modular-studio 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{graphPopulator-DH0qM1Fu.js → graphPopulator-B3rQxb5A.js} +1 -1
- package/dist/assets/index-BA_J-aHx.js +686 -0
- package/dist/assets/index-C7vpqKVZ.css +1 -0
- package/dist/assets/{jszip.min-DByyLalk.js → jszip.min-BK6ZQWkj.js} +1 -1
- package/dist/index.html +2 -2
- package/dist-server/server/data/mcp-tokens.json +3 -3
- package/dist-server/server/index.d.ts.map +1 -1
- package/dist-server/server/index.js +10 -0
- package/dist-server/server/index.js.map +1 -1
- package/dist-server/server/routes/embeddings.d.ts.map +1 -1
- package/dist-server/server/routes/embeddings.js +16 -1
- package/dist-server/server/routes/embeddings.js.map +1 -1
- package/dist-server/server/routes/health.d.ts.map +1 -1
- package/dist-server/server/routes/health.js +10 -1
- package/dist-server/server/routes/health.js.map +1 -1
- package/dist-server/server/routes/skills-search.d.ts.map +1 -1
- package/dist-server/server/routes/skills-search.js +6 -1
- package/dist-server/server/routes/skills-search.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/index-B0RRTCSi.css +0 -1
- package/dist/assets/index-LWCi_4Hu.js +0 -662
|
@@ -0,0 +1,686 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var A7=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hf={exports:{}},ws={};var rb;function JE(){if(rb)return ws;rb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,s){var l=null;if(s!==void 0&&(l=""+s),i.key!==void 0&&(l=""+i.key),"key"in i){s={};for(var u in i)u!=="key"&&(s[u]=i[u])}else s=i;return i=s.ref,{$$typeof:e,type:r,key:l,ref:i!==void 0?i:null,props:s}}return ws.Fragment=t,ws.jsx=n,ws.jsxs=n,ws}var ab;function eM(){return ab||(ab=1,Hf.exports=JE()),Hf.exports}var d=eM(),Uf={exports:{}},Re={};var ib;function tM(){if(ib)return Re;ib=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function y(F){return F===null||typeof F!="object"?null:(F=b&&F[b]||F["@@iterator"],typeof F=="function"?F:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,E={};function C(F,L,z){this.props=F,this.context=L,this.refs=E,this.updater=z||v}C.prototype.isReactComponent={},C.prototype.setState=function(F,L){if(typeof F!="object"&&typeof F!="function"&&F!=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,F,L,"setState")},C.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function M(){}M.prototype=C.prototype;function S(F,L,z){this.props=F,this.context=L,this.refs=E,this.updater=z||v}var N=S.prototype=new M;N.constructor=S,w(N,C.prototype),N.isPureReactComponent=!0;var R=Array.isArray;function T(){}var D={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function V(F,L,z){var W=z.ref;return{$$typeof:e,type:F,key:L,ref:W!==void 0?W:null,props:z}}function B(F,L){return V(F.type,L,F.props)}function O(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function Y(F){var L={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(z){return L[z]})}var Z=/\/+/g;function U(F,L){return typeof F=="object"&&F!==null&&F.key!=null?Y(""+F.key):L.toString(36)}function _(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(T,T):(F.status="pending",F.then(function(L){F.status==="pending"&&(F.status="fulfilled",F.value=L)},function(L){F.status==="pending"&&(F.status="rejected",F.reason=L)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function A(F,L,z,W,ae){var le=typeof F;(le==="undefined"||le==="boolean")&&(F=null);var me=!1;if(F===null)me=!0;else switch(le){case"bigint":case"string":case"number":me=!0;break;case"object":switch(F.$$typeof){case e:case t:me=!0;break;case h:return me=F._init,A(me(F._payload),L,z,W,ae)}}if(me)return ae=ae(F),me=W===""?"."+U(F,0):W,R(ae)?(z="",me!=null&&(z=me.replace(Z,"$&/")+"/"),A(ae,L,z,"",function(be){return be})):ae!=null&&(O(ae)&&(ae=B(ae,z+(ae.key==null||F&&F.key===ae.key?"":(""+ae.key).replace(Z,"$&/")+"/")+me)),L.push(ae)),1;me=0;var G=W===""?".":W+":";if(R(F))for(var ce=0;ce<F.length;ce++)W=F[ce],le=G+U(W,ce),me+=A(W,L,z,le,ae);else if(ce=y(F),typeof ce=="function")for(F=ce.call(F),ce=0;!(W=F.next()).done;)W=W.value,le=G+U(W,ce++),me+=A(W,L,z,le,ae);else if(le==="object"){if(typeof F.then=="function")return A(_(F),L,z,W,ae);throw L=String(F),Error("Objects are not valid as a React child (found: "+(L==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":L)+"). If you meant to render a collection of children, use an array instead.")}return me}function q(F,L,z){if(F==null)return F;var W=[],ae=0;return A(F,W,"","",function(le){return L.call(z,le,ae++)}),W}function K(F){if(F._status===-1){var L=F._result;L=L(),L.then(function(z){(F._status===0||F._status===-1)&&(F._status=1,F._result=z)},function(z){(F._status===0||F._status===-1)&&(F._status=2,F._result=z)}),F._status===-1&&(F._status=0,F._result=L)}if(F._status===1)return F._result.default;throw F._result}var Q=typeof reportError=="function"?reportError:function(F){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var L=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof F=="object"&&F!==null&&typeof F.message=="string"?String(F.message):String(F),error:F});if(!window.dispatchEvent(L))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",F);return}console.error(F)},I={map:q,forEach:function(F,L,z){q(F,function(){L.apply(this,arguments)},z)},count:function(F){var L=0;return q(F,function(){L++}),L},toArray:function(F){return q(F,function(L){return L})||[]},only:function(F){if(!O(F))throw Error("React.Children.only expected to receive a single React element child.");return F}};return Re.Activity=g,Re.Children=I,Re.Component=C,Re.Fragment=n,Re.Profiler=i,Re.PureComponent=S,Re.StrictMode=r,Re.Suspense=f,Re.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Re.__COMPILER_RUNTIME={__proto__:null,c:function(F){return D.H.useMemoCache(F)}},Re.cache=function(F){return function(){return F.apply(null,arguments)}},Re.cacheSignal=function(){return null},Re.cloneElement=function(F,L,z){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var W=w({},F.props),ae=F.key;if(L!=null)for(le in L.key!==void 0&&(ae=""+L.key),L)!H.call(L,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&L.ref===void 0||(W[le]=L[le]);var le=arguments.length-2;if(le===1)W.children=z;else if(1<le){for(var me=Array(le),G=0;G<le;G++)me[G]=arguments[G+2];W.children=me}return V(F.type,ae,W)},Re.createContext=function(F){return F={$$typeof:l,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null},F.Provider=F,F.Consumer={$$typeof:s,_context:F},F},Re.createElement=function(F,L,z){var W,ae={},le=null;if(L!=null)for(W in L.key!==void 0&&(le=""+L.key),L)H.call(L,W)&&W!=="key"&&W!=="__self"&&W!=="__source"&&(ae[W]=L[W]);var me=arguments.length-2;if(me===1)ae.children=z;else if(1<me){for(var G=Array(me),ce=0;ce<me;ce++)G[ce]=arguments[ce+2];ae.children=G}if(F&&F.defaultProps)for(W in me=F.defaultProps,me)ae[W]===void 0&&(ae[W]=me[W]);return V(F,le,ae)},Re.createRef=function(){return{current:null}},Re.forwardRef=function(F){return{$$typeof:u,render:F}},Re.isValidElement=O,Re.lazy=function(F){return{$$typeof:h,_payload:{_status:-1,_result:F},_init:K}},Re.memo=function(F,L){return{$$typeof:m,type:F,compare:L===void 0?null:L}},Re.startTransition=function(F){var L=D.T,z={};D.T=z;try{var W=F(),ae=D.S;ae!==null&&ae(z,W),typeof W=="object"&&W!==null&&typeof W.then=="function"&&W.then(T,Q)}catch(le){Q(le)}finally{L!==null&&z.types!==null&&(L.types=z.types),D.T=L}},Re.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Re.use=function(F){return D.H.use(F)},Re.useActionState=function(F,L,z){return D.H.useActionState(F,L,z)},Re.useCallback=function(F,L){return D.H.useCallback(F,L)},Re.useContext=function(F){return D.H.useContext(F)},Re.useDebugValue=function(){},Re.useDeferredValue=function(F,L){return D.H.useDeferredValue(F,L)},Re.useEffect=function(F,L){return D.H.useEffect(F,L)},Re.useEffectEvent=function(F){return D.H.useEffectEvent(F)},Re.useId=function(){return D.H.useId()},Re.useImperativeHandle=function(F,L,z){return D.H.useImperativeHandle(F,L,z)},Re.useInsertionEffect=function(F,L){return D.H.useInsertionEffect(F,L)},Re.useLayoutEffect=function(F,L){return D.H.useLayoutEffect(F,L)},Re.useMemo=function(F,L){return D.H.useMemo(F,L)},Re.useOptimistic=function(F,L){return D.H.useOptimistic(F,L)},Re.useReducer=function(F,L,z){return D.H.useReducer(F,L,z)},Re.useRef=function(F){return D.H.useRef(F)},Re.useState=function(F){return D.H.useState(F)},Re.useSyncExternalStore=function(F,L,z){return D.H.useSyncExternalStore(F,L,z)},Re.useTransition=function(){return D.H.useTransition()},Re.version="19.2.4",Re}var sb;function fl(){return sb||(sb=1,Uf.exports=tM()),Uf.exports}var $=fl();const Rs=Qu($);var qf={exports:{}},Ss={},Gf={exports:{}},Kf={};var lb;function nM(){return lb||(lb=1,(function(e){function t(A,q){var K=A.length;A.push(q);e:for(;0<K;){var Q=K-1>>>1,I=A[Q];if(0<i(I,q))A[Q]=q,A[K]=I,K=Q;else break e}}function n(A){return A.length===0?null:A[0]}function r(A){if(A.length===0)return null;var q=A[0],K=A.pop();if(K!==q){A[0]=K;e:for(var Q=0,I=A.length,F=I>>>1;Q<F;){var L=2*(Q+1)-1,z=A[L],W=L+1,ae=A[W];if(0>i(z,K))W<I&&0>i(ae,z)?(A[Q]=ae,A[W]=K,Q=W):(A[Q]=z,A[L]=K,Q=L);else if(W<I&&0>i(ae,K))A[Q]=ae,A[W]=K,Q=W;else break e}}return q}function i(A,q){var K=A.sortIndex-q.sortIndex;return K!==0?K:A.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var f=[],m=[],h=1,g=null,b=3,y=!1,v=!1,w=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function N(A){for(var q=n(m);q!==null;){if(q.callback===null)r(m);else if(q.startTime<=A)r(m),q.sortIndex=q.expirationTime,t(f,q);else break;q=n(m)}}function R(A){if(w=!1,N(A),!v)if(n(f)!==null)v=!0,T||(T=!0,Y());else{var q=n(m);q!==null&&_(R,q.startTime-A)}}var T=!1,D=-1,H=5,V=-1;function B(){return E?!0:!(e.unstable_now()-V<H)}function O(){if(E=!1,T){var A=e.unstable_now();V=A;var q=!0;try{e:{v=!1,w&&(w=!1,M(D),D=-1),y=!0;var K=b;try{t:{for(N(A),g=n(f);g!==null&&!(g.expirationTime>A&&B());){var Q=g.callback;if(typeof Q=="function"){g.callback=null,b=g.priorityLevel;var I=Q(g.expirationTime<=A);if(A=e.unstable_now(),typeof I=="function"){g.callback=I,N(A),q=!0;break t}g===n(f)&&r(f),N(A)}else r(f);g=n(f)}if(g!==null)q=!0;else{var F=n(m);F!==null&&_(R,F.startTime-A),q=!1}}break e}finally{g=null,b=K,y=!1}q=void 0}}finally{q?Y():T=!1}}}var Y;if(typeof S=="function")Y=function(){S(O)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,U=Z.port2;Z.port1.onmessage=O,Y=function(){U.postMessage(null)}}else Y=function(){C(O,0)};function _(A,q){D=C(function(){A(e.unstable_now())},q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(A){switch(b){case 1:case 2:case 3:var q=3;break;default:q=b}var K=b;b=q;try{return A()}finally{b=K}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(A,q){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var K=b;b=A;try{return q()}finally{b=K}},e.unstable_scheduleCallback=function(A,q,K){var Q=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?Q+K:Q):K=Q,A){case 1:var I=-1;break;case 2:I=250;break;case 5:I=1073741823;break;case 4:I=1e4;break;default:I=5e3}return I=K+I,A={id:h++,callback:q,priorityLevel:A,startTime:K,expirationTime:I,sortIndex:-1},K>Q?(A.sortIndex=K,t(m,A),n(f)===null&&A===n(m)&&(w?(M(D),D=-1):w=!0,_(R,K-Q))):(A.sortIndex=I,t(f,A),v||y||(v=!0,T||(T=!0,Y()))),A},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(A){var q=b;return function(){var K=b;b=q;try{return A.apply(this,arguments)}finally{b=K}}}})(Kf)),Kf}var cb;function oM(){return cb||(cb=1,Gf.exports=nM()),Gf.exports}var Vf={exports:{}},Vt={};var ub;function rM(){if(ub)return Vt;ub=1;var e=fl();function t(f){var m="https://react.dev/errors/"+f;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)m+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+f+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(f,m,h){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:g==null?null:""+g,children:f,containerInfo:m,implementation:h}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(f,m){if(f==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Vt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Vt.createPortal=function(f,m){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return s(f,m,null,h)},Vt.flushSync=function(f){var m=l.T,h=r.p;try{if(l.T=null,r.p=2,f)return f()}finally{l.T=m,r.p=h,r.d.f()}},Vt.preconnect=function(f,m){typeof f=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(f,m))},Vt.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},Vt.preinit=function(f,m){if(typeof f=="string"&&m&&typeof m.as=="string"){var h=m.as,g=u(h,m.crossOrigin),b=typeof m.integrity=="string"?m.integrity:void 0,y=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;h==="style"?r.d.S(f,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:y}):h==="script"&&r.d.X(f,{crossOrigin:g,integrity:b,fetchPriority:y,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Vt.preinitModule=function(f,m){if(typeof f=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var h=u(m.as,m.crossOrigin);r.d.M(f,{crossOrigin:h,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(f)},Vt.preload=function(f,m){if(typeof f=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var h=m.as,g=u(h,m.crossOrigin);r.d.L(f,h,{crossOrigin:g,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})}},Vt.preloadModule=function(f,m){if(typeof f=="string")if(m){var h=u(m.as,m.crossOrigin);r.d.m(f,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:h,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(f)},Vt.requestFormReset=function(f){r.d.r(f)},Vt.unstable_batchedUpdates=function(f,m){return f(m)},Vt.useFormState=function(f,m,h){return l.H.useFormState(f,m,h)},Vt.useFormStatus=function(){return l.H.useHostTransitionStatus()},Vt.version="19.2.4",Vt}var db;function Kk(){if(db)return Vf.exports;db=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Vf.exports=rM(),Vf.exports}var pb;function aM(){if(pb)return Ss;pb=1;var e=oM(),t=fl(),n=Kk();function r(o){var a="https://react.dev/errors/"+o;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+o+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var a=o,c=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(c=a.return),o=a.return;while(o)}return a.tag===3?c:null}function l(o){if(o.tag===13){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function u(o){if(o.tag===31){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function f(o){if(s(o)!==o)throw Error(r(188))}function m(o){var a=o.alternate;if(!a){if(a=s(o),a===null)throw Error(r(188));return a!==o?null:o}for(var c=o,p=a;;){var x=c.return;if(x===null)break;var k=x.alternate;if(k===null){if(p=x.return,p!==null){c=p;continue}break}if(x.child===k.child){for(k=x.child;k;){if(k===c)return f(x),o;if(k===p)return f(x),a;k=k.sibling}throw Error(r(188))}if(c.return!==p.return)c=x,p=k;else{for(var j=!1,P=x.child;P;){if(P===c){j=!0,c=x,p=k;break}if(P===p){j=!0,p=x,c=k;break}P=P.sibling}if(!j){for(P=k.child;P;){if(P===c){j=!0,c=k,p=x;break}if(P===p){j=!0,p=k,c=x;break}P=P.sibling}if(!j)throw Error(r(189))}}if(c.alternate!==p)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?o:a}function h(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o;for(o=o.child;o!==null;){if(a=h(o),a!==null)return a;o=o.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),S=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),O=Symbol.iterator;function Y(o){return o===null||typeof o!="object"?null:(o=O&&o[O]||o["@@iterator"],typeof o=="function"?o:null)}var Z=Symbol.for("react.client.reference");function U(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===Z?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case w:return"Fragment";case C:return"Profiler";case E:return"StrictMode";case R:return"Suspense";case T:return"SuspenseList";case V:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case v:return"Portal";case S:return o.displayName||"Context";case M:return(o._context.displayName||"Context")+".Consumer";case N:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case D:return a=o.displayName||null,a!==null?a:U(o.type)||"Memo";case H:a=o._payload,o=o._init;try{return U(o(a))}catch{}}return null}var _=Array.isArray,A=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},Q=[],I=-1;function F(o){return{current:o}}function L(o){0>I||(o.current=Q[I],Q[I]=null,I--)}function z(o,a){I++,Q[I]=o.current,o.current=a}var W=F(null),ae=F(null),le=F(null),me=F(null);function G(o,a){switch(z(le,a),z(ae,o),z(W,null),a.nodeType){case 9:case 11:o=(o=a.documentElement)&&(o=o.namespaceURI)?T0(o):0;break;default:if(o=a.tagName,a=a.namespaceURI)a=T0(a),o=j0(a,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}L(W),z(W,o)}function ce(){L(W),L(ae),L(le)}function be(o){o.memoizedState!==null&&z(me,o);var a=W.current,c=j0(a,o.type);a!==c&&(z(ae,o),z(W,c))}function we(o){ae.current===o&&(L(W),L(ae)),me.current===o&&(L(me),xs._currentValue=K)}var ve,ke;function De(o){if(ve===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);ve=a&&a[1]||"",ke=-1<c.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+ve+o+ke}var oe=!1;function xe(o,a){if(!o||oe)return"";oe=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(a){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(se){var re=se}Reflect.construct(o,[],fe)}else{try{fe.call()}catch(se){re=se}o.call(fe.prototype)}}else{try{throw Error()}catch(se){re=se}(fe=o())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(se){if(se&&re&&typeof se.stack=="string")return[se.stack,re.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=p.DetermineComponentFrameRoot(),j=k[0],P=k[1];if(j&&P){var X=j.split(`
|
|
4
|
+
`),ne=P.split(`
|
|
5
|
+
`);for(x=p=0;p<X.length&&!X[p].includes("DetermineComponentFrameRoot");)p++;for(;x<ne.length&&!ne[x].includes("DetermineComponentFrameRoot");)x++;if(p===X.length||x===ne.length)for(p=X.length-1,x=ne.length-1;1<=p&&0<=x&&X[p]!==ne[x];)x--;for(;1<=p&&0<=x;p--,x--)if(X[p]!==ne[x]){if(p!==1||x!==1)do if(p--,x--,0>x||X[p]!==ne[x]){var de=`
|
|
6
|
+
`+X[p].replace(" at new "," at ");return o.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",o.displayName)),de}while(1<=p&&0<=x);break}}}finally{oe=!1,Error.prepareStackTrace=c}return(c=o?o.displayName||o.name:"")?De(c):""}function Oe(o,a){switch(o.tag){case 26:case 27:case 5:return De(o.type);case 16:return De("Lazy");case 13:return o.child!==a&&a!==null?De("Suspense Fallback"):De("Suspense");case 19:return De("SuspenseList");case 0:case 15:return xe(o.type,!1);case 11:return xe(o.type.render,!1);case 1:return xe(o.type,!0);case 31:return De("Activity");default:return""}}function wt(o){try{var a="",c=null;do a+=Oe(o,c),c=o,o=o.return;while(o);return a}catch(p){return`
|
|
7
|
+
Error generating stack: `+p.message+`
|
|
8
|
+
`+p.stack}}var ht=Object.prototype.hasOwnProperty,St=e.unstable_scheduleCallback,hn=e.unstable_cancelCallback,en=e.unstable_shouldYield,gn=e.unstable_requestPaint,_t=e.unstable_now,Vo=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,ye=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,Le=e.unstable_LowPriority,Ke=e.unstable_IdlePriority,Zt=e.log,Un=e.unstable_setDisableYieldValue,Lt=null,xt=null;function Gt(o){if(typeof Zt=="function"&&Un(o),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(Lt,o)}catch{}}var Qe=Math.clz32?Math.clz32:Ad,to=Math.log,yn=Math.LN2;function Ad(o){return o>>>=0,o===0?32:31-(to(o)/yn|0)|0}var xa=256,ba=262144,ka=4194304;function yo(o){var a=o&42;if(a!==0)return a;switch(o&-o){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 o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function va(o,a,c){var p=o.pendingLanes;if(p===0)return 0;var x=0,k=o.suspendedLanes,j=o.pingedLanes;o=o.warmLanes;var P=p&134217727;return P!==0?(p=P&~k,p!==0?x=yo(p):(j&=P,j!==0?x=yo(j):c||(c=P&~o,c!==0&&(x=yo(c))))):(P=p&~k,P!==0?x=yo(P):j!==0?x=yo(j):c||(c=p&~o,c!==0&&(x=yo(c)))),x===0?0:a!==0&&a!==x&&(a&k)===0&&(k=x&-x,c=a&-a,k>=c||k===32&&(c&4194048)!==0)?a:x}function zr(o,a){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&a)===0}function Nd(o,a){switch(o){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Nl(){var o=ka;return ka<<=1,(ka&62914560)===0&&(ka=4194304),o}function Ai(o){for(var a=[],c=0;31>c;c++)a.push(o);return a}function Rr(o,a){o.pendingLanes|=a,a!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function _d(o,a,c,p,x,k){var j=o.pendingLanes;o.pendingLanes=c,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=c,o.entangledLanes&=c,o.errorRecoveryDisabledLanes&=c,o.shellSuspendCounter=0;var P=o.entanglements,X=o.expirationTimes,ne=o.hiddenUpdates;for(c=j&~c;0<c;){var de=31-Qe(c),fe=1<<de;P[de]=0,X[de]=-1;var re=ne[de];if(re!==null)for(ne[de]=null,de=0;de<re.length;de++){var se=re[de];se!==null&&(se.lane&=-536870913)}c&=~fe}p!==0&&_l(o,p,0),k!==0&&x===0&&o.tag!==0&&(o.suspendedLanes|=k&~(j&~a))}function _l(o,a,c){o.pendingLanes|=a,o.suspendedLanes&=~a;var p=31-Qe(a);o.entangledLanes|=a,o.entanglements[p]=o.entanglements[p]|1073741824|c&261930}function Dl(o,a){var c=o.entangledLanes|=a;for(o=o.entanglements;c;){var p=31-Qe(c),x=1<<p;x&a|o[p]&a&&(o[p]|=a),c&=~x}}function zl(o,a){var c=a&-a;return c=(c&42)!==0?1:Ni(c),(c&(o.suspendedLanes|a))!==0?0:c}function Ni(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function _i(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function Rl(){var o=q.p;return o!==0?o:(o=window.event,o===void 0?32:Z0(o.type))}function Ol(o,a){var c=q.p;try{return q.p=o,a()}finally{q.p=c}}var no=Math.random().toString(36).slice(2),Dt="__reactFiber$"+no,Kt="__reactProps$"+no,xo="__reactContainer$"+no,wa="__reactEvents$"+no,Il="__reactListeners$"+no,Dd="__reactHandles$"+no,Fl="__reactResources$"+no,Or="__reactMarker$"+no;function Di(o){delete o[Dt],delete o[Kt],delete o[wa],delete o[Il],delete o[Dd]}function Yo(o){var a=o[Dt];if(a)return a;for(var c=o.parentNode;c;){if(a=c[xo]||c[Dt]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(o=O0(o);o!==null;){if(c=o[Dt])return c;o=O0(o)}return a}o=c,c=o.parentNode}return null}function Wo(o){if(o=o[Dt]||o[xo]){var a=o.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return o}return null}function Xo(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o.stateNode;throw Error(r(33))}function Zo(o){var a=o[Fl];return a||(a=o[Fl]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Ct(o){o[Or]=!0}var $l=new Set,Ll={};function bo(o,a){Qo(o,a),Qo(o+"Capture",a)}function Qo(o,a){for(Ll[o]=a,o=0;o<a.length;o++)$l.add(a[o])}var zd=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]*$"),zi={},Pl={};function Rd(o){return ht.call(Pl,o)?!0:ht.call(zi,o)?!1:zd.test(o)?Pl[o]=!0:(zi[o]=!0,!1)}function Sa(o,a,c){if(Rd(a))if(c===null)o.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":o.removeAttribute(a);return;case"boolean":var p=a.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){o.removeAttribute(a);return}}o.setAttribute(a,""+c)}}function Ca(o,a,c){if(c===null)o.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(a);return}o.setAttribute(a,""+c)}}function qn(o,a,c,p){if(p===null)o.removeAttribute(c);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(c);return}o.setAttributeNS(a,c,""+p)}}function tn(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Bl(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Od(o,a,c){var p=Object.getOwnPropertyDescriptor(o.constructor.prototype,a);if(!o.hasOwnProperty(a)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var x=p.get,k=p.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return x.call(this)},set:function(j){c=""+j,k.call(this,j)}}),Object.defineProperty(o,a,{enumerable:p.enumerable}),{getValue:function(){return c},setValue:function(j){c=""+j},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function Ea(o){if(!o._valueTracker){var a=Bl(o)?"checked":"value";o._valueTracker=Od(o,a,""+o[a])}}function Hl(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var c=a.getValue(),p="";return o&&(p=Bl(o)?o.checked?"true":"false":o.value),o=p,o!==c?(a.setValue(o),!0):!1}function Ir(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var Id=/[\n"\\]/g;function nn(o){return o.replace(Id,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Fr(o,a,c,p,x,k,j,P){o.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?o.type=j:o.removeAttribute("type"),a!=null?j==="number"?(a===0&&o.value===""||o.value!=a)&&(o.value=""+tn(a)):o.value!==""+tn(a)&&(o.value=""+tn(a)):j!=="submit"&&j!=="reset"||o.removeAttribute("value"),a!=null?Ri(o,j,tn(a)):c!=null?Ri(o,j,tn(c)):p!=null&&o.removeAttribute("value"),x==null&&k!=null&&(o.defaultChecked=!!k),x!=null&&(o.checked=x&&typeof x!="function"&&typeof x!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?o.name=""+tn(P):o.removeAttribute("name")}function Ul(o,a,c,p,x,k,j,P){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(o.type=k),a!=null||c!=null){if(!(k!=="submit"&&k!=="reset"||a!=null)){Ea(o);return}c=c!=null?""+tn(c):"",a=a!=null?""+tn(a):c,P||a===o.value||(o.value=a),o.defaultValue=a}p=p??x,p=typeof p!="function"&&typeof p!="symbol"&&!!p,o.checked=P?o.checked:!!p,o.defaultChecked=!!p,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(o.name=j),Ea(o)}function Ri(o,a,c){a==="number"&&Ir(o.ownerDocument)===o||o.defaultValue===""+c||(o.defaultValue=""+c)}function ko(o,a,c,p){if(o=o.options,a){a={};for(var x=0;x<c.length;x++)a["$"+c[x]]=!0;for(c=0;c<o.length;c++)x=a.hasOwnProperty("$"+o[c].value),o[c].selected!==x&&(o[c].selected=x),x&&p&&(o[c].defaultSelected=!0)}else{for(c=""+tn(c),a=null,x=0;x<o.length;x++){if(o[x].value===c){o[x].selected=!0,p&&(o[x].defaultSelected=!0);return}a!==null||o[x].disabled||(a=o[x])}a!==null&&(a.selected=!0)}}function wg(o,a,c){if(a!=null&&(a=""+tn(a),a!==o.value&&(o.value=a),c==null)){o.defaultValue!==a&&(o.defaultValue=a);return}o.defaultValue=c!=null?""+tn(c):""}function Sg(o,a,c,p){if(a==null){if(p!=null){if(c!=null)throw Error(r(92));if(_(p)){if(1<p.length)throw Error(r(93));p=p[0]}c=p}c==null&&(c=""),a=c}c=tn(a),o.defaultValue=c,p=o.textContent,p===c&&p!==""&&p!==null&&(o.value=p),Ea(o)}function Ma(o,a){if(a){var c=o.firstChild;if(c&&c===o.lastChild&&c.nodeType===3){c.nodeValue=a;return}}o.textContent=a}var Y2=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 Cg(o,a,c){var p=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?p?o.setProperty(a,""):a==="float"?o.cssFloat="":o[a]="":p?o.setProperty(a,c):typeof c!="number"||c===0||Y2.has(a)?a==="float"?o.cssFloat=c:o[a]=(""+c).trim():o[a]=c+"px"}function Eg(o,a,c){if(a!=null&&typeof a!="object")throw Error(r(62));if(o=o.style,c!=null){for(var p in c)!c.hasOwnProperty(p)||a!=null&&a.hasOwnProperty(p)||(p.indexOf("--")===0?o.setProperty(p,""):p==="float"?o.cssFloat="":o[p]="");for(var x in a)p=a[x],a.hasOwnProperty(x)&&c[x]!==p&&Cg(o,x,p)}else for(var k in a)a.hasOwnProperty(k)&&Cg(o,k,a[k])}function Fd(o){if(o.indexOf("-")===-1)return!1;switch(o){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 W2=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"]]),X2=/^[\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 ql(o){return X2.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function vo(){}var $d=null;function Ld(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Ta=null,ja=null;function Mg(o){var a=Wo(o);if(a&&(o=a.stateNode)){var c=o[Kt]||null;e:switch(o=a.stateNode,a.type){case"input":if(Fr(o,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=o;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+nn(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var p=c[a];if(p!==o&&p.form===o.form){var x=p[Kt]||null;if(!x)throw Error(r(90));Fr(p,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(a=0;a<c.length;a++)p=c[a],p.form===o.form&&Hl(p)}break e;case"textarea":wg(o,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&ko(o,!!c.multiple,a,!1)}}}var Pd=!1;function Tg(o,a,c){if(Pd)return o(a,c);Pd=!0;try{var p=o(a);return p}finally{if(Pd=!1,(Ta!==null||ja!==null)&&(_c(),Ta&&(a=Ta,o=ja,ja=Ta=null,Mg(a),o)))for(a=0;a<o.length;a++)Mg(o[a])}}function Oi(o,a){var c=o.stateNode;if(c===null)return null;var p=c[Kt]||null;if(p===null)return null;c=p[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(o=o.type,p=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!p;break e;default:o=!1}if(o)return null;if(c&&typeof c!="function")throw Error(r(231,a,typeof c));return c}var wo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bd=!1;if(wo)try{var Ii={};Object.defineProperty(Ii,"passive",{get:function(){Bd=!0}}),window.addEventListener("test",Ii,Ii),window.removeEventListener("test",Ii,Ii)}catch{Bd=!1}var Jo=null,Hd=null,Gl=null;function jg(){if(Gl)return Gl;var o,a=Hd,c=a.length,p,x="value"in Jo?Jo.value:Jo.textContent,k=x.length;for(o=0;o<c&&a[o]===x[o];o++);var j=c-o;for(p=1;p<=j&&a[c-p]===x[k-p];p++);return Gl=x.slice(o,1<p?1-p:void 0)}function Kl(o){var a=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&a===13&&(o=13)):o=a,o===10&&(o=13),32<=o||o===13?o:0}function Vl(){return!0}function Ag(){return!1}function on(o){function a(c,p,x,k,j){this._reactName=c,this._targetInst=x,this.type=p,this.nativeEvent=k,this.target=j,this.currentTarget=null;for(var P in o)o.hasOwnProperty(P)&&(c=o[P],this[P]=c?c(k):k[P]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?Vl:Ag,this.isPropagationStopped=Ag,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Vl)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Vl)},persist:function(){},isPersistent:Vl}),a}var $r={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yl=on($r),Fi=g({},$r,{view:0,detail:0}),Z2=on(Fi),Ud,qd,$i,Wl=g({},Fi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Kd,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==$i&&($i&&o.type==="mousemove"?(Ud=o.screenX-$i.screenX,qd=o.screenY-$i.screenY):qd=Ud=0,$i=o),Ud)},movementY:function(o){return"movementY"in o?o.movementY:qd}}),Ng=on(Wl),Q2=g({},Wl,{dataTransfer:0}),J2=on(Q2),eC=g({},Fi,{relatedTarget:0}),Gd=on(eC),tC=g({},$r,{animationName:0,elapsedTime:0,pseudoElement:0}),nC=on(tC),oC=g({},$r,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),rC=on(oC),aC=g({},$r,{data:0}),_g=on(aC),iC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sC={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"},lC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cC(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=lC[o])?!!a[o]:!1}function Kd(){return cC}var uC=g({},Fi,{key:function(o){if(o.key){var a=iC[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=Kl(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?sC[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Kd,charCode:function(o){return o.type==="keypress"?Kl(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Kl(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),dC=on(uC),pC=g({},Wl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Dg=on(pC),fC=g({},Fi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Kd}),mC=on(fC),hC=g({},$r,{propertyName:0,elapsedTime:0,pseudoElement:0}),gC=on(hC),yC=g({},Wl,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),xC=on(yC),bC=g({},$r,{newState:0,oldState:0}),kC=on(bC),vC=[9,13,27,32],Vd=wo&&"CompositionEvent"in window,Li=null;wo&&"documentMode"in document&&(Li=document.documentMode);var wC=wo&&"TextEvent"in window&&!Li,zg=wo&&(!Vd||Li&&8<Li&&11>=Li),Rg=" ",Og=!1;function Ig(o,a){switch(o){case"keyup":return vC.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fg(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Aa=!1;function SC(o,a){switch(o){case"compositionend":return Fg(a);case"keypress":return a.which!==32?null:(Og=!0,Rg);case"textInput":return o=a.data,o===Rg&&Og?null:o;default:return null}}function CC(o,a){if(Aa)return o==="compositionend"||!Vd&&Ig(o,a)?(o=jg(),Gl=Hd=Jo=null,Aa=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return zg&&a.locale!=="ko"?null:a.data;default:return null}}var EC={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 $g(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!EC[o.type]:a==="textarea"}function Lg(o,a,c,p){Ta?ja?ja.push(p):ja=[p]:Ta=p,a=$c(a,"onChange"),0<a.length&&(c=new Yl("onChange","change",null,c,p),o.push({event:c,listeners:a}))}var Pi=null,Bi=null;function MC(o){v0(o,0)}function Xl(o){var a=Xo(o);if(Hl(a))return o}function Pg(o,a){if(o==="change")return a}var Bg=!1;if(wo){var Yd;if(wo){var Wd="oninput"in document;if(!Wd){var Hg=document.createElement("div");Hg.setAttribute("oninput","return;"),Wd=typeof Hg.oninput=="function"}Yd=Wd}else Yd=!1;Bg=Yd&&(!document.documentMode||9<document.documentMode)}function Ug(){Pi&&(Pi.detachEvent("onpropertychange",qg),Bi=Pi=null)}function qg(o){if(o.propertyName==="value"&&Xl(Bi)){var a=[];Lg(a,Bi,o,Ld(o)),Tg(MC,a)}}function TC(o,a,c){o==="focusin"?(Ug(),Pi=a,Bi=c,Pi.attachEvent("onpropertychange",qg)):o==="focusout"&&Ug()}function jC(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Xl(Bi)}function AC(o,a){if(o==="click")return Xl(a)}function NC(o,a){if(o==="input"||o==="change")return Xl(a)}function _C(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var xn=typeof Object.is=="function"?Object.is:_C;function Hi(o,a){if(xn(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var c=Object.keys(o),p=Object.keys(a);if(c.length!==p.length)return!1;for(p=0;p<c.length;p++){var x=c[p];if(!ht.call(a,x)||!xn(o[x],a[x]))return!1}return!0}function Gg(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Kg(o,a){var c=Gg(o);o=0;for(var p;c;){if(c.nodeType===3){if(p=o+c.textContent.length,o<=a&&p>=a)return{node:c,offset:a-o};o=p}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Gg(c)}}function Vg(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?Vg(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function Yg(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var a=Ir(o.document);a instanceof o.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)o=a.contentWindow;else break;a=Ir(o.document)}return a}function Xd(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a&&(a==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||a==="textarea"||o.contentEditable==="true")}var DC=wo&&"documentMode"in document&&11>=document.documentMode,Na=null,Zd=null,Ui=null,Qd=!1;function Wg(o,a,c){var p=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Qd||Na==null||Na!==Ir(p)||(p=Na,"selectionStart"in p&&Xd(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Ui&&Hi(Ui,p)||(Ui=p,p=$c(Zd,"onSelect"),0<p.length&&(a=new Yl("onSelect","select",null,a,c),o.push({event:a,listeners:p}),a.target=Na)))}function Lr(o,a){var c={};return c[o.toLowerCase()]=a.toLowerCase(),c["Webkit"+o]="webkit"+a,c["Moz"+o]="moz"+a,c}var _a={animationend:Lr("Animation","AnimationEnd"),animationiteration:Lr("Animation","AnimationIteration"),animationstart:Lr("Animation","AnimationStart"),transitionrun:Lr("Transition","TransitionRun"),transitionstart:Lr("Transition","TransitionStart"),transitioncancel:Lr("Transition","TransitionCancel"),transitionend:Lr("Transition","TransitionEnd")},Jd={},Xg={};wo&&(Xg=document.createElement("div").style,"AnimationEvent"in window||(delete _a.animationend.animation,delete _a.animationiteration.animation,delete _a.animationstart.animation),"TransitionEvent"in window||delete _a.transitionend.transition);function Pr(o){if(Jd[o])return Jd[o];if(!_a[o])return o;var a=_a[o],c;for(c in a)if(a.hasOwnProperty(c)&&c in Xg)return Jd[o]=a[c];return o}var Zg=Pr("animationend"),Qg=Pr("animationiteration"),Jg=Pr("animationstart"),zC=Pr("transitionrun"),RC=Pr("transitionstart"),OC=Pr("transitioncancel"),ey=Pr("transitionend"),ty=new Map,ep="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(" ");ep.push("scrollEnd");function Gn(o,a){ty.set(o,a),bo(a,[o])}var Zl=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},An=[],Da=0,tp=0;function Ql(){for(var o=Da,a=tp=Da=0;a<o;){var c=An[a];An[a++]=null;var p=An[a];An[a++]=null;var x=An[a];An[a++]=null;var k=An[a];if(An[a++]=null,p!==null&&x!==null){var j=p.pending;j===null?x.next=x:(x.next=j.next,j.next=x),p.pending=x}k!==0&&ny(c,x,k)}}function Jl(o,a,c,p){An[Da++]=o,An[Da++]=a,An[Da++]=c,An[Da++]=p,tp|=p,o.lanes|=p,o=o.alternate,o!==null&&(o.lanes|=p)}function np(o,a,c,p){return Jl(o,a,c,p),ec(o)}function Br(o,a){return Jl(o,null,null,a),ec(o)}function ny(o,a,c){o.lanes|=c;var p=o.alternate;p!==null&&(p.lanes|=c);for(var x=!1,k=o.return;k!==null;)k.childLanes|=c,p=k.alternate,p!==null&&(p.childLanes|=c),k.tag===22&&(o=k.stateNode,o===null||o._visibility&1||(x=!0)),o=k,k=k.return;return o.tag===3?(k=o.stateNode,x&&a!==null&&(x=31-Qe(c),o=k.hiddenUpdates,p=o[x],p===null?o[x]=[a]:p.push(a),a.lane=c|536870912),k):null}function ec(o){if(50<ds)throw ds=0,pf=null,Error(r(185));for(var a=o.return;a!==null;)o=a,a=o.return;return o.tag===3?o.stateNode:null}var za={};function IC(o,a,c,p){this.tag=o,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bn(o,a,c,p){return new IC(o,a,c,p)}function op(o){return o=o.prototype,!(!o||!o.isReactComponent)}function So(o,a){var c=o.alternate;return c===null?(c=bn(o.tag,a,o.key,o.mode),c.elementType=o.elementType,c.type=o.type,c.stateNode=o.stateNode,c.alternate=o,o.alternate=c):(c.pendingProps=a,c.type=o.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=o.flags&65011712,c.childLanes=o.childLanes,c.lanes=o.lanes,c.child=o.child,c.memoizedProps=o.memoizedProps,c.memoizedState=o.memoizedState,c.updateQueue=o.updateQueue,a=o.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=o.sibling,c.index=o.index,c.ref=o.ref,c.refCleanup=o.refCleanup,c}function oy(o,a){o.flags&=65011714;var c=o.alternate;return c===null?(o.childLanes=0,o.lanes=a,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=c.childLanes,o.lanes=c.lanes,o.child=c.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=c.memoizedProps,o.memoizedState=c.memoizedState,o.updateQueue=c.updateQueue,o.type=c.type,a=c.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),o}function tc(o,a,c,p,x,k){var j=0;if(p=o,typeof o=="function")op(o)&&(j=1);else if(typeof o=="string")j=BE(o,c,W.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case V:return o=bn(31,c,a,x),o.elementType=V,o.lanes=k,o;case w:return Hr(c.children,x,k,a);case E:j=8,x|=24;break;case C:return o=bn(12,c,a,x|2),o.elementType=C,o.lanes=k,o;case R:return o=bn(13,c,a,x),o.elementType=R,o.lanes=k,o;case T:return o=bn(19,c,a,x),o.elementType=T,o.lanes=k,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case S:j=10;break e;case M:j=9;break e;case N:j=11;break e;case D:j=14;break e;case H:j=16,p=null;break e}j=29,c=Error(r(130,o===null?"null":typeof o,"")),p=null}return a=bn(j,c,a,x),a.elementType=o,a.type=p,a.lanes=k,a}function Hr(o,a,c,p){return o=bn(7,o,p,a),o.lanes=c,o}function rp(o,a,c){return o=bn(6,o,null,a),o.lanes=c,o}function ry(o){var a=bn(18,null,null,0);return a.stateNode=o,a}function ap(o,a,c){return a=bn(4,o.children!==null?o.children:[],o.key,a),a.lanes=c,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}var ay=new WeakMap;function Nn(o,a){if(typeof o=="object"&&o!==null){var c=ay.get(o);return c!==void 0?c:(a={value:o,source:a,stack:wt(a)},ay.set(o,a),a)}return{value:o,source:a,stack:wt(a)}}var Ra=[],Oa=0,nc=null,qi=0,_n=[],Dn=0,er=null,oo=1,ro="";function Co(o,a){Ra[Oa++]=qi,Ra[Oa++]=nc,nc=o,qi=a}function iy(o,a,c){_n[Dn++]=oo,_n[Dn++]=ro,_n[Dn++]=er,er=o;var p=oo;o=ro;var x=32-Qe(p)-1;p&=~(1<<x),c+=1;var k=32-Qe(a)+x;if(30<k){var j=x-x%5;k=(p&(1<<j)-1).toString(32),p>>=j,x-=j,oo=1<<32-Qe(a)+x|c<<x|p,ro=k+o}else oo=1<<k|c<<x|p,ro=o}function ip(o){o.return!==null&&(Co(o,1),iy(o,1,0))}function sp(o){for(;o===nc;)nc=Ra[--Oa],Ra[Oa]=null,qi=Ra[--Oa],Ra[Oa]=null;for(;o===er;)er=_n[--Dn],_n[Dn]=null,ro=_n[--Dn],_n[Dn]=null,oo=_n[--Dn],_n[Dn]=null}function sy(o,a){_n[Dn++]=oo,_n[Dn++]=ro,_n[Dn++]=er,oo=a.id,ro=a.overflow,er=o}var Pt=null,ct=null,Ge=!1,tr=null,zn=!1,lp=Error(r(519));function nr(o){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Gi(Nn(a,o)),lp}function ly(o){var a=o.stateNode,c=o.type,p=o.memoizedProps;switch(a[Dt]=o,a[Kt]=p,c){case"dialog":Be("cancel",a),Be("close",a);break;case"iframe":case"object":case"embed":Be("load",a);break;case"video":case"audio":for(c=0;c<fs.length;c++)Be(fs[c],a);break;case"source":Be("error",a);break;case"img":case"image":case"link":Be("error",a),Be("load",a);break;case"details":Be("toggle",a);break;case"input":Be("invalid",a),Ul(a,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":Be("invalid",a);break;case"textarea":Be("invalid",a),Sg(a,p.value,p.defaultValue,p.children)}c=p.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||p.suppressHydrationWarning===!0||E0(a.textContent,c)?(p.popover!=null&&(Be("beforetoggle",a),Be("toggle",a)),p.onScroll!=null&&Be("scroll",a),p.onScrollEnd!=null&&Be("scrollend",a),p.onClick!=null&&(a.onclick=vo),a=!0):a=!1,a||nr(o,!0)}function cy(o){for(Pt=o.return;Pt;)switch(Pt.tag){case 5:case 31:case 13:zn=!1;return;case 27:case 3:zn=!0;return;default:Pt=Pt.return}}function Ia(o){if(o!==Pt)return!1;if(!Ge)return cy(o),Ge=!0,!1;var a=o.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=o.type,c=!(c!=="form"&&c!=="button")||Tf(o.type,o.memoizedProps)),c=!c),c&&ct&&nr(o),cy(o),a===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));ct=R0(o)}else if(a===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));ct=R0(o)}else a===27?(a=ct,gr(o.type)?(o=Df,Df=null,ct=o):ct=a):ct=Pt?On(o.stateNode.nextSibling):null;return!0}function Ur(){ct=Pt=null,Ge=!1}function cp(){var o=tr;return o!==null&&(ln===null?ln=o:ln.push.apply(ln,o),tr=null),o}function Gi(o){tr===null?tr=[o]:tr.push(o)}var up=F(null),qr=null,Eo=null;function or(o,a,c){z(up,a._currentValue),a._currentValue=c}function Mo(o){o._currentValue=up.current,L(up)}function dp(o,a,c){for(;o!==null;){var p=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,p!==null&&(p.childLanes|=a)):p!==null&&(p.childLanes&a)!==a&&(p.childLanes|=a),o===c)break;o=o.return}}function pp(o,a,c,p){var x=o.child;for(x!==null&&(x.return=o);x!==null;){var k=x.dependencies;if(k!==null){var j=x.child;k=k.firstContext;e:for(;k!==null;){var P=k;k=x;for(var X=0;X<a.length;X++)if(P.context===a[X]){k.lanes|=c,P=k.alternate,P!==null&&(P.lanes|=c),dp(k.return,c,o),p||(j=null);break e}k=P.next}}else if(x.tag===18){if(j=x.return,j===null)throw Error(r(341));j.lanes|=c,k=j.alternate,k!==null&&(k.lanes|=c),dp(j,c,o),j=null}else j=x.child;if(j!==null)j.return=x;else for(j=x;j!==null;){if(j===o){j=null;break}if(x=j.sibling,x!==null){x.return=j.return,j=x;break}j=j.return}x=j}}function Fa(o,a,c,p){o=null;for(var x=a,k=!1;x!==null;){if(!k){if((x.flags&524288)!==0)k=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var j=x.alternate;if(j===null)throw Error(r(387));if(j=j.memoizedProps,j!==null){var P=x.type;xn(x.pendingProps.value,j.value)||(o!==null?o.push(P):o=[P])}}else if(x===me.current){if(j=x.alternate,j===null)throw Error(r(387));j.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(o!==null?o.push(xs):o=[xs])}x=x.return}o!==null&&pp(a,o,c,p),a.flags|=262144}function oc(o){for(o=o.firstContext;o!==null;){if(!xn(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Gr(o){qr=o,Eo=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Bt(o){return uy(qr,o)}function rc(o,a){return qr===null&&Gr(o),uy(o,a)}function uy(o,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},Eo===null){if(o===null)throw Error(r(308));Eo=a,o.dependencies={lanes:0,firstContext:a},o.flags|=524288}else Eo=Eo.next=a;return c}var FC=typeof AbortController<"u"?AbortController:function(){var o=[],a=this.signal={aborted:!1,addEventListener:function(c,p){o.push(p)}};this.abort=function(){a.aborted=!0,o.forEach(function(c){return c()})}},$C=e.unstable_scheduleCallback,LC=e.unstable_NormalPriority,Et={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function fp(){return{controller:new FC,data:new Map,refCount:0}}function Ki(o){o.refCount--,o.refCount===0&&$C(LC,function(){o.controller.abort()})}var Vi=null,mp=0,$a=0,La=null;function PC(o,a){if(Vi===null){var c=Vi=[];mp=0,$a=xf(),La={status:"pending",value:void 0,then:function(p){c.push(p)}}}return mp++,a.then(dy,dy),a}function dy(){if(--mp===0&&Vi!==null){La!==null&&(La.status="fulfilled");var o=Vi;Vi=null,$a=0,La=null;for(var a=0;a<o.length;a++)(0,o[a])()}}function BC(o,a){var c=[],p={status:"pending",value:null,reason:null,then:function(x){c.push(x)}};return o.then(function(){p.status="fulfilled",p.value=a;for(var x=0;x<c.length;x++)(0,c[x])(a)},function(x){for(p.status="rejected",p.reason=x,x=0;x<c.length;x++)(0,c[x])(void 0)}),p}var py=A.S;A.S=function(o,a){Wx=_t(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&PC(o,a),py!==null&&py(o,a)};var Kr=F(null);function hp(){var o=Kr.current;return o!==null?o:it.pooledCache}function ac(o,a){a===null?z(Kr,Kr.current):z(Kr,a.pool)}function fy(){var o=hp();return o===null?null:{parent:Et._currentValue,pool:o}}var Pa=Error(r(460)),gp=Error(r(474)),ic=Error(r(542)),sc={then:function(){}};function my(o){return o=o.status,o==="fulfilled"||o==="rejected"}function hy(o,a,c){switch(c=o[c],c===void 0?o.push(a):c!==a&&(a.then(vo,vo),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,yy(o),o;default:if(typeof a.status=="string")a.then(vo,vo);else{if(o=it,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=a,o.status="pending",o.then(function(p){if(a.status==="pending"){var x=a;x.status="fulfilled",x.value=p}},function(p){if(a.status==="pending"){var x=a;x.status="rejected",x.reason=p}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,yy(o),o}throw Yr=a,Pa}}function Vr(o){try{var a=o._init;return a(o._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Yr=c,Pa):c}}var Yr=null;function gy(){if(Yr===null)throw Error(r(459));var o=Yr;return Yr=null,o}function yy(o){if(o===Pa||o===ic)throw Error(r(483))}var Ba=null,Yi=0;function lc(o){var a=Yi;return Yi+=1,Ba===null&&(Ba=[]),hy(Ba,o,a)}function Wi(o,a){a=a.props.ref,o.ref=a!==void 0?a:null}function cc(o,a){throw a.$$typeof===b?Error(r(525)):(o=Object.prototype.toString.call(a),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":o)))}function xy(o){function a(ee,J){if(o){var te=ee.deletions;te===null?(ee.deletions=[J],ee.flags|=16):te.push(J)}}function c(ee,J){if(!o)return null;for(;J!==null;)a(ee,J),J=J.sibling;return null}function p(ee){for(var J=new Map;ee!==null;)ee.key!==null?J.set(ee.key,ee):J.set(ee.index,ee),ee=ee.sibling;return J}function x(ee,J){return ee=So(ee,J),ee.index=0,ee.sibling=null,ee}function k(ee,J,te){return ee.index=te,o?(te=ee.alternate,te!==null?(te=te.index,te<J?(ee.flags|=67108866,J):te):(ee.flags|=67108866,J)):(ee.flags|=1048576,J)}function j(ee){return o&&ee.alternate===null&&(ee.flags|=67108866),ee}function P(ee,J,te,pe){return J===null||J.tag!==6?(J=rp(te,ee.mode,pe),J.return=ee,J):(J=x(J,te),J.return=ee,J)}function X(ee,J,te,pe){var je=te.type;return je===w?de(ee,J,te.props.children,pe,te.key):J!==null&&(J.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===H&&Vr(je)===J.type)?(J=x(J,te.props),Wi(J,te),J.return=ee,J):(J=tc(te.type,te.key,te.props,null,ee.mode,pe),Wi(J,te),J.return=ee,J)}function ne(ee,J,te,pe){return J===null||J.tag!==4||J.stateNode.containerInfo!==te.containerInfo||J.stateNode.implementation!==te.implementation?(J=ap(te,ee.mode,pe),J.return=ee,J):(J=x(J,te.children||[]),J.return=ee,J)}function de(ee,J,te,pe,je){return J===null||J.tag!==7?(J=Hr(te,ee.mode,pe,je),J.return=ee,J):(J=x(J,te),J.return=ee,J)}function fe(ee,J,te){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=rp(""+J,ee.mode,te),J.return=ee,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case y:return te=tc(J.type,J.key,J.props,null,ee.mode,te),Wi(te,J),te.return=ee,te;case v:return J=ap(J,ee.mode,te),J.return=ee,J;case H:return J=Vr(J),fe(ee,J,te)}if(_(J)||Y(J))return J=Hr(J,ee.mode,te,null),J.return=ee,J;if(typeof J.then=="function")return fe(ee,lc(J),te);if(J.$$typeof===S)return fe(ee,rc(ee,J),te);cc(ee,J)}return null}function re(ee,J,te,pe){var je=J!==null?J.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return je!==null?null:P(ee,J,""+te,pe);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case y:return te.key===je?X(ee,J,te,pe):null;case v:return te.key===je?ne(ee,J,te,pe):null;case H:return te=Vr(te),re(ee,J,te,pe)}if(_(te)||Y(te))return je!==null?null:de(ee,J,te,pe,null);if(typeof te.then=="function")return re(ee,J,lc(te),pe);if(te.$$typeof===S)return re(ee,J,rc(ee,te),pe);cc(ee,te)}return null}function se(ee,J,te,pe,je){if(typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint")return ee=ee.get(te)||null,P(J,ee,""+pe,je);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case y:return ee=ee.get(pe.key===null?te:pe.key)||null,X(J,ee,pe,je);case v:return ee=ee.get(pe.key===null?te:pe.key)||null,ne(J,ee,pe,je);case H:return pe=Vr(pe),se(ee,J,te,pe,je)}if(_(pe)||Y(pe))return ee=ee.get(te)||null,de(J,ee,pe,je,null);if(typeof pe.then=="function")return se(ee,J,te,lc(pe),je);if(pe.$$typeof===S)return se(ee,J,te,rc(J,pe),je);cc(J,pe)}return null}function Se(ee,J,te,pe){for(var je=null,We=null,Ce=J,Fe=J=0,qe=null;Ce!==null&&Fe<te.length;Fe++){Ce.index>Fe?(qe=Ce,Ce=null):qe=Ce.sibling;var Xe=re(ee,Ce,te[Fe],pe);if(Xe===null){Ce===null&&(Ce=qe);break}o&&Ce&&Xe.alternate===null&&a(ee,Ce),J=k(Xe,J,Fe),We===null?je=Xe:We.sibling=Xe,We=Xe,Ce=qe}if(Fe===te.length)return c(ee,Ce),Ge&&Co(ee,Fe),je;if(Ce===null){for(;Fe<te.length;Fe++)Ce=fe(ee,te[Fe],pe),Ce!==null&&(J=k(Ce,J,Fe),We===null?je=Ce:We.sibling=Ce,We=Ce);return Ge&&Co(ee,Fe),je}for(Ce=p(Ce);Fe<te.length;Fe++)qe=se(Ce,ee,Fe,te[Fe],pe),qe!==null&&(o&&qe.alternate!==null&&Ce.delete(qe.key===null?Fe:qe.key),J=k(qe,J,Fe),We===null?je=qe:We.sibling=qe,We=qe);return o&&Ce.forEach(function(vr){return a(ee,vr)}),Ge&&Co(ee,Fe),je}function _e(ee,J,te,pe){if(te==null)throw Error(r(151));for(var je=null,We=null,Ce=J,Fe=J=0,qe=null,Xe=te.next();Ce!==null&&!Xe.done;Fe++,Xe=te.next()){Ce.index>Fe?(qe=Ce,Ce=null):qe=Ce.sibling;var vr=re(ee,Ce,Xe.value,pe);if(vr===null){Ce===null&&(Ce=qe);break}o&&Ce&&vr.alternate===null&&a(ee,Ce),J=k(vr,J,Fe),We===null?je=vr:We.sibling=vr,We=vr,Ce=qe}if(Xe.done)return c(ee,Ce),Ge&&Co(ee,Fe),je;if(Ce===null){for(;!Xe.done;Fe++,Xe=te.next())Xe=fe(ee,Xe.value,pe),Xe!==null&&(J=k(Xe,J,Fe),We===null?je=Xe:We.sibling=Xe,We=Xe);return Ge&&Co(ee,Fe),je}for(Ce=p(Ce);!Xe.done;Fe++,Xe=te.next())Xe=se(Ce,ee,Fe,Xe.value,pe),Xe!==null&&(o&&Xe.alternate!==null&&Ce.delete(Xe.key===null?Fe:Xe.key),J=k(Xe,J,Fe),We===null?je=Xe:We.sibling=Xe,We=Xe);return o&&Ce.forEach(function(QE){return a(ee,QE)}),Ge&&Co(ee,Fe),je}function ot(ee,J,te,pe){if(typeof te=="object"&&te!==null&&te.type===w&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case y:e:{for(var je=te.key;J!==null;){if(J.key===je){if(je=te.type,je===w){if(J.tag===7){c(ee,J.sibling),pe=x(J,te.props.children),pe.return=ee,ee=pe;break e}}else if(J.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===H&&Vr(je)===J.type){c(ee,J.sibling),pe=x(J,te.props),Wi(pe,te),pe.return=ee,ee=pe;break e}c(ee,J);break}else a(ee,J);J=J.sibling}te.type===w?(pe=Hr(te.props.children,ee.mode,pe,te.key),pe.return=ee,ee=pe):(pe=tc(te.type,te.key,te.props,null,ee.mode,pe),Wi(pe,te),pe.return=ee,ee=pe)}return j(ee);case v:e:{for(je=te.key;J!==null;){if(J.key===je)if(J.tag===4&&J.stateNode.containerInfo===te.containerInfo&&J.stateNode.implementation===te.implementation){c(ee,J.sibling),pe=x(J,te.children||[]),pe.return=ee,ee=pe;break e}else{c(ee,J);break}else a(ee,J);J=J.sibling}pe=ap(te,ee.mode,pe),pe.return=ee,ee=pe}return j(ee);case H:return te=Vr(te),ot(ee,J,te,pe)}if(_(te))return Se(ee,J,te,pe);if(Y(te)){if(je=Y(te),typeof je!="function")throw Error(r(150));return te=je.call(te),_e(ee,J,te,pe)}if(typeof te.then=="function")return ot(ee,J,lc(te),pe);if(te.$$typeof===S)return ot(ee,J,rc(ee,te),pe);cc(ee,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,J!==null&&J.tag===6?(c(ee,J.sibling),pe=x(J,te),pe.return=ee,ee=pe):(c(ee,J),pe=rp(te,ee.mode,pe),pe.return=ee,ee=pe),j(ee)):c(ee,J)}return function(ee,J,te,pe){try{Yi=0;var je=ot(ee,J,te,pe);return Ba=null,je}catch(Ce){if(Ce===Pa||Ce===ic)throw Ce;var We=bn(29,Ce,null,ee.mode);return We.lanes=pe,We.return=ee,We}}}var Wr=xy(!0),by=xy(!1),rr=!1;function yp(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xp(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function ar(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function ir(o,a,c){var p=o.updateQueue;if(p===null)return null;if(p=p.shared,(Ze&2)!==0){var x=p.pending;return x===null?a.next=a:(a.next=x.next,x.next=a),p.pending=a,a=ec(o),ny(o,null,c),a}return Jl(o,p,a,c),ec(o)}function Xi(o,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var p=a.lanes;p&=o.pendingLanes,c|=p,a.lanes=c,Dl(o,c)}}function bp(o,a){var c=o.updateQueue,p=o.alternate;if(p!==null&&(p=p.updateQueue,c===p)){var x=null,k=null;if(c=c.firstBaseUpdate,c!==null){do{var j={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};k===null?x=k=j:k=k.next=j,c=c.next}while(c!==null);k===null?x=k=a:k=k.next=a}else x=k=a;c={baseState:p.baseState,firstBaseUpdate:x,lastBaseUpdate:k,shared:p.shared,callbacks:p.callbacks},o.updateQueue=c;return}o=c.lastBaseUpdate,o===null?c.firstBaseUpdate=a:o.next=a,c.lastBaseUpdate=a}var kp=!1;function Zi(){if(kp){var o=La;if(o!==null)throw o}}function Qi(o,a,c,p){kp=!1;var x=o.updateQueue;rr=!1;var k=x.firstBaseUpdate,j=x.lastBaseUpdate,P=x.shared.pending;if(P!==null){x.shared.pending=null;var X=P,ne=X.next;X.next=null,j===null?k=ne:j.next=ne,j=X;var de=o.alternate;de!==null&&(de=de.updateQueue,P=de.lastBaseUpdate,P!==j&&(P===null?de.firstBaseUpdate=ne:P.next=ne,de.lastBaseUpdate=X))}if(k!==null){var fe=x.baseState;j=0,de=ne=X=null,P=k;do{var re=P.lane&-536870913,se=re!==P.lane;if(se?(Ue&re)===re:(p&re)===re){re!==0&&re===$a&&(kp=!0),de!==null&&(de=de.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var Se=o,_e=P;re=a;var ot=c;switch(_e.tag){case 1:if(Se=_e.payload,typeof Se=="function"){fe=Se.call(ot,fe,re);break e}fe=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=_e.payload,re=typeof Se=="function"?Se.call(ot,fe,re):Se,re==null)break e;fe=g({},fe,re);break e;case 2:rr=!0}}re=P.callback,re!==null&&(o.flags|=64,se&&(o.flags|=8192),se=x.callbacks,se===null?x.callbacks=[re]:se.push(re))}else se={lane:re,tag:P.tag,payload:P.payload,callback:P.callback,next:null},de===null?(ne=de=se,X=fe):de=de.next=se,j|=re;if(P=P.next,P===null){if(P=x.shared.pending,P===null)break;se=P,P=se.next,se.next=null,x.lastBaseUpdate=se,x.shared.pending=null}}while(!0);de===null&&(X=fe),x.baseState=X,x.firstBaseUpdate=ne,x.lastBaseUpdate=de,k===null&&(x.shared.lanes=0),dr|=j,o.lanes=j,o.memoizedState=fe}}function ky(o,a){if(typeof o!="function")throw Error(r(191,o));o.call(a)}function vy(o,a){var c=o.callbacks;if(c!==null)for(o.callbacks=null,o=0;o<c.length;o++)ky(c[o],a)}var Ha=F(null),uc=F(0);function wy(o,a){o=Oo,z(uc,o),z(Ha,a),Oo=o|a.baseLanes}function vp(){z(uc,Oo),z(Ha,Ha.current)}function wp(){Oo=uc.current,L(Ha),L(uc)}var kn=F(null),Rn=null;function sr(o){var a=o.alternate;z(bt,bt.current&1),z(kn,o),Rn===null&&(a===null||Ha.current!==null||a.memoizedState!==null)&&(Rn=o)}function Sp(o){z(bt,bt.current),z(kn,o),Rn===null&&(Rn=o)}function Sy(o){o.tag===22?(z(bt,bt.current),z(kn,o),Rn===null&&(Rn=o)):lr()}function lr(){z(bt,bt.current),z(kn,kn.current)}function vn(o){L(kn),Rn===o&&(Rn=null),L(bt)}var bt=F(0);function dc(o){for(var a=o;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Nf(c)||_f(c)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var To=0,Ie=null,tt=null,Mt=null,pc=!1,Ua=!1,Xr=!1,fc=0,Ji=0,qa=null,HC=0;function gt(){throw Error(r(321))}function Cp(o,a){if(a===null)return!1;for(var c=0;c<a.length&&c<o.length;c++)if(!xn(o[c],a[c]))return!1;return!0}function Ep(o,a,c,p,x,k){return To=k,Ie=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,A.H=o===null||o.memoizedState===null?ix:Pp,Xr=!1,k=c(p,x),Xr=!1,Ua&&(k=Ey(a,c,p,x)),Cy(o),k}function Cy(o){A.H=ns;var a=tt!==null&&tt.next!==null;if(To=0,Mt=tt=Ie=null,pc=!1,Ji=0,qa=null,a)throw Error(r(300));o===null||Tt||(o=o.dependencies,o!==null&&oc(o)&&(Tt=!0))}function Ey(o,a,c,p){Ie=o;var x=0;do{if(Ua&&(qa=null),Ji=0,Ua=!1,25<=x)throw Error(r(301));if(x+=1,Mt=tt=null,o.updateQueue!=null){var k=o.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}A.H=sx,k=a(c,p)}while(Ua);return k}function UC(){var o=A.H,a=o.useState()[0];return a=typeof a.then=="function"?es(a):a,o=o.useState()[0],(tt!==null?tt.memoizedState:null)!==o&&(Ie.flags|=1024),a}function Mp(){var o=fc!==0;return fc=0,o}function Tp(o,a,c){a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~c}function jp(o){if(pc){for(o=o.memoizedState;o!==null;){var a=o.queue;a!==null&&(a.pending=null),o=o.next}pc=!1}To=0,Mt=tt=Ie=null,Ua=!1,Ji=fc=0,qa=null}function Qt(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?Ie.memoizedState=Mt=o:Mt=Mt.next=o,Mt}function kt(){if(tt===null){var o=Ie.alternate;o=o!==null?o.memoizedState:null}else o=tt.next;var a=Mt===null?Ie.memoizedState:Mt.next;if(a!==null)Mt=a,tt=o;else{if(o===null)throw Ie.alternate===null?Error(r(467)):Error(r(310));tt=o,o={memoizedState:tt.memoizedState,baseState:tt.baseState,baseQueue:tt.baseQueue,queue:tt.queue,next:null},Mt===null?Ie.memoizedState=Mt=o:Mt=Mt.next=o}return Mt}function mc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function es(o){var a=Ji;return Ji+=1,qa===null&&(qa=[]),o=hy(qa,o,a),a=Ie,(Mt===null?a.memoizedState:Mt.next)===null&&(a=a.alternate,A.H=a===null||a.memoizedState===null?ix:Pp),o}function hc(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return es(o);if(o.$$typeof===S)return Bt(o)}throw Error(r(438,String(o)))}function Ap(o){var a=null,c=Ie.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var p=Ie.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(a={data:p.data.map(function(x){return x.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=mc(),Ie.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(o),p=0;p<o;p++)c[p]=B;return a.index++,c}function jo(o,a){return typeof a=="function"?a(o):a}function gc(o){var a=kt();return Np(a,tt,o)}function Np(o,a,c){var p=o.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=c;var x=o.baseQueue,k=p.pending;if(k!==null){if(x!==null){var j=x.next;x.next=k.next,k.next=j}a.baseQueue=x=k,p.pending=null}if(k=o.baseState,x===null)o.memoizedState=k;else{a=x.next;var P=j=null,X=null,ne=a,de=!1;do{var fe=ne.lane&-536870913;if(fe!==ne.lane?(Ue&fe)===fe:(To&fe)===fe){var re=ne.revertLane;if(re===0)X!==null&&(X=X.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),fe===$a&&(de=!0);else if((To&re)===re){ne=ne.next,re===$a&&(de=!0);continue}else fe={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},X===null?(P=X=fe,j=k):X=X.next=fe,Ie.lanes|=re,dr|=re;fe=ne.action,Xr&&c(k,fe),k=ne.hasEagerState?ne.eagerState:c(k,fe)}else re={lane:fe,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},X===null?(P=X=re,j=k):X=X.next=re,Ie.lanes|=fe,dr|=fe;ne=ne.next}while(ne!==null&&ne!==a);if(X===null?j=k:X.next=P,!xn(k,o.memoizedState)&&(Tt=!0,de&&(c=La,c!==null)))throw c;o.memoizedState=k,o.baseState=j,o.baseQueue=X,p.lastRenderedState=k}return x===null&&(p.lanes=0),[o.memoizedState,p.dispatch]}function _p(o){var a=kt(),c=a.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=o;var p=c.dispatch,x=c.pending,k=a.memoizedState;if(x!==null){c.pending=null;var j=x=x.next;do k=o(k,j.action),j=j.next;while(j!==x);xn(k,a.memoizedState)||(Tt=!0),a.memoizedState=k,a.baseQueue===null&&(a.baseState=k),c.lastRenderedState=k}return[k,p]}function My(o,a,c){var p=Ie,x=kt(),k=Ge;if(k){if(c===void 0)throw Error(r(407));c=c()}else c=a();var j=!xn((tt||x).memoizedState,c);if(j&&(x.memoizedState=c,Tt=!0),x=x.queue,Rp(Ay.bind(null,p,x,o),[o]),x.getSnapshot!==a||j||Mt!==null&&Mt.memoizedState.tag&1){if(p.flags|=2048,Ga(9,{destroy:void 0},jy.bind(null,p,x,c,a),null),it===null)throw Error(r(349));k||(To&127)!==0||Ty(p,a,c)}return c}function Ty(o,a,c){o.flags|=16384,o={getSnapshot:a,value:c},a=Ie.updateQueue,a===null?(a=mc(),Ie.updateQueue=a,a.stores=[o]):(c=a.stores,c===null?a.stores=[o]:c.push(o))}function jy(o,a,c,p){a.value=c,a.getSnapshot=p,Ny(a)&&_y(o)}function Ay(o,a,c){return c(function(){Ny(a)&&_y(o)})}function Ny(o){var a=o.getSnapshot;o=o.value;try{var c=a();return!xn(o,c)}catch{return!0}}function _y(o){var a=Br(o,2);a!==null&&cn(a,o,2)}function Dp(o){var a=Qt();if(typeof o=="function"){var c=o;if(o=c(),Xr){Gt(!0);try{c()}finally{Gt(!1)}}}return a.memoizedState=a.baseState=o,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:o},a}function Dy(o,a,c,p){return o.baseState=c,Np(o,tt,typeof p=="function"?p:jo)}function qC(o,a,c,p,x){if(bc(o))throw Error(r(485));if(o=a.action,o!==null){var k={payload:x,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){k.listeners.push(j)}};A.T!==null?c(!0):k.isTransition=!1,p(k),c=a.pending,c===null?(k.next=a.pending=k,zy(a,k)):(k.next=c.next,a.pending=c.next=k)}}function zy(o,a){var c=a.action,p=a.payload,x=o.state;if(a.isTransition){var k=A.T,j={};A.T=j;try{var P=c(x,p),X=A.S;X!==null&&X(j,P),Ry(o,a,P)}catch(ne){zp(o,a,ne)}finally{k!==null&&j.types!==null&&(k.types=j.types),A.T=k}}else try{k=c(x,p),Ry(o,a,k)}catch(ne){zp(o,a,ne)}}function Ry(o,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(p){Oy(o,a,p)},function(p){return zp(o,a,p)}):Oy(o,a,c)}function Oy(o,a,c){a.status="fulfilled",a.value=c,Iy(a),o.state=c,a=o.pending,a!==null&&(c=a.next,c===a?o.pending=null:(c=c.next,a.next=c,zy(o,c)))}function zp(o,a,c){var p=o.pending;if(o.pending=null,p!==null){p=p.next;do a.status="rejected",a.reason=c,Iy(a),a=a.next;while(a!==p)}o.action=null}function Iy(o){o=o.listeners;for(var a=0;a<o.length;a++)(0,o[a])()}function Fy(o,a){return a}function $y(o,a){if(Ge){var c=it.formState;if(c!==null){e:{var p=Ie;if(Ge){if(ct){t:{for(var x=ct,k=zn;x.nodeType!==8;){if(!k){x=null;break t}if(x=On(x.nextSibling),x===null){x=null;break t}}k=x.data,x=k==="F!"||k==="F"?x:null}if(x){ct=On(x.nextSibling),p=x.data==="F!";break e}}nr(p)}p=!1}p&&(a=c[0])}}return c=Qt(),c.memoizedState=c.baseState=a,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fy,lastRenderedState:a},c.queue=p,c=ox.bind(null,Ie,p),p.dispatch=c,p=Dp(!1),k=Lp.bind(null,Ie,!1,p.queue),p=Qt(),x={state:a,dispatch:null,action:o,pending:null},p.queue=x,c=qC.bind(null,Ie,x,k,c),x.dispatch=c,p.memoizedState=o,[a,c,!1]}function Ly(o){var a=kt();return Py(a,tt,o)}function Py(o,a,c){if(a=Np(o,a,Fy)[0],o=gc(jo)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var p=es(a)}catch(j){throw j===Pa?ic:j}else p=a;a=kt();var x=a.queue,k=x.dispatch;return c!==a.memoizedState&&(Ie.flags|=2048,Ga(9,{destroy:void 0},GC.bind(null,x,c),null)),[p,k,o]}function GC(o,a){o.action=a}function By(o){var a=kt(),c=tt;if(c!==null)return Py(a,c,o);kt(),a=a.memoizedState,c=kt();var p=c.queue.dispatch;return c.memoizedState=o,[a,p,!1]}function Ga(o,a,c,p){return o={tag:o,create:c,deps:p,inst:a,next:null},a=Ie.updateQueue,a===null&&(a=mc(),Ie.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=o.next=o:(p=c.next,c.next=o,o.next=p,a.lastEffect=o),o}function Hy(){return kt().memoizedState}function yc(o,a,c,p){var x=Qt();Ie.flags|=o,x.memoizedState=Ga(1|a,{destroy:void 0},c,p===void 0?null:p)}function xc(o,a,c,p){var x=kt();p=p===void 0?null:p;var k=x.memoizedState.inst;tt!==null&&p!==null&&Cp(p,tt.memoizedState.deps)?x.memoizedState=Ga(a,k,c,p):(Ie.flags|=o,x.memoizedState=Ga(1|a,k,c,p))}function Uy(o,a){yc(8390656,8,o,a)}function Rp(o,a){xc(2048,8,o,a)}function KC(o){Ie.flags|=4;var a=Ie.updateQueue;if(a===null)a=mc(),Ie.updateQueue=a,a.events=[o];else{var c=a.events;c===null?a.events=[o]:c.push(o)}}function qy(o){var a=kt().memoizedState;return KC({ref:a,nextImpl:o}),function(){if((Ze&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function Gy(o,a){return xc(4,2,o,a)}function Ky(o,a){return xc(4,4,o,a)}function Vy(o,a){if(typeof a=="function"){o=o();var c=a(o);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function Yy(o,a,c){c=c!=null?c.concat([o]):null,xc(4,4,Vy.bind(null,a,o),c)}function Op(){}function Wy(o,a){var c=kt();a=a===void 0?null:a;var p=c.memoizedState;return a!==null&&Cp(a,p[1])?p[0]:(c.memoizedState=[o,a],o)}function Xy(o,a){var c=kt();a=a===void 0?null:a;var p=c.memoizedState;if(a!==null&&Cp(a,p[1]))return p[0];if(p=o(),Xr){Gt(!0);try{o()}finally{Gt(!1)}}return c.memoizedState=[p,a],p}function Ip(o,a,c){return c===void 0||(To&1073741824)!==0&&(Ue&261930)===0?o.memoizedState=a:(o.memoizedState=c,o=Zx(),Ie.lanes|=o,dr|=o,c)}function Zy(o,a,c,p){return xn(c,a)?c:Ha.current!==null?(o=Ip(o,c,p),xn(o,a)||(Tt=!0),o):(To&42)===0||(To&1073741824)!==0&&(Ue&261930)===0?(Tt=!0,o.memoizedState=c):(o=Zx(),Ie.lanes|=o,dr|=o,a)}function Qy(o,a,c,p,x){var k=q.p;q.p=k!==0&&8>k?k:8;var j=A.T,P={};A.T=P,Lp(o,!1,a,c);try{var X=x(),ne=A.S;if(ne!==null&&ne(P,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var de=BC(X,p);ts(o,a,de,Cn(o))}else ts(o,a,p,Cn(o))}catch(fe){ts(o,a,{then:function(){},status:"rejected",reason:fe},Cn())}finally{q.p=k,j!==null&&P.types!==null&&(j.types=P.types),A.T=j}}function VC(){}function Fp(o,a,c,p){if(o.tag!==5)throw Error(r(476));var x=Jy(o).queue;Qy(o,x,a,K,c===null?VC:function(){return ex(o),c(p)})}function Jy(o){var a=o.memoizedState;if(a!==null)return a;a={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:K},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:c},next:null},o.memoizedState=a,o=o.alternate,o!==null&&(o.memoizedState=a),a}function ex(o){var a=Jy(o);a.next===null&&(a=o.alternate.memoizedState),ts(o,a.next.queue,{},Cn())}function $p(){return Bt(xs)}function tx(){return kt().memoizedState}function nx(){return kt().memoizedState}function YC(o){for(var a=o.return;a!==null;){switch(a.tag){case 24:case 3:var c=Cn();o=ar(c);var p=ir(a,o,c);p!==null&&(cn(p,a,c),Xi(p,a,c)),a={cache:fp()},o.payload=a;return}a=a.return}}function WC(o,a,c){var p=Cn();c={lane:p,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},bc(o)?rx(a,c):(c=np(o,a,c,p),c!==null&&(cn(c,o,p),ax(c,a,p)))}function ox(o,a,c){var p=Cn();ts(o,a,c,p)}function ts(o,a,c,p){var x={lane:p,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(bc(o))rx(a,x);else{var k=o.alternate;if(o.lanes===0&&(k===null||k.lanes===0)&&(k=a.lastRenderedReducer,k!==null))try{var j=a.lastRenderedState,P=k(j,c);if(x.hasEagerState=!0,x.eagerState=P,xn(P,j))return Jl(o,a,x,0),it===null&&Ql(),!1}catch{}if(c=np(o,a,x,p),c!==null)return cn(c,o,p),ax(c,a,p),!0}return!1}function Lp(o,a,c,p){if(p={lane:2,revertLane:xf(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},bc(o)){if(a)throw Error(r(479))}else a=np(o,c,p,2),a!==null&&cn(a,o,2)}function bc(o){var a=o.alternate;return o===Ie||a!==null&&a===Ie}function rx(o,a){Ua=pc=!0;var c=o.pending;c===null?a.next=a:(a.next=c.next,c.next=a),o.pending=a}function ax(o,a,c){if((c&4194048)!==0){var p=a.lanes;p&=o.pendingLanes,c|=p,a.lanes=c,Dl(o,c)}}var ns={readContext:Bt,use:hc,useCallback:gt,useContext:gt,useEffect:gt,useImperativeHandle:gt,useLayoutEffect:gt,useInsertionEffect:gt,useMemo:gt,useReducer:gt,useRef:gt,useState:gt,useDebugValue:gt,useDeferredValue:gt,useTransition:gt,useSyncExternalStore:gt,useId:gt,useHostTransitionStatus:gt,useFormState:gt,useActionState:gt,useOptimistic:gt,useMemoCache:gt,useCacheRefresh:gt};ns.useEffectEvent=gt;var ix={readContext:Bt,use:hc,useCallback:function(o,a){return Qt().memoizedState=[o,a===void 0?null:a],o},useContext:Bt,useEffect:Uy,useImperativeHandle:function(o,a,c){c=c!=null?c.concat([o]):null,yc(4194308,4,Vy.bind(null,a,o),c)},useLayoutEffect:function(o,a){return yc(4194308,4,o,a)},useInsertionEffect:function(o,a){yc(4,2,o,a)},useMemo:function(o,a){var c=Qt();a=a===void 0?null:a;var p=o();if(Xr){Gt(!0);try{o()}finally{Gt(!1)}}return c.memoizedState=[p,a],p},useReducer:function(o,a,c){var p=Qt();if(c!==void 0){var x=c(a);if(Xr){Gt(!0);try{c(a)}finally{Gt(!1)}}}else x=a;return p.memoizedState=p.baseState=x,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:x},p.queue=o,o=o.dispatch=WC.bind(null,Ie,o),[p.memoizedState,o]},useRef:function(o){var a=Qt();return o={current:o},a.memoizedState=o},useState:function(o){o=Dp(o);var a=o.queue,c=ox.bind(null,Ie,a);return a.dispatch=c,[o.memoizedState,c]},useDebugValue:Op,useDeferredValue:function(o,a){var c=Qt();return Ip(c,o,a)},useTransition:function(){var o=Dp(!1);return o=Qy.bind(null,Ie,o.queue,!0,!1),Qt().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,a,c){var p=Ie,x=Qt();if(Ge){if(c===void 0)throw Error(r(407));c=c()}else{if(c=a(),it===null)throw Error(r(349));(Ue&127)!==0||Ty(p,a,c)}x.memoizedState=c;var k={value:c,getSnapshot:a};return x.queue=k,Uy(Ay.bind(null,p,k,o),[o]),p.flags|=2048,Ga(9,{destroy:void 0},jy.bind(null,p,k,c,a),null),c},useId:function(){var o=Qt(),a=it.identifierPrefix;if(Ge){var c=ro,p=oo;c=(p&~(1<<32-Qe(p)-1)).toString(32)+c,a="_"+a+"R_"+c,c=fc++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=HC++,a="_"+a+"r_"+c.toString(32)+"_";return o.memoizedState=a},useHostTransitionStatus:$p,useFormState:$y,useActionState:$y,useOptimistic:function(o){var a=Qt();a.memoizedState=a.baseState=o;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=Lp.bind(null,Ie,!0,c),c.dispatch=a,[o,a]},useMemoCache:Ap,useCacheRefresh:function(){return Qt().memoizedState=YC.bind(null,Ie)},useEffectEvent:function(o){var a=Qt(),c={impl:o};return a.memoizedState=c,function(){if((Ze&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},Pp={readContext:Bt,use:hc,useCallback:Wy,useContext:Bt,useEffect:Rp,useImperativeHandle:Yy,useInsertionEffect:Gy,useLayoutEffect:Ky,useMemo:Xy,useReducer:gc,useRef:Hy,useState:function(){return gc(jo)},useDebugValue:Op,useDeferredValue:function(o,a){var c=kt();return Zy(c,tt.memoizedState,o,a)},useTransition:function(){var o=gc(jo)[0],a=kt().memoizedState;return[typeof o=="boolean"?o:es(o),a]},useSyncExternalStore:My,useId:tx,useHostTransitionStatus:$p,useFormState:Ly,useActionState:Ly,useOptimistic:function(o,a){var c=kt();return Dy(c,tt,o,a)},useMemoCache:Ap,useCacheRefresh:nx};Pp.useEffectEvent=qy;var sx={readContext:Bt,use:hc,useCallback:Wy,useContext:Bt,useEffect:Rp,useImperativeHandle:Yy,useInsertionEffect:Gy,useLayoutEffect:Ky,useMemo:Xy,useReducer:_p,useRef:Hy,useState:function(){return _p(jo)},useDebugValue:Op,useDeferredValue:function(o,a){var c=kt();return tt===null?Ip(c,o,a):Zy(c,tt.memoizedState,o,a)},useTransition:function(){var o=_p(jo)[0],a=kt().memoizedState;return[typeof o=="boolean"?o:es(o),a]},useSyncExternalStore:My,useId:tx,useHostTransitionStatus:$p,useFormState:By,useActionState:By,useOptimistic:function(o,a){var c=kt();return tt!==null?Dy(c,tt,o,a):(c.baseState=o,[o,c.queue.dispatch])},useMemoCache:Ap,useCacheRefresh:nx};sx.useEffectEvent=qy;function Bp(o,a,c,p){a=o.memoizedState,c=c(p,a),c=c==null?a:g({},a,c),o.memoizedState=c,o.lanes===0&&(o.updateQueue.baseState=c)}var Hp={enqueueSetState:function(o,a,c){o=o._reactInternals;var p=Cn(),x=ar(p);x.payload=a,c!=null&&(x.callback=c),a=ir(o,x,p),a!==null&&(cn(a,o,p),Xi(a,o,p))},enqueueReplaceState:function(o,a,c){o=o._reactInternals;var p=Cn(),x=ar(p);x.tag=1,x.payload=a,c!=null&&(x.callback=c),a=ir(o,x,p),a!==null&&(cn(a,o,p),Xi(a,o,p))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var c=Cn(),p=ar(c);p.tag=2,a!=null&&(p.callback=a),a=ir(o,p,c),a!==null&&(cn(a,o,c),Xi(a,o,c))}};function lx(o,a,c,p,x,k,j){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(p,k,j):a.prototype&&a.prototype.isPureReactComponent?!Hi(c,p)||!Hi(x,k):!0}function cx(o,a,c,p){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,p),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,p),a.state!==o&&Hp.enqueueReplaceState(a,a.state,null)}function Zr(o,a){var c=a;if("ref"in a){c={};for(var p in a)p!=="ref"&&(c[p]=a[p])}if(o=o.defaultProps){c===a&&(c=g({},c));for(var x in o)c[x]===void 0&&(c[x]=o[x])}return c}function ux(o){Zl(o)}function dx(o){console.error(o)}function px(o){Zl(o)}function kc(o,a){try{var c=o.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(p){setTimeout(function(){throw p})}}function fx(o,a,c){try{var p=o.onCaughtError;p(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Up(o,a,c){return c=ar(c),c.tag=3,c.payload={element:null},c.callback=function(){kc(o,a)},c}function mx(o){return o=ar(o),o.tag=3,o}function hx(o,a,c,p){var x=c.type.getDerivedStateFromError;if(typeof x=="function"){var k=p.value;o.payload=function(){return x(k)},o.callback=function(){fx(a,c,p)}}var j=c.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(o.callback=function(){fx(a,c,p),typeof x!="function"&&(pr===null?pr=new Set([this]):pr.add(this));var P=p.stack;this.componentDidCatch(p.value,{componentStack:P!==null?P:""})})}function XC(o,a,c,p,x){if(c.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(a=c.alternate,a!==null&&Fa(a,c,x,!0),c=kn.current,c!==null){switch(c.tag){case 31:case 13:return Rn===null?Dc():c.alternate===null&&yt===0&&(yt=3),c.flags&=-257,c.flags|=65536,c.lanes=x,p===sc?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([p]):a.add(p),hf(o,p,x)),!1;case 22:return c.flags|=65536,p===sc?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([p])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([p]):c.add(p)),hf(o,p,x)),!1}throw Error(r(435,c.tag))}return hf(o,p,x),Dc(),!1}if(Ge)return a=kn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,p!==lp&&(o=Error(r(422),{cause:p}),Gi(Nn(o,c)))):(p!==lp&&(a=Error(r(423),{cause:p}),Gi(Nn(a,c))),o=o.current.alternate,o.flags|=65536,x&=-x,o.lanes|=x,p=Nn(p,c),x=Up(o.stateNode,p,x),bp(o,x),yt!==4&&(yt=2)),!1;var k=Error(r(520),{cause:p});if(k=Nn(k,c),us===null?us=[k]:us.push(k),yt!==4&&(yt=2),a===null)return!0;p=Nn(p,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,o=x&-x,c.lanes|=o,o=Up(c.stateNode,p,o),bp(c,o),!1;case 1:if(a=c.type,k=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(pr===null||!pr.has(k))))return c.flags|=65536,x&=-x,c.lanes|=x,x=mx(x),hx(x,o,c,p),bp(c,x),!1}c=c.return}while(c!==null);return!1}var qp=Error(r(461)),Tt=!1;function Ht(o,a,c,p){a.child=o===null?by(a,null,c,p):Wr(a,o.child,c,p)}function gx(o,a,c,p,x){c=c.render;var k=a.ref;if("ref"in p){var j={};for(var P in p)P!=="ref"&&(j[P]=p[P])}else j=p;return Gr(a),p=Ep(o,a,c,j,k,x),P=Mp(),o!==null&&!Tt?(Tp(o,a,x),Ao(o,a,x)):(Ge&&P&&ip(a),a.flags|=1,Ht(o,a,p,x),a.child)}function yx(o,a,c,p,x){if(o===null){var k=c.type;return typeof k=="function"&&!op(k)&&k.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=k,xx(o,a,k,p,x)):(o=tc(c.type,null,p,a,a.mode,x),o.ref=a.ref,o.return=a,a.child=o)}if(k=o.child,!Qp(o,x)){var j=k.memoizedProps;if(c=c.compare,c=c!==null?c:Hi,c(j,p)&&o.ref===a.ref)return Ao(o,a,x)}return a.flags|=1,o=So(k,p),o.ref=a.ref,o.return=a,a.child=o}function xx(o,a,c,p,x){if(o!==null){var k=o.memoizedProps;if(Hi(k,p)&&o.ref===a.ref)if(Tt=!1,a.pendingProps=p=k,Qp(o,x))(o.flags&131072)!==0&&(Tt=!0);else return a.lanes=o.lanes,Ao(o,a,x)}return Gp(o,a,c,p,x)}function bx(o,a,c,p){var x=p.children,k=o!==null?o.memoizedState:null;if(o===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((a.flags&128)!==0){if(k=k!==null?k.baseLanes|c:c,o!==null){for(p=a.child=o.child,x=0;p!==null;)x=x|p.lanes|p.childLanes,p=p.sibling;p=x&~k}else p=0,a.child=null;return kx(o,a,k,c,p)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},o!==null&&ac(a,k!==null?k.cachePool:null),k!==null?wy(a,k):vp(),Sy(a);else return p=a.lanes=536870912,kx(o,a,k!==null?k.baseLanes|c:c,c,p)}else k!==null?(ac(a,k.cachePool),wy(a,k),lr(),a.memoizedState=null):(o!==null&&ac(a,null),vp(),lr());return Ht(o,a,x,c),a.child}function os(o,a){return o!==null&&o.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function kx(o,a,c,p,x){var k=hp();return k=k===null?null:{parent:Et._currentValue,pool:k},a.memoizedState={baseLanes:c,cachePool:k},o!==null&&ac(a,null),vp(),Sy(a),o!==null&&Fa(o,a,p,!0),a.childLanes=x,null}function vc(o,a){return a=Sc({mode:a.mode,children:a.children},o.mode),a.ref=o.ref,o.child=a,a.return=o,a}function vx(o,a,c){return Wr(a,o.child,null,c),o=vc(a,a.pendingProps),o.flags|=2,vn(a),a.memoizedState=null,o}function ZC(o,a,c){var p=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,o===null){if(Ge){if(p.mode==="hidden")return o=vc(a,p),a.lanes=536870912,os(null,o);if(Sp(a),(o=ct)?(o=z0(o,zn),o=o!==null&&o.data==="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:er!==null?{id:oo,overflow:ro}:null,retryLane:536870912,hydrationErrors:null},c=ry(o),c.return=a,a.child=c,Pt=a,ct=null)):o=null,o===null)throw nr(a);return a.lanes=536870912,null}return vc(a,p)}var k=o.memoizedState;if(k!==null){var j=k.dehydrated;if(Sp(a),x)if(a.flags&256)a.flags&=-257,a=vx(o,a,c);else if(a.memoizedState!==null)a.child=o.child,a.flags|=128,a=null;else throw Error(r(558));else if(Tt||Fa(o,a,c,!1),x=(c&o.childLanes)!==0,Tt||x){if(p=it,p!==null&&(j=zl(p,c),j!==0&&j!==k.retryLane))throw k.retryLane=j,Br(o,j),cn(p,o,j),qp;Dc(),a=vx(o,a,c)}else o=k.treeContext,ct=On(j.nextSibling),Pt=a,Ge=!0,tr=null,zn=!1,o!==null&&sy(a,o),a=vc(a,p),a.flags|=4096;return a}return o=So(o.child,{mode:p.mode,children:p.children}),o.ref=a.ref,a.child=o,o.return=a,o}function wc(o,a){var c=a.ref;if(c===null)o!==null&&o.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(o===null||o.ref!==c)&&(a.flags|=4194816)}}function Gp(o,a,c,p,x){return Gr(a),c=Ep(o,a,c,p,void 0,x),p=Mp(),o!==null&&!Tt?(Tp(o,a,x),Ao(o,a,x)):(Ge&&p&&ip(a),a.flags|=1,Ht(o,a,c,x),a.child)}function wx(o,a,c,p,x,k){return Gr(a),a.updateQueue=null,c=Ey(a,p,c,x),Cy(o),p=Mp(),o!==null&&!Tt?(Tp(o,a,k),Ao(o,a,k)):(Ge&&p&&ip(a),a.flags|=1,Ht(o,a,c,k),a.child)}function Sx(o,a,c,p,x){if(Gr(a),a.stateNode===null){var k=za,j=c.contextType;typeof j=="object"&&j!==null&&(k=Bt(j)),k=new c(p,k),a.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=Hp,a.stateNode=k,k._reactInternals=a,k=a.stateNode,k.props=p,k.state=a.memoizedState,k.refs={},yp(a),j=c.contextType,k.context=typeof j=="object"&&j!==null?Bt(j):za,k.state=a.memoizedState,j=c.getDerivedStateFromProps,typeof j=="function"&&(Bp(a,c,j,p),k.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(j=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),j!==k.state&&Hp.enqueueReplaceState(k,k.state,null),Qi(a,p,k,x),Zi(),k.state=a.memoizedState),typeof k.componentDidMount=="function"&&(a.flags|=4194308),p=!0}else if(o===null){k=a.stateNode;var P=a.memoizedProps,X=Zr(c,P);k.props=X;var ne=k.context,de=c.contextType;j=za,typeof de=="object"&&de!==null&&(j=Bt(de));var fe=c.getDerivedStateFromProps;de=typeof fe=="function"||typeof k.getSnapshotBeforeUpdate=="function",P=a.pendingProps!==P,de||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(P||ne!==j)&&cx(a,k,p,j),rr=!1;var re=a.memoizedState;k.state=re,Qi(a,p,k,x),Zi(),ne=a.memoizedState,P||re!==ne||rr?(typeof fe=="function"&&(Bp(a,c,fe,p),ne=a.memoizedState),(X=rr||lx(a,c,X,p,re,ne,j))?(de||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(a.flags|=4194308)):(typeof k.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=p,a.memoizedState=ne),k.props=p,k.state=ne,k.context=j,p=X):(typeof k.componentDidMount=="function"&&(a.flags|=4194308),p=!1)}else{k=a.stateNode,xp(o,a),j=a.memoizedProps,de=Zr(c,j),k.props=de,fe=a.pendingProps,re=k.context,ne=c.contextType,X=za,typeof ne=="object"&&ne!==null&&(X=Bt(ne)),P=c.getDerivedStateFromProps,(ne=typeof P=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(j!==fe||re!==X)&&cx(a,k,p,X),rr=!1,re=a.memoizedState,k.state=re,Qi(a,p,k,x),Zi();var se=a.memoizedState;j!==fe||re!==se||rr||o!==null&&o.dependencies!==null&&oc(o.dependencies)?(typeof P=="function"&&(Bp(a,c,P,p),se=a.memoizedState),(de=rr||lx(a,c,de,p,re,se,X)||o!==null&&o.dependencies!==null&&oc(o.dependencies))?(ne||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(p,se,X),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(p,se,X)),typeof k.componentDidUpdate=="function"&&(a.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof k.componentDidUpdate!="function"||j===o.memoizedProps&&re===o.memoizedState||(a.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||j===o.memoizedProps&&re===o.memoizedState||(a.flags|=1024),a.memoizedProps=p,a.memoizedState=se),k.props=p,k.state=se,k.context=X,p=de):(typeof k.componentDidUpdate!="function"||j===o.memoizedProps&&re===o.memoizedState||(a.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||j===o.memoizedProps&&re===o.memoizedState||(a.flags|=1024),p=!1)}return k=p,wc(o,a),p=(a.flags&128)!==0,k||p?(k=a.stateNode,c=p&&typeof c.getDerivedStateFromError!="function"?null:k.render(),a.flags|=1,o!==null&&p?(a.child=Wr(a,o.child,null,x),a.child=Wr(a,null,c,x)):Ht(o,a,c,x),a.memoizedState=k.state,o=a.child):o=Ao(o,a,x),o}function Cx(o,a,c,p){return Ur(),a.flags|=256,Ht(o,a,c,p),a.child}var Kp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vp(o){return{baseLanes:o,cachePool:fy()}}function Yp(o,a,c){return o=o!==null?o.childLanes&~c:0,a&&(o|=Sn),o}function Ex(o,a,c){var p=a.pendingProps,x=!1,k=(a.flags&128)!==0,j;if((j=k)||(j=o!==null&&o.memoizedState===null?!1:(bt.current&2)!==0),j&&(x=!0,a.flags&=-129),j=(a.flags&32)!==0,a.flags&=-33,o===null){if(Ge){if(x?sr(a):lr(),(o=ct)?(o=z0(o,zn),o=o!==null&&o.data!=="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:er!==null?{id:oo,overflow:ro}:null,retryLane:536870912,hydrationErrors:null},c=ry(o),c.return=a,a.child=c,Pt=a,ct=null)):o=null,o===null)throw nr(a);return _f(o)?a.lanes=32:a.lanes=536870912,null}var P=p.children;return p=p.fallback,x?(lr(),x=a.mode,P=Sc({mode:"hidden",children:P},x),p=Hr(p,x,c,null),P.return=a,p.return=a,P.sibling=p,a.child=P,p=a.child,p.memoizedState=Vp(c),p.childLanes=Yp(o,j,c),a.memoizedState=Kp,os(null,p)):(sr(a),Wp(a,P))}var X=o.memoizedState;if(X!==null&&(P=X.dehydrated,P!==null)){if(k)a.flags&256?(sr(a),a.flags&=-257,a=Xp(o,a,c)):a.memoizedState!==null?(lr(),a.child=o.child,a.flags|=128,a=null):(lr(),P=p.fallback,x=a.mode,p=Sc({mode:"visible",children:p.children},x),P=Hr(P,x,c,null),P.flags|=2,p.return=a,P.return=a,p.sibling=P,a.child=p,Wr(a,o.child,null,c),p=a.child,p.memoizedState=Vp(c),p.childLanes=Yp(o,j,c),a.memoizedState=Kp,a=os(null,p));else if(sr(a),_f(P)){if(j=P.nextSibling&&P.nextSibling.dataset,j)var ne=j.dgst;j=ne,p=Error(r(419)),p.stack="",p.digest=j,Gi({value:p,source:null,stack:null}),a=Xp(o,a,c)}else if(Tt||Fa(o,a,c,!1),j=(c&o.childLanes)!==0,Tt||j){if(j=it,j!==null&&(p=zl(j,c),p!==0&&p!==X.retryLane))throw X.retryLane=p,Br(o,p),cn(j,o,p),qp;Nf(P)||Dc(),a=Xp(o,a,c)}else Nf(P)?(a.flags|=192,a.child=o.child,a=null):(o=X.treeContext,ct=On(P.nextSibling),Pt=a,Ge=!0,tr=null,zn=!1,o!==null&&sy(a,o),a=Wp(a,p.children),a.flags|=4096);return a}return x?(lr(),P=p.fallback,x=a.mode,X=o.child,ne=X.sibling,p=So(X,{mode:"hidden",children:p.children}),p.subtreeFlags=X.subtreeFlags&65011712,ne!==null?P=So(ne,P):(P=Hr(P,x,c,null),P.flags|=2),P.return=a,p.return=a,p.sibling=P,a.child=p,os(null,p),p=a.child,P=o.child.memoizedState,P===null?P=Vp(c):(x=P.cachePool,x!==null?(X=Et._currentValue,x=x.parent!==X?{parent:X,pool:X}:x):x=fy(),P={baseLanes:P.baseLanes|c,cachePool:x}),p.memoizedState=P,p.childLanes=Yp(o,j,c),a.memoizedState=Kp,os(o.child,p)):(sr(a),c=o.child,o=c.sibling,c=So(c,{mode:"visible",children:p.children}),c.return=a,c.sibling=null,o!==null&&(j=a.deletions,j===null?(a.deletions=[o],a.flags|=16):j.push(o)),a.child=c,a.memoizedState=null,c)}function Wp(o,a){return a=Sc({mode:"visible",children:a},o.mode),a.return=o,o.child=a}function Sc(o,a){return o=bn(22,o,null,a),o.lanes=0,o}function Xp(o,a,c){return Wr(a,o.child,null,c),o=Wp(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function Mx(o,a,c){o.lanes|=a;var p=o.alternate;p!==null&&(p.lanes|=a),dp(o.return,a,c)}function Zp(o,a,c,p,x,k){var j=o.memoizedState;j===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:p,tail:c,tailMode:x,treeForkCount:k}:(j.isBackwards=a,j.rendering=null,j.renderingStartTime=0,j.last=p,j.tail=c,j.tailMode=x,j.treeForkCount=k)}function Tx(o,a,c){var p=a.pendingProps,x=p.revealOrder,k=p.tail;p=p.children;var j=bt.current,P=(j&2)!==0;if(P?(j=j&1|2,a.flags|=128):j&=1,z(bt,j),Ht(o,a,p,c),p=Ge?qi:0,!P&&o!==null&&(o.flags&128)!==0)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Mx(o,c,a);else if(o.tag===19)Mx(o,c,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break e;for(;o.sibling===null;){if(o.return===null||o.return===a)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(x){case"forwards":for(c=a.child,x=null;c!==null;)o=c.alternate,o!==null&&dc(o)===null&&(x=c),c=c.sibling;c=x,c===null?(x=a.child,a.child=null):(x=c.sibling,c.sibling=null),Zp(a,!1,x,c,k,p);break;case"backwards":case"unstable_legacy-backwards":for(c=null,x=a.child,a.child=null;x!==null;){if(o=x.alternate,o!==null&&dc(o)===null){a.child=x;break}o=x.sibling,x.sibling=c,c=x,x=o}Zp(a,!0,c,null,k,p);break;case"together":Zp(a,!1,null,null,void 0,p);break;default:a.memoizedState=null}return a.child}function Ao(o,a,c){if(o!==null&&(a.dependencies=o.dependencies),dr|=a.lanes,(c&a.childLanes)===0)if(o!==null){if(Fa(o,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(o!==null&&a.child!==o.child)throw Error(r(153));if(a.child!==null){for(o=a.child,c=So(o,o.pendingProps),a.child=c,c.return=a;o.sibling!==null;)o=o.sibling,c=c.sibling=So(o,o.pendingProps),c.return=a;c.sibling=null}return a.child}function Qp(o,a){return(o.lanes&a)!==0?!0:(o=o.dependencies,!!(o!==null&&oc(o)))}function QC(o,a,c){switch(a.tag){case 3:G(a,a.stateNode.containerInfo),or(a,Et,o.memoizedState.cache),Ur();break;case 27:case 5:be(a);break;case 4:G(a,a.stateNode.containerInfo);break;case 10:or(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Sp(a),null;break;case 13:var p=a.memoizedState;if(p!==null)return p.dehydrated!==null?(sr(a),a.flags|=128,null):(c&a.child.childLanes)!==0?Ex(o,a,c):(sr(a),o=Ao(o,a,c),o!==null?o.sibling:null);sr(a);break;case 19:var x=(o.flags&128)!==0;if(p=(c&a.childLanes)!==0,p||(Fa(o,a,c,!1),p=(c&a.childLanes)!==0),x){if(p)return Tx(o,a,c);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),z(bt,bt.current),p)break;return null;case 22:return a.lanes=0,bx(o,a,c,a.pendingProps);case 24:or(a,Et,o.memoizedState.cache)}return Ao(o,a,c)}function jx(o,a,c){if(o!==null)if(o.memoizedProps!==a.pendingProps)Tt=!0;else{if(!Qp(o,c)&&(a.flags&128)===0)return Tt=!1,QC(o,a,c);Tt=(o.flags&131072)!==0}else Tt=!1,Ge&&(a.flags&1048576)!==0&&iy(a,qi,a.index);switch(a.lanes=0,a.tag){case 16:e:{var p=a.pendingProps;if(o=Vr(a.elementType),a.type=o,typeof o=="function")op(o)?(p=Zr(o,p),a.tag=1,a=Sx(null,a,o,p,c)):(a.tag=0,a=Gp(null,a,o,p,c));else{if(o!=null){var x=o.$$typeof;if(x===N){a.tag=11,a=gx(null,a,o,p,c);break e}else if(x===D){a.tag=14,a=yx(null,a,o,p,c);break e}}throw a=U(o)||o,Error(r(306,a,""))}}return a;case 0:return Gp(o,a,a.type,a.pendingProps,c);case 1:return p=a.type,x=Zr(p,a.pendingProps),Sx(o,a,p,x,c);case 3:e:{if(G(a,a.stateNode.containerInfo),o===null)throw Error(r(387));p=a.pendingProps;var k=a.memoizedState;x=k.element,xp(o,a),Qi(a,p,null,c);var j=a.memoizedState;if(p=j.cache,or(a,Et,p),p!==k.cache&&pp(a,[Et],c,!0),Zi(),p=j.element,k.isDehydrated)if(k={element:p,isDehydrated:!1,cache:j.cache},a.updateQueue.baseState=k,a.memoizedState=k,a.flags&256){a=Cx(o,a,p,c);break e}else if(p!==x){x=Nn(Error(r(424)),a),Gi(x),a=Cx(o,a,p,c);break e}else for(o=a.stateNode.containerInfo,o.nodeType===9?o=o.body:o=o.nodeName==="HTML"?o.ownerDocument.body:o,ct=On(o.firstChild),Pt=a,Ge=!0,tr=null,zn=!0,c=by(a,null,p,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(Ur(),p===x){a=Ao(o,a,c);break e}Ht(o,a,p,c)}a=a.child}return a;case 26:return wc(o,a),o===null?(c=L0(a.type,null,a.pendingProps,null))?a.memoizedState=c:Ge||(c=a.type,o=a.pendingProps,p=Lc(le.current).createElement(c),p[Dt]=a,p[Kt]=o,Ut(p,c,o),Ct(p),a.stateNode=p):a.memoizedState=L0(a.type,o.memoizedProps,a.pendingProps,o.memoizedState),null;case 27:return be(a),o===null&&Ge&&(p=a.stateNode=I0(a.type,a.pendingProps,le.current),Pt=a,zn=!0,x=ct,gr(a.type)?(Df=x,ct=On(p.firstChild)):ct=x),Ht(o,a,a.pendingProps.children,c),wc(o,a),o===null&&(a.flags|=4194304),a.child;case 5:return o===null&&Ge&&((x=p=ct)&&(p=jE(p,a.type,a.pendingProps,zn),p!==null?(a.stateNode=p,Pt=a,ct=On(p.firstChild),zn=!1,x=!0):x=!1),x||nr(a)),be(a),x=a.type,k=a.pendingProps,j=o!==null?o.memoizedProps:null,p=k.children,Tf(x,k)?p=null:j!==null&&Tf(x,j)&&(a.flags|=32),a.memoizedState!==null&&(x=Ep(o,a,UC,null,null,c),xs._currentValue=x),wc(o,a),Ht(o,a,p,c),a.child;case 6:return o===null&&Ge&&((o=c=ct)&&(c=AE(c,a.pendingProps,zn),c!==null?(a.stateNode=c,Pt=a,ct=null,o=!0):o=!1),o||nr(a)),null;case 13:return Ex(o,a,c);case 4:return G(a,a.stateNode.containerInfo),p=a.pendingProps,o===null?a.child=Wr(a,null,p,c):Ht(o,a,p,c),a.child;case 11:return gx(o,a,a.type,a.pendingProps,c);case 7:return Ht(o,a,a.pendingProps,c),a.child;case 8:return Ht(o,a,a.pendingProps.children,c),a.child;case 12:return Ht(o,a,a.pendingProps.children,c),a.child;case 10:return p=a.pendingProps,or(a,a.type,p.value),Ht(o,a,p.children,c),a.child;case 9:return x=a.type._context,p=a.pendingProps.children,Gr(a),x=Bt(x),p=p(x),a.flags|=1,Ht(o,a,p,c),a.child;case 14:return yx(o,a,a.type,a.pendingProps,c);case 15:return xx(o,a,a.type,a.pendingProps,c);case 19:return Tx(o,a,c);case 31:return ZC(o,a,c);case 22:return bx(o,a,c,a.pendingProps);case 24:return Gr(a),p=Bt(Et),o===null?(x=hp(),x===null&&(x=it,k=fp(),x.pooledCache=k,k.refCount++,k!==null&&(x.pooledCacheLanes|=c),x=k),a.memoizedState={parent:p,cache:x},yp(a),or(a,Et,x)):((o.lanes&c)!==0&&(xp(o,a),Qi(a,null,null,c),Zi()),x=o.memoizedState,k=a.memoizedState,x.parent!==p?(x={parent:p,cache:p},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),or(a,Et,p)):(p=k.cache,or(a,Et,p),p!==x.cache&&pp(a,[Et],c,!0))),Ht(o,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function No(o){o.flags|=4}function Jp(o,a,c,p,x){if((a=(o.mode&32)!==0)&&(a=!1),a){if(o.flags|=16777216,(x&335544128)===x)if(o.stateNode.complete)o.flags|=8192;else if(t0())o.flags|=8192;else throw Yr=sc,gp}else o.flags&=-16777217}function Ax(o,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!q0(a))if(t0())o.flags|=8192;else throw Yr=sc,gp}function Cc(o,a){a!==null&&(o.flags|=4),o.flags&16384&&(a=o.tag!==22?Nl():536870912,o.lanes|=a,Wa|=a)}function rs(o,a){if(!Ge)switch(o.tailMode){case"hidden":a=o.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?o.tail=null:c.sibling=null;break;case"collapsed":c=o.tail;for(var p=null;c!==null;)c.alternate!==null&&(p=c),c=c.sibling;p===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:p.sibling=null}}function ut(o){var a=o.alternate!==null&&o.alternate.child===o.child,c=0,p=0;if(a)for(var x=o.child;x!==null;)c|=x.lanes|x.childLanes,p|=x.subtreeFlags&65011712,p|=x.flags&65011712,x.return=o,x=x.sibling;else for(x=o.child;x!==null;)c|=x.lanes|x.childLanes,p|=x.subtreeFlags,p|=x.flags,x.return=o,x=x.sibling;return o.subtreeFlags|=p,o.childLanes=c,a}function JC(o,a,c){var p=a.pendingProps;switch(sp(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ut(a),null;case 1:return ut(a),null;case 3:return c=a.stateNode,p=null,o!==null&&(p=o.memoizedState.cache),a.memoizedState.cache!==p&&(a.flags|=2048),Mo(Et),ce(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(o===null||o.child===null)&&(Ia(a)?No(a):o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,cp())),ut(a),null;case 26:var x=a.type,k=a.memoizedState;return o===null?(No(a),k!==null?(ut(a),Ax(a,k)):(ut(a),Jp(a,x,null,p,c))):k?k!==o.memoizedState?(No(a),ut(a),Ax(a,k)):(ut(a),a.flags&=-16777217):(o=o.memoizedProps,o!==p&&No(a),ut(a),Jp(a,x,o,p,c)),null;case 27:if(we(a),c=le.current,x=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==p&&No(a);else{if(!p){if(a.stateNode===null)throw Error(r(166));return ut(a),null}o=W.current,Ia(a)?ly(a):(o=I0(x,p,c),a.stateNode=o,No(a))}return ut(a),null;case 5:if(we(a),x=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==p&&No(a);else{if(!p){if(a.stateNode===null)throw Error(r(166));return ut(a),null}if(k=W.current,Ia(a))ly(a);else{var j=Lc(le.current);switch(k){case 1:k=j.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:k=j.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":k=j.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":k=j.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":k=j.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof p.is=="string"?j.createElement("select",{is:p.is}):j.createElement("select"),p.multiple?k.multiple=!0:p.size&&(k.size=p.size);break;default:k=typeof p.is=="string"?j.createElement(x,{is:p.is}):j.createElement(x)}}k[Dt]=a,k[Kt]=p;e:for(j=a.child;j!==null;){if(j.tag===5||j.tag===6)k.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===a)break e;for(;j.sibling===null;){if(j.return===null||j.return===a)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}a.stateNode=k;e:switch(Ut(k,x,p),x){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&No(a)}}return ut(a),Jp(a,a.type,o===null?null:o.memoizedProps,a.pendingProps,c),null;case 6:if(o&&a.stateNode!=null)o.memoizedProps!==p&&No(a);else{if(typeof p!="string"&&a.stateNode===null)throw Error(r(166));if(o=le.current,Ia(a)){if(o=a.stateNode,c=a.memoizedProps,p=null,x=Pt,x!==null)switch(x.tag){case 27:case 5:p=x.memoizedProps}o[Dt]=a,o=!!(o.nodeValue===c||p!==null&&p.suppressHydrationWarning===!0||E0(o.nodeValue,c)),o||nr(a,!0)}else o=Lc(o).createTextNode(p),o[Dt]=a,a.stateNode=o}return ut(a),null;case 31:if(c=a.memoizedState,o===null||o.memoizedState!==null){if(p=Ia(a),c!==null){if(o===null){if(!p)throw Error(r(318));if(o=a.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Dt]=a}else Ur(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;ut(a),o=!1}else c=cp(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=c),o=!0;if(!o)return a.flags&256?(vn(a),a):(vn(a),null);if((a.flags&128)!==0)throw Error(r(558))}return ut(a),null;case 13:if(p=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(x=Ia(a),p!==null&&p.dehydrated!==null){if(o===null){if(!x)throw Error(r(318));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[Dt]=a}else Ur(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;ut(a),x=!1}else x=cp(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(vn(a),a):(vn(a),null)}return vn(a),(a.flags&128)!==0?(a.lanes=c,a):(c=p!==null,o=o!==null&&o.memoizedState!==null,c&&(p=a.child,x=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(x=p.alternate.memoizedState.cachePool.pool),k=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(k=p.memoizedState.cachePool.pool),k!==x&&(p.flags|=2048)),c!==o&&c&&(a.child.flags|=8192),Cc(a,a.updateQueue),ut(a),null);case 4:return ce(),o===null&&wf(a.stateNode.containerInfo),ut(a),null;case 10:return Mo(a.type),ut(a),null;case 19:if(L(bt),p=a.memoizedState,p===null)return ut(a),null;if(x=(a.flags&128)!==0,k=p.rendering,k===null)if(x)rs(p,!1);else{if(yt!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(k=dc(o),k!==null){for(a.flags|=128,rs(p,!1),o=k.updateQueue,a.updateQueue=o,Cc(a,o),a.subtreeFlags=0,o=c,c=a.child;c!==null;)oy(c,o),c=c.sibling;return z(bt,bt.current&1|2),Ge&&Co(a,p.treeForkCount),a.child}o=o.sibling}p.tail!==null&&_t()>Ac&&(a.flags|=128,x=!0,rs(p,!1),a.lanes=4194304)}else{if(!x)if(o=dc(k),o!==null){if(a.flags|=128,x=!0,o=o.updateQueue,a.updateQueue=o,Cc(a,o),rs(p,!0),p.tail===null&&p.tailMode==="hidden"&&!k.alternate&&!Ge)return ut(a),null}else 2*_t()-p.renderingStartTime>Ac&&c!==536870912&&(a.flags|=128,x=!0,rs(p,!1),a.lanes=4194304);p.isBackwards?(k.sibling=a.child,a.child=k):(o=p.last,o!==null?o.sibling=k:a.child=k,p.last=k)}return p.tail!==null?(o=p.tail,p.rendering=o,p.tail=o.sibling,p.renderingStartTime=_t(),o.sibling=null,c=bt.current,z(bt,x?c&1|2:c&1),Ge&&Co(a,p.treeForkCount),o):(ut(a),null);case 22:case 23:return vn(a),wp(),p=a.memoizedState!==null,o!==null?o.memoizedState!==null!==p&&(a.flags|=8192):p&&(a.flags|=8192),p?(c&536870912)!==0&&(a.flags&128)===0&&(ut(a),a.subtreeFlags&6&&(a.flags|=8192)):ut(a),c=a.updateQueue,c!==null&&Cc(a,c.retryQueue),c=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(c=o.memoizedState.cachePool.pool),p=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(p=a.memoizedState.cachePool.pool),p!==c&&(a.flags|=2048),o!==null&&L(Kr),null;case 24:return c=null,o!==null&&(c=o.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Mo(Et),ut(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function eE(o,a){switch(sp(a),a.tag){case 1:return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return Mo(Et),ce(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 26:case 27:case 5:return we(a),null;case 31:if(a.memoizedState!==null){if(vn(a),a.alternate===null)throw Error(r(340));Ur()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 13:if(vn(a),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(r(340));Ur()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return L(bt),null;case 4:return ce(),null;case 10:return Mo(a.type),null;case 22:case 23:return vn(a),wp(),o!==null&&L(Kr),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 24:return Mo(Et),null;case 25:return null;default:return null}}function Nx(o,a){switch(sp(a),a.tag){case 3:Mo(Et),ce();break;case 26:case 27:case 5:we(a);break;case 4:ce();break;case 31:a.memoizedState!==null&&vn(a);break;case 13:vn(a);break;case 19:L(bt);break;case 10:Mo(a.type);break;case 22:case 23:vn(a),wp(),o!==null&&L(Kr);break;case 24:Mo(Et)}}function as(o,a){try{var c=a.updateQueue,p=c!==null?c.lastEffect:null;if(p!==null){var x=p.next;c=x;do{if((c.tag&o)===o){p=void 0;var k=c.create,j=c.inst;p=k(),j.destroy=p}c=c.next}while(c!==x)}}catch(P){et(a,a.return,P)}}function cr(o,a,c){try{var p=a.updateQueue,x=p!==null?p.lastEffect:null;if(x!==null){var k=x.next;p=k;do{if((p.tag&o)===o){var j=p.inst,P=j.destroy;if(P!==void 0){j.destroy=void 0,x=a;var X=c,ne=P;try{ne()}catch(de){et(x,X,de)}}}p=p.next}while(p!==k)}}catch(de){et(a,a.return,de)}}function _x(o){var a=o.updateQueue;if(a!==null){var c=o.stateNode;try{vy(a,c)}catch(p){et(o,o.return,p)}}}function Dx(o,a,c){c.props=Zr(o.type,o.memoizedProps),c.state=o.memoizedState;try{c.componentWillUnmount()}catch(p){et(o,a,p)}}function is(o,a){try{var c=o.ref;if(c!==null){switch(o.tag){case 26:case 27:case 5:var p=o.stateNode;break;case 30:p=o.stateNode;break;default:p=o.stateNode}typeof c=="function"?o.refCleanup=c(p):c.current=p}}catch(x){et(o,a,x)}}function ao(o,a){var c=o.ref,p=o.refCleanup;if(c!==null)if(typeof p=="function")try{p()}catch(x){et(o,a,x)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(x){et(o,a,x)}else c.current=null}function zx(o){var a=o.type,c=o.memoizedProps,p=o.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&p.focus();break e;case"img":c.src?p.src=c.src:c.srcSet&&(p.srcset=c.srcSet)}}catch(x){et(o,o.return,x)}}function ef(o,a,c){try{var p=o.stateNode;wE(p,o.type,c,a),p[Kt]=a}catch(x){et(o,o.return,x)}}function Rx(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&gr(o.type)||o.tag===4}function tf(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Rx(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&gr(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function nf(o,a,c){var p=o.tag;if(p===5||p===6)o=o.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(o,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(o),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=vo));else if(p!==4&&(p===27&&gr(o.type)&&(c=o.stateNode,a=null),o=o.child,o!==null))for(nf(o,a,c),o=o.sibling;o!==null;)nf(o,a,c),o=o.sibling}function Ec(o,a,c){var p=o.tag;if(p===5||p===6)o=o.stateNode,a?c.insertBefore(o,a):c.appendChild(o);else if(p!==4&&(p===27&&gr(o.type)&&(c=o.stateNode),o=o.child,o!==null))for(Ec(o,a,c),o=o.sibling;o!==null;)Ec(o,a,c),o=o.sibling}function Ox(o){var a=o.stateNode,c=o.memoizedProps;try{for(var p=o.type,x=a.attributes;x.length;)a.removeAttributeNode(x[0]);Ut(a,p,c),a[Dt]=o,a[Kt]=c}catch(k){et(o,o.return,k)}}var _o=!1,jt=!1,of=!1,Ix=typeof WeakSet=="function"?WeakSet:Set,It=null;function tE(o,a){if(o=o.containerInfo,Ef=Kc,o=Yg(o),Xd(o)){if("selectionStart"in o)var c={start:o.selectionStart,end:o.selectionEnd};else e:{c=(c=o.ownerDocument)&&c.defaultView||window;var p=c.getSelection&&c.getSelection();if(p&&p.rangeCount!==0){c=p.anchorNode;var x=p.anchorOffset,k=p.focusNode;p=p.focusOffset;try{c.nodeType,k.nodeType}catch{c=null;break e}var j=0,P=-1,X=-1,ne=0,de=0,fe=o,re=null;t:for(;;){for(var se;fe!==c||x!==0&&fe.nodeType!==3||(P=j+x),fe!==k||p!==0&&fe.nodeType!==3||(X=j+p),fe.nodeType===3&&(j+=fe.nodeValue.length),(se=fe.firstChild)!==null;)re=fe,fe=se;for(;;){if(fe===o)break t;if(re===c&&++ne===x&&(P=j),re===k&&++de===p&&(X=j),(se=fe.nextSibling)!==null)break;fe=re,re=fe.parentNode}fe=se}c=P===-1||X===-1?null:{start:P,end:X}}else c=null}c=c||{start:0,end:0}}else c=null;for(Mf={focusedElem:o,selectionRange:c},Kc=!1,It=a;It!==null;)if(a=It,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,It=o;else for(;It!==null;){switch(a=It,k=a.alternate,o=a.flags,a.tag){case 0:if((o&4)!==0&&(o=a.updateQueue,o=o!==null?o.events:null,o!==null))for(c=0;c<o.length;c++)x=o[c],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&k!==null){o=void 0,c=a,x=k.memoizedProps,k=k.memoizedState,p=c.stateNode;try{var Se=Zr(c.type,x);o=p.getSnapshotBeforeUpdate(Se,k),p.__reactInternalSnapshotBeforeUpdate=o}catch(_e){et(c,c.return,_e)}}break;case 3:if((o&1024)!==0){if(o=a.stateNode.containerInfo,c=o.nodeType,c===9)Af(o);else if(c===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":Af(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=a.sibling,o!==null){o.return=a.return,It=o;break}It=a.return}}function Fx(o,a,c){var p=c.flags;switch(c.tag){case 0:case 11:case 15:zo(o,c),p&4&&as(5,c);break;case 1:if(zo(o,c),p&4)if(o=c.stateNode,a===null)try{o.componentDidMount()}catch(j){et(c,c.return,j)}else{var x=Zr(c.type,a.memoizedProps);a=a.memoizedState;try{o.componentDidUpdate(x,a,o.__reactInternalSnapshotBeforeUpdate)}catch(j){et(c,c.return,j)}}p&64&&_x(c),p&512&&is(c,c.return);break;case 3:if(zo(o,c),p&64&&(o=c.updateQueue,o!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{vy(o,a)}catch(j){et(c,c.return,j)}}break;case 27:a===null&&p&4&&Ox(c);case 26:case 5:zo(o,c),a===null&&p&4&&zx(c),p&512&&is(c,c.return);break;case 12:zo(o,c);break;case 31:zo(o,c),p&4&&Px(o,c);break;case 13:zo(o,c),p&4&&Bx(o,c),p&64&&(o=c.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(c=uE.bind(null,c),NE(o,c))));break;case 22:if(p=c.memoizedState!==null||_o,!p){a=a!==null&&a.memoizedState!==null||jt,x=_o;var k=jt;_o=p,(jt=a)&&!k?Ro(o,c,(c.subtreeFlags&8772)!==0):zo(o,c),_o=x,jt=k}break;case 30:break;default:zo(o,c)}}function $x(o){var a=o.alternate;a!==null&&(o.alternate=null,$x(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&Di(a)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var pt=null,rn=!1;function Do(o,a,c){for(c=c.child;c!==null;)Lx(o,a,c),c=c.sibling}function Lx(o,a,c){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(Lt,c)}catch{}switch(c.tag){case 26:jt||ao(c,a),Do(o,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:jt||ao(c,a);var p=pt,x=rn;gr(c.type)&&(pt=c.stateNode,rn=!1),Do(o,a,c),hs(c.stateNode),pt=p,rn=x;break;case 5:jt||ao(c,a);case 6:if(p=pt,x=rn,pt=null,Do(o,a,c),pt=p,rn=x,pt!==null)if(rn)try{(pt.nodeType===9?pt.body:pt.nodeName==="HTML"?pt.ownerDocument.body:pt).removeChild(c.stateNode)}catch(k){et(c,a,k)}else try{pt.removeChild(c.stateNode)}catch(k){et(c,a,k)}break;case 18:pt!==null&&(rn?(o=pt,_0(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,c.stateNode),oi(o)):_0(pt,c.stateNode));break;case 4:p=pt,x=rn,pt=c.stateNode.containerInfo,rn=!0,Do(o,a,c),pt=p,rn=x;break;case 0:case 11:case 14:case 15:cr(2,c,a),jt||cr(4,c,a),Do(o,a,c);break;case 1:jt||(ao(c,a),p=c.stateNode,typeof p.componentWillUnmount=="function"&&Dx(c,a,p)),Do(o,a,c);break;case 21:Do(o,a,c);break;case 22:jt=(p=jt)||c.memoizedState!==null,Do(o,a,c),jt=p;break;default:Do(o,a,c)}}function Px(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{oi(o)}catch(c){et(a,a.return,c)}}}function Bx(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{oi(o)}catch(c){et(a,a.return,c)}}function nE(o){switch(o.tag){case 31:case 13:case 19:var a=o.stateNode;return a===null&&(a=o.stateNode=new Ix),a;case 22:return o=o.stateNode,a=o._retryCache,a===null&&(a=o._retryCache=new Ix),a;default:throw Error(r(435,o.tag))}}function Mc(o,a){var c=nE(o);a.forEach(function(p){if(!c.has(p)){c.add(p);var x=dE.bind(null,o,p);p.then(x,x)}})}function an(o,a){var c=a.deletions;if(c!==null)for(var p=0;p<c.length;p++){var x=c[p],k=o,j=a,P=j;e:for(;P!==null;){switch(P.tag){case 27:if(gr(P.type)){pt=P.stateNode,rn=!1;break e}break;case 5:pt=P.stateNode,rn=!1;break e;case 3:case 4:pt=P.stateNode.containerInfo,rn=!0;break e}P=P.return}if(pt===null)throw Error(r(160));Lx(k,j,x),pt=null,rn=!1,k=x.alternate,k!==null&&(k.return=null),x.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Hx(a,o),a=a.sibling}var Kn=null;function Hx(o,a){var c=o.alternate,p=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:an(a,o),sn(o),p&4&&(cr(3,o,o.return),as(3,o),cr(5,o,o.return));break;case 1:an(a,o),sn(o),p&512&&(jt||c===null||ao(c,c.return)),p&64&&_o&&(o=o.updateQueue,o!==null&&(p=o.callbacks,p!==null&&(c=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=c===null?p:c.concat(p))));break;case 26:var x=Kn;if(an(a,o),sn(o),p&512&&(jt||c===null||ao(c,c.return)),p&4){var k=c!==null?c.memoizedState:null;if(p=o.memoizedState,c===null)if(p===null)if(o.stateNode===null){e:{p=o.type,c=o.memoizedProps,x=x.ownerDocument||x;t:switch(p){case"title":k=x.getElementsByTagName("title")[0],(!k||k[Or]||k[Dt]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=x.createElement(p),x.head.insertBefore(k,x.querySelector("head > title"))),Ut(k,p,c),k[Dt]=o,Ct(k),p=k;break e;case"link":var j=H0("link","href",x).get(p+(c.href||""));if(j){for(var P=0;P<j.length;P++)if(k=j[P],k.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&k.getAttribute("rel")===(c.rel==null?null:c.rel)&&k.getAttribute("title")===(c.title==null?null:c.title)&&k.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){j.splice(P,1);break t}}k=x.createElement(p),Ut(k,p,c),x.head.appendChild(k);break;case"meta":if(j=H0("meta","content",x).get(p+(c.content||""))){for(P=0;P<j.length;P++)if(k=j[P],k.getAttribute("content")===(c.content==null?null:""+c.content)&&k.getAttribute("name")===(c.name==null?null:c.name)&&k.getAttribute("property")===(c.property==null?null:c.property)&&k.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&k.getAttribute("charset")===(c.charSet==null?null:c.charSet)){j.splice(P,1);break t}}k=x.createElement(p),Ut(k,p,c),x.head.appendChild(k);break;default:throw Error(r(468,p))}k[Dt]=o,Ct(k),p=k}o.stateNode=p}else U0(x,o.type,o.stateNode);else o.stateNode=B0(x,p,o.memoizedProps);else k!==p?(k===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):k.count--,p===null?U0(x,o.type,o.stateNode):B0(x,p,o.memoizedProps)):p===null&&o.stateNode!==null&&ef(o,o.memoizedProps,c.memoizedProps)}break;case 27:an(a,o),sn(o),p&512&&(jt||c===null||ao(c,c.return)),c!==null&&p&4&&ef(o,o.memoizedProps,c.memoizedProps);break;case 5:if(an(a,o),sn(o),p&512&&(jt||c===null||ao(c,c.return)),o.flags&32){x=o.stateNode;try{Ma(x,"")}catch(Se){et(o,o.return,Se)}}p&4&&o.stateNode!=null&&(x=o.memoizedProps,ef(o,x,c!==null?c.memoizedProps:x)),p&1024&&(of=!0);break;case 6:if(an(a,o),sn(o),p&4){if(o.stateNode===null)throw Error(r(162));p=o.memoizedProps,c=o.stateNode;try{c.nodeValue=p}catch(Se){et(o,o.return,Se)}}break;case 3:if(Hc=null,x=Kn,Kn=Pc(a.containerInfo),an(a,o),Kn=x,sn(o),p&4&&c!==null&&c.memoizedState.isDehydrated)try{oi(a.containerInfo)}catch(Se){et(o,o.return,Se)}of&&(of=!1,Ux(o));break;case 4:p=Kn,Kn=Pc(o.stateNode.containerInfo),an(a,o),sn(o),Kn=p;break;case 12:an(a,o),sn(o);break;case 31:an(a,o),sn(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,Mc(o,p)));break;case 13:an(a,o),sn(o),o.child.flags&8192&&o.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(jc=_t()),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,Mc(o,p)));break;case 22:x=o.memoizedState!==null;var X=c!==null&&c.memoizedState!==null,ne=_o,de=jt;if(_o=ne||x,jt=de||X,an(a,o),jt=de,_o=ne,sn(o),p&8192)e:for(a=o.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,x&&(c===null||X||_o||jt||Qr(o)),c=null,a=o;;){if(a.tag===5||a.tag===26){if(c===null){X=c=a;try{if(k=X.stateNode,x)j=k.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{P=X.stateNode;var fe=X.memoizedProps.style,re=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;P.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(Se){et(X,X.return,Se)}}}else if(a.tag===6){if(c===null){X=a;try{X.stateNode.nodeValue=x?"":X.memoizedProps}catch(Se){et(X,X.return,Se)}}}else if(a.tag===18){if(c===null){X=a;try{var se=X.stateNode;x?D0(se,!0):D0(X.stateNode,!1)}catch(Se){et(X,X.return,Se)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===o)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break e;for(;a.sibling===null;){if(a.return===null||a.return===o)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}p&4&&(p=o.updateQueue,p!==null&&(c=p.retryQueue,c!==null&&(p.retryQueue=null,Mc(o,c))));break;case 19:an(a,o),sn(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,Mc(o,p)));break;case 30:break;case 21:break;default:an(a,o),sn(o)}}function sn(o){var a=o.flags;if(a&2){try{for(var c,p=o.return;p!==null;){if(Rx(p)){c=p;break}p=p.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var x=c.stateNode,k=tf(o);Ec(o,k,x);break;case 5:var j=c.stateNode;c.flags&32&&(Ma(j,""),c.flags&=-33);var P=tf(o);Ec(o,P,j);break;case 3:case 4:var X=c.stateNode.containerInfo,ne=tf(o);nf(o,ne,X);break;default:throw Error(r(161))}}catch(de){et(o,o.return,de)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function Ux(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var a=o;Ux(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),o=o.sibling}}function zo(o,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Fx(o,a.alternate,a),a=a.sibling}function Qr(o){for(o=o.child;o!==null;){var a=o;switch(a.tag){case 0:case 11:case 14:case 15:cr(4,a,a.return),Qr(a);break;case 1:ao(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&Dx(a,a.return,c),Qr(a);break;case 27:hs(a.stateNode);case 26:case 5:ao(a,a.return),Qr(a);break;case 22:a.memoizedState===null&&Qr(a);break;case 30:Qr(a);break;default:Qr(a)}o=o.sibling}}function Ro(o,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var p=a.alternate,x=o,k=a,j=k.flags;switch(k.tag){case 0:case 11:case 15:Ro(x,k,c),as(4,k);break;case 1:if(Ro(x,k,c),p=k,x=p.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(ne){et(p,p.return,ne)}if(p=k,x=p.updateQueue,x!==null){var P=p.stateNode;try{var X=x.shared.hiddenCallbacks;if(X!==null)for(x.shared.hiddenCallbacks=null,x=0;x<X.length;x++)ky(X[x],P)}catch(ne){et(p,p.return,ne)}}c&&j&64&&_x(k),is(k,k.return);break;case 27:Ox(k);case 26:case 5:Ro(x,k,c),c&&p===null&&j&4&&zx(k),is(k,k.return);break;case 12:Ro(x,k,c);break;case 31:Ro(x,k,c),c&&j&4&&Px(x,k);break;case 13:Ro(x,k,c),c&&j&4&&Bx(x,k);break;case 22:k.memoizedState===null&&Ro(x,k,c),is(k,k.return);break;case 30:break;default:Ro(x,k,c)}a=a.sibling}}function rf(o,a){var c=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(c=o.memoizedState.cachePool.pool),o=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),o!==c&&(o!=null&&o.refCount++,c!=null&&Ki(c))}function af(o,a){o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&Ki(o))}function Vn(o,a,c,p){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)qx(o,a,c,p),a=a.sibling}function qx(o,a,c,p){var x=a.flags;switch(a.tag){case 0:case 11:case 15:Vn(o,a,c,p),x&2048&&as(9,a);break;case 1:Vn(o,a,c,p);break;case 3:Vn(o,a,c,p),x&2048&&(o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&Ki(o)));break;case 12:if(x&2048){Vn(o,a,c,p),o=a.stateNode;try{var k=a.memoizedProps,j=k.id,P=k.onPostCommit;typeof P=="function"&&P(j,a.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(X){et(a,a.return,X)}}else Vn(o,a,c,p);break;case 31:Vn(o,a,c,p);break;case 13:Vn(o,a,c,p);break;case 23:break;case 22:k=a.stateNode,j=a.alternate,a.memoizedState!==null?k._visibility&2?Vn(o,a,c,p):ss(o,a):k._visibility&2?Vn(o,a,c,p):(k._visibility|=2,Ka(o,a,c,p,(a.subtreeFlags&10256)!==0||!1)),x&2048&&rf(j,a);break;case 24:Vn(o,a,c,p),x&2048&&af(a.alternate,a);break;default:Vn(o,a,c,p)}}function Ka(o,a,c,p,x){for(x=x&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var k=o,j=a,P=c,X=p,ne=j.flags;switch(j.tag){case 0:case 11:case 15:Ka(k,j,P,X,x),as(8,j);break;case 23:break;case 22:var de=j.stateNode;j.memoizedState!==null?de._visibility&2?Ka(k,j,P,X,x):ss(k,j):(de._visibility|=2,Ka(k,j,P,X,x)),x&&ne&2048&&rf(j.alternate,j);break;case 24:Ka(k,j,P,X,x),x&&ne&2048&&af(j.alternate,j);break;default:Ka(k,j,P,X,x)}a=a.sibling}}function ss(o,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=o,p=a,x=p.flags;switch(p.tag){case 22:ss(c,p),x&2048&&rf(p.alternate,p);break;case 24:ss(c,p),x&2048&&af(p.alternate,p);break;default:ss(c,p)}a=a.sibling}}var ls=8192;function Va(o,a,c){if(o.subtreeFlags&ls)for(o=o.child;o!==null;)Gx(o,a,c),o=o.sibling}function Gx(o,a,c){switch(o.tag){case 26:Va(o,a,c),o.flags&ls&&o.memoizedState!==null&&HE(c,Kn,o.memoizedState,o.memoizedProps);break;case 5:Va(o,a,c);break;case 3:case 4:var p=Kn;Kn=Pc(o.stateNode.containerInfo),Va(o,a,c),Kn=p;break;case 22:o.memoizedState===null&&(p=o.alternate,p!==null&&p.memoizedState!==null?(p=ls,ls=16777216,Va(o,a,c),ls=p):Va(o,a,c));break;default:Va(o,a,c)}}function Kx(o){var a=o.alternate;if(a!==null&&(o=a.child,o!==null)){a.child=null;do a=o.sibling,o.sibling=null,o=a;while(o!==null)}}function cs(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var p=a[c];It=p,Yx(p,o)}Kx(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Vx(o),o=o.sibling}function Vx(o){switch(o.tag){case 0:case 11:case 15:cs(o),o.flags&2048&&cr(9,o,o.return);break;case 3:cs(o);break;case 12:cs(o);break;case 22:var a=o.stateNode;o.memoizedState!==null&&a._visibility&2&&(o.return===null||o.return.tag!==13)?(a._visibility&=-3,Tc(o)):cs(o);break;default:cs(o)}}function Tc(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var p=a[c];It=p,Yx(p,o)}Kx(o)}for(o=o.child;o!==null;){switch(a=o,a.tag){case 0:case 11:case 15:cr(8,a,a.return),Tc(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,Tc(a));break;default:Tc(a)}o=o.sibling}}function Yx(o,a){for(;It!==null;){var c=It;switch(c.tag){case 0:case 11:case 15:cr(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var p=c.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:Ki(c.memoizedState.cache)}if(p=c.child,p!==null)p.return=c,It=p;else e:for(c=o;It!==null;){p=It;var x=p.sibling,k=p.return;if($x(p),p===c){It=null;break e}if(x!==null){x.return=k,It=x;break e}It=k}}}var oE={getCacheForType:function(o){var a=Bt(Et),c=a.data.get(o);return c===void 0&&(c=o(),a.data.set(o,c)),c},cacheSignal:function(){return Bt(Et).controller.signal}},rE=typeof WeakMap=="function"?WeakMap:Map,Ze=0,it=null,Pe=null,Ue=0,Je=0,wn=null,ur=!1,Ya=!1,sf=!1,Oo=0,yt=0,dr=0,Jr=0,lf=0,Sn=0,Wa=0,us=null,ln=null,cf=!1,jc=0,Wx=0,Ac=1/0,Nc=null,pr=null,zt=0,fr=null,Xa=null,Io=0,uf=0,df=null,Xx=null,ds=0,pf=null;function Cn(){return(Ze&2)!==0&&Ue!==0?Ue&-Ue:A.T!==null?xf():Rl()}function Zx(){if(Sn===0)if((Ue&536870912)===0||Ge){var o=ba;ba<<=1,(ba&3932160)===0&&(ba=262144),Sn=o}else Sn=536870912;return o=kn.current,o!==null&&(o.flags|=32),Sn}function cn(o,a,c){(o===it&&(Je===2||Je===9)||o.cancelPendingCommit!==null)&&(Za(o,0),mr(o,Ue,Sn,!1)),Rr(o,c),((Ze&2)===0||o!==it)&&(o===it&&((Ze&2)===0&&(Jr|=c),yt===4&&mr(o,Ue,Sn,!1)),io(o))}function Qx(o,a,c){if((Ze&6)!==0)throw Error(r(327));var p=!c&&(a&127)===0&&(a&o.expiredLanes)===0||zr(o,a),x=p?sE(o,a):mf(o,a,!0),k=p;do{if(x===0){Ya&&!p&&mr(o,a,0,!1);break}else{if(c=o.current.alternate,k&&!aE(c)){x=mf(o,a,!1),k=!1;continue}if(x===2){if(k=a,o.errorRecoveryDisabledLanes&k)var j=0;else j=o.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){a=j;e:{var P=o;x=us;var X=P.current.memoizedState.isDehydrated;if(X&&(Za(P,j).flags|=256),j=mf(P,j,!1),j!==2){if(sf&&!X){P.errorRecoveryDisabledLanes|=k,Jr|=k,x=4;break e}k=ln,ln=x,k!==null&&(ln===null?ln=k:ln.push.apply(ln,k))}x=j}if(k=!1,x!==2)continue}}if(x===1){Za(o,0),mr(o,a,0,!0);break}e:{switch(p=o,k=x,k){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:mr(p,a,Sn,!ur);break e;case 2:ln=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(x=jc+300-_t(),10<x)){if(mr(p,a,Sn,!ur),va(p,0,!0)!==0)break e;Io=a,p.timeoutHandle=A0(Jx.bind(null,p,c,ln,Nc,cf,a,Sn,Jr,Wa,ur,k,"Throttled",-0,0),x);break e}Jx(p,c,ln,Nc,cf,a,Sn,Jr,Wa,ur,k,null,-0,0)}}break}while(!0);io(o)}function Jx(o,a,c,p,x,k,j,P,X,ne,de,fe,re,se){if(o.timeoutHandle=-1,fe=a.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:vo},Gx(a,k,fe);var Se=(k&62914560)===k?jc-_t():(k&4194048)===k?Wx-_t():0;if(Se=UE(fe,Se),Se!==null){Io=k,o.cancelPendingCommit=Se(s0.bind(null,o,a,k,c,p,x,j,P,X,de,fe,null,re,se)),mr(o,k,j,!ne);return}}s0(o,a,k,c,p,x,j,P,X)}function aE(o){for(var a=o;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var p=0;p<c.length;p++){var x=c[p],k=x.getSnapshot;x=x.value;try{if(!xn(k(),x))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function mr(o,a,c,p){a&=~lf,a&=~Jr,o.suspendedLanes|=a,o.pingedLanes&=~a,p&&(o.warmLanes|=a),p=o.expirationTimes;for(var x=a;0<x;){var k=31-Qe(x),j=1<<k;p[k]=-1,x&=~j}c!==0&&_l(o,c,a)}function _c(){return(Ze&6)===0?(ps(0),!1):!0}function ff(){if(Pe!==null){if(Je===0)var o=Pe.return;else o=Pe,Eo=qr=null,jp(o),Ba=null,Yi=0,o=Pe;for(;o!==null;)Nx(o.alternate,o),o=o.return;Pe=null}}function Za(o,a){var c=o.timeoutHandle;c!==-1&&(o.timeoutHandle=-1,EE(c)),c=o.cancelPendingCommit,c!==null&&(o.cancelPendingCommit=null,c()),Io=0,ff(),it=o,Pe=c=So(o.current,null),Ue=a,Je=0,wn=null,ur=!1,Ya=zr(o,a),sf=!1,Wa=Sn=lf=Jr=dr=yt=0,ln=us=null,cf=!1,(a&8)!==0&&(a|=a&32);var p=o.entangledLanes;if(p!==0)for(o=o.entanglements,p&=a;0<p;){var x=31-Qe(p),k=1<<x;a|=o[x],p&=~k}return Oo=a,Ql(),c}function e0(o,a){Ie=null,A.H=ns,a===Pa||a===ic?(a=gy(),Je=3):a===gp?(a=gy(),Je=4):Je=a===qp?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,wn=a,Pe===null&&(yt=1,kc(o,Nn(a,o.current)))}function t0(){var o=kn.current;return o===null?!0:(Ue&4194048)===Ue?Rn===null:(Ue&62914560)===Ue||(Ue&536870912)!==0?o===Rn:!1}function n0(){var o=A.H;return A.H=ns,o===null?ns:o}function o0(){var o=A.A;return A.A=oE,o}function Dc(){yt=4,ur||(Ue&4194048)!==Ue&&kn.current!==null||(Ya=!0),(dr&134217727)===0&&(Jr&134217727)===0||it===null||mr(it,Ue,Sn,!1)}function mf(o,a,c){var p=Ze;Ze|=2;var x=n0(),k=o0();(it!==o||Ue!==a)&&(Nc=null,Za(o,a)),a=!1;var j=yt;e:do try{if(Je!==0&&Pe!==null){var P=Pe,X=wn;switch(Je){case 8:ff(),j=6;break e;case 3:case 2:case 9:case 6:kn.current===null&&(a=!0);var ne=Je;if(Je=0,wn=null,Qa(o,P,X,ne),c&&Ya){j=0;break e}break;default:ne=Je,Je=0,wn=null,Qa(o,P,X,ne)}}iE(),j=yt;break}catch(de){e0(o,de)}while(!0);return a&&o.shellSuspendCounter++,Eo=qr=null,Ze=p,A.H=x,A.A=k,Pe===null&&(it=null,Ue=0,Ql()),j}function iE(){for(;Pe!==null;)r0(Pe)}function sE(o,a){var c=Ze;Ze|=2;var p=n0(),x=o0();it!==o||Ue!==a?(Nc=null,Ac=_t()+500,Za(o,a)):Ya=zr(o,a);e:do try{if(Je!==0&&Pe!==null){a=Pe;var k=wn;t:switch(Je){case 1:Je=0,wn=null,Qa(o,a,k,1);break;case 2:case 9:if(my(k)){Je=0,wn=null,a0(a);break}a=function(){Je!==2&&Je!==9||it!==o||(Je=7),io(o)},k.then(a,a);break e;case 3:Je=7;break e;case 4:Je=5;break e;case 7:my(k)?(Je=0,wn=null,a0(a)):(Je=0,wn=null,Qa(o,a,k,7));break;case 5:var j=null;switch(Pe.tag){case 26:j=Pe.memoizedState;case 5:case 27:var P=Pe;if(j?q0(j):P.stateNode.complete){Je=0,wn=null;var X=P.sibling;if(X!==null)Pe=X;else{var ne=P.return;ne!==null?(Pe=ne,zc(ne)):Pe=null}break t}}Je=0,wn=null,Qa(o,a,k,5);break;case 6:Je=0,wn=null,Qa(o,a,k,6);break;case 8:ff(),yt=6;break e;default:throw Error(r(462))}}lE();break}catch(de){e0(o,de)}while(!0);return Eo=qr=null,A.H=p,A.A=x,Ze=c,Pe!==null?0:(it=null,Ue=0,Ql(),yt)}function lE(){for(;Pe!==null&&!en();)r0(Pe)}function r0(o){var a=jx(o.alternate,o,Oo);o.memoizedProps=o.pendingProps,a===null?zc(o):Pe=a}function a0(o){var a=o,c=a.alternate;switch(a.tag){case 15:case 0:a=wx(c,a,a.pendingProps,a.type,void 0,Ue);break;case 11:a=wx(c,a,a.pendingProps,a.type.render,a.ref,Ue);break;case 5:jp(a);default:Nx(c,a),a=Pe=oy(a,Oo),a=jx(c,a,Oo)}o.memoizedProps=o.pendingProps,a===null?zc(o):Pe=a}function Qa(o,a,c,p){Eo=qr=null,jp(a),Ba=null,Yi=0;var x=a.return;try{if(XC(o,x,a,c,Ue)){yt=1,kc(o,Nn(c,o.current)),Pe=null;return}}catch(k){if(x!==null)throw Pe=x,k;yt=1,kc(o,Nn(c,o.current)),Pe=null;return}a.flags&32768?(Ge||p===1?o=!0:Ya||(Ue&536870912)!==0?o=!1:(ur=o=!0,(p===2||p===9||p===3||p===6)&&(p=kn.current,p!==null&&p.tag===13&&(p.flags|=16384))),i0(a,o)):zc(a)}function zc(o){var a=o;do{if((a.flags&32768)!==0){i0(a,ur);return}o=a.return;var c=JC(a.alternate,a,Oo);if(c!==null){Pe=c;return}if(a=a.sibling,a!==null){Pe=a;return}Pe=a=o}while(a!==null);yt===0&&(yt=5)}function i0(o,a){do{var c=eE(o.alternate,o);if(c!==null){c.flags&=32767,Pe=c;return}if(c=o.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(o=o.sibling,o!==null)){Pe=o;return}Pe=o=c}while(o!==null);yt=6,Pe=null}function s0(o,a,c,p,x,k,j,P,X){o.cancelPendingCommit=null;do Rc();while(zt!==0);if((Ze&6)!==0)throw Error(r(327));if(a!==null){if(a===o.current)throw Error(r(177));if(k=a.lanes|a.childLanes,k|=tp,_d(o,c,k,j,P,X),o===it&&(Pe=it=null,Ue=0),Xa=a,fr=o,Io=c,uf=k,df=x,Xx=p,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,pE(Ne,function(){return p0(),null})):(o.callbackNode=null,o.callbackPriority=0),p=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||p){p=A.T,A.T=null,x=q.p,q.p=2,j=Ze,Ze|=4;try{tE(o,a,c)}finally{Ze=j,q.p=x,A.T=p}}zt=1,l0(),c0(),u0()}}function l0(){if(zt===1){zt=0;var o=fr,a=Xa,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=A.T,A.T=null;var p=q.p;q.p=2;var x=Ze;Ze|=4;try{Hx(a,o);var k=Mf,j=Yg(o.containerInfo),P=k.focusedElem,X=k.selectionRange;if(j!==P&&P&&P.ownerDocument&&Vg(P.ownerDocument.documentElement,P)){if(X!==null&&Xd(P)){var ne=X.start,de=X.end;if(de===void 0&&(de=ne),"selectionStart"in P)P.selectionStart=ne,P.selectionEnd=Math.min(de,P.value.length);else{var fe=P.ownerDocument||document,re=fe&&fe.defaultView||window;if(re.getSelection){var se=re.getSelection(),Se=P.textContent.length,_e=Math.min(X.start,Se),ot=X.end===void 0?_e:Math.min(X.end,Se);!se.extend&&_e>ot&&(j=ot,ot=_e,_e=j);var ee=Kg(P,_e),J=Kg(P,ot);if(ee&&J&&(se.rangeCount!==1||se.anchorNode!==ee.node||se.anchorOffset!==ee.offset||se.focusNode!==J.node||se.focusOffset!==J.offset)){var te=fe.createRange();te.setStart(ee.node,ee.offset),se.removeAllRanges(),_e>ot?(se.addRange(te),se.extend(J.node,J.offset)):(te.setEnd(J.node,J.offset),se.addRange(te))}}}}for(fe=[],se=P;se=se.parentNode;)se.nodeType===1&&fe.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;P<fe.length;P++){var pe=fe[P];pe.element.scrollLeft=pe.left,pe.element.scrollTop=pe.top}}Kc=!!Ef,Mf=Ef=null}finally{Ze=x,q.p=p,A.T=c}}o.current=a,zt=2}}function c0(){if(zt===2){zt=0;var o=fr,a=Xa,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=A.T,A.T=null;var p=q.p;q.p=2;var x=Ze;Ze|=4;try{Fx(o,a.alternate,a)}finally{Ze=x,q.p=p,A.T=c}}zt=3}}function u0(){if(zt===4||zt===3){zt=0,gn();var o=fr,a=Xa,c=Io,p=Xx;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?zt=5:(zt=0,Xa=fr=null,d0(o,o.pendingLanes));var x=o.pendingLanes;if(x===0&&(pr=null),_i(c),a=a.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(Lt,a,void 0,(a.current.flags&128)===128)}catch{}if(p!==null){a=A.T,x=q.p,q.p=2,A.T=null;try{for(var k=o.onRecoverableError,j=0;j<p.length;j++){var P=p[j];k(P.value,{componentStack:P.stack})}}finally{A.T=a,q.p=x}}(Io&3)!==0&&Rc(),io(o),x=o.pendingLanes,(c&261930)!==0&&(x&42)!==0?o===pf?ds++:(ds=0,pf=o):ds=0,ps(0)}}function d0(o,a){(o.pooledCacheLanes&=a)===0&&(a=o.pooledCache,a!=null&&(o.pooledCache=null,Ki(a)))}function Rc(){return l0(),c0(),u0(),p0()}function p0(){if(zt!==5)return!1;var o=fr,a=uf;uf=0;var c=_i(Io),p=A.T,x=q.p;try{q.p=32>c?32:c,A.T=null,c=df,df=null;var k=fr,j=Io;if(zt=0,Xa=fr=null,Io=0,(Ze&6)!==0)throw Error(r(331));var P=Ze;if(Ze|=4,Vx(k.current),qx(k,k.current,j,c),Ze=P,ps(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(Lt,k)}catch{}return!0}finally{q.p=x,A.T=p,d0(o,a)}}function f0(o,a,c){a=Nn(c,a),a=Up(o.stateNode,a,2),o=ir(o,a,2),o!==null&&(Rr(o,2),io(o))}function et(o,a,c){if(o.tag===3)f0(o,o,c);else for(;a!==null;){if(a.tag===3){f0(a,o,c);break}else if(a.tag===1){var p=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(pr===null||!pr.has(p))){o=Nn(c,o),c=mx(2),p=ir(a,c,2),p!==null&&(hx(c,p,a,o),Rr(p,2),io(p));break}}a=a.return}}function hf(o,a,c){var p=o.pingCache;if(p===null){p=o.pingCache=new rE;var x=new Set;p.set(a,x)}else x=p.get(a),x===void 0&&(x=new Set,p.set(a,x));x.has(c)||(sf=!0,x.add(c),o=cE.bind(null,o,a,c),a.then(o,o))}function cE(o,a,c){var p=o.pingCache;p!==null&&p.delete(a),o.pingedLanes|=o.suspendedLanes&c,o.warmLanes&=~c,it===o&&(Ue&c)===c&&(yt===4||yt===3&&(Ue&62914560)===Ue&&300>_t()-jc?(Ze&2)===0&&Za(o,0):lf|=c,Wa===Ue&&(Wa=0)),io(o)}function m0(o,a){a===0&&(a=Nl()),o=Br(o,a),o!==null&&(Rr(o,a),io(o))}function uE(o){var a=o.memoizedState,c=0;a!==null&&(c=a.retryLane),m0(o,c)}function dE(o,a){var c=0;switch(o.tag){case 31:case 13:var p=o.stateNode,x=o.memoizedState;x!==null&&(c=x.retryLane);break;case 19:p=o.stateNode;break;case 22:p=o.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(a),m0(o,c)}function pE(o,a){return St(o,a)}var Oc=null,Ja=null,gf=!1,Ic=!1,yf=!1,hr=0;function io(o){o!==Ja&&o.next===null&&(Ja===null?Oc=Ja=o:Ja=Ja.next=o),Ic=!0,gf||(gf=!0,mE())}function ps(o,a){if(!yf&&Ic){yf=!0;do for(var c=!1,p=Oc;p!==null;){if(o!==0){var x=p.pendingLanes;if(x===0)var k=0;else{var j=p.suspendedLanes,P=p.pingedLanes;k=(1<<31-Qe(42|o)+1)-1,k&=x&~(j&~P),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(c=!0,x0(p,k))}else k=Ue,k=va(p,p===it?k:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(k&3)===0||zr(p,k)||(c=!0,x0(p,k));p=p.next}while(c);yf=!1}}function fE(){h0()}function h0(){Ic=gf=!1;var o=0;hr!==0&&CE()&&(o=hr);for(var a=_t(),c=null,p=Oc;p!==null;){var x=p.next,k=g0(p,a);k===0?(p.next=null,c===null?Oc=x:c.next=x,x===null&&(Ja=c)):(c=p,(o!==0||(k&3)!==0)&&(Ic=!0)),p=x}zt!==0&&zt!==5||ps(o),hr!==0&&(hr=0)}function g0(o,a){for(var c=o.suspendedLanes,p=o.pingedLanes,x=o.expirationTimes,k=o.pendingLanes&-62914561;0<k;){var j=31-Qe(k),P=1<<j,X=x[j];X===-1?((P&c)===0||(P&p)!==0)&&(x[j]=Nd(P,a)):X<=a&&(o.expiredLanes|=P),k&=~P}if(a=it,c=Ue,c=va(o,o===a?c:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p=o.callbackNode,c===0||o===a&&(Je===2||Je===9)||o.cancelPendingCommit!==null)return p!==null&&p!==null&&hn(p),o.callbackNode=null,o.callbackPriority=0;if((c&3)===0||zr(o,c)){if(a=c&-c,a===o.callbackPriority)return a;switch(p!==null&&hn(p),_i(c)){case 2:case 8:c=ye;break;case 32:c=Ne;break;case 268435456:c=Ke;break;default:c=Ne}return p=y0.bind(null,o),c=St(c,p),o.callbackPriority=a,o.callbackNode=c,a}return p!==null&&p!==null&&hn(p),o.callbackPriority=2,o.callbackNode=null,2}function y0(o,a){if(zt!==0&&zt!==5)return o.callbackNode=null,o.callbackPriority=0,null;var c=o.callbackNode;if(Rc()&&o.callbackNode!==c)return null;var p=Ue;return p=va(o,o===it?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p===0?null:(Qx(o,p,a),g0(o,_t()),o.callbackNode!=null&&o.callbackNode===c?y0.bind(null,o):null)}function x0(o,a){if(Rc())return null;Qx(o,a,!0)}function mE(){ME(function(){(Ze&6)!==0?St(ue,fE):h0()})}function xf(){if(hr===0){var o=$a;o===0&&(o=xa,xa<<=1,(xa&261888)===0&&(xa=256)),hr=o}return hr}function b0(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:ql(""+o)}function k0(o,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,o.id&&c.setAttribute("form",o.id),a.parentNode.insertBefore(c,a),o=new FormData(o),c.parentNode.removeChild(c),o}function hE(o,a,c,p,x){if(a==="submit"&&c&&c.stateNode===x){var k=b0((x[Kt]||null).action),j=p.submitter;j&&(a=(a=j[Kt]||null)?b0(a.formAction):j.getAttribute("formAction"),a!==null&&(k=a,j=null));var P=new Yl("action","action",null,p,x);o.push({event:P,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(hr!==0){var X=j?k0(x,j):new FormData(x);Fp(c,{pending:!0,data:X,method:x.method,action:k},null,X)}}else typeof k=="function"&&(P.preventDefault(),X=j?k0(x,j):new FormData(x),Fp(c,{pending:!0,data:X,method:x.method,action:k},k,X))},currentTarget:x}]})}}for(var bf=0;bf<ep.length;bf++){var kf=ep[bf],gE=kf.toLowerCase(),yE=kf[0].toUpperCase()+kf.slice(1);Gn(gE,"on"+yE)}Gn(Zg,"onAnimationEnd"),Gn(Qg,"onAnimationIteration"),Gn(Jg,"onAnimationStart"),Gn("dblclick","onDoubleClick"),Gn("focusin","onFocus"),Gn("focusout","onBlur"),Gn(zC,"onTransitionRun"),Gn(RC,"onTransitionStart"),Gn(OC,"onTransitionCancel"),Gn(ey,"onTransitionEnd"),Qo("onMouseEnter",["mouseout","mouseover"]),Qo("onMouseLeave",["mouseout","mouseover"]),Qo("onPointerEnter",["pointerout","pointerover"]),Qo("onPointerLeave",["pointerout","pointerover"]),bo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),bo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),bo("onBeforeInput",["compositionend","keypress","textInput","paste"]),bo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),bo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),bo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fs="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(" "),xE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(fs));function v0(o,a){a=(a&4)!==0;for(var c=0;c<o.length;c++){var p=o[c],x=p.event;p=p.listeners;e:{var k=void 0;if(a)for(var j=p.length-1;0<=j;j--){var P=p[j],X=P.instance,ne=P.currentTarget;if(P=P.listener,X!==k&&x.isPropagationStopped())break e;k=P,x.currentTarget=ne;try{k(x)}catch(de){Zl(de)}x.currentTarget=null,k=X}else for(j=0;j<p.length;j++){if(P=p[j],X=P.instance,ne=P.currentTarget,P=P.listener,X!==k&&x.isPropagationStopped())break e;k=P,x.currentTarget=ne;try{k(x)}catch(de){Zl(de)}x.currentTarget=null,k=X}}}}function Be(o,a){var c=a[wa];c===void 0&&(c=a[wa]=new Set);var p=o+"__bubble";c.has(p)||(w0(a,o,2,!1),c.add(p))}function vf(o,a,c){var p=0;a&&(p|=4),w0(c,o,p,a)}var Fc="_reactListening"+Math.random().toString(36).slice(2);function wf(o){if(!o[Fc]){o[Fc]=!0,$l.forEach(function(c){c!=="selectionchange"&&(xE.has(c)||vf(c,!1,o),vf(c,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[Fc]||(a[Fc]=!0,vf("selectionchange",!1,a))}}function w0(o,a,c,p){switch(Z0(a)){case 2:var x=KE;break;case 8:x=VE;break;default:x=Ff}c=x.bind(null,a,c,o),x=void 0,!Bd||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(x=!0),p?x!==void 0?o.addEventListener(a,c,{capture:!0,passive:x}):o.addEventListener(a,c,!0):x!==void 0?o.addEventListener(a,c,{passive:x}):o.addEventListener(a,c,!1)}function Sf(o,a,c,p,x){var k=p;if((a&1)===0&&(a&2)===0&&p!==null)e:for(;;){if(p===null)return;var j=p.tag;if(j===3||j===4){var P=p.stateNode.containerInfo;if(P===x)break;if(j===4)for(j=p.return;j!==null;){var X=j.tag;if((X===3||X===4)&&j.stateNode.containerInfo===x)return;j=j.return}for(;P!==null;){if(j=Yo(P),j===null)return;if(X=j.tag,X===5||X===6||X===26||X===27){p=k=j;continue e}P=P.parentNode}}p=p.return}Tg(function(){var ne=k,de=Ld(c),fe=[];e:{var re=ty.get(o);if(re!==void 0){var se=Yl,Se=o;switch(o){case"keypress":if(Kl(c)===0)break e;case"keydown":case"keyup":se=dC;break;case"focusin":Se="focus",se=Gd;break;case"focusout":Se="blur",se=Gd;break;case"beforeblur":case"afterblur":se=Gd;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=Ng;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=J2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=mC;break;case Zg:case Qg:case Jg:se=nC;break;case ey:se=gC;break;case"scroll":case"scrollend":se=Z2;break;case"wheel":se=xC;break;case"copy":case"cut":case"paste":se=rC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=Dg;break;case"toggle":case"beforetoggle":se=kC}var _e=(a&4)!==0,ot=!_e&&(o==="scroll"||o==="scrollend"),ee=_e?re!==null?re+"Capture":null:re;_e=[];for(var J=ne,te;J!==null;){var pe=J;if(te=pe.stateNode,pe=pe.tag,pe!==5&&pe!==26&&pe!==27||te===null||ee===null||(pe=Oi(J,ee),pe!=null&&_e.push(ms(J,pe,te))),ot)break;J=J.return}0<_e.length&&(re=new se(re,Se,null,c,de),fe.push({event:re,listeners:_e}))}}if((a&7)===0){e:{if(re=o==="mouseover"||o==="pointerover",se=o==="mouseout"||o==="pointerout",re&&c!==$d&&(Se=c.relatedTarget||c.fromElement)&&(Yo(Se)||Se[xo]))break e;if((se||re)&&(re=de.window===de?de:(re=de.ownerDocument)?re.defaultView||re.parentWindow:window,se?(Se=c.relatedTarget||c.toElement,se=ne,Se=Se?Yo(Se):null,Se!==null&&(ot=s(Se),_e=Se.tag,Se!==ot||_e!==5&&_e!==27&&_e!==6)&&(Se=null)):(se=null,Se=ne),se!==Se)){if(_e=Ng,pe="onMouseLeave",ee="onMouseEnter",J="mouse",(o==="pointerout"||o==="pointerover")&&(_e=Dg,pe="onPointerLeave",ee="onPointerEnter",J="pointer"),ot=se==null?re:Xo(se),te=Se==null?re:Xo(Se),re=new _e(pe,J+"leave",se,c,de),re.target=ot,re.relatedTarget=te,pe=null,Yo(de)===ne&&(_e=new _e(ee,J+"enter",Se,c,de),_e.target=te,_e.relatedTarget=ot,pe=_e),ot=pe,se&&Se)t:{for(_e=bE,ee=se,J=Se,te=0,pe=ee;pe;pe=_e(pe))te++;pe=0;for(var je=J;je;je=_e(je))pe++;for(;0<te-pe;)ee=_e(ee),te--;for(;0<pe-te;)J=_e(J),pe--;for(;te--;){if(ee===J||J!==null&&ee===J.alternate){_e=ee;break t}ee=_e(ee),J=_e(J)}_e=null}else _e=null;se!==null&&S0(fe,re,se,_e,!1),Se!==null&&ot!==null&&S0(fe,ot,Se,_e,!0)}}e:{if(re=ne?Xo(ne):window,se=re.nodeName&&re.nodeName.toLowerCase(),se==="select"||se==="input"&&re.type==="file")var We=Pg;else if($g(re))if(Bg)We=NC;else{We=jC;var Ce=TC}else se=re.nodeName,!se||se.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?ne&&Fd(ne.elementType)&&(We=Pg):We=AC;if(We&&(We=We(o,ne))){Lg(fe,We,c,de);break e}Ce&&Ce(o,re,ne),o==="focusout"&&ne&&re.type==="number"&&ne.memoizedProps.value!=null&&Ri(re,"number",re.value)}switch(Ce=ne?Xo(ne):window,o){case"focusin":($g(Ce)||Ce.contentEditable==="true")&&(Na=Ce,Zd=ne,Ui=null);break;case"focusout":Ui=Zd=Na=null;break;case"mousedown":Qd=!0;break;case"contextmenu":case"mouseup":case"dragend":Qd=!1,Wg(fe,c,de);break;case"selectionchange":if(DC)break;case"keydown":case"keyup":Wg(fe,c,de)}var Fe;if(Vd)e:{switch(o){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else Aa?Ig(o,c)&&(qe="onCompositionEnd"):o==="keydown"&&c.keyCode===229&&(qe="onCompositionStart");qe&&(zg&&c.locale!=="ko"&&(Aa||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&Aa&&(Fe=jg()):(Jo=de,Hd="value"in Jo?Jo.value:Jo.textContent,Aa=!0)),Ce=$c(ne,qe),0<Ce.length&&(qe=new _g(qe,o,null,c,de),fe.push({event:qe,listeners:Ce}),Fe?qe.data=Fe:(Fe=Fg(c),Fe!==null&&(qe.data=Fe)))),(Fe=wC?SC(o,c):CC(o,c))&&(qe=$c(ne,"onBeforeInput"),0<qe.length&&(Ce=new _g("onBeforeInput","beforeinput",null,c,de),fe.push({event:Ce,listeners:qe}),Ce.data=Fe)),hE(fe,o,ne,c,de)}v0(fe,a)})}function ms(o,a,c){return{instance:o,listener:a,currentTarget:c}}function $c(o,a){for(var c=a+"Capture",p=[];o!==null;){var x=o,k=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||k===null||(x=Oi(o,c),x!=null&&p.unshift(ms(o,x,k)),x=Oi(o,a),x!=null&&p.push(ms(o,x,k))),o.tag===3)return p;o=o.return}return[]}function bE(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function S0(o,a,c,p,x){for(var k=a._reactName,j=[];c!==null&&c!==p;){var P=c,X=P.alternate,ne=P.stateNode;if(P=P.tag,X!==null&&X===p)break;P!==5&&P!==26&&P!==27||ne===null||(X=ne,x?(ne=Oi(c,k),ne!=null&&j.unshift(ms(c,ne,X))):x||(ne=Oi(c,k),ne!=null&&j.push(ms(c,ne,X)))),c=c.return}j.length!==0&&o.push({event:a,listeners:j})}var kE=/\r\n?/g,vE=/\u0000|\uFFFD/g;function C0(o){return(typeof o=="string"?o:""+o).replace(kE,`
|
|
9
|
+
`).replace(vE,"")}function E0(o,a){return a=C0(a),C0(o)===a}function nt(o,a,c,p,x,k){switch(c){case"children":typeof p=="string"?a==="body"||a==="textarea"&&p===""||Ma(o,p):(typeof p=="number"||typeof p=="bigint")&&a!=="body"&&Ma(o,""+p);break;case"className":Ca(o,"class",p);break;case"tabIndex":Ca(o,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":Ca(o,c,p);break;case"style":Eg(o,p,k);break;case"data":if(a!=="object"){Ca(o,"data",p);break}case"src":case"href":if(p===""&&(a!=="a"||c!=="href")){o.removeAttribute(c);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(c);break}p=ql(""+p),o.setAttribute(c,p);break;case"action":case"formAction":if(typeof p=="function"){o.setAttribute(c,"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 k=="function"&&(c==="formAction"?(a!=="input"&&nt(o,a,"name",x.name,x,null),nt(o,a,"formEncType",x.formEncType,x,null),nt(o,a,"formMethod",x.formMethod,x,null),nt(o,a,"formTarget",x.formTarget,x,null)):(nt(o,a,"encType",x.encType,x,null),nt(o,a,"method",x.method,x,null),nt(o,a,"target",x.target,x,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(c);break}p=ql(""+p),o.setAttribute(c,p);break;case"onClick":p!=null&&(o.onclick=vo);break;case"onScroll":p!=null&&Be("scroll",o);break;case"onScrollEnd":p!=null&&Be("scrollend",o);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(c=p.__html,c!=null){if(x.children!=null)throw Error(r(60));o.innerHTML=c}}break;case"multiple":o.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":o.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){o.removeAttribute("xlink:href");break}c=ql(""+p),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(c,""+p):o.removeAttribute(c);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":p&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(c,""):o.removeAttribute(c);break;case"capture":case"download":p===!0?o.setAttribute(c,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(c,p):o.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?o.setAttribute(c,p):o.removeAttribute(c);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?o.removeAttribute(c):o.setAttribute(c,p);break;case"popover":Be("beforetoggle",o),Be("toggle",o),Sa(o,"popover",p);break;case"xlinkActuate":qn(o,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":qn(o,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":qn(o,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":qn(o,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":qn(o,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":qn(o,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":qn(o,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":qn(o,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":qn(o,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":Sa(o,"is",p);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=W2.get(c)||c,Sa(o,c,p))}}function Cf(o,a,c,p,x,k){switch(c){case"style":Eg(o,p,k);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(c=p.__html,c!=null){if(x.children!=null)throw Error(r(60));o.innerHTML=c}}break;case"children":typeof p=="string"?Ma(o,p):(typeof p=="number"||typeof p=="bigint")&&Ma(o,""+p);break;case"onScroll":p!=null&&Be("scroll",o);break;case"onScrollEnd":p!=null&&Be("scrollend",o);break;case"onClick":p!=null&&(o.onclick=vo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ll.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(x=c.endsWith("Capture"),a=c.slice(2,x?c.length-7:void 0),k=o[Kt]||null,k=k!=null?k[c]:null,typeof k=="function"&&o.removeEventListener(a,k,x),typeof p=="function")){typeof k!="function"&&k!==null&&(c in o?o[c]=null:o.hasAttribute(c)&&o.removeAttribute(c)),o.addEventListener(a,p,x);break e}c in o?o[c]=p:p===!0?o.setAttribute(c,""):Sa(o,c,p)}}}function Ut(o,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Be("error",o),Be("load",o);var p=!1,x=!1,k;for(k in c)if(c.hasOwnProperty(k)){var j=c[k];if(j!=null)switch(k){case"src":p=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:nt(o,a,k,j,c,null)}}x&&nt(o,a,"srcSet",c.srcSet,c,null),p&&nt(o,a,"src",c.src,c,null);return;case"input":Be("invalid",o);var P=k=j=x=null,X=null,ne=null;for(p in c)if(c.hasOwnProperty(p)){var de=c[p];if(de!=null)switch(p){case"name":x=de;break;case"type":j=de;break;case"checked":X=de;break;case"defaultChecked":ne=de;break;case"value":k=de;break;case"defaultValue":P=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,a));break;default:nt(o,a,p,de,c,null)}}Ul(o,k,P,X,ne,j,x,!1);return;case"select":Be("invalid",o),p=j=k=null;for(x in c)if(c.hasOwnProperty(x)&&(P=c[x],P!=null))switch(x){case"value":k=P;break;case"defaultValue":j=P;break;case"multiple":p=P;default:nt(o,a,x,P,c,null)}a=k,c=j,o.multiple=!!p,a!=null?ko(o,!!p,a,!1):c!=null&&ko(o,!!p,c,!0);return;case"textarea":Be("invalid",o),k=x=p=null;for(j in c)if(c.hasOwnProperty(j)&&(P=c[j],P!=null))switch(j){case"value":p=P;break;case"defaultValue":x=P;break;case"children":k=P;break;case"dangerouslySetInnerHTML":if(P!=null)throw Error(r(91));break;default:nt(o,a,j,P,c,null)}Sg(o,p,x,k);return;case"option":for(X in c)c.hasOwnProperty(X)&&(p=c[X],p!=null)&&(X==="selected"?o.selected=p&&typeof p!="function"&&typeof p!="symbol":nt(o,a,X,p,c,null));return;case"dialog":Be("beforetoggle",o),Be("toggle",o),Be("cancel",o),Be("close",o);break;case"iframe":case"object":Be("load",o);break;case"video":case"audio":for(p=0;p<fs.length;p++)Be(fs[p],o);break;case"image":Be("error",o),Be("load",o);break;case"details":Be("toggle",o);break;case"embed":case"source":case"link":Be("error",o),Be("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ne in c)if(c.hasOwnProperty(ne)&&(p=c[ne],p!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:nt(o,a,ne,p,c,null)}return;default:if(Fd(a)){for(de in c)c.hasOwnProperty(de)&&(p=c[de],p!==void 0&&Cf(o,a,de,p,c,void 0));return}}for(P in c)c.hasOwnProperty(P)&&(p=c[P],p!=null&&nt(o,a,P,p,c,null))}function wE(o,a,c,p){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,k=null,j=null,P=null,X=null,ne=null,de=null;for(se in c){var fe=c[se];if(c.hasOwnProperty(se)&&fe!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":X=fe;default:p.hasOwnProperty(se)||nt(o,a,se,null,p,fe)}}for(var re in p){var se=p[re];if(fe=c[re],p.hasOwnProperty(re)&&(se!=null||fe!=null))switch(re){case"type":k=se;break;case"name":x=se;break;case"checked":ne=se;break;case"defaultChecked":de=se;break;case"value":j=se;break;case"defaultValue":P=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,a));break;default:se!==fe&&nt(o,a,re,se,p,fe)}}Fr(o,j,P,X,ne,de,k,x);return;case"select":se=j=P=re=null;for(k in c)if(X=c[k],c.hasOwnProperty(k)&&X!=null)switch(k){case"value":break;case"multiple":se=X;default:p.hasOwnProperty(k)||nt(o,a,k,null,p,X)}for(x in p)if(k=p[x],X=c[x],p.hasOwnProperty(x)&&(k!=null||X!=null))switch(x){case"value":re=k;break;case"defaultValue":P=k;break;case"multiple":j=k;default:k!==X&&nt(o,a,x,k,p,X)}a=P,c=j,p=se,re!=null?ko(o,!!c,re,!1):!!p!=!!c&&(a!=null?ko(o,!!c,a,!0):ko(o,!!c,c?[]:"",!1));return;case"textarea":se=re=null;for(P in c)if(x=c[P],c.hasOwnProperty(P)&&x!=null&&!p.hasOwnProperty(P))switch(P){case"value":break;case"children":break;default:nt(o,a,P,null,p,x)}for(j in p)if(x=p[j],k=c[j],p.hasOwnProperty(j)&&(x!=null||k!=null))switch(j){case"value":re=x;break;case"defaultValue":se=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:x!==k&&nt(o,a,j,x,p,k)}wg(o,re,se);return;case"option":for(var Se in c)re=c[Se],c.hasOwnProperty(Se)&&re!=null&&!p.hasOwnProperty(Se)&&(Se==="selected"?o.selected=!1:nt(o,a,Se,null,p,re));for(X in p)re=p[X],se=c[X],p.hasOwnProperty(X)&&re!==se&&(re!=null||se!=null)&&(X==="selected"?o.selected=re&&typeof re!="function"&&typeof re!="symbol":nt(o,a,X,re,p,se));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 _e in c)re=c[_e],c.hasOwnProperty(_e)&&re!=null&&!p.hasOwnProperty(_e)&&nt(o,a,_e,null,p,re);for(ne in p)if(re=p[ne],se=c[ne],p.hasOwnProperty(ne)&&re!==se&&(re!=null||se!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(r(137,a));break;default:nt(o,a,ne,re,p,se)}return;default:if(Fd(a)){for(var ot in c)re=c[ot],c.hasOwnProperty(ot)&&re!==void 0&&!p.hasOwnProperty(ot)&&Cf(o,a,ot,void 0,p,re);for(de in p)re=p[de],se=c[de],!p.hasOwnProperty(de)||re===se||re===void 0&&se===void 0||Cf(o,a,de,re,p,se);return}}for(var ee in c)re=c[ee],c.hasOwnProperty(ee)&&re!=null&&!p.hasOwnProperty(ee)&&nt(o,a,ee,null,p,re);for(fe in p)re=p[fe],se=c[fe],!p.hasOwnProperty(fe)||re===se||re==null&&se==null||nt(o,a,fe,re,p,se)}function M0(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function SE(){if(typeof performance.getEntriesByType=="function"){for(var o=0,a=0,c=performance.getEntriesByType("resource"),p=0;p<c.length;p++){var x=c[p],k=x.transferSize,j=x.initiatorType,P=x.duration;if(k&&P&&M0(j)){for(j=0,P=x.responseEnd,p+=1;p<c.length;p++){var X=c[p],ne=X.startTime;if(ne>P)break;var de=X.transferSize,fe=X.initiatorType;de&&M0(fe)&&(X=X.responseEnd,j+=de*(X<P?1:(P-ne)/(X-ne)))}if(--p,a+=8*(k+j)/(x.duration/1e3),o++,10<o)break}}if(0<o)return a/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var Ef=null,Mf=null;function Lc(o){return o.nodeType===9?o:o.ownerDocument}function T0(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function j0(o,a){if(o===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&a==="foreignObject"?0:o}function Tf(o,a){return o==="textarea"||o==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var jf=null;function CE(){var o=window.event;return o&&o.type==="popstate"?o===jf?!1:(jf=o,!0):(jf=null,!1)}var A0=typeof setTimeout=="function"?setTimeout:void 0,EE=typeof clearTimeout=="function"?clearTimeout:void 0,N0=typeof Promise=="function"?Promise:void 0,ME=typeof queueMicrotask=="function"?queueMicrotask:typeof N0<"u"?function(o){return N0.resolve(null).then(o).catch(TE)}:A0;function TE(o){setTimeout(function(){throw o})}function gr(o){return o==="head"}function _0(o,a){var c=a,p=0;do{var x=c.nextSibling;if(o.removeChild(c),x&&x.nodeType===8)if(c=x.data,c==="/$"||c==="/&"){if(p===0){o.removeChild(x),oi(a);return}p--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")p++;else if(c==="html")hs(o.ownerDocument.documentElement);else if(c==="head"){c=o.ownerDocument.head,hs(c);for(var k=c.firstChild;k;){var j=k.nextSibling,P=k.nodeName;k[Or]||P==="SCRIPT"||P==="STYLE"||P==="LINK"&&k.rel.toLowerCase()==="stylesheet"||c.removeChild(k),k=j}}else c==="body"&&hs(o.ownerDocument.body);c=x}while(c);oi(a)}function D0(o,a){var c=o;o=0;do{var p=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),p&&p.nodeType===8)if(c=p.data,c==="/$"){if(o===0)break;o--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||o++;c=p}while(c)}function Af(o){var a=o.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Af(c),Di(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}o.removeChild(c)}}function jE(o,a,c,p){for(;o.nodeType===1;){var x=c;if(o.nodeName.toLowerCase()!==a.toLowerCase()){if(!p&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(p){if(!o[Or])switch(a){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(k=o.getAttribute("rel"),k==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(k!==x.rel||o.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||o.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||o.getAttribute("title")!==(x.title==null?null:x.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(k=o.getAttribute("src"),(k!==(x.src==null?null:x.src)||o.getAttribute("type")!==(x.type==null?null:x.type)||o.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&k&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(a==="input"&&o.type==="hidden"){var k=x.name==null?null:""+x.name;if(x.type==="hidden"&&o.getAttribute("name")===k)return o}else return o;if(o=On(o.nextSibling),o===null)break}return null}function AE(o,a,c){if(a==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!c||(o=On(o.nextSibling),o===null))return null;return o}function z0(o,a){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!a||(o=On(o.nextSibling),o===null))return null;return o}function Nf(o){return o.data==="$?"||o.data==="$~"}function _f(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function NE(o,a){var c=o.ownerDocument;if(o.data==="$~")o._reactRetry=a;else if(o.data!=="$?"||c.readyState!=="loading")a();else{var p=function(){a(),c.removeEventListener("DOMContentLoaded",p)};c.addEventListener("DOMContentLoaded",p),o._reactRetry=p}}function On(o){for(;o!=null;o=o.nextSibling){var a=o.nodeType;if(a===1||a===3)break;if(a===8){if(a=o.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return o}var Df=null;function R0(o){o=o.nextSibling;for(var a=0;o;){if(o.nodeType===8){var c=o.data;if(c==="/$"||c==="/&"){if(a===0)return On(o.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}o=o.nextSibling}return null}function O0(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var c=o.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return o;a--}else c!=="/$"&&c!=="/&"||a++}o=o.previousSibling}return null}function I0(o,a,c){switch(a=Lc(c),o){case"html":if(o=a.documentElement,!o)throw Error(r(452));return o;case"head":if(o=a.head,!o)throw Error(r(453));return o;case"body":if(o=a.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function hs(o){for(var a=o.attributes;a.length;)o.removeAttributeNode(a[0]);Di(o)}var In=new Map,F0=new Set;function Pc(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var Fo=q.d;q.d={f:_E,r:DE,D:zE,C:RE,L:OE,m:IE,X:$E,S:FE,M:LE};function _E(){var o=Fo.f(),a=_c();return o||a}function DE(o){var a=Wo(o);a!==null&&a.tag===5&&a.type==="form"?ex(a):Fo.r(o)}var ei=typeof document>"u"?null:document;function $0(o,a,c){var p=ei;if(p&&typeof a=="string"&&a){var x=nn(a);x='link[rel="'+o+'"][href="'+x+'"]',typeof c=="string"&&(x+='[crossorigin="'+c+'"]'),F0.has(x)||(F0.add(x),o={rel:o,crossOrigin:c,href:a},p.querySelector(x)===null&&(a=p.createElement("link"),Ut(a,"link",o),Ct(a),p.head.appendChild(a)))}}function zE(o){Fo.D(o),$0("dns-prefetch",o,null)}function RE(o,a){Fo.C(o,a),$0("preconnect",o,a)}function OE(o,a,c){Fo.L(o,a,c);var p=ei;if(p&&o&&a){var x='link[rel="preload"][as="'+nn(a)+'"]';a==="image"&&c&&c.imageSrcSet?(x+='[imagesrcset="'+nn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(x+='[imagesizes="'+nn(c.imageSizes)+'"]')):x+='[href="'+nn(o)+'"]';var k=x;switch(a){case"style":k=ti(o);break;case"script":k=ni(o)}In.has(k)||(o=g({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:o,as:a},c),In.set(k,o),p.querySelector(x)!==null||a==="style"&&p.querySelector(gs(k))||a==="script"&&p.querySelector(ys(k))||(a=p.createElement("link"),Ut(a,"link",o),Ct(a),p.head.appendChild(a)))}}function IE(o,a){Fo.m(o,a);var c=ei;if(c&&o){var p=a&&typeof a.as=="string"?a.as:"script",x='link[rel="modulepreload"][as="'+nn(p)+'"][href="'+nn(o)+'"]',k=x;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=ni(o)}if(!In.has(k)&&(o=g({rel:"modulepreload",href:o},a),In.set(k,o),c.querySelector(x)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(ys(k)))return}p=c.createElement("link"),Ut(p,"link",o),Ct(p),c.head.appendChild(p)}}}function FE(o,a,c){Fo.S(o,a,c);var p=ei;if(p&&o){var x=Zo(p).hoistableStyles,k=ti(o);a=a||"default";var j=x.get(k);if(!j){var P={loading:0,preload:null};if(j=p.querySelector(gs(k)))P.loading=5;else{o=g({rel:"stylesheet",href:o,"data-precedence":a},c),(c=In.get(k))&&zf(o,c);var X=j=p.createElement("link");Ct(X),Ut(X,"link",o),X._p=new Promise(function(ne,de){X.onload=ne,X.onerror=de}),X.addEventListener("load",function(){P.loading|=1}),X.addEventListener("error",function(){P.loading|=2}),P.loading|=4,Bc(j,a,p)}j={type:"stylesheet",instance:j,count:1,state:P},x.set(k,j)}}}function $E(o,a){Fo.X(o,a);var c=ei;if(c&&o){var p=Zo(c).hoistableScripts,x=ni(o),k=p.get(x);k||(k=c.querySelector(ys(x)),k||(o=g({src:o,async:!0},a),(a=In.get(x))&&Rf(o,a),k=c.createElement("script"),Ct(k),Ut(k,"link",o),c.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},p.set(x,k))}}function LE(o,a){Fo.M(o,a);var c=ei;if(c&&o){var p=Zo(c).hoistableScripts,x=ni(o),k=p.get(x);k||(k=c.querySelector(ys(x)),k||(o=g({src:o,async:!0,type:"module"},a),(a=In.get(x))&&Rf(o,a),k=c.createElement("script"),Ct(k),Ut(k,"link",o),c.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},p.set(x,k))}}function L0(o,a,c,p){var x=(x=le.current)?Pc(x):null;if(!x)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=ti(c.href),c=Zo(x).hoistableStyles,p=c.get(a),p||(p={type:"style",instance:null,count:0,state:null},c.set(a,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){o=ti(c.href);var k=Zo(x).hoistableStyles,j=k.get(o);if(j||(x=x.ownerDocument||x,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(o,j),(k=x.querySelector(gs(o)))&&!k._p&&(j.instance=k,j.state.loading=5),In.has(o)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},In.set(o,c),k||PE(x,o,c,j.state))),a&&p===null)throw Error(r(528,""));return j}if(a&&p!==null)throw Error(r(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=ni(c),c=Zo(x).hoistableScripts,p=c.get(a),p||(p={type:"script",instance:null,count:0,state:null},c.set(a,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function ti(o){return'href="'+nn(o)+'"'}function gs(o){return'link[rel="stylesheet"]['+o+"]"}function P0(o){return g({},o,{"data-precedence":o.precedence,precedence:null})}function PE(o,a,c,p){o.querySelector('link[rel="preload"][as="style"]['+a+"]")?p.loading=1:(a=o.createElement("link"),p.preload=a,a.addEventListener("load",function(){return p.loading|=1}),a.addEventListener("error",function(){return p.loading|=2}),Ut(a,"link",c),Ct(a),o.head.appendChild(a))}function ni(o){return'[src="'+nn(o)+'"]'}function ys(o){return"script[async]"+o}function B0(o,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var p=o.querySelector('style[data-href~="'+nn(c.href)+'"]');if(p)return a.instance=p,Ct(p),p;var x=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return p=(o.ownerDocument||o).createElement("style"),Ct(p),Ut(p,"style",x),Bc(p,c.precedence,o),a.instance=p;case"stylesheet":x=ti(c.href);var k=o.querySelector(gs(x));if(k)return a.state.loading|=4,a.instance=k,Ct(k),k;p=P0(c),(x=In.get(x))&&zf(p,x),k=(o.ownerDocument||o).createElement("link"),Ct(k);var j=k;return j._p=new Promise(function(P,X){j.onload=P,j.onerror=X}),Ut(k,"link",p),a.state.loading|=4,Bc(k,c.precedence,o),a.instance=k;case"script":return k=ni(c.src),(x=o.querySelector(ys(k)))?(a.instance=x,Ct(x),x):(p=c,(x=In.get(k))&&(p=g({},c),Rf(p,x)),o=o.ownerDocument||o,x=o.createElement("script"),Ct(x),Ut(x,"link",p),o.head.appendChild(x),a.instance=x);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(p=a.instance,a.state.loading|=4,Bc(p,c.precedence,o));return a.instance}function Bc(o,a,c){for(var p=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=p.length?p[p.length-1]:null,k=x,j=0;j<p.length;j++){var P=p[j];if(P.dataset.precedence===a)k=P;else if(k!==x)break}k?k.parentNode.insertBefore(o,k.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(o,a.firstChild))}function zf(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.title==null&&(o.title=a.title)}function Rf(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.integrity==null&&(o.integrity=a.integrity)}var Hc=null;function H0(o,a,c){if(Hc===null){var p=new Map,x=Hc=new Map;x.set(c,p)}else x=Hc,p=x.get(c),p||(p=new Map,x.set(c,p));if(p.has(o))return p;for(p.set(o,null),c=c.getElementsByTagName(o),x=0;x<c.length;x++){var k=c[x];if(!(k[Or]||k[Dt]||o==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var j=k.getAttribute(a)||"";j=o+j;var P=p.get(j);P?P.push(k):p.set(j,[k])}}return p}function U0(o,a,c){o=o.ownerDocument||o,o.head.insertBefore(c,a==="title"?o.querySelector("head > title"):null)}function BE(o,a,c){if(c===1||a.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(o=a.disabled,typeof a.precedence=="string"&&o==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function q0(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function HE(o,a,c,p){if(c.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var x=ti(p.href),k=a.querySelector(gs(x));if(k){a=k._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(o.count++,o=Uc.bind(o),a.then(o,o)),c.state.loading|=4,c.instance=k,Ct(k);return}k=a.ownerDocument||a,p=P0(p),(x=In.get(x))&&zf(p,x),k=k.createElement("link"),Ct(k);var j=k;j._p=new Promise(function(P,X){j.onload=P,j.onerror=X}),Ut(k,"link",p),c.instance=k}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(o.count++,c=Uc.bind(o),a.addEventListener("load",c),a.addEventListener("error",c))}}var Of=0;function UE(o,a){return o.stylesheets&&o.count===0&&Gc(o,o.stylesheets),0<o.count||0<o.imgCount?function(c){var p=setTimeout(function(){if(o.stylesheets&&Gc(o,o.stylesheets),o.unsuspend){var k=o.unsuspend;o.unsuspend=null,k()}},6e4+a);0<o.imgBytes&&Of===0&&(Of=62500*SE());var x=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Gc(o,o.stylesheets),o.unsuspend)){var k=o.unsuspend;o.unsuspend=null,k()}},(o.imgBytes>Of?50:800)+a);return o.unsuspend=c,function(){o.unsuspend=null,clearTimeout(p),clearTimeout(x)}}:null}function Uc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Gc(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var qc=null;function Gc(o,a){o.stylesheets=null,o.unsuspend!==null&&(o.count++,qc=new Map,a.forEach(qE,o),qc=null,Uc.call(o))}function qE(o,a){if(!(a.state.loading&4)){var c=qc.get(o);if(c)var p=c.get(null);else{c=new Map,qc.set(o,c);for(var x=o.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<x.length;k++){var j=x[k];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(c.set(j.dataset.precedence,j),p=j)}p&&c.set(null,p)}x=a.instance,j=x.getAttribute("data-precedence"),k=c.get(j)||p,k===p&&c.set(null,x),c.set(j,x),this.count++,p=Uc.bind(this),x.addEventListener("load",p),x.addEventListener("error",p),k?k.parentNode.insertBefore(x,k.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(x,o.firstChild)),a.state.loading|=4}}var xs={$$typeof:S,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function GE(o,a,c,p,x,k,j,P,X){this.tag=1,this.containerInfo=o,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=Ai(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ai(0),this.hiddenUpdates=Ai(null),this.identifierPrefix=p,this.onUncaughtError=x,this.onCaughtError=k,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function G0(o,a,c,p,x,k,j,P,X,ne,de,fe){return o=new GE(o,a,c,j,X,ne,de,fe,P),a=1,k===!0&&(a|=24),k=bn(3,null,null,a),o.current=k,k.stateNode=o,a=fp(),a.refCount++,o.pooledCache=a,a.refCount++,k.memoizedState={element:p,isDehydrated:c,cache:a},yp(k),o}function K0(o){return o?(o=za,o):za}function V0(o,a,c,p,x,k){x=K0(x),p.context===null?p.context=x:p.pendingContext=x,p=ar(a),p.payload={element:c},k=k===void 0?null:k,k!==null&&(p.callback=k),c=ir(o,p,a),c!==null&&(cn(c,o,a),Xi(c,o,a))}function Y0(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var c=o.retryLane;o.retryLane=c!==0&&c<a?c:a}}function If(o,a){Y0(o,a),(o=o.alternate)&&Y0(o,a)}function W0(o){if(o.tag===13||o.tag===31){var a=Br(o,67108864);a!==null&&cn(a,o,67108864),If(o,67108864)}}function X0(o){if(o.tag===13||o.tag===31){var a=Cn();a=Ni(a);var c=Br(o,a);c!==null&&cn(c,o,a),If(o,a)}}var Kc=!0;function KE(o,a,c,p){var x=A.T;A.T=null;var k=q.p;try{q.p=2,Ff(o,a,c,p)}finally{q.p=k,A.T=x}}function VE(o,a,c,p){var x=A.T;A.T=null;var k=q.p;try{q.p=8,Ff(o,a,c,p)}finally{q.p=k,A.T=x}}function Ff(o,a,c,p){if(Kc){var x=$f(p);if(x===null)Sf(o,a,p,Vc,c),Q0(o,p);else if(WE(x,o,a,c,p))p.stopPropagation();else if(Q0(o,p),a&4&&-1<YE.indexOf(o)){for(;x!==null;){var k=Wo(x);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var j=yo(k.pendingLanes);if(j!==0){var P=k;for(P.pendingLanes|=2,P.entangledLanes|=2;j;){var X=1<<31-Qe(j);P.entanglements[1]|=X,j&=~X}io(k),(Ze&6)===0&&(Ac=_t()+500,ps(0))}}break;case 31:case 13:P=Br(k,2),P!==null&&cn(P,k,2),_c(),If(k,2)}if(k=$f(p),k===null&&Sf(o,a,p,Vc,c),k===x)break;x=k}x!==null&&p.stopPropagation()}else Sf(o,a,p,null,c)}}function $f(o){return o=Ld(o),Lf(o)}var Vc=null;function Lf(o){if(Vc=null,o=Yo(o),o!==null){var a=s(o);if(a===null)o=null;else{var c=a.tag;if(c===13){if(o=l(a),o!==null)return o;o=null}else if(c===31){if(o=u(a),o!==null)return o;o=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null)}}return Vc=o,null}function Z0(o){switch(o){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(Vo()){case ue:return 2;case ye:return 8;case Ne:case Le:return 32;case Ke:return 268435456;default:return 32}default:return 32}}var Pf=!1,yr=null,xr=null,br=null,bs=new Map,ks=new Map,kr=[],YE="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 Q0(o,a){switch(o){case"focusin":case"focusout":yr=null;break;case"dragenter":case"dragleave":xr=null;break;case"mouseover":case"mouseout":br=null;break;case"pointerover":case"pointerout":bs.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":ks.delete(a.pointerId)}}function vs(o,a,c,p,x,k){return o===null||o.nativeEvent!==k?(o={blockedOn:a,domEventName:c,eventSystemFlags:p,nativeEvent:k,targetContainers:[x]},a!==null&&(a=Wo(a),a!==null&&W0(a)),o):(o.eventSystemFlags|=p,a=o.targetContainers,x!==null&&a.indexOf(x)===-1&&a.push(x),o)}function WE(o,a,c,p,x){switch(a){case"focusin":return yr=vs(yr,o,a,c,p,x),!0;case"dragenter":return xr=vs(xr,o,a,c,p,x),!0;case"mouseover":return br=vs(br,o,a,c,p,x),!0;case"pointerover":var k=x.pointerId;return bs.set(k,vs(bs.get(k)||null,o,a,c,p,x)),!0;case"gotpointercapture":return k=x.pointerId,ks.set(k,vs(ks.get(k)||null,o,a,c,p,x)),!0}return!1}function J0(o){var a=Yo(o.target);if(a!==null){var c=s(a);if(c!==null){if(a=c.tag,a===13){if(a=l(c),a!==null){o.blockedOn=a,Ol(o.priority,function(){X0(c)});return}}else if(a===31){if(a=u(c),a!==null){o.blockedOn=a,Ol(o.priority,function(){X0(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){o.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Yc(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var c=$f(o.nativeEvent);if(c===null){c=o.nativeEvent;var p=new c.constructor(c.type,c);$d=p,c.target.dispatchEvent(p),$d=null}else return a=Wo(c),a!==null&&W0(a),o.blockedOn=c,!1;a.shift()}return!0}function eb(o,a,c){Yc(o)&&c.delete(a)}function XE(){Pf=!1,yr!==null&&Yc(yr)&&(yr=null),xr!==null&&Yc(xr)&&(xr=null),br!==null&&Yc(br)&&(br=null),bs.forEach(eb),ks.forEach(eb)}function Wc(o,a){o.blockedOn===a&&(o.blockedOn=null,Pf||(Pf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,XE)))}var Xc=null;function tb(o){Xc!==o&&(Xc=o,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Xc===o&&(Xc=null);for(var a=0;a<o.length;a+=3){var c=o[a],p=o[a+1],x=o[a+2];if(typeof p!="function"){if(Lf(p||c)===null)continue;break}var k=Wo(c);k!==null&&(o.splice(a,3),a-=3,Fp(k,{pending:!0,data:x,method:c.method,action:p},p,x))}}))}function oi(o){function a(X){return Wc(X,o)}yr!==null&&Wc(yr,o),xr!==null&&Wc(xr,o),br!==null&&Wc(br,o),bs.forEach(a),ks.forEach(a);for(var c=0;c<kr.length;c++){var p=kr[c];p.blockedOn===o&&(p.blockedOn=null)}for(;0<kr.length&&(c=kr[0],c.blockedOn===null);)J0(c),c.blockedOn===null&&kr.shift();if(c=(o.ownerDocument||o).$$reactFormReplay,c!=null)for(p=0;p<c.length;p+=3){var x=c[p],k=c[p+1],j=x[Kt]||null;if(typeof k=="function")j||tb(c);else if(j){var P=null;if(k&&k.hasAttribute("formAction")){if(x=k,j=k[Kt]||null)P=j.formAction;else if(Lf(x)!==null)continue}else P=j.action;typeof P=="function"?c[p+1]=P:(c.splice(p,3),p-=3),tb(c)}}}function nb(){function o(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(j){return x=j})},focusReset:"manual",scroll:"manual"})}function a(){x!==null&&(x(),x=null),p||setTimeout(c,20)}function c(){if(!p&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,x=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){p=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),x!==null&&(x(),x=null)}}}function Bf(o){this._internalRoot=o}Zc.prototype.render=Bf.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(r(409));var c=a.current,p=Cn();V0(c,p,o,a,null,null)},Zc.prototype.unmount=Bf.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;V0(o.current,2,null,o,null,null),_c(),a[xo]=null}};function Zc(o){this._internalRoot=o}Zc.prototype.unstable_scheduleHydration=function(o){if(o){var a=Rl();o={blockedOn:null,target:o,priority:a};for(var c=0;c<kr.length&&a!==0&&a<kr[c].priority;c++);kr.splice(c,0,o),c===0&&J0(o)}};var ob=t.version;if(ob!=="19.2.4")throw Error(r(527,ob,"19.2.4"));q.findDOMNode=function(o){var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=m(a),o=o!==null?h(o):null,o=o===null?null:o.stateNode,o};var ZE={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Qc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qc.isDisabled&&Qc.supportsFiber)try{Lt=Qc.inject(ZE),xt=Qc}catch{}}return Ss.createRoot=function(o,a){if(!i(o))throw Error(r(299));var c=!1,p="",x=ux,k=dx,j=px;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(p=a.identifierPrefix),a.onUncaughtError!==void 0&&(x=a.onUncaughtError),a.onCaughtError!==void 0&&(k=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError)),a=G0(o,1,!1,null,null,c,p,null,x,k,j,nb),o[xo]=a.current,wf(o),new Bf(a)},Ss.hydrateRoot=function(o,a,c){if(!i(o))throw Error(r(299));var p=!1,x="",k=ux,j=dx,P=px,X=null;return c!=null&&(c.unstable_strictMode===!0&&(p=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onUncaughtError!==void 0&&(k=c.onUncaughtError),c.onCaughtError!==void 0&&(j=c.onCaughtError),c.onRecoverableError!==void 0&&(P=c.onRecoverableError),c.formState!==void 0&&(X=c.formState)),a=G0(o,1,!0,a,c??null,p,x,X,k,j,P,nb),a.context=K0(null),c=a.current,p=Cn(),p=Ni(p),x=ar(p),x.callback=null,ir(c,x,p),c=p,a.current.lanes=c,Rr(a,c),io(a),o[xo]=a.current,wf(o),new Zc(a)},Ss.version="19.2.4",Ss}var fb;function iM(){if(fb)return qf.exports;fb=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),qf.exports=aM(),qf.exports}var sM=iM();const lM="modulepreload",cM=function(e){return"/"+e},mb={},Ho=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let f=function(m){return Promise.all(m.map(h=>Promise.resolve(h).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=l?.nonce||l?.getAttribute("nonce");i=f(n.map(m=>{if(m=cM(m),m in mb)return;mb[m]=!0;const h=m.endsWith(".css"),g=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const b=document.createElement("link");if(b.rel=h?"stylesheet":lM,h||(b.as="script"),b.crossOrigin="",b.href=m,u&&b.setAttribute("nonce",u),document.head.appendChild(b),h)return new Promise((y,v)=>{b.addEventListener("load",y),b.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${m}`)))})}))}function s(l){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=l,window.dispatchEvent(u),!u.defaultPrevented)throw l}return i.then(l=>{for(const u of l||[])u.status==="rejected"&&s(u.reason);return t().catch(s)})},hb=e=>{let t;const n=new Set,r=(m,h)=>{const g=typeof m=="function"?m(t):m;if(!Object.is(g,t)){const b=t;t=h??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(y=>y(t,b))}},i=()=>t,u={setState:r,getState:i,getInitialState:()=>f,subscribe:m=>(n.add(m),()=>n.delete(m))},f=t=e(r,i,u);return u},uM=(e=>e?hb(e):hb),dM=e=>e;function pM(e,t=dM){const n=Rs.useSyncExternalStore(e.subscribe,Rs.useCallback(()=>t(e.getState()),[e,t]),Rs.useCallback(()=>t(e.getInitialState()),[e,t]));return Rs.useDebugValue(n),n}const gb=e=>{const t=uM(e),n=r=>pM(t,r);return Object.assign(n,t),n},fn=(e=>e?gb(e):gb);function fM(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var s;const l=f=>f===null?null:JSON.parse(f,void 0),u=(s=n.getItem(i))!=null?s:null;return u instanceof Promise?u.then(l):l(u)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const Bm=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Bm(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Bm(r)(n)}}}},mM=(e,t)=>(n,r,i)=>{let s={storage:fM(()=>window.localStorage),partialize:E=>E,version:0,merge:(E,C)=>({...C,...E}),...t},l=!1,u=0;const f=new Set,m=new Set;let h=s.storage;if(!h)return e((...E)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...E)},r,i);const g=()=>{const E=s.partialize({...r()});return h.setItem(s.name,{state:E,version:s.version})},b=i.setState;i.setState=(E,C)=>(b(E,C),g());const y=e((...E)=>(n(...E),g()),r,i);i.getInitialState=()=>y;let v;const w=()=>{var E,C;if(!h)return;const M=++u;l=!1,f.forEach(N=>{var R;return N((R=r())!=null?R:y)});const S=((C=s.onRehydrateStorage)==null?void 0:C.call(s,(E=r())!=null?E:y))||void 0;return Bm(h.getItem.bind(h))(s.name).then(N=>{if(N)if(typeof N.version=="number"&&N.version!==s.version){if(s.migrate){const R=s.migrate(N.state,N.version);return R instanceof Promise?R.then(T=>[!0,T]):[!0,R]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,N.state];return[!1,void 0]}).then(N=>{var R;if(M!==u)return;const[T,D]=N;if(v=s.merge(D,(R=r())!=null?R:y),n(v,!0),T)return g()}).then(()=>{M===u&&(S?.(v,void 0),v=r(),l=!0,m.forEach(N=>N(v)))}).catch(N=>{M===u&&S?.(void 0,N)})};return i.persist={setOptions:E=>{s={...s,...E},E.storage&&(h=E.storage)},clearStorage:()=>{h?.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>w(),hasHydrated:()=>l,onHydrate:E=>(f.add(E),()=>{f.delete(E)}),onFinishHydration:E=>(m.add(E),()=>{m.delete(E)})},s.skipHydration||w(),v||y},hM=mM,Ar={"ground-truth":{label:"Ground Truth",color:"#e74c3c",icon:"🔴",instruction:"Do not contradict this."},signal:{label:"Signal",color:"#f1c40f",icon:"🟡",instruction:"Interpret — look for the underlying need, not the surface request."},evidence:{label:"Evidence",color:"#3498db",icon:"🔵",instruction:"Cite and weigh against other evidence."},framework:{label:"Framework",color:"#2ecc71",icon:"🟢",instruction:"Use to structure thinking, but not as immutable."},hypothesis:{label:"Hypothesis",color:"#9b59b6",icon:"🟣",instruction:"Help validate or invalidate with evidence and signals."},guideline:{label:"Guideline",color:"#FE5000",icon:"📏",instruction:"Extract and enforce as constraints, workflow rules, and output formatting."}},gM=[[["signal","feedback","user feedback"],"signal"],[["discovery","_temp_"],"hypothesis"],[["roadmap","plans/","plan/"],"framework"],[["intel","competitors","competitive","research","savings-analysis"],"evidence"],[["cmo-handoff","release","demo","newsletter"],"evidence"],[["sales prep","event prep","executive profiler"],"framework"],[["guidelines","contributing","code-style","coding-standards","engineering-rules"],"guideline"],[["products"],"ground-truth",["feedback"]],[["clients/"],"ground-truth",["feedback"]],[["companies"],"evidence"],[["voyage-preparation","navarea-map"],"ground-truth"]],yM=[{patterns:[/^#{1,2}\s*(spec|specification|schema|api|contract|definition|interface)/mi,/\b(MUST|SHALL|REQUIRED)\b/g,/```(json|yaml|graphql|proto|sql)\b/g,/\b(version|v\d+\.\d+)/gi],type:"ground-truth",weight:10,minMatches:2},{patterns:[/\b(user said|customer|feedback|interview|request(ed)?|pain point|frustrat|complain|asked for|wants? to|need(s|ed)?)\b/gi,/\b(nps|csat|satisfaction|churn|retention)\b/gi,/[""][^""]{10,}[""]/g,/\b(quote|verbatim)\b/gi],type:"signal",weight:8,minMatches:2},{patterns:[/\b(analysis|benchmark|comparison|metric|kpi|data|report|finding|result|measured|observed)\b/gi,/\d+(\.\d+)?%/g,/\b(increase|decrease|growth|decline|trend)\b/gi,/\|\s*\w+\s*\|/g],type:"evidence",weight:7,minMatches:2},{patterns:[/\b(framework|methodology|process|template|playbook|checklist|step \d|phase \d|stage \d)\b/gi,/\b(when to|how to|best practice|guideline|principle|pattern)\b/gi,/^\s*[-*]\s*\[[ x]\]/gm,/\b(input|output|trigger|criteria)\b/gi],type:"framework",weight:6,minMatches:2},{patterns:[/\b(hypothesis|proposal|rfc|suggest(ion)?|idea|explore|what if|could we|might|experiment|assumption|validate)\b/gi,/\b(pro(s)?|con(s)?|trade-?off|risk|upside|downside)\b/gi,/\b(option [a-c]|alternative|approach \d)\b/gi],type:"hypothesis",weight:5,minMatches:2},{patterns:[/\b(MUST|SHALL|NEVER|ALWAYS|REQUIRED|FORBIDDEN|DO NOT)\b/g,/\b(convention|standard|guideline|rule|policy|style guide|best practice|coding standard)\b/gi,/\b(naming|branch|commit|pr|pull request)\s*(convention|format|rule|pattern)/gi,/\b(linting|formatting|eslint|prettier|editorconfig)\b/gi],type:"guideline",weight:8,minMatches:2}],xM=[{test:(e,t)=>t==="ground-truth",depth:0},{test:(e,t)=>t==="signal",depth:0},{test:e=>e.length<2e3,depth:0},{test:(e,t)=>t==="hypothesis",depth:1},{test:(e,t)=>t==="evidence"&&e.length>8e3,depth:2},{test:(e,t)=>t==="evidence",depth:1},{test:(e,t)=>t==="framework"&&e.length>8e3,depth:2},{test:(e,t)=>t==="framework",depth:1},{test:(e,t)=>t==="guideline",depth:0}];function $s(e,t){return Hm(e,t).knowledgeType}function Hm(e,t){const n=e.toLowerCase();for(const[s,l,u]of gM)if(s.some(f=>n.includes(f))){if(u&&u.some(m=>n.includes(m)))continue;const f=Jc(t||"",l);return{knowledgeType:l,depth:f,confidence:"high",reason:`Path matches "${s.find(m=>n.includes(m))}"`}}if(t&&t.length>50){const s=[];for(const l of yM){let u=0,f=0;for(const h of l.patterns){h.lastIndex=0;const g=t.match(h);g&&g.length>0&&(f++,u+=g.length)}const m=l.minMatches??1;f>=m&&s.push({type:l.type,score:u*l.weight,matches:f})}if(s.length>0){s.sort((m,h)=>h.score-m.score);const l=s[0],u=l.score>30?"high":l.score>10?"medium":"low",f=Jc(t,l.type);return{knowledgeType:l.type,depth:f,confidence:u,reason:`Content analysis: ${l.matches} pattern groups, score ${l.score}`}}}const r=e.split(".").pop()?.toLowerCase();if(r){const s={json:"ground-truth",yaml:"ground-truth",yml:"ground-truth",toml:"ground-truth",sql:"ground-truth",graphql:"ground-truth",proto:"ground-truth",csv:"evidence",tsv:"evidence",xlsx:"evidence",py:"guideline",ts:"guideline",js:"guideline",tsx:"guideline",jsx:"guideline",log:"guideline",txt:"evidence"};if(s[r]){const l=Jc(t||"",s[r]);return{knowledgeType:s[r],depth:l,confidence:"low",reason:`File extension .${r}`}}}return{knowledgeType:"evidence",depth:Jc(t||"","evidence"),confidence:"low",reason:"Default"}}function Jc(e,t){for(const n of xM)if(n.test(e,t))return n.depth;return 1}const Vk=[{id:"markdown",label:"Markdown",icon:"📝",ext:".md"},{id:"html-slides",label:"HTML Slides",icon:"🎯",ext:".html"},{id:"email",label:"Email Draft",icon:"✉️",ext:""},{id:"code",label:"Code",icon:"💻",ext:".py"},{id:"csv",label:"Data Table",icon:"📊",ext:".csv"},{id:"json",label:"JSON",icon:"{}",ext:".json"},{id:"diagram",label:"Diagram",icon:"🔀",ext:".svg"},{id:"slack",label:"Slack Post",icon:"💬",ext:""}];function bM(e){const t=e.toLowerCase();return t.includes("slide")||t.includes("presentation")||t.includes("pitch")||t.includes("deck")?"html-slides":t.includes("email")||t.includes("draft")||t.includes("send to")?"email":t.includes("script")||t.includes("function")||t.includes("code")||t.includes("implement")?"code":t.includes("table")||t.includes("csv")||t.includes("spreadsheet")||t.includes("data")?"csv":t.includes("json")||t.includes("api")||t.includes("schema")?"json":t.includes("diagram")||t.includes("flowchart")||t.includes("architecture")?"diagram":t.includes("slack")||t.includes("post in")?"slack":"markdown"}const fi=[{label:"Full",pct:1},{label:"Detail",pct:.75},{label:"Summary",pct:.5},{label:"Headlines",pct:.25},{label:"Mention",pct:.1}],yb={model:"claude-opus-4",temperature:.7,systemPrompt:"",planningMode:"single-shot",maxTokens:4096};function Me(e,t,n,r,i,s=0){return{sourceId:e,name:t,path:n,category:r,knowledgeType:$s(n),depth:s,baseTokens:i}}const kM=[{id:"senior-pm",name:"Senior PM",agentConfig:{model:"claude-opus-4",temperature:.5,planningMode:"chain-of-thought",maxTokens:8192},channels:[Me("knowledge-products","Products","00 - Knowledge/Products/","knowledge",16e3,0),Me("knowledge-products-feedback","Feedback","00 - Knowledge/Products/Feedback/","knowledge",4800,0),Me("signals-odfjell","User feedback / Odfjell","07 - Signals/User feedback/odfjell/","intel",6800,1),Me("signals-kcc","User feedback / KCC","07 - Signals/User feedback/kcc/","intel",5200,1),Me("signals-general","User feedback / General","07 - Signals/User feedback/general/","intel",7500,1),Me("discovery-eu-ets","EU ETS Cost Layer","01 - Discovery/EU ETS Cost Layer/","discovery",3200,2),Me("discovery-weather-routing","Weather Routing v2","01 - Discovery/Weather Routing v2/","discovery",4100,2),Me("discovery-fleet-dashboard","Fleet Dashboard","01 - Discovery/Fleet Dashboard/","discovery",3500,2),Me("roadmap","03 - Roadmap","03 - Roadmap/","knowledge",12e3,1)]},{id:"competitive-intel",name:"Competitive Intel",agentConfig:{model:"claude-opus-4",temperature:.3,planningMode:"react",maxTokens:8192},channels:[Me("knowledge-competitors","Competitors","00 - Knowledge/Competitors/","knowledge",22e3,0),Me("knowledge-competitors-stormgeo","StormGeo","00 - Knowledge/Competitors/Features/stormgeo/","knowledge",4500,0),Me("knowledge-competitors-dtn","DTN","00 - Knowledge/Competitors/Features/dtn/","knowledge",3800,0),Me("knowledge-competitors-sofar","Sofar","00 - Knowledge/Competitors/Features/sofar/","knowledge",3200,0),Me("knowledge-competitors-wni","WNI","00 - Knowledge/Competitors/Features/wni/","knowledge",3600,0),Me("cmo-competitive-intel","05 - Competitive Intel","CMO-Handoff/05 - Competitive Intel/","intel",5800,1),Me("intel-competitive","01 - Competitive Intel","05 - Intel/01 - Competitive Intel/","intel",12e3,0)]},{id:"company-intel",name:"Company Intel",channels:[Me("knowledge-companies","Companies","00 - Knowledge/Companies/","knowledge",14e3,0),Me("cmo-company-profiles","01 - Company Profiles","CMO-Handoff/01 - Company Profiles/","knowledge",28e3,0),Me("cmo-charter-structures","02 - Charter Structures","CMO-Handoff/02 - Charter Structures/","knowledge",8500,1)]},{id:"feedback-manager",name:"Feedback Manager",agentConfig:{model:"claude-sonnet-4",temperature:.4,planningMode:"chain-of-thought",maxTokens:4096},channels:[Me("knowledge-products-feedback","Feedback","00 - Knowledge/Products/Feedback/","knowledge",4800,0),Me("signals-odfjell","User feedback / Odfjell","07 - Signals/User feedback/odfjell/","intel",6800,0),Me("signals-kcc","User feedback / KCC","07 - Signals/User feedback/kcc/","intel",5200,0),Me("signals-baru","User feedback / Baru","07 - Signals/User feedback/baru/","intel",4500,0),Me("signals-general","User feedback / General","07 - Signals/User feedback/general/","intel",7500,0),Me("intel-feedback","04 - Feedback Synthesis","05 - Intel/04 - Feedback Synthesis/","intel",4800,1)]},{id:"odfjell-deep-dive",name:"Odfjell Deep Dive",channels:[Me("odfjell-savings","odfjell-savings-analysis","odfjell-savings-analysis/","intel",14e3,0),Me("knowledge-clients-odfjell","Odfjell","00 - Knowledge/Clients/odfjell/","knowledge",4200,0),Me("signals-odfjell","User feedback / Odfjell","07 - Signals/User feedback/odfjell/","intel",6800,0),Me("cmo-charter-structures","02 - Charter Structures","CMO-Handoff/02 - Charter Structures/","knowledge",8500,1),Me("knowledge-competitors-stormgeo","StormGeo","00 - Knowledge/Competitors/Features/stormgeo/","knowledge",4500,2)]},{id:"voyage-prep-dev",name:"Voyage Prep Dev",channels:[Me("voyage-prep","voyage-preparation","voyage-preparation/","discovery",18e3,0),Me("temp-voyage","_temp_voyage-briefing","_temp_voyage-briefing/","discovery",6400,0),Me("discovery-weather-routing","Weather Routing v2","01 - Discovery/Weather Routing v2/","discovery",4100,1),Me("knowledge-products-nr","Navigation Reports","00 - Knowledge/Products/NR/","knowledge",8200,1)]},{id:"event-prep",name:"Event Prep",channels:[Me("sales-prep-events","Event Prep","06 - Sales Prep/Event Prep/","agents",9500,0),Me("sales-prep-exec","Executive Profiler","06 - Sales Prep/Executive Profiler/","agents",8500,0),Me("cmo-event-prep","07 - Event Prep Profiles","CMO-Handoff/07 - Event Prep Profiles/","agents",3500,0),Me("cmo-company-profiles","01 - Company Profiles","CMO-Handoff/01 - Company Profiles/","knowledge",28e3,2)]},{id:"maritime-intel",name:"Maritime Intel",channels:[Me("intel-maritime","02 - Maritime Intel","05 - Intel/02 - Maritime Intel/","intel",14e3,0),Me("navarea-map","navarea-map","navarea-map/","intel",11e3,0),Me("intel-research","03 - Research","05 - Intel/03 - Research/","intel",7200,1)]},{id:"discovery-all",name:"Discovery",channels:[Me("discovery-eu-ets","EU ETS Cost Layer","01 - Discovery/EU ETS Cost Layer/","discovery",3200,0),Me("discovery-weather-routing","Weather Routing v2","01 - Discovery/Weather Routing v2/","discovery",4100,0),Me("discovery-cii-monitor","CII Monitor","01 - Discovery/CII Monitor/","discovery",2800,0),Me("discovery-fleet-dashboard","Fleet Dashboard","01 - Discovery/Fleet Dashboard/","discovery",3500,0),Me("discovery-voyage-compare","Voyage Compare","01 - Discovery/Voyage Compare/","discovery",2600,0),Me("discovery-port-insights","Port Insights","01 - Discovery/Port Insights/","discovery",2200,0),Me("discovery-api-v2","API v2","01 - Discovery/API v2/","discovery",3800,0),Me("discovery-alerts-engine","Alerts Engine","01 - Discovery/Alerts Engine/","discovery",2400,0),Me("discovery-bunker-opt","Bunker Optimization","01 - Discovery/Bunker Optimization/","discovery",3100,0),Me("discovery-cargo-tracking","Cargo Tracking","01 - Discovery/Cargo Tracking/","discovery",2700,0)]},{id:"all-knowledge",name:"All Knowledge",channels:[Me("knowledge","00 - Knowledge","00 - Knowledge/","knowledge",82e3,2),Me("knowledge-clients","Clients","00 - Knowledge/Clients/","knowledge",18e3,1),Me("knowledge-companies","Companies","00 - Knowledge/Companies/","knowledge",14e3,1),Me("knowledge-competitors","Competitors","00 - Knowledge/Competitors/","knowledge",22e3,1),Me("knowledge-products","Products","00 - Knowledge/Products/","knowledge",16e3,0),Me("knowledge-market","Market","00 - Knowledge/Market/","knowledge",6500,2),Me("knowledge-users","Users","00 - Knowledge/Users/","knowledge",5500,2)]}],ra=[{id:"mcp-filesystem",name:"Filesystem",npmPackage:"@modelcontextprotocol/server-filesystem",description:"Read, write, and manage local files with configurable access controls",icon:"folder",category:"coding",author:"MCP Official",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-filesystem"],configFields:[{key:"ALLOWED_DIRS",label:"Allowed Directories (comma-separated)",type:"text",placeholder:"/home/user/projects,/tmp",required:!0}],repo:"https://github.com/modelcontextprotocol/servers",tags:["files","local","read","write"],authMethod:"none"},{id:"mcp-memory",name:"Memory (Knowledge Graph)",npmPackage:"@modelcontextprotocol/server-memory",description:"Persistent knowledge graph memory for agent state and relationships",icon:"brain",category:"data",author:"MCP Official",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-memory"],configFields:[],repo:"https://github.com/modelcontextprotocol/servers",tags:["memory","knowledge-graph","state","persistence"],authMethod:"none"},{id:"mcp-fetch",name:"Fetch",npmPackage:"@modelcontextprotocol/server-fetch",description:"Fetch web content and convert to markdown for LLM consumption",icon:"download",category:"research",author:"MCP Official",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-fetch"],configFields:[],repo:"https://github.com/modelcontextprotocol/servers",tags:["web","fetch","scrape","markdown"],authMethod:"none"},{id:"mcp-git",name:"Git",npmPackage:"@modelcontextprotocol/server-git",description:"Read, search, and manipulate Git repositories - log, diff, blame",icon:"git-branch",category:"coding",author:"MCP Official",transport:"stdio",runtimes:["claude","amp","codex"],command:"uvx",defaultArgs:["mcp-server-git"],configFields:[{key:"GIT_REPO_PATH",label:"Repository Path",type:"text",placeholder:"/path/to/repo",required:!1}],repo:"https://github.com/modelcontextprotocol/servers",tags:["git","version-control","diff","log"],authMethod:"none",installHint:{macos:"brew install uv",linux:"curl -LsSf https://astral.sh/uv/install.sh | sh",windows:"pip install uv"}},{id:"mcp-sequential-thinking",name:"Sequential Thinking",npmPackage:"@modelcontextprotocol/server-sequential-thinking",description:"Dynamic and reflective problem-solving through structured thought sequences",icon:"list-ordered",category:"research",author:"MCP Official",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-sequential-thinking"],configFields:[],repo:"https://github.com/modelcontextprotocol/servers",tags:["thinking","reasoning","chain-of-thought"],authMethod:"none"},{id:"mcp-time",name:"Time",npmPackage:"@modelcontextprotocol/server-time",description:"Get current time and convert between timezones",icon:"clock",category:"data",author:"MCP Official",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-time"],configFields:[],repo:"https://github.com/modelcontextprotocol/servers",tags:["time","timezone","date"],authMethod:"none"},{id:"mcp-everything",name:"Everything (Test)",npmPackage:"@modelcontextprotocol/server-everything",description:"Reference test server with prompts, resources, and tools for MCP testing",icon:"star",category:"coding",author:"MCP Official",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-everything"],configFields:[],repo:"https://github.com/modelcontextprotocol/servers",tags:["test","reference","debug"],authMethod:"none"},{id:"mcp-brave-search",name:"Brave Search",npmPackage:"@modelcontextprotocol/server-brave-search",description:"Web and local search powered by Brave Search API",icon:"search",category:"research",author:"MCP Official",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-brave-search"],configFields:[{key:"BRAVE_API_KEY",label:"API Key",type:"password",placeholder:"BSA...",required:!0}],website:"https://brave.com/search/api/",tags:["search","web","brave"],authMethod:"api-key"},{id:"mcp-tavily",name:"Tavily Search",npmPackage:"tavily-mcp",description:"AI-optimized search engine with structured results and answer extraction",icon:"search",category:"research",author:"Tavily",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","tavily-mcp"],configFields:[{key:"TAVILY_API_KEY",label:"API Key",type:"password",placeholder:"tvly-...",required:!0}],website:"https://tavily.com",tags:["search","ai-search","research"],authMethod:"api-key"},{id:"mcp-exa",name:"Exa Search",npmPackage:"exa-mcp-server",description:"Neural search engine - find similar content, get page contents",icon:"search",category:"research",author:"Exa",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","exa-mcp-server"],configFields:[{key:"EXA_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0}],website:"https://exa.ai",tags:["search","neural-search","semantic"],authMethod:"api-key"},{id:"mcp-firecrawl",name:"Firecrawl",npmPackage:"firecrawl-mcp",description:"Web scraping and crawling - extract structured data from any website",icon:"flame",category:"research",author:"Firecrawl",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","firecrawl-mcp"],configFields:[{key:"FIRECRAWL_API_KEY",label:"API Key",type:"password",placeholder:"fc-...",required:!0}],website:"https://firecrawl.dev",tags:["scraping","crawling","web","extract"],authMethod:"api-key"},{id:"mcp-puppeteer",name:"Puppeteer",npmPackage:"@modelcontextprotocol/server-puppeteer",description:"Browser automation - screenshots, navigation, form filling, scraping",icon:"globe",category:"research",author:"MCP Official",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-puppeteer"],configFields:[],tags:["browser","automation","screenshots","scraping"],authMethod:"none"},{id:"mcp-playwright",name:"Playwright",npmPackage:"@playwright/mcp",description:"Browser automation with Playwright - cross-browser testing and scraping",icon:"globe",category:"research",author:"Microsoft",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@playwright/mcp"],configFields:[],tags:["browser","playwright","testing","automation"],authMethod:"none"},{id:"mcp-github",name:"GitHub",npmPackage:"@modelcontextprotocol/server-github",description:"GitHub repos, issues, PRs, code search, and actions",icon:"git-branch",category:"coding",author:"GitHub",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-github"],configFields:[{key:"GITHUB_TOKEN",label:"Personal Access Token",type:"password",placeholder:"ghp_...",required:!0}],website:"https://github.com",tags:["github","git","issues","pr","code"],authMethod:"api-key"},{id:"github-remote",name:"GitHub (Cloud)",npmPackage:"@modelcontextprotocol/server-github-cloud",description:"GitHub repos, issues, PRs – OAuth via GitHub App",icon:"git-branch",category:"coding",author:"GitHub",transport:"sse",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-github-cloud"],url:"https://api.githubcopilot.com/mcp/",authMethod:"oauth",configFields:[],website:"https://github.com",tags:["github","git","issues","pr","code","oauth"]},{id:"mcp-gitlab",name:"GitLab",npmPackage:"@modelcontextprotocol/server-gitlab",description:"GitLab API - projects, issues, merge requests, pipelines",icon:"git-merge",category:"coding",author:"GitLab",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-gitlab"],configFields:[{key:"GITLAB_TOKEN",label:"Access Token",type:"password",placeholder:"glpat-...",required:!0},{key:"GITLAB_URL",label:"Instance URL",type:"url",placeholder:"https://gitlab.com",required:!1}],tags:["gitlab","git","ci-cd","merge-request"],authMethod:"api-key"},{id:"mcp-linear",name:"Linear",npmPackage:"@linear/mcp-server",description:"Linear project management - issues, projects, cycles, and teams",icon:"target",category:"coding",author:"Linear",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@linear/mcp-server"],configFields:[{key:"LINEAR_API_KEY",label:"API Key",type:"password",placeholder:"lin_api_...",required:!0}],website:"https://linear.app",tags:["linear","project-management","issues","agile"],authMethod:"api-key"},{id:"mcp-sentry",name:"Sentry",npmPackage:"@sentry/mcp-server",description:"Error tracking and performance monitoring - issues, events, releases",icon:"shield",category:"coding",author:"Sentry",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@sentry/mcp-server"],configFields:[{key:"SENTRY_AUTH_TOKEN",label:"Auth Token",type:"password",placeholder:"sntrys_...",required:!0}],website:"https://sentry.io",tags:["sentry","errors","monitoring","debugging"],authMethod:"api-key"},{id:"mcp-docker",name:"Docker",npmPackage:"docker-mcp",description:"Manage Docker containers, images, volumes, and networks",icon:"box",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","docker-mcp"],configFields:[],tags:["docker","containers","devops","infrastructure"],authMethod:"none"},{id:"mcp-kubernetes",name:"Kubernetes",npmPackage:"kubernetes-mcp",description:"Kubernetes cluster management - pods, deployments, services, logs",icon:"server",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","kubernetes-mcp"],configFields:[{key:"KUBECONFIG",label:"Kubeconfig Path",type:"text",placeholder:"~/.kube/config",required:!1}],tags:["kubernetes","k8s","devops","orchestration"],authMethod:"none"},{id:"mcp-vercel",name:"Vercel",npmPackage:"@vercel/mcp",description:"Vercel deployments, domains, environment variables, and logs",icon:"triangle",category:"coding",author:"Vercel",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@vercel/mcp"],configFields:[{key:"VERCEL_TOKEN",label:"Access Token",type:"password",placeholder:"",required:!0}],website:"https://vercel.com",tags:["vercel","deploy","hosting","serverless"],authMethod:"api-key"},{id:"mcp-cloudflare",name:"Cloudflare",npmPackage:"@cloudflare/mcp-server-cloudflare",description:"Cloudflare Workers, KV, R2, D1, and DNS management",icon:"cloud",category:"coding",author:"Cloudflare",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@cloudflare/mcp-server-cloudflare"],configFields:[{key:"CLOUDFLARE_API_TOKEN",label:"API Token",type:"password",placeholder:"",required:!0}],website:"https://cloudflare.com",tags:["cloudflare","workers","cdn","dns"],authMethod:"api-key"},{id:"mcp-netlify",name:"Netlify",npmPackage:"netlify-mcp",description:"Netlify sites, deploys, functions, and build hooks",icon:"globe",category:"coding",author:"Netlify",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","netlify-mcp"],configFields:[{key:"NETLIFY_TOKEN",label:"Personal Access Token",type:"password",placeholder:"",required:!0}],tags:["netlify","deploy","hosting","jamstack"],authMethod:"api-key"},{id:"mcp-npm",name:"npm Registry",npmPackage:"npm-mcp",description:"Search npm packages, view details, check versions and dependencies",icon:"package",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","npm-mcp"],configFields:[],tags:["npm","packages","dependencies","registry"],authMethod:"none"},{id:"mcp-postgres",name:"PostgreSQL",npmPackage:"@modelcontextprotocol/server-postgres",description:"Query PostgreSQL databases - schema inspection, read/write operations",icon:"database",category:"data",author:"MCP Official",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-postgres"],configFields:[{key:"DATABASE_URL",label:"Connection String",type:"password",placeholder:"postgresql://user:pass@host:5432/db",required:!0}],tags:["postgres","database","sql","query"],authMethod:"api-key"},{id:"mcp-mysql",name:"MySQL",npmPackage:"mysql-mcp-server",description:"MySQL database operations - queries, schema, migrations",icon:"database",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","mysql-mcp-server"],configFields:[{key:"MYSQL_URL",label:"Connection String",type:"password",placeholder:"mysql://user:pass@host:3306/db",required:!0}],tags:["mysql","database","sql"],authMethod:"api-key"},{id:"mcp-sqlite",name:"SQLite",npmPackage:"@modelcontextprotocol/server-sqlite",description:"SQLite database - local file-based SQL with business intelligence",icon:"database",category:"data",author:"MCP Official",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-sqlite"],configFields:[{key:"SQLITE_PATH",label:"Database File Path",type:"text",placeholder:"/path/to/database.db",required:!0}],tags:["sqlite","database","sql","local"],authMethod:"none"},{id:"mcp-mongodb",name:"MongoDB",npmPackage:"mongodb-mcp-server",description:"MongoDB operations - collections, documents, aggregation pipelines",icon:"database",category:"data",author:"MongoDB",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","mongodb-mcp-server"],configFields:[{key:"MONGODB_URI",label:"Connection URI",type:"password",placeholder:"mongodb+srv://user:pass@cluster.mongodb.net/db",required:!0}],tags:["mongodb","nosql","database","documents"],authMethod:"api-key"},{id:"mcp-redis",name:"Redis",npmPackage:"@modelcontextprotocol/server-redis",description:"Redis key-value store - get, set, scan, pub/sub",icon:"database",category:"data",author:"MCP Official",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-redis"],configFields:[{key:"REDIS_URL",label:"Connection URL",type:"password",placeholder:"redis://localhost:6379",required:!0}],tags:["redis","cache","key-value","pub-sub"],authMethod:"api-key"},{id:"mcp-supabase",name:"Supabase",npmPackage:"@supabase/mcp-server",description:"Supabase - database, auth, storage, edge functions, realtime",icon:"database",category:"data",author:"Supabase",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@supabase/mcp-server"],configFields:[{key:"SUPABASE_URL",label:"Project URL",type:"url",placeholder:"https://xxx.supabase.co",required:!0},{key:"SUPABASE_SERVICE_ROLE_KEY",label:"Service Role Key",type:"password",placeholder:"eyJ...",required:!0}],website:"https://supabase.com",tags:["supabase","database","auth","storage","postgres"],authMethod:"api-key"},{id:"mcp-neon",name:"Neon",npmPackage:"@neondatabase/mcp-server-neon",description:"Neon serverless Postgres - branches, queries, schema management",icon:"database",category:"data",author:"Neon",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@neondatabase/mcp-server-neon"],configFields:[{key:"NEON_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0}],website:"https://neon.tech",tags:["neon","postgres","serverless","database"],authMethod:"api-key"},{id:"mcp-turso",name:"Turso",npmPackage:"@tursodatabase/mcp-server",description:"Turso edge database - SQLite at the edge, libSQL",icon:"database",category:"data",author:"Turso",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@tursodatabase/mcp-server"],configFields:[{key:"TURSO_DATABASE_URL",label:"Database URL",type:"url",placeholder:"libsql://db-org.turso.io",required:!0},{key:"TURSO_AUTH_TOKEN",label:"Auth Token",type:"password",placeholder:"",required:!0}],website:"https://turso.tech",tags:["turso","sqlite","edge","database"],authMethod:"api-key"},{id:"mcp-pinecone",name:"Pinecone",npmPackage:"@pinecone-database/mcp",description:"Pinecone vector database - upsert, query, delete vectors",icon:"database",category:"data",author:"Pinecone",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@pinecone-database/mcp"],configFields:[{key:"PINECONE_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0}],website:"https://pinecone.io",tags:["pinecone","vector","embeddings","rag"],authMethod:"api-key"},{id:"mcp-qdrant",name:"Qdrant",npmPackage:"qdrant-mcp",description:"Qdrant vector search - collections, points, filtering, similarity",icon:"database",category:"data",author:"Qdrant",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","qdrant-mcp"],configFields:[{key:"QDRANT_URL",label:"URL",type:"url",placeholder:"http://localhost:6333",required:!0},{key:"QDRANT_API_KEY",label:"API Key",type:"password",placeholder:"",required:!1}],website:"https://qdrant.tech",tags:["qdrant","vector","search","embeddings"],authMethod:"api-key"},{id:"mcp-slack",name:"Slack",npmPackage:"@modelcontextprotocol/server-slack",description:"Slack workspace - channels, messages, threads, search, reactions",icon:"hash",category:"data",author:"Slack",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-slack"],configFields:[{key:"SLACK_BOT_TOKEN",label:"Bot Token",type:"password",placeholder:"xoxb-...",required:!0},{key:"SLACK_TEAM_ID",label:"Team ID",type:"text",placeholder:"T0...",required:!1}],website:"https://slack.com",tags:["slack","messaging","channels","team"],authMethod:"api-key"},{id:"slack-remote",name:"Slack (Cloud)",npmPackage:"",description:"Slack workspace - OAuth, no bot token needed",icon:"hash",category:"data",author:"Slack",transport:"streamable-http",runtimes:["claude","amp","codex"],command:"",defaultArgs:[],url:"https://mcp.slack.com/sse",authMethod:"oauth",configFields:[],website:"https://slack.com",tags:["slack","messaging","channels","team","oauth"]},{id:"mcp-discord",name:"Discord",npmPackage:"discord-mcp",description:"Discord bot - read messages, manage channels, send notifications",icon:"message-circle",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","discord-mcp"],configFields:[{key:"DISCORD_TOKEN",label:"Bot Token",type:"password",placeholder:"",required:!0}],tags:["discord","messaging","bot","community"],authMethod:"api-key"},{id:"mcp-gmail",name:"Gmail",npmPackage:"@gongrzhe/server-gmail-autoauth-mcp",description:"Read, send, search, and manage Gmail with OAuth auto-auth",icon:"mail",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@gongrzhe/server-gmail-autoauth-mcp"],configFields:[{key:"GMAIL_CLIENT_ID",label:"OAuth Client ID",type:"text",placeholder:"...apps.googleusercontent.com",required:!0},{key:"GMAIL_CLIENT_SECRET",label:"OAuth Client Secret",type:"password",placeholder:"GOCSPX-...",required:!0}],tags:["gmail","email","google","oauth"],authMethod:"api-key"},{id:"mcp-email",name:"Email (SMTP/IMAP)",npmPackage:"email-mcp",description:"Send and read emails via SMTP/IMAP - works with any email provider",icon:"mail",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","email-mcp"],configFields:[{key:"SMTP_HOST",label:"SMTP Host",type:"text",placeholder:"smtp.gmail.com",required:!0},{key:"SMTP_USER",label:"Username",type:"text",placeholder:"user@example.com",required:!0},{key:"SMTP_PASS",label:"Password",type:"password",placeholder:"",required:!0}],tags:["email","smtp","imap","send"],authMethod:"api-key"},{id:"mcp-twilio",name:"Twilio",npmPackage:"twilio-mcp",description:"Send SMS, make calls, manage phone numbers via Twilio API",icon:"phone",category:"data",author:"Twilio",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","twilio-mcp"],configFields:[{key:"TWILIO_ACCOUNT_SID",label:"Account SID",type:"text",placeholder:"AC...",required:!0},{key:"TWILIO_AUTH_TOKEN",label:"Auth Token",type:"password",placeholder:"",required:!0}],website:"https://twilio.com",tags:["twilio","sms","phone","messaging"],authMethod:"api-key"},{id:"mcp-notion",name:"Notion",npmPackage:"@notionhq/notion-mcp-server",description:"Notion pages, databases, blocks - read, create, update, search",icon:"book-open",category:"writing",author:"Notion",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@notionhq/notion-mcp-server"],configFields:[{key:"NOTION_TOKEN",label:"Integration Token",type:"password",placeholder:"ntn_...",required:!0}],website:"https://notion.so",tags:["notion","docs","wiki","database","pages"],authMethod:"api-key"},{id:"notion-remote",name:"Notion (Cloud)",npmPackage:"",description:"Notion pages, databases, blocks - OAuth, no API key needed",icon:"book-open",category:"writing",author:"Notion",transport:"streamable-http",runtimes:["claude","amp","codex"],command:"",defaultArgs:[],url:"https://mcp.notion.com/mcp",authMethod:"oauth",configFields:[],website:"https://notion.so",tags:["notion","docs","wiki","database","pages","oauth"],sameServiceAs:"mcp-notion"},{id:"mcp-google-drive",name:"Google Drive",npmPackage:"@modelcontextprotocol/server-gdrive",description:"Google Drive - search, read, create files and folders",icon:"hard-drive",category:"data",author:"MCP Official",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-gdrive"],configFields:[{key:"GOOGLE_CLIENT_ID",label:"OAuth Client ID",type:"text",placeholder:"",required:!0},{key:"GOOGLE_CLIENT_SECRET",label:"OAuth Client Secret",type:"password",placeholder:"",required:!0}],tags:["google-drive","files","docs","sheets","storage"],authMethod:"api-key"},{id:"mcp-google-sheets",name:"Google Sheets",npmPackage:"google-sheets-mcp",description:"Read and write Google Sheets - cells, ranges, formulas",icon:"table",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","google-sheets-mcp"],configFields:[{key:"GOOGLE_CLIENT_ID",label:"OAuth Client ID",type:"text",placeholder:"",required:!0},{key:"GOOGLE_CLIENT_SECRET",label:"OAuth Client Secret",type:"password",placeholder:"",required:!0}],tags:["google-sheets","spreadsheet","data","tables"],authMethod:"api-key"},{id:"mcp-google-calendar",name:"Google Calendar",npmPackage:"google-calendar-mcp",description:"Google Calendar - events, scheduling, availability, reminders",icon:"calendar",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","google-calendar-mcp"],configFields:[{key:"GOOGLE_CLIENT_ID",label:"OAuth Client ID",type:"text",placeholder:"",required:!0},{key:"GOOGLE_CLIENT_SECRET",label:"OAuth Client Secret",type:"password",placeholder:"",required:!0}],tags:["google-calendar","events","scheduling","calendar"],authMethod:"api-key"},{id:"mcp-google-maps",name:"Google Maps",npmPackage:"@modelcontextprotocol/server-google-maps",description:"Google Maps - geocoding, directions, places, distance matrix",icon:"map-pin",category:"data",author:"MCP Official",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-google-maps"],configFields:[{key:"GOOGLE_MAPS_API_KEY",label:"API Key",type:"password",placeholder:"AIza...",required:!0}],tags:["google-maps","geocoding","directions","places"],authMethod:"api-key"},{id:"mcp-confluence",name:"Confluence",npmPackage:"confluence-mcp",description:"Atlassian Confluence - spaces, pages, search, content management",icon:"book-open",category:"writing",author:"Atlassian",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","confluence-mcp"],configFields:[{key:"CONFLUENCE_URL",label:"Instance URL",type:"url",placeholder:"https://your-org.atlassian.net/wiki",required:!0},{key:"CONFLUENCE_TOKEN",label:"API Token",type:"password",placeholder:"",required:!0},{key:"CONFLUENCE_EMAIL",label:"Email",type:"text",placeholder:"user@company.com",required:!0}],tags:["confluence","wiki","docs","atlassian"],authMethod:"api-key"},{id:"mcp-jira",name:"Jira",npmPackage:"jira-mcp",description:"Jira - issues, boards, sprints, epics, JQL search",icon:"clipboard-list",category:"coding",author:"Atlassian",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","jira-mcp"],configFields:[{key:"JIRA_URL",label:"Instance URL",type:"url",placeholder:"https://your-org.atlassian.net",required:!0},{key:"JIRA_EMAIL",label:"Email",type:"text",placeholder:"user@company.com",required:!0},{key:"JIRA_TOKEN",label:"API Token",type:"password",placeholder:"",required:!0}],tags:["jira","issues","agile","boards","atlassian"],authMethod:"api-key"},{id:"mcp-asana",name:"Asana",npmPackage:"asana-mcp",description:"Asana - tasks, projects, sections, comments, assignees",icon:"check-square",category:"coding",author:"Asana",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","asana-mcp"],configFields:[{key:"ASANA_TOKEN",label:"Personal Access Token",type:"password",placeholder:"1/...",required:!0}],website:"https://asana.com",tags:["asana","tasks","project-management"],authMethod:"api-key"},{id:"mcp-todoist",name:"Todoist",npmPackage:"todoist-mcp",description:"Todoist - tasks, projects, labels, filters, productivity",icon:"check-circle",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","todoist-mcp"],configFields:[{key:"TODOIST_API_TOKEN",label:"API Token",type:"password",placeholder:"",required:!0}],website:"https://todoist.com",tags:["todoist","tasks","productivity","todo"],authMethod:"api-key"},{id:"mcp-obsidian",name:"Obsidian",npmPackage:"obsidian-mcp",description:"Obsidian vault - read, search, create notes, manage links",icon:"file-text",category:"writing",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","obsidian-mcp"],configFields:[{key:"OBSIDIAN_VAULT_PATH",label:"Vault Path",type:"text",placeholder:"/path/to/vault",required:!0}],tags:["obsidian","notes","markdown","knowledge-base"],authMethod:"none"},{id:"mcp-airtable",name:"Airtable",npmPackage:"airtable-mcp",description:"Airtable bases, tables, records - CRUD operations and views",icon:"table",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","airtable-mcp"],configFields:[{key:"AIRTABLE_TOKEN",label:"Personal Access Token",type:"password",placeholder:"pat...",required:!0}],website:"https://airtable.com",tags:["airtable","database","spreadsheet","records"]},{id:"mcp-hubspot",name:"HubSpot",npmPackage:"hubspot-mcp",description:"HubSpot CRM - contacts, companies, deals, tickets, engagement",icon:"hexagon",category:"data",author:"HubSpot",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","hubspot-mcp"],configFields:[{key:"HUBSPOT_ACCESS_TOKEN",label:"Private App Token",type:"password",placeholder:"pat-...",required:!0}],website:"https://hubspot.com",tags:["hubspot","crm","sales","contacts","deals"]},{id:"mcp-salesforce",name:"Salesforce",npmPackage:"salesforce-mcp",description:"Salesforce - SOQL queries, objects, records, reports",icon:"cloud",category:"data",author:"Salesforce",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","salesforce-mcp"],configFields:[{key:"SF_LOGIN_URL",label:"Login URL",type:"url",placeholder:"https://login.salesforce.com",required:!0},{key:"SF_USERNAME",label:"Username",type:"text",placeholder:"",required:!0},{key:"SF_PASSWORD",label:"Password + Security Token",type:"password",placeholder:"",required:!0}],tags:["salesforce","crm","soql","sales"],authMethod:"api-key"},{id:"mcp-stripe",name:"Stripe",npmPackage:"@stripe/mcp",description:"Stripe payments - customers, invoices, subscriptions, products",icon:"credit-card",category:"data",author:"Stripe",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@stripe/mcp"],configFields:[{key:"STRIPE_SECRET_KEY",label:"Secret Key",type:"password",placeholder:"sk_...",required:!0}],website:"https://stripe.com",tags:["stripe","payments","billing","subscriptions"]},{id:"mcp-shopify",name:"Shopify",npmPackage:"@shopify/dev-mcp",description:"Shopify store - products, orders, customers, inventory",icon:"shopping-bag",category:"data",author:"Shopify",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@shopify/dev-mcp"],configFields:[{key:"SHOPIFY_STORE_URL",label:"Store URL",type:"url",placeholder:"your-store.myshopify.com",required:!0},{key:"SHOPIFY_ACCESS_TOKEN",label:"Access Token",type:"password",placeholder:"shpat_...",required:!0}],tags:["shopify","ecommerce","products","orders"],authMethod:"api-key"},{id:"mcp-openai",name:"OpenAI",npmPackage:"openai-mcp",description:"OpenAI API - completions, embeddings, DALL-E, Whisper, assistants",icon:"cpu",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","openai-mcp"],configFields:[{key:"OPENAI_API_KEY",label:"API Key",type:"password",placeholder:"sk-...",required:!0}],tags:["openai","gpt","embeddings","dalle","whisper"],authMethod:"api-key"},{id:"mcp-anthropic",name:"Anthropic Claude",npmPackage:"anthropic-mcp",description:"Anthropic API - Claude completions, tool use, system prompts",icon:"cpu",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","anthropic-mcp"],configFields:[{key:"ANTHROPIC_API_KEY",label:"API Key",type:"password",placeholder:"sk-ant-...",required:!0}],tags:["anthropic","claude","ai","llm"],authMethod:"api-key"},{id:"mcp-replicate",name:"Replicate",npmPackage:"replicate-mcp",description:"Replicate - run open-source ML models via API",icon:"cpu",category:"coding",author:"Replicate",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","replicate-mcp"],configFields:[{key:"REPLICATE_API_TOKEN",label:"API Token",type:"password",placeholder:"r8_...",required:!0}],website:"https://replicate.com",tags:["replicate","ml","models","inference"]},{id:"mcp-huggingface",name:"Hugging Face",npmPackage:"huggingface-mcp",description:"Hugging Face - models, datasets, spaces, inference API",icon:"cpu",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","huggingface-mcp"],configFields:[{key:"HF_TOKEN",label:"Access Token",type:"password",placeholder:"hf_...",required:!0}],website:"https://huggingface.co",tags:["huggingface","models","datasets","ml"]},{id:"mcp-aws",name:"AWS",npmPackage:"aws-mcp",description:"AWS services - S3, Lambda, EC2, DynamoDB, CloudWatch",icon:"cloud",category:"coding",author:"AWS",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","aws-mcp"],configFields:[{key:"AWS_ACCESS_KEY_ID",label:"Access Key ID",type:"text",placeholder:"AKIA...",required:!0},{key:"AWS_SECRET_ACCESS_KEY",label:"Secret Access Key",type:"password",placeholder:"",required:!0},{key:"AWS_REGION",label:"Region",type:"text",placeholder:"us-east-1",required:!1}],tags:["aws","s3","lambda","ec2","cloud"],authMethod:"api-key"},{id:"mcp-gcp",name:"Google Cloud",npmPackage:"gcp-mcp",description:"Google Cloud Platform - BigQuery, Cloud Storage, Compute, Pub/Sub",icon:"cloud",category:"coding",author:"Google",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","gcp-mcp"],configFields:[{key:"GOOGLE_APPLICATION_CREDENTIALS",label:"Service Account Key Path",type:"text",placeholder:"/path/to/key.json",required:!0}],tags:["gcp","bigquery","cloud-storage","google-cloud"],authMethod:"none"},{id:"mcp-azure",name:"Azure",npmPackage:"azure-mcp",description:"Azure services - Blob Storage, Functions, Cosmos DB, Key Vault",icon:"cloud",category:"coding",author:"Microsoft",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","azure-mcp"],configFields:[{key:"AZURE_SUBSCRIPTION_ID",label:"Subscription ID",type:"text",placeholder:"",required:!0},{key:"AZURE_TENANT_ID",label:"Tenant ID",type:"text",placeholder:"",required:!0},{key:"AZURE_CLIENT_ID",label:"Client ID",type:"text",placeholder:"",required:!0},{key:"AZURE_CLIENT_SECRET",label:"Client Secret",type:"password",placeholder:"",required:!0}],tags:["azure","cloud","microsoft","blob-storage"],authMethod:"api-key"},{id:"mcp-n8n",name:"n8n",npmPackage:"n8n-mcp",description:"n8n workflow automation - trigger, manage, inspect workflows",icon:"workflow",category:"coding",author:"n8n",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","n8n-mcp"],configFields:[{key:"N8N_URL",label:"Instance URL",type:"url",placeholder:"http://localhost:5678",required:!0},{key:"N8N_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0}],website:"https://n8n.io",tags:["n8n","automation","workflow","integration"]},{id:"mcp-zapier",name:"Zapier",npmPackage:"zapier-mcp",description:"Zapier - trigger Zaps, manage connections, inspect runs",icon:"zap",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","zapier-mcp"],configFields:[{key:"ZAPIER_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0}],tags:["zapier","automation","workflow","zaps"],authMethod:"api-key"},{id:"mcp-make",name:"Make (Integromat)",npmPackage:"make-mcp",description:"Make.com - scenarios, modules, connections, execution history",icon:"workflow",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","make-mcp"],configFields:[{key:"MAKE_API_TOKEN",label:"API Token",type:"password",placeholder:"",required:!0}],tags:["make","integromat","automation","scenarios"],authMethod:"api-key"},{id:"mcp-datadog",name:"Datadog",npmPackage:"datadog-mcp",description:"Datadog - metrics, dashboards, monitors, logs, APM",icon:"bar-chart",category:"data",author:"Datadog",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","datadog-mcp"],configFields:[{key:"DD_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0},{key:"DD_APP_KEY",label:"App Key",type:"password",placeholder:"",required:!0}],website:"https://datadoghq.com",tags:["datadog","monitoring","metrics","apm"]},{id:"mcp-grafana",name:"Grafana",npmPackage:"grafana-mcp",description:"Grafana - dashboards, alerts, data sources, panels",icon:"bar-chart",category:"data",author:"Grafana",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","grafana-mcp"],configFields:[{key:"GRAFANA_URL",label:"Instance URL",type:"url",placeholder:"http://localhost:3000",required:!0},{key:"GRAFANA_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0}],tags:["grafana","dashboards","monitoring","visualization"],authMethod:"api-key"},{id:"mcp-posthog",name:"PostHog",npmPackage:"posthog-mcp",description:"PostHog product analytics - events, funnels, feature flags, surveys",icon:"bar-chart-3",category:"data",author:"PostHog",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","posthog-mcp"],configFields:[{key:"POSTHOG_HOST",label:"Host URL",type:"url",placeholder:"https://app.posthog.com",required:!0},{key:"POSTHOG_API_KEY",label:"Personal API Key",type:"password",placeholder:"phx_...",required:!0}],website:"https://posthog.com",tags:["posthog","analytics","events","product"]},{id:"mcp-mixpanel",name:"Mixpanel",npmPackage:"mixpanel-mcp",description:"Mixpanel - events, funnels, cohorts, user analytics",icon:"bar-chart",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","mixpanel-mcp"],configFields:[{key:"MIXPANEL_TOKEN",label:"Project Token",type:"password",placeholder:"",required:!0},{key:"MIXPANEL_API_SECRET",label:"API Secret",type:"password",placeholder:"",required:!1}],tags:["mixpanel","analytics","events","funnels"],authMethod:"api-key"},{id:"mcp-twitter",name:"Twitter / X",npmPackage:"twitter-mcp",description:"Twitter/X - tweets, search, timeline, DMs, analytics",icon:"message-circle",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","twitter-mcp"],configFields:[{key:"TWITTER_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0},{key:"TWITTER_API_SECRET",label:"API Secret",type:"password",placeholder:"",required:!0},{key:"TWITTER_ACCESS_TOKEN",label:"Access Token",type:"password",placeholder:"",required:!0},{key:"TWITTER_ACCESS_SECRET",label:"Access Token Secret",type:"password",placeholder:"",required:!0}],tags:["twitter","x","social","tweets"],authMethod:"api-key"},{id:"mcp-youtube",name:"YouTube",npmPackage:"youtube-mcp",description:"YouTube - search videos, get transcripts, channel analytics",icon:"play",category:"research",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","youtube-mcp"],configFields:[{key:"YOUTUBE_API_KEY",label:"API Key",type:"password",placeholder:"AIza...",required:!0}],tags:["youtube","video","transcripts","search"],authMethod:"api-key"},{id:"mcp-spotify",name:"Spotify",npmPackage:"spotify-mcp",description:"Spotify - search tracks, manage playlists, playback control",icon:"music",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","spotify-mcp"],configFields:[{key:"SPOTIFY_CLIENT_ID",label:"Client ID",type:"text",placeholder:"",required:!0},{key:"SPOTIFY_CLIENT_SECRET",label:"Client Secret",type:"password",placeholder:"",required:!0}],tags:["spotify","music","playlists","audio"],authMethod:"api-key"},{id:"mcp-figma",name:"Figma",npmPackage:"figma-mcp",description:"Figma - read files, components, styles, export assets",icon:"palette",category:"design",author:"Figma",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","figma-mcp"],configFields:[{key:"FIGMA_ACCESS_TOKEN",label:"Personal Access Token",type:"password",placeholder:"figd_...",required:!0}],website:"https://figma.com",tags:["figma","design","ui","components"]},{id:"mcp-21st-dev",name:"21st.dev Magic",npmPackage:"@21st-dev/magic-mcp",description:"Create crafted UI components inspired by best design engineers",icon:"sparkles",category:"design",author:"21st.dev",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@21st-dev/magic-mcp"],configFields:[{key:"TWENTYFIRST_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0}],website:"https://21st.dev",tags:["ui","components","design","magic"]},{id:"mcp-cloudinary",name:"Cloudinary",npmPackage:"cloudinary-mcp",description:"Cloudinary - upload, transform, optimize images and videos",icon:"image",category:"design",author:"Cloudinary",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","cloudinary-mcp"],configFields:[{key:"CLOUDINARY_URL",label:"Cloudinary URL",type:"password",placeholder:"cloudinary://api_key:api_secret@cloud_name",required:!0}],tags:["cloudinary","images","media","cdn","transform"],authMethod:"api-key"},{id:"mcp-vault",name:"HashiCorp Vault",npmPackage:"vault-mcp",description:"HashiCorp Vault - secrets management, dynamic credentials",icon:"lock",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","vault-mcp"],configFields:[{key:"VAULT_ADDR",label:"Vault Address",type:"url",placeholder:"http://localhost:8200",required:!0},{key:"VAULT_TOKEN",label:"Token",type:"password",placeholder:"hvs.",required:!0}],tags:["vault","secrets","security","hashicorp"],authMethod:"api-key"},{id:"mcp-1password",name:"1Password",npmPackage:"1password-mcp",description:"1Password - read secrets, vaults, items securely",icon:"lock",category:"data",author:"1Password",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","1password-mcp"],configFields:[{key:"OP_SERVICE_ACCOUNT_TOKEN",label:"Service Account Token",type:"password",placeholder:"ops_...",required:!0}],tags:["1password","secrets","passwords","security"],authMethod:"api-key"},{id:"mcp-snowflake",name:"Snowflake",npmPackage:"snowflake-mcp",description:"Snowflake data warehouse - queries, tables, schemas, warehouses",icon:"database",category:"data",author:"Snowflake",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","snowflake-mcp"],configFields:[{key:"SNOWFLAKE_ACCOUNT",label:"Account",type:"text",placeholder:"org-account",required:!0},{key:"SNOWFLAKE_USER",label:"Username",type:"text",placeholder:"",required:!0},{key:"SNOWFLAKE_PASSWORD",label:"Password",type:"password",placeholder:"",required:!0}],tags:["snowflake","data-warehouse","sql","analytics"],authMethod:"api-key"},{id:"mcp-bigquery",name:"BigQuery",npmPackage:"bigquery-mcp",description:"Google BigQuery - run SQL queries, manage datasets and tables",icon:"database",category:"data",author:"Google",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","bigquery-mcp"],configFields:[{key:"GOOGLE_APPLICATION_CREDENTIALS",label:"Service Account Key Path",type:"text",placeholder:"/path/to/key.json",required:!0},{key:"BIGQUERY_PROJECT_ID",label:"Project ID",type:"text",placeholder:"my-project",required:!0}],tags:["bigquery","sql","analytics","google-cloud"],authMethod:"none"},{id:"mcp-elasticsearch",name:"Elasticsearch",npmPackage:"elasticsearch-mcp",description:"Elasticsearch - search, index, aggregate, analyze data",icon:"search",category:"data",author:"Elastic",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","elasticsearch-mcp"],configFields:[{key:"ELASTICSEARCH_URL",label:"URL",type:"url",placeholder:"http://localhost:9200",required:!0},{key:"ELASTICSEARCH_API_KEY",label:"API Key",type:"password",placeholder:"",required:!1}],tags:["elasticsearch","search","indexing","analytics"],authMethod:"api-key"},{id:"mcp-rabbitmq",name:"RabbitMQ",npmPackage:"rabbitmq-mcp",description:"RabbitMQ - queues, exchanges, publish/consume messages",icon:"send",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","rabbitmq-mcp"],configFields:[{key:"RABBITMQ_URL",label:"Connection URL",type:"password",placeholder:"amqp://user:pass@localhost:5672",required:!0}],tags:["rabbitmq","queue","messaging","amqp"],authMethod:"api-key"},{id:"mcp-kafka",name:"Kafka",npmPackage:"kafka-mcp",description:"Apache Kafka - topics, produce/consume, consumer groups",icon:"send",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","kafka-mcp"],configFields:[{key:"KAFKA_BROKERS",label:"Brokers (comma-separated)",type:"text",placeholder:"localhost:9092",required:!0}],tags:["kafka","streaming","events","queue"],authMethod:"none"},{id:"mcp-plaid",name:"Plaid",npmPackage:"plaid-mcp",description:"Plaid financial data - bank accounts, transactions, balances",icon:"credit-card",category:"data",author:"Plaid",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","plaid-mcp"],configFields:[{key:"PLAID_CLIENT_ID",label:"Client ID",type:"text",placeholder:"",required:!0},{key:"PLAID_SECRET",label:"Secret",type:"password",placeholder:"",required:!0}],website:"https://plaid.com",tags:["plaid","banking","finance","transactions"]},{id:"mcp-quickbooks",name:"QuickBooks",npmPackage:"quickbooks-mcp",description:"QuickBooks - invoices, expenses, customers, reports",icon:"receipt",category:"data",author:"Intuit",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","quickbooks-mcp"],configFields:[{key:"QUICKBOOKS_CLIENT_ID",label:"Client ID",type:"text",placeholder:"",required:!0},{key:"QUICKBOOKS_CLIENT_SECRET",label:"Client Secret",type:"password",placeholder:"",required:!0}],tags:["quickbooks","accounting","invoices","finance"],authMethod:"api-key"},{id:"mcp-xero",name:"Xero",npmPackage:"xero-mcp",description:"Xero accounting - invoices, contacts, bank transactions, reports",icon:"receipt",category:"data",author:"Xero",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","xero-mcp"],configFields:[{key:"XERO_CLIENT_ID",label:"Client ID",type:"text",placeholder:"",required:!0},{key:"XERO_CLIENT_SECRET",label:"Client Secret",type:"password",placeholder:"",required:!0}],tags:["xero","accounting","invoices","finance"],authMethod:"api-key"},{id:"mcp-wordpress",name:"WordPress",npmPackage:"wordpress-mcp",description:"WordPress - posts, pages, media, comments via REST API",icon:"file-text",category:"writing",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","wordpress-mcp"],configFields:[{key:"WORDPRESS_URL",label:"Site URL",type:"url",placeholder:"https://yoursite.com",required:!0},{key:"WORDPRESS_USER",label:"Username",type:"text",placeholder:"",required:!0},{key:"WORDPRESS_APP_PASSWORD",label:"Application Password",type:"password",placeholder:"",required:!0}],tags:["wordpress","cms","blog","content"],authMethod:"api-key"},{id:"mcp-contentful",name:"Contentful",npmPackage:"contentful-mcp",description:"Contentful - content types, entries, assets, spaces",icon:"file-text",category:"writing",author:"Contentful",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","contentful-mcp"],configFields:[{key:"CONTENTFUL_SPACE_ID",label:"Space ID",type:"text",placeholder:"",required:!0},{key:"CONTENTFUL_ACCESS_TOKEN",label:"Access Token",type:"password",placeholder:"",required:!0}],tags:["contentful","cms","headless","content"],authMethod:"api-key"},{id:"mcp-sanity",name:"Sanity",npmPackage:"sanity-mcp",description:"Sanity CMS - documents, GROQ queries, assets, mutations",icon:"file-text",category:"writing",author:"Sanity",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","sanity-mcp"],configFields:[{key:"SANITY_PROJECT_ID",label:"Project ID",type:"text",placeholder:"",required:!0},{key:"SANITY_TOKEN",label:"API Token",type:"password",placeholder:"",required:!0}],tags:["sanity","cms","headless","groq"],authMethod:"api-key"},{id:"mcp-weather",name:"Weather",npmPackage:"weather-mcp",description:"Weather data - current conditions, forecasts, historical data",icon:"cloud",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","weather-mcp"],configFields:[{key:"OPENWEATHER_API_KEY",label:"OpenWeatherMap API Key",type:"password",placeholder:"",required:!0}],tags:["weather","forecast","climate","temperature"],authMethod:"api-key"},{id:"mcp-wolfram",name:"Wolfram Alpha",npmPackage:"wolfram-mcp",description:"Wolfram Alpha computational intelligence - math, science, data",icon:"calculator",category:"research",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","wolfram-mcp"],configFields:[{key:"WOLFRAM_APP_ID",label:"App ID",type:"password",placeholder:"",required:!0}],tags:["wolfram","math","science","computation"],authMethod:"api-key"},{id:"mcp-whois",name:"WHOIS",npmPackage:"whois-mcp",description:"Domain WHOIS lookup - registration, expiry, nameservers",icon:"globe",category:"research",author:"Community",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","whois-mcp"],configFields:[],tags:["whois","domain","dns","lookup"],authMethod:"none"},{id:"mcp-mermaid",name:"Mermaid",npmPackage:"mermaid-mcp",description:"Generate Mermaid diagrams - flowcharts, sequence, gantt, class",icon:"workflow",category:"design",author:"Community",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","mermaid-mcp"],configFields:[],tags:["mermaid","diagrams","flowchart","visualization"],authMethod:"none"},{id:"mcp-screenshot",name:"Screenshot",npmPackage:"screenshot-mcp",description:"Take screenshots of websites - full page, element, viewport",icon:"camera",category:"research",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","screenshot-mcp"],configFields:[],tags:["screenshot","capture","web","image"],authMethod:"none"},{id:"mcp-pdf",name:"PDF Tools",npmPackage:"pdf-mcp",description:"Extract text, tables, and images from PDF documents",icon:"file",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","pdf-mcp"],configFields:[],tags:["pdf","extract","text","documents"],authMethod:"none"},{id:"mcp-csv",name:"CSV Tools",npmPackage:"csv-mcp",description:"Parse, query, transform, and generate CSV/TSV files",icon:"table",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","csv-mcp"],configFields:[],tags:["csv","tsv","data","tables","transform"],authMethod:"none"},{id:"mcp-s3",name:"S3 / Object Storage",npmPackage:"s3-mcp",description:"S3-compatible storage - list, read, write, delete objects",icon:"hard-drive",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","s3-mcp"],configFields:[{key:"S3_ENDPOINT",label:"Endpoint",type:"url",placeholder:"https://s3.amazonaws.com",required:!1},{key:"S3_ACCESS_KEY",label:"Access Key",type:"text",placeholder:"",required:!0},{key:"S3_SECRET_KEY",label:"Secret Key",type:"password",placeholder:"",required:!0},{key:"S3_BUCKET",label:"Bucket Name",type:"text",placeholder:"my-bucket",required:!0}],tags:["s3","storage","objects","bucket"],authMethod:"api-key"},{id:"mcp-ssh",name:"SSH",npmPackage:"ssh-mcp",description:"Execute commands on remote servers via SSH",icon:"terminal",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","ssh-mcp"],configFields:[{key:"SSH_HOST",label:"Host",type:"text",placeholder:"192.168.1.100",required:!0},{key:"SSH_USER",label:"Username",type:"text",placeholder:"root",required:!0},{key:"SSH_KEY_PATH",label:"Private Key Path",type:"text",placeholder:"~/.ssh/id_rsa",required:!1}],tags:["ssh","remote","terminal","server"],authMethod:"none"},{id:"mcp-terraform",name:"Terraform",npmPackage:"terraform-mcp",description:"Terraform - plan, apply, state, modules, resources",icon:"server",category:"coding",author:"HashiCorp",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","terraform-mcp"],configFields:[],tags:["terraform","iac","infrastructure","devops"],authMethod:"none"},{id:"mcp-prometheus",name:"Prometheus",npmPackage:"prometheus-mcp",description:"Prometheus - PromQL queries, metrics, alerts, targets",icon:"bar-chart",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","prometheus-mcp"],configFields:[{key:"PROMETHEUS_URL",label:"URL",type:"url",placeholder:"http://localhost:9090",required:!0}],tags:["prometheus","metrics","monitoring","promql"],authMethod:"none"},{id:"mcp-intercom",name:"Intercom",npmPackage:"intercom-mcp",description:"Intercom - conversations, contacts, companies, articles",icon:"message-circle",category:"data",author:"Intercom",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","intercom-mcp"],configFields:[{key:"INTERCOM_TOKEN",label:"Access Token",type:"password",placeholder:"",required:!0}],tags:["intercom","support","chat","crm"],authMethod:"api-key"},{id:"mcp-zendesk",name:"Zendesk",npmPackage:"zendesk-mcp",description:"Zendesk - tickets, users, organizations, search",icon:"headphones",category:"data",author:"Zendesk",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","zendesk-mcp"],configFields:[{key:"ZENDESK_SUBDOMAIN",label:"Subdomain",type:"text",placeholder:"your-org",required:!0},{key:"ZENDESK_EMAIL",label:"Email",type:"text",placeholder:"agent@company.com",required:!0},{key:"ZENDESK_TOKEN",label:"API Token",type:"password",placeholder:"",required:!0}],tags:["zendesk","support","tickets","helpdesk"],authMethod:"api-key"},{id:"mcp-freshdesk",name:"Freshdesk",npmPackage:"freshdesk-mcp",description:"Freshdesk - tickets, contacts, groups, canned responses",icon:"headphones",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","freshdesk-mcp"],configFields:[{key:"FRESHDESK_DOMAIN",label:"Domain",type:"text",placeholder:"your-org.freshdesk.com",required:!0},{key:"FRESHDESK_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0}],tags:["freshdesk","support","tickets","helpdesk"],authMethod:"api-key"},{id:"mcp-clickup",name:"ClickUp",npmPackage:"clickup-mcp",description:"ClickUp - tasks, lists, spaces, goals, docs, time tracking",icon:"check-square",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","clickup-mcp"],configFields:[{key:"CLICKUP_TOKEN",label:"Personal API Token",type:"password",placeholder:"pk_...",required:!0}],tags:["clickup","tasks","project-management","productivity"],authMethod:"api-key"},{id:"mcp-trello",name:"Trello",npmPackage:"trello-mcp",description:"Trello - boards, lists, cards, checklists, members",icon:"layout",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","trello-mcp"],configFields:[{key:"TRELLO_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0},{key:"TRELLO_TOKEN",label:"Token",type:"password",placeholder:"",required:!0}],tags:["trello","boards","kanban","cards"],authMethod:"api-key"},{id:"mcp-monday",name:"Monday.com",npmPackage:"monday-mcp",description:"Monday.com - boards, items, columns, updates, automations",icon:"layout",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","monday-mcp"],configFields:[{key:"MONDAY_API_TOKEN",label:"API Token",type:"password",placeholder:"",required:!0}],tags:["monday","boards","project-management","workflow"],authMethod:"api-key"},{id:"mcp-github-actions",name:"GitHub Actions",npmPackage:"github-actions-mcp",description:"GitHub Actions - workflows, runs, jobs, artifacts, secrets",icon:"play-circle",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","github-actions-mcp"],configFields:[{key:"GITHUB_TOKEN",label:"Personal Access Token",type:"password",placeholder:"ghp_...",required:!0}],tags:["github-actions","ci-cd","workflows","automation"],authMethod:"api-key"},{id:"mcp-circleci",name:"CircleCI",npmPackage:"circleci-mcp",description:"CircleCI - pipelines, jobs, workflows, orbs, insights",icon:"play-circle",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","circleci-mcp"],configFields:[{key:"CIRCLECI_TOKEN",label:"Personal API Token",type:"password",placeholder:"",required:!0}],tags:["circleci","ci-cd","pipelines","automation"],authMethod:"api-key"},{id:"mcp-upstash",name:"Upstash",npmPackage:"@upstash/mcp-server",description:"Upstash - serverless Redis and Kafka, QStash message queue",icon:"database",category:"data",author:"Upstash",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@upstash/mcp-server"],configFields:[{key:"UPSTASH_REDIS_REST_URL",label:"Redis REST URL",type:"url",placeholder:"",required:!0},{key:"UPSTASH_REDIS_REST_TOKEN",label:"Redis REST Token",type:"password",placeholder:"",required:!0}],website:"https://upstash.com",tags:["upstash","redis","kafka","serverless"]},{id:"mcp-sendgrid",name:"SendGrid",npmPackage:"sendgrid-mcp",description:"SendGrid - send transactional emails, manage templates, contacts",icon:"mail",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","sendgrid-mcp"],configFields:[{key:"SENDGRID_API_KEY",label:"API Key",type:"password",placeholder:"SG.",required:!0}],tags:["sendgrid","email","transactional","templates"],authMethod:"api-key"},{id:"mcp-resend",name:"Resend",npmPackage:"resend-mcp",description:"Resend - send emails with React Email templates",icon:"mail",category:"data",author:"Resend",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","resend-mcp"],configFields:[{key:"RESEND_API_KEY",label:"API Key",type:"password",placeholder:"re_...",required:!0}],website:"https://resend.com",tags:["resend","email","react-email","transactional"]},{id:"mcp-openapi",name:"OpenAPI",npmPackage:"openapi-mcp",description:"Load any OpenAPI/Swagger spec and call its endpoints as MCP tools",icon:"globe",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","openapi-mcp"],configFields:[{key:"OPENAPI_SPEC_URL",label:"Spec URL",type:"url",placeholder:"https://api.example.com/openapi.json",required:!0}],tags:["openapi","swagger","rest","api"],authMethod:"none"},{id:"mcp-graphql",name:"GraphQL",npmPackage:"graphql-mcp",description:"Query any GraphQL endpoint - introspection, queries, mutations",icon:"globe",category:"coding",author:"Community",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","graphql-mcp"],configFields:[{key:"GRAPHQL_URL",label:"Endpoint URL",type:"url",placeholder:"https://api.example.com/graphql",required:!0},{key:"GRAPHQL_AUTH_HEADER",label:"Auth Header Value",type:"password",placeholder:"Bearer ...",required:!1}],tags:["graphql","api","query","mutation"],authMethod:"api-key"},{id:"mcp-coda",name:"Coda",npmPackage:"coda-mcp",description:"Coda docs - tables, rows, formulas, pages, automations",icon:"file-text",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","coda-mcp"],configFields:[{key:"CODA_API_TOKEN",label:"API Token",type:"password",placeholder:"",required:!0}],tags:["coda","docs","tables","automation"],authMethod:"api-key"},{id:"mcp-segment",name:"Segment",npmPackage:"segment-mcp",description:"Segment - track events, identify users, manage sources & destinations",icon:"bar-chart",category:"data",author:"Twilio",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","segment-mcp"],configFields:[{key:"SEGMENT_WRITE_KEY",label:"Write Key",type:"password",placeholder:"",required:!0}],tags:["segment","analytics","events","cdp"],authMethod:"api-key"},{id:"mcp-amplitude",name:"Amplitude",npmPackage:"amplitude-mcp",description:"Amplitude - events, user analytics, cohorts, retention",icon:"bar-chart",category:"data",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","amplitude-mcp"],configFields:[{key:"AMPLITUDE_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0},{key:"AMPLITUDE_SECRET_KEY",label:"Secret Key",type:"password",placeholder:"",required:!0}],tags:["amplitude","analytics","events","product"],authMethod:"api-key"},{id:"mcp-context7",name:"Context7",npmPackage:"@upstash/context7-mcp",description:"Pull up-to-date library documentation and code examples on demand",icon:"book-open",category:"domain",author:"Upstash",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@upstash/context7-mcp"],configFields:[],tags:["docs","documentation","libraries","context"],authMethod:"none"},{id:"mcp-aws-kb-retrieval",name:"AWS KB Retrieval",npmPackage:"@modelcontextprotocol/server-aws-kb-retrieval",description:"Retrieve from AWS Bedrock Knowledge Bases using RAG",icon:"database",category:"domain",author:"MCP Official",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-aws-kb-retrieval"],configFields:[{key:"AWS_ACCESS_KEY_ID",label:"Access Key ID",type:"text",placeholder:"AKIA...",required:!0},{key:"AWS_SECRET_ACCESS_KEY",label:"Secret Access Key",type:"password",placeholder:"",required:!0},{key:"AWS_REGION",label:"Region",type:"text",placeholder:"us-east-1",required:!0}],repo:"https://github.com/modelcontextprotocol/servers",tags:["aws","bedrock","rag","knowledge-base"]},{id:"mcp-everart",name:"EverArt",npmPackage:"@modelcontextprotocol/server-everart",description:"AI image generation with multiple models via EverArt platform",icon:"image",category:"design",author:"MCP Official",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@modelcontextprotocol/server-everart"],configFields:[{key:"EVERART_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0}],repo:"https://github.com/modelcontextprotocol/servers",tags:["image","generation","ai-art","design"]},{id:"mcp-greptile",name:"Greptile",npmPackage:"@greptile/mcp-server",description:"AI-powered codebase search and understanding",icon:"search",category:"coding",author:"Greptile",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@greptile/mcp-server"],configFields:[{key:"GREPTILE_API_KEY",label:"API Key",type:"password",placeholder:"",required:!0}],website:"https://greptile.com",tags:["code-search","codebase","ai","understanding"]},{id:"mcp-e2b",name:"E2B Code Interpreter",npmPackage:"@e2b/mcp-server",description:"Sandboxed code execution - run Python, JS, and more in secure cloud sandbox",icon:"terminal",category:"coding",author:"E2B",transport:"stdio",runtimes:["claude","amp","codex"],command:"npx",defaultArgs:["-y","@e2b/mcp-server"],configFields:[{key:"E2B_API_KEY",label:"API Key",type:"password",placeholder:"e2b_...",required:!0}],website:"https://e2b.dev",tags:["sandbox","code-execution","interpreter","python"]},{id:"mcp-hubspot-dev",name:"HubSpot Developer",npmPackage:"@hubspot/mcp-server",description:"HubSpot developer tools - CMS, projects, functions, deploy",icon:"hexagon",category:"domain",author:"HubSpot",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","@hubspot/mcp-server"],configFields:[{key:"HUBSPOT_PORTAL_ID",label:"Portal ID",type:"text",placeholder:"",required:!0}],website:"https://developers.hubspot.com",tags:["hubspot","cms","developer","deploy"]},{id:"mcp-medical-ref",name:"Medical Reference",npmPackage:"medical-ref-mcp",description:"Medical terminology, drug interactions, clinical guidelines lookup",icon:"heart",category:"domain",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","medical-ref-mcp"],configFields:[],tags:["medical","healthcare","drugs","clinical"],authMethod:"none"},{id:"mcp-legal",name:"Legal Research",npmPackage:"legal-mcp",description:"Legal document search - case law, statutes, regulations",icon:"scale",category:"domain",author:"Community",transport:"stdio",runtimes:["claude","amp"],command:"npx",defaultArgs:["-y","legal-mcp"],configFields:[],tags:["legal","law","case-law","regulations"],authMethod:"none"}],vu=[{id:"web-search",name:"Web Search",description:"Search the web using Brave Search API for real-time information retrieval",icon:"search",category:"research",author:"Anthropic",installs:12400,runtimes:["claude","amp","codex"],installCmd:"npx modular-skills install web-search",installed:!1},{id:"github",name:"GitHub",description:"GitHub operations — repos, issues, PRs, and code search via gh CLI",icon:"git-branch",category:"coding",author:"Anthropic",installs:9800,runtimes:["claude","amp","codex"],installCmd:"npx modular-skills install github",installed:!1},{id:"weather",name:"Weather",description:"Weather data from wttr.in and Open-Meteo for forecasts and conditions",icon:"cloud",category:"data",author:"Community",installs:4200,runtimes:["claude","amp"],installCmd:"npx modular-skills install weather",installed:!1},{id:"coding-agent",name:"Coding Agent",description:"Delegate complex coding tasks to Claude Code or Codex sub-agents",icon:"code",category:"coding",author:"Anthropic",installs:18200,runtimes:["claude","amp","codex"],installCmd:"npx modular-skills install coding-agent",installed:!0,installedTarget:"claude",installedScope:"project"},{id:"openai-whisper",name:"OpenAI Whisper",description:"Transcribe audio files to text using OpenAI Whisper API",icon:"mic",category:"data",author:"OpenAI",installs:6700,runtimes:["claude","amp","codex","openai"],installCmd:"npx modular-skills install openai-whisper",installed:!1},{id:"openai-image-gen",name:"Image Generation",description:"Generate images from text prompts using DALL-E or Stable Diffusion",icon:"image",category:"design",author:"OpenAI",installs:8900,runtimes:["claude","amp","openai"],installCmd:"npx modular-skills install openai-image-gen",installed:!1},{id:"notion-api",name:"Notion API",description:"Full Notion integration — read, create, update pages and databases",icon:"book-open",category:"writing",author:"Notion",installs:7300,runtimes:["claude","amp","codex"],installCmd:"npx modular-skills install notion-api",installed:!1},{id:"hubspot-integration",name:"HubSpot CRM",description:"HubSpot CRM operations — contacts, companies, deals, and pipelines",icon:"hexagon",category:"data",author:"HubSpot",installs:3100,runtimes:["claude","amp"],installCmd:"npx modular-skills install hubspot-integration",installed:!1},{id:"n8n-workflow-patterns",name:"n8n Workflows",description:"Build and manage n8n automation workflows with proven patterns",icon:"workflow",category:"coding",author:"n8n",installs:2800,runtimes:["claude","amp"],installCmd:"npx modular-skills install n8n-workflow-patterns",installed:!1},{id:"maritime-expert",name:"Maritime Expert",description:"Maritime domain expertise — vessel tracking, port ops, cargo management",icon:"anchor",category:"domain",author:"Nimbalyst",installs:1200,runtimes:["claude","amp"],installCmd:"npx modular-skills install maritime-expert",installed:!0,installedTarget:"claude",installedScope:"project"},{id:"feedback-analyzer",name:"Feedback Analyzer",description:"Extract insights from customer feedback — patterns, sentiment, priorities",icon:"bar-chart-3",category:"research",author:"Nimbalyst",installs:2400,runtimes:["claude","amp","codex"],installCmd:"npx modular-skills install feedback-analyzer",installed:!0,installedTarget:"all",installedScope:"global"},{id:"roadmap-builder",name:"Roadmap Builder",description:"Create strategic product roadmaps with OKRs and stakeholder alignment",icon:"map",category:"writing",author:"Community",installs:1800,runtimes:["claude","amp"],installCmd:"npx modular-skills install roadmap-builder",installed:!1},{id:"presentation-generator",name:"Presentation Gen",description:"Generate interactive HTML presentations with animations and styling",icon:"presentation",category:"design",author:"Community",installs:3600,runtimes:["claude","amp","codex"],installCmd:"npx modular-skills install presentation-generator",installed:!0,installedTarget:"claude",installedScope:"project"},{id:"clean-code",name:"Clean Code",description:"Pragmatic coding standards — concise, direct, no over-engineering",icon:"sparkles",category:"coding",author:"Community",installs:5400,runtimes:["claude","amp","codex"],installCmd:"npx modular-skills install clean-code",installed:!1},{id:"html-style",name:"HTML Style",description:"Apply opinionated styling to unstyled HTML with a cohesive design system",icon:"palette",category:"design",author:"Community",installs:2100,runtimes:["claude","amp"],installCmd:"npx modular-skills install html-style",installed:!1},{id:"find-skills",name:"Find Skills",description:"Meta-skill that discovers and recommends other skills for your task",icon:"compass",category:"research",author:"Anthropic",installs:4800,runtimes:["claude","amp","codex"],installCmd:"npx modular-skills install find-skills",installed:!1},{id:"fluidsim",name:"FluidSim",description:"Computational fluid dynamics — Navier-Stokes, shallow water, turbulence",icon:"waves",category:"domain",author:"SciPy",installs:800,runtimes:["claude"],installCmd:"npx modular-skills install fluidsim",installed:!1},{id:"threejs-fundamentals",name:"Three.js",description:"Three.js 3D graphics — scene setup, cameras, lighting, animation",icon:"box",category:"coding",author:"Community",installs:3200,runtimes:["claude","amp","codex"],installCmd:"npx modular-skills install threejs-fundamentals",installed:!1},{id:"web-design-guidelines",name:"Web Design Review",description:"Review UI code against Web Interface Guidelines for best practices",icon:"layout",category:"design",author:"Community",installs:2900,runtimes:["claude","amp"],installCmd:"npx modular-skills install web-design-guidelines",installed:!1},{id:"skill-creator",name:"Skill Creator",description:"Build and package new skills with proper manifests and adapters",icon:"wrench",category:"coding",author:"Anthropic",installs:1500,runtimes:["claude","amp","codex"],installCmd:"npx modular-skills install skill-creator",installed:!1},{id:"vercel-react",name:"Vercel React",description:"React and Next.js performance optimization patterns from Vercel Engineering",icon:"triangle",category:"coding",author:"Vercel",installs:7100,runtimes:["claude","amp","codex"],installCmd:"npx modular-skills install vercel-react",installed:!1},{id:"claude-platform",name:"Claude Platform",description:"Build apps with Claude API — SDK patterns, tool use, streaming",icon:"cpu",category:"coding",author:"Anthropic",installs:11200,runtimes:["claude"],installCmd:"npx modular-skills install claude-platform",installed:!1}];function vM(e){return{id:e.id,name:e.name,description:e.description,icon:e.icon,category:e.category,author:e.author,transport:e.transport,runtimes:e.runtimes,installCmd:`npx -y ${e.npmPackage}`,command:e.command,defaultArgs:e.defaultArgs,configFields:e.configFields,installed:!1,configured:!1}}const wM=ra.map(vM),SM=[{id:"preset-fullstack-dev",name:"Full-Stack Developer",description:"Complete dev setup with GitHub, filesystem, coding agent, and clean code standards",icon:"code",skills:["coding-agent","clean-code","github","threejs-fundamentals"],mcpServers:["mcp-github","mcp-filesystem","mcp-linear"],canvasDescription:"Knowledge → Agent (Claude Opus) → Code Output | Skills: Coding Agent, Clean Code, GitHub | MCP: GitHub, Filesystem, Linear"},{id:"preset-research-analyst",name:"Research Analyst",description:"Web search, scraping, and analysis tools for deep research",icon:"search",skills:["web-search","feedback-analyzer","find-skills"],mcpServers:["mcp-brave-search","mcp-firecrawl","mcp-puppeteer"],canvasDescription:"Web Sources → Agent (Claude Opus) → Markdown Report | Skills: Web Search, Feedback Analyzer | MCP: Brave, Firecrawl, Puppeteer"},{id:"preset-content-writer",name:"Content Writer",description:"Writing-focused setup with Notion, presentation gen, and design review",icon:"pen-tool",skills:["presentation-generator","html-style","web-design-guidelines","notion-api"],mcpServers:["mcp-notion","mcp-slack"],canvasDescription:"Notion Pages → Agent (Claude Sonnet) → HTML/Markdown | Skills: Presentation Gen, HTML Style | MCP: Notion, Slack"},{id:"preset-data-pipeline",name:"Data Pipeline",description:"Database, API, and CRM integrations for data workflows",icon:"database",skills:["hubspot-integration","n8n-workflow-patterns","weather"],mcpServers:["mcp-postgres","mcp-supabase","mcp-hubspot"],canvasDescription:"CRM + DB → Agent (Claude Sonnet) → JSON/CSV | Skills: HubSpot, n8n Workflows | MCP: PostgreSQL, Supabase, HubSpot"},{id:"preset-maritime-ops",name:"Maritime Operations",description:"Maritime domain with vessel tracking, weather data, and fleet management",icon:"anchor",skills:["maritime-expert","weather","feedback-analyzer"],mcpServers:["mcp-slack","mcp-notion"],canvasDescription:"Maritime Knowledge → Agent (Claude Opus) → Reports | Skills: Maritime Expert, Weather | MCP: Slack, Notion"},{id:"preset-design-system",name:"Design System",description:"Design-focused setup with visual review, styling, and presentation tools",icon:"palette",skills:["web-design-guidelines","html-style","presentation-generator","openai-image-gen"],mcpServers:["mcp-puppeteer"],canvasDescription:"Design Specs → Agent (Claude Sonnet) → HTML/CSS | Skills: Web Design, HTML Style, Image Gen | MCP: Puppeteer"},{id:"preset-senior-pm",name:"Senior PM",description:"Discovery synthesis specialist — turns messy brainstorms into prioritized product strategy with RICE framework",icon:"user",skills:["feedback-analyzer","roadmap-builder"],mcpServers:["mcp-notion","mcp-slack"],canvasDescription:"Knowledge + Signals → Agent (Claude Opus) → Synthesis Report | Skills: Feedback Analyzer, Roadmap Builder | MCP: Notion, Slack"},{id:"preset-feedback-manager",name:"Feedback Manager",description:"Feedback lifecycle specialist — organizes, challenges, and maintains the single source of truth for user feedback",icon:"inbox",skills:["feedback-analyzer"],mcpServers:["mcp-gmail","mcp-notion","mcp-slack"],canvasDescription:"Gmail + Signals → Agent (Claude Sonnet) → Feedback Reports | Skills: Feedback Analyzer | MCP: Gmail, Notion, Slack"},{id:"preset-competitor-scraper",name:"Competitor Feature Scraper",description:"Scrapes competitor websites to extract product features, claims, and screenshots for competitive comparison",icon:"search",skills:["web-search"],mcpServers:["mcp-firecrawl"],canvasDescription:"Competitor Knowledge → Agent (Claude Sonnet) → Feature Profiles | Skills: Web Search | MCP: Firecrawl"}],wu={claude:{label:"Claude",color:"#FE5000"},amp:{label:"Amp",color:"#8B5CF6"},codex:{label:"Codex",color:"#10B981"},openai:{label:"OpenAI",color:"#74AA9C"},gemini:{label:"Gemini",color:"#4285F4"}},xb=[{id:"all",label:"All"},{id:"research",label:"Research"},{id:"coding",label:"Coding"},{id:"data",label:"Data"},{id:"design",label:"Design"},{id:"writing",label:"Writing"},{id:"domain",label:"Domain"}],ze="/api";async function Yk(e,t){const n=new TextDecoder;let r="";for(;;){const{done:i,value:s}=await e.read();if(i)break;r+=n.decode(s,{stream:!0});const l=r.split(`
|
|
10
|
+
`);r=l.pop()??"";for(const u of l){const f=u.trim();if(!f||!f.startsWith("data: "))continue;const m=f.slice(6);if(m==="[DONE]"||t(m))return}}}function Wk(e){const{prompt:t,model:n,systemPrompt:r,maxTurns:i,onChunk:s,onDone:l,onError:u}=e,f=new AbortController;return fetch(`${ze}/agent-sdk/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:t,model:n,systemPrompt:r,maxTurns:i}),signal:f.signal}).then(async m=>{if(!m.ok){const g=await m.text().catch(()=>"");throw new Error(`Agent SDK error ${m.status}: ${g||m.statusText}`)}const h=m.body?.getReader();if(!h)throw new Error("No response body");await Yk(h,g=>{try{const b=JSON.parse(g);if(b.type==="text"&&b.content)s(b.content);else if(b.type==="error")return u(new Error(b.message)),!0}catch{}}),l()}).catch(m=>{m instanceof DOMException&&m.name==="AbortError"||u(m instanceof Error?m:new Error(String(m)))}),f}function Xk(e){const{providerId:t,model:n,messages:r,temperature:i=.7,maxTokens:s=4096,onChunk:l,onDone:u,onError:f}=e,m=new AbortController;return fetch(`${ze}/llm/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,model:n,messages:r,temperature:i,max_tokens:s}),signal:m.signal}).then(async h=>{if(!h.ok){const b=await h.text().catch(()=>"");throw new Error(`LLM error ${h.status}: ${b||h.statusText}`)}const g=h.body?.getReader();if(!g)throw new Error("No response body");await Yk(g,b=>{try{const y=JSON.parse(b);y.type==="content_block_delta"&&y.delta?.text?l(y.delta.text):y.choices?.[0]?.delta?.content&&l(y.choices[0].delta.content)}catch{}}),u()}).catch(h=>{h instanceof DOMException&&h.name==="AbortError"||f(h instanceof Error?h:new Error(String(h)))}),m}async function Ju(e){const{providerId:t,model:n,messages:r,temperature:i=.3,maxTokens:s=2048}=e,l=await fetch(`${ze}/llm/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,model:n,messages:r,temperature:i,maxTokens:s})});if(!l.ok){const m=await l.text().catch(()=>"");throw new Error(`LLM error ${l.status}: ${m||l.statusText}`)}const u=await l.text(),f=[];for(const m of u.split(`
|
|
11
|
+
`)){if(!m.startsWith("data: "))continue;const h=m.slice(6).trim();if(h==="[DONE]")break;try{const g=JSON.parse(h);g.type==="content_block_delta"&&g.delta?.text?f.push(g.delta.text):g.choices?.[0]?.delta?.content?f.push(g.choices[0].delta.content):g.type==="text"&&g.content&&f.push(g.content)}catch{}}return f.join("").trim()}async function ed(e){const t=await fetch(`${ze}/agent-sdk/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(`Agent SDK error ${t.status}: ${i||t.statusText}`)}const n=await t.text(),r=[];for(const i of n.split(`
|
|
12
|
+
`)){if(!i.startsWith("data: "))continue;const s=i.slice(6).trim();if(s==="[DONE]")break;try{const l=JSON.parse(s);l.type==="text"&&l.content&&r.push(l.content)}catch{}}return r.join("").trim()}const wr=`${ze}/mcp`;async function $o(e,t){try{const n=await fetch(e,{...t,headers:{"Content-Type":"application/json",...t?.headers}});if(!n.ok)return null;const r=await n.json();return r?.data??r}catch{return null}}const vt=fn((e,t)=>({servers:[],loaded:!1,loading:!1,error:void 0,loadServers:async()=>{if(t().loading||t().loaded)return;e({loading:!0,error:void 0});const n=await $o(wr),r=await $o(`${ze}/claude-config/mcp`);if(!n&&!r){e({servers:[],loaded:!0,loading:!1,error:"Backend unavailable. Start the server with `npm run server` on port 4800."});return}const i=n??[],s=r??[],l=new Set(i.map(f=>f.id)),u=[...i,...s.filter(f=>!l.has(f.id)).map(f=>({id:f.id,name:f.name,type:f.type,command:f.command??"",args:f.args??[],env:f.env??{},url:f.url,headers:f.headers,status:(f.status==="enabled"||f.status==="deferred","disconnected"),tools:[],mcpStatus:f.status}))];e({servers:u,loaded:!0,loading:!1}),await t().syncFromConfig()},syncFromConfig:async()=>{const{useConsoleStore:n}=await Ho(async()=>{const{useConsoleStore:l}=await Promise.resolve().then(()=>fS);return{useConsoleStore:l}},void 0),r=n.getState().mcpServers,i=t().servers,s=new Set(i.map(l=>l.id));for(const l of r)l.added&&!s.has(l.id)&&await t().addServer({id:l.id,name:l.name,command:"",args:[],env:{}})},addServer:async n=>{const r=t().servers.find(s=>s.id===n.id);if(r)return r;const i=await $o(wr,{method:"POST",body:JSON.stringify(n)});return i&&e({servers:[...t().servers,i]}),i},updateServer:async(n,r)=>{const i=await $o(`${wr}/${n}`,{method:"PUT",body:JSON.stringify(r)});return i&&e({servers:t().servers.map(s=>s.id===n?{...s,...i}:s)}),i},connectServer:async n=>{e({servers:t().servers.map(i=>i.id===n?{...i,status:"connecting"}:i)});const r=await $o(`${wr}/${n}/connect`,{method:"POST"});e({servers:t().servers.map(i=>i.id===n?{...i,status:r?.status??"error",tools:r?.tools??[],lastError:r?void 0:"Connection failed"}:i)})},disconnectServer:async n=>{await $o(`${wr}/${n}/disconnect`,{method:"POST"}),e({servers:t().servers.map(r=>r.id===n?{...r,status:"disconnected",tools:[]}:r)})},removeServer:async n=>{await $o(`${wr}/${n}`,{method:"DELETE"}),e({servers:t().servers.filter(r=>r.id!==n)})},callTool:async(n,r,i)=>(await $o(`${wr}/${n}/call`,{method:"POST",body:JSON.stringify({toolName:r,arguments:i})}))?.result??null,refreshHealth:async n=>{const r=await $o(`${wr}/${n}/health`);r&&e({servers:t().servers.map(i=>i.id===n?{...i,status:r.status,tools:r.tools,uptime:r.uptime,lastError:r.lastError}:i)})},getConnectedTools:()=>t().servers.filter(n=>n.status==="connected").flatMap(n=>n.tools)}));let Ls=null;function CM(){Ls||(Ls=setInterval(()=>{const{servers:e,refreshHealth:t}=vt.getState();for(const n of e)n.status==="connected"&&t(n.id)},3e4))}function EM(){Ls&&(clearInterval(Ls),Ls=null)}const bb=Object.freeze(Object.defineProperty({__proto__:null,startHealthPolling:CM,stopHealthPolling:EM,useMcpStore:vt},Symbol.toStringTag,{value:"Module"}));function Nt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=Nt(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var MM={value:()=>{}};function td(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Su(n)}function Su(e){this._=e}function TM(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Su.prototype=td.prototype={constructor:Su,on:function(e,t){var n=this._,r=TM(e+"",n),i,s=-1,l=r.length;if(arguments.length<2){for(;++s<l;)if((i=(e=r[s]).type)&&(i=jM(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<l;)if(i=(e=r[s]).type)n[i]=kb(n[i],e.name,t);else if(t==null)for(i in n)n[i]=kb(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Su(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)}};function jM(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function kb(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=MM,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Um="http://www.w3.org/1999/xhtml";const vb={svg:"http://www.w3.org/2000/svg",xhtml:Um,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function nd(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),vb.hasOwnProperty(t)?{space:vb[t],local:e}:e}function AM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Um&&t.documentElement.namespaceURI===Um?t.createElement(e):t.createElementNS(n,e)}}function NM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Zk(e){var t=nd(e);return(t.local?NM:AM)(t)}function _M(){}function Sh(e){return e==null?_M:function(){return this.querySelector(e)}}function DM(e){typeof e!="function"&&(e=Sh(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],l=s.length,u=r[i]=new Array(l),f,m,h=0;h<l;++h)(f=s[h])&&(m=e.call(f,f.__data__,h,s))&&("__data__"in f&&(m.__data__=f.__data__),u[h]=m);return new jn(r,this._parents)}function zM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function RM(){return[]}function Qk(e){return e==null?RM:function(){return this.querySelectorAll(e)}}function OM(e){return function(){return zM(e.apply(this,arguments))}}function IM(e){typeof e=="function"?e=OM(e):e=Qk(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var l=t[s],u=l.length,f,m=0;m<u;++m)(f=l[m])&&(r.push(e.call(f,f.__data__,m,l)),i.push(f));return new jn(r,i)}function Jk(e){return function(){return this.matches(e)}}function ev(e){return function(t){return t.matches(e)}}var FM=Array.prototype.find;function $M(e){return function(){return FM.call(this.children,e)}}function LM(){return this.firstElementChild}function PM(e){return this.select(e==null?LM:$M(typeof e=="function"?e:ev(e)))}var BM=Array.prototype.filter;function HM(){return Array.from(this.children)}function UM(e){return function(){return BM.call(this.children,e)}}function qM(e){return this.selectAll(e==null?HM:UM(typeof e=="function"?e:ev(e)))}function GM(e){typeof e!="function"&&(e=Jk(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],l=s.length,u=r[i]=[],f,m=0;m<l;++m)(f=s[m])&&e.call(f,f.__data__,m,s)&&u.push(f);return new jn(r,this._parents)}function tv(e){return new Array(e.length)}function KM(){return new jn(this._enter||this._groups.map(tv),this._parents)}function Du(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Du.prototype={constructor:Du,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function VM(e){return function(){return e}}function YM(e,t,n,r,i,s){for(var l=0,u,f=t.length,m=s.length;l<m;++l)(u=t[l])?(u.__data__=s[l],r[l]=u):n[l]=new Du(e,s[l]);for(;l<f;++l)(u=t[l])&&(i[l]=u)}function WM(e,t,n,r,i,s,l){var u,f,m=new Map,h=t.length,g=s.length,b=new Array(h),y;for(u=0;u<h;++u)(f=t[u])&&(b[u]=y=l.call(f,f.__data__,u,t)+"",m.has(y)?i[u]=f:m.set(y,f));for(u=0;u<g;++u)y=l.call(e,s[u],u,s)+"",(f=m.get(y))?(r[u]=f,f.__data__=s[u],m.delete(y)):n[u]=new Du(e,s[u]);for(u=0;u<h;++u)(f=t[u])&&m.get(b[u])===f&&(i[u]=f)}function XM(e){return e.__data__}function ZM(e,t){if(!arguments.length)return Array.from(this,XM);var n=t?WM:YM,r=this._parents,i=this._groups;typeof e!="function"&&(e=VM(e));for(var s=i.length,l=new Array(s),u=new Array(s),f=new Array(s),m=0;m<s;++m){var h=r[m],g=i[m],b=g.length,y=QM(e.call(h,h&&h.__data__,m,r)),v=y.length,w=u[m]=new Array(v),E=l[m]=new Array(v),C=f[m]=new Array(b);n(h,g,w,E,C,y,t);for(var M=0,S=0,N,R;M<v;++M)if(N=w[M]){for(M>=S&&(S=M+1);!(R=E[S])&&++S<v;);N._next=R||null}}return l=new jn(l,r),l._enter=u,l._exit=f,l}function QM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function JM(){return new jn(this._exit||this._groups.map(tv),this._parents)}function eT(e,t,n){var r=this.enter(),i=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}function tT(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,s=r.length,l=Math.min(i,s),u=new Array(i),f=0;f<l;++f)for(var m=n[f],h=r[f],g=m.length,b=u[f]=new Array(g),y,v=0;v<g;++v)(y=m[v]||h[v])&&(b[v]=y);for(;f<i;++f)u[f]=n[f];return new jn(u,this._parents)}function nT(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,s=r[i],l;--i>=0;)(l=r[i])&&(s&&l.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(l,s),s=l);return this}function oT(e){e||(e=rT);function t(g,b){return g&&b?e(g.__data__,b.__data__):!g-!b}for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var l=n[s],u=l.length,f=i[s]=new Array(u),m,h=0;h<u;++h)(m=l[h])&&(f[h]=m);f.sort(t)}return new jn(i,this._parents).order()}function rT(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function aT(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function iT(){return Array.from(this)}function sT(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length;i<s;++i){var l=r[i];if(l)return l}return null}function lT(){let e=0;for(const t of this)++e;return e}function cT(){return!this.node()}function uT(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,l=i.length,u;s<l;++s)(u=i[s])&&e.call(u,u.__data__,s,i);return this}function dT(e){return function(){this.removeAttribute(e)}}function pT(e){return function(){this.removeAttributeNS(e.space,e.local)}}function fT(e,t){return function(){this.setAttribute(e,t)}}function mT(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function hT(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function gT(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function yT(e,t){var n=nd(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?pT:dT:typeof t=="function"?n.local?gT:hT:n.local?mT:fT)(n,t))}function nv(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function xT(e){return function(){this.style.removeProperty(e)}}function bT(e,t,n){return function(){this.style.setProperty(e,t,n)}}function kT(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function vT(e,t,n){return arguments.length>1?this.each((t==null?xT:typeof t=="function"?kT:bT)(e,t,n??"")):mi(this.node(),e)}function mi(e,t){return e.style.getPropertyValue(t)||nv(e).getComputedStyle(e,null).getPropertyValue(t)}function wT(e){return function(){delete this[e]}}function ST(e,t){return function(){this[e]=t}}function CT(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ET(e,t){return arguments.length>1?this.each((t==null?wT:typeof t=="function"?CT:ST)(e,t)):this.node()[e]}function ov(e){return e.trim().split(/^|\s+/)}function Ch(e){return e.classList||new rv(e)}function rv(e){this._node=e,this._names=ov(e.getAttribute("class")||"")}rv.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function av(e,t){for(var n=Ch(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function iv(e,t){for(var n=Ch(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function MT(e){return function(){av(this,e)}}function TT(e){return function(){iv(this,e)}}function jT(e,t){return function(){(t.apply(this,arguments)?av:iv)(this,e)}}function AT(e,t){var n=ov(e+"");if(arguments.length<2){for(var r=Ch(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?jT:t?MT:TT)(n,t))}function NT(){this.textContent=""}function _T(e){return function(){this.textContent=e}}function DT(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function zT(e){return arguments.length?this.each(e==null?NT:(typeof e=="function"?DT:_T)(e)):this.node().textContent}function RT(){this.innerHTML=""}function OT(e){return function(){this.innerHTML=e}}function IT(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function FT(e){return arguments.length?this.each(e==null?RT:(typeof e=="function"?IT:OT)(e)):this.node().innerHTML}function $T(){this.nextSibling&&this.parentNode.appendChild(this)}function LT(){return this.each($T)}function PT(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function BT(){return this.each(PT)}function HT(e){var t=typeof e=="function"?e:Zk(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function UT(){return null}function qT(e,t){var n=typeof e=="function"?e:Zk(e),r=t==null?UT:typeof t=="function"?t:Sh(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function GT(){var e=this.parentNode;e&&e.removeChild(this)}function KT(){return this.each(GT)}function VT(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function YT(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function WT(e){return this.select(e?YT:VT)}function XT(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ZT(e){return function(t){e.call(this,t,this.__data__)}}function QT(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function JT(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n<i;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}function ej(e,t,n){return function(){var r=this.__on,i,s=ZT(t);if(r){for(var l=0,u=r.length;l<u;++l)if((i=r[l]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=t;return}}this.addEventListener(e.type,s,n),i={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(i):this.__on=[i]}}function tj(e,t,n){var r=QT(e+""),i,s=r.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,m=u.length,h;f<m;++f)for(i=0,h=u[f];i<s;++i)if((l=r[i]).type===h.type&&l.name===h.name)return h.value}return}for(u=t?ej:JT,i=0;i<s;++i)this.each(u(r[i],t,n));return this}function sv(e,t,n){var r=nv(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function nj(e,t){return function(){return sv(this,e,t)}}function oj(e,t){return function(){return sv(this,e,t.apply(this,arguments))}}function rj(e,t){return this.each((typeof t=="function"?oj:nj)(e,t))}function*aj(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length,l;i<s;++i)(l=r[i])&&(yield l)}var lv=[null];function jn(e,t){this._groups=e,this._parents=t}function ml(){return new jn([[document.documentElement]],lv)}function ij(){return this}jn.prototype=ml.prototype={constructor:jn,select:DM,selectAll:IM,selectChild:PM,selectChildren:qM,filter:GM,data:ZM,enter:KM,exit:JM,join:eT,merge:tT,selection:ij,order:nT,sort:oT,call:aT,nodes:iT,node:sT,size:lT,empty:cT,each:uT,attr:yT,style:vT,property:ET,classed:AT,text:zT,html:FT,raise:LT,lower:BT,append:HT,insert:qT,remove:KT,clone:WT,datum:XT,on:tj,dispatch:rj,[Symbol.iterator]:aj};function Mn(e){return typeof e=="string"?new jn([[document.querySelector(e)]],[document.documentElement]):new jn([[e]],lv)}function sj(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Yn(e,t){if(e=sj(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const lj={passive:!1},Ws={capture:!0,passive:!1};function Yf(e){e.stopImmediatePropagation()}function ui(e){e.preventDefault(),e.stopImmediatePropagation()}function cv(e){var t=e.document.documentElement,n=Mn(e).on("dragstart.drag",ui,Ws);"onselectstart"in t?n.on("selectstart.drag",ui,Ws):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function uv(e,t){var n=e.document.documentElement,r=Mn(e).on("dragstart.drag",null);t&&(r.on("click.drag",ui,Ws),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const eu=e=>()=>e;function qm(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:l,y:u,dx:f,dy:m,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:m,enumerable:!0,configurable:!0},_:{value:h}})}qm.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function cj(e){return!e.ctrlKey&&!e.button}function uj(){return this.parentNode}function dj(e,t){return t??{x:e.x,y:e.y}}function pj(){return navigator.maxTouchPoints||"ontouchstart"in this}function dv(){var e=cj,t=uj,n=dj,r=pj,i={},s=td("start","drag","end"),l=0,u,f,m,h,g=0;function b(N){N.on("mousedown.drag",y).filter(r).on("touchstart.drag",E).on("touchmove.drag",C,lj).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(N,R){if(!(h||!e.call(this,N,R))){var T=S(this,t.call(this,N,R),N,R,"mouse");T&&(Mn(N.view).on("mousemove.drag",v,Ws).on("mouseup.drag",w,Ws),cv(N.view),Yf(N),m=!1,u=N.clientX,f=N.clientY,T("start",N))}}function v(N){if(ui(N),!m){var R=N.clientX-u,T=N.clientY-f;m=R*R+T*T>g}i.mouse("drag",N)}function w(N){Mn(N.view).on("mousemove.drag mouseup.drag",null),uv(N.view,m),ui(N),i.mouse("end",N)}function E(N,R){if(e.call(this,N,R)){var T=N.changedTouches,D=t.call(this,N,R),H=T.length,V,B;for(V=0;V<H;++V)(B=S(this,D,N,R,T[V].identifier,T[V]))&&(Yf(N),B("start",N,T[V]))}}function C(N){var R=N.changedTouches,T=R.length,D,H;for(D=0;D<T;++D)(H=i[R[D].identifier])&&(ui(N),H("drag",N,R[D]))}function M(N){var R=N.changedTouches,T=R.length,D,H;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),D=0;D<T;++D)(H=i[R[D].identifier])&&(Yf(N),H("end",N,R[D]))}function S(N,R,T,D,H,V){var B=s.copy(),O=Yn(V||T,R),Y,Z,U;if((U=n.call(N,new qm("beforestart",{sourceEvent:T,target:b,identifier:H,active:l,x:O[0],y:O[1],dx:0,dy:0,dispatch:B}),D))!=null)return Y=U.x-O[0]||0,Z=U.y-O[1]||0,function _(A,q,K){var Q=O,I;switch(A){case"start":i[H]=_,I=l++;break;case"end":delete i[H],--l;case"drag":O=Yn(K||q,R),I=l;break}B.call(A,N,new qm(A,{sourceEvent:q,subject:U,target:b,identifier:H,active:I,x:O[0]+Y,y:O[1]+Z,dx:O[0]-Q[0],dy:O[1]-Q[1],dispatch:B}),D)}}return b.filter=function(N){return arguments.length?(e=typeof N=="function"?N:eu(!!N),b):e},b.container=function(N){return arguments.length?(t=typeof N=="function"?N:eu(N),b):t},b.subject=function(N){return arguments.length?(n=typeof N=="function"?N:eu(N),b):n},b.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:eu(!!N),b):r},b.on=function(){var N=s.on.apply(s,arguments);return N===s?b:N},b.clickDistance=function(N){return arguments.length?(g=(N=+N)*N,b):Math.sqrt(g)},b}function Eh(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function pv(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function hl(){}var Xs=.7,zu=1/Xs,di="\\s*([+-]?\\d+)\\s*",Zs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",fj=/^#([0-9a-f]{3,8})$/,mj=new RegExp(`^rgb\\(${di},${di},${di}\\)$`),hj=new RegExp(`^rgb\\(${fo},${fo},${fo}\\)$`),gj=new RegExp(`^rgba\\(${di},${di},${di},${Zs}\\)$`),yj=new RegExp(`^rgba\\(${fo},${fo},${fo},${Zs}\\)$`),xj=new RegExp(`^hsl\\(${Zs},${fo},${fo}\\)$`),bj=new RegExp(`^hsla\\(${Zs},${fo},${fo},${Zs}\\)$`),wb={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Eh(hl,da,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Sb,formatHex:Sb,formatHex8:kj,formatHsl:vj,formatRgb:Cb,toString:Cb});function Sb(){return this.rgb().formatHex()}function kj(){return this.rgb().formatHex8()}function vj(){return fv(this).formatHsl()}function Cb(){return this.rgb().formatRgb()}function da(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=fj.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Eb(t):n===3?new pn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?tu(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?tu(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=mj.exec(e))?new pn(t[1],t[2],t[3],1):(t=hj.exec(e))?new pn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=gj.exec(e))?tu(t[1],t[2],t[3],t[4]):(t=yj.exec(e))?tu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=xj.exec(e))?jb(t[1],t[2]/100,t[3]/100,1):(t=bj.exec(e))?jb(t[1],t[2]/100,t[3]/100,t[4]):wb.hasOwnProperty(e)?Eb(wb[e]):e==="transparent"?new pn(NaN,NaN,NaN,0):null}function Eb(e){return new pn(e>>16&255,e>>8&255,e&255,1)}function tu(e,t,n,r){return r<=0&&(e=t=n=NaN),new pn(e,t,n,r)}function wj(e){return e instanceof hl||(e=da(e)),e?(e=e.rgb(),new pn(e.r,e.g,e.b,e.opacity)):new pn}function Gm(e,t,n,r){return arguments.length===1?wj(e):new pn(e,t,n,r??1)}function pn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Eh(pn,Gm,pv(hl,{brighter(e){return e=e==null?zu:Math.pow(zu,e),new pn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Xs:Math.pow(Xs,e),new pn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pn(sa(this.r),sa(this.g),sa(this.b),Ru(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Mb,formatHex:Mb,formatHex8:Sj,formatRgb:Tb,toString:Tb}));function Mb(){return`#${aa(this.r)}${aa(this.g)}${aa(this.b)}`}function Sj(){return`#${aa(this.r)}${aa(this.g)}${aa(this.b)}${aa((isNaN(this.opacity)?1:this.opacity)*255)}`}function Tb(){const e=Ru(this.opacity);return`${e===1?"rgb(":"rgba("}${sa(this.r)}, ${sa(this.g)}, ${sa(this.b)}${e===1?")":`, ${e})`}`}function Ru(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function sa(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function aa(e){return e=sa(e),(e<16?"0":"")+e.toString(16)}function jb(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Wn(e,t,n,r)}function fv(e){if(e instanceof Wn)return new Wn(e.h,e.s,e.l,e.opacity);if(e instanceof hl||(e=da(e)),!e)return new Wn;if(e instanceof Wn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),l=NaN,u=s-i,f=(s+i)/2;return u?(t===s?l=(n-r)/u+(n<r)*6:n===s?l=(r-t)/u+2:l=(t-n)/u+4,u/=f<.5?s+i:2-s-i,l*=60):u=f>0&&f<1?0:l,new Wn(l,u,f,e.opacity)}function Cj(e,t,n,r){return arguments.length===1?fv(e):new Wn(e,t,n,r??1)}function Wn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Eh(Wn,Cj,pv(hl,{brighter(e){return e=e==null?zu:Math.pow(zu,e),new Wn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Xs:Math.pow(Xs,e),new Wn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new pn(Wf(e>=240?e-240:e+120,i,r),Wf(e,i,r),Wf(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Wn(Ab(this.h),nu(this.s),nu(this.l),Ru(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Ru(this.opacity);return`${e===1?"hsl(":"hsla("}${Ab(this.h)}, ${nu(this.s)*100}%, ${nu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ab(e){return e=(e||0)%360,e<0?e+360:e}function nu(e){return Math.max(0,Math.min(1,e||0))}function Wf(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Mh=e=>()=>e;function Ej(e,t){return function(n){return e+n*t}}function Mj(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Tj(e){return(e=+e)==1?mv:function(t,n){return n-t?Mj(t,n,e):Mh(isNaN(t)?n:t)}}function mv(e,t){var n=t-e;return n?Ej(e,n):Mh(isNaN(e)?t:e)}const Ou=(function e(t){var n=Tj(t);function r(i,s){var l=n((i=Gm(i)).r,(s=Gm(s)).r),u=n(i.g,s.g),f=n(i.b,s.b),m=mv(i.opacity,s.opacity);return function(h){return i.r=l(h),i.g=u(h),i.b=f(h),i.opacity=m(h),i+""}}return r.gamma=e,r})(1);function jj(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;i<n;++i)r[i]=e[i]*(1-s)+t[i]*s;return r}}function Aj(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Nj(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),s=new Array(n),l;for(l=0;l<r;++l)i[l]=Ps(e[l],t[l]);for(;l<n;++l)s[l]=t[l];return function(u){for(l=0;l<r;++l)s[l]=i[l](u);return s}}function _j(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function uo(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Dj(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=Ps(e[i],t[i]):r[i]=t[i];return function(s){for(i in n)r[i]=n[i](s);return r}}var Km=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xf=new RegExp(Km.source,"g");function zj(e){return function(){return e}}function Rj(e){return function(t){return e(t)+""}}function hv(e,t){var n=Km.lastIndex=Xf.lastIndex=0,r,i,s,l=-1,u=[],f=[];for(e=e+"",t=t+"";(r=Km.exec(e))&&(i=Xf.exec(t));)(s=i.index)>n&&(s=t.slice(n,s),u[l]?u[l]+=s:u[++l]=s),(r=r[0])===(i=i[0])?u[l]?u[l]+=i:u[++l]=i:(u[++l]=null,f.push({i:l,x:uo(r,i)})),n=Xf.lastIndex;return n<t.length&&(s=t.slice(n),u[l]?u[l]+=s:u[++l]=s),u.length<2?f[0]?Rj(f[0].x):zj(t):(t=f.length,function(m){for(var h=0,g;h<t;++h)u[(g=f[h]).i]=g.x(m);return u.join("")})}function Ps(e,t){var n=typeof t,r;return t==null||n==="boolean"?Mh(t):(n==="number"?uo:n==="string"?(r=da(t))?(t=r,Ou):hv:t instanceof da?Ou:t instanceof Date?_j:Aj(t)?jj:Array.isArray(t)?Nj:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Dj:uo)(e,t)}var Nb=180/Math.PI,Vm={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function gv(e,t,n,r,i,s){var l,u,f;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(f=e*n+t*r)&&(n-=e*f,r-=t*f),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,f/=u),e*r<t*n&&(e=-e,t=-t,f=-f,l=-l),{translateX:i,translateY:s,rotate:Math.atan2(t,e)*Nb,skewX:Math.atan(f)*Nb,scaleX:l,scaleY:u}}var ou;function Oj(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Vm:gv(t.a,t.b,t.c,t.d,t.e,t.f)}function Ij(e){return e==null||(ou||(ou=document.createElementNS("http://www.w3.org/2000/svg","g")),ou.setAttribute("transform",e),!(e=ou.transform.baseVal.consolidate()))?Vm:(e=e.matrix,gv(e.a,e.b,e.c,e.d,e.e,e.f))}function yv(e,t,n,r){function i(m){return m.length?m.pop()+" ":""}function s(m,h,g,b,y,v){if(m!==g||h!==b){var w=y.push("translate(",null,t,null,n);v.push({i:w-4,x:uo(m,g)},{i:w-2,x:uo(h,b)})}else(g||b)&&y.push("translate("+g+t+b+n)}function l(m,h,g,b){m!==h?(m-h>180?h+=360:h-m>180&&(m+=360),b.push({i:g.push(i(g)+"rotate(",null,r)-2,x:uo(m,h)})):h&&g.push(i(g)+"rotate("+h+r)}function u(m,h,g,b){m!==h?b.push({i:g.push(i(g)+"skewX(",null,r)-2,x:uo(m,h)}):h&&g.push(i(g)+"skewX("+h+r)}function f(m,h,g,b,y,v){if(m!==g||h!==b){var w=y.push(i(y)+"scale(",null,",",null,")");v.push({i:w-4,x:uo(m,g)},{i:w-2,x:uo(h,b)})}else(g!==1||b!==1)&&y.push(i(y)+"scale("+g+","+b+")")}return function(m,h){var g=[],b=[];return m=e(m),h=e(h),s(m.translateX,m.translateY,h.translateX,h.translateY,g,b),l(m.rotate,h.rotate,g,b),u(m.skewX,h.skewX,g,b),f(m.scaleX,m.scaleY,h.scaleX,h.scaleY,g,b),m=h=null,function(y){for(var v=-1,w=b.length,E;++v<w;)g[(E=b[v]).i]=E.x(y);return g.join("")}}}var Fj=yv(Oj,"px, ","px)","deg)"),$j=yv(Ij,", ",")",")"),Lj=1e-12;function _b(e){return((e=Math.exp(e))+1/e)/2}function Pj(e){return((e=Math.exp(e))-1/e)/2}function Bj(e){return((e=Math.exp(2*e))-1)/(e+1)}const Cu=(function e(t,n,r){function i(s,l){var u=s[0],f=s[1],m=s[2],h=l[0],g=l[1],b=l[2],y=h-u,v=g-f,w=y*y+v*v,E,C;if(w<Lj)C=Math.log(b/m)/t,E=function(D){return[u+D*y,f+D*v,m*Math.exp(t*D*C)]};else{var M=Math.sqrt(w),S=(b*b-m*m+r*w)/(2*m*n*M),N=(b*b-m*m-r*w)/(2*b*n*M),R=Math.log(Math.sqrt(S*S+1)-S),T=Math.log(Math.sqrt(N*N+1)-N);C=(T-R)/t,E=function(D){var H=D*C,V=_b(R),B=m/(n*M)*(V*Bj(t*H+R)-Pj(R));return[u+B*y,f+B*v,m*V/_b(t*H+R)]}}return E.duration=C*1e3*t/Math.SQRT2,E}return i.rho=function(s){var l=Math.max(.001,+s),u=l*l,f=u*u;return e(l,u,f)},i})(Math.SQRT2,2,4);var hi=0,Os=0,Cs=0,xv=1e3,Iu,Is,Fu=0,pa=0,od=0,Qs=typeof performance=="object"&&performance.now?performance:Date,bv=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Th(){return pa||(bv(Hj),pa=Qs.now()+od)}function Hj(){pa=0}function $u(){this._call=this._time=this._next=null}$u.prototype=kv.prototype={constructor:$u,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Th():+n)+(t==null?0:+t),!this._next&&Is!==this&&(Is?Is._next=this:Iu=this,Is=this),this._call=e,this._time=n,Ym()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ym())}};function kv(e,t,n){var r=new $u;return r.restart(e,t,n),r}function Uj(){Th(),++hi;for(var e=Iu,t;e;)(t=pa-e._time)>=0&&e._call.call(void 0,t),e=e._next;--hi}function Db(){pa=(Fu=Qs.now())+od,hi=Os=0;try{Uj()}finally{hi=0,Gj(),pa=0}}function qj(){var e=Qs.now(),t=e-Fu;t>xv&&(od-=t,Fu=e)}function Gj(){for(var e,t=Iu,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Iu=n);Is=e,Ym(r)}function Ym(e){if(!hi){Os&&(Os=clearTimeout(Os));var t=e-pa;t>24?(e<1/0&&(Os=setTimeout(Db,e-Qs.now()-od)),Cs&&(Cs=clearInterval(Cs))):(Cs||(Fu=Qs.now(),Cs=setInterval(qj,xv)),hi=1,bv(Db))}}function zb(e,t,n){var r=new $u;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Kj=td("start","end","cancel","interrupt"),Vj=[],vv=0,Rb=1,Wm=2,Eu=3,Ob=4,Xm=5,Mu=6;function rd(e,t,n,r,i,s){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;Yj(e,n,{name:t,index:r,group:i,on:Kj,tween:Vj,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:vv})}function jh(e,t){var n=eo(e,t);if(n.state>vv)throw new Error("too late; already scheduled");return n}function ho(e,t){var n=eo(e,t);if(n.state>Eu)throw new Error("too late; already running");return n}function eo(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Yj(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=kv(s,0,n.time);function s(m){n.state=Rb,n.timer.restart(l,n.delay,n.time),n.delay<=m&&l(m-n.delay)}function l(m){var h,g,b,y;if(n.state!==Rb)return f();for(h in r)if(y=r[h],y.name===n.name){if(y.state===Eu)return zb(l);y.state===Ob?(y.state=Mu,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[h]):+h<t&&(y.state=Mu,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete r[h])}if(zb(function(){n.state===Eu&&(n.state=Ob,n.timer.restart(u,n.delay,n.time),u(m))}),n.state=Wm,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Wm){for(n.state=Eu,i=new Array(b=n.tween.length),h=0,g=-1;h<b;++h)(y=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(i[++g]=y);i.length=g+1}}function u(m){for(var h=m<n.duration?n.ease.call(null,m/n.duration):(n.timer.restart(f),n.state=Xm,1),g=-1,b=i.length;++g<b;)i[g].call(e,h);n.state===Xm&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=Mu,n.timer.stop(),delete r[t];for(var m in r)return;delete e.__transition}}function Tu(e,t){var n=e.__transition,r,i,s=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((r=n[l]).name!==t){s=!1;continue}i=r.state>Wm&&r.state<Xm,r.state=Mu,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[l]}s&&delete e.__transition}}function Wj(e){return this.each(function(){Tu(this,e)})}function Xj(e,t){var n,r;return function(){var i=ho(this,e),s=i.tween;if(s!==n){r=n=s;for(var l=0,u=r.length;l<u;++l)if(r[l].name===t){r=r.slice(),r.splice(l,1);break}}i.tween=r}}function Zj(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=ho(this,e),l=s.tween;if(l!==r){i=(r=l).slice();for(var u={name:t,value:n},f=0,m=i.length;f<m;++f)if(i[f].name===t){i[f]=u;break}f===m&&i.push(u)}s.tween=i}}function Qj(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=eo(this.node(),n).tween,i=0,s=r.length,l;i<s;++i)if((l=r[i]).name===e)return l.value;return null}return this.each((t==null?Xj:Zj)(n,e,t))}function Ah(e,t,n){var r=e._id;return e.each(function(){var i=ho(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return eo(i,r).value[t]}}function wv(e,t){var n;return(typeof t=="number"?uo:t instanceof da?Ou:(n=da(t))?(t=n,Ou):hv)(e,t)}function Jj(e){return function(){this.removeAttribute(e)}}function e5(e){return function(){this.removeAttributeNS(e.space,e.local)}}function t5(e,t,n){var r,i=n+"",s;return function(){var l=this.getAttribute(e);return l===i?null:l===r?s:s=t(r=l,n)}}function n5(e,t,n){var r,i=n+"",s;return function(){var l=this.getAttributeNS(e.space,e.local);return l===i?null:l===r?s:s=t(r=l,n)}}function o5(e,t,n){var r,i,s;return function(){var l,u=n(this),f;return u==null?void this.removeAttribute(e):(l=this.getAttribute(e),f=u+"",l===f?null:l===r&&f===i?s:(i=f,s=t(r=l,u)))}}function r5(e,t,n){var r,i,s;return function(){var l,u=n(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),f=u+"",l===f?null:l===r&&f===i?s:(i=f,s=t(r=l,u)))}}function a5(e,t){var n=nd(e),r=n==="transform"?$j:wv;return this.attrTween(e,typeof t=="function"?(n.local?r5:o5)(n,r,Ah(this,"attr."+e,t)):t==null?(n.local?e5:Jj)(n):(n.local?n5:t5)(n,r,t))}function i5(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function s5(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function l5(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&s5(e,s)),n}return i._value=t,i}function c5(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&i5(e,s)),n}return i._value=t,i}function u5(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=nd(e);return this.tween(n,(r.local?l5:c5)(r,t))}function d5(e,t){return function(){jh(this,e).delay=+t.apply(this,arguments)}}function p5(e,t){return t=+t,function(){jh(this,e).delay=t}}function f5(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?d5:p5)(t,e)):eo(this.node(),t).delay}function m5(e,t){return function(){ho(this,e).duration=+t.apply(this,arguments)}}function h5(e,t){return t=+t,function(){ho(this,e).duration=t}}function g5(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?m5:h5)(t,e)):eo(this.node(),t).duration}function y5(e,t){if(typeof t!="function")throw new Error;return function(){ho(this,e).ease=t}}function x5(e){var t=this._id;return arguments.length?this.each(y5(t,e)):eo(this.node(),t).ease}function b5(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ho(this,e).ease=n}}function k5(e){if(typeof e!="function")throw new Error;return this.each(b5(this._id,e))}function v5(e){typeof e!="function"&&(e=Jk(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],l=s.length,u=r[i]=[],f,m=0;m<l;++m)(f=s[m])&&e.call(f,f.__data__,m,s)&&u.push(f);return new Uo(r,this._parents,this._name,this._id)}function w5(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,s=Math.min(r,i),l=new Array(r),u=0;u<s;++u)for(var f=t[u],m=n[u],h=f.length,g=l[u]=new Array(h),b,y=0;y<h;++y)(b=f[y]||m[y])&&(g[y]=b);for(;u<r;++u)l[u]=t[u];return new Uo(l,this._parents,this._name,this._id)}function S5(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function C5(e,t,n){var r,i,s=S5(t)?jh:ho;return function(){var l=s(this,e),u=l.on;u!==r&&(i=(r=u).copy()).on(t,n),l.on=i}}function E5(e,t){var n=this._id;return arguments.length<2?eo(this.node(),n).on.on(e):this.each(C5(n,e,t))}function M5(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function T5(){return this.on("end.remove",M5(this._id))}function j5(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Sh(e));for(var r=this._groups,i=r.length,s=new Array(i),l=0;l<i;++l)for(var u=r[l],f=u.length,m=s[l]=new Array(f),h,g,b=0;b<f;++b)(h=u[b])&&(g=e.call(h,h.__data__,b,u))&&("__data__"in h&&(g.__data__=h.__data__),m[b]=g,rd(m[b],t,n,b,m,eo(h,n)));return new Uo(s,this._parents,t,n)}function A5(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Qk(e));for(var r=this._groups,i=r.length,s=[],l=[],u=0;u<i;++u)for(var f=r[u],m=f.length,h,g=0;g<m;++g)if(h=f[g]){for(var b=e.call(h,h.__data__,g,f),y,v=eo(h,n),w=0,E=b.length;w<E;++w)(y=b[w])&&rd(y,t,n,w,b,v);s.push(b),l.push(h)}return new Uo(s,l,t,n)}var N5=ml.prototype.constructor;function _5(){return new N5(this._groups,this._parents)}function D5(e,t){var n,r,i;return function(){var s=mi(this,e),l=(this.style.removeProperty(e),mi(this,e));return s===l?null:s===n&&l===r?i:i=t(n=s,r=l)}}function Sv(e){return function(){this.style.removeProperty(e)}}function z5(e,t,n){var r,i=n+"",s;return function(){var l=mi(this,e);return l===i?null:l===r?s:s=t(r=l,n)}}function R5(e,t,n){var r,i,s;return function(){var l=mi(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),mi(this,e))),l===f?null:l===r&&f===i?s:(i=f,s=t(r=l,u))}}function O5(e,t){var n,r,i,s="style."+t,l="end."+s,u;return function(){var f=ho(this,e),m=f.on,h=f.value[s]==null?u||(u=Sv(t)):void 0;(m!==n||i!==h)&&(r=(n=m).copy()).on(l,i=h),f.on=r}}function I5(e,t,n){var r=(e+="")=="transform"?Fj:wv;return t==null?this.styleTween(e,D5(e,r)).on("end.style."+e,Sv(e)):typeof t=="function"?this.styleTween(e,R5(e,r,Ah(this,"style."+e,t))).each(O5(this._id,e)):this.styleTween(e,z5(e,r,t),n).on("end.style."+e,null)}function F5(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function $5(e,t,n){var r,i;function s(){var l=t.apply(this,arguments);return l!==i&&(r=(i=l)&&F5(e,l,n)),r}return s._value=t,s}function L5(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,$5(e,t,n??""))}function P5(e){return function(){this.textContent=e}}function B5(e){return function(){var t=e(this);this.textContent=t??""}}function H5(e){return this.tween("text",typeof e=="function"?B5(Ah(this,"text",e)):P5(e==null?"":e+""))}function U5(e){return function(t){this.textContent=e.call(this,t)}}function q5(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&U5(i)),t}return r._value=e,r}function G5(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,q5(e))}function K5(){for(var e=this._name,t=this._id,n=Cv(),r=this._groups,i=r.length,s=0;s<i;++s)for(var l=r[s],u=l.length,f,m=0;m<u;++m)if(f=l[m]){var h=eo(f,t);rd(f,e,n,m,l,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Uo(r,this._parents,e,n)}function V5(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,l){var u={value:l},f={value:function(){--i===0&&s()}};n.each(function(){var m=ho(this,r),h=m.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),m.on=t}),i===0&&s()})}var Y5=0;function Uo(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Cv(){return++Y5}var Lo=ml.prototype;Uo.prototype={constructor:Uo,select:j5,selectAll:A5,selectChild:Lo.selectChild,selectChildren:Lo.selectChildren,filter:v5,merge:w5,selection:_5,transition:K5,call:Lo.call,nodes:Lo.nodes,node:Lo.node,size:Lo.size,empty:Lo.empty,each:Lo.each,on:E5,attr:a5,attrTween:u5,style:I5,styleTween:L5,text:H5,textTween:G5,remove:T5,tween:Qj,delay:f5,duration:g5,ease:x5,easeVarying:k5,end:V5,[Symbol.iterator]:Lo[Symbol.iterator]};function W5(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var X5={time:null,delay:0,duration:250,ease:W5};function Z5(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Q5(e){var t,n;e instanceof Uo?(t=e._id,e=e._name):(t=Cv(),(n=X5).time=Th(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var l=r[s],u=l.length,f,m=0;m<u;++m)(f=l[m])&&rd(f,e,t,m,l,n||Z5(f,t));return new Uo(r,this._parents,e,t)}ml.prototype.interrupt=Wj;ml.prototype.transition=Q5;const ru=e=>()=>e;function J5(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Bo(e,t,n){this.k=e,this.x=t,this.y=n}Bo.prototype={constructor:Bo,scale:function(e){return e===1?this:new Bo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Bo(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ad=new Bo(1,0,0);Ev.prototype=Bo.prototype;function Ev(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ad;return e.__zoom}function Zf(e){e.stopImmediatePropagation()}function Es(e){e.preventDefault(),e.stopImmediatePropagation()}function eA(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function tA(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ib(){return this.__zoom||ad}function nA(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function oA(){return navigator.maxTouchPoints||"ontouchstart"in this}function rA(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),l>s?(s+l)/2:Math.min(0,s)||Math.max(0,l))}function Mv(){var e=eA,t=tA,n=rA,r=nA,i=oA,s=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,f=Cu,m=td("start","zoom","end"),h,g,b,y=500,v=150,w=0,E=10;function C(U){U.property("__zoom",Ib).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",V).on("dblclick.zoom",B).filter(i).on("touchstart.zoom",O).on("touchmove.zoom",Y).on("touchend.zoom touchcancel.zoom",Z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}C.transform=function(U,_,A,q){var K=U.selection?U.selection():U;K.property("__zoom",Ib),U!==K?R(U,_,A,q):K.interrupt().each(function(){T(this,arguments).event(q).start().zoom(null,typeof _=="function"?_.apply(this,arguments):_).end()})},C.scaleBy=function(U,_,A,q){C.scaleTo(U,function(){var K=this.__zoom.k,Q=typeof _=="function"?_.apply(this,arguments):_;return K*Q},A,q)},C.scaleTo=function(U,_,A,q){C.transform(U,function(){var K=t.apply(this,arguments),Q=this.__zoom,I=A==null?N(K):typeof A=="function"?A.apply(this,arguments):A,F=Q.invert(I),L=typeof _=="function"?_.apply(this,arguments):_;return n(S(M(Q,L),I,F),K,l)},A,q)},C.translateBy=function(U,_,A,q){C.transform(U,function(){return n(this.__zoom.translate(typeof _=="function"?_.apply(this,arguments):_,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),l)},null,q)},C.translateTo=function(U,_,A,q,K){C.transform(U,function(){var Q=t.apply(this,arguments),I=this.__zoom,F=q==null?N(Q):typeof q=="function"?q.apply(this,arguments):q;return n(ad.translate(F[0],F[1]).scale(I.k).translate(typeof _=="function"?-_.apply(this,arguments):-_,typeof A=="function"?-A.apply(this,arguments):-A),Q,l)},q,K)};function M(U,_){return _=Math.max(s[0],Math.min(s[1],_)),_===U.k?U:new Bo(_,U.x,U.y)}function S(U,_,A){var q=_[0]-A[0]*U.k,K=_[1]-A[1]*U.k;return q===U.x&&K===U.y?U:new Bo(U.k,q,K)}function N(U){return[(+U[0][0]+ +U[1][0])/2,(+U[0][1]+ +U[1][1])/2]}function R(U,_,A,q){U.on("start.zoom",function(){T(this,arguments).event(q).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(q).end()}).tween("zoom",function(){var K=this,Q=arguments,I=T(K,Q).event(q),F=t.apply(K,Q),L=A==null?N(F):typeof A=="function"?A.apply(K,Q):A,z=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),W=K.__zoom,ae=typeof _=="function"?_.apply(K,Q):_,le=f(W.invert(L).concat(z/W.k),ae.invert(L).concat(z/ae.k));return function(me){if(me===1)me=ae;else{var G=le(me),ce=z/G[2];me=new Bo(ce,L[0]-G[0]*ce,L[1]-G[1]*ce)}I.zoom(null,me)}})}function T(U,_,A){return!A&&U.__zooming||new D(U,_)}function D(U,_){this.that=U,this.args=_,this.active=0,this.sourceEvent=null,this.extent=t.apply(U,_),this.taps=0}D.prototype={event:function(U){return U&&(this.sourceEvent=U),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(U,_){return this.mouse&&U!=="mouse"&&(this.mouse[1]=_.invert(this.mouse[0])),this.touch0&&U!=="touch"&&(this.touch0[1]=_.invert(this.touch0[0])),this.touch1&&U!=="touch"&&(this.touch1[1]=_.invert(this.touch1[0])),this.that.__zoom=_,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(U){var _=Mn(this.that).datum();m.call(U,this.that,new J5(U,{sourceEvent:this.sourceEvent,target:C,transform:this.that.__zoom,dispatch:m}),_)}};function H(U,..._){if(!e.apply(this,arguments))return;var A=T(this,_).event(U),q=this.__zoom,K=Math.max(s[0],Math.min(s[1],q.k*Math.pow(2,r.apply(this,arguments)))),Q=Yn(U);if(A.wheel)(A.mouse[0][0]!==Q[0]||A.mouse[0][1]!==Q[1])&&(A.mouse[1]=q.invert(A.mouse[0]=Q)),clearTimeout(A.wheel);else{if(q.k===K)return;A.mouse=[Q,q.invert(Q)],Tu(this),A.start()}Es(U),A.wheel=setTimeout(I,v),A.zoom("mouse",n(S(M(q,K),A.mouse[0],A.mouse[1]),A.extent,l));function I(){A.wheel=null,A.end()}}function V(U,..._){if(b||!e.apply(this,arguments))return;var A=U.currentTarget,q=T(this,_,!0).event(U),K=Mn(U.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",z,!0),Q=Yn(U,A),I=U.clientX,F=U.clientY;cv(U.view),Zf(U),q.mouse=[Q,this.__zoom.invert(Q)],Tu(this),q.start();function L(W){if(Es(W),!q.moved){var ae=W.clientX-I,le=W.clientY-F;q.moved=ae*ae+le*le>w}q.event(W).zoom("mouse",n(S(q.that.__zoom,q.mouse[0]=Yn(W,A),q.mouse[1]),q.extent,l))}function z(W){K.on("mousemove.zoom mouseup.zoom",null),uv(W.view,q.moved),Es(W),q.event(W).end()}}function B(U,..._){if(e.apply(this,arguments)){var A=this.__zoom,q=Yn(U.changedTouches?U.changedTouches[0]:U,this),K=A.invert(q),Q=A.k*(U.shiftKey?.5:2),I=n(S(M(A,Q),q,K),t.apply(this,_),l);Es(U),u>0?Mn(this).transition().duration(u).call(R,I,q,U):Mn(this).call(C.transform,I,q,U)}}function O(U,..._){if(e.apply(this,arguments)){var A=U.touches,q=A.length,K=T(this,_,U.changedTouches.length===q).event(U),Q,I,F,L;for(Zf(U),I=0;I<q;++I)F=A[I],L=Yn(F,this),L=[L,this.__zoom.invert(L),F.identifier],K.touch0?!K.touch1&&K.touch0[2]!==L[2]&&(K.touch1=L,K.taps=0):(K.touch0=L,Q=!0,K.taps=1+!!h);h&&(h=clearTimeout(h)),Q&&(K.taps<2&&(g=L[0],h=setTimeout(function(){h=null},y)),Tu(this),K.start())}}function Y(U,..._){if(this.__zooming){var A=T(this,_).event(U),q=U.changedTouches,K=q.length,Q,I,F,L;for(Es(U),Q=0;Q<K;++Q)I=q[Q],F=Yn(I,this),A.touch0&&A.touch0[2]===I.identifier?A.touch0[0]=F:A.touch1&&A.touch1[2]===I.identifier&&(A.touch1[0]=F);if(I=A.that.__zoom,A.touch1){var z=A.touch0[0],W=A.touch0[1],ae=A.touch1[0],le=A.touch1[1],me=(me=ae[0]-z[0])*me+(me=ae[1]-z[1])*me,G=(G=le[0]-W[0])*G+(G=le[1]-W[1])*G;I=M(I,Math.sqrt(me/G)),F=[(z[0]+ae[0])/2,(z[1]+ae[1])/2],L=[(W[0]+le[0])/2,(W[1]+le[1])/2]}else if(A.touch0)F=A.touch0[0],L=A.touch0[1];else return;A.zoom("touch",n(S(I,F,L),A.extent,l))}}function Z(U,..._){if(this.__zooming){var A=T(this,_).event(U),q=U.changedTouches,K=q.length,Q,I;for(Zf(U),b&&clearTimeout(b),b=setTimeout(function(){b=null},y),Q=0;Q<K;++Q)I=q[Q],A.touch0&&A.touch0[2]===I.identifier?delete A.touch0:A.touch1&&A.touch1[2]===I.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(I=Yn(I,this),Math.hypot(g[0]-I[0],g[1]-I[1])<E)){var F=Mn(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return C.wheelDelta=function(U){return arguments.length?(r=typeof U=="function"?U:ru(+U),C):r},C.filter=function(U){return arguments.length?(e=typeof U=="function"?U:ru(!!U),C):e},C.touchable=function(U){return arguments.length?(i=typeof U=="function"?U:ru(!!U),C):i},C.extent=function(U){return arguments.length?(t=typeof U=="function"?U:ru([[+U[0][0],+U[0][1]],[+U[1][0],+U[1][1]]]),C):t},C.scaleExtent=function(U){return arguments.length?(s[0]=+U[0],s[1]=+U[1],C):[s[0],s[1]]},C.translateExtent=function(U){return arguments.length?(l[0][0]=+U[0][0],l[1][0]=+U[1][0],l[0][1]=+U[0][1],l[1][1]=+U[1][1],C):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},C.constrain=function(U){return arguments.length?(n=U,C):n},C.duration=function(U){return arguments.length?(u=+U,C):u},C.interpolate=function(U){return arguments.length?(f=U,C):f},C.on=function(){var U=m.on.apply(m,arguments);return U===m?C:U},C.clickDistance=function(U){return arguments.length?(w=(U=+U)*U,C):Math.sqrt(w)},C.tapDistance=function(U){return arguments.length?(E=+U,C):E},C}const mo={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Js=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Tv=["Enter"," ","Escape"],jv={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var gi;(function(e){e.Strict="strict",e.Loose="loose"})(gi||(gi={}));var la;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(la||(la={}));var el;(function(e){e.Partial="partial",e.Full="full"})(el||(el={}));const Av={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var jr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(jr||(jr={}));var Lu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Lu||(Lu={}));var Te;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Te||(Te={}));const Fb={[Te.Left]:Te.Right,[Te.Right]:Te.Left,[Te.Top]:Te.Bottom,[Te.Bottom]:Te.Top};function Nv(e){return e===null?null:e?"valid":"invalid"}const _v=e=>"id"in e&&"source"in e&&"target"in e,aA=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Nh=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),gl=(e,t=[0,0])=>{const{width:n,height:r}=qo(e),i=e.origin??t,s=n*i[0],l=r*i[1];return{x:e.position.x-s,y:e.position.y-l}},iA=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const s=typeof i=="string";let l=!t.nodeLookup&&!s?i:void 0;t.nodeLookup&&(l=s?t.nodeLookup.get(i):Nh(i)?i:t.nodeLookup.get(i.id));const u=l?Pu(l,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return id(r,u)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return sd(n)},yl=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=id(n,Pu(i)),r=!0)}),r?sd(n):{x:0,y:0,width:0,height:0}},_h=(e,t,[n,r,i]=[0,0,1],s=!1,l=!1)=>{const u={...bl(t,[n,r,i]),width:t.width/i,height:t.height/i},f=[];for(const m of e.values()){const{measured:h,selectable:g=!0,hidden:b=!1}=m;if(l&&!g||b)continue;const y=h.width??m.width??m.initialWidth??null,v=h.height??m.height??m.initialHeight??null,w=tl(u,xi(m)),E=(y??0)*(v??0),C=s&&w>0;(!m.internals.handleBounds||C||w>=E||m.dragging)&&f.push(m)}return f},sA=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function lA(e,t){const n=new Map,r=t?.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&(t?.includeHiddenNodes||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function cA({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},l){if(e.size===0)return Promise.resolve(!0);const u=lA(e,l),f=yl(u),m=Dh(f,t,n,l?.minZoom??i,l?.maxZoom??s,l?.padding??.1);return await r.setViewport(m,{duration:l?.duration,ease:l?.ease,interpolate:l?.interpolate}),Promise.resolve(!0)}function Dv({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){const l=n.get(e),u=l.parentId?n.get(l.parentId):void 0,{x:f,y:m}=u?u.internals.positionAbsolute:{x:0,y:0},h=l.origin??r;let g=l.extent||i;if(l.extent==="parent"&&!l.expandParent)if(!u)s?.("005",mo.error005());else{const y=u.measured.width,v=u.measured.height;y&&v&&(g=[[f,m],[f+y,m+v]])}else u&&bi(l.extent)&&(g=[[l.extent[0][0]+f,l.extent[0][1]+m],[l.extent[1][0]+f,l.extent[1][1]+m]]);const b=bi(g)?fa(t,g,l.measured):t;return(l.measured.width===void 0||l.measured.height===void 0)&&s?.("015",mo.error015()),{position:{x:b.x-f+(l.measured.width??0)*h[0],y:b.y-m+(l.measured.height??0)*h[1]},positionAbsolute:b}}async function uA({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const s=new Set(e.map(b=>b.id)),l=[];for(const b of n){if(b.deletable===!1)continue;const y=s.has(b.id),v=!y&&b.parentId&&l.find(w=>w.id===b.parentId);(y||v)&&l.push(b)}const u=new Set(t.map(b=>b.id)),f=r.filter(b=>b.deletable!==!1),h=sA(l,f);for(const b of f)u.has(b.id)&&!h.find(v=>v.id===b.id)&&h.push(b);if(!i)return{edges:h,nodes:l};const g=await i({nodes:l,edges:h});return typeof g=="boolean"?g?{edges:h,nodes:l}:{edges:[],nodes:[]}:g}const yi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),fa=(e={x:0,y:0},t,n)=>({x:yi(e.x,t[0][0],t[1][0]-(n?.width??0)),y:yi(e.y,t[0][1],t[1][1]-(n?.height??0))});function zv(e,t,n){const{width:r,height:i}=qo(n),{x:s,y:l}=n.internals.positionAbsolute;return fa(e,[[s,l],[s+r,l+i]],t)}const $b=(e,t,n)=>e<t?yi(Math.abs(e-t),1,t)/t:e>n?-yi(Math.abs(e-n),1,t)/t:0,Rv=(e,t,n=15,r=40)=>{const i=$b(e.x,r,t.width-r)*n,s=$b(e.y,r,t.height-r)*n;return[i,s]},id=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Zm=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),sd=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),xi=(e,t=[0,0])=>{const{x:n,y:r}=Nh(e)?e.internals.positionAbsolute:gl(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Pu=(e,t=[0,0])=>{const{x:n,y:r}=Nh(e)?e.internals.positionAbsolute:gl(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},Ov=(e,t)=>sd(id(Zm(e),Zm(t))),tl=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Lb=e=>Zn(e.width)&&Zn(e.height)&&Zn(e.x)&&Zn(e.y),Zn=e=>!isNaN(e)&&isFinite(e),dA=(e,t)=>{},xl=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),bl=({x:e,y:t},[n,r,i],s=!1,l=[1,1])=>{const u={x:(e-n)/i,y:(t-r)/i};return s?xl(u,l):u},Bu=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function ri(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function pA(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=ri(e,n),i=ri(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=ri(e.top??e.y??0,n),i=ri(e.bottom??e.y??0,n),s=ri(e.left??e.x??0,t),l=ri(e.right??e.x??0,t);return{top:r,right:l,bottom:i,left:s,x:s+l,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function fA(e,t,n,r,i,s){const{x:l,y:u}=Bu(e,[t,n,r]),{x:f,y:m}=Bu({x:e.x+e.width,y:e.y+e.height},[t,n,r]),h=i-f,g=s-m;return{left:Math.floor(l),top:Math.floor(u),right:Math.floor(h),bottom:Math.floor(g)}}const Dh=(e,t,n,r,i,s)=>{const l=pA(s,t,n),u=(t-l.x)/e.width,f=(n-l.y)/e.height,m=Math.min(u,f),h=yi(m,r,i),g=e.x+e.width/2,b=e.y+e.height/2,y=t/2-g*h,v=n/2-b*h,w=fA(e,y,v,h,t,n),E={left:Math.min(w.left-l.left,0),top:Math.min(w.top-l.top,0),right:Math.min(w.right-l.right,0),bottom:Math.min(w.bottom-l.bottom,0)};return{x:y-E.left+E.right,y:v-E.top+E.bottom,zoom:h}},nl=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function bi(e){return e!=null&&e!=="parent"}function qo(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Iv(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Fv(e,t={width:0,height:0},n,r,i){const s={...e},l=r.get(n);if(l){const u=l.origin||i;s.x+=l.internals.positionAbsolute.x-(t.width??0)*u[0],s.y+=l.internals.positionAbsolute.y-(t.height??0)*u[1]}return s}function Pb(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function mA(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function hA(e){return{...jv,...e||{}}}function Bs(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:s,y:l}=Qn(e),u=bl({x:s-(i?.left??0),y:l-(i?.top??0)},r),{x:f,y:m}=n?xl(u,t):u;return{xSnapped:f,ySnapped:m,...u}}const zh=e=>({width:e.offsetWidth,height:e.offsetHeight}),$v=e=>e?.getRootNode?.()||window?.document,gA=["INPUT","SELECT","TEXTAREA"];function Lv(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:gA.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Pv=e=>"clientX"in e,Qn=(e,t)=>{const n=Pv(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},Bb=(e,t,n,r,i)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:i,position:l.getAttribute("data-handlepos"),x:(u.left-n.left)/r,y:(u.top-n.top)/r,...zh(l)}})};function Bv({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:l,targetControlY:u}){const f=e*.125+i*.375+l*.375+n*.125,m=t*.125+s*.375+u*.375+r*.125,h=Math.abs(f-e),g=Math.abs(m-t);return[f,m,h,g]}function au(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Hb({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case Te.Left:return[t-au(t-r,s),n];case Te.Right:return[t+au(r-t,s),n];case Te.Top:return[t,n-au(n-i,s)];case Te.Bottom:return[t,n+au(i-n,s)]}}function Hv({sourceX:e,sourceY:t,sourcePosition:n=Te.Bottom,targetX:r,targetY:i,targetPosition:s=Te.Top,curvature:l=.25}){const[u,f]=Hb({pos:n,x1:e,y1:t,x2:r,y2:i,c:l}),[m,h]=Hb({pos:s,x1:r,y1:i,x2:e,y2:t,c:l}),[g,b,y,v]=Bv({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:u,sourceControlY:f,targetControlX:m,targetControlY:h});return[`M${e},${t} C${u},${f} ${m},${h} ${r},${i}`,g,b,y,v]}function Uv({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,s=n<e?n+i:n-i,l=Math.abs(r-t)/2,u=r<t?r+l:r-l;return[s,u,i,l]}function yA({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:s="basic"}){if(s==="manual")return r;const l=i&&n?r+1e3:r,u=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return l+u}function xA({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const s=id(Pu(e),Pu(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const l={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return tl(l,sd(s))>0}const bA=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,kA=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),vA=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||bA;let i;return _v(e)?i={...e}:i={...e,id:r(e)},kA(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function qv({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,s,l,u]=Uv({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,l,u]}const Ub={[Te.Left]:{x:-1,y:0},[Te.Right]:{x:1,y:0},[Te.Top]:{x:0,y:-1},[Te.Bottom]:{x:0,y:1}},wA=({source:e,sourcePosition:t=Te.Bottom,target:n})=>t===Te.Left||t===Te.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},qb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function SA({source:e,sourcePosition:t=Te.Bottom,target:n,targetPosition:r=Te.Top,center:i,offset:s,stepPosition:l}){const u=Ub[t],f=Ub[r],m={x:e.x+u.x*s,y:e.y+u.y*s},h={x:n.x+f.x*s,y:n.y+f.y*s},g=wA({source:m,sourcePosition:t,target:h}),b=g.x!==0?"x":"y",y=g[b];let v=[],w,E;const C={x:0,y:0},M={x:0,y:0},[,,S,N]=Uv({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(u[b]*f[b]===-1){b==="x"?(w=i.x??m.x+(h.x-m.x)*l,E=i.y??(m.y+h.y)/2):(w=i.x??(m.x+h.x)/2,E=i.y??m.y+(h.y-m.y)*l);const T=[{x:w,y:m.y},{x:w,y:h.y}],D=[{x:m.x,y:E},{x:h.x,y:E}];u[b]===y?v=b==="x"?T:D:v=b==="x"?D:T}else{const T=[{x:m.x,y:h.y}],D=[{x:h.x,y:m.y}];if(b==="x"?v=u.x===y?D:T:v=u.y===y?T:D,t===r){const Y=Math.abs(e[b]-n[b]);if(Y<=s){const Z=Math.min(s-1,s-Y);u[b]===y?C[b]=(m[b]>e[b]?-1:1)*Z:M[b]=(h[b]>n[b]?-1:1)*Z}}if(t!==r){const Y=b==="x"?"y":"x",Z=u[b]===f[Y],U=m[Y]>h[Y],_=m[Y]<h[Y];(u[b]===1&&(!Z&&U||Z&&_)||u[b]!==1&&(!Z&&_||Z&&U))&&(v=b==="x"?T:D)}const H={x:m.x+C.x,y:m.y+C.y},V={x:h.x+M.x,y:h.y+M.y},B=Math.max(Math.abs(H.x-v[0].x),Math.abs(V.x-v[0].x)),O=Math.max(Math.abs(H.y-v[0].y),Math.abs(V.y-v[0].y));B>=O?(w=(H.x+V.x)/2,E=v[0].y):(w=v[0].x,E=(H.y+V.y)/2)}return[[e,{x:m.x+C.x,y:m.y+C.y},...v,{x:h.x+M.x,y:h.y+M.y},n],w,E,S,N]}function CA(e,t,n,r){const i=Math.min(qb(e,t)/2,qb(t,n)/2,r),{x:s,y:l}=t;if(e.x===s&&s===n.x||e.y===l&&l===n.y)return`L${s} ${l}`;if(e.y===l){const m=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${s+i*m},${l}Q ${s},${l} ${s},${l+i*h}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${s},${l+i*f}Q ${s},${l} ${s+i*u},${l}`}function Qm({sourceX:e,sourceY:t,sourcePosition:n=Te.Bottom,targetX:r,targetY:i,targetPosition:s=Te.Top,borderRadius:l=5,centerX:u,centerY:f,offset:m=20,stepPosition:h=.5}){const[g,b,y,v,w]=SA({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:u,y:f},offset:m,stepPosition:h});return[g.reduce((C,M,S)=>{let N="";return S>0&&S<g.length-1?N=CA(g[S-1],M,g[S+1],l):N=`${S===0?"M":"L"}${M.x} ${M.y}`,C+=N,C},""),b,y,v,w]}function Gb(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function EA(e){const{sourceNode:t,targetNode:n}=e;if(!Gb(t)||!Gb(n))return null;const r=t.internals.handleBounds||Kb(t.handles),i=n.internals.handleBounds||Kb(n.handles),s=Vb(r?.source??[],e.sourceHandle),l=Vb(e.connectionMode===gi.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!s||!l)return e.onError?.("008",mo.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const u=s?.position||Te.Bottom,f=l?.position||Te.Top,m=ma(t,s,u),h=ma(n,l,f);return{sourceX:m.x,sourceY:m.y,targetX:h.x,targetY:h.y,sourcePosition:u,targetPosition:f}}function Kb(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function ma(e,t,n=Te.Left,r=!1){const i=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:l,height:u}=t??qo(e);if(r)return{x:i+l/2,y:s+u/2};switch(t?.position??n){case Te.Top:return{x:i+l/2,y:s};case Te.Right:return{x:i+l,y:s+u/2};case Te.Bottom:return{x:i+l/2,y:s+u};case Te.Left:return{x:i,y:s+u/2}}}function Vb(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Jm(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function MA(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const s=new Set;return e.reduce((l,u)=>([u.markerStart||r,u.markerEnd||i].forEach(f=>{if(f&&typeof f=="object"){const m=Jm(f,t);s.has(m)||(l.push({id:m,color:f.color||n,...f}),s.add(m))}}),l),[]).sort((l,u)=>l.id.localeCompare(u.id))}const Gv=1e3,TA=10,Rh={nodeOrigin:[0,0],nodeExtent:Js,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},jA={...Rh,checkEquality:!0};function Oh(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function AA(e,t,n){const r=Oh(Rh,n);for(const i of e.values())if(i.parentId)Fh(i,e,t,r);else{const s=gl(i,r.nodeOrigin),l=bi(i.extent)?i.extent:r.nodeExtent,u=fa(s,l,qo(i));i.internals.positionAbsolute=u}}function NA(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],r=[];for(const i of e.handles){const s={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(s):i.type==="target"&&r.push(s)}return{source:n,target:r}}function Ih(e){return e==="manual"}function eh(e,t,n,r={}){const i=Oh(jA,r),s={i:0},l=new Map(t),u=i?.elevateNodesOnSelect&&!Ih(i.zIndexMode)?Gv:0;let f=e.length>0;t.clear(),n.clear();for(const m of e){let h=l.get(m.id);if(i.checkEquality&&m===h?.internals.userNode)t.set(m.id,h);else{const g=gl(m,i.nodeOrigin),b=bi(m.extent)?m.extent:i.nodeExtent,y=fa(g,b,qo(m));h={...i.defaults,...m,measured:{width:m.measured?.width,height:m.measured?.height},internals:{positionAbsolute:y,handleBounds:NA(m,h),z:Kv(m,u,i.zIndexMode),userNode:m}},t.set(m.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(f=!1),m.parentId&&Fh(h,t,n,r,s)}return f}function _A(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Fh(e,t,n,r,i){const{elevateNodesOnSelect:s,nodeOrigin:l,nodeExtent:u,zIndexMode:f}=Oh(Rh,r),m=e.parentId,h=t.get(m);if(!h){console.warn(`Parent node ${m} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}_A(e,n),i&&!h.parentId&&h.internals.rootParentIndex===void 0&&f==="auto"&&(h.internals.rootParentIndex=++i.i,h.internals.z=h.internals.z+i.i*TA),i&&h.internals.rootParentIndex!==void 0&&(i.i=h.internals.rootParentIndex);const g=s&&!Ih(f)?Gv:0,{x:b,y,z:v}=DA(e,h,l,u,g,f),{positionAbsolute:w}=e.internals,E=b!==w.x||y!==w.y;(E||v!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:E?{x:b,y}:w,z:v}})}function Kv(e,t,n){const r=Zn(e.zIndex)?e.zIndex:0;return Ih(n)?r:r+(e.selected?t:0)}function DA(e,t,n,r,i,s){const{x:l,y:u}=t.internals.positionAbsolute,f=qo(e),m=gl(e,n),h=bi(e.extent)?fa(m,e.extent,f):m;let g=fa({x:l+h.x,y:u+h.y},r,f);e.extent==="parent"&&(g=zv(g,f,t));const b=Kv(e,i,s),y=t.internals.z??0;return{x:g.x,y:g.y,z:y>=b?y+1:b}}function $h(e,t,n,r=[0,0]){const i=[],s=new Map;for(const l of e){const u=t.get(l.parentId);if(!u)continue;const f=s.get(l.parentId)?.expandedRect??xi(u),m=Ov(f,l.rect);s.set(l.parentId,{expandedRect:m,parent:u})}return s.size>0&&s.forEach(({expandedRect:l,parent:u},f)=>{const m=u.internals.positionAbsolute,h=qo(u),g=u.origin??r,b=l.x<m.x?Math.round(Math.abs(m.x-l.x)):0,y=l.y<m.y?Math.round(Math.abs(m.y-l.y)):0,v=Math.max(h.width,Math.round(l.width)),w=Math.max(h.height,Math.round(l.height)),E=(v-h.width)*g[0],C=(w-h.height)*g[1];(b>0||y>0||E||C)&&(i.push({id:f,type:"position",position:{x:u.position.x-b+E,y:u.position.y-y+C}}),n.get(f)?.forEach(M=>{e.some(S=>S.id===M.id)||i.push({id:M.id,type:"position",position:{x:M.position.x+b,y:M.position.y+y}})})),(h.width<l.width||h.height<l.height||b||y)&&i.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:v+(b?g[0]*b-E:0),height:w+(y?g[1]*y-C:0)}})}),i}function zA(e,t,n,r,i,s,l){const u=r?.querySelector(".xyflow__viewport");let f=!1;if(!u)return{changes:[],updatedInternals:f};const m=[],h=window.getComputedStyle(u),{m22:g}=new window.DOMMatrixReadOnly(h.transform),b=[];for(const y of e.values()){const v=t.get(y.id);if(!v)continue;if(v.hidden){t.set(v.id,{...v,internals:{...v.internals,handleBounds:void 0}}),f=!0;continue}const w=zh(y.nodeElement),E=v.measured.width!==w.width||v.measured.height!==w.height;if(!!(w.width&&w.height&&(E||!v.internals.handleBounds||y.force))){const M=y.nodeElement.getBoundingClientRect(),S=bi(v.extent)?v.extent:s;let{positionAbsolute:N}=v.internals;v.parentId&&v.extent==="parent"?N=zv(N,w,t.get(v.parentId)):S&&(N=fa(N,S,w));const R={...v,measured:w,internals:{...v.internals,positionAbsolute:N,handleBounds:{source:Bb("source",y.nodeElement,M,g,v.id),target:Bb("target",y.nodeElement,M,g,v.id)}}};t.set(v.id,R),v.parentId&&Fh(R,t,n,{nodeOrigin:i,zIndexMode:l}),f=!0,E&&(m.push({id:v.id,type:"dimensions",dimensions:w}),v.expandParent&&v.parentId&&b.push({id:v.id,parentId:v.parentId,rect:xi(R,i)}))}}if(b.length>0){const y=$h(b,t,n,i);m.push(...y)}return{changes:m,updatedInternals:f}}async function RA({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const l=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,s]],r),u=!!l&&(l.x!==n[0]||l.y!==n[1]||l.k!==n[2]);return Promise.resolve(u)}function Yb(e,t,n,r,i,s){let l=i;const u=r.get(l)||new Map;r.set(l,u.set(n,t)),l=`${i}-${e}`;const f=r.get(l)||new Map;if(r.set(l,f.set(n,t)),s){l=`${i}-${e}-${s}`;const m=r.get(l)||new Map;r.set(l,m.set(n,t))}}function Vv(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:s,sourceHandle:l=null,targetHandle:u=null}=r,f={edgeId:r.id,source:i,target:s,sourceHandle:l,targetHandle:u},m=`${i}-${l}--${s}-${u}`,h=`${s}-${u}--${i}-${l}`;Yb("source",f,h,e,i,l),Yb("target",f,m,e,s,u),t.set(r.id,r)}}function Yv(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Yv(n,t):!1}function Wb(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function OA(e,t,n,r){const i=new Map;for(const[s,l]of e)if((l.selected||l.id===r)&&(!l.parentId||!Yv(l,e))&&(l.draggable||t&&typeof l.draggable>"u")){const u=e.get(s);u&&i.set(s,{id:s,position:u.position||{x:0,y:0},distance:{x:n.x-u.internals.positionAbsolute.x,y:n.y-u.internals.positionAbsolute.y},extent:u.extent,parentId:u.parentId,origin:u.origin,expandParent:u.expandParent,internals:{positionAbsolute:u.internals.positionAbsolute||{x:0,y:0}},measured:{width:u.measured.width??0,height:u.measured.height??0}})}return i}function Qf({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const i=[];for(const[l,u]of t){const f=n.get(l)?.internals.userNode;f&&i.push({...f,position:u.position,dragging:r})}if(!e)return[i[0],i];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:r}:i[0],i]}function IA({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const s={x:n-i.distance.x,y:r-i.distance.y},l=xl(s,t);return{x:l.x-s.x,y:l.y-s.y}}function FA({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},l=0,u=new Map,f=!1,m={x:0,y:0},h=null,g=!1,b=null,y=!1,v=!1,w=null;function E({noDragClassName:M,handleSelector:S,domNode:N,isSelectable:R,nodeId:T,nodeClickDistance:D=0}){b=Mn(N);function H({x:Y,y:Z}){const{nodeLookup:U,nodeExtent:_,snapGrid:A,snapToGrid:q,nodeOrigin:K,onNodeDrag:Q,onSelectionDrag:I,onError:F,updateNodePositions:L}=t();s={x:Y,y:Z};let z=!1;const W=u.size>1,ae=W&&_?Zm(yl(u)):null,le=W&&q?IA({dragItems:u,snapGrid:A,x:Y,y:Z}):null;for(const[me,G]of u){if(!U.has(me))continue;let ce={x:Y-G.distance.x,y:Z-G.distance.y};q&&(ce=le?{x:Math.round(ce.x+le.x),y:Math.round(ce.y+le.y)}:xl(ce,A));let be=null;if(W&&_&&!G.extent&&ae){const{positionAbsolute:ke}=G.internals,De=ke.x-ae.x+_[0][0],oe=ke.x+G.measured.width-ae.x2+_[1][0],xe=ke.y-ae.y+_[0][1],Oe=ke.y+G.measured.height-ae.y2+_[1][1];be=[[De,xe],[oe,Oe]]}const{position:we,positionAbsolute:ve}=Dv({nodeId:me,nextPosition:ce,nodeLookup:U,nodeExtent:be||_,nodeOrigin:K,onError:F});z=z||G.position.x!==we.x||G.position.y!==we.y,G.position=we,G.internals.positionAbsolute=ve}if(v=v||z,!!z&&(L(u,!0),w&&(r||Q||!T&&I))){const[me,G]=Qf({nodeId:T,dragItems:u,nodeLookup:U});r?.(w,u,me,G),Q?.(w,me,G),T||I?.(w,G)}}async function V(){if(!h)return;const{transform:Y,panBy:Z,autoPanSpeed:U,autoPanOnNodeDrag:_}=t();if(!_){f=!1,cancelAnimationFrame(l);return}const[A,q]=Rv(m,h,U);(A!==0||q!==0)&&(s.x=(s.x??0)-A/Y[2],s.y=(s.y??0)-q/Y[2],await Z({x:A,y:q})&&H(s)),l=requestAnimationFrame(V)}function B(Y){const{nodeLookup:Z,multiSelectionActive:U,nodesDraggable:_,transform:A,snapGrid:q,snapToGrid:K,selectNodesOnDrag:Q,onNodeDragStart:I,onSelectionDragStart:F,unselectNodesAndEdges:L}=t();g=!0,(!Q||!R)&&!U&&T&&(Z.get(T)?.selected||L()),R&&Q&&T&&e?.(T);const z=Bs(Y.sourceEvent,{transform:A,snapGrid:q,snapToGrid:K,containerBounds:h});if(s=z,u=OA(Z,_,z,T),u.size>0&&(n||I||!T&&F)){const[W,ae]=Qf({nodeId:T,dragItems:u,nodeLookup:Z});n?.(Y.sourceEvent,u,W,ae),I?.(Y.sourceEvent,W,ae),T||F?.(Y.sourceEvent,ae)}}const O=dv().clickDistance(D).on("start",Y=>{const{domNode:Z,nodeDragThreshold:U,transform:_,snapGrid:A,snapToGrid:q}=t();h=Z?.getBoundingClientRect()||null,y=!1,v=!1,w=Y.sourceEvent,U===0&&B(Y),s=Bs(Y.sourceEvent,{transform:_,snapGrid:A,snapToGrid:q,containerBounds:h}),m=Qn(Y.sourceEvent,h)}).on("drag",Y=>{const{autoPanOnNodeDrag:Z,transform:U,snapGrid:_,snapToGrid:A,nodeDragThreshold:q,nodeLookup:K}=t(),Q=Bs(Y.sourceEvent,{transform:U,snapGrid:_,snapToGrid:A,containerBounds:h});if(w=Y.sourceEvent,(Y.sourceEvent.type==="touchmove"&&Y.sourceEvent.touches.length>1||T&&!K.has(T))&&(y=!0),!y){if(!f&&Z&&g&&(f=!0,V()),!g){const I=Qn(Y.sourceEvent,h),F=I.x-m.x,L=I.y-m.y;Math.sqrt(F*F+L*L)>q&&B(Y)}(s.x!==Q.xSnapped||s.y!==Q.ySnapped)&&u&&g&&(m=Qn(Y.sourceEvent,h),H(Q))}}).on("end",Y=>{if(!(!g||y)&&(f=!1,g=!1,cancelAnimationFrame(l),u.size>0)){const{nodeLookup:Z,updateNodePositions:U,onNodeDragStop:_,onSelectionDragStop:A}=t();if(v&&(U(u,!1),v=!1),i||_||!T&&A){const[q,K]=Qf({nodeId:T,dragItems:u,nodeLookup:Z,dragging:!1});i?.(Y.sourceEvent,u,q,K),_?.(Y.sourceEvent,q,K),T||A?.(Y.sourceEvent,K)}}}).filter(Y=>{const Z=Y.target;return!Y.button&&(!M||!Wb(Z,`.${M}`,N))&&(!S||Wb(Z,S,N))});b.call(O)}function C(){b?.on(".drag",null)}return{update:E,destroy:C}}function $A(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())tl(i,xi(s))>0&&r.push(s);return r}const LA=250;function PA(e,t,n,r){let i=[],s=1/0;const l=$A(e,n,t+LA);for(const u of l){const f=[...u.internals.handleBounds?.source??[],...u.internals.handleBounds?.target??[]];for(const m of f){if(r.nodeId===m.nodeId&&r.type===m.type&&r.id===m.id)continue;const{x:h,y:g}=ma(u,m,m.position,!0),b=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(g-e.y,2));b>t||(b<s?(i=[{...m,x:h,y:g}],s=b):b===s&&i.push({...m,x:h,y:g}))}}if(!i.length)return null;if(i.length>1){const u=r.type==="source"?"target":"source";return i.find(f=>f.type===u)??i[0]}return i[0]}function Wv(e,t,n,r,i,s=!1){const l=r.get(e);if(!l)return null;const u=i==="strict"?l.internals.handleBounds?.[t]:[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]],f=(n?u?.find(m=>m.id===n):u?.[0])??null;return f&&s?{...f,...ma(l,f,f.position,!0)}:f}function Xv(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function BA(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Zv=()=>!0;function HA(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:l,domNode:u,nodeLookup:f,lib:m,autoPanOnConnect:h,flowId:g,panBy:b,cancelConnection:y,onConnectStart:v,onConnect:w,onConnectEnd:E,isValidConnection:C=Zv,onReconnectEnd:M,updateConnection:S,getTransform:N,getFromHandle:R,autoPanSpeed:T,dragThreshold:D=1,handleDomNode:H}){const V=$v(e.target);let B=0,O;const{x:Y,y:Z}=Qn(e),U=Xv(s,H),_=u?.getBoundingClientRect();let A=!1;if(!_||!U)return;const q=Wv(i,U,r,f,t);if(!q)return;let K=Qn(e,_),Q=!1,I=null,F=!1,L=null;function z(){if(!h||!_)return;const[we,ve]=Rv(K,_,T);b({x:we,y:ve}),B=requestAnimationFrame(z)}const W={...q,nodeId:i,type:U,position:q.position},ae=f.get(i);let me={inProgress:!0,isValid:null,from:ma(ae,W,Te.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:ae,to:K,toHandle:null,toPosition:Fb[W.position],toNode:null,pointer:K};function G(){A=!0,S(me),v?.(e,{nodeId:i,handleId:r,handleType:U})}D===0&&G();function ce(we){if(!A){const{x:Oe,y:wt}=Qn(we),ht=Oe-Y,St=wt-Z;if(!(ht*ht+St*St>D*D))return;G()}if(!R()||!W){be(we);return}const ve=N();K=Qn(we,_),O=PA(bl(K,ve,!1,[1,1]),n,f,W),Q||(z(),Q=!0);const ke=Qv(we,{handle:O,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:l?"target":"source",isValidConnection:C,doc:V,lib:m,flowId:g,nodeLookup:f});L=ke.handleDomNode,I=ke.connection,F=BA(!!O,ke.isValid);const De=f.get(i),oe=De?ma(De,W,Te.Left,!0):me.from,xe={...me,from:oe,isValid:F,to:ke.toHandle&&F?Bu({x:ke.toHandle.x,y:ke.toHandle.y},ve):K,toHandle:ke.toHandle,toPosition:F&&ke.toHandle?ke.toHandle.position:Fb[W.position],toNode:ke.toHandle?f.get(ke.toHandle.nodeId):null,pointer:K};S(xe),me=xe}function be(we){if(!("touches"in we&&we.touches.length>0)){if(A){(O||L)&&I&&F&&w?.(I);const{inProgress:ve,...ke}=me,De={...ke,toPosition:me.toHandle?me.toPosition:null};E?.(we,De),s&&M?.(we,De)}y(),cancelAnimationFrame(B),Q=!1,F=!1,I=null,L=null,V.removeEventListener("mousemove",ce),V.removeEventListener("mouseup",be),V.removeEventListener("touchmove",ce),V.removeEventListener("touchend",be)}}V.addEventListener("mousemove",ce),V.addEventListener("mouseup",be),V.addEventListener("touchmove",ce),V.addEventListener("touchend",be)}function Qv(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:l,lib:u,flowId:f,isValidConnection:m=Zv,nodeLookup:h}){const g=s==="target",b=t?l.querySelector(`.${u}-flow__handle[data-id="${f}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:y,y:v}=Qn(e),w=l.elementFromPoint(y,v),E=w?.classList.contains(`${u}-flow__handle`)?w:b,C={handleDomNode:E,isValid:!1,connection:null,toHandle:null};if(E){const M=Xv(void 0,E),S=E.getAttribute("data-nodeid"),N=E.getAttribute("data-handleid"),R=E.classList.contains("connectable"),T=E.classList.contains("connectableend");if(!S||!M)return C;const D={source:g?S:r,sourceHandle:g?N:i,target:g?r:S,targetHandle:g?i:N};C.connection=D;const V=R&&T&&(n===gi.Strict?g&&M==="source"||!g&&M==="target":S!==r||N!==i);C.isValid=V&&m(D),C.toHandle=Wv(S,M,N,h,n,!0)}return C}const th={onPointerDown:HA,isValid:Qv};function UA({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=Mn(e);function s({translateExtent:u,width:f,height:m,zoomStep:h=1,pannable:g=!0,zoomable:b=!0,inversePan:y=!1}){const v=S=>{if(S.sourceEvent.type!=="wheel"||!t)return;const N=n(),R=S.sourceEvent.ctrlKey&&nl()?10:1,T=-S.sourceEvent.deltaY*(S.sourceEvent.deltaMode===1?.05:S.sourceEvent.deltaMode?1:.002)*h,D=N[2]*Math.pow(2,T*R);t.scaleTo(D)};let w=[0,0];const E=S=>{(S.sourceEvent.type==="mousedown"||S.sourceEvent.type==="touchstart")&&(w=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY])},C=S=>{const N=n();if(S.sourceEvent.type!=="mousemove"&&S.sourceEvent.type!=="touchmove"||!t)return;const R=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY],T=[R[0]-w[0],R[1]-w[1]];w=R;const D=r()*Math.max(N[2],Math.log(N[2]))*(y?-1:1),H={x:N[0]-T[0]*D,y:N[1]-T[1]*D},V=[[0,0],[f,m]];t.setViewportConstrained({x:H.x,y:H.y,zoom:N[2]},V,u)},M=Mv().on("start",E).on("zoom",g?C:null).on("zoom.wheel",b?v:null);i.call(M,{})}function l(){i.on("zoom",null)}return{update:s,destroy:l,pointer:Yn}}const ld=e=>({x:e.x,y:e.y,zoom:e.k}),Jf=({x:e,y:t,zoom:n})=>ad.translate(e,t).scale(n),li=(e,t)=>e.target.closest(`.${t}`),Jv=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),qA=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,em=(e,t=0,n=qA,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},ew=e=>{const t=e.ctrlKey&&nl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function GA({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:l,onPanZoomStart:u,onPanZoom:f,onPanZoomEnd:m}){return h=>{if(li(h,t))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const g=n.property("__zoom").k||1;if(h.ctrlKey&&l){const E=Yn(h),C=ew(h),M=g*Math.pow(2,C);r.scaleTo(n,M,E,h);return}const b=h.deltaMode===1?20:1;let y=i===la.Vertical?0:h.deltaX*b,v=i===la.Horizontal?0:h.deltaY*b;!nl()&&h.shiftKey&&i!==la.Vertical&&(y=h.deltaY*b,v=0),r.translateBy(n,-(y/g)*s,-(v/g)*s,{internal:!0});const w=ld(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(f?.(h,w),e.panScrollTimeout=setTimeout(()=>{m?.(h,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,u?.(h,w))}}function KA({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const s=r.type==="wheel",l=!t&&s&&!r.ctrlKey,u=li(r,e);if(r.ctrlKey&&s&&u&&r.preventDefault(),l||u)return null;r.preventDefault(),n.call(this,r,i)}}function VA({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const i=ld(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,i)}}function YA({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{e.usedRightMouseButton=!!(n&&Jv(t,e.mouseButton??0)),s.sourceEvent?.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!s.sourceEvent?.internal&&i?.(s.sourceEvent,ld(s.transform))}}function WA({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return l=>{if(!l.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&Jv(t,e.mouseButton??0)&&!e.usedRightMouseButton&&l.sourceEvent&&s(l.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const u=ld(l.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(l.sourceEvent,u)},n?150:0)}}}function XA({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:l,noWheelClassName:u,noPanClassName:f,lib:m,connectionInProgress:h}){return g=>{const b=e||t,y=n&&g.ctrlKey,v=g.type==="wheel";if(g.button===1&&g.type==="mousedown"&&(li(g,`${m}-flow__node`)||li(g,`${m}-flow__edge`)))return!0;if(!r&&!b&&!i&&!s&&!n||l||h&&!v||li(g,u)&&v||li(g,f)&&(!v||i&&v&&!e)||!n&&g.ctrlKey&&v)return!1;if(!n&&g.type==="touchstart"&&g.touches?.length>1)return g.preventDefault(),!1;if(!b&&!i&&!y&&v||!r&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(r)&&!r.includes(g.button)&&g.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||v)&&w}}function ZA({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:l,onPanZoomEnd:u,onDraggingChange:f}){const m={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),g=Mv().scaleExtent([t,n]).translateExtent(r),b=Mn(e).call(g);M({x:i.x,y:i.y,zoom:yi(i.zoom,t,n)},[[0,0],[h.width,h.height]],r);const y=b.on("wheel.zoom"),v=b.on("dblclick.zoom");g.wheelDelta(ew);function w(O,Y){return b?new Promise(Z=>{g?.interpolate(Y?.interpolate==="linear"?Ps:Cu).transform(em(b,Y?.duration,Y?.ease,()=>Z(!0)),O)}):Promise.resolve(!1)}function E({noWheelClassName:O,noPanClassName:Y,onPaneContextMenu:Z,userSelectionActive:U,panOnScroll:_,panOnDrag:A,panOnScrollMode:q,panOnScrollSpeed:K,preventScrolling:Q,zoomOnPinch:I,zoomOnScroll:F,zoomOnDoubleClick:L,zoomActivationKeyPressed:z,lib:W,onTransformChange:ae,connectionInProgress:le,paneClickDistance:me,selectionOnDrag:G}){U&&!m.isZoomingOrPanning&&C();const ce=_&&!z&&!U;g.clickDistance(G?1/0:!Zn(me)||me<0?0:me);const be=ce?GA({zoomPanValues:m,noWheelClassName:O,d3Selection:b,d3Zoom:g,panOnScrollMode:q,panOnScrollSpeed:K,zoomOnPinch:I,onPanZoomStart:l,onPanZoom:s,onPanZoomEnd:u}):KA({noWheelClassName:O,preventScrolling:Q,d3ZoomHandler:y});if(b.on("wheel.zoom",be,{passive:!1}),!U){const ve=VA({zoomPanValues:m,onDraggingChange:f,onPanZoomStart:l});g.on("start",ve);const ke=YA({zoomPanValues:m,panOnDrag:A,onPaneContextMenu:!!Z,onPanZoom:s,onTransformChange:ae});g.on("zoom",ke);const De=WA({zoomPanValues:m,panOnDrag:A,panOnScroll:_,onPaneContextMenu:Z,onPanZoomEnd:u,onDraggingChange:f});g.on("end",De)}const we=XA({zoomActivationKeyPressed:z,panOnDrag:A,zoomOnScroll:F,panOnScroll:_,zoomOnDoubleClick:L,zoomOnPinch:I,userSelectionActive:U,noPanClassName:Y,noWheelClassName:O,lib:W,connectionInProgress:le});g.filter(we),L?b.on("dblclick.zoom",v):b.on("dblclick.zoom",null)}function C(){g.on("zoom",null)}async function M(O,Y,Z){const U=Jf(O),_=g?.constrain()(U,Y,Z);return _&&await w(_),new Promise(A=>A(_))}async function S(O,Y){const Z=Jf(O);return await w(Z,Y),new Promise(U=>U(Z))}function N(O){if(b){const Y=Jf(O),Z=b.property("__zoom");(Z.k!==O.zoom||Z.x!==O.x||Z.y!==O.y)&&g?.transform(b,Y,null,{sync:!0})}}function R(){const O=b?Ev(b.node()):{x:0,y:0,k:1};return{x:O.x,y:O.y,zoom:O.k}}function T(O,Y){return b?new Promise(Z=>{g?.interpolate(Y?.interpolate==="linear"?Ps:Cu).scaleTo(em(b,Y?.duration,Y?.ease,()=>Z(!0)),O)}):Promise.resolve(!1)}function D(O,Y){return b?new Promise(Z=>{g?.interpolate(Y?.interpolate==="linear"?Ps:Cu).scaleBy(em(b,Y?.duration,Y?.ease,()=>Z(!0)),O)}):Promise.resolve(!1)}function H(O){g?.scaleExtent(O)}function V(O){g?.translateExtent(O)}function B(O){const Y=!Zn(O)||O<0?0:O;g?.clickDistance(Y)}return{update:E,destroy:C,setViewport:S,setViewportConstrained:M,getViewport:R,scaleTo:T,scaleBy:D,setScaleExtent:H,setTranslateExtent:V,syncViewport:N,setClickDistance:B}}var ki;(function(e){e.Line="line",e.Handle="handle"})(ki||(ki={}));function QA({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){const l=e-t,u=n-r,f=[l>0?1:l<0?-1:0,u>0?1:u<0?-1:0];return l&&i&&(f[0]=f[0]*-1),u&&s&&(f[1]=f[1]*-1),f}function Xb(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function Sr(e,t){return Math.max(0,t-e)}function Cr(e,t){return Math.max(0,e-t)}function iu(e,t,n){return Math.max(0,t-e,e-n)}function Zb(e,t){return e?!t:t}function JA(e,t,n,r,i,s,l,u){let{affectsX:f,affectsY:m}=t;const{isHorizontal:h,isVertical:g}=t,b=h&&g,{xSnapped:y,ySnapped:v}=n,{minWidth:w,maxWidth:E,minHeight:C,maxHeight:M}=r,{x:S,y:N,width:R,height:T,aspectRatio:D}=e;let H=Math.floor(h?y-e.pointerX:0),V=Math.floor(g?v-e.pointerY:0);const B=R+(f?-H:H),O=T+(m?-V:V),Y=-s[0]*R,Z=-s[1]*T;let U=iu(B,w,E),_=iu(O,C,M);if(l){let K=0,Q=0;f&&H<0?K=Sr(S+H+Y,l[0][0]):!f&&H>0&&(K=Cr(S+B+Y,l[1][0])),m&&V<0?Q=Sr(N+V+Z,l[0][1]):!m&&V>0&&(Q=Cr(N+O+Z,l[1][1])),U=Math.max(U,K),_=Math.max(_,Q)}if(u){let K=0,Q=0;f&&H>0?K=Cr(S+H,u[0][0]):!f&&H<0&&(K=Sr(S+B,u[1][0])),m&&V>0?Q=Cr(N+V,u[0][1]):!m&&V<0&&(Q=Sr(N+O,u[1][1])),U=Math.max(U,K),_=Math.max(_,Q)}if(i){if(h){const K=iu(B/D,C,M)*D;if(U=Math.max(U,K),l){let Q=0;!f&&!m||f&&!m&&b?Q=Cr(N+Z+B/D,l[1][1])*D:Q=Sr(N+Z+(f?H:-H)/D,l[0][1])*D,U=Math.max(U,Q)}if(u){let Q=0;!f&&!m||f&&!m&&b?Q=Sr(N+B/D,u[1][1])*D:Q=Cr(N+(f?H:-H)/D,u[0][1])*D,U=Math.max(U,Q)}}if(g){const K=iu(O*D,w,E)/D;if(_=Math.max(_,K),l){let Q=0;!f&&!m||m&&!f&&b?Q=Cr(S+O*D+Y,l[1][0])/D:Q=Sr(S+(m?V:-V)*D+Y,l[0][0])/D,_=Math.max(_,Q)}if(u){let Q=0;!f&&!m||m&&!f&&b?Q=Sr(S+O*D,u[1][0])/D:Q=Cr(S+(m?V:-V)*D,u[0][0])/D,_=Math.max(_,Q)}}}V=V+(V<0?_:-_),H=H+(H<0?U:-U),i&&(b?B>O*D?V=(Zb(f,m)?-H:H)/D:H=(Zb(f,m)?-V:V)*D:h?(V=H/D,m=f):(H=V*D,f=m));const A=f?S+H:S,q=m?N+V:N;return{width:R+(f?-H:H),height:T+(m?-V:V),x:s[0]*H*(f?-1:1)+A,y:s[1]*V*(m?-1:1)+q}}const tw={width:0,height:0,x:0,y:0},eN={...tw,pointerX:0,pointerY:0,aspectRatio:1};function tN(e){return[[0,0],[e.measured.width,e.measured.height]]}function nN(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,s=e.measured.width??0,l=e.measured.height??0,u=n[0]*s,f=n[1]*l;return[[r-u,i-f],[r+s-u,i+l-f]]}function oN({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const s=Mn(e);let l={controlDirection:Xb("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function u({controlPosition:m,boundaries:h,keepAspectRatio:g,resizeDirection:b,onResizeStart:y,onResize:v,onResizeEnd:w,shouldResize:E}){let C={...tw},M={...eN};l={boundaries:h,resizeDirection:b,keepAspectRatio:g,controlDirection:Xb(m)};let S,N=null,R=[],T,D,H,V=!1;const B=dv().on("start",O=>{const{nodeLookup:Y,transform:Z,snapGrid:U,snapToGrid:_,nodeOrigin:A,paneDomNode:q}=n();if(S=Y.get(t),!S)return;N=q?.getBoundingClientRect()??null;const{xSnapped:K,ySnapped:Q}=Bs(O.sourceEvent,{transform:Z,snapGrid:U,snapToGrid:_,containerBounds:N});C={width:S.measured.width??0,height:S.measured.height??0,x:S.position.x??0,y:S.position.y??0},M={...C,pointerX:K,pointerY:Q,aspectRatio:C.width/C.height},T=void 0,S.parentId&&(S.extent==="parent"||S.expandParent)&&(T=Y.get(S.parentId),D=T&&S.extent==="parent"?tN(T):void 0),R=[],H=void 0;for(const[I,F]of Y)if(F.parentId===t&&(R.push({id:I,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const L=nN(F,S,F.origin??A);H?H=[[Math.min(L[0][0],H[0][0]),Math.min(L[0][1],H[0][1])],[Math.max(L[1][0],H[1][0]),Math.max(L[1][1],H[1][1])]]:H=L}y?.(O,{...C})}).on("drag",O=>{const{transform:Y,snapGrid:Z,snapToGrid:U,nodeOrigin:_}=n(),A=Bs(O.sourceEvent,{transform:Y,snapGrid:Z,snapToGrid:U,containerBounds:N}),q=[];if(!S)return;const{x:K,y:Q,width:I,height:F}=C,L={},z=S.origin??_,{width:W,height:ae,x:le,y:me}=JA(M,l.controlDirection,A,l.boundaries,l.keepAspectRatio,z,D,H),G=W!==I,ce=ae!==F,be=le!==K&&G,we=me!==Q&&ce;if(!be&&!we&&!G&&!ce)return;if((be||we||z[0]===1||z[1]===1)&&(L.x=be?le:C.x,L.y=we?me:C.y,C.x=L.x,C.y=L.y,R.length>0)){const oe=le-K,xe=me-Q;for(const Oe of R)Oe.position={x:Oe.position.x-oe+z[0]*(W-I),y:Oe.position.y-xe+z[1]*(ae-F)},q.push(Oe)}if((G||ce)&&(L.width=G&&(!l.resizeDirection||l.resizeDirection==="horizontal")?W:C.width,L.height=ce&&(!l.resizeDirection||l.resizeDirection==="vertical")?ae:C.height,C.width=L.width,C.height=L.height),T&&S.expandParent){const oe=z[0]*(L.width??0);L.x&&L.x<oe&&(C.x=oe,M.x=M.x-(L.x-oe));const xe=z[1]*(L.height??0);L.y&&L.y<xe&&(C.y=xe,M.y=M.y-(L.y-xe))}const ve=QA({width:C.width,prevWidth:I,height:C.height,prevHeight:F,affectsX:l.controlDirection.affectsX,affectsY:l.controlDirection.affectsY}),ke={...C,direction:ve};E?.(O,ke)!==!1&&(V=!0,v?.(O,ke),r(L,q))}).on("end",O=>{V&&(w?.(O,{...C}),i?.({...C}),V=!1)});s.call(B)}function f(){s.on(".drag",null)}return{update:u,destroy:f}}var tm={exports:{}},nm={},om={exports:{}},rm={};var Qb;function rN(){if(Qb)return rm;Qb=1;var e=fl();function t(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,s=e.useLayoutEffect,l=e.useDebugValue;function u(g,b){var y=b(),v=r({inst:{value:y,getSnapshot:b}}),w=v[0].inst,E=v[1];return s(function(){w.value=y,w.getSnapshot=b,f(w)&&E({inst:w})},[g,y,b]),i(function(){return f(w)&&E({inst:w}),g(function(){f(w)&&E({inst:w})})},[g]),l(y),y}function f(g){var b=g.getSnapshot;g=g.value;try{var y=b();return!n(g,y)}catch{return!0}}function m(g,b){return b()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:u;return rm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,rm}var Jb;function aN(){return Jb||(Jb=1,om.exports=rN()),om.exports}var e1;function iN(){if(e1)return nm;e1=1;var e=fl(),t=aN();function n(m,h){return m===h&&(m!==0||1/m===1/h)||m!==m&&h!==h}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,s=e.useRef,l=e.useEffect,u=e.useMemo,f=e.useDebugValue;return nm.useSyncExternalStoreWithSelector=function(m,h,g,b,y){var v=s(null);if(v.current===null){var w={hasValue:!1,value:null};v.current=w}else w=v.current;v=u(function(){function C(T){if(!M){if(M=!0,S=T,T=b(T),y!==void 0&&w.hasValue){var D=w.value;if(y(D,T))return N=D}return N=T}if(D=N,r(S,T))return D;var H=b(T);return y!==void 0&&y(D,H)?(S=T,D):(S=T,N=H)}var M=!1,S,N,R=g===void 0?null:g;return[function(){return C(h())},R===null?void 0:function(){return C(R())}]},[h,g,b,y]);var E=i(m,v[0],v[1]);return l(function(){w.hasValue=!0,w.value=E},[E]),f(E),E},nm}var t1;function sN(){return t1||(t1=1,tm.exports=iN()),tm.exports}var lN=sN();const cN=Qu(lN),uN={},n1=e=>{let t;const n=new Set,r=(h,g)=>{const b=typeof h=="function"?h(t):h;if(!Object.is(b,t)){const y=t;t=g??(typeof b!="object"||b===null)?b:Object.assign({},t,b),n.forEach(v=>v(t,y))}},i=()=>t,f={setState:r,getState:i,getInitialState:()=>m,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(uN?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},m=t=e(r,i,f);return f},dN=e=>e?n1(e):n1,{useDebugValue:pN}=Rs,{useSyncExternalStoreWithSelector:fN}=cN,mN=e=>e;function nw(e,t=mN,n){const r=fN(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return pN(r),r}const o1=(e,t)=>{const n=dN(e),r=(i,s=t)=>nw(n,i,s);return Object.assign(r,n),r},hN=(e,t)=>e?o1(e,t):o1;function ft(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var cd=Kk();const ud=$.createContext(null),gN=ud.Provider,ow=mo.error001();function Ye(e,t){const n=$.useContext(ud);if(n===null)throw new Error(ow);return nw(n,e,t)}function mt(){const e=$.useContext(ud);if(e===null)throw new Error(ow);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const r1={display:"none"},yN={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},rw="react-flow__node-desc",aw="react-flow__edge-desc",xN="react-flow__aria-live",bN=e=>e.ariaLiveMessage,kN=e=>e.ariaLabelConfig;function vN({rfId:e}){const t=Ye(bN);return d.jsx("div",{id:`${xN}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:yN,children:t})}function wN({rfId:e,disableKeyboardA11y:t}){const n=Ye(kN);return d.jsxs(d.Fragment,{children:[d.jsx("div",{id:`${rw}-${e}`,style:r1,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),d.jsx("div",{id:`${aw}-${e}`,style:r1,children:n["edge.a11yDescription.default"]}),!t&&d.jsx(vN,{rfId:e})]})}const dd=$.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{const l=`${e}`.split("-");return d.jsx("div",{className:Nt(["react-flow__panel",n,...l]),style:r,ref:s,...i,children:t})});dd.displayName="Panel";function SN({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:d.jsx(dd,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:d.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const CN=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},su=e=>e.id;function EN(e,t){return ft(e.selectedNodes.map(su),t.selectedNodes.map(su))&&ft(e.selectedEdges.map(su),t.selectedEdges.map(su))}function MN({onSelectionChange:e}){const t=mt(),{selectedNodes:n,selectedEdges:r}=Ye(CN,EN);return $.useEffect(()=>{const i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}const TN=e=>!!e.onSelectionChangeHandlers;function jN({onSelectionChange:e}){const t=Ye(TN);return e||t?d.jsx(MN,{onSelectionChange:e}):null}const iw=[0,0],AN={x:0,y:0,zoom:1},NN=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],a1=[...NN,"rfId"],_N=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),i1={translateExtent:Js,nodeOrigin:iw,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function DN(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:l,reset:u,setDefaultNodesAndEdges:f}=Ye(_N,ft),m=mt();$.useEffect(()=>(f(e.defaultNodes,e.defaultEdges),()=>{h.current=i1,u()}),[]);const h=$.useRef(i1);return $.useEffect(()=>{for(const g of a1){const b=e[g],y=h.current[g];b!==y&&(typeof e[g]>"u"||(g==="nodes"?t(b):g==="edges"?n(b):g==="minZoom"?r(b):g==="maxZoom"?i(b):g==="translateExtent"?s(b):g==="nodeExtent"?l(b):g==="ariaLabelConfig"?m.setState({ariaLabelConfig:hA(b)}):g==="fitView"?m.setState({fitViewQueued:b}):g==="fitViewOptions"?m.setState({fitViewOptions:b}):m.setState({[g]:b})))}h.current=e},a1.map(g=>e[g])),null}function s1(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function zN(e){const[t,n]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){n(e);return}const r=s1(),i=()=>n(r?.matches?"dark":"light");return i(),r?.addEventListener("change",i),()=>{r?.removeEventListener("change",i)}},[e]),t!==null?t:s1()?.matches?"dark":"light"}const l1=typeof document<"u"?document:null;function ol(e=null,t={target:l1,actInsideInputWithModifier:!0}){const[n,r]=$.useState(!1),i=$.useRef(!1),s=$.useRef(new Set([])),[l,u]=$.useMemo(()=>{if(e!==null){const m=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.replace("+",`
|
|
13
|
+
`).replace(`
|
|
14
|
+
|
|
15
|
+
`,`
|
|
16
|
+
+`).split(`
|
|
17
|
+
`)),h=m.reduce((g,b)=>g.concat(...b),[]);return[m,h]}return[[],[]]},[e]);return $.useEffect(()=>{const f=t?.target??l1,m=t?.actInsideInputWithModifier??!0;if(e!==null){const h=y=>{if(i.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!i.current||i.current&&!m)&&Lv(y))return!1;const w=u1(y.code,u);if(s.current.add(y[w]),c1(l,s.current,!1)){const E=y.composedPath?.()?.[0]||y.target,C=E?.nodeName==="BUTTON"||E?.nodeName==="A";t.preventDefault!==!1&&(i.current||!C)&&y.preventDefault(),r(!0)}},g=y=>{const v=u1(y.code,u);c1(l,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(y[v]),y.key==="Meta"&&s.current.clear(),i.current=!1},b=()=>{s.current.clear(),r(!1)};return f?.addEventListener("keydown",h),f?.addEventListener("keyup",g),window.addEventListener("blur",b),window.addEventListener("contextmenu",b),()=>{f?.removeEventListener("keydown",h),f?.removeEventListener("keyup",g),window.removeEventListener("blur",b),window.removeEventListener("contextmenu",b)}}},[e,r]),n}function c1(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function u1(e,t){return t.includes(e)?"code":"key"}const RN=()=>{const e=mt();return $.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,i,s],panZoom:l}=e.getState();return l?(await l.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:i,minZoom:s,maxZoom:l,panZoom:u}=e.getState(),f=Dh(t,r,i,s,l,n?.padding??.1);return u?(await u.setViewport(f,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:i,snapToGrid:s,domNode:l}=e.getState();if(!l)return t;const{x:u,y:f}=l.getBoundingClientRect(),m={x:t.x-u,y:t.y-f},h=n.snapGrid??i,g=n.snapToGrid??s;return bl(m,r,g,h)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:s}=r.getBoundingClientRect(),l=Bu(t,n);return{x:l.x+i,y:l.y+s}}}),[])};function sw(e,t){const n=[],r=new Map,i=[];for(const s of e)if(s.type==="add"){i.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const l=r.get(s.id);l?l.push(s):r.set(s.id,[s])}for(const s of t){const l=r.get(s.id);if(!l){n.push(s);continue}if(l[0].type==="remove")continue;if(l[0].type==="replace"){n.push({...l[0].item});continue}const u={...s};for(const f of l)ON(f,u);n.push(u)}return i.length&&i.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function ON(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function IN(e,t){return sw(e,t)}function FN(e,t){return sw(e,t)}function oa(e,t){return{id:e,type:"select",selected:t}}function ci(e,t=new Set,n=!1){const r=[];for(const[i,s]of e){const l=t.has(i);!(s.selected===void 0&&!l)&&s.selected!==l&&(n&&(s.selected=l),r.push(oa(s.id,l)))}return r}function d1({items:e=[],lookup:t}){const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,s]of e.entries()){const l=t.get(s.id),u=l?.internals?.userNode??l;u!==void 0&&u!==s&&n.push({id:s.id,item:s,type:"replace"}),u===void 0&&n.push({item:s,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function p1(e){return{id:e.id,type:"remove"}}const f1=e=>aA(e),$N=e=>_v(e);function lw(e){return $.forwardRef(e)}const LN=typeof window<"u"?$.useLayoutEffect:$.useEffect;function m1(e){const[t,n]=$.useState(BigInt(0)),[r]=$.useState(()=>PN(()=>n(i=>i+BigInt(1))));return LN(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function PN(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const cw=$.createContext(null);function BN({children:e}){const t=mt(),n=$.useCallback(u=>{const{nodes:f=[],setNodes:m,hasDefaultNodes:h,onNodesChange:g,nodeLookup:b,fitViewQueued:y,onNodesChangeMiddlewareMap:v}=t.getState();let w=f;for(const C of u)w=typeof C=="function"?C(w):C;let E=d1({items:w,lookup:b});for(const C of v.values())E=C(E);h&&m(w),E.length>0?g?.(E):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:C,nodes:M,setNodes:S}=t.getState();C&&S(M)})},[]),r=m1(n),i=$.useCallback(u=>{const{edges:f=[],setEdges:m,hasDefaultEdges:h,onEdgesChange:g,edgeLookup:b}=t.getState();let y=f;for(const v of u)y=typeof v=="function"?v(y):v;h?m(y):g&&g(d1({items:y,lookup:b}))},[]),s=m1(i),l=$.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return d.jsx(cw.Provider,{value:l,children:e})}function HN(){const e=$.useContext(cw);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const UN=e=>!!e.panZoom;function Lh(){const e=RN(),t=mt(),n=HN(),r=Ye(UN),i=$.useMemo(()=>{const s=g=>t.getState().nodeLookup.get(g),l=g=>{n.nodeQueue.push(g)},u=g=>{n.edgeQueue.push(g)},f=g=>{const{nodeLookup:b,nodeOrigin:y}=t.getState(),v=f1(g)?g:b.get(g.id),w=v.parentId?Fv(v.position,v.measured,v.parentId,b,y):v.position,E={...v,position:w,width:v.measured?.width??v.width,height:v.measured?.height??v.height};return xi(E)},m=(g,b,y={replace:!1})=>{l(v=>v.map(w=>{if(w.id===g){const E=typeof b=="function"?b(w):b;return y.replace&&f1(E)?E:{...w,...E}}return w}))},h=(g,b,y={replace:!1})=>{u(v=>v.map(w=>{if(w.id===g){const E=typeof b=="function"?b(w):b;return y.replace&&$N(E)?E:{...w,...E}}return w}))};return{getNodes:()=>t.getState().nodes.map(g=>({...g})),getNode:g=>s(g)?.internals.userNode,getInternalNode:s,getEdges:()=>{const{edges:g=[]}=t.getState();return g.map(b=>({...b}))},getEdge:g=>t.getState().edgeLookup.get(g),setNodes:l,setEdges:u,addNodes:g=>{const b=Array.isArray(g)?g:[g];n.nodeQueue.push(y=>[...y,...b])},addEdges:g=>{const b=Array.isArray(g)?g:[g];n.edgeQueue.push(y=>[...y,...b])},toObject:()=>{const{nodes:g=[],edges:b=[],transform:y}=t.getState(),[v,w,E]=y;return{nodes:g.map(C=>({...C})),edges:b.map(C=>({...C})),viewport:{x:v,y:w,zoom:E}}},deleteElements:async({nodes:g=[],edges:b=[]})=>{const{nodes:y,edges:v,onNodesDelete:w,onEdgesDelete:E,triggerNodeChanges:C,triggerEdgeChanges:M,onDelete:S,onBeforeDelete:N}=t.getState(),{nodes:R,edges:T}=await uA({nodesToRemove:g,edgesToRemove:b,nodes:y,edges:v,onBeforeDelete:N}),D=T.length>0,H=R.length>0;if(D){const V=T.map(p1);E?.(T),M(V)}if(H){const V=R.map(p1);w?.(R),C(V)}return(H||D)&&S?.({nodes:R,edges:T}),{deletedNodes:R,deletedEdges:T}},getIntersectingNodes:(g,b=!0,y)=>{const v=Lb(g),w=v?g:f(g),E=y!==void 0;return w?(y||t.getState().nodes).filter(C=>{const M=t.getState().nodeLookup.get(C.id);if(M&&!v&&(C.id===g.id||!M.internals.positionAbsolute))return!1;const S=xi(E?C:M),N=tl(S,w);return b&&N>0||N>=S.width*S.height||N>=w.width*w.height}):[]},isNodeIntersecting:(g,b,y=!0)=>{const w=Lb(g)?g:f(g);if(!w)return!1;const E=tl(w,b);return y&&E>0||E>=b.width*b.height||E>=w.width*w.height},updateNode:m,updateNodeData:(g,b,y={replace:!1})=>{m(g,v=>{const w=typeof b=="function"?b(v):b;return y.replace?{...v,data:w}:{...v,data:{...v.data,...w}}},y)},updateEdge:h,updateEdgeData:(g,b,y={replace:!1})=>{h(g,v=>{const w=typeof b=="function"?b(v):b;return y.replace?{...v,data:w}:{...v,data:{...v.data,...w}}},y)},getNodesBounds:g=>{const{nodeLookup:b,nodeOrigin:y}=t.getState();return iA(g,{nodeLookup:b,nodeOrigin:y})},getHandleConnections:({type:g,id:b,nodeId:y})=>Array.from(t.getState().connectionLookup.get(`${y}-${g}${b?`-${b}`:""}`)?.values()??[]),getNodeConnections:({type:g,handleId:b,nodeId:y})=>Array.from(t.getState().connectionLookup.get(`${y}${g?b?`-${g}-${b}`:`-${g}`:""}`)?.values()??[]),fitView:async g=>{const b=t.getState().fitViewResolver??mA();return t.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:b}),n.nodeQueue.push(y=>[...y]),b.promise}}},[]);return $.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const h1=e=>e.selected,qN=typeof window<"u"?window:void 0;function GN({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=mt(),{deleteElements:r}=Lh(),i=ol(e,{actInsideInputWithModifier:!1}),s=ol(t,{target:qN});$.useEffect(()=>{if(i){const{edges:l,nodes:u}=n.getState();r({nodes:u.filter(h1),edges:l.filter(h1)}),n.setState({nodesSelectionActive:!1})}},[i]),$.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function KN(e){const t=mt();$.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const r=zh(e.current);(r.height===0||r.width===0)&&t.getState().onError?.("004",mo.error004()),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const pd={position:"absolute",width:"100%",height:"100%",top:0,left:0},VN=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function YN({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=la.Free,zoomOnDoubleClick:l=!0,panOnDrag:u=!0,defaultViewport:f,translateExtent:m,minZoom:h,maxZoom:g,zoomActivationKeyCode:b,preventScrolling:y=!0,children:v,noWheelClassName:w,noPanClassName:E,onViewportChange:C,isControlledViewport:M,paneClickDistance:S,selectionOnDrag:N}){const R=mt(),T=$.useRef(null),{userSelectionActive:D,lib:H,connectionInProgress:V}=Ye(VN,ft),B=ol(b),O=$.useRef();KN(T);const Y=$.useCallback(Z=>{C?.({x:Z[0],y:Z[1],zoom:Z[2]}),M||R.setState({transform:Z})},[C,M]);return $.useEffect(()=>{if(T.current){O.current=ZA({domNode:T.current,minZoom:h,maxZoom:g,translateExtent:m,viewport:f,onDraggingChange:A=>R.setState(q=>q.paneDragging===A?q:{paneDragging:A}),onPanZoomStart:(A,q)=>{const{onViewportChangeStart:K,onMoveStart:Q}=R.getState();Q?.(A,q),K?.(q)},onPanZoom:(A,q)=>{const{onViewportChange:K,onMove:Q}=R.getState();Q?.(A,q),K?.(q)},onPanZoomEnd:(A,q)=>{const{onViewportChangeEnd:K,onMoveEnd:Q}=R.getState();Q?.(A,q),K?.(q)}});const{x:Z,y:U,zoom:_}=O.current.getViewport();return R.setState({panZoom:O.current,transform:[Z,U,_],domNode:T.current.closest(".react-flow")}),()=>{O.current?.destroy()}}},[]),$.useEffect(()=>{O.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:l,panOnDrag:u,zoomActivationKeyPressed:B,preventScrolling:y,noPanClassName:E,userSelectionActive:D,noWheelClassName:w,lib:H,onTransformChange:Y,connectionInProgress:V,selectionOnDrag:N,paneClickDistance:S})},[e,t,n,r,i,s,l,u,B,y,E,D,w,H,Y,V,N,S]),d.jsx("div",{className:"react-flow__renderer",ref:T,style:pd,children:v})}const WN=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function XN(){const{userSelectionActive:e,userSelectionRect:t}=Ye(WN,ft);return e&&t?d.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const am=(e,t)=>n=>{n.target===t.current&&e?.(n)},ZN=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function QN({isSelecting:e,selectionKeyPressed:t,selectionMode:n=el.Full,panOnDrag:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:l,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:m,onPaneScroll:h,onPaneMouseEnter:g,onPaneMouseMove:b,onPaneMouseLeave:y,children:v}){const w=mt(),{userSelectionActive:E,elementsSelectable:C,dragging:M,connectionInProgress:S}=Ye(ZN,ft),N=C&&(e||E),R=$.useRef(null),T=$.useRef(),D=$.useRef(new Set),H=$.useRef(new Set),V=$.useRef(!1),B=K=>{if(V.current||S){V.current=!1;return}f?.(K),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},O=K=>{if(Array.isArray(r)&&r?.includes(2)){K.preventDefault();return}m?.(K)},Y=h?K=>h(K):void 0,Z=K=>{V.current&&(K.stopPropagation(),V.current=!1)},U=K=>{const{domNode:Q}=w.getState();if(T.current=Q?.getBoundingClientRect(),!T.current)return;const I=K.target===R.current;if(!I&&!!K.target.closest(".nokey")||!e||!(s&&I||t)||K.button!==0||!K.isPrimary)return;K.target?.setPointerCapture?.(K.pointerId),V.current=!1;const{x:z,y:W}=Qn(K.nativeEvent,T.current);w.setState({userSelectionRect:{width:0,height:0,startX:z,startY:W,x:z,y:W}}),I||(K.stopPropagation(),K.preventDefault())},_=K=>{const{userSelectionRect:Q,transform:I,nodeLookup:F,edgeLookup:L,connectionLookup:z,triggerNodeChanges:W,triggerEdgeChanges:ae,defaultEdgeOptions:le,resetSelectedElements:me}=w.getState();if(!T.current||!Q)return;const{x:G,y:ce}=Qn(K.nativeEvent,T.current),{startX:be,startY:we}=Q;if(!V.current){const xe=t?0:i;if(Math.hypot(G-be,ce-we)<=xe)return;me(),l?.(K)}V.current=!0;const ve={startX:be,startY:we,x:G<be?G:be,y:ce<we?ce:we,width:Math.abs(G-be),height:Math.abs(ce-we)},ke=D.current,De=H.current;D.current=new Set(_h(F,ve,I,n===el.Partial,!0).map(xe=>xe.id)),H.current=new Set;const oe=le?.selectable??!0;for(const xe of D.current){const Oe=z.get(xe);if(Oe)for(const{edgeId:wt}of Oe.values()){const ht=L.get(wt);ht&&(ht.selectable??oe)&&H.current.add(wt)}}if(!Pb(ke,D.current)){const xe=ci(F,D.current,!0);W(xe)}if(!Pb(De,H.current)){const xe=ci(L,H.current);ae(xe)}w.setState({userSelectionRect:ve,userSelectionActive:!0,nodesSelectionActive:!1})},A=K=>{K.button===0&&(K.target?.releasePointerCapture?.(K.pointerId),!E&&K.target===R.current&&w.getState().userSelectionRect&&B?.(K),w.setState({userSelectionActive:!1,userSelectionRect:null}),V.current&&(u?.(K),w.setState({nodesSelectionActive:D.current.size>0})))},q=r===!0||Array.isArray(r)&&r.includes(0);return d.jsxs("div",{className:Nt(["react-flow__pane",{draggable:q,dragging:M,selection:e}]),onClick:N?void 0:am(B,R),onContextMenu:am(O,R),onWheel:am(Y,R),onPointerEnter:N?void 0:g,onPointerMove:N?_:b,onPointerUp:N?A:void 0,onPointerDownCapture:N?U:void 0,onClickCapture:N?Z:void 0,onPointerLeave:y,ref:R,style:pd,children:[v,d.jsx(XN,{})]})}function nh({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:l,nodeLookup:u,onError:f}=t.getState(),m=u.get(e);if(!m){f?.("012",mo.error012(e));return}t.setState({nodesSelectionActive:!1}),m.selected?(n||m.selected&&l)&&(s({nodes:[m],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function uw({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:l}){const u=mt(),[f,m]=$.useState(!1),h=$.useRef();return $.useEffect(()=>{h.current=FA({getStoreItems:()=>u.getState(),onNodeMouseDown:g=>{nh({id:g,store:u,nodeRef:e})},onDragStart:()=>{m(!0)},onDragStop:()=>{m(!1)}})},[]),$.useEffect(()=>{if(!(t||!e.current||!h.current))return h.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:i,nodeClickDistance:l}),()=>{h.current?.destroy()}},[n,r,t,s,e,i,l]),f}const JN=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function dw(){const e=mt();return $.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:s,nodesDraggable:l,onError:u,updateNodePositions:f,nodeLookup:m,nodeOrigin:h}=e.getState(),g=new Map,b=JN(l),y=i?s[0]:5,v=i?s[1]:5,w=n.direction.x*y*n.factor,E=n.direction.y*v*n.factor;for(const[,C]of m){if(!b(C))continue;let M={x:C.internals.positionAbsolute.x+w,y:C.internals.positionAbsolute.y+E};i&&(M=xl(M,s));const{position:S,positionAbsolute:N}=Dv({nodeId:C.id,nextPosition:M,nodeLookup:m,nodeExtent:r,nodeOrigin:h,onError:u});C.position=S,C.internals.positionAbsolute=N,g.set(C.id,C)}f(g)},[])}const Ph=$.createContext(null),e4=Ph.Provider;Ph.Consumer;const pw=()=>$.useContext(Ph),t4=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),n4=(e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:l}=r,{fromHandle:u,toHandle:f,isValid:m}=l,h=f?.nodeId===e&&f?.id===t&&f?.type===n;return{connectingFrom:u?.nodeId===e&&u?.id===t&&u?.type===n,connectingTo:h,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:s===gi.Strict?u?.type!==n:e!==u?.nodeId||t!==u?.id,connectionInProcess:!!u,clickConnectionInProcess:!!i,valid:h&&m}};function o4({type:e="source",position:t=Te.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:l,onConnect:u,children:f,className:m,onMouseDown:h,onTouchStart:g,...b},y){const v=l||null,w=e==="target",E=mt(),C=pw(),{connectOnClick:M,noPanClassName:S,rfId:N}=Ye(t4,ft),{connectingFrom:R,connectingTo:T,clickConnecting:D,isPossibleEndHandle:H,connectionInProcess:V,clickConnectionInProcess:B,valid:O}=Ye(n4(C,v,e),ft);C||E.getState().onError?.("010",mo.error010());const Y=_=>{const{defaultEdgeOptions:A,onConnect:q,hasDefaultEdges:K}=E.getState(),Q={...A,..._};if(K){const{edges:I,setEdges:F}=E.getState();F(vA(Q,I))}q?.(Q),u?.(Q)},Z=_=>{if(!C)return;const A=Pv(_.nativeEvent);if(i&&(A&&_.button===0||!A)){const q=E.getState();th.onPointerDown(_.nativeEvent,{handleDomNode:_.currentTarget,autoPanOnConnect:q.autoPanOnConnect,connectionMode:q.connectionMode,connectionRadius:q.connectionRadius,domNode:q.domNode,nodeLookup:q.nodeLookup,lib:q.lib,isTarget:w,handleId:v,nodeId:C,flowId:q.rfId,panBy:q.panBy,cancelConnection:q.cancelConnection,onConnectStart:q.onConnectStart,onConnectEnd:(...K)=>E.getState().onConnectEnd?.(...K),updateConnection:q.updateConnection,onConnect:Y,isValidConnection:n||((...K)=>E.getState().isValidConnection?.(...K)??!0),getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,autoPanSpeed:q.autoPanSpeed,dragThreshold:q.connectionDragThreshold})}A?h?.(_):g?.(_)},U=_=>{const{onClickConnectStart:A,onClickConnectEnd:q,connectionClickStartHandle:K,connectionMode:Q,isValidConnection:I,lib:F,rfId:L,nodeLookup:z,connection:W}=E.getState();if(!C||!K&&!i)return;if(!K){A?.(_.nativeEvent,{nodeId:C,handleId:v,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:C,type:e,id:v}});return}const ae=$v(_.target),le=n||I,{connection:me,isValid:G}=th.isValid(_.nativeEvent,{handle:{nodeId:C,id:v,type:e},connectionMode:Q,fromNodeId:K.nodeId,fromHandleId:K.id||null,fromType:K.type,isValidConnection:le,flowId:L,doc:ae,lib:F,nodeLookup:z});G&&me&&Y(me);const ce=structuredClone(W);delete ce.inProgress,ce.toPosition=ce.toHandle?ce.toHandle.position:null,q?.(_,ce),E.setState({connectionClickStartHandle:null})};return d.jsx("div",{"data-handleid":v,"data-nodeid":C,"data-handlepos":t,"data-id":`${N}-${C}-${v}-${e}`,className:Nt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",S,m,{source:!w,target:w,connectable:r,connectablestart:i,connectableend:s,clickconnecting:D,connectingfrom:R,connectingto:T,valid:O,connectionindicator:r&&(!V||H)&&(V||B?s:i)}]),onMouseDown:Z,onTouchStart:Z,onClick:M?U:void 0,ref:y,...b,children:f})}const vi=$.memo(lw(o4));function r4({data:e,isConnectable:t,sourcePosition:n=Te.Bottom}){return d.jsxs(d.Fragment,{children:[e?.label,d.jsx(vi,{type:"source",position:n,isConnectable:t})]})}function a4({data:e,isConnectable:t,targetPosition:n=Te.Top,sourcePosition:r=Te.Bottom}){return d.jsxs(d.Fragment,{children:[d.jsx(vi,{type:"target",position:n,isConnectable:t}),e?.label,d.jsx(vi,{type:"source",position:r,isConnectable:t})]})}function i4(){return null}function s4({data:e,isConnectable:t,targetPosition:n=Te.Top}){return d.jsxs(d.Fragment,{children:[d.jsx(vi,{type:"target",position:n,isConnectable:t}),e?.label]})}const Hu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},g1={input:r4,default:a4,output:s4,group:i4};function l4(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const c4=e=>{const{width:t,height:n,x:r,y:i}=yl(e.nodeLookup,{filter:s=>!!s.selected});return{width:Zn(t)?t:null,height:Zn(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function u4({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=mt(),{width:i,height:s,transformString:l,userSelectionActive:u}=Ye(c4,ft),f=dw(),m=$.useRef(null);$.useEffect(()=>{n||m.current?.focus({preventScroll:!0})},[n]);const h=!u&&i!==null&&s!==null;if(uw({nodeRef:m,disabled:!h}),!h)return null;const g=e?y=>{const v=r.getState().nodes.filter(w=>w.selected);e(y,v)}:void 0,b=y=>{Object.prototype.hasOwnProperty.call(Hu,y.key)&&(y.preventDefault(),f({direction:Hu[y.key],factor:y.shiftKey?4:1}))};return d.jsx("div",{className:Nt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:d.jsx("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:b,style:{width:i,height:s}})})}const y1=typeof window<"u"?window:void 0,d4=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function fw({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:l,paneClickDistance:u,deleteKeyCode:f,selectionKeyCode:m,selectionOnDrag:h,selectionMode:g,onSelectionStart:b,onSelectionEnd:y,multiSelectionKeyCode:v,panActivationKeyCode:w,zoomActivationKeyCode:E,elementsSelectable:C,zoomOnScroll:M,zoomOnPinch:S,panOnScroll:N,panOnScrollSpeed:R,panOnScrollMode:T,zoomOnDoubleClick:D,panOnDrag:H,defaultViewport:V,translateExtent:B,minZoom:O,maxZoom:Y,preventScrolling:Z,onSelectionContextMenu:U,noWheelClassName:_,noPanClassName:A,disableKeyboardA11y:q,onViewportChange:K,isControlledViewport:Q}){const{nodesSelectionActive:I,userSelectionActive:F}=Ye(d4,ft),L=ol(m,{target:y1}),z=ol(w,{target:y1}),W=z||H,ae=z||N,le=h&&W!==!0,me=L||F||le;return GN({deleteKeyCode:f,multiSelectionKeyCode:v}),d.jsx(YN,{onPaneContextMenu:s,elementsSelectable:C,zoomOnScroll:M,zoomOnPinch:S,panOnScroll:ae,panOnScrollSpeed:R,panOnScrollMode:T,zoomOnDoubleClick:D,panOnDrag:!L&&W,defaultViewport:V,translateExtent:B,minZoom:O,maxZoom:Y,zoomActivationKeyCode:E,preventScrolling:Z,noWheelClassName:_,noPanClassName:A,onViewportChange:K,isControlledViewport:Q,paneClickDistance:u,selectionOnDrag:le,children:d.jsxs(QN,{onSelectionStart:b,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:l,panOnDrag:W,isSelecting:!!me,selectionMode:g,selectionKeyPressed:L,paneClickDistance:u,selectionOnDrag:le,children:[e,I&&d.jsx(u4,{onSelectionContextMenu:U,noPanClassName:A,disableKeyboardA11y:q})]})})}fw.displayName="FlowRenderer";const p4=$.memo(fw),f4=e=>t=>e?_h(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function m4(e){return Ye($.useCallback(f4(e),[e]),ft)}const h4=e=>e.updateNodeInternals;function g4(){const e=Ye(h4),[t]=$.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(i=>{const s=i.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:i.target,force:!0})}),e(r)}));return $.useEffect(()=>()=>{t?.disconnect()},[t]),t}function y4({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=mt(),s=$.useRef(null),l=$.useRef(null),u=$.useRef(e.sourcePosition),f=$.useRef(e.targetPosition),m=$.useRef(t),h=n&&!!e.internals.handleBounds;return $.useEffect(()=>{s.current&&!e.hidden&&(!h||l.current!==s.current)&&(l.current&&r?.unobserve(l.current),r?.observe(s.current),l.current=s.current)},[h,e.hidden]),$.useEffect(()=>()=>{l.current&&(r?.unobserve(l.current),l.current=null)},[]),$.useEffect(()=>{if(s.current){const g=m.current!==t,b=u.current!==e.sourcePosition,y=f.current!==e.targetPosition;(g||b||y)&&(m.current=t,u.current=e.sourcePosition,f.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function x4({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:s,onDoubleClick:l,nodesDraggable:u,elementsSelectable:f,nodesConnectable:m,nodesFocusable:h,resizeObserver:g,noDragClassName:b,noPanClassName:y,disableKeyboardA11y:v,rfId:w,nodeTypes:E,nodeClickDistance:C,onError:M}){const{node:S,internals:N,isParent:R}=Ye(G=>{const ce=G.nodeLookup.get(e),be=G.parentLookup.has(e);return{node:ce,internals:ce.internals,isParent:be}},ft);let T=S.type||"default",D=E?.[T]||g1[T];D===void 0&&(M?.("003",mo.error003(T)),T="default",D=E?.default||g1.default);const H=!!(S.draggable||u&&typeof S.draggable>"u"),V=!!(S.selectable||f&&typeof S.selectable>"u"),B=!!(S.connectable||m&&typeof S.connectable>"u"),O=!!(S.focusable||h&&typeof S.focusable>"u"),Y=mt(),Z=Iv(S),U=y4({node:S,nodeType:T,hasDimensions:Z,resizeObserver:g}),_=uw({nodeRef:U,disabled:S.hidden||!H,noDragClassName:b,handleSelector:S.dragHandle,nodeId:e,isSelectable:V,nodeClickDistance:C}),A=dw();if(S.hidden)return null;const q=qo(S),K=l4(S),Q=V||H||t||n||r||i,I=n?G=>n(G,{...N.userNode}):void 0,F=r?G=>r(G,{...N.userNode}):void 0,L=i?G=>i(G,{...N.userNode}):void 0,z=s?G=>s(G,{...N.userNode}):void 0,W=l?G=>l(G,{...N.userNode}):void 0,ae=G=>{const{selectNodesOnDrag:ce,nodeDragThreshold:be}=Y.getState();V&&(!ce||!H||be>0)&&nh({id:e,store:Y,nodeRef:U}),t&&t(G,{...N.userNode})},le=G=>{if(!(Lv(G.nativeEvent)||v)){if(Tv.includes(G.key)&&V){const ce=G.key==="Escape";nh({id:e,store:Y,unselect:ce,nodeRef:U})}else if(H&&S.selected&&Object.prototype.hasOwnProperty.call(Hu,G.key)){G.preventDefault();const{ariaLabelConfig:ce}=Y.getState();Y.setState({ariaLiveMessage:ce["node.a11yDescription.ariaLiveMessage"]({direction:G.key.replace("Arrow","").toLowerCase(),x:~~N.positionAbsolute.x,y:~~N.positionAbsolute.y})}),A({direction:Hu[G.key],factor:G.shiftKey?4:1})}}},me=()=>{if(v||!U.current?.matches(":focus-visible"))return;const{transform:G,width:ce,height:be,autoPanOnNodeFocus:we,setCenter:ve}=Y.getState();if(!we)return;_h(new Map([[e,S]]),{x:0,y:0,width:ce,height:be},G,!0).length>0||ve(S.position.x+q.width/2,S.position.y+q.height/2,{zoom:G[2]})};return d.jsx("div",{className:Nt(["react-flow__node",`react-flow__node-${T}`,{[y]:H},S.className,{selected:S.selected,selectable:V,parent:R,draggable:H,dragging:_}]),ref:U,style:{zIndex:N.z,transform:`translate(${N.positionAbsolute.x}px,${N.positionAbsolute.y}px)`,pointerEvents:Q?"all":"none",visibility:Z?"visible":"hidden",...S.style,...K},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:F,onMouseLeave:L,onContextMenu:z,onClick:ae,onDoubleClick:W,onKeyDown:O?le:void 0,tabIndex:O?0:void 0,onFocus:O?me:void 0,role:S.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":v?void 0:`${rw}-${w}`,"aria-label":S.ariaLabel,...S.domAttributes,children:d.jsx(e4,{value:e,children:d.jsx(D,{id:e,data:S.data,type:T,positionAbsoluteX:N.positionAbsolute.x,positionAbsoluteY:N.positionAbsolute.y,selected:S.selected??!1,selectable:V,draggable:H,deletable:S.deletable??!0,isConnectable:B,sourcePosition:S.sourcePosition,targetPosition:S.targetPosition,dragging:_,dragHandle:S.dragHandle,zIndex:N.z,parentId:S.parentId,...q})})})}var b4=$.memo(x4);const k4=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function mw(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=Ye(k4,ft),l=m4(e.onlyRenderVisibleElements),u=g4();return d.jsx("div",{className:"react-flow__nodes",style:pd,children:l.map(f=>d.jsx(b4,{id:f,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:u,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:s},f))})}mw.displayName="NodeRenderer";const v4=$.memo(mw);function w4(e){return Ye($.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const r=[];if(n.width&&n.height)for(const i of n.edges){const s=n.nodeLookup.get(i.source),l=n.nodeLookup.get(i.target);s&&l&&xA({sourceNode:s,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),ft)}const S4=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return d.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},C4=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return d.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},x1={[Lu.Arrow]:S4,[Lu.ArrowClosed]:C4};function E4(e){const t=mt();return $.useMemo(()=>Object.prototype.hasOwnProperty.call(x1,e)?x1[e]:(t.getState().onError?.("009",mo.error009(e)),null),[e])}const M4=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const f=E4(t);return f?d.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:u,refX:"0",refY:"0",children:d.jsx(f,{color:n,strokeWidth:l})}):null},hw=({defaultColor:e,rfId:t})=>{const n=Ye(s=>s.edges),r=Ye(s=>s.defaultEdgeOptions),i=$.useMemo(()=>MA(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?d.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:d.jsx("defs",{children:i.map(s=>d.jsx(M4,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};hw.displayName="MarkerDefinitions";var T4=$.memo(hw);function gw({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:s,labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:f,className:m,...h}){const[g,b]=$.useState({x:1,y:0,width:0,height:0}),y=Nt(["react-flow__edge-textwrapper",m]),v=$.useRef(null);return $.useEffect(()=>{if(v.current){const w=v.current.getBBox();b({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?d.jsxs("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:y,visibility:g.width?"visible":"hidden",...h,children:[i&&d.jsx("rect",{width:g.width+2*l[0],x:-l[0],y:-l[1],height:g.height+2*l[1],className:"react-flow__edge-textbg",style:s,rx:u,ry:u}),d.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:v,style:r,children:n}),f]}):null}gw.displayName="EdgeText";const j4=$.memo(gw);function fd({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,interactionWidth:m=20,...h}){return d.jsxs(d.Fragment,{children:[d.jsx("path",{...h,d:e,fill:"none",className:Nt(["react-flow__edge-path",h.className])}),m?d.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}):null,r&&Zn(t)&&Zn(n)?d.jsx(j4,{x:t,y:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f}):null]})}function b1({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Te.Left||e===Te.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function yw({sourceX:e,sourceY:t,sourcePosition:n=Te.Bottom,targetX:r,targetY:i,targetPosition:s=Te.Top}){const[l,u]=b1({pos:n,x1:e,y1:t,x2:r,y2:i}),[f,m]=b1({pos:s,x1:r,y1:i,x2:e,y2:t}),[h,g,b,y]=Bv({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:l,sourceControlY:u,targetControlX:f,targetControlY:m});return[`M${e},${t} C${l},${u} ${f},${m} ${r},${i}`,h,g,b,y]}function xw(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:l,targetPosition:u,label:f,labelStyle:m,labelShowBg:h,labelBgStyle:g,labelBgPadding:b,labelBgBorderRadius:y,style:v,markerEnd:w,markerStart:E,interactionWidth:C})=>{const[M,S,N]=yw({sourceX:n,sourceY:r,sourcePosition:l,targetX:i,targetY:s,targetPosition:u}),R=e.isInternal?void 0:t;return d.jsx(fd,{id:R,path:M,labelX:S,labelY:N,label:f,labelStyle:m,labelShowBg:h,labelBgStyle:g,labelBgPadding:b,labelBgBorderRadius:y,style:v,markerEnd:w,markerStart:E,interactionWidth:C})})}const A4=xw({isInternal:!1}),bw=xw({isInternal:!0});A4.displayName="SimpleBezierEdge";bw.displayName="SimpleBezierEdgeInternal";function kw(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:m,labelBgPadding:h,labelBgBorderRadius:g,style:b,sourcePosition:y=Te.Bottom,targetPosition:v=Te.Top,markerEnd:w,markerStart:E,pathOptions:C,interactionWidth:M})=>{const[S,N,R]=Qm({sourceX:n,sourceY:r,sourcePosition:y,targetX:i,targetY:s,targetPosition:v,borderRadius:C?.borderRadius,offset:C?.offset,stepPosition:C?.stepPosition}),T=e.isInternal?void 0:t;return d.jsx(fd,{id:T,path:S,labelX:N,labelY:R,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:m,labelBgPadding:h,labelBgBorderRadius:g,style:b,markerEnd:w,markerStart:E,interactionWidth:M})})}const vw=kw({isInternal:!1}),ww=kw({isInternal:!0});vw.displayName="SmoothStepEdge";ww.displayName="SmoothStepEdgeInternal";function Sw(e){return $.memo(({id:t,...n})=>{const r=e.isInternal?void 0:t;return d.jsx(vw,{...n,id:r,pathOptions:$.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const N4=Sw({isInternal:!1}),Cw=Sw({isInternal:!0});N4.displayName="StepEdge";Cw.displayName="StepEdgeInternal";function Ew(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:m,labelBgPadding:h,labelBgBorderRadius:g,style:b,markerEnd:y,markerStart:v,interactionWidth:w})=>{const[E,C,M]=qv({sourceX:n,sourceY:r,targetX:i,targetY:s}),S=e.isInternal?void 0:t;return d.jsx(fd,{id:S,path:E,labelX:C,labelY:M,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:m,labelBgPadding:h,labelBgBorderRadius:g,style:b,markerEnd:y,markerStart:v,interactionWidth:w})})}const _4=Ew({isInternal:!1}),Mw=Ew({isInternal:!0});_4.displayName="StraightEdge";Mw.displayName="StraightEdgeInternal";function Tw(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:l=Te.Bottom,targetPosition:u=Te.Top,label:f,labelStyle:m,labelShowBg:h,labelBgStyle:g,labelBgPadding:b,labelBgBorderRadius:y,style:v,markerEnd:w,markerStart:E,pathOptions:C,interactionWidth:M})=>{const[S,N,R]=Hv({sourceX:n,sourceY:r,sourcePosition:l,targetX:i,targetY:s,targetPosition:u,curvature:C?.curvature}),T=e.isInternal?void 0:t;return d.jsx(fd,{id:T,path:S,labelX:N,labelY:R,label:f,labelStyle:m,labelShowBg:h,labelBgStyle:g,labelBgPadding:b,labelBgBorderRadius:y,style:v,markerEnd:w,markerStart:E,interactionWidth:M})})}const D4=Tw({isInternal:!1}),jw=Tw({isInternal:!0});D4.displayName="BezierEdge";jw.displayName="BezierEdgeInternal";const k1={default:jw,straight:Mw,step:Cw,smoothstep:ww,simplebezier:bw},v1={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},z4=(e,t,n)=>n===Te.Left?e-t:n===Te.Right?e+t:e,R4=(e,t,n)=>n===Te.Top?e-t:n===Te.Bottom?e+t:e,w1="react-flow__edgeupdater";function S1({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:s,onMouseOut:l,type:u}){return d.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:l,className:Nt([w1,`${w1}-${u}`]),cx:z4(t,r,e),cy:R4(n,r,e),r,stroke:"transparent",fill:"transparent"})}function O4({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:s,targetY:l,sourcePosition:u,targetPosition:f,onReconnect:m,onReconnectStart:h,onReconnectEnd:g,setReconnecting:b,setUpdateHover:y}){const v=mt(),w=(N,R)=>{if(N.button!==0)return;const{autoPanOnConnect:T,domNode:D,connectionMode:H,connectionRadius:V,lib:B,onConnectStart:O,cancelConnection:Y,nodeLookup:Z,rfId:U,panBy:_,updateConnection:A}=v.getState(),q=R.type==="target",K=(F,L)=>{b(!1),g?.(F,n,R.type,L)},Q=F=>m?.(n,F),I=(F,L)=>{b(!0),h?.(N,n,R.type),O?.(F,L)};th.onPointerDown(N.nativeEvent,{autoPanOnConnect:T,connectionMode:H,connectionRadius:V,domNode:D,handleId:R.id,nodeId:R.nodeId,nodeLookup:Z,isTarget:q,edgeUpdaterType:R.type,lib:B,flowId:U,cancelConnection:Y,panBy:_,isValidConnection:(...F)=>v.getState().isValidConnection?.(...F)??!0,onConnect:Q,onConnectStart:I,onConnectEnd:(...F)=>v.getState().onConnectEnd?.(...F),onReconnectEnd:K,updateConnection:A,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,dragThreshold:v.getState().connectionDragThreshold,handleDomNode:N.currentTarget})},E=N=>w(N,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),C=N=>w(N,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),M=()=>y(!0),S=()=>y(!1);return d.jsxs(d.Fragment,{children:[(e===!0||e==="source")&&d.jsx(S1,{position:u,centerX:r,centerY:i,radius:t,onMouseDown:E,onMouseEnter:M,onMouseOut:S,type:"source"}),(e===!0||e==="target")&&d.jsx(S1,{position:f,centerX:s,centerY:l,radius:t,onMouseDown:C,onMouseEnter:M,onMouseOut:S,type:"target"})]})}function I4({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:s,onContextMenu:l,onMouseEnter:u,onMouseMove:f,onMouseLeave:m,reconnectRadius:h,onReconnect:g,onReconnectStart:b,onReconnectEnd:y,rfId:v,edgeTypes:w,noPanClassName:E,onError:C,disableKeyboardA11y:M}){let S=Ye(ve=>ve.edgeLookup.get(e));const N=Ye(ve=>ve.defaultEdgeOptions);S=N?{...N,...S}:S;let R=S.type||"default",T=w?.[R]||k1[R];T===void 0&&(C?.("011",mo.error011(R)),R="default",T=w?.default||k1.default);const D=!!(S.focusable||t&&typeof S.focusable>"u"),H=typeof g<"u"&&(S.reconnectable||n&&typeof S.reconnectable>"u"),V=!!(S.selectable||r&&typeof S.selectable>"u"),B=$.useRef(null),[O,Y]=$.useState(!1),[Z,U]=$.useState(!1),_=mt(),{zIndex:A,sourceX:q,sourceY:K,targetX:Q,targetY:I,sourcePosition:F,targetPosition:L}=Ye($.useCallback(ve=>{const ke=ve.nodeLookup.get(S.source),De=ve.nodeLookup.get(S.target);if(!ke||!De)return{zIndex:S.zIndex,...v1};const oe=EA({id:e,sourceNode:ke,targetNode:De,sourceHandle:S.sourceHandle||null,targetHandle:S.targetHandle||null,connectionMode:ve.connectionMode,onError:C});return{zIndex:yA({selected:S.selected,zIndex:S.zIndex,sourceNode:ke,targetNode:De,elevateOnSelect:ve.elevateEdgesOnSelect,zIndexMode:ve.zIndexMode}),...oe||v1}},[S.source,S.target,S.sourceHandle,S.targetHandle,S.selected,S.zIndex]),ft),z=$.useMemo(()=>S.markerStart?`url('#${Jm(S.markerStart,v)}')`:void 0,[S.markerStart,v]),W=$.useMemo(()=>S.markerEnd?`url('#${Jm(S.markerEnd,v)}')`:void 0,[S.markerEnd,v]);if(S.hidden||q===null||K===null||Q===null||I===null)return null;const ae=ve=>{const{addSelectedEdges:ke,unselectNodesAndEdges:De,multiSelectionActive:oe}=_.getState();V&&(_.setState({nodesSelectionActive:!1}),S.selected&&oe?(De({nodes:[],edges:[S]}),B.current?.blur()):ke([e])),i&&i(ve,S)},le=s?ve=>{s(ve,{...S})}:void 0,me=l?ve=>{l(ve,{...S})}:void 0,G=u?ve=>{u(ve,{...S})}:void 0,ce=f?ve=>{f(ve,{...S})}:void 0,be=m?ve=>{m(ve,{...S})}:void 0,we=ve=>{if(!M&&Tv.includes(ve.key)&&V){const{unselectNodesAndEdges:ke,addSelectedEdges:De}=_.getState();ve.key==="Escape"?(B.current?.blur(),ke({edges:[S]})):De([e])}};return d.jsx("svg",{style:{zIndex:A},children:d.jsxs("g",{className:Nt(["react-flow__edge",`react-flow__edge-${R}`,S.className,E,{selected:S.selected,animated:S.animated,inactive:!V&&!i,updating:O,selectable:V}]),onClick:ae,onDoubleClick:le,onContextMenu:me,onMouseEnter:G,onMouseMove:ce,onMouseLeave:be,onKeyDown:D?we:void 0,tabIndex:D?0:void 0,role:S.ariaRole??(D?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":S.ariaLabel===null?void 0:S.ariaLabel||`Edge from ${S.source} to ${S.target}`,"aria-describedby":D?`${aw}-${v}`:void 0,ref:B,...S.domAttributes,children:[!Z&&d.jsx(T,{id:e,source:S.source,target:S.target,type:S.type,selected:S.selected,animated:S.animated,selectable:V,deletable:S.deletable??!0,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,sourceX:q,sourceY:K,targetX:Q,targetY:I,sourcePosition:F,targetPosition:L,data:S.data,style:S.style,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerStart:z,markerEnd:W,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth}),H&&d.jsx(O4,{edge:S,isReconnectable:H,reconnectRadius:h,onReconnect:g,onReconnectStart:b,onReconnectEnd:y,sourceX:q,sourceY:K,targetX:Q,targetY:I,sourcePosition:F,targetPosition:L,setUpdateHover:Y,setReconnecting:U})]})})}var F4=$.memo(I4);const $4=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Aw({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:s,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:m,onEdgeClick:h,reconnectRadius:g,onEdgeDoubleClick:b,onReconnectStart:y,onReconnectEnd:v,disableKeyboardA11y:w}){const{edgesFocusable:E,edgesReconnectable:C,elementsSelectable:M,onError:S}=Ye($4,ft),N=w4(t);return d.jsxs("div",{className:"react-flow__edges",children:[d.jsx(T4,{defaultColor:e,rfId:n}),N.map(R=>d.jsx(F4,{id:R,edgesFocusable:E,edgesReconnectable:C,elementsSelectable:M,noPanClassName:i,onReconnect:s,onContextMenu:l,onMouseEnter:u,onMouseMove:f,onMouseLeave:m,onClick:h,reconnectRadius:g,onDoubleClick:b,onReconnectStart:y,onReconnectEnd:v,rfId:n,onError:S,edgeTypes:r,disableKeyboardA11y:w},R))]})}Aw.displayName="EdgeRenderer";const L4=$.memo(Aw),P4=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function B4({children:e}){const t=Ye(P4);return d.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function H4(e){const t=Lh(),n=$.useRef(!1);$.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const U4=e=>e.panZoom?.syncViewport;function q4(e){const t=Ye(U4),n=mt();return $.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function G4(e){return e.connection.inProgress?{...e.connection,to:bl(e.connection.to,e.transform)}:{...e.connection}}function K4(e){return G4}function V4(e){const t=K4();return Ye(t,ft)}const Y4=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function W4({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:s,height:l,isValid:u,inProgress:f}=Ye(Y4,ft);return!(s&&i&&f)?null:d.jsx("svg",{style:e,width:s,height:l,className:"react-flow__connectionline react-flow__container",children:d.jsx("g",{className:Nt(["react-flow__connection",Nv(u)]),children:d.jsx(Nw,{style:t,type:n,CustomComponent:r,isValid:u})})})}const Nw=({style:e,type:t=jr.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:s,fromNode:l,fromHandle:u,fromPosition:f,to:m,toNode:h,toHandle:g,toPosition:b,pointer:y}=V4();if(!i)return;if(n)return d.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:l,fromHandle:u,fromX:s.x,fromY:s.y,toX:m.x,toY:m.y,fromPosition:f,toPosition:b,connectionStatus:Nv(r),toNode:h,toHandle:g,pointer:y});let v="";const w={sourceX:s.x,sourceY:s.y,sourcePosition:f,targetX:m.x,targetY:m.y,targetPosition:b};switch(t){case jr.Bezier:[v]=Hv(w);break;case jr.SimpleBezier:[v]=yw(w);break;case jr.Step:[v]=Qm({...w,borderRadius:0});break;case jr.SmoothStep:[v]=Qm(w);break;default:[v]=qv(w)}return d.jsx("path",{d:v,fill:"none",className:"react-flow__connection-path",style:e})};Nw.displayName="ConnectionLine";const X4={};function C1(e=X4){$.useRef(e),mt(),$.useEffect(()=>{},[e])}function Z4(){mt(),$.useRef(!1),$.useEffect(()=>{},[])}function _w({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:f,onNodeMouseLeave:m,onNodeContextMenu:h,onSelectionContextMenu:g,onSelectionStart:b,onSelectionEnd:y,connectionLineType:v,connectionLineStyle:w,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:M,selectionOnDrag:S,selectionMode:N,multiSelectionKeyCode:R,panActivationKeyCode:T,zoomActivationKeyCode:D,deleteKeyCode:H,onlyRenderVisibleElements:V,elementsSelectable:B,defaultViewport:O,translateExtent:Y,minZoom:Z,maxZoom:U,preventScrolling:_,defaultMarkerColor:A,zoomOnScroll:q,zoomOnPinch:K,panOnScroll:Q,panOnScrollSpeed:I,panOnScrollMode:F,zoomOnDoubleClick:L,panOnDrag:z,onPaneClick:W,onPaneMouseEnter:ae,onPaneMouseMove:le,onPaneMouseLeave:me,onPaneScroll:G,onPaneContextMenu:ce,paneClickDistance:be,nodeClickDistance:we,onEdgeContextMenu:ve,onEdgeMouseEnter:ke,onEdgeMouseMove:De,onEdgeMouseLeave:oe,reconnectRadius:xe,onReconnect:Oe,onReconnectStart:wt,onReconnectEnd:ht,noDragClassName:St,noWheelClassName:hn,noPanClassName:en,disableKeyboardA11y:gn,nodeExtent:_t,rfId:Vo,viewport:ue,onViewportChange:ye}){return C1(e),C1(t),Z4(),H4(n),q4(ue),d.jsx(p4,{onPaneClick:W,onPaneMouseEnter:ae,onPaneMouseMove:le,onPaneMouseLeave:me,onPaneContextMenu:ce,onPaneScroll:G,paneClickDistance:be,deleteKeyCode:H,selectionKeyCode:M,selectionOnDrag:S,selectionMode:N,onSelectionStart:b,onSelectionEnd:y,multiSelectionKeyCode:R,panActivationKeyCode:T,zoomActivationKeyCode:D,elementsSelectable:B,zoomOnScroll:q,zoomOnPinch:K,zoomOnDoubleClick:L,panOnScroll:Q,panOnScrollSpeed:I,panOnScrollMode:F,panOnDrag:z,defaultViewport:O,translateExtent:Y,minZoom:Z,maxZoom:U,onSelectionContextMenu:g,preventScrolling:_,noDragClassName:St,noWheelClassName:hn,noPanClassName:en,disableKeyboardA11y:gn,onViewportChange:ye,isControlledViewport:!!ue,children:d.jsxs(B4,{children:[d.jsx(L4,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:l,onReconnect:Oe,onReconnectStart:wt,onReconnectEnd:ht,onlyRenderVisibleElements:V,onEdgeContextMenu:ve,onEdgeMouseEnter:ke,onEdgeMouseMove:De,onEdgeMouseLeave:oe,reconnectRadius:xe,defaultMarkerColor:A,noPanClassName:en,disableKeyboardA11y:gn,rfId:Vo}),d.jsx(W4,{style:w,type:v,component:E,containerStyle:C}),d.jsx("div",{className:"react-flow__edgelabel-renderer"}),d.jsx(v4,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:u,onNodeMouseMove:f,onNodeMouseLeave:m,onNodeContextMenu:h,nodeClickDistance:we,onlyRenderVisibleElements:V,noPanClassName:en,noDragClassName:St,disableKeyboardA11y:gn,nodeExtent:_t,rfId:Vo}),d.jsx("div",{className:"react-flow__viewport-portal"})]})})}_w.displayName="GraphView";const Q4=$.memo(_w),E1=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:l,fitViewOptions:u,minZoom:f=.5,maxZoom:m=2,nodeOrigin:h,nodeExtent:g,zIndexMode:b="basic"}={})=>{const y=new Map,v=new Map,w=new Map,E=new Map,C=r??t??[],M=n??e??[],S=h??[0,0],N=g??Js;Vv(w,E,C);const R=eh(M,y,v,{nodeOrigin:S,nodeExtent:N,zIndexMode:b});let T=[0,0,1];if(l&&i&&s){const D=yl(y,{filter:O=>!!((O.width||O.initialWidth)&&(O.height||O.initialHeight))}),{x:H,y:V,zoom:B}=Dh(D,i,s,f,m,u?.padding??.1);T=[H,V,B]}return{rfId:"1",width:i??0,height:s??0,transform:T,nodes:M,nodesInitialized:R,nodeLookup:y,parentLookup:v,edges:C,edgeLookup:E,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:f,maxZoom:m,translateExtent:Js,nodeExtent:N,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:gi.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:S,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:l??!1,fitViewOptions:u,fitViewResolver:null,connection:{...Av},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:dA,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:jv,zIndexMode:b,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},J4=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:l,fitViewOptions:u,minZoom:f,maxZoom:m,nodeOrigin:h,nodeExtent:g,zIndexMode:b})=>hN((y,v)=>{async function w(){const{nodeLookup:E,panZoom:C,fitViewOptions:M,fitViewResolver:S,width:N,height:R,minZoom:T,maxZoom:D}=v();C&&(await cA({nodes:E,width:N,height:R,panZoom:C,minZoom:T,maxZoom:D},M),S?.resolve(!0),y({fitViewResolver:null}))}return{...E1({nodes:e,edges:t,width:i,height:s,fitView:l,fitViewOptions:u,minZoom:f,maxZoom:m,nodeOrigin:h,nodeExtent:g,defaultNodes:n,defaultEdges:r,zIndexMode:b}),setNodes:E=>{const{nodeLookup:C,parentLookup:M,nodeOrigin:S,elevateNodesOnSelect:N,fitViewQueued:R,zIndexMode:T}=v(),D=eh(E,C,M,{nodeOrigin:S,nodeExtent:g,elevateNodesOnSelect:N,checkEquality:!0,zIndexMode:T});R&&D?(w(),y({nodes:E,nodesInitialized:D,fitViewQueued:!1,fitViewOptions:void 0})):y({nodes:E,nodesInitialized:D})},setEdges:E=>{const{connectionLookup:C,edgeLookup:M}=v();Vv(C,M,E),y({edges:E})},setDefaultNodesAndEdges:(E,C)=>{if(E){const{setNodes:M}=v();M(E),y({hasDefaultNodes:!0})}if(C){const{setEdges:M}=v();M(C),y({hasDefaultEdges:!0})}},updateNodeInternals:E=>{const{triggerNodeChanges:C,nodeLookup:M,parentLookup:S,domNode:N,nodeOrigin:R,nodeExtent:T,debug:D,fitViewQueued:H,zIndexMode:V}=v(),{changes:B,updatedInternals:O}=zA(E,M,S,N,R,T,V);O&&(AA(M,S,{nodeOrigin:R,nodeExtent:T,zIndexMode:V}),H?(w(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),B?.length>0&&(D&&console.log("React Flow: trigger node changes",B),C?.(B)))},updateNodePositions:(E,C=!1)=>{const M=[];let S=[];const{nodeLookup:N,triggerNodeChanges:R,connection:T,updateConnection:D,onNodesChangeMiddlewareMap:H}=v();for(const[V,B]of E){const O=N.get(V),Y=!!(O?.expandParent&&O?.parentId&&B?.position),Z={id:V,type:"position",position:Y?{x:Math.max(0,B.position.x),y:Math.max(0,B.position.y)}:B.position,dragging:C};if(O&&T.inProgress&&T.fromNode.id===O.id){const U=ma(O,T.fromHandle,Te.Left,!0);D({...T,from:U})}Y&&O.parentId&&M.push({id:V,parentId:O.parentId,rect:{...B.internals.positionAbsolute,width:B.measured.width??0,height:B.measured.height??0}}),S.push(Z)}if(M.length>0){const{parentLookup:V,nodeOrigin:B}=v(),O=$h(M,N,V,B);S.push(...O)}for(const V of H.values())S=V(S);R(S)},triggerNodeChanges:E=>{const{onNodesChange:C,setNodes:M,nodes:S,hasDefaultNodes:N,debug:R}=v();if(E?.length){if(N){const T=IN(E,S);M(T)}R&&console.log("React Flow: trigger node changes",E),C?.(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:C,setEdges:M,edges:S,hasDefaultEdges:N,debug:R}=v();if(E?.length){if(N){const T=FN(E,S);M(T)}R&&console.log("React Flow: trigger edge changes",E),C?.(E)}},addSelectedNodes:E=>{const{multiSelectionActive:C,edgeLookup:M,nodeLookup:S,triggerNodeChanges:N,triggerEdgeChanges:R}=v();if(C){const T=E.map(D=>oa(D,!0));N(T);return}N(ci(S,new Set([...E]),!0)),R(ci(M))},addSelectedEdges:E=>{const{multiSelectionActive:C,edgeLookup:M,nodeLookup:S,triggerNodeChanges:N,triggerEdgeChanges:R}=v();if(C){const T=E.map(D=>oa(D,!0));R(T);return}R(ci(M,new Set([...E]))),N(ci(S,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:C}={})=>{const{edges:M,nodes:S,nodeLookup:N,triggerNodeChanges:R,triggerEdgeChanges:T}=v(),D=E||S,H=C||M,V=[];for(const O of D){if(!O.selected)continue;const Y=N.get(O.id);Y&&(Y.selected=!1),V.push(oa(O.id,!1))}const B=[];for(const O of H)O.selected&&B.push(oa(O.id,!1));R(V),T(B)},setMinZoom:E=>{const{panZoom:C,maxZoom:M}=v();C?.setScaleExtent([E,M]),y({minZoom:E})},setMaxZoom:E=>{const{panZoom:C,minZoom:M}=v();C?.setScaleExtent([M,E]),y({maxZoom:E})},setTranslateExtent:E=>{v().panZoom?.setTranslateExtent(E),y({translateExtent:E})},resetSelectedElements:()=>{const{edges:E,nodes:C,triggerNodeChanges:M,triggerEdgeChanges:S,elementsSelectable:N}=v();if(!N)return;const R=C.reduce((D,H)=>H.selected?[...D,oa(H.id,!1)]:D,[]),T=E.reduce((D,H)=>H.selected?[...D,oa(H.id,!1)]:D,[]);M(R),S(T)},setNodeExtent:E=>{const{nodes:C,nodeLookup:M,parentLookup:S,nodeOrigin:N,elevateNodesOnSelect:R,nodeExtent:T,zIndexMode:D}=v();E[0][0]===T[0][0]&&E[0][1]===T[0][1]&&E[1][0]===T[1][0]&&E[1][1]===T[1][1]||(eh(C,M,S,{nodeOrigin:N,nodeExtent:E,elevateNodesOnSelect:R,checkEquality:!1,zIndexMode:D}),y({nodeExtent:E}))},panBy:E=>{const{transform:C,width:M,height:S,panZoom:N,translateExtent:R}=v();return RA({delta:E,panZoom:N,transform:C,translateExtent:R,width:M,height:S})},setCenter:async(E,C,M)=>{const{width:S,height:N,maxZoom:R,panZoom:T}=v();if(!T)return Promise.resolve(!1);const D=typeof M?.zoom<"u"?M.zoom:R;return await T.setViewport({x:S/2-E*D,y:N/2-C*D,zoom:D},{duration:M?.duration,ease:M?.ease,interpolate:M?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{y({connection:{...Av}})},updateConnection:E=>{y({connection:E})},reset:()=>y({...E1()})}},Object.is);function e3({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:s,initialMinZoom:l,initialMaxZoom:u,initialFitViewOptions:f,fitView:m,nodeOrigin:h,nodeExtent:g,zIndexMode:b,children:y}){const[v]=$.useState(()=>J4({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:m,minZoom:l,maxZoom:u,fitViewOptions:f,nodeOrigin:h,nodeExtent:g,zIndexMode:b}));return d.jsx(gN,{value:v,children:d.jsx(BN,{children:y})})}function t3({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:l,fitView:u,fitViewOptions:f,minZoom:m,maxZoom:h,nodeOrigin:g,nodeExtent:b,zIndexMode:y}){return $.useContext(ud)?d.jsx(d.Fragment,{children:e}):d.jsx(e3,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:l,fitView:u,initialFitViewOptions:f,initialMinZoom:m,initialMaxZoom:h,nodeOrigin:g,nodeExtent:b,zIndexMode:y,children:e})}const n3={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function o3({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:s,edgeTypes:l,onNodeClick:u,onEdgeClick:f,onInit:m,onMove:h,onMoveStart:g,onMoveEnd:b,onConnect:y,onConnectStart:v,onConnectEnd:w,onClickConnectStart:E,onClickConnectEnd:C,onNodeMouseEnter:M,onNodeMouseMove:S,onNodeMouseLeave:N,onNodeContextMenu:R,onNodeDoubleClick:T,onNodeDragStart:D,onNodeDrag:H,onNodeDragStop:V,onNodesDelete:B,onEdgesDelete:O,onDelete:Y,onSelectionChange:Z,onSelectionDragStart:U,onSelectionDrag:_,onSelectionDragStop:A,onSelectionContextMenu:q,onSelectionStart:K,onSelectionEnd:Q,onBeforeDelete:I,connectionMode:F,connectionLineType:L=jr.Bezier,connectionLineStyle:z,connectionLineComponent:W,connectionLineContainerStyle:ae,deleteKeyCode:le="Backspace",selectionKeyCode:me="Shift",selectionOnDrag:G=!1,selectionMode:ce=el.Full,panActivationKeyCode:be="Space",multiSelectionKeyCode:we=nl()?"Meta":"Control",zoomActivationKeyCode:ve=nl()?"Meta":"Control",snapToGrid:ke,snapGrid:De,onlyRenderVisibleElements:oe=!1,selectNodesOnDrag:xe,nodesDraggable:Oe,autoPanOnNodeFocus:wt,nodesConnectable:ht,nodesFocusable:St,nodeOrigin:hn=iw,edgesFocusable:en,edgesReconnectable:gn,elementsSelectable:_t=!0,defaultViewport:Vo=AN,minZoom:ue=.5,maxZoom:ye=2,translateExtent:Ne=Js,preventScrolling:Le=!0,nodeExtent:Ke,defaultMarkerColor:Zt="#b1b1b7",zoomOnScroll:Un=!0,zoomOnPinch:Lt=!0,panOnScroll:xt=!1,panOnScrollSpeed:Gt=.5,panOnScrollMode:Qe=la.Free,zoomOnDoubleClick:to=!0,panOnDrag:yn=!0,onPaneClick:Ad,onPaneMouseEnter:xa,onPaneMouseMove:ba,onPaneMouseLeave:ka,onPaneScroll:yo,onPaneContextMenu:va,paneClickDistance:zr=1,nodeClickDistance:Nd=0,children:Nl,onReconnect:Ai,onReconnectStart:Rr,onReconnectEnd:_d,onEdgeContextMenu:_l,onEdgeDoubleClick:Dl,onEdgeMouseEnter:zl,onEdgeMouseMove:Ni,onEdgeMouseLeave:_i,reconnectRadius:Rl=10,onNodesChange:Ol,onEdgesChange:no,noDragClassName:Dt="nodrag",noWheelClassName:Kt="nowheel",noPanClassName:xo="nopan",fitView:wa,fitViewOptions:Il,connectOnClick:Dd,attributionPosition:Fl,proOptions:Or,defaultEdgeOptions:Di,elevateNodesOnSelect:Yo=!0,elevateEdgesOnSelect:Wo=!1,disableKeyboardA11y:Xo=!1,autoPanOnConnect:Zo,autoPanOnNodeDrag:Ct,autoPanSpeed:$l,connectionRadius:Ll,isValidConnection:bo,onError:Qo,style:zd,id:zi,nodeDragThreshold:Pl,connectionDragThreshold:Rd,viewport:Sa,onViewportChange:Ca,width:qn,height:tn,colorMode:Bl="light",debug:Od,onScroll:Ea,ariaLabelConfig:Hl,zIndexMode:Ir="basic",...Id},nn){const Fr=zi||"1",Ul=zN(Bl),Ri=$.useCallback(ko=>{ko.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ea?.(ko)},[Ea]);return d.jsx("div",{"data-testid":"rf__wrapper",...Id,onScroll:Ri,style:{...zd,...n3},ref:nn,className:Nt(["react-flow",i,Ul]),id:zi,role:"application",children:d.jsxs(t3,{nodes:e,edges:t,width:qn,height:tn,fitView:wa,fitViewOptions:Il,minZoom:ue,maxZoom:ye,nodeOrigin:hn,nodeExtent:Ke,zIndexMode:Ir,children:[d.jsx(Q4,{onInit:m,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:M,onNodeMouseMove:S,onNodeMouseLeave:N,onNodeContextMenu:R,onNodeDoubleClick:T,nodeTypes:s,edgeTypes:l,connectionLineType:L,connectionLineStyle:z,connectionLineComponent:W,connectionLineContainerStyle:ae,selectionKeyCode:me,selectionOnDrag:G,selectionMode:ce,deleteKeyCode:le,multiSelectionKeyCode:we,panActivationKeyCode:be,zoomActivationKeyCode:ve,onlyRenderVisibleElements:oe,defaultViewport:Vo,translateExtent:Ne,minZoom:ue,maxZoom:ye,preventScrolling:Le,zoomOnScroll:Un,zoomOnPinch:Lt,zoomOnDoubleClick:to,panOnScroll:xt,panOnScrollSpeed:Gt,panOnScrollMode:Qe,panOnDrag:yn,onPaneClick:Ad,onPaneMouseEnter:xa,onPaneMouseMove:ba,onPaneMouseLeave:ka,onPaneScroll:yo,onPaneContextMenu:va,paneClickDistance:zr,nodeClickDistance:Nd,onSelectionContextMenu:q,onSelectionStart:K,onSelectionEnd:Q,onReconnect:Ai,onReconnectStart:Rr,onReconnectEnd:_d,onEdgeContextMenu:_l,onEdgeDoubleClick:Dl,onEdgeMouseEnter:zl,onEdgeMouseMove:Ni,onEdgeMouseLeave:_i,reconnectRadius:Rl,defaultMarkerColor:Zt,noDragClassName:Dt,noWheelClassName:Kt,noPanClassName:xo,rfId:Fr,disableKeyboardA11y:Xo,nodeExtent:Ke,viewport:Sa,onViewportChange:Ca}),d.jsx(DN,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:y,onConnectStart:v,onConnectEnd:w,onClickConnectStart:E,onClickConnectEnd:C,nodesDraggable:Oe,autoPanOnNodeFocus:wt,nodesConnectable:ht,nodesFocusable:St,edgesFocusable:en,edgesReconnectable:gn,elementsSelectable:_t,elevateNodesOnSelect:Yo,elevateEdgesOnSelect:Wo,minZoom:ue,maxZoom:ye,nodeExtent:Ke,onNodesChange:Ol,onEdgesChange:no,snapToGrid:ke,snapGrid:De,connectionMode:F,translateExtent:Ne,connectOnClick:Dd,defaultEdgeOptions:Di,fitView:wa,fitViewOptions:Il,onNodesDelete:B,onEdgesDelete:O,onDelete:Y,onNodeDragStart:D,onNodeDrag:H,onNodeDragStop:V,onSelectionDrag:_,onSelectionDragStart:U,onSelectionDragStop:A,onMove:h,onMoveStart:g,onMoveEnd:b,noPanClassName:xo,nodeOrigin:hn,rfId:Fr,autoPanOnConnect:Zo,autoPanOnNodeDrag:Ct,autoPanSpeed:$l,onError:Qo,connectionRadius:Ll,isValidConnection:bo,selectNodesOnDrag:xe,nodeDragThreshold:Pl,connectionDragThreshold:Rd,onBeforeDelete:I,debug:Od,ariaLabelConfig:Hl,zIndexMode:Ir}),d.jsx(jN,{onSelectionChange:Z}),Nl,d.jsx(SN,{proOptions:Or,position:Fl}),d.jsx(wN,{rfId:Fr,disableKeyboardA11y:Xo})]})})}lw(o3);function r3({dimensions:e,lineWidth:t,variant:n,className:r}){return d.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Nt(["react-flow__background-pattern",n,r])})}function a3({radius:e,className:t}){return d.jsx("circle",{cx:e,cy:e,r:e,className:Nt(["react-flow__background-pattern","dots",t])})}var _r;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(_r||(_r={}));const i3={[_r.Dots]:1,[_r.Lines]:1,[_r.Cross]:6},s3=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Dw({id:e,variant:t=_r.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:l,bgColor:u,style:f,className:m,patternClassName:h}){const g=$.useRef(null),{transform:b,patternId:y}=Ye(s3,ft),v=r||i3[t],w=t===_r.Dots,E=t===_r.Cross,C=Array.isArray(n)?n:[n,n],M=[C[0]*b[2]||1,C[1]*b[2]||1],S=v*b[2],N=Array.isArray(s)?s:[s,s],R=E?[S,S]:M,T=[N[0]*b[2]||1+R[0]/2,N[1]*b[2]||1+R[1]/2],D=`${y}${e||""}`;return d.jsxs("svg",{className:Nt(["react-flow__background",m]),style:{...f,...pd,"--xy-background-color-props":u,"--xy-background-pattern-color-props":l},ref:g,"data-testid":"rf__background",children:[d.jsx("pattern",{id:D,x:b[0]%M[0],y:b[1]%M[1],width:M[0],height:M[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:w?d.jsx(a3,{radius:S/2,className:h}):d.jsx(r3,{dimensions:R,lineWidth:i,variant:t,className:h})}),d.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${D})`})]})}Dw.displayName="Background";$.memo(Dw);function l3(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:d.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function c3(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:d.jsx("path",{d:"M0 0h32v4.2H0z"})})}function u3(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:d.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function d3(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:d.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function p3(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:d.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function lu({children:e,className:t,...n}){return d.jsx("button",{type:"button",className:Nt(["react-flow__controls-button",t]),...n,children:e})}const f3=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function zw({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:l,onFitView:u,onInteractiveChange:f,className:m,children:h,position:g="bottom-left",orientation:b="vertical","aria-label":y}){const v=mt(),{isInteractive:w,minZoomReached:E,maxZoomReached:C,ariaLabelConfig:M}=Ye(f3,ft),{zoomIn:S,zoomOut:N,fitView:R}=Lh(),T=()=>{S(),s?.()},D=()=>{N(),l?.()},H=()=>{R(i),u?.()},V=()=>{v.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),f?.(!w)},B=b==="horizontal"?"horizontal":"vertical";return d.jsxs(dd,{className:Nt(["react-flow__controls",B,m]),position:g,style:e,"data-testid":"rf__controls","aria-label":y??M["controls.ariaLabel"],children:[t&&d.jsxs(d.Fragment,{children:[d.jsx(lu,{onClick:T,className:"react-flow__controls-zoomin",title:M["controls.zoomIn.ariaLabel"],"aria-label":M["controls.zoomIn.ariaLabel"],disabled:C,children:d.jsx(l3,{})}),d.jsx(lu,{onClick:D,className:"react-flow__controls-zoomout",title:M["controls.zoomOut.ariaLabel"],"aria-label":M["controls.zoomOut.ariaLabel"],disabled:E,children:d.jsx(c3,{})})]}),n&&d.jsx(lu,{className:"react-flow__controls-fitview",onClick:H,title:M["controls.fitView.ariaLabel"],"aria-label":M["controls.fitView.ariaLabel"],children:d.jsx(u3,{})}),r&&d.jsx(lu,{className:"react-flow__controls-interactive",onClick:V,title:M["controls.interactive.ariaLabel"],"aria-label":M["controls.interactive.ariaLabel"],children:w?d.jsx(p3,{}):d.jsx(d3,{})}),h]})}zw.displayName="Controls";$.memo(zw);function m3({id:e,x:t,y:n,width:r,height:i,style:s,color:l,strokeColor:u,strokeWidth:f,className:m,borderRadius:h,shapeRendering:g,selected:b,onClick:y}){const{background:v,backgroundColor:w}=s||{},E=l||v||w;return d.jsx("rect",{className:Nt(["react-flow__minimap-node",{selected:b},m]),x:t,y:n,rx:h,ry:h,width:r,height:i,style:{fill:E,stroke:u,strokeWidth:f},shapeRendering:g,onClick:y?C=>y(C,e):void 0})}const h3=$.memo(m3),g3=e=>e.nodes.map(t=>t.id),im=e=>e instanceof Function?e:()=>e;function y3({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=h3,onClick:l}){const u=Ye(g3,ft),f=im(t),m=im(e),h=im(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return d.jsx(d.Fragment,{children:u.map(b=>d.jsx(b3,{id:b,nodeColorFunc:f,nodeStrokeColorFunc:m,nodeClassNameFunc:h,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:l,shapeRendering:g},b))})}function x3({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:l,NodeComponent:u,onClick:f}){const{node:m,x:h,y:g,width:b,height:y}=Ye(v=>{const w=v.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const E=w.internals.userNode,{x:C,y:M}=w.internals.positionAbsolute,{width:S,height:N}=qo(E);return{node:E,x:C,y:M,width:S,height:N}},ft);return!m||m.hidden||!Iv(m)?null:d.jsx(u,{x:h,y:g,width:b,height:y,style:m.style,selected:!!m.selected,className:r(m),color:t(m),borderRadius:i,strokeColor:n(m),strokeWidth:s,shapeRendering:l,onClick:f,id:m.id})}const b3=$.memo(x3);var k3=$.memo(y3);const v3=200,w3=150,S3=e=>!e.hidden,C3=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Ov(yl(e.nodeLookup,{filter:S3}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},E3="react-flow__minimap-desc";function Rw({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:l,nodeComponent:u,bgColor:f,maskColor:m,maskStrokeColor:h,maskStrokeWidth:g,position:b="bottom-right",onClick:y,onNodeClick:v,pannable:w=!1,zoomable:E=!1,ariaLabel:C,inversePan:M,zoomStep:S=1,offsetScale:N=5}){const R=mt(),T=$.useRef(null),{boundingRect:D,viewBB:H,rfId:V,panZoom:B,translateExtent:O,flowWidth:Y,flowHeight:Z,ariaLabelConfig:U}=Ye(C3,ft),_=e?.width??v3,A=e?.height??w3,q=D.width/_,K=D.height/A,Q=Math.max(q,K),I=Q*_,F=Q*A,L=N*Q,z=D.x-(I-D.width)/2-L,W=D.y-(F-D.height)/2-L,ae=I+L*2,le=F+L*2,me=`${E3}-${V}`,G=$.useRef(0),ce=$.useRef();G.current=Q,$.useEffect(()=>{if(T.current&&B)return ce.current=UA({domNode:T.current,panZoom:B,getTransform:()=>R.getState().transform,getViewScale:()=>G.current}),()=>{ce.current?.destroy()}},[B]),$.useEffect(()=>{ce.current?.update({translateExtent:O,width:Y,height:Z,inversePan:M,pannable:w,zoomStep:S,zoomable:E})},[w,E,M,S,O,Y,Z]);const be=y?ke=>{const[De,oe]=ce.current?.pointer(ke)||[0,0];y(ke,{x:De,y:oe})}:void 0,we=v?$.useCallback((ke,De)=>{const oe=R.getState().nodeLookup.get(De).internals.userNode;v(ke,oe)},[]):void 0,ve=C??U["minimap.ariaLabel"];return d.jsx(dd,{position:b,style:{...e,"--xy-minimap-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-background-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-stroke-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*Q:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof l=="number"?l:void 0},className:Nt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:d.jsxs("svg",{width:_,height:A,viewBox:`${z} ${W} ${ae} ${le}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":me,ref:T,onClick:be,children:[ve&&d.jsx("title",{id:me,children:ve}),d.jsx(k3,{onClick:we,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:l,nodeComponent:u}),d.jsx("path",{className:"react-flow__minimap-mask",d:`M${z-L},${W-L}h${ae+L*2}v${le+L*2}h${-ae-L*2}z
|
|
18
|
+
M${H.x},${H.y}h${H.width}v${H.height}h${-H.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Rw.displayName="MiniMap";$.memo(Rw);const M3=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,T3={[ki.Line]:"right",[ki.Handle]:"bottom-right"};function j3({nodeId:e,position:t,variant:n=ki.Handle,className:r,style:i=void 0,children:s,color:l,minWidth:u=10,minHeight:f=10,maxWidth:m=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:b,autoScale:y=!0,shouldResize:v,onResizeStart:w,onResize:E,onResizeEnd:C}){const M=pw(),S=typeof e=="string"?e:M,N=mt(),R=$.useRef(null),T=n===ki.Handle,D=Ye($.useCallback(M3(T&&y),[T,y]),ft),H=$.useRef(null),V=t??T3[n];$.useEffect(()=>{if(!(!R.current||!S))return H.current||(H.current=oN({domNode:R.current,nodeId:S,getStoreItems:()=>{const{nodeLookup:O,transform:Y,snapGrid:Z,snapToGrid:U,nodeOrigin:_,domNode:A}=N.getState();return{nodeLookup:O,transform:Y,snapGrid:Z,snapToGrid:U,nodeOrigin:_,paneDomNode:A}},onChange:(O,Y)=>{const{triggerNodeChanges:Z,nodeLookup:U,parentLookup:_,nodeOrigin:A}=N.getState(),q=[],K={x:O.x,y:O.y},Q=U.get(S);if(Q&&Q.expandParent&&Q.parentId){const I=Q.origin??A,F=O.width??Q.measured.width??0,L=O.height??Q.measured.height??0,z={id:Q.id,parentId:Q.parentId,rect:{width:F,height:L,...Fv({x:O.x??Q.position.x,y:O.y??Q.position.y},{width:F,height:L},Q.parentId,U,I)}},W=$h([z],U,_,A);q.push(...W),K.x=O.x?Math.max(I[0]*F,O.x):void 0,K.y=O.y?Math.max(I[1]*L,O.y):void 0}if(K.x!==void 0&&K.y!==void 0){const I={id:S,type:"position",position:{...K}};q.push(I)}if(O.width!==void 0&&O.height!==void 0){const F={id:S,type:"dimensions",resizing:!0,setAttributes:b?b==="horizontal"?"width":"height":!0,dimensions:{width:O.width,height:O.height}};q.push(F)}for(const I of Y){const F={...I,type:"position"};q.push(F)}Z(q)},onEnd:({width:O,height:Y})=>{const Z={id:S,type:"dimensions",resizing:!1,dimensions:{width:O,height:Y}};N.getState().triggerNodeChanges([Z])}})),H.current.update({controlPosition:V,boundaries:{minWidth:u,minHeight:f,maxWidth:m,maxHeight:h},keepAspectRatio:g,resizeDirection:b,onResizeStart:w,onResize:E,onResizeEnd:C,shouldResize:v}),()=>{H.current?.destroy()}},[V,u,f,m,h,g,w,E,C,v]);const B=V.split("-");return d.jsx("div",{className:Nt(["react-flow__resize-control","nodrag",...B,n,r]),ref:R,style:{...i,scale:D,...l&&{[T?"backgroundColor":"borderColor"]:l}},children:s})}$.memo(j3);const A3=typeof localStorage<"u"?localStorage.getItem("modular-theme"):null,Uu=fn((e,t)=>({theme:A3==="light"?"light":"dark",toggleTheme:()=>{const n=t().theme==="dark"?"light":"dark";localStorage.setItem("modular-theme",n),e({theme:n})}})),N3={bg:"#111114",surface:"rgba(28, 28, 32, 0.9)",surfaceOpaque:"#1c1c20",surfaceElevated:"#25252a",surfaceHover:"#1f1f24",border:"#2a2a30",borderSubtle:"#222226",textPrimary:"#f0f0f0",textSecondary:"#888",textMuted:"#666",textDim:"#555",textFaint:"#444",inputBg:"#141417",badgeBg:"#25252a",dotGrid:"#222228",minimapBg:"#111114",minimapMask:"rgba(17,17,20,0.8)",minimapNode:"#25252a",controlsBg:"#1c1c20",controlsBorder:"#2a2a30",tileActiveBg:"#25252a",tileHoverBg:"#1f1f24",tileBg:"#1c1c20",tileBorderHover:"#3a3a40",agentBg:"#151210",agentBorder:"#2d2720",agentLabel:"#9a8e82",agentMeta:"#6d6058",agentArrow:"#6d6058",agentLineNum:"#2d2720",agentText:"#8a7e72",tokenLabel:"#999",tokenDivider:"#777",tokenTrackBg:"#25252a",jackRingBase:"#0a0a0a",jackLabelOnRing:"#999",jackLabelBeside:"#666",cableShadow:"rgba(0,0,0,0.4)",cableHighlight:"rgba(255,255,255,0.06)",responseBg:"rgba(28, 28, 32, 0.9)",responseText:"#bbb",statusSuccess:"#00ff88",statusError:"#ff3344",statusWarning:"#ffaa00",statusInfo:"#3498db",statusSuccessBg:"rgba(0,255,136,0.07)",statusErrorBg:"rgba(255,51,68,0.08)",statusWarningBg:"rgba(255,170,0,0.08)",statusSuccessGlow:"0 0 6px rgba(0,255,136,0.5)",statusErrorGlow:"0 0 6px rgba(255,51,68,0.5)",statusWarningGlow:"0 0 6px rgba(255,170,0,0.5)",cableSkills:"#f1c40f",cableMcp:"#2ecc71",cableKnowledge:"#e74c3c"},_3={bg:"#f0f1f3",surface:"rgba(255,255,255,0.95)",surfaceOpaque:"#ffffff",surfaceElevated:"#eeeef2",surfaceHover:"#f5f5f8",border:"#ccccd4",borderSubtle:"#dddde2",textPrimary:"#1a1a20",textSecondary:"#3a3a45",textMuted:"#555560",textDim:"#5c5c66",textFaint:"#71717a",inputBg:"#f5f5f8",badgeBg:"#e5e5ea",dotGrid:"#d0d0d8",minimapBg:"#f0f1f3",minimapMask:"rgba(240,241,243,0.8)",minimapNode:"#dddde2",controlsBg:"#ffffff",controlsBorder:"#ccccd4",tileActiveBg:"#e8e8ee",tileHoverBg:"#f0f0f5",tileBg:"#ffffff",tileBorderHover:"#bbbbc4",agentBg:"#f8f8fa",agentBorder:"#dddde2",agentLabel:"#555560",agentMeta:"#888890",agentArrow:"#888890",agentLineNum:"#ccccd4",agentText:"#666670",tokenLabel:"#555560",tokenDivider:"#888890",tokenTrackBg:"#dddde2",jackRingBase:"#e8e8ee",jackLabelOnRing:"#555",jackLabelBeside:"#777",cableShadow:"rgba(0,0,0,0.12)",cableHighlight:"rgba(255,255,255,0.3)",responseBg:"rgba(255,255,255,0.95)",responseText:"#444",statusSuccess:"#16a34a",statusError:"#dc2626",statusWarning:"#ca8a04",statusInfo:"#2563eb",statusSuccessBg:"rgba(22,163,74,0.08)",statusErrorBg:"rgba(220,38,38,0.08)",statusWarningBg:"rgba(202,138,4,0.08)",statusSuccessGlow:"0 0 6px rgba(22,163,74,0.3)",statusErrorGlow:"0 0 6px rgba(220,38,38,0.3)",statusWarningGlow:"0 0 6px rgba(202,138,4,0.3)",cableSkills:"#B45309",cableMcp:"#16a34a",cableKnowledge:"#dc2626"};function Ee(){const e=Uu(n=>n.theme);return{...e==="dark"?N3:_3,isDark:e==="dark"}}const Hs=$.forwardRef(function({label:t,error:n,className:r="",style:i,...s},l){const u=Ee();return d.jsxs("div",{className:"flex flex-col gap-1",children:[t&&d.jsx("label",{className:"text-[13px] tracking-wider uppercase font-semibold",style:{color:u.textMuted,fontFamily:"'Geist Mono', monospace"},children:t}),d.jsx("input",{ref:l,className:`w-full px-3 py-2 rounded-md outline-none nodrag ${r}`,style:{background:u.inputBg,border:`1px solid ${n?u.statusError:u.border}`,color:u.textPrimary,fontFamily:"'Geist Sans', sans-serif",fontSize:16,lineHeight:1.5,...i},...s}),n&&d.jsx("span",{className:"text-[13px]",style:{color:u.statusError},children:n})]})}),ia=$.forwardRef(function({label:t,error:n,showCount:r,maxChars:i,value:s,className:l="",style:u,...f},m){const h=Ee(),g=typeof s=="string"?s.length:0;return d.jsxs("div",{className:"flex flex-col gap-1",children:[(t||r)&&d.jsxs("div",{className:"flex items-center justify-between",children:[t&&d.jsx("label",{className:"text-[13px] tracking-wider uppercase font-semibold",style:{color:h.textMuted,fontFamily:"'Geist Mono', monospace"},children:t}),r&&d.jsxs("span",{className:"text-[13px]",style:{color:i&&g>i?h.statusError:h.textFaint},children:[g,i?` / ${i}`:""]})]}),d.jsx("textarea",{ref:m,value:s,className:`w-full px-3 py-2.5 rounded-md outline-none resize-none nowheel nodrag ${l}`,style:{background:h.inputBg,border:`1px solid ${n?h.statusError:h.border}`,color:h.textPrimary,fontFamily:"'Geist Sans', sans-serif",fontSize:16,lineHeight:1.5,minHeight:64,...u},...f}),n&&d.jsx("span",{className:"text-[13px]",style:{color:h.statusError},children:n})]})});const Ow=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const D3=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const z3=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const M1=e=>{const t=z3(e);return t.charAt(0).toUpperCase()+t.slice(1)};var R3={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const O3=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const I3=$.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:l,...u},f)=>$.createElement("svg",{ref:f,...R3,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Ow("lucide",i),...!s&&!O3(u)&&{"aria-hidden":"true"},...u},[...l.map(([m,h])=>$.createElement(m,h)),...Array.isArray(s)?s:[s]]));const he=(e,t)=>{const n=$.forwardRef(({className:r,...i},s)=>$.createElement(I3,{ref:s,iconNode:t,className:Ow(`lucide-${D3(M1(e))}`,`lucide-${e}`,r),...i}));return n.displayName=M1(e),n};const F3=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],oh=he("activity",F3);const $3=[["path",{d:"M12 6v16",key:"nqf5sj"}],["path",{d:"m19 13 2-1a9 9 0 0 1-18 0l2 1",key:"y7qv08"}],["path",{d:"M9 11h6",key:"1fldmi"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}]],L3=he("anchor",$3);const P3=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],B3=he("arrow-down-right",P3);const H3=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],U3=he("arrow-down",H3);const q3=[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]],G3=he("arrow-right-left",q3);const K3=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],T1=he("arrow-up-right",K3);const V3=[["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20",key:"oj1oa8"}],["path",{d:"m20 7 2 .5-2 .5",key:"12nv4d"}],["path",{d:"M10 18v3",key:"1yea0a"}],["path",{d:"M14 17.75V21",key:"1pymcb"}],["path",{d:"M7 18a6 6 0 0 0 3.84-10.61",key:"1npnn0"}]],Y3=he("bird",V3);const W3=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Iw=he("book-open",W3);const X3=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],kl=he("bot",X3);const Z3=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],Bh=he("box",Z3);const Q3=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],vl=he("brain",Q3);const J3=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],e_=he("bug",J3);const t_=[["path",{d:"M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z",key:"x6xyqk"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M11.25 16.25h1.5L12 17l-.75-.75Z",key:"12kq1m"}]],n_=he("cat",t_);const o_=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Hh=he("chart-column",o_);const r_=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Wt=he("check",r_);const a_=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Pn=he("chevron-down",a_);const i_=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Go=he("chevron-right",i_);const s_=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Fw=he("chevron-up",s_);const l_=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],$w=he("circle-alert",l_);const c_=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],qu=he("circle-check-big",c_);const u_=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],rl=he("circle-x",u_);const d_=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],p_=he("circle",d_);const f_=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],m_=he("clipboard-list",f_);const h_=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],g_=he("clock",h_);const y_=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],x_=he("cloud",y_);const b_=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Lw=he("code",b_);const k_=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]],v_=he("compass",k_);const w_=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Pw=he("copy",w_);const S_=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],wl=he("cpu",S_);const C_=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Sl=he("database",C_);const E_=[["path",{d:"M11.25 16.25h1.5L12 17z",key:"w7jh35"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309",key:"u7s9ue"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5",key:"v8hric"}]],M_=he("dog",E_);const T_=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],md=he("download",T_);const j_=[["path",{d:"M10 11h.01",key:"d2at3l"}],["path",{d:"M14 6h.01",key:"k028ub"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6.5 13.1h.01",key:"1748ia"}],["path",{d:"M22 5c0 9-4 12-6 12s-6-3-6-12c0-2 2-3 6-3s6 1 6 3",key:"172yzv"}],["path",{d:"M17.4 9.9c-.8.8-2 .8-2.8 0",key:"1obv0w"}],["path",{d:"M10.1 7.1C9 7.2 7.7 7.7 6 8.6c-3.5 2-4.7 3.9-3.7 5.6 4.5 7.8 9.5 8.4 11.2 7.4.9-.5 1.9-2.1 1.9-4.7",key:"rqjl8i"}],["path",{d:"M9.1 16.5c.3-1.1 1.4-1.7 2.4-1.4",key:"1mr6wy"}]],A_=he("drama",j_);const N_=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Bw=he("external-link",N_);const __=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],D_=he("eye-off",__);const z_=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],R_=he("eye",z_);const O_=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],I_=he("file-code",O_);const F_=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Cl=he("file-text",F_);const $_=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],Hw=he("flame",$_);const L_=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],P_=he("folder-git-2",L_);const B_=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Uh=he("folder-open",B_);const H_=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],U_=he("folder",H_);const q_=[["path",{d:"M10.5 3 8 9l4 13 4-13-2.5-6",key:"b3dvk1"}],["path",{d:"M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z",key:"7w4byz"}],["path",{d:"M2 9h20",key:"16fsjt"}]],G_=he("gem",q_);const K_=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],wi=he("git-branch",K_);const V_=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Uw=he("globe",V_);const Y_=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],W_=he("grid-3x3",Y_);const X_=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Z_=he("grip-vertical",X_);const Q_=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],J_=he("hard-drive",Q_);const eD=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],tD=he("hash",eD);const nD=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],oD=he("heart",nD);const rD=[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]],aD=he("hexagon",rD);const iD=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],sD=he("image",iD);const lD=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],cD=he("info",lD);const uD=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],dD=he("key-round",uD);const pD=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],fD=he("layers",pD);const mD=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],qw=he("layout-grid",mD);const hD=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],gD=he("library",hD);const yD=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],Gu=he("lightbulb",yD);const xD=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],j1=he("list-ordered",xD);const bD=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ot=he("loader-circle",bD);const kD=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],vD=he("mail",kD);const wD=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],SD=he("map",wD);const CD=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Gw=he("maximize-2",CD);const ED=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],MD=he("mic",ED);const TD=[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]],jD=he("microscope",TD);const AD=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],qh=he("minimize-2",AD);const ND=[["path",{d:"M5 12h14",key:"1ays0h"}]],_D=he("minus",ND);const DD=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],zD=he("monitor",DD);const RD=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Kw=he("moon",RD);const OD=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Vw=he("package",OD);const ID=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],Yw=he("palette",ID);const FD=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],$D=he("panels-top-left",FD);const LD=[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]],Ww=he("pen-tool",LD);const PD=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],A1=he("pencil-line",PD);const BD=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Xw=he("play",BD);const HD=[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]],Zw=he("plug-zap",HD);const UD=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],El=he("plug",UD);const qD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ft=he("plus",qD);const GD=[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]],KD=he("presentation",GD);const VD=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],YD=he("rocket",VD);const WD=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Gh=he("rotate-ccw",WD);const XD=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],N1=he("rotate-cw",XD);const ZD=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Kh=he("save",ZD);const QD=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],hd=he("search",QD);const JD=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],ez=he("send",JD);const tz=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],nz=he("server",tz);const oz=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Qw=he("settings",oz);const rz=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Vh=he("shield",rz);const az=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],iz=he("shopping-bag",az);const sz=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],ga=he("sparkles",sz);const lz=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Jw=he("square",lz);const cz=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],uz=he("star",cz);const dz=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],eS=he("sun",dz);const pz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],gd=he("target",pz);const fz=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],al=he("terminal",fz);const mz=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],yd=he("trash-2",mz);const hz=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],tS=he("triangle-alert",hz);const gz=[["path",{d:"M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"14u9p9"}]],yz=he("triangle",gz);const xz=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],nS=he("upload",xz);const bz=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],kz=he("users",bz);const vz=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],wz=he("wand-sparkles",vz);const Sz=[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]],Cz=he("waves",Sz);const Ez=[["path",{d:"m10.586 5.414-5.172 5.172",key:"4mc350"}],["path",{d:"m18.586 13.414-5.172 5.172",key:"8c96vv"}],["path",{d:"M6 12h12",key:"8npq4p"}],["circle",{cx:"12",cy:"20",r:"2",key:"144qzu"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["circle",{cx:"20",cy:"12",r:"2",key:"1xzzfp"}],["circle",{cx:"4",cy:"12",r:"2",key:"1hvhnz"}]],Mz=he("waypoints",Ez);const Tz=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],jz=he("workflow",Tz);const Az=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],oS=he("wrench",Az);const Nz=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],$t=he("x",Nz);const _z=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Bn=he("zap",_z);function co({options:e,value:t,onChange:n,label:r,placeholder:i="Select...",size:s="md"}){const l=Ee(),[u,f]=$.useState(!1),[m,h]=$.useState({x:0,y:0,w:0}),g=$.useRef(null),b=e.find(w=>w.value===t),y={sm:28,md:32};$.useEffect(()=>{if(!u)return;const w=()=>f(!1);return document.addEventListener("click",w),()=>document.removeEventListener("click",w)},[u]);const v=()=>{if(!g.current)return;const w=g.current.getBoundingClientRect();h({x:w.left,y:w.bottom+4,w:w.width}),f(!u)};return d.jsxs("div",{className:"flex flex-col gap-1",children:[r&&d.jsx("label",{className:"text-[13px] tracking-wider uppercase font-semibold",style:{color:l.textMuted,fontFamily:"'Geist Mono', monospace"},children:r}),d.jsxs("button",{ref:g,type:"button",onClick:w=>{w.stopPropagation(),v()},className:"flex items-center justify-between gap-2 w-full rounded-lg cursor-pointer border outline-none nodrag",style:{height:y[s],padding:"0 10px",fontSize:13,fontFamily:"'Geist Mono', monospace",background:l.inputBg,borderColor:l.border,color:b?l.textPrimary:l.textMuted},children:[d.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[b?.icon,b?.label||i]}),d.jsx(Pn,{size:12,style:{color:l.textDim,transform:u?"rotate(180deg)":"none",transition:"transform 0.15s"}})]}),u&&cd.createPortal(d.jsx("div",{className:"fixed z-[250] rounded-lg overflow-hidden py-1",style:{left:m.x,top:m.y,width:m.w,background:l.surfaceElevated,border:`1px solid ${l.border}`,boxShadow:`0 8px 24px ${l.isDark?"rgba(0,0,0,0.5)":"rgba(0,0,0,0.12)"}`,maxHeight:200,overflowY:"auto"},onClick:w=>w.stopPropagation(),children:e.map(w=>d.jsxs("button",{type:"button",onClick:()=>{n(w.value),f(!1)},className:"flex items-center gap-2 w-full px-3 py-1.5 text-[13px] text-left cursor-pointer border-none bg-transparent",style:{fontFamily:"'Geist Mono', monospace",color:w.value===t?"#FE5000":l.textSecondary,background:w.value===t?"#FE500008":"transparent"},onMouseEnter:E=>E.currentTarget.style.background=l.isDark?"#ffffff08":"#00000005",onMouseLeave:E=>E.currentTarget.style.background=w.value===t?"#FE500008":"transparent",children:[w.icon,d.jsx("span",{className:"flex-1 truncate",children:w.label}),w.value===t&&d.jsx(Wt,{size:10})]},w.value))}),document.body)]})}const Po=[{id:"anthropic",name:"Claude",authMethod:"api-key",status:"disconnected",baseUrl:"https://api.anthropic.com/v1",models:[],docsUrl:"https://docs.anthropic.com/en/api",keyPageUrl:"https://console.anthropic.com/settings/keys",pricingUrl:"https://www.anthropic.com/pricing",icon:"Bot",color:"#D4A574",authHeader:"x-api-key",headerNote:"Uses x-api-key header (not Bearer)"},{id:"openai",name:"OpenAI",authMethod:"api-key",status:"disconnected",baseUrl:"https://api.openai.com/v1",models:[],docsUrl:"https://platform.openai.com/docs",keyPageUrl:"https://platform.openai.com/api-keys",pricingUrl:"https://openai.com/pricing",icon:"Sparkles",color:"#10A37F",authHeader:"bearer"},{id:"google",name:"Google AI",authMethod:"api-key",status:"disconnected",baseUrl:"https://generativelanguage.googleapis.com/v1beta",models:[],docsUrl:"https://ai.google.dev/docs",keyPageUrl:"https://aistudio.google.com/app/apikey",pricingUrl:"https://ai.google.dev/pricing",icon:"Gem",color:"#4285F4",authHeader:"query-param",headerNote:"Uses ?key= query parameter"},{id:"claude-agent-sdk",name:"Claude (Agent SDK)",authMethod:"claude-agent-sdk",status:"disconnected",baseUrl:"",apiKey:"",models:[],docsUrl:"https://docs.anthropic.com/en/docs/claude-code/sdk",keyPageUrl:"",icon:"Terminal",color:"#D4A574",authHeader:"bearer",headerNote:"Zero-config — authenticates via Claude Code login"},{id:"openrouter",name:"OpenRouter",authMethod:"api-key",status:"disconnected",baseUrl:"https://openrouter.ai/api/v1",models:[],docsUrl:"https://openrouter.ai/docs",keyPageUrl:"https://openrouter.ai/keys",pricingUrl:"https://openrouter.ai/models",icon:"Route",color:"#6366F1",authHeader:"bearer",headerNote:"HTTP-Referer header recommended"}],rS="modular-providers";function _1(e){const t=e instanceof Error?e.message:String(e);return/failed to fetch|networkerror|load failed/i.test(t)?"Cannot reach backend API. Start server with `npm run server` (port 4800).":t}function Dz(e,t){const n=(t||"").trim().replace(/\/+$/,"");return n&&((e==="openai"||n.includes("api.openai.com"))&&!n.endsWith("/v1")?`${n}/v1`:n)}let Ms=null,sm=0;const zz=3e4,ca=new Set,lm=new Map;let cm=!1;async function il(){const e=Date.now();if(Ms!==null&&e-sm<zz)return Ms;try{Ms=(await fetch(`${ze}/providers`,{method:"GET",signal:AbortSignal.timeout(2e3)})).ok,sm=e}catch{Ms=!1,sm=e}return Ms}async function Yh(e){if(!await il()){ca.add(e.id);return}const n=e.id.includes("anthropic")||e.id==="claude-agent-sdk"?"anthropic":e.id.includes("google")?"google":e.id.includes("openrouter")?"openrouter":e.id.includes("openai")?"openai":"custom",r=s=>!s||/^[•]+$/.test(s),i={baseUrl:e.baseUrl,authMethod:e.authMethod,name:e.name,type:n};r(e.apiKey)||(i.apiKey=e.apiKey),r(e.accessToken)||(i.accessToken=e.accessToken),await fetch(`${ze}/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),ca.delete(e.id)}function cu(e,t){const n=lm.get(t);n&&clearTimeout(n);const r=setTimeout(()=>{const i=e.find(s=>s.id===t);i&&Yh(i).catch(()=>{ca.add(t)}).finally(()=>{lm.delete(t)})},400);lm.set(t,r)}async function rh(e){if(!(cm||ca.size===0)){cm=!0;try{if(!await il())return;const n=[...ca];for(const r of n){const i=e.find(s=>s.id===r);if(!i){ca.delete(r);continue}try{await Yh(i)}catch{}}}finally{cm=!1}}}function Rz(){try{const e=localStorage.getItem(rS);if(!e)return Po;const t=JSON.parse(e),n=Po.map(s=>{const l=t.find(f=>f.id===s.id);if(!l)return s;const u=l.authMethod??s.authMethod;return{...s,authMethod:u,apiKey:s.apiKey,accessToken:s.accessToken,baseUrl:l.baseUrl??s.baseUrl,status:l.status??s.status}}).concat(t.filter(s=>!Po.some(l=>l.id===s.id)).map(s=>{const l=s.authMethod??"api-key";return{...Po[Po.length-1],...s,authMethod:l,apiKey:"",accessToken:"",id:s.id??"custom-"+Date.now(),name:s.name??"Custom",status:s.status??"disconnected",models:s.models??[{id:"custom-model",label:"Custom Model"}]}})),r=new Set,i=[];for(let s=n.length-1;s>=0;s--)r.has(n[s].id)||(r.add(n[s].id),i.unshift(n[s]));return i}catch{return Po}}const Oz=new Set(Po.map(e=>e.id));function qt(e){const t=e.map(n=>{const r=Oz.has(n.id);return{id:n.id,name:n.name,baseUrl:n.baseUrl,status:n.status,authMethod:n.authMethod,models:r?void 0:n.models,authHeader:r?void 0:n.authHeader,icon:r?void 0:n.icon,color:r?void 0:n.color,docsUrl:r?void 0:n.docsUrl,keyPageUrl:r?void 0:n.keyPageUrl,headerNote:r?void 0:n.headerNote}});localStorage.setItem(rS,JSON.stringify(t))}const dt=fn((e,t)=>({providers:Rz(),selectedProviderId:"",testing:{},setProviderKey:(n,r)=>{e(i=>{const s=i.providers.map(l=>{if(l.id!==n)return l;const u=!!r.trim(),f=l.authMethod==="oauth"?l.status:u?"configured":"disconnected";return{...l,apiKey:r,status:f}});return qt(s),cu(s,n),{providers:s}})},setProviderAccessToken:(n,r)=>{e(i=>{const s=i.providers.map(l=>l.id===n?{...l,accessToken:r,status:r.trim()?"configured":l.status}:l);return qt(s),cu(s,n),{providers:s}})},setProviderAuthMethod:(n,r)=>{e(i=>{const s=i.providers.map(l=>{if(l.id!==n)return l;const u=!!l.apiKey?.trim();return{...l,authMethod:r,status:r==="oauth"||u?"configured":"disconnected",lastError:void 0}});return qt(s),cu(s,n),{providers:s}})},setProviderBaseUrl:(n,r)=>{e(i=>{const s=Dz(n,r),l=i.providers.map(u=>u.id===n?{...u,baseUrl:s}:u);return qt(l),cu(l,n),{providers:l}})},setProviderStatus:(n,r)=>{e(i=>{const s=i.providers.map(l=>l.id===n?{...l,status:r}:l);return qt(s),{providers:s}})},setProviderModels:(n,r)=>{e(i=>{const s=i.providers.map(l=>l.id===n?{...l,models:r}:l);return qt(s),{providers:s}})},getProviderForModel:n=>t().providers.find(r=>(Array.isArray(r.models)?r.models:[]).some(i=>i.id===n)),getActiveProvider:()=>t().providers.find(n=>n.id===t().selectedProviderId),getAllModels:()=>t().providers.flatMap(n=>{const r=Array.isArray(n.models)?n.models:[];return r.length===0?[]:n.status==="connected"||n.status==="configured"?r.map(i=>({id:i.id,label:i.label,providerId:n.id,providerName:n.name,providerColor:n.color})):[]}),selectProvider:n=>e({selectedProviderId:n}),testConnection:async n=>{e(r=>({testing:{...r.testing,[n]:!0}}));try{const r=t().providers.find(s=>s.id===n);if(r?.authMethod==="oauth"&&!r.apiKey?.trim()){const s='Codex sign-in not completed yet. Use "Sign in with Codex" first.';return e(l=>({testing:{...l.testing,[n]:!1},providers:l.providers.map(u=>u.id===n?{...u,status:"error",lastError:s}:u)})),qt(t().providers),{ok:!1,error:s}}if(r?.authMethod==="claude-agent-sdk")try{const s=await fetch(`${ze}/agent-sdk/status`);if(s.status===429)return e(g=>({testing:{...g.testing,[n]:!1}})),{ok:!1,error:"Rate limited — try again in a moment"};const l=await s.json(),u=l?.data,f=u?.authenticated===!0,m=f&&u?.email?`${u.displayName||"User"} (${u.email})`:void 0,h=Array.isArray(u?.models)?u.models.map(g=>({id:g,label:g})):[];return e(g=>({testing:{...g.testing,[n]:!1},providers:g.providers.map(b=>b.id===n?{...b,status:f?"connected":"error",models:h.length>0?h:b.models,lastError:f?m:u?.error||"Not authenticated"}:b)})),qt(t().providers),f?{ok:!0,models:h.map(g=>g.id)}:{ok:!1,error:l?.data?.error||"Not authenticated — run `claude` in your terminal first"}}catch(s){const l=_1(s);return e(u=>({testing:{...u.testing,[n]:!1},providers:u.providers.map(f=>f.id===n?{...f,status:"error",lastError:l}:f)})),qt(t().providers),{ok:!1,error:l}}if(await il()){const s=t().providers.find(h=>h.id===n),l=s?.apiKey&&!/^[•]+$/.test(s.apiKey);s&&l&&await fetch(`${ze}/providers/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:s.apiKey,baseUrl:s.baseUrl})});const u={baseUrl:s?.baseUrl||""};l&&(u.apiKey=s.apiKey);const m=await(await fetch(`${ze}/providers/${n}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)})).json();if(m.status==="ok"){const h=m.data?.models??m.models??[],g=h.map(b=>({id:b,label:b}));return e(b=>({testing:{...b.testing,[n]:!1},providers:b.providers.map(y=>y.id===n?{...y,status:"connected",models:g.length?g:y.models,lastError:void 0}:y)})),qt(t().providers),{ok:!0,models:h}}else return e(h=>({testing:{...h.testing,[n]:!1},providers:h.providers.map(g=>g.id===n?{...g,status:"error",lastError:m.error}:g)})),qt(t().providers),{ok:!1,error:m.error}}else return t().providers.find(l=>l.id===n)?.apiKey?(e(l=>({testing:{...l.testing,[n]:!1},providers:l.providers.map(u=>u.id===n?{...u,status:"connected",lastError:void 0}:u)})),qt(t().providers),{ok:!0}):(e(l=>({testing:{...l.testing,[n]:!1}})),{ok:!1,error:"No API key configured"})}catch(r){const i=_1(r);return e(s=>({testing:{...s.testing,[n]:!1},providers:s.providers.map(l=>l.id===n?{...l,status:"error",lastError:i}:l)})),qt(t().providers),{ok:!1,error:i}}},saveProvider:async n=>{const r=t().providers,i=r.find(s=>s.id===n);if(i){qt(r);try{await Yh(i)}catch{ca.add(n)}rh(t().providers).catch(()=>{})}},deleteProvider:n=>{e(r=>{const i=r.providers.filter(s=>s.id!==n);return qt(i),{providers:i}}),il().then(r=>{r&&fetch(`${ze}/providers/${n}`,{method:"DELETE"}).catch(()=>{})})},addCustomProvider:()=>{const r={id:"custom-"+Date.now(),name:"Custom Provider",authMethod:"api-key",status:"disconnected",baseUrl:"http://localhost:11434/v1",models:[{id:"custom-model",label:"Custom Model"}],docsUrl:"",keyPageUrl:"",icon:"Server",color:"#888888",authHeader:"bearer",headerNote:"For Ollama, vLLM, or any OpenAI-compatible API"};e(i=>{const s=[...i.providers,r];return qt(s),{providers:s}})},loadFromBackend:async()=>{try{const n=await fetch(`${ze}/providers`);if(!n.ok)return;const r=await n.json(),i=Array.isArray(r)?r:Array.isArray(r?.data)?r.data:[];if(i.length>0){const s=Po.map(y=>{const v=i.find(C=>C.id===y.id);if(!v)return y;const w=!!v.hasStoredKey,E=!!v.hasStoredAccessToken;return{...y,...v,name:y.id==="anthropic"?"Claude":v.name||y.name,apiKey:w?"":y.apiKey,accessToken:E?"":y.accessToken,_hasStoredKey:w,_hasStoredAccessToken:E,status:w||E?"configured":v.status||y.status,models:Array.isArray(v.models)?v.models:y.models}}),l=i.filter(y=>!Po.some(v=>v.id===y.id)).map(y=>({...y,models:Array.isArray(y.models)?y.models:[]})),u=[...s,...l],f=t().selectedProviderId,m=u.find(y=>y.id===f),h=!!(m&&(m.status==="connected"||m.status==="configured")&&Array.isArray(m.models)&&m.models.length>0),g=u.find(y=>(y.status==="connected"||y.status==="configured")&&Array.isArray(y.models)&&y.models.length>0),b=h?f:g?.id||"";e({providers:u,selectedProviderId:b}),qt(t().providers),await rh(t().providers)}}catch{}}}));il().then(e=>{e&&(dt.getState().loadFromBackend(),rh(dt.getState().providers).catch(()=>{}))});function xd(){const e=ie.getState(),t=[];e.agentMeta.name&&t.push(`Agent: ${e.agentMeta.name}`),e.agentMeta.description&&t.push(`Description: ${e.agentMeta.description}`),e.instructionState.persona&&t.push(`Persona: ${e.instructionState.persona}`),e.instructionState.objectives.primary&&t.push(`Primary objective: ${e.instructionState.objectives.primary}`),e.instructionState.constraints.scopeDefinition&&t.push(`Scope: ${e.instructionState.constraints.scopeDefinition}`);const n=e.skills.filter(i=>i.enabled).map(i=>i.name);n.length&&t.push(`Skills: ${n.join(", ")}`);const r=e.mcpServers.filter(i=>i.enabled).map(i=>i.name);return r.length&&t.push(`MCP servers: ${r.join(", ")}`),t.join(`
|
|
19
|
+
`)}const Wh={workflow:`You are an expert AI agent architect. Given the agent context below, generate a workflow — a sequence of 3-8 steps the agent should follow for every request.
|
|
20
|
+
|
|
21
|
+
Output ONLY a JSON array:
|
|
22
|
+
[{"label": "<step name>", "action": "<what the agent does>", "condition": false, "loop": false}]
|
|
23
|
+
|
|
24
|
+
Rules:
|
|
25
|
+
- Each step should be concrete and actionable
|
|
26
|
+
- Include verification/review steps where appropriate
|
|
27
|
+
- If the agent uses tools, reference them in the action text
|
|
28
|
+
- Steps should form a logical flow (gather → analyze → synthesize → verify → output)`,memory:`You are an expert AI agent architect. Given the agent context below, generate memory configuration and initial facts.
|
|
29
|
+
|
|
30
|
+
Output ONLY a JSON object:
|
|
31
|
+
{
|
|
32
|
+
"maxMessages": <10-50>,
|
|
33
|
+
"summarizeAfter": <5-25>,
|
|
34
|
+
"summarizeEnabled": <true|false>,
|
|
35
|
+
"suggestedFacts": ["<pre-loaded fact relevant to the agent's domain>"]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
Rules:
|
|
39
|
+
- Conversational agents need higher maxMessages and summarization
|
|
40
|
+
- One-shot tools can have lower limits and no summarization
|
|
41
|
+
- Facts should be domain-relevant knowledge the agent should always have
|
|
42
|
+
- Generate 2-5 facts that help the agent do its job better`,knowledge:`You are an expert AI agent architect. Given the agent context below, suggest knowledge sources this agent should have access to.
|
|
43
|
+
|
|
44
|
+
Output ONLY a JSON array:
|
|
45
|
+
[{"name": "<source name>", "type": "<ground-truth|signal|evidence|framework|hypothesis|artifact>", "description": "<what it contains>"}]
|
|
46
|
+
|
|
47
|
+
Rules:
|
|
48
|
+
- Suggest 3-6 knowledge sources
|
|
49
|
+
- Use appropriate types: ground-truth for authoritative docs, signal for real-time data, evidence for research, framework for methodologies
|
|
50
|
+
- Be specific to the agent's domain`};async function bd(e,t){const n=dt.getState(),r=n.providers.find(s=>s.id===n.selectedProviderId);if(!r)throw new Error("No provider configured — add one in Settings");const i=typeof r.models?.[0]=="object"?r.models[0].id:r.models?.[0]||"claude-sonnet-4-20250514";return r.authMethod==="claude-agent-sdk"?ed({prompt:t,model:i,systemPrompt:e,maxTurns:1}):Ju({providerId:r.id,model:i,messages:[{role:"system",content:e},{role:"user",content:t}],temperature:.4,maxTokens:2048})}function kd(e){try{return JSON.parse(e)}catch{}const t=e.match(/```(?:json)?\s*([\s\S]*?)```/);if(t)try{return JSON.parse(t[1].trim())}catch{}const n=e.match(/[\[{][\s\S]*[\]}]/);if(n)try{return JSON.parse(n[0])}catch{}throw new Error("Could not parse LLM response as JSON")}async function Iz(e){const t=xd(),n=e.map((s,l)=>`${l+1}. ${s}`).join(`
|
|
51
|
+
`),r=`You are an expert AI agent architect. The user has sketched out workflow steps for their agent. Refine them into proper, actionable workflow steps.
|
|
52
|
+
|
|
53
|
+
User's draft steps:
|
|
54
|
+
${n}
|
|
55
|
+
|
|
56
|
+
Agent context:
|
|
57
|
+
${t||"(no agent identity set yet)"}
|
|
58
|
+
|
|
59
|
+
Output ONLY a JSON array:
|
|
60
|
+
[{"label": "<clear step name>", "action": "<specific what the agent does>", "condition": false, "loop": false}]
|
|
61
|
+
|
|
62
|
+
Rules:
|
|
63
|
+
- Keep the user's intent and ordering — don't add unrelated steps
|
|
64
|
+
- Make labels concise and action-oriented
|
|
65
|
+
- Fill in the "action" field with specific details about HOW the step works
|
|
66
|
+
- You may split or merge steps if it makes the flow clearer
|
|
67
|
+
- Add verification/output steps if the user forgot them`,i=await bd(r,n);return kd(i)}async function Xh(){const e=xd();if(!e)throw new Error("Add agent identity/persona first — the generator needs context");const t=await bd(Wh.workflow,e);return kd(t)}async function aS(){const e=xd();if(!e)throw new Error("Add agent identity/persona first — the generator needs context");const t=await bd(Wh.memory,e);return kd(t)}async function Fz(){const e=xd();if(!e)throw new Error("Add agent identity/persona first — the generator needs context");const t=await bd(Wh.knowledge,e);return kd(t)}const $z=Object.freeze(Object.defineProperty({__proto__:null,generateKnowledge:Fz,generateMemoryConfig:aS,generateWorkflow:Xh,refineWorkflowSteps:Iz},Symbol.toStringTag,{value:"Module"}));function iS(e){if(e.length===0)return"";const t=["## Workflow","Follow these steps for every request:",""];return e.forEach((n,r)=>{const i=r+1,s=n.label||`Step ${i}`;let l=`${i}. **${s}:** ${n.action}`;if(n.condition==="if"&&n.conditionText?l+=` *(if ${n.conditionText})*`:n.condition==="unless"&&n.conditionText&&(l+=` *(unless ${n.conditionText})*`),n.tool&&(l+=` [tool: ${n.tool}]`),n.loopTarget){const u=e.findIndex(f=>f.id===n.loopTarget);u>=0&&(l+=` → loop to step ${u+1} (max ${n.loopMax}×)`)}t.push(l)}),t.join(`
|
|
68
|
+
`)}$.memo(function(){const t=Ee(),[n,r]=$.useState(null),[i,s]=$.useState(null),l=ie(T=>T.workflowSteps),u=ie(T=>T.updateWorkflowSteps),[f,m]=$.useState(!1),h=$.useCallback(async()=>{if(!f){m(!0);try{const D=(await Xh()).map((H,V)=>({id:`gen-${Date.now()}-${V}`,label:H.label,action:H.action,tool:"",condition:H.condition?"if":"always",conditionText:"",loopTarget:"",loopMax:H.loop?3:0}));u(D)}catch{}finally{m(!1)}}},[f,u]),b=vt(T=>T.servers).filter(T=>T.status==="connected"),y=ie(T=>T.channels),v=$.useMemo(()=>y.filter(T=>T.type==="skill"),[y]),w=[{value:"",label:"-- no tool --"},...b.map(T=>({value:`mcp:${T.id}`,label:`${T.name}`})),...v.map(T=>({value:`skill:${T.name}`,label:`${T.name}`}))],E=$.useCallback((T,D)=>{const H=[...l];H[T]={...H[T],...D},u(H)},[l,u]),C=$.useCallback(T=>{u(l.filter((D,H)=>H!==T)),i===T&&s(null)},[l,u,i]),M=$.useCallback(()=>{const T={id:`step-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,label:"",action:"",tool:"",condition:"always",conditionText:"",loopTarget:"",loopMax:3};u([...l,T]),s(l.length)},[l,u]),S=$.useCallback((T,D)=>{if(D<0||D>=l.length)return;const H=[...l],[V]=H.splice(T,1);H.splice(D,0,V),u(H)},[l,u]),N={background:t.inputBg,border:`1px solid ${t.border}`,color:t.textPrimary,fontFamily:"'Geist Mono', monospace",fontSize:13},R={width:8,height:8,border:"none",borderRadius:"50%"};return d.jsxs("div",{className:"rounded-lg overflow-visible",style:{background:t.surfaceOpaque,border:`1px solid ${t.border}`,boxShadow:`0 2px 12px ${t.isDark?"rgba(0,0,0,0.5)":"rgba(0,0,0,0.08)"}`,width:"100%"},children:[d.jsx(vi,{type:"target",position:Te.Left,id:"workflow-in",style:{...R,background:"#e67e22",top:"50%",left:-4}}),d.jsx(vi,{type:"source",position:Te.Right,id:"workflow-out",style:{...R,background:"#9b59b6",top:"50%",right:-4}}),d.jsxs("div",{className:"flex flex-col overflow-visible rounded-lg",children:[d.jsxs("div",{className:"flex items-center gap-2 px-5 shrink-0 select-none",style:{height:40,background:t.surfaceElevated,borderBottom:`1px solid ${t.border}`},children:[d.jsx(j1,{size:13,style:{color:"#e67e22"}}),d.jsx("span",{className:"text-[12px] font-bold tracking-widest uppercase",style:{fontFamily:"'Geist Mono', monospace",color:t.textPrimary},children:"Workflow"}),d.jsxs("span",{className:"text-[13px] ml-1",style:{color:t.textDim,fontFamily:"'Geist Mono', monospace"},children:[l.length," ",l.length===1?"step":"steps"]}),d.jsx("div",{className:"flex-1"}),d.jsxs("button",{type:"button",onClick:h,disabled:f,className:"flex items-center gap-1 text-[13px] px-2 py-0.5 rounded cursor-pointer border-none nodrag",style:{background:"#FE500015",color:"#FE5000",fontFamily:"'Geist Mono', monospace",opacity:f?.6:1},children:[f?d.jsx(Ot,{size:9,className:"animate-spin motion-reduce:animate-none"}):d.jsx(ga,{size:9}),"Generate"]})]}),d.jsx("div",{className:"flex-1 overflow-y-auto nowheel nodrag",style:{maxHeight:700},children:d.jsxs("div",{className:"flex flex-col items-center py-3 px-5",children:[d.jsx("div",{className:"flex items-center justify-center rounded-full mb-1",style:{width:28,height:28,background:"#e67e2215",border:"2px solid #e67e2240"},children:d.jsx(U3,{size:12,style:{color:"#e67e22"}})}),l.map((T,D)=>{const H=i===D,V=T.condition!=="always",B=!!T.tool,O=!!T.loopTarget,Y=O?l.findIndex(Z=>Z.id===T.loopTarget):-1;return d.jsxs("div",{className:"flex flex-col items-center w-full",children:[d.jsx("div",{style:{width:2,height:16,background:"#e67e2230"}}),d.jsxs("div",{className:"relative w-full rounded-lg",style:{background:n===D?"#FE500008":t.surfaceElevated,border:`1.5px solid ${H?"#e67e2260":t.borderSubtle}`,maxWidth:310},children:[d.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 cursor-pointer",onClick:()=>s(H?null:D),style:{borderBottom:H?`1px solid ${t.borderSubtle}`:"none"},children:[d.jsx("button",{type:"button",className:"p-0 border-none bg-transparent cursor-grab nodrag",style:{color:t.textDim},draggable:!0,onDragStart:Z=>{Z.stopPropagation(),r(D)},onDragEnd:()=>r(null),onDragOver:Z=>{Z.preventDefault(),n!==null&&n!==D&&S(n,D)},onClick:Z=>Z.stopPropagation(),children:d.jsx(Z_,{size:11})}),d.jsx("span",{className:"text-[12px] shrink-0 w-5 h-5 flex items-center justify-center rounded-full font-bold",style:{background:"#e67e2218",color:"#e67e22",fontFamily:"'Geist Mono', monospace",fontSize:13},children:D+1}),d.jsx("span",{className:"flex-1 text-[13px] font-semibold truncate",style:{color:T.label?t.textPrimary:t.textMuted,fontFamily:"'Geist Sans', sans-serif"},children:T.label||`Step ${D+1}`}),V&&d.jsxs("span",{className:"flex items-center gap-0.5 text-[12px] px-1.5 py-0.5 rounded",style:{background:"#3498db15",color:"#3498db"},children:[d.jsx(wi,{size:8}),T.condition]}),B&&d.jsx("span",{className:"flex items-center gap-0.5 text-[12px] px-1.5 py-0.5 rounded",style:{background:"#2ecc7115",color:"#2ecc71"},children:d.jsx(oS,{size:8})}),O&&d.jsx("span",{className:"flex items-center gap-0.5 text-[12px] px-1.5 py-0.5 rounded",style:{background:"#9b59b615",color:"#9b59b6"},children:d.jsx(N1,{size:8})}),d.jsx("button",{type:"button",onClick:Z=>{Z.stopPropagation(),C(D)},className:"p-0.5 border-none bg-transparent cursor-pointer nodrag",style:{color:t.textDim},children:d.jsx($t,{size:10})})]}),!H&&T.action&&d.jsx("div",{className:"px-2.5 pb-1.5",children:d.jsx("span",{className:"text-[12px]",style:{color:t.textMuted},children:T.action})}),H&&d.jsxs("div",{className:"flex flex-col gap-1.5 px-2.5 py-2 nodrag",children:[d.jsx(Hs,{value:T.label,onChange:Z=>E(D,{label:Z.target.value}),placeholder:`Step ${D+1} label`}),d.jsx(ia,{value:T.action,onChange:Z=>E(D,{action:Z.target.value}),placeholder:"What the agent does in this step...",style:{minHeight:40}}),d.jsxs("div",{className:"flex gap-1.5",children:[d.jsx("div",{className:"flex-1",children:d.jsx(co,{options:w,value:T.tool,onChange:Z=>E(D,{tool:Z}),size:"sm"})}),d.jsx("div",{style:{width:90},children:d.jsx(co,{options:[{value:"always",label:"Always"},{value:"if",label:"If..."},{value:"unless",label:"Unless..."}],value:T.condition,onChange:Z=>E(D,{condition:Z}),size:"sm"})})]}),T.condition!=="always"&&d.jsx(Hs,{value:T.conditionText,onChange:Z=>E(D,{conditionText:Z.target.value}),placeholder:`${T.condition==="if"?"If":"Unless"} condition...`}),l.length>1&&d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(N1,{size:9,style:{color:t.textDim}}),d.jsx("div",{className:"flex-1",children:d.jsx(co,{options:[{value:"",label:"No loop"},...l.filter((Z,U)=>U!==D).map(Z=>({value:Z.id,label:`Step ${l.indexOf(Z)+1}${Z.label?`: ${Z.label}`:""}`}))],value:T.loopTarget||"",onChange:Z=>E(D,{loopTarget:Z}),size:"sm"})}),T.loopTarget&&d.jsxs("span",{className:"flex items-center gap-0.5 text-[13px]",style:{color:t.textDim},children:["max ",d.jsx(Hs,{type:"number",min:1,max:10,value:T.loopMax,onChange:Z=>E(D,{loopMax:parseInt(Z.target.value)||3}),style:{width:32,textAlign:"center",padding:"2px 2px",...N,fontSize:13}}),"x"]})]})]}),O&&Y>=0&&Y<D&&d.jsx("div",{className:"absolute flex items-center justify-center",style:{right:-28,top:"50%",transform:"translateY(-50%)",width:22,height:22,borderRadius:"50%",background:"#9b59b610",border:"1px dashed #9b59b640"},children:d.jsxs("span",{className:"text-[7px] font-bold",style:{color:"#9b59b6",fontFamily:"'Geist Mono', monospace"},children:[T.loopMax,"x"]})})]})]},T.id)}),l.length>0&&d.jsx("div",{style:{width:2,height:16,background:"#e67e2230"}}),d.jsxs("button",{type:"button",onClick:M,className:"flex items-center justify-center gap-1.5 text-[12px] px-5 py-3 rounded-lg cursor-pointer border-none nodrag",style:{background:"#e67e2210",border:"1.5px dashed #e67e2240",color:"#e67e22",fontFamily:"'Geist Mono', monospace",fontWeight:600},children:[d.jsx(Ft,{size:12})," ADD STEP"]}),l.length===0&&d.jsxs("div",{className:"px-4 py-4 text-center text-[12px]",style:{color:t.textFaint},children:[d.jsx(j1,{size:18,style:{margin:"0 auto 6px",opacity:.3}}),d.jsx("div",{children:"Define step-by-step reasoning plan"}),d.jsx("div",{style:{color:t.textMuted,marginTop:4,fontSize:13},children:"Visual flowchart builder"})]}),l.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("div",{style:{width:2,height:10,background:"#e67e2220"}}),d.jsx("div",{className:"flex items-center justify-center rounded-full",style:{width:20,height:20,background:"#e67e2210",border:"2px solid #e67e2230"},children:d.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:"#e67e2240"}})})]})]})})]})]})});function at(e){if(!e)return 0;const t=e.match(/```[\s\S]*?```/g),n=t?t.reduce((i,s)=>i+s.length,0):0,r=e.length-n;return Math.ceil(r/4+n/2.5)}function ah(e){const t=e.match(/^[^\n]*?[.!?](?:\s|$)/);return t?t[0].trim():e.split(`
|
|
69
|
+
`)[0].slice(0,200)}function ih(e){const t=e.split(/\n\s*\n/)[0];return t?t.trim().slice(0,1e3):""}function Si(e,t){return`n${e}-${t}`}function sl(e){let t=e.tokens;for(const n of e.children)t+=sl(n);return e.totalTokens=t,t}function vd(e){let t=1;for(const n of e.children)t+=vd(n);return t}function Ci(e,t){const n=t.split(`
|
|
70
|
+
`);let r=0;const i={nodeId:Si(0,r++),title:e,depth:0,text:"",tokens:0,totalTokens:0,children:[]},s=[i];let l=[],u=0;function f(h){const g=l.join(`
|
|
71
|
+
`).trim(),b=s[s.length-1];b.text=g,b.tokens=at(g),b.meta?(b.meta.lineEnd=h,b.meta.firstSentence=ah(g),b.meta.firstParagraph=ih(g)):g&&(b.meta={lineStart:u,lineEnd:h,firstSentence:ah(g),firstParagraph:ih(g),sourceType:"markdown"}),l=[]}const m=/^(#{1,6})\s+(.+)$/;for(let h=0;h<n.length;h++){const g=n[h],b=m.exec(g);if(b){f(h-1);const y=b[1].length,v=b[2].trim(),w={nodeId:Si(y,r++),title:v,depth:y,text:"",tokens:0,totalTokens:0,children:[],meta:{lineStart:h,lineEnd:h,firstSentence:"",firstParagraph:"",sourceType:"markdown"}};for(;s.length>1&&s[s.length-1].depth>=y;)s.pop();s[s.length-1].children.push(w),s.push(w),u=h+1}else l.push(g)}return f(n.length-1),sl(i),{source:e,sourceType:"markdown",root:i,totalTokens:i.totalTokens,nodeCount:vd(i),created:Date.now()}}function Lz(e,t,n="structured"){let r=0;const i={nodeId:Si(0,r++),title:e,depth:0,text:"",tokens:0,totalTokens:0,children:[]},s=new Map;for(const l of t){const u=l.group||"default";s.has(u)||s.set(u,[]),s.get(u).push(l)}for(const[l,u]of s){const f=u.map(h=>`${h.label}: ${h.value}`).join(`
|
|
72
|
+
`),m={nodeId:Si(1,r++),title:l==="default"?e:l,depth:1,text:f,tokens:at(f),totalTokens:0,children:[],meta:{firstSentence:u[0]?`${u[0].label}: ${u[0].value}`:"",firstParagraph:f.slice(0,1e3),sourceType:n,fieldGroup:l}};i.children.push(m)}return sl(i),{source:e,sourceType:n,root:i,totalTokens:i.totalTokens,nodeCount:vd(i),created:Date.now()}}function Pz(e,t,n="chronological",r=10){let i=0;const s={nodeId:Si(0,i++),title:e,depth:0,text:"",tokens:0,totalTokens:0,children:[]};if(t.length===0)return sl(s),{source:e,sourceType:n,root:s,totalTokens:0,nodeCount:1,created:Date.now()};const l=r*60*1e3;let u=[t[0]];const f=[];for(let m=1;m<t.length;m++)t[m].timestamp-t[m-1].timestamp>l&&(f.push(u),u=[]),u.push(t[m]);f.push(u);for(const m of f){const g=`${new Date(m[0].timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`,b=m.map(v=>v.speaker?`${v.speaker}: ${v.text}`:v.text).join(`
|
|
73
|
+
`),y={nodeId:Si(1,i++),title:g,depth:1,text:b,tokens:at(b),totalTokens:0,children:[],meta:{firstSentence:m[0].text.slice(0,200),firstParagraph:b.slice(0,1e3),sourceType:n,timestamp:m[0].timestamp}};s.children.push(y)}return sl(s),{source:e,sourceType:n,root:s,totalTokens:s.totalTokens,nodeCount:vd(s),created:Date.now()}}function D1(e,t,n="flat"){const r={nodeId:"n0-0",title:e,depth:0,text:t.trim(),tokens:at(t),totalTokens:at(t),children:[],meta:{firstSentence:ah(t),firstParagraph:ih(t),sourceType:n}};return{source:e,sourceType:n,root:r,totalTokens:r.totalTokens,nodeCount:1,created:Date.now()}}const Bz=300*1e3,Xn=fn((e,t)=>({indexes:{},loading:{},errors:{},indexFile:async n=>{const r=t(),i=r.indexes[n];if(i&&!i.stale&&Date.now()-i.fetchedAt<Bz)return i.index;if(r.loading[n])return i?.index??null;e(s=>({loading:{...s.loading,[n]:!0},errors:{...s.errors,[n]:""}}));try{const l=await(await fetch(`${ze}/knowledge/read?path=${encodeURIComponent(n)}`)).json();if(l.status!=="ok"||!l.data)throw new Error(l.error??"Failed to read file");const u=Ci(n,l.data.content),f={index:u,fetchedAt:Date.now(),stale:!1};return e(m=>({indexes:{...m.indexes,[n]:f},loading:{...m.loading,[n]:!1}})),u}catch(s){const l=s instanceof Error?s.message:"Index failed";return e(u=>({loading:{...u.loading,[n]:!1},errors:{...u.errors,[n]:l}})),null}},getIndex:n=>t().indexes[n]?.index??null,indexFiles:async n=>{await Promise.allSettled(n.map(r=>t().indexFile(r)))},invalidate:n=>{e(r=>{const i=r.indexes[n];return i?{indexes:{...r.indexes,[n]:{...i,stale:!0}}}:r})},clearAll:()=>e({indexes:{},loading:{},errors:{}})}));function sS(e,t,n){if(t===4&&e.depth>0||t===3&&e.depth>n)return null;let r="",i=!1;t===0?r=e.text:t===1?e.children.length===0&&e.meta?.firstParagraph?(r=e.meta.firstParagraph,i=e.text.length>r.length):r=e.text:t===2?(r=e.meta?.firstSentence??"",i=e.text.length>r.length):r="";const s=[];for(const l of e.children){const u=sS(l,t,n);u&&s.push(u)}return{nodeId:e.nodeId,title:e.title,depth:e.depth,text:r,tokens:at(r),children:s,truncated:i}}function lS(e){let t=e.tokens+at(e.title);for(const n of e.children)t+=lS(n);return t}function ll(e,t,n){const r=Math.max(0,Math.min(4,t));let s=sS(e.root,r,2);s||(s={nodeId:e.root.nodeId,title:e.root.title,depth:0,text:"",tokens:0,children:[],truncated:!0});let l=lS(s);return{source:e.source,filtered:s,totalTokens:l,depthLevel:r,budgetUsed:l,budgetLimit:1/0}}function cl(e){const t=[];e.depth>0&&t.push(`${"#".repeat(e.depth)} ${e.title}`),e.text&&t.push(e.text),e.truncated&&e.depth>0&&t.push(`_[${e.title}: truncated at this depth level]_`);for(const n of e.children)t.push(cl(n));return t.join(`
|
|
74
|
+
|
|
75
|
+
`)}function Hz(e,t,n){const r=[],i=e.filter(y=>y.enabled),s=ie.getState(),l=s.instructionState,u=s.workflowSteps,f=s.agentMeta,m=[];if(f.name||n?.name){const y=[];y.push(`Name: ${f.name||n?.name||"Assistant"}`),(f.description||n?.description)&&y.push(`Description: ${f.description||n?.description}`),f.avatar&&y.push(`Avatar: ${f.avatar}`),f.tags&&f.tags.length>0&&y.push(`Tags: ${f.tags.join(", ")}`),m.push(`<identity>
|
|
76
|
+
${y.join(`
|
|
77
|
+
`)}
|
|
78
|
+
</identity>`)}if(l.persona||l.objectives.primary){const y=[];if(l.persona&&y.push(`Persona: ${l.persona}`),l.tone!=="neutral"&&y.push(`Tone: ${l.tone}`),l.expertise!==3){const v=["Beginner","Novice","Intermediate","Advanced","Expert"];y.push(`Expertise Level: ${v[l.expertise-1]} (${l.expertise}/5)`)}l.objectives.primary&&(y.push(`Primary Objective: ${l.objectives.primary}`),l.objectives.successCriteria.length>0&&y.push(`Success Criteria:
|
|
79
|
+
${l.objectives.successCriteria.map(v=>`- ${v}`).join(`
|
|
80
|
+
`)}`),l.objectives.failureModes.length>0&&y.push(`Failure Modes to Avoid:
|
|
81
|
+
${l.objectives.failureModes.map(v=>`- ${v}`).join(`
|
|
82
|
+
`)}`)),m.push(`<instructions>
|
|
83
|
+
${y.join(`
|
|
84
|
+
|
|
85
|
+
`)}
|
|
86
|
+
</instructions>`)}const h=[];if(l.constraints.neverMakeUp&&h.push("Never fabricate information or make up facts"),l.constraints.askBeforeActions&&h.push("Ask for permission before taking significant actions"),l.constraints.stayInScope&&h.push(`Stay within the defined scope: ${l.constraints.scopeDefinition||"as specified"}`),l.constraints.useOnlyTools&&h.push("Only use tools and capabilities that are explicitly provided"),l.constraints.limitWords&&h.push(`Keep responses under ${l.constraints.wordLimit} words`),l.constraints.customConstraints&&h.push(`Additional constraints: ${l.constraints.customConstraints}`),h.length>0&&m.push(`<constraints>
|
|
87
|
+
${h.map(y=>`- ${y}`).join(`
|
|
88
|
+
`)}
|
|
89
|
+
</constraints>`),u.length>0){const y=iS(u);m.push(`<workflow>
|
|
90
|
+
${y}
|
|
91
|
+
</workflow>`)}if(i.length>0){const y={},v=["ground-truth","signal","evidence","framework","hypothesis","guideline"];for(const C of i)y[C.knowledgeType]||(y[C.knowledgeType]=[]),y[C.knowledgeType].push(C);const w=Xn.getState(),E=[];for(const C of v){const M=y[C];if(!M||M.length===0)continue;const S=Ar[C],N=[];for(const R of M){const T=fi[R.depth],D=w.getIndex(R.path);if(D){const H=ll(D,0),V=cl(H.filtered);V.trim()?N.push(`<source name="${R.name}" type="${S.label}" depth="${T.label}" tokens="${H.totalTokens}">
|
|
92
|
+
${V}
|
|
93
|
+
</source>`):N.push(`- ${R.name} (${T.label}, title only) [${R.path}]`)}else N.push(`- ${R.name} (${T.label}, ~${Math.round(R.baseTokens*T.pct).toLocaleString()} tokens) [${R.path}]`)}E.push(`[${S.label.toUpperCase()}] ${S.instruction}
|
|
94
|
+
${N.join(`
|
|
95
|
+
`)}`)}m.push(`<knowledge>
|
|
96
|
+
${E.join(`
|
|
97
|
+
|
|
98
|
+
`)}
|
|
99
|
+
</knowledge>`)}const g=vt.getState().getConnectedTools(),b=s.skills.filter(y=>y.enabled);if(g.length>0||b.length>0){const y=[];g.length>0&&(y.push("MCP Tools:"),y.push(...g.map(v=>`- ${v.name}: ${v.description||"No description"}`))),b.length>0&&(y.length>0&&y.push(""),y.push("Skills:"),y.push(...b.map(v=>`- ${v.name}: ${v.description||"No description"}`))),m.push(`<tools>
|
|
100
|
+
${y.join(`
|
|
101
|
+
`)}
|
|
102
|
+
</tools>`)}return m.length>0&&r.push({role:"system",content:m.join(`
|
|
103
|
+
|
|
104
|
+
`)}),r.push({role:"user",content:t||"(no prompt provided)"}),r}const z1=/(?:^|[\s`"'([<{])([A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)+\.[A-Za-z0-9._-]+)(?=$|[\s`"')\]}>:,;.!?])/g;function Zh(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/")}function Uz(e){const t=Zh(e),n=t.lastIndexOf("/");return n>0?t.slice(0,n):t}function sh(e,t){z1.lastIndex=0;let n;for(;(n=z1.exec(e))!==null;){const r=n[1].replace(/^\.?\//,"");r.includes("/")&&t.add(r)}}function cS(e,t){sh(e.title,t),e.text&&sh(e.text,t);for(const n of e.children)cS(n,t)}function qz(e){const t=new Map;for(const n of e){const r=Zh(n).replace(/^\.?\//,"");if(!r.includes("/"))continue;const i=r.split("/").filter(Boolean);if(i.length<2)continue;const s=i.length>=3?`${i[0]}/${i[1]}/`:`${i[0]}/`,l=i.length>=3?`${i[2]}${i.length>3?"/":""}`:i[1];t.has(s)||t.set(s,new Set),t.get(s).add(l)}return[...t.entries()].sort(([n],[r])=>n.localeCompare(r)).slice(0,14).map(([n,r])=>{const i=[...r].sort(),s=i.slice(0,8),l=i.length>s.length?", ...":"";return` ${n} -> ${s.join(", ")}${l}`})}function Gz(e){const t=e.filter(r=>r.enabled&&r.repoMeta);if(t.length===0)return"";const n=[];for(const r of t){const i=r.repoMeta,s=i.features;if(s.length===0)continue;const l=s[0],f=`src/${l.toLowerCase().replace(/\s+/g,"-")}/index.ts`,m=[`### Example: answering a question about ${i.name}`,`Q: "How does ${l} work?"`,`1. Check Data Flow in "${l}" section → see what files import/depend on each other`,"2. Check Key Files → exports and types tell you the API surface without opening files",`3. Need actual implementation? → \`get_file_contents("${f}")\``];i.baseUrl&&m.push(`4. Need to share a link? → \`${i.baseUrl}{exact_file_path}\``),n.push(m.join(`
|
|
105
|
+
`))}return n.length===0?"":n.join(`
|
|
106
|
+
|
|
107
|
+
`)}function uS(e,t){const n=e.filter(h=>h.enabled),r=[],i=n.filter(h=>h.repoMeta);for(const h of i){const g=h.repoMeta,b=h.path?Uz(h.path):"",y=b?n.filter(E=>E.path&&Zh(E.path).startsWith(`${b}/`)):[h],v=new Set;for(const E of y){if(E.content&&sh(E.content,v),!E.path)continue;const C=t(E.path);C&&cS(C.root,v)}const w=qz([...v]);r.push(`## ${g.name}`),g.stack.length>0&&r.push(`- Stack: ${g.stack.join(", ")}`),g.baseUrl&&r.push(`- Base URL: ${g.baseUrl}`),r.push(`- ${g.totalFiles} files, key features: ${g.features.join(", ")}`),g.baseUrl&&w.length>0&&(r.push(`- File lookup table (${v.size} paths): use \`${g.baseUrl}{filePath}\``),r.push(...w)),r.push("- You can explore this codebase in depth — read files, trace dependencies, check implementations."),r.push("")}const s=n.filter(h=>!h.repoMeta&&h.content);for(const h of s){const g=Ar[h.knowledgeType],b=g?g.label:h.knowledgeType;r.push(`## Document: ${h.name}`),r.push(`- Type: ${b}`),r.push("")}if(r.length===0)return"";const l=`You have access to the following codebases and knowledge sources:
|
|
108
|
+
`,u=Gz(e),f=u?`
|
|
109
|
+
## How to Use This Knowledge
|
|
110
|
+
${u}
|
|
111
|
+
`:"";return`<orientation>
|
|
112
|
+
${l}
|
|
113
|
+
${r.join(`
|
|
114
|
+
`)}
|
|
115
|
+
${f}Approach:
|
|
116
|
+
- Your knowledge about these codebases is already loaded in your context below. Use it directly.
|
|
117
|
+
- For file contents not in your context, use get_file_contents or read_file tools — NOT the knowledge graph.
|
|
118
|
+
- Do NOT call search_nodes or read_graph to find basic structure — that information is already here.
|
|
119
|
+
- Use each repo's base URL + file path from the lookup table to build exact file links.
|
|
120
|
+
- Explore files and trace dependencies BEFORE asking the user for information.
|
|
121
|
+
</orientation>`}function dS(e){const{frame:t,orientationBlock:n,hasRepos:r,knowledgeFormatGuide:i,frameworkBlock:s,memoryBlock:l,knowledgeBlock:u}=e,f=[t];if(n&&f.push(n),r&&f.push(i),s&&f.push(s),l&&f.push(l),u){const m=Kz(u);f.push(m)}return f.filter(Boolean).join(`
|
|
122
|
+
|
|
123
|
+
`)}function Kz(e){if(!e.includes("<knowledge>"))return e;const t=e.match(/<knowledge[^>]*>(.*?)<\/knowledge>/s);if(!t)return e;const n=t[1],r=/<source[^>]*type="([^"]*)"[^>]*>(.*?)<\/source>/gs,i=[],s=[],l={"ground-truth":0,"Ground Truth":0,guideline:1,Guideline:1,framework:2,Framework:2,hypothesis:3,Hypothesis:3,signal:4,Signal:4,evidence:5,Evidence:5};let u=0,f;for(;(f=r.exec(n))!==null;){if(f.index>u){const v=n.slice(u,f.index).trim();v&&s.push(v)}const b=f[1],y=l[b]??3;i.push({type:b,fullMatch:f[0],order:y}),u=f.index+f[0].length}if(u<n.length){const b=n.slice(u).trim();b&&s.push(b)}i.sort((b,y)=>b.order-y.order);const m=[];s.length>0&&m.push(...s),i.length>0&&m.push(...i.map(b=>b.fullMatch));const h=e.match(/<knowledge[^>]*>/);return`${h?h[0]:"<knowledge>"}
|
|
124
|
+
${m.join(`
|
|
125
|
+
|
|
126
|
+
`)}
|
|
127
|
+
</knowledge>`}const Vz={agentMeta:{name:"React Code Reviewer",description:"Senior React engineer specializing in code quality, TypeScript best practices, and accessibility compliance",icon:"search",category:"coding",tags:["react","code-review","typescript","accessibility"],avatar:"bug"},instructionState:{persona:"You are a senior React engineer with 8+ years of experience in building production-ready applications. You have deep expertise in TypeScript, modern React patterns, performance optimization, and web accessibility standards.",tone:"formal",expertise:5,constraints:{neverMakeUp:!0,askBeforeActions:!1,stayInScope:!0,useOnlyTools:!1,limitWords:!1,wordLimit:500,customConstraints:"Always provide specific line numbers and actionable suggestions",scopeDefinition:"Code review for React/TypeScript applications with focus on quality, performance, and accessibility"},objectives:{primary:"Provide thorough, actionable code reviews that improve code quality and maintainability",successCriteria:["Identify potential bugs and performance issues","Suggest accessibility improvements","Maintain consistency with React/TypeScript best practices","Provide specific, actionable feedback with examples"],failureModes:["Generic or vague feedback without specific suggestions","Missing critical accessibility issues","Approving code with TypeScript type safety violations","Ignoring performance implications"]},rawPrompt:"",autoSync:!0},workflowSteps:[{id:"step-analyze-diff",label:"Analyze Code Changes",action:"Read and understand the code diff, identifying the scope and purpose of changes",tool:"",condition:"always",conditionValue:""},{id:"step-style-check",label:"Check Code Style",action:"Verify code follows React/TypeScript best practices and coding standards",tool:"skill:clean-code",condition:"always",conditionValue:""},{id:"step-accessibility",label:"Review Accessibility",action:"Check for accessibility violations and suggest improvements for screen readers and keyboard navigation",tool:"",condition:"always",conditionValue:""},{id:"step-categorize-issues",label:"Categorize Issues",action:"Classify identified issues by severity: critical (blocking), major (important), minor (nice-to-have)",tool:"",condition:"always",conditionValue:""},{id:"step-write-review",label:"Write Comprehensive Review",action:"Compose detailed review with specific line references, code examples, and actionable suggestions",tool:"",condition:"always",conditionValue:""}],channels:[{sourceId:"react-style-guide",name:"React Style Guide",path:"docs/react-style-guide.md",category:"knowledge",knowledgeType:"framework",enabled:!0,depth:2,baseTokens:1500},{sourceId:"accessibility-checklist",name:"Accessibility Checklist",path:"docs/accessibility-checklist.md",category:"knowledge",knowledgeType:"evidence",enabled:!0,depth:3,baseTokens:800}],skills:[{id:"clean-code",name:"Clean Code",icon:"✨",enabled:!0,added:!0,description:"Pragmatic coding standards - concise, direct, no over-engineering",category:"development"}],mcpServers:[{id:"github",name:"GitHub",icon:"🐙",connected:!0,enabled:!0,added:!0,capabilities:["input","output"],category:"development",description:"Access GitHub repositories, PRs, and issues"}]},Yz={agentMeta:{name:"Senior PM",description:"Senior Product Manager specializing in discovery synthesis, product strategy, and opportunity analysis. Turns messy brainstorms into clear product strategy.",icon:"user",category:"strategy",tags:["discovery","strategy","synthesis","prioritization"],avatar:"target"},instructionState:{persona:"You are a Senior Product Manager with 10+ years building B2B SaaS products. You excel at discovery work, synthesizing messy conversations into clear product strategy, and translating customer/team insights into prioritized roadmap decisions.",tone:"formal",expertise:5,constraints:{neverMakeUp:!0,askBeforeActions:!1,stayInScope:!0,useOnlyTools:!1,limitWords:!1,wordLimit:500,customConstraints:"Strategic but practical — connect dots between insights and execution. Framework-driven — use opportunity solution trees, RICE, impact mapping. Hypothesis-oriented — frame everything as assumptions to validate. Trade-off aware — always consider what we are NOT doing. Customer-outcome focused — start with customer value, not features.",scopeDefinition:"Discovery synthesis, product strategy, opportunity analysis, roadmap prioritization"},objectives:{primary:"Synthesize product team discussions into clear, prioritized product opportunities with actionable next steps",successCriteria:["TL;DR with top 3 takeaways","Key opportunities grouped by theme","Customer pain points identified","Prioritization using RICE or similar framework","Discovery plan with validation steps"],failureModes:["Listing features without strategic context","Missing underlying customer needs behind surface requests","No prioritization or all items marked equal priority","Skipping hypothesis formation and validation planning"]},rawPrompt:"",autoSync:!0},workflowSteps:[{id:"step-tldr",label:"TL;DR",action:"Extract top 3 takeaways in one sentence each",tool:"",condition:"always"},{id:"step-opportunities",label:"Key Opportunities",action:"Identify product ideas/improvements discussed, grouped by theme",tool:"",condition:"always"},{id:"step-pain-points",label:"Customer Pain Points",action:"Extract problems being solved and underlying needs",tool:"",condition:"always"},{id:"step-strategic",label:"Strategic Implications",action:"Analyze how findings affect roadmap and positioning",tool:"",condition:"always"},{id:"step-hypotheses",label:"Assumptions & Hypotheses",action:"Frame beliefs that need validation with evidence and signals",tool:"",condition:"always"},{id:"step-prioritize",label:"Prioritization",action:"Recommend what to tackle first using RICE (Reach, Impact, Confidence, Effort)",tool:"",condition:"always"},{id:"step-discovery-plan",label:"Discovery Plan",action:"Define how to validate key hypotheses — research needed, experiments",tool:"",condition:"always"},{id:"step-risks",label:"Dependencies & Risks",action:"Flag technical, organizational, and market blockers",tool:"",condition:"always"},{id:"step-next-steps",label:"Next Steps",action:"List concrete actions with owners and timelines",tool:"",condition:"always"}],channels:[{sourceId:"knowledge-products",name:"Products",path:"00 - Knowledge/Products/",category:"knowledge",knowledgeType:"ground-truth",enabled:!0,depth:0,baseTokens:16e3},{sourceId:"knowledge-products-feedback",name:"Feedback",path:"00 - Knowledge/Products/Feedback/",category:"knowledge",knowledgeType:"signal",enabled:!0,depth:0,baseTokens:4800},{sourceId:"signals-odfjell",name:"User feedback / Odfjell",path:"07 - Signals/User feedback/odfjell/",category:"intel",knowledgeType:"signal",enabled:!0,depth:1,baseTokens:6800},{sourceId:"signals-kcc",name:"User feedback / KCC",path:"07 - Signals/User feedback/kcc/",category:"intel",knowledgeType:"signal",enabled:!0,depth:1,baseTokens:5200},{sourceId:"signals-general",name:"User feedback / General",path:"07 - Signals/User feedback/general/",category:"intel",knowledgeType:"signal",enabled:!0,depth:1,baseTokens:7500},{sourceId:"discovery-eu-ets",name:"EU ETS Cost Layer",path:"01 - Discovery/EU ETS Cost Layer/",category:"discovery",knowledgeType:"hypothesis",enabled:!0,depth:2,baseTokens:3200},{sourceId:"discovery-weather-routing",name:"Weather Routing v2",path:"01 - Discovery/Weather Routing v2/",category:"discovery",knowledgeType:"hypothesis",enabled:!0,depth:2,baseTokens:4100},{sourceId:"discovery-fleet-dashboard",name:"Fleet Dashboard",path:"01 - Discovery/Fleet Dashboard/",category:"discovery",knowledgeType:"hypothesis",enabled:!0,depth:2,baseTokens:3500},{sourceId:"roadmap",name:"03 - Roadmap",path:"03 - Roadmap/",category:"knowledge",knowledgeType:"framework",enabled:!0,depth:1,baseTokens:12e3}],skills:[{id:"feedback-analyzer",name:"Feedback Analyzer",icon:"📊",enabled:!0,added:!0,description:"Extract insights from customer feedback",category:"analysis"},{id:"roadmap-builder",name:"Roadmap Builder",icon:"🗺️",enabled:!0,added:!0,description:"Create strategic product roadmaps with OKRs",category:"content"}],mcpServers:[{id:"notion",name:"Notion",icon:"📓",connected:!0,enabled:!0,added:!0,capabilities:["input","output"],category:"productivity",description:"Read and write Notion pages and databases"},{id:"slack",name:"Slack",icon:"💬",connected:!0,enabled:!0,added:!0,capabilities:["input","output"],category:"communication",description:"Read and post Slack messages"}]},Wz={agentMeta:{name:"Feedback Manager",description:"Feedback lifecycle specialist — organizes, challenges, and maintains the single source of truth for user feedback. Monitors Gmail, connects feedback to product features, proposes improvements.",icon:"inbox",category:"feedback",tags:["feedback","triage","patterns","improvement"],avatar:"chart"},instructionState:{persona:"You are a specialized Product Manager focused on feedback management and intelligence. You maintain the single source of truth for all user feedback, ensuring it's organized, challenged, contextualized with current product features, and continuously refined.",tone:"neutral",expertise:4,constraints:{neverMakeUp:!0,askBeforeActions:!0,stayInScope:!0,useOnlyTools:!1,limitWords:!1,wordLimit:500,customConstraints:`Curious and probing — always ask "why?" and "what's the underlying need?". Pattern-oriented — look for recurring themes. Feature-aware — reference specific product capabilities. Actionable — turn feedback into concrete improvement proposals. Organized — maintain clean, accessible feedback repository.`,scopeDefinition:"Feedback triage, pattern recognition, improvement proposals, repository maintenance"},objectives:{primary:"Process and organize user feedback into actionable insights, maintaining a clean feedback repository with pattern detection and improvement proposals",successCriteria:["New feedback triaged within workflow","Patterns detected across feedback sources","Improvement proposals with rationale and priority","Feedback connected to current product capabilities","Repository organized and deduplicated"],failureModes:["Taking feedback at face value without probing deeper","Missing recurring patterns across sources","No connection between feedback and existing product features","Feedback stored without actionable improvement proposals"]},rawPrompt:"",autoSync:!0},workflowSteps:[{id:"step-initial-analysis",label:"Initial Analysis",action:"Quick pattern detection, sentiment analysis, theme identification, extract key quotes using feedback-analyzer skill",tool:"skill:feedback-analyzer",condition:"always"},{id:"step-triage",label:"Triage",action:"Ask clarifying questions: which product/feature, user role, frequency/severity, blocking vs inconvenient",tool:"",condition:"always"},{id:"step-deep-dive",label:"Deep Dive",action:"Uncover real pain point, identify job-to-be-done, find behavioral patterns, challenge assumptions",tool:"",condition:"always"},{id:"step-strategic-synthesis",label:"Strategic Synthesis",action:"Alignment with product strategy, opportunity sizing, prioritization recommendation",tool:"",condition:"always"},{id:"step-contextualize",label:"Contextualize with Product",action:"Check if capability exists, identify gap/enhancement/misunderstanding, find related features",tool:"",condition:"always"},{id:"step-categorize",label:"Categorize & Store",action:"Tag by product, type (Bug/Enhancement/Feature), user type, severity, frequency, status",tool:"",condition:"always"},{id:"step-patterns",label:"Pattern Recognition",action:"Check against existing patterns, update PATTERNS.md if new theme, flag recurring issues",tool:"",condition:"always"}],channels:[{sourceId:"knowledge-products-feedback",name:"Feedback",path:"00 - Knowledge/Products/Feedback/",category:"knowledge",knowledgeType:"signal",enabled:!0,depth:0,baseTokens:4800},{sourceId:"signals-odfjell",name:"User feedback / Odfjell",path:"07 - Signals/User feedback/odfjell/",category:"intel",knowledgeType:"signal",enabled:!0,depth:0,baseTokens:6800},{sourceId:"signals-kcc",name:"User feedback / KCC",path:"07 - Signals/User feedback/kcc/",category:"intel",knowledgeType:"signal",enabled:!0,depth:0,baseTokens:5200},{sourceId:"signals-baru",name:"User feedback / Baru",path:"07 - Signals/User feedback/baru/",category:"intel",knowledgeType:"signal",enabled:!0,depth:0,baseTokens:4500},{sourceId:"signals-general",name:"User feedback / General",path:"07 - Signals/User feedback/general/",category:"intel",knowledgeType:"signal",enabled:!0,depth:0,baseTokens:7500},{sourceId:"intel-feedback",name:"04 - Feedback Synthesis",path:"05 - Intel/04 - Feedback Synthesis/",category:"intel",knowledgeType:"evidence",enabled:!0,depth:1,baseTokens:4800}],skills:[{id:"feedback-analyzer",name:"Feedback Analyzer",icon:"📊",enabled:!0,added:!0,description:"Extract insights from customer feedback — patterns, sentiment, priorities",category:"analysis"}],mcpServers:[{id:"gmail",name:"Gmail",icon:"📧",connected:!0,enabled:!0,added:!0,capabilities:["input"],category:"communication",description:"Read Gmail OnWatch label for captain feedback"},{id:"notion",name:"Notion",icon:"📓",connected:!0,enabled:!0,added:!0,capabilities:["input","output"],category:"productivity",description:"CSM Team Hub and feedback databases"},{id:"slack",name:"Slack",icon:"💬",connected:!0,enabled:!0,added:!0,capabilities:["output"],category:"communication",description:"Send critical feedback alerts"}]},Xz={agentMeta:{name:"Competitor Feature Scraper",description:"Systematically scrapes competitor product pages to extract features, claims, screenshots, and target users. Produces structured feature profiles for competitive comparison.",icon:"search",category:"intel",tags:["competitors","scraping","features","intel"],avatar:"microscope"},instructionState:{persona:"You are a specialized competitive intelligence agent that systematically scrapes competitor websites to extract product features, claims, metrics, and screenshots. You produce structured feature profiles that feed into the competitive comparison matrix.",tone:"neutral",expertise:4,constraints:{neverMakeUp:!0,askBeforeActions:!1,stayInScope:!0,useOnlyTools:!0,limitWords:!1,wordLimit:500,customConstraints:'Only extract factual claims from competitor pages — never infer or embellish. Mark unverified claims as "Claimed". Save raw scrape data for re-processing. Respect rate limits (max 10 parallel scrapes).',scopeDefinition:"Competitor product page scraping, feature extraction, structured profile generation"},objectives:{primary:"Scrape competitor websites and produce structured FEATURES.md profiles with feature names, descriptions, claims, screenshots, and taxonomy mapping",successCriteria:["All discoverable product pages scraped","Each feature has name, description, and source URL","Screenshots downloaded for key features","Features mapped to taxonomy categories","Raw scrape data saved for re-processing"],failureModes:["Missing product pages due to incomplete site discovery","Inferring features not actually claimed by competitor","No screenshots captured for visual comparison","Features not mapped to standard taxonomy"]},rawPrompt:"",autoSync:!0},workflowSteps:[{id:"step-setup",label:"Setup",action:"Verify Firecrawl is available, create output directories for competitor",tool:"bash",condition:"always"},{id:"step-discover",label:"Discover Pages",action:"Use Firecrawl map to find all product/feature pages, filter for relevant URLs",tool:"skill:firecrawl",condition:"always"},{id:"step-scrape",label:"Scrape Pages",action:"Scrape each feature page for content + screenshot (up to 10 concurrent)",tool:"skill:firecrawl",condition:"always"},{id:"step-extract",label:"Extract Features",action:"Extract feature name, description, key claims, metrics, target user, screenshot URL",tool:"",condition:"always"},{id:"step-taxonomy",label:"Map to Taxonomy",action:"Read _FEATURE_TAXONOMY.md and map each feature to taxonomy categories",tool:"",condition:"always"},{id:"step-write",label:"Write Profile",action:"Generate structured FEATURES.md with summary table and detailed feature sections",tool:"",condition:"always"}],channels:[{sourceId:"knowledge-competitors",name:"Competitors",path:"00 - Knowledge/Competitors/",category:"knowledge",knowledgeType:"evidence",enabled:!0,depth:0,baseTokens:22e3},{sourceId:"intel-competitive",name:"01 - Competitive Intel",path:"05 - Intel/01 - Competitive Intel/",category:"intel",knowledgeType:"evidence",enabled:!0,depth:0,baseTokens:12e3},{sourceId:"cmo-competitive-intel",name:"05 - Competitive Intel",path:"CMO-Handoff/05 - Competitive Intel/",category:"intel",knowledgeType:"evidence",enabled:!0,depth:1,baseTokens:5800}],skills:[{id:"web-search",name:"Web Search",icon:"🔎",enabled:!0,added:!0,description:"Search the web for competitor information",category:"analysis"}],mcpServers:[{id:"firecrawl",name:"Firecrawl",icon:"🔥",connected:!0,enabled:!0,added:!0,capabilities:["input"],category:"data",description:"Web scraping, crawling, and site mapping"}]},Zz={"senior-pm":Yz,"feedback-manager":Wz,"competitor-scraper":Xz};let Er;function um(e){return e==="coding"?"development":e==="research"?"analysis":e==="design"||e==="writing"?"content":e==="domain"?"domain":"content"}function R1(e){return e==="coding"?"development":e==="research"?"data":e==="writing"?"productivity":"data"}function O1(e,t){return e.map(n=>n.id===t?{...n,enabled:!n.enabled}:n)}function I1(e,t){return e.map(n=>n.id===t?{...n,added:!0,enabled:!0}:n)}function F1(e,t){return e.map(n=>n.id===t?{...n,added:!1,enabled:!1}:n)}function pS(e){if(!e.enabled)return 0;const t=fi[e.depth]??fi[0];return Math.round(e.baseTokens*t.pct)}const ie=fn()(hM((e,t)=>({channels:[],prompt:"",selectedModel:"claude-opus-4",selectedPreset:"",outputFormat:"markdown",outputFormats:["markdown"],tokenBudget:2e5,navigationMode:"tree-aware",running:!1,showFilePicker:!1,showMcpPicker:!1,showSkillPicker:!1,showSaveModal:!1,showConnectorPicker:!1,showConnectionPicker:!1,showMarketplace:!1,activeMarketplaceTab:"skills",showSettings:!1,activeSettingsTab:"providers",response:"",exportTarget:"claude",registrySkills:vu.map(n=>({...n})),registryMcpServers:wM.map(n=>({...n})),agentConfig:{...yb},agentMeta:{name:"",description:"",icon:"brain",category:"general",tags:[],avatar:"bot"},mcpServers:[],skills:vu.filter(n=>n.installed).map(n=>({id:n.id,name:n.name,icon:n.icon,enabled:!1,added:!1,description:n.description,category:um(n.category)})),agents:[],connectors:[],pendingKnowledge:[],suggestedSkills:[],instructionState:{persona:"",tone:"neutral",expertise:3,constraints:{neverMakeUp:!1,askBeforeActions:!1,stayInScope:!1,useOnlyTools:!1,limitWords:!1,wordLimit:500,customConstraints:"",scopeDefinition:""},objectives:{primary:"",successCriteria:[],failureModes:[]},rawPrompt:"",autoSync:!0},workflowSteps:[],outputTemplateConfig:{},agentPattern:"prompt-chain",verification:{enabled:!1,strategy:"none",rules:[],crossRefSources:[],confidenceRequired:!1,autoRetryOnFail:!1,maxRetries:2},errorHandling:{onStepFailure:"abort",retryCount:1,fallbackAction:"",checkpointEnabled:!1,timeoutSeconds:0,gracefulDegradation:!1},evaluation:{enabled:!1,criteria:[],expectedOutputFormat:"",qualityRubric:""},totalTokens:()=>{const{channels:n,prompt:r}=t(),i=n.reduce((l,u)=>l+pS(u),0),s=Math.ceil(r.length/4);return i+s},loadPreset:n=>{const r=kM.find(l=>l.id===n);if(!r)return;const i=r.channels.map(l=>({...l,enabled:!0})),s={...yb,...r.agentConfig};e({channels:i,selectedPreset:n,response:"",agentConfig:s})},setOutputFormat:n=>e({outputFormat:n,outputFormats:[n]}),toggleOutputFormat:n=>{const r=t().outputFormats,i=r.includes(n)?r.filter(s=>s!==n):[...r,n];i.length!==0&&e({outputFormats:i,outputFormat:i[0]})},cycleKnowledgeType:n=>{const r=["ground-truth","signal","evidence","framework","hypothesis","guideline"];e({channels:t().channels.map(i=>{if(i.sourceId!==n)return i;const s=r.indexOf(i.knowledgeType);return{...i,knowledgeType:r[(s+1)%r.length]}})})},addChannel:n=>{const{channels:r}=t();if(r.some(s=>s.sourceId===n.sourceId))return;const i={...n};if(n.path){const s=Hm(n.path,n.content);(!n.knowledgeType||n.knowledgeType==="evidence")&&(i.knowledgeType=s.knowledgeType),(n.depth===void 0||n.depth===null)&&(i.depth=s.depth)}e({channels:[...r,{...i,enabled:!0}],selectedPreset:""})},removeChannel:n=>{e({channels:t().channels.filter(r=>r.sourceId!==n),selectedPreset:""})},toggleChannel:n=>{e({channels:t().channels.map(r=>r.sourceId===n?{...r,enabled:!r.enabled}:r)})},setChannelDepth:(n,r)=>{e({channels:t().channels.map(i=>i.sourceId===n?{...i,depth:Math.max(0,Math.min(4,r))}:i)})},setPrompt:n=>{const r=bM(n);e({prompt:n,outputFormat:r})},setModel:n=>e(r=>({selectedModel:n,agentConfig:{...r.agentConfig,model:n}})),setTokenBudget:n=>e({tokenBudget:n}),setNavigationMode:n=>e({navigationMode:n}),setShowFilePicker:n=>e({showFilePicker:n}),setShowMcpPicker:n=>e({showMcpPicker:n}),setShowSkillPicker:n=>e({showSkillPicker:n}),setShowSaveModal:n=>e({showSaveModal:n}),setShowConnectorPicker:n=>e({showConnectorPicker:n}),setShowConnectionPicker:n=>e({showConnectionPicker:n}),setShowMarketplace:(n,r)=>e({showMarketplace:n,...r?{activeMarketplaceTab:r}:{}}),setShowSettings:(n,r)=>e({showSettings:n,...r?{activeSettingsTab:r}:{}}),setAgentMeta:n=>e({agentMeta:{...t().agentMeta,...n}}),setChannelKnowledgeType:(n,r)=>{const i=["ground-truth","signal","evidence","framework","hypothesis","guideline"],s=i[Math.max(0,Math.min(i.length-1,r))];e({channels:t().channels.map(l=>l.sourceId===n?{...l,knowledgeType:s}:l)})},reorderChannels:(n,r)=>{const i=[...t().channels],[s]=i.splice(n,1);i.splice(r,0,s),e({channels:i,selectedPreset:""})},run:()=>{const{running:n,prompt:r,channels:i}=t();if(n){t().cancelRun();return}const l=dt.getState().getActiveProvider(),u=l?.authMethod==="claude-agent-sdk";if(!u&&!l?.apiKey){e({response:"Error: No API key configured. Open Settings → Providers to add your API key."});return}e({running:!0,response:""});const f=Hz(i,r),m=t().agentConfig.model;let h="";if(u){const b=f.filter(w=>w.role==="system").map(w=>w.content),y=f.filter(w=>w.role==="user").map(w=>w.content).join(`
|
|
128
|
+
`);Er=Wk({prompt:y||r,model:m,systemPrompt:b.join(`
|
|
129
|
+
`)||void 0,onChunk:w=>{h+=w,e({response:h})},onDone:()=>{e({running:!1}),Er=void 0},onError:w=>{e({running:!1,response:`Error: ${w.message}`}),Er=void 0}});return}Er=Xk({providerId:l?.id||"",model:m,messages:f,onChunk:b=>{h+=b,e({response:h})},onDone:()=>{e({running:!1}),Er=void 0},onError:b=>{e({running:!1,response:`Error: ${b.message}`}),Er=void 0}})},cancelRun:()=>{const n=Er;n&&n.abort(),e({running:!1}),Er=void 0},clearChannels:()=>e({channels:[],selectedPreset:"",response:""}),setAgentModel:n=>e({agentConfig:{...t().agentConfig,model:n}}),setAgentTemperature:n=>e({agentConfig:{...t().agentConfig,temperature:n}}),setAgentSystemPrompt:n=>e({agentConfig:{...t().agentConfig,systemPrompt:n}}),setAgentPlanningMode:n=>e({agentConfig:{...t().agentConfig,planningMode:n}}),setAgentMaxTokens:n=>e({agentConfig:{...t().agentConfig,maxTokens:n}}),toggleMcp:n=>{e({mcpServers:O1(t().mcpServers,n)})},addMcp:n=>{e({mcpServers:I1(t().mcpServers,n)})},removeMcp:n=>{e({mcpServers:F1(t().mcpServers,n)})},upsertMcpServer:n=>{if(t().mcpServers.find(i=>i.id===n.id)){e({mcpServers:t().mcpServers.map(i=>i.id===n.id?{...i,name:n.name,description:n.description??i.description,connected:n.connected??i.connected}:i)});return}e({mcpServers:[...t().mcpServers,{id:n.id,name:n.name,icon:"plug",connected:n.connected??!1,enabled:!1,added:!1,capabilities:["input","output"],category:"data",description:n.description??"Custom MCP server"}]})},removeMcpServer:n=>{e({mcpServers:t().mcpServers.filter(r=>r.id!==n)})},toggleSkill:n=>{e({skills:O1(t().skills,n)})},addSkill:n=>{e({skills:I1(t().skills,n)})},removeSkill:n=>{e({skills:F1(t().skills,n)})},upsertSkill:n=>{if(t().skills.find(i=>i.id===n.id)){e({skills:t().skills.map(i=>i.id===n.id?{...i,name:n.name||i.name,description:n.description&&n.description.length>0?n.description:i.description,skillUrl:n.skillUrl??i.skillUrl,installedFrom:n.installedFrom??i.installedFrom,installs:n.installs??i.installs}:i)});return}e({skills:[...t().skills,{id:n.id,name:n.name,icon:"zap",enabled:!1,added:!1,description:n.description??"Installed from skills.sh",category:"development",skillUrl:n.skillUrl,installedFrom:n.installedFrom,installs:n.installs}]})},loadAgent:n=>{(async()=>{try{const r=await fetch(`${ze}/agents/${encodeURIComponent(n)}`);if(!r.ok)return;const i=await r.json(),s=i.data??i;t().restoreFullState(s);try{const{useMcpStore:l}=await Ho(async()=>{const{useMcpStore:m}=await Promise.resolve().then(()=>bb);return{useMcpStore:m}},void 0),u=l.getState(),f=s.mcpServers??[];for(const m of f){if(!m.connected&&!m.enabled)continue;const h=u.servers.find(g=>g.id===m.id);h?h.status!=="connected"&&u.connectServer(m.id):await u.addServer({id:m.id,name:m.name,command:"",args:[],env:{}})&&u.connectServer(m.id)}}catch{}}catch{}})()},restoreFullState:n=>{const r={};n.agentMeta&&(r.agentMeta=n.agentMeta),n.instructionState&&(r.instructionState=n.instructionState),n.workflowSteps&&(r.workflowSteps=n.workflowSteps),n.mcpServers&&(r.mcpServers=n.mcpServers),n.skills&&(r.skills=n.skills),n.connectors&&(r.connectors=n.connectors),n.agentConfig&&(r.agentConfig=n.agentConfig),n.exportTarget&&(r.exportTarget=n.exportTarget),n.outputFormat&&(r.outputFormat=n.outputFormat),n.outputFormats&&(r.outputFormats=n.outputFormats),n.tokenBudget&&(r.tokenBudget=n.tokenBudget),n.prompt&&(r.prompt=n.prompt),n.channels&&(r.channels=n.channels),r.selectedPreset="",r.response="",e(r),n.mcpServers&&(async()=>{try{const{useMcpStore:i}=await Ho(async()=>{const{useMcpStore:s}=await Promise.resolve().then(()=>bb);return{useMcpStore:s}},void 0);await i.getState().syncFromConfig()}catch{}})()},setInstructionState:n=>{e({instructionState:n})},setWorkflowSteps:n=>{e({workflowSteps:n})},toggleConnector:n=>{e({connectors:t().connectors.map(r=>r.id===n?{...r,enabled:!r.enabled}:r)})},addConnector:n=>{const{connectors:r}=t();r.some(i=>i.id===n.id)||e({connectors:[...r,n]})},removeConnector:n=>{e({connectors:t().connectors.filter(r=>r.id!==n)})},updateConnectorScope:(n,r)=>{e({connectors:t().connectors.map(i=>i.id===n?{...i,hint:r}:i)})},setExportTarget:n=>e({exportTarget:n}),addPendingKnowledge:n=>{e({pendingKnowledge:[...t().pendingKnowledge,n]})},acceptPendingKnowledge:n=>{const r=t().pendingKnowledge.find(s=>s.id===n);if(!r)return;const i={sourceId:`feedback-${n}`,name:r.name,path:"",category:"knowledge",knowledgeType:r.type||"evidence",enabled:!0,depth:0,baseTokens:500};e({channels:[...t().channels,i],pendingKnowledge:t().pendingKnowledge.filter(s=>s.id!==n)})},dismissPendingKnowledge:n=>{e({pendingKnowledge:t().pendingKnowledge.filter(r=>r.id!==n)})},addSuggestedSkill:n=>{e({suggestedSkills:[...t().suggestedSkills,n]})},acceptSuggestedSkill:n=>{e({suggestedSkills:t().suggestedSkills.map(r=>r.id===n?{...r,installing:!0}:r)}),setTimeout(()=>{t().suggestedSkills.find(i=>i.id===n)&&(e({suggestedSkills:t().suggestedSkills.map(i=>i.id===n?{...i,installing:!1,installed:!0}:i)}),setTimeout(()=>{e({suggestedSkills:t().suggestedSkills.filter(i=>i.id!==n)})},1200))},1500)},dismissSuggestedSkill:n=>{e({suggestedSkills:t().suggestedSkills.filter(r=>r.id!==n)})},installRegistrySkill:(n,r,i)=>{const s=t().registrySkills.find(m=>m.id===n),l=t().registrySkills.map(m=>m.id===n?{...m,installed:!0,installedTarget:r,installedScope:i}:m),f=t().skills.some(m=>m.id===n)?t().skills:s?[...t().skills,{id:s.id,name:s.name,icon:s.icon,enabled:!0,added:!0,description:s.description,category:um(s.category)}]:t().skills;e({registrySkills:l,skills:f})},installRegistryMcp:n=>{const r=t().registryMcpServers.find(u=>u.id===n),i=t().registryMcpServers.map(u=>u.id===n?{...u,installed:!0,configured:!0}:u),l=t().mcpServers.some(u=>u.id===n)?t().mcpServers:r?[...t().mcpServers,{id:r.id,name:r.name,icon:r.icon,connected:!0,enabled:!0,added:!0,capabilities:["input","output"],category:R1(r.category),description:r.description}]:t().mcpServers;e({registryMcpServers:i,mcpServers:l})},addFileChannel:n=>{const{channels:r}=t(),i=`file:${n.path}`;if(r.some(u=>u.sourceId===i))return;const s=Hm(n.path,n.content),l={sourceId:i,name:n.path.split("/").pop()??n.path,path:n.path,category:"knowledge",knowledgeType:n.knowledgeType||s.knowledgeType,enabled:!0,depth:s.depth,baseTokens:n.tokenEstimate};e({channels:[...r,l],selectedPreset:""})},setInstructionPersona:n=>{e({instructionState:{...t().instructionState,persona:n}})},setInstructionTone:n=>{e({instructionState:{...t().instructionState,tone:n}})},setInstructionExpertise:n=>{e({instructionState:{...t().instructionState,expertise:Math.max(1,Math.min(5,n))}})},setInstructionConstraints:n=>{e({instructionState:{...t().instructionState,constraints:{...t().instructionState.constraints,...n}}})},setInstructionObjectives:n=>{e({instructionState:{...t().instructionState,objectives:{...t().instructionState.objectives,...n}}})},setInstructionRawPrompt:n=>{e({instructionState:{...t().instructionState,rawPrompt:n}})},setInstructionAutoSync:n=>{e({instructionState:{...t().instructionState,autoSync:n}})},addWorkflowStep:n=>{const r={...n,id:`step-${Date.now()}-${Math.random().toString(36).substr(2,9)}`};e({workflowSteps:[...t().workflowSteps,r]})},updateWorkflowStep:(n,r)=>{e({workflowSteps:t().workflowSteps.map(i=>i.id===n?{...i,...r}:i)})},removeWorkflowStep:n=>{e({workflowSteps:t().workflowSteps.filter(r=>r.id!==n)})},reorderWorkflowSteps:(n,r)=>{const i=[...t().workflowSteps],[s]=i.splice(n,1);i.splice(r,0,s),e({workflowSteps:i})},updateInstruction:n=>{e({instructionState:{...t().instructionState,...n}})},updateWorkflowSteps:n=>{const r=n.map((i,s)=>({...i,id:i.id||`step-${Date.now()}-${s}-${Math.random().toString(36).substr(2,5)}`}));e({workflowSteps:r})},setAgentPattern:n=>e({agentPattern:n}),updateVerification:n=>e({verification:{...t().verification,...n}}),updateErrorHandling:n=>e({errorHandling:{...t().errorHandling,...n}}),updateEvaluation:n=>e({evaluation:{...t().evaluation,...n}}),setOutputTemplateConfig:(n,r)=>{e({outputTemplateConfig:{...t().outputTemplateConfig,[n]:r}})},removeOutputTemplateConfig:n=>{const r={...t().outputTemplateConfig};delete r[n],e({outputTemplateConfig:r})},hydrateFromGenerated:n=>{e({agentMeta:{name:n.agentMeta.name||"",description:n.agentMeta.description||"",icon:"brain",category:"general",tags:n.agentMeta.tags||[],avatar:n.agentMeta.avatar||"bot"}}),e({instructionState:{persona:n.instructionState.persona||"",tone:n.instructionState.tone||"neutral",expertise:n.instructionState.expertise||3,constraints:{neverMakeUp:n.instructionState.constraints?.neverMakeUp??!0,askBeforeActions:n.instructionState.constraints?.askBeforeActions??!1,stayInScope:n.instructionState.constraints?.stayInScope??!0,useOnlyTools:n.instructionState.constraints?.useOnlyTools??!1,limitWords:n.instructionState.constraints?.limitWords??!1,wordLimit:n.instructionState.constraints?.wordLimit??0,customConstraints:(n.instructionState.constraints?.customConstraints||[]).join(`
|
|
130
|
+
`),scopeDefinition:n.instructionState.constraints?.scopeDefinition||""},objectives:{primary:n.instructionState.objectives?.primary||"",successCriteria:n.instructionState.objectives?.successCriteria||[],failureModes:n.instructionState.objectives?.failureModes||[]},rawPrompt:"",autoSync:!0}});const r=(n.workflowSteps||[]).map((f,m)=>({id:`gen-step-${m}-${Date.now()}`,label:f.label,action:f.action,tool:"",condition:f.condition?"if":"always",loop:f.loop,maxIterations:f.loop?3:0}));e({workflowSteps:r});const i=(n.mcpServerIds||[]).map(f=>{const m=ra.find(h=>h.id===f);return m?{id:m.id,name:m.name,icon:m.icon||"server",connected:!1,enabled:!0,added:!0,capabilities:[],category:R1(m.category),description:m.description}:null}).filter(Boolean);e({mcpServers:i});const s=(n.skillIds||[]).map(f=>{const m=vu.find(h=>h.id===f);return m?{id:m.id,name:m.name,icon:m.icon,enabled:!0,added:!0,description:m.description,category:um(m.category)}:null}).filter(Boolean);e({skills:s});const l=["ground-truth","signal","evidence","framework","hypothesis","guideline"],u=t().channels;if(n.knowledgeSelections&&n.knowledgeSelections.length>0){const f=u.map(m=>{const h=n.knowledgeSelections.find(v=>v.sourceId===m.sourceId);if(!h)return{...m,enabled:!1};const g=l.indexOf(h.type),b=g>=0?l[g]:m.knowledgeType||"evidence",y=typeof h.depth=="number"&&h.depth>=0&&h.depth<=4?h.depth:m.depth;return{...m,enabled:!0,knowledgeType:b,depth:y}});e({channels:f})}else if(n.knowledgeSuggestions&&n.knowledgeSuggestions.length>0){const f=n.knowledgeSuggestions.map((m,h)=>{const g=l.indexOf(m.type),b=g>=0?l[g]:"evidence";return{sourceId:`gen-knowledge-${h}-${Date.now()}`,name:m.name,path:"",category:"knowledge",knowledgeType:b,enabled:!0,depth:0,baseTokens:2e3}});e({channels:f})}e({response:"",selectedPreset:""})},loadDemoPreset:n=>{if(!n){const i=Vz;e({agentMeta:{...i.agentMeta},instructionState:{...i.instructionState},workflowSteps:[...i.workflowSteps],channels:[...i.channels],skills:[...i.skills],mcpServers:[...i.mcpServers],selectedPreset:"",response:""});return}const r=Zz[n];r&&e({agentMeta:{...r.agentMeta},instructionState:{...r.instructionState},workflowSteps:[...r.workflowSteps],channels:[...r.channels],skills:[...r.skills],mcpServers:[...r.mcpServers],selectedPreset:"",response:""})},resetAgent:()=>{e({agentMeta:{name:"",description:"",icon:"brain",category:"general",tags:[],avatar:"bot"},instructionState:{persona:"",tone:"neutral",expertise:3,constraints:{neverMakeUp:!1,askBeforeActions:!1,stayInScope:!1,useOnlyTools:!1,limitWords:!1,wordLimit:500,customConstraints:"",scopeDefinition:""},objectives:{primary:"",successCriteria:[],failureModes:[]},rawPrompt:"",autoSync:!0},workflowSteps:[]})},collectContextState:()=>({channels:t().channels,mcpServers:t().mcpServers,skills:t().skills,connectors:t().connectors}),restoreContextState:n=>{e({channels:n.channels,mcpServers:n.mcpServers,skills:n.skills,connectors:n.connectors})}}),{name:"modular-console",partialize:e=>({channels:e.channels,mcpServers:e.mcpServers,skills:e.skills,connectors:e.connectors,agentMeta:e.agentMeta,instructionState:e.instructionState,workflowSteps:e.workflowSteps,selectedModel:e.selectedModel,outputFormat:e.outputFormat,tokenBudget:e.tokenBudget,agentConfig:e.agentConfig}),version:1}));function Qh(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")||"modular-agent"}function Jh(){const e=ie.getState();return{id:Qh(e.agentMeta.name),version:"1.0.0",savedAt:new Date().toISOString(),agentMeta:{...e.agentMeta},instructionState:{...e.instructionState},workflowSteps:e.workflowSteps.map(n=>({...n})),channels:e.channels.map(n=>({...n})),mcpServers:e.mcpServers.map(n=>({...n})),skills:e.skills.map(n=>({...n})),connectors:e.connectors.map(n=>({...n})),agentConfig:{...e.agentConfig},exportTarget:e.exportTarget,outputFormat:e.outputFormat,outputFormats:[...e.outputFormats],tokenBudget:e.tokenBudget,prompt:e.prompt}}const fS=Object.freeze(Object.defineProperty({__proto__:null,agentNameToId:Qh,collectFullState:Jh,getEffectiveTokens:pS,useConsoleStore:ie},Symbol.toStringTag,{value:"Module"}));function Qz({value:e,onChange:t,children:n,t:r,ariaLabel:i}){return d.jsx("select",{value:e,onChange:s=>t(s.target.value),"aria-label":i,className:"appearance-none cursor-pointer outline-none text-[14px] h-8 pl-3 pr-7 rounded-lg",style:{fontFamily:"'Geist Sans', sans-serif",background:r.surfaceOpaque,border:`1px solid ${r.border}`,color:r.isDark?r.textSecondary:"#1a1a20",backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath d='M0 2l4 4 4-4' fill='none' stroke='%23${r.isDark?"555":"999"}' stroke-width='1.5'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 8px center"},children:n})}function Jz({onSettingsClick:e}){const t=ie(b=>b.selectedModel),n=ie(b=>b.setModel),r=ie(b=>b.running),i=ie(b=>b.run),s=Uu(b=>b.toggleTheme),l=Ee(),u=ie(b=>b.setShowMarketplace),f=dt(b=>b.getAllModels),m=dt(b=>b.providers),h=$.useMemo(()=>f(),[f,m]),g=h.length>0;return d.jsxs("div",{className:"flex items-center h-[48px] px-4 gap-3 shrink-0 border-b select-none",style:{background:l.surface,backdropFilter:"blur(12px)",borderColor:l.border},children:[d.jsxs("div",{className:"flex items-center gap-2 mr-4",children:[d.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:"#FE5000",boxShadow:"0 0 8px rgba(254,80,0,0.4)"}}),d.jsx("span",{className:"text-[17px] font-bold tracking-[3px] uppercase",style:{fontFamily:"'Geist Mono', monospace",color:l.textPrimary},children:"MODULAR"})]}),d.jsx(Qz,{value:g?`${dt.getState().selectedProviderId}::${t}`:"__no_models__",onChange:b=>{if(b==="__no_models__")return;const[y,...v]=b.split("::"),w=v.join("::");dt.getState().selectProvider(y),n(w)},t:l,ariaLabel:"Select AI model",children:h.map(b=>d.jsxs("option",{value:`${b.providerId}::${b.id}`,children:[b.providerName," — ",b.label]},`${b.providerId}-${b.id}`))}),!g&&d.jsx("button",{onClick:()=>ie.getState().setShowSettings(!0,"providers"),style:{background:"none",border:`1px solid ${l.border}`,borderRadius:6,padding:"4px 10px",color:"#FE5000",cursor:"pointer",fontFamily:"'Geist Mono', monospace",fontSize:"12px"},children:"⚡ Connect a model provider"}),d.jsx("div",{className:"flex-1"}),d.jsxs("button",{type:"button",onClick:()=>u(!0),className:"flex items-center justify-center gap-1.5 h-8 px-2.5 rounded-lg text-[14px] font-medium cursor-pointer border-none",style:{background:"#FE500012",color:"#FE5000",transition:"background 0.15s"},onMouseEnter:b=>{b.currentTarget.style.background="#FE500025"},onMouseLeave:b=>{b.currentTarget.style.background="#FE500012"},"aria-label":"Open Marketplace",children:[d.jsx(iz,{size:13}),"Marketplace"]}),d.jsx("button",{type:"button",onClick:e,className:"flex items-center justify-center w-11 h-11 rounded-md cursor-pointer border-none bg-transparent hover-accent-text focus-visible:outline focus-visible:outline-2",style:{color:l.textDim},"aria-label":"LLM settings",children:d.jsx(Qw,{size:14})}),d.jsx("button",{type:"button",onClick:s,className:"flex items-center justify-center w-11 h-11 rounded-md cursor-pointer border-none bg-transparent hover-accent-text focus-visible:outline focus-visible:outline-2",style:{color:l.textDim},"aria-label":l.isDark?"Switch to light mode":"Switch to dark mode",children:l.isDark?d.jsx(eS,{size:14}):d.jsx(Kw,{size:14})}),d.jsxs("button",{type:"button",onClick:i,className:"flex items-center justify-center gap-1.5 h-8 px-4 rounded-lg text-[14px] font-semibold tracking-wider uppercase cursor-pointer border-none",style:{background:r?"#CC4000":"#FE5000",color:"#fff",boxShadow:r?"0 0 12px rgba(254,80,0,0.5)":"0 0 8px rgba(254,80,0,0.25)",opacity:r?.8:1,animation:r?"run-pulse-ring 1.5s ease infinite":"none",transition:"background 0.2s ease, opacity 0.2s ease"},children:[r?d.jsx(Jw,{size:12,fill:"white"}):d.jsx(Xw,{size:12,fill:"white"}),r?"Stop":"Run",d.jsx("span",{className:"text-[13px] opacity-60 tracking-normal font-normal ml-1",children:r?"click to cancel":"Ctrl+Enter"})]})]})}function e6(){const e=ie(l=>l.totalTokens),t=ie(l=>l.tokenBudget),n=Ee(),r=e(),i=Math.min(r/t*100,100);let s=n.statusSuccess;return i>80?s=n.statusError:i>55&&(s=n.statusWarning),d.jsxs("div",{className:"w-full px-4 py-2 flex items-center gap-3 shrink-0 border-t",style:{background:n.surfaceOpaque,borderColor:n.border},children:[d.jsx("span",{className:"text-[12px] tracking-wider uppercase shrink-0 font-medium",style:{fontFamily:"'Geist Mono', monospace",color:n.tokenLabel},children:"Token Budget"}),d.jsx("div",{className:"flex-1 h-[6px] rounded-full overflow-hidden",style:{background:n.tokenTrackBg},children:d.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${i}%`,background:`linear-gradient(90deg, ${s}cc, ${s})`,boxShadow:`0 0 6px ${s}30`}})}),d.jsx("span",{className:"text-[13px] shrink-0 tabular-nums",style:{fontFamily:"'Geist Mono', monospace",color:s,minWidth:56,textAlign:"right",whiteSpace:"nowrap"},children:r>=1e3?`${(r/1e3).toFixed(1)}K`:r}),d.jsxs("span",{className:"text-[13px] shrink-0",style:{fontFamily:"'Geist Mono', monospace",color:n.tokenDivider,minWidth:64,whiteSpace:"nowrap"},children:["/ ",t>=1e3?`${(t/1e3).toFixed(0)}K`:t]})]})}const $1=`${ze}/knowledge`,dm=fn(e=>({tree:[],loaded:!1,scanning:!1,error:null,lastDir:"",scanDirectory:async t=>{e({scanning:!0,error:null});try{const r=await(await fetch(`${$1}/scan?dir=${encodeURIComponent(t)}&depth=3`)).json();r.status==="ok"&&r.data?e({tree:r.data,loaded:!0,scanning:!1,lastDir:t}):e({scanning:!1,error:r.error??"Scan failed"})}catch(n){e({scanning:!1,error:n instanceof Error?n.message:"Network error"})}},readFile:async t=>{try{const r=await(await fetch(`${$1}/read?path=${encodeURIComponent(t)}`)).json();return r.status==="ok"&&r.data?r.data:null}catch{return null}}}));function t6(e){return e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function mS(e,t){if(!t)return!0;const n=t.toLowerCase();return!!(e.name.toLowerCase().includes(n)||e.path.toLowerCase().includes(n)||e.children?.some(r=>mS(r,t)))}function hS({node:e,depth:t,onAdd:n,filter:r}){const[i,s]=$.useState(t<1||!!r),l=e.type==="directory"&&e.children&&e.children.length>0,u=Ee();return mS(e,r)?d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-2 rounded cursor-pointer transition-colors",style:{paddingLeft:8+t*16},onMouseEnter:f=>{f.currentTarget.style.background=u.surfaceHover},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:[l?d.jsx("button",{type:"button",onClick:()=>s(!i),className:"w-4 h-4 flex items-center justify-center text-[12px] cursor-pointer border-none bg-transparent",style:{color:u.textMuted},"aria-label":i?"Collapse folder":"Expand folder",children:i?"▼":"▶"}):d.jsx("span",{className:"w-4"}),d.jsx("div",{className:"w-[6px] h-[6px] rounded-full shrink-0",style:{background:e.type==="directory"?"#f1c40f":"#3498db"}}),d.jsx("span",{className:"flex-1 text-[13px] truncate",style:{fontFamily:"'Geist Mono', monospace",color:u.textPrimary},children:e.name}),e.tokenEstimate&&d.jsx("span",{className:"text-[13px] shrink-0",style:{fontFamily:"'Geist Mono', monospace",color:u.textDim},children:t6(e.tokenEstimate)}),e.type==="file"&&d.jsx("button",{type:"button",onClick:()=>n(e),className:"px-2 py-0.5 rounded text-[12px] tracking-[1px] uppercase cursor-pointer border transition-colors shrink-0",style:{fontFamily:"'Geist Mono', monospace",background:"transparent",borderColor:u.border,color:u.textMuted},onMouseEnter:f=>{f.currentTarget.style.borderColor="#FE5000",f.currentTarget.style.color="#FE5000"},onMouseLeave:f=>{f.currentTarget.style.borderColor=u.border,f.currentTarget.style.color=u.textMuted},"aria-label":`Add ${e.name}`,children:"+ ADD"})]}),l&&i&&e.children.map(f=>d.jsx(hS,{node:f,depth:t+1,onAdd:n,filter:r},f.path))]}):null}function n6(){const e=ie(S=>S.showFilePicker),t=ie(S=>S.setShowFilePicker),n=ie(S=>S.addFileChannel),{tree:r,loaded:i,scanning:s,scanDirectory:l}=dm(),u=dm(S=>S.readFile),f=dm(S=>S.lastDir),[m,h]=$.useState(""),[g,b]=$.useState(""),y=$.useRef(null),v=$.useRef(null),w=Ee();$.useEffect(()=>{e&&(h(""),b(f),setTimeout(()=>y.current?.focus(),100))},[e,f]),$.useEffect(()=>{if(!e)return;const S=N=>{N.key==="Escape"&&t(!1)};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[e,t]);const E=$.useCallback(S=>{if(S.key!=="Tab"||!v.current)return;const N=v.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(N.length===0)return;const R=N[0],T=N[N.length-1];S.shiftKey?document.activeElement===R&&(S.preventDefault(),T.focus()):document.activeElement===T&&(S.preventDefault(),R.focus())},[]);if(!e)return null;const C=async S=>{if(S.type!=="file")return;const N=f.replace(/\\/g,"/")+"/"+S.path,R=await u(N);R&&n(R)},M=()=>{g.trim()&&l(g.trim())};return d.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",onClick:()=>t(!1),children:[d.jsx("div",{className:"absolute inset-0",style:{background:"rgba(0,0,0,0.7)"}}),d.jsxs("div",{ref:v,role:"dialog","aria-modal":"true","aria-label":"Add Knowledge Source",className:"relative w-[560px] max-h-[70vh] flex flex-col rounded-lg overflow-hidden",style:{background:w.surfaceOpaque,border:`1px solid ${w.border}`,boxShadow:"0 24px 48px rgba(0,0,0,0.8)",animation:"modal-in 0.2s ease-out"},onClick:S=>S.stopPropagation(),onKeyDown:E,children:[d.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b",style:{borderColor:w.border},children:[d.jsx("span",{className:"text-[13px] font-bold tracking-[3px] uppercase",style:{fontFamily:"'Geist Mono', monospace",color:w.textPrimary},children:"ADD KNOWLEDGE SOURCE"}),d.jsx("button",{type:"button",onClick:()=>t(!1),className:"text-[17px] cursor-pointer border-none bg-transparent",style:{color:w.textMuted},onMouseEnter:S=>{S.currentTarget.style.color="#FE5000"},onMouseLeave:S=>{S.currentTarget.style.color=w.textMuted},"aria-label":"Close file picker",children:"✕"})]}),d.jsxs("div",{className:"px-4 py-2 border-b flex items-center gap-2",style:{borderColor:w.border},children:[d.jsx("input",{type:"text",value:g,onChange:S=>b(S.target.value),onKeyDown:S=>{S.key==="Enter"&&M()},placeholder:"Directory path to scan...",className:"flex-1 outline-none text-[13px]",style:{background:w.inputBg,border:`1px solid ${w.border}`,borderRadius:4,color:w.textPrimary,fontFamily:"'Geist Mono', monospace",padding:"6px 10px"},"aria-label":"Directory path to scan"}),d.jsx("button",{type:"button",onClick:M,disabled:s,className:"px-3 py-1 rounded text-[12px] tracking-wide uppercase cursor-pointer border-none",style:{background:"#FE5000",color:"#fff",opacity:s?.6:1},"aria-label":"Scan directory",children:s?"Scanning...":"Scan"})]}),d.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:w.borderSubtle},children:d.jsx("input",{ref:y,type:"text",value:m,onChange:S=>h(S.target.value),placeholder:"Filter results...",className:"w-full outline-none text-[13px]",style:{background:w.inputBg,border:`1px solid ${w.border}`,borderRadius:4,color:w.textPrimary,fontFamily:"'Geist Mono', monospace",padding:"6px 10px"},onFocus:S=>{S.currentTarget.style.borderColor="#FE500050"},onBlur:S=>{S.currentTarget.style.borderColor=w.border},"aria-label":"Filter knowledge sources"})}),d.jsx("div",{className:"flex-1 overflow-y-auto py-2 px-1",children:i&&r.length>0?r.map(S=>d.jsx(hS,{node:S,depth:0,onAdd:N=>{C(N)},filter:m},S.path)):i&&r.length===0?d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-[13px]",style:{color:w.textDim},children:"No files found. Try scanning a directory."})}):d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-[13px]",style:{color:w.textDim},children:"Enter a directory path and click Scan to browse files."})})})]})]})}const uu=fn((e,t)=>({skills:[],loaded:!1,loading:!1,error:void 0,loadSkills:async()=>{if(!t().loading){e({loading:!0,error:void 0});try{const n=await fetch(`${ze}/claude-config/skills`);if(!n.ok){e({loaded:!0,loading:!1,error:`Failed to load skills (${n.status})`});return}const i=(await n.json())?.data??[];e({skills:i.map(s=>({...s,enabled:!0})),loaded:!0,loading:!1})}catch{e({loaded:!0,loading:!1,error:"Backend unavailable. Start the server with `npm run server` on port 4800."})}}},toggleSkill:n=>{e({skills:t().skills.map(r=>r.id===n?{...r,enabled:!r.enabled}:r)})}})),eg={presentation:KD,mic:MD,cloud:x_,code:Lw,"bar-chart-3":Hh,anchor:L3,"git-branch":wi,palette:Yw,search:hd,image:sD,"book-open":Iw,hexagon:aD,workflow:jz,map:SD,sparkles:ga,compass:v_,waves:Cz,box:Bh,layout:$D,wrench:oS,cpu:wl,triangle:yz,"pen-tool":Ww,mail:vD,hash:tD,github:wi,"file-text":Cl,flame:Hw,database:Sl,globe:Uw,folder:U_,target:gd,"clipboard-list":m_,"hard-drive":J_,shield:Vh,brain:vl};function pm({icon:e,size:t=14,...n}){const r=eg[e];return r?d.jsx(r,{size:t,...n}):d.jsx(El,{size:t,...n})}function o6({icon:e,size:t=14,...n}){const r=eg[e];return r?d.jsx(r,{size:t,...n}):d.jsx(Bn,{size:t,...n})}function r6({icon:e,size:t=14,...n}){const r=eg[e];return r?d.jsx(r,{size:t,...n}):d.jsx(Bn,{size:t,...n})}function gS({open:e,onClose:t,title:n,searchPlaceholder:r,width:i=520,hideSearch:s,children:l}){const[u,f]=$.useState(""),m=$.useRef(null),h=$.useRef(null),g=Ee();$.useEffect(()=>{e&&(f(""),setTimeout(()=>m.current?.focus(),100))},[e]),$.useEffect(()=>{if(!e)return;const y=v=>{v.key==="Escape"&&t()};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[e,t]);const b=$.useCallback(y=>{if(y.key!=="Tab"||!h.current)return;const v=h.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(v.length===0)return;const w=v[0],E=v[v.length-1];y.shiftKey?document.activeElement===w&&(y.preventDefault(),E.focus()):document.activeElement===E&&(y.preventDefault(),w.focus())},[]);return e?cd.createPortal(d.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center",onClick:t,children:[d.jsx("div",{className:"absolute inset-0",style:{background:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}),d.jsxs("div",{ref:h,role:"dialog","aria-modal":"true","aria-label":n,className:"relative max-h-[70vh] flex flex-col rounded-xl overflow-hidden",style:{width:i,background:g.surfaceOpaque,border:`1px solid ${g.border}`,boxShadow:"0 24px 48px rgba(0,0,0,0.6)",animation:"modal-in 0.2s ease-out"},onClick:y=>y.stopPropagation(),onKeyDown:b,children:[d.jsxs("div",{className:"flex items-center justify-between px-5 py-4",style:{borderBottom:`1px solid ${g.border}`},children:[d.jsx("span",{className:"text-[14px] font-semibold",style:{color:g.textPrimary},children:n}),d.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-md cursor-pointer border-none bg-transparent",style:{color:g.textDim},"aria-label":"Close",children:d.jsx($t,{size:16})})]}),!s&&d.jsx("div",{className:"px-5 py-3",style:{borderBottom:`1px solid ${g.borderSubtle}`},children:d.jsxs("div",{className:"relative",children:[d.jsx(hd,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2",style:{color:g.textDim}}),d.jsx("input",{ref:m,type:"text",value:u,onChange:y=>f(y.target.value),placeholder:r??"Search...",className:"w-full outline-none text-[13px] pl-9 pr-3 py-1.5 rounded-lg",style:{background:g.inputBg,border:`1px solid ${g.border}`,color:g.textPrimary,fontFamily:"'Geist Sans', sans-serif"},"aria-label":"Search"})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:l(u)})]})]}),document.body):null}const Ts=new Map,du=new Set,yS=new Set;let fm=!1,pu=null;function a6(e){const t=e.includes(":")?e.split(":").pop():e;return t.includes("/")?t.split("/").pop():t}function i6(){return fm?Promise.resolve():pu||(pu=fetch(`${ze}/health/skills`).then(e=>e.json()).then(e=>{e.status==="ok"&&Array.isArray(e.data)&&e.data.forEach(t=>yS.add(t.id)),fm=!0}).catch(()=>{fm=!0}),pu)}function s6(e){return e==="ok"?"#2ecc71":e==="warning"?"#f39c12":e==="error"?"#e74c3c":"#888"}function wd({skillPath:e}){const t=Ee(),n=a6(e),[r,i]=$.useState(()=>Ts.get(n)??null),[s,l]=$.useState(()=>!Ts.has(n)&&!du.has(n)),[u,f]=$.useState(null);if($.useEffect(()=>{if(Ts.has(n)){i(Ts.get(n)),l(!1);return}if(du.has(n)){l(!1);return}let y=!1;return i6().then(()=>{if(!y){if(!yS.has(n)){du.add(n),l(!1);return}fetch(`${ze}/health/skills/${encodeURIComponent(n)}`).then(v=>v.status===404?(du.add(n),y||l(!1),null):v.json()).then(v=>{y||v===null||(v.status==="ok"&&v.data&&(Ts.set(n,v.data),i(v.data)),l(!1))}).catch(()=>{y||l(!1)})}}),()=>{y=!0}},[n]),!s&&r===null)return null;const m=s&&r===null,h=r?.securityIssues.some(y=>y.includes("undocumented"))??!1,g=[{key:"SEC",label:"SEC",color:r?r.securityIssues.length===0?"#2ecc71":"#e74c3c":"#888",tooltip:r?r.securityIssues.length===0?"Security: No issues":`Security: ${r.securityIssues.length} issue${r.securityIssues.length>1?"s":""}`:"Security: Loading..."},{key:"DEP",label:"DEP",color:r?r.outdatedDeps.length===0?"#2ecc71":"#f39c12":"#888",tooltip:r?r.outdatedDeps.length===0?"Dependencies: Up to date":`Dependencies: ${r.outdatedDeps.length} outdated`:"Dependencies: Loading..."},{key:"DOC",label:"DOC",color:r?h?"#e74c3c":"#2ecc71":"#888",tooltip:r?h?"Docs: Missing SKILL.md / README":"Docs: Present":"Docs: Loading..."}],b=s6(r?.status??null);return d.jsxs("div",{style:{position:"relative",display:"inline-flex",alignItems:"center",gap:3},children:[m?d.jsx(Ot,{size:8,style:{color:"#888"},className:"animate-spin"}):d.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:b,flexShrink:0}}),g.map(y=>d.jsxs("div",{style:{position:"relative",display:"inline-flex",alignItems:"center",gap:2,cursor:"default"},onMouseEnter:()=>f(y.key),onMouseLeave:()=>f(null),children:[d.jsx("span",{style:{fontSize:12,fontFamily:"'Geist Mono', monospace",fontWeight:600,color:m?"#888":y.color,lineHeight:1},children:y.label}),u===y.key&&d.jsx("div",{style:{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:4,background:t.surfaceOpaque,border:`1px solid ${t.border}`,borderRadius:4,padding:"2px 6px",whiteSpace:"nowrap",fontSize:12,color:t.textPrimary,boxShadow:"0 4px 12px rgba(0,0,0,0.4)",zIndex:100,pointerEvents:"none"},children:y.tooltip})]},y.key))]})}const l6={content:"Content",analysis:"Analysis",development:"Development",domain:"Domain"},c6=["content","analysis","development","domain"];function u6(e,t){const n=`${e} ${t}`.toLowerCase();return/analysis|insight|research|intel|feedback/.test(n)?"analysis":/code|dev|api|build|test|automation|github/.test(n)?"development":/content|write|presentation|slides|copy/.test(n)?"content":"domain"}function d6(){const e=ie(g=>g.showSkillPicker),t=ie(g=>g.setShowSkillPicker),n=ie(g=>g.skills),r=ie(g=>g.addSkill),i=ie(g=>g.upsertSkill),s=uu(g=>g.skills),l=uu(g=>g.loaded),u=uu(g=>g.loading),f=uu(g=>g.loadSkills),m=Ee();$.useEffect(()=>{e&&!l&&!u&&f()},[e,l,u,f]),$.useEffect(()=>{if(s.length!==0)for(const g of s)i({id:g.id,name:g.name,description:g.description||"Installed skill"})},[s,i]);const h=$.useMemo(()=>{const g=new Set(n.filter(y=>y.added).map(y=>y.id)),b=new Map(n.map(y=>[y.id,y]));for(const y of s)b.has(y.id)||b.set(y.id,{id:y.id,name:y.name,icon:"zap",enabled:y.enabled,added:g.has(y.id),description:y.description||"Installed skill",category:u6(y.name,y.description||"")});return Array.from(b.values())},[n,s]);return d.jsx(gS,{open:e,onClose:()=>t(!1),title:"Add Skill",searchPlaceholder:"Search skills...",children:g=>{const b=h.filter(v=>{if(!g)return!0;const w=g.toLowerCase();return v.name.toLowerCase().includes(w)||v.description.toLowerCase().includes(w)});return c6.map(v=>({category:v,label:l6[v],skills:b.filter(w=>w.category===v)})).filter(v=>v.skills.length>0).map(v=>d.jsxs("div",{children:[d.jsx("div",{className:"px-5 py-1.5",children:d.jsx("span",{className:"text-[12px] font-medium tracking-wider uppercase",style:{color:m.textDim},children:v.label})}),v.skills.map(w=>d.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 hover-row cursor-default",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center shrink-0",style:{background:m.surfaceElevated},children:d.jsx(o6,{icon:w.icon,size:16,style:{color:m.textSecondary}})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-[17px] font-medium",style:{color:m.textPrimary},children:w.name}),w.skillUrl?.startsWith("https://skills.sh/")&&d.jsx(wd,{skillPath:w.skillUrl.replace("https://skills.sh/","").split("/").pop()??""})]}),d.jsx("span",{className:"text-[14px]",style:{color:m.textDim},children:w.description})]}),w.added?d.jsxs("span",{className:"flex items-center gap-1 text-[14px] px-2.5 py-1 rounded-md",style:{color:m.statusSuccess,background:m.statusSuccessBg},children:[d.jsx(Wt,{size:12})," Added"]}):d.jsxs("button",{type:"button",onClick:()=>r(w.id),className:"flex items-center gap-1 text-[14px] px-2.5 py-1 rounded-md cursor-pointer border-none",style:{color:"#FE5000",background:"#FE500012",transition:"background 0.15s ease"},onMouseEnter:E=>{E.currentTarget.style.background="#FE500025"},onMouseLeave:E=>{E.currentTarget.style.background="#FE500012"},"aria-label":`Add ${w.name}`,children:[d.jsx(Ft,{size:12})," Add"]})]},w.id))]},v.category))}})}function ul({content:e,children:t,position:n="top",delay:r=300}){const i=Ee(),[s,l]=$.useState(!1),[u,f]=$.useState({x:0,y:0}),m=$.useRef(void 0),h=$.useRef(null),g=()=>{m.current=setTimeout(()=>{if(!h.current)return;const v=h.current.getBoundingClientRect();f({x:v.left+v.width/2,y:n==="top"?v.top-8:v.bottom+8}),l(!0)},r)},b=()=>{clearTimeout(m.current),l(!1)},y=i.isDark?"#333":"#222";return d.jsxs(d.Fragment,{children:[d.jsx("span",{ref:h,onMouseEnter:g,onMouseLeave:b,className:"inline-flex",children:t}),s&&cd.createPortal(d.jsxs("div",{className:"fixed z-[300] pointer-events-none px-2.5 py-1.5 rounded text-[12px]",style:{left:u.x,top:u.y,transform:n==="top"?"translate(-50%, -100%)":"translate(-50%, 0)",background:y,color:"#fff",fontFamily:"'Geist Mono', monospace",boxShadow:"0 2px 8px rgba(0,0,0,0.3)",maxWidth:250,whiteSpace:"normal",lineHeight:1.4},children:[e,d.jsx("div",{style:{position:"absolute",left:"50%",transform:"translateX(-50%)",...n==="top"?{bottom:-4,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderTop:`5px solid ${y}`}:{top:-4,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderBottom:`5px solid ${y}`},width:0,height:0}})]}),document.body)]})}function p6(){const e=ie(W=>W.showMarketplace),t=ie(W=>W.activeMarketplaceTab),n=ie(W=>W.setShowMarketplace),r=ie(W=>W.registrySkills),i=ie(W=>W.installRegistrySkill),s=ie(W=>W.upsertSkill),l=ie(W=>W.skills),[u,f]=$.useState(""),[m,h]=$.useState("all"),[g,b]=$.useState(null),[y,v]=$.useState(null),[w,E]=$.useState(()=>new Set),[C,M]=$.useState([]),[S,N]=$.useState(!1),[R,T]=$.useState(null),[D,H]=$.useState(null),V=$.useRef(null),B=$.useRef(null),O=Ee(),Y=new Set(Array.isArray(l)?l.filter(W=>W.added).map(W=>W.id??""):[]),Z=$.useCallback(W=>{if(W.key!=="Tab"||!B.current)return;const ae=B.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(ae.length===0)return;const le=ae[0],me=ae[ae.length-1];W.shiftKey?document.activeElement===le&&(W.preventDefault(),me.focus()):document.activeElement===me&&(W.preventDefault(),le.focus())},[]);$.useEffect(()=>{e&&(f(""),h("all"),b(null),v(null),M([]),N(!1),T(null),H(null),setTimeout(()=>V.current?.focus(),100))},[e]),$.useEffect(()=>{if(!e)return;const W=ae=>{ae.key==="Escape"&&n(!1)};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[e,n]);const U=$.useCallback(W=>{n(!0,W),f(""),h("all"),M([]),T(null),N(!1)},[n]),_=$.useCallback((W,ae,le)=>{b(W),H(null),setTimeout(()=>{i(W,ae,le),b(null)},1200)},[i]),A=$.useCallback(async W=>{v(W.id);try{const ae=await fetch(`${ze}/skills/install`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({skillId:W.id})});if(!ae.ok)throw new Error(`HTTP ${ae.status}`);E(le=>new Set(le).add(W.id)),s({id:W.id,name:W.name,description:`Installed from skills.sh (${W.repo})`,skillUrl:W.url})}catch(ae){T(ae instanceof Error?ae.message:"Install failed")}finally{v(null)}},[s]);$.useEffect(()=>{if(!e||t!=="skills"){N(!1),M([]),T(null);return}const W=u.trim();if(W.length<2){N(!1),M([]),T(null);return}const ae=new AbortController,le=setTimeout(async()=>{N(!0),T(null);try{const me=await fetch(`${ze}/skills/search?q=${encodeURIComponent(W)}`,{signal:ae.signal});if(!me.ok)throw new Error(`HTTP ${me.status}`);const G=await me.json();M(Array.isArray(G.data)?G.data:[]),T(G.error??null)}catch(me){if(ae.signal.aborted)return;M([]),T(me instanceof Error?me.message:"Search failed")}finally{ae.signal.aborted||N(!1)}},300);return()=>{ae.abort(),clearTimeout(le)}},[t,u,e]);const q=()=>{if(typeof window>"u")return 4;const W=window.innerWidth;return W<=1024?2:W<=1440?3:4},[K,Q]=$.useState(q);if($.useEffect(()=>{const W=()=>Q(q());return window.addEventListener("resize",W),()=>window.removeEventListener("resize",W)},[]),!e)return null;const I=(W,ae)=>{if(!u)return!0;const le=u.toLowerCase();return W.toLowerCase().includes(le)||ae.toLowerCase().includes(le)},F=r.filter(W=>I(W.name,W.description)&&(m==="all"||W.category===m)),L=SM.filter(W=>I(W.name,W.description)),z={display:"grid",gridTemplateColumns:`repeat(${K}, 1fr)`,gap:12,padding:16,alignContent:"start"};return d.jsx(d.Fragment,{children:d.jsxs("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>n(!1),children:[d.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.90)",backdropFilter:"blur(4px)"}}),d.jsxs("div",{ref:B,role:"dialog","aria-modal":"true","aria-label":"Marketplace",style:{position:"relative",display:"flex",flexDirection:"column",borderRadius:6,overflow:"hidden",isolation:"isolate",zIndex:1,width:"90vw",maxWidth:1600,height:"80vh",background:O.surfaceOpaque,border:`1px solid ${O.border}`,boxShadow:"0 24px 48px rgba(0,0,0,0.6)",animation:"modal-in 0.2s ease-out"},onClick:W=>W.stopPropagation(),onKeyDown:Z,children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 16px",borderBottom:`1px solid ${O.border}`},children:[d.jsx("span",{style:{fontSize:17,fontWeight:600,flexShrink:0,color:O.textPrimary,fontFamily:"'Geist Mono', monospace"},children:"Marketplace"}),d.jsxs("div",{style:{position:"relative",width:240,flexShrink:0},children:[d.jsx(hd,{size:13,style:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:O.textDim}}),d.jsx("input",{ref:V,type:"text",value:u,onChange:W=>f(W.target.value),placeholder:"Search...",style:{width:"100%",outline:"none",fontSize:14,paddingLeft:32,paddingRight:12,paddingTop:6,paddingBottom:6,borderRadius:6,background:O.inputBg,border:`1px solid ${O.border}`,color:O.textPrimary,fontFamily:"'Geist Sans', sans-serif"}})]}),d.jsx("div",{style:{display:"flex",alignItems:"center",marginLeft:"auto",borderBottom:`1px solid ${O.borderSubtle}`},children:["skills","mcp","presets"].map(W=>d.jsx("button",{type:"button",onClick:()=>U(W),style:{padding:"6px 12px",fontSize:13,fontWeight:500,letterSpacing:"0.025em",textTransform:"uppercase",cursor:"pointer",border:"none",color:t===W?"#FE5000":O.textDim,borderBottom:t===W?"2px solid #FE5000":"2px solid transparent",background:"transparent",marginBottom:-1,transition:"color 150ms ease"},children:W==="mcp"?"MCP Servers":W==="presets"?"Presets":"Skills"},W))}),d.jsx(ul,{content:"Close marketplace (Esc)",children:d.jsx("button",{type:"button",onClick:()=>n(!1),style:{padding:4,borderRadius:6,cursor:"pointer",border:"none",background:"transparent",flexShrink:0,color:O.textDim},"aria-label":"Close marketplace",children:d.jsx($t,{size:16})})})]}),t==="skills"&&d.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 16px",borderBottom:`1px solid ${O.borderSubtle}`,gap:12,flexWrap:"wrap"},children:[d.jsx("div",{style:{display:"flex",alignItems:"center",gap:4,flexWrap:"wrap",flex:1},children:xb.map(W=>d.jsx("button",{type:"button",onClick:()=>h(W.id),style:{fontSize:12,padding:"2px 10px",borderRadius:9999,cursor:"pointer",border:"none",fontWeight:500,background:m===W.id?"#FE5000":O.surfaceElevated,color:m===W.id?"#fff":O.textSecondary,transition:"background 150ms ease, color 150ms ease"},children:W.label},W.id))}),d.jsx("div",{style:{display:"flex",alignItems:"center",gap:12,flexShrink:0},children:Object.entries(wu).map(([W,ae])=>d.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,fontSize:13,color:O.textDim},children:[d.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:ae.color,display:"inline-block",flexShrink:0}}),ae.label]},W))})]}),t==="mcp"&&d.jsx("div",{style:{display:"flex",alignItems:"center",padding:"8px 16px",gap:4,flexWrap:"wrap",borderBottom:`1px solid ${O.borderSubtle}`},children:xb.map(W=>d.jsx("button",{type:"button",onClick:()=>h(W.id),style:{fontSize:12,padding:"2px 10px",borderRadius:9999,cursor:"pointer",border:"none",fontWeight:500,background:m===W.id?"#FE5000":O.surfaceElevated,color:m===W.id?"#fff":O.textSecondary,transition:"background 150ms ease, color 150ms ease"},children:W.label},W.id))}),d.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[t==="skills"&&d.jsxs(d.Fragment,{children:[F.length>0&&d.jsx("div",{style:z,children:F.map(W=>d.jsx(f6,{skill:W,isInLibrary:Y.has(W.id),installing:g===W.id,dropdownOpen:D===W.id,onToggleDropdown:()=>H(D===W.id?null:W.id),onInstall:_,t:O},W.id))}),F.length===0&&!S&&!R&&C.length===0&&d.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px 0"},children:d.jsx("span",{style:{fontSize:14,color:O.textFaint},children:"No skills match your search"})}),(u.trim().length>=2||S||R||C.length>0)&&d.jsx("div",{style:{padding:"16px 16px 8px",borderTop:`1px solid ${O.borderSubtle}`},children:d.jsx("span",{style:{fontSize:12,letterSpacing:"0.05em",textTransform:"uppercase",color:O.textDim,fontFamily:"'Geist Mono', monospace"},children:"From skill.sh"})}),S&&d.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 0"},children:d.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,color:O.textDim},children:[d.jsx(Ot,{size:12,style:{animation:"spin 1s linear infinite"}}),"Searching skill.sh..."]})}),!S&&R&&d.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 16px"},children:d.jsx("span",{style:{fontSize:13,color:O.statusError},children:"skill.sh search unavailable"})}),!S&&!R&&C.length>0&&d.jsx("div",{style:{...z,paddingTop:0},children:C.map(W=>d.jsx(m6,{skill:W,installing:y===W.id,installed:w.has(W.id),onInstall:()=>A(W),t:O},W.id))}),!S&&!R&&u.trim().length>=2&&C.length===0&&d.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 16px"},children:d.jsx("span",{style:{fontSize:13,color:O.textFaint},children:"No results from skill.sh"})})]}),t==="mcp"&&d.jsxs("div",{style:{textAlign:"center",padding:40},children:[d.jsx("p",{style:{color:O.textDim,marginBottom:12},children:"Browse and connect MCP servers"}),d.jsx("button",{onClick:()=>{n(!1),ie.getState().setShowConnectionPicker(!0)},style:{background:"#FE5000",color:"#fff",border:"none",borderRadius:6,padding:"8px 16px",cursor:"pointer",fontFamily:"'Geist Mono', monospace"},children:"Open Connection Picker"})]}),t==="presets"&&d.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[L.map(W=>d.jsx(h6,{preset:W,t:O,onLoad:()=>n(!1)},W.id)),L.length===0&&d.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px 0"},children:d.jsx("span",{style:{fontSize:14,color:O.textFaint},children:"No presets match your search"})})]})]})]})]})})}function f6({skill:e,isInLibrary:t,installing:n,dropdownOpen:r,onToggleDropdown:i,onInstall:s,t:l}){const[u,f]=$.useState(!1),[m,h]=$.useState("claude"),[g,b]=$.useState("project"),y=t||e.installed;return d.jsxs("div",{style:{background:l.surfaceElevated,border:`1px solid ${y?l.borderSubtle:l.border}`,borderRadius:6,padding:"10px 12px",display:"flex",flexDirection:"column",gap:5,opacity:y?.55:1,position:"relative",transition:"border-color 150ms ease",minHeight:120},onMouseEnter:v=>{y||(v.currentTarget.style.borderColor="#FE500050")},onMouseLeave:v=>{v.currentTarget.style.borderColor=y?l.borderSubtle:l.border},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:6},children:[d.jsx("span",{style:{fontSize:13,fontWeight:600,color:l.textPrimary,fontFamily:"'Geist Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.name}),d.jsxs("span",{style:{fontSize:13,color:l.textDim,background:l.badgeBg,borderRadius:3,padding:"1px 4px",whiteSpace:"nowrap",flexShrink:0,fontFamily:"'Geist Mono', monospace"},children:[e.installs>=1e3?`${(e.installs/1e3).toFixed(1)}k`:e.installs,"↓"]})]}),d.jsx("span",{style:{fontSize:12,color:l.textDim,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"'Geist Sans', sans-serif"},children:e.author}),d.jsxs("div",{style:{flex:1},children:[d.jsx("span",{style:{fontSize:12,color:l.textMuted,fontFamily:"'Geist Sans', sans-serif",lineHeight:1.4,display:u?"block":"-webkit-box",WebkitLineClamp:u?"unset":2,WebkitBoxOrient:"vertical",overflow:u?"visible":"hidden"},children:e.description}),d.jsx("button",{type:"button",onClick:()=>f(!u),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:l.textDim,display:"inline-flex",alignItems:"center",marginTop:1},children:u?d.jsx(Fw,{size:9}):d.jsx(Pn,{size:9})})]}),d.jsx(wd,{skillPath:e.id}),d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:2},children:[d.jsx("div",{style:{display:"flex",gap:4,alignItems:"center"},children:e.runtimes.map(v=>d.jsx("span",{title:wu[v].label,style:{width:7,height:7,borderRadius:"50%",background:wu[v].color,display:"inline-block",flexShrink:0}},v))}),y?d.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:13,color:l.statusSuccess,background:l.statusSuccessBg,borderRadius:4,padding:"2px 6px"},children:[d.jsx(Wt,{size:9})," In Library"]}):n?d.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:13,color:"#FE5000",background:"#FE500010",borderRadius:4,padding:"2px 6px"},children:[d.jsx(Ot,{size:9,className:"animate-spin"})," Installing"]}):d.jsxs("button",{type:"button",onClick:i,style:{fontSize:13,padding:"2px 8px",borderRadius:4,cursor:"pointer",border:`1px solid ${r?"#FE5000":l.border}`,color:r?"#FE5000":l.textSecondary,background:"transparent",display:"inline-flex",alignItems:"center",gap:3,transition:"border-color 150ms ease, color 150ms ease"},onMouseEnter:v=>{v.currentTarget.style.borderColor="#FE5000",v.currentTarget.style.color="#FE5000"},onMouseLeave:v=>{r||(v.currentTarget.style.borderColor=l.border,v.currentTarget.style.color=l.textSecondary)},children:["Install ",d.jsx(Pn,{size:8})]})]}),r&&d.jsxs("div",{style:{position:"absolute",right:0,bottom:"calc(100% + 4px)",background:l.surfaceOpaque,border:`1px solid ${l.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",borderRadius:6,padding:10,zIndex:20,width:220,display:"flex",flexDirection:"column",gap:8},children:[d.jsxs("div",{children:[d.jsx("span",{style:{fontSize:13,fontWeight:600,color:l.textDim,fontFamily:"'Geist Mono', monospace",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Target"}),d.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:4},children:["all",...e.runtimes].map(v=>d.jsx("button",{type:"button",onClick:()=>h(v),style:{fontSize:13,padding:"2px 6px",borderRadius:4,cursor:"pointer",border:"none",background:m===v?"#FE5000":l.surfaceElevated,color:m===v?"#fff":l.textSecondary,fontWeight:500},children:v==="all"?"All":wu[v].label},v))})]}),d.jsxs("div",{children:[d.jsx("span",{style:{fontSize:13,fontWeight:600,color:l.textDim,fontFamily:"'Geist Mono', monospace",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Scope"}),d.jsx("div",{style:{display:"flex",gap:4,marginTop:4},children:["project","global"].map(v=>d.jsx("button",{type:"button",onClick:()=>b(v),style:{fontSize:13,padding:"2px 6px",borderRadius:4,cursor:"pointer",border:"none",background:g===v?"#FE5000":l.surfaceElevated,color:g===v?"#fff":l.textSecondary,fontWeight:500,textTransform:"capitalize"},children:v},v))})]}),d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,background:l.inputBg,borderRadius:4,padding:"4px 6px"},children:[d.jsx(al,{size:9,style:{color:l.textDim,flexShrink:0}}),d.jsxs("code",{style:{fontSize:12,color:l.textMuted,fontFamily:"'Geist Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[e.installCmd," --target ",m," --scope ",g]})]}),d.jsx("button",{type:"button",onClick:()=>s(e.id,m,g),style:{width:"100%",padding:"6px",borderRadius:4,border:"none",background:"#FE5000",color:"#fff",fontSize:12,fontWeight:600,cursor:"pointer"},children:"Confirm Install"})]})]})}function m6({skill:e,installing:t,installed:n,onInstall:r,t:i}){const[s,l]=$.useState(!1),u=e.url.replace("https://skills.sh/","");return d.jsxs("div",{style:{background:i.surfaceElevated,border:`1px solid ${i.border}`,borderRadius:6,padding:"10px 12px",display:"flex",flexDirection:"column",gap:5,position:"relative",transition:"border-color 150ms ease",minHeight:120},onMouseEnter:f=>{f.currentTarget.style.borderColor="#FE500050"},onMouseLeave:f=>{f.currentTarget.style.borderColor=i.border},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:6},children:[d.jsx("span",{style:{fontSize:13,fontWeight:600,color:i.textPrimary,fontFamily:"'Geist Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.name}),d.jsxs("span",{style:{fontSize:13,color:i.textDim,background:i.badgeBg,borderRadius:3,padding:"1px 4px",whiteSpace:"nowrap",flexShrink:0,fontFamily:"'Geist Mono', monospace"},children:[e.installs,"↓"]})]}),d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[d.jsx("span",{style:{fontSize:12,color:i.textDim,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,fontFamily:"'Geist Sans', sans-serif"},children:e.repo}),d.jsx(ul,{content:"View on skills.sh",children:d.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",style:{color:i.textDim,flexShrink:0,display:"inline-flex"},"aria-label":`Open ${e.name} on skills.sh`,onMouseEnter:f=>{f.currentTarget.style.color="#FE5000"},onMouseLeave:f=>{f.currentTarget.style.color=i.textDim},children:d.jsx(Bw,{size:10})})})]}),d.jsxs("div",{style:{flex:1},children:[d.jsx("span",{style:{fontSize:12,color:i.textMuted,fontFamily:"'Geist Sans', sans-serif",lineHeight:1.4,display:s?"block":"-webkit-box",WebkitLineClamp:s?"unset":2,WebkitBoxOrient:"vertical",overflow:s?"visible":"hidden"},children:e.url}),d.jsx("button",{type:"button",onClick:()=>l(!s),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:i.textDim,display:"inline-flex",alignItems:"center",marginTop:1},children:s?d.jsx(Fw,{size:9}):d.jsx(Pn,{size:9})})]}),d.jsx(wd,{skillPath:u}),d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:2},children:[d.jsx(Bn,{size:10,style:{color:i.textDim}}),n?d.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:13,color:i.statusSuccess,background:i.statusSuccessBg,borderRadius:4,padding:"2px 6px"},children:[d.jsx(Wt,{size:9})," Installed"]}):t?d.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:13,color:"#FE5000",background:"#FE500010",borderRadius:4,padding:"2px 6px"},children:[d.jsx(Ot,{size:9,className:"animate-spin"})," Installing"]}):d.jsxs("button",{type:"button",onClick:r,style:{fontSize:13,padding:"2px 8px",borderRadius:4,cursor:"pointer",border:`1px solid ${i.border}`,color:"#FE5000",background:"#FE500010",display:"inline-flex",alignItems:"center",gap:3},children:[d.jsx(md,{size:9})," Install"]})]})]})}function h6({preset:e,t,onLoad:n}){return d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"0 16px",minHeight:56,borderBottom:`1px solid ${t.borderSubtle}`,transition:"background 100ms ease"},onMouseEnter:r=>{r.currentTarget.style.background=t.surfaceHover},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:[d.jsx("div",{style:{width:24,height:24,borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:"#FE500010"},children:d.jsx(r6,{icon:e.icon,size:14,style:{color:"#FE5000"}})}),d.jsxs("div",{style:{flex:1,minWidth:0},children:[d.jsx("div",{style:{fontSize:14,fontWeight:500,color:t.textPrimary},children:e.name}),d.jsx("div",{style:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:2,color:t.textMuted},title:e.description,spellCheck:!1,children:e.description}),d.jsxs("div",{style:{display:"flex",gap:4,marginTop:2},children:[e.skills.slice(0,3).map(r=>d.jsx("span",{style:{fontSize:12,padding:"0 4px",borderRadius:2,color:t.cableSkills,background:t.cableSkills+"10"},children:r},r)),e.mcpServers.slice(0,2).map(r=>d.jsx("span",{style:{fontSize:12,padding:"0 4px",borderRadius:2,color:t.cableMcp,background:t.cableMcp+"10"},children:r},r))]})]}),d.jsx("button",{type:"button",onClick:n,style:{fontSize:12,padding:"4px 8px",borderRadius:6,cursor:"pointer",flexShrink:0,background:"transparent",border:`1px solid ${t.border}`,color:t.textSecondary,whiteSpace:"nowrap",minWidth:80,transition:"border-color 150ms ease, color 150ms ease, background 150ms ease"},onMouseEnter:r=>{r.currentTarget.style.borderColor="#FE5000",r.currentTarget.style.color="#fff",r.currentTarget.style.background="#FE5000"},onMouseLeave:r=>{r.currentTarget.style.borderColor=t.border,r.currentTarget.style.color=t.textSecondary,r.currentTarget.style.background="transparent"},children:"Load Preset"})]})}async function g6(e){const t=await fetch(`${ze}/mcp/oauth/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverUrl:e})});if(!t.ok){const r=await t.json().catch(()=>({error:"Request failed"}));throw new Error(r.error||`HTTP ${t.status}`)}const{authUrl:n}=await t.json();return new Promise((r,i)=>{const s=window.open(n,"mcp-oauth","width=600,height=700,popup=yes");if(!s){i(new Error("Popup blocked — allow popups for this site"));return}const l=()=>{window.removeEventListener("message",u),clearInterval(f),clearTimeout(m)},u=h=>{const g=h.data;g?.type&&(g.type==="mcp-oauth-success"?(l(),r()):g.type==="mcp-oauth-error"&&(l(),i(new Error(g.error||"OAuth flow failed"))))};window.addEventListener("message",u);const f=setInterval(()=>{s.closed&&(l(),i(new Error("OAuth flow cancelled")))},500),m=setTimeout(()=>{l(),s.close(),i(new Error("OAuth flow timed out"))},3e5)})}async function y6(e){const t=await fetch(`${ze}/mcp/oauth/status?serverUrl=${encodeURIComponent(e)}`);return t.ok?await t.json():{connected:!1}}const mm=(e="none")=>{switch(e){case"oauth":return{bg:"#FE500010",color:"#FE5000",text:"OAuth"};case"api-key":return{bg:"#3498db10",color:"#3498db",text:"API Key"};default:return{bg:"#2ecc7110",color:"#2ecc71",text:"Local"}}};function hm({status:e}){const t=e==="connected"?"#00cc66":e==="connecting"?"#f5a623":e==="error"?"#ff4444":"#555",n=e==="connected"?"Connected":e==="connecting"?"Connecting…":e==="error"?"Error":"Disconnected";return d.jsx("span",{className:e==="connecting"?"animate-pulse":"",style:{display:"inline-block",width:7,height:7,borderRadius:"50%",background:t,flexShrink:0},title:n})}function L1({title:e,collapsed:t,onToggle:n,t:r}){return d.jsxs("div",{className:"flex items-center gap-2 px-5 py-2 cursor-pointer select-none",onClick:n,children:[t?d.jsx(Go,{size:12,style:{color:r.textDim}}):d.jsx(Pn,{size:12,style:{color:r.textDim}}),d.jsx("span",{className:"text-[11px] tracking-[0.12em] uppercase font-bold",style:{color:r.textDim,fontFamily:"'Geist Mono', monospace"},children:e})]})}function x6(){const e=ie(A=>A.showConnectionPicker),t=ie(A=>A.setShowConnectionPicker),n=ie(A=>A.connectors),r=ie(A=>A.addConnector),i=ie(A=>A.upsertMcpServer),s=Ee(),[l,u]=$.useState({}),[f,m]=$.useState({}),[h,g]=$.useState({}),[b,y]=$.useState(!1),[v,w]=$.useState(!1),[E,C]=$.useState("All"),[M,S]=$.useState({}),N=vt(A=>A.servers),R=vt(A=>A.addServer),T=ra.filter(A=>A.authMethod==="oauth"&&!!A.url),D=["All",...Array.from(new Set(ra.map(A=>A.category)))];$.useEffect(()=>{e&&T.forEach(A=>{y6(A.url).then(q=>{if(u(K=>({...K,[A.url]:q.connected})),q.connected){const K=A.id;ie.getState().connectors.some(Q=>Q.service===K)||r({id:`conn-${A.id}-oauth`,service:K,name:A.name,mcpServerId:A.id,direction:"both",enabled:!0,config:{},status:"connected",authMethod:"oauth"})}}).catch(()=>{})})},[e]);const H=async A=>{m(q=>({...q,[A.url]:!0})),g(q=>({...q,[A.url]:""}));try{await g6(A.url),u(K=>({...K,[A.url]:!0})),await R({id:A.id,name:A.name,type:"http",command:"",args:[],env:{},url:A.url,headers:{},autoConnect:!0}),await i({id:A.id,name:A.name,description:A.description,connected:!0});const q=A.id;n.some(K=>K.service===q)||r({id:`conn-${A.id}-oauth-${Date.now()}`,service:q,name:A.name,mcpServerId:A.id,direction:"both",enabled:!0,config:{},status:"connected",authMethod:"oauth"})}catch(q){g(K=>({...K,[A.url]:q.message}))}finally{m(q=>({...q,[A.url]:!1}))}},V=A=>{const q=ra.find(K=>K.id===A);q&&S(K=>({...K,[A]:{entry:q,expanded:!K[A]?.expanded,configValues:K[A]?.configValues||{}}}))},B=(A,q,K)=>{S(Q=>({...Q,[A]:{...Q[A],configValues:{...Q[A]?.configValues,[q]:K}}}))},O=async A=>{const K=M[A.id]?.configValues||{};await i({id:A.id,name:A.name,description:A.description,connected:!1});const Q={};A.configFields&&A.configFields.length>0&&A.configFields.forEach(I=>{const F=K[I.key];F&&(Q[I.key]=F)}),await R({id:A.id,name:A.name,type:A.transport==="stdio"?"stdio":"http",command:A.command||"",args:A.defaultArgs||[],env:Q,autoConnect:!0,...A.url?{url:A.url}:{}}),S(I=>({...I,[A.id]:{...I[A.id],expanded:!1}}))},Y=A=>N.some(q=>q.id===A)||n.some(q=>q.mcpServerId===A),Z=A=>N.find(K=>K.id===A)?.status??"disconnected",U=A=>{const q=l[A.url]??!1,K=f[A.url]??!1,Q=h[A.url],I=Y(A.id),F=mm("oauth");return d.jsxs("div",{className:"flex items-center gap-3 px-4 py-1.5 hover-row cursor-default",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center shrink-0",style:{background:s.surfaceElevated},children:d.jsx(pm,{icon:A.icon,size:16,style:{color:s.textSecondary}})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(hm,{status:q?"connected":"disconnected"}),d.jsx("span",{className:"text-[13px] font-medium",style:{color:s.textPrimary},children:A.name}),d.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full uppercase",style:{background:F.bg,color:F.color,fontFamily:"'Geist Mono', monospace",fontWeight:600},children:F.text})]}),d.jsxs("div",{children:[d.jsx("span",{className:"text-[11px]",style:{color:s.textDim},children:A.description}),Q&&d.jsx("span",{className:"text-[10px] ml-2",style:{color:"#ff4444"},children:Q})]})]}),I&&q?d.jsxs("span",{className:"flex items-center gap-1 text-[11px] px-2.5 py-1 rounded-md",style:{color:s.statusSuccess,background:s.statusSuccessBg},children:[d.jsx(Wt,{size:12})," Connected"]}):d.jsxs("button",{type:"button",onClick:()=>H(A),disabled:K,className:"flex items-center gap-1.5 text-[11px] px-3 py-1 rounded-md cursor-pointer border-none",style:{background:"#FE500018",color:"#FE5000",fontWeight:600,opacity:K?.7:1},children:[K?d.jsx(Ot,{size:12,className:"animate-spin"}):d.jsx(Ft,{size:12}),K?"Connecting...":"Connect"]})]},A.id)},_=A=>{if(A.authMethod==="oauth"){const F=l[A.url]??!1,L=mm("oauth");return d.jsxs("div",{className:"flex items-center gap-3 px-4 py-1.5 hover-row cursor-default",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center shrink-0",style:{background:s.surfaceElevated},children:d.jsx(pm,{icon:A.icon,size:16,style:{color:s.textSecondary}})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(hm,{status:F?"connected":"disconnected"}),d.jsx("span",{className:"text-[13px] font-medium",style:{color:s.textPrimary},children:A.name}),d.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full uppercase",style:{background:L.bg,color:L.color,fontFamily:"'Geist Mono', monospace",fontWeight:600},children:L.text})]}),d.jsx("span",{className:"text-[11px]",style:{color:s.textDim},children:A.description})]}),d.jsxs("button",{type:"button",onClick:()=>A.url&&H(A),className:"flex items-center gap-1.5 text-[11px] px-3 py-1 rounded-md cursor-pointer border-none",style:{background:"#FE500018",color:"#FE5000",fontWeight:600},children:[d.jsx(Ft,{size:12}),"Connect via OAuth"]})]},A.id)}const q=Y(A.id),K=mm(A.authMethod),Q=M[A.id],I=A.configFields&&A.configFields.length>0;return d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-3 px-4 py-1.5 hover-row cursor-default",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center shrink-0",style:{background:s.surfaceElevated},children:d.jsx(pm,{icon:A.icon,size:16,style:{color:s.textSecondary}})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(hm,{status:Z(A.id)}),d.jsx("span",{className:"text-[13px] font-medium",style:{color:s.textPrimary},children:A.name}),d.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full uppercase",style:{background:K.bg,color:K.color,fontFamily:"'Geist Mono', monospace",fontWeight:600},children:K.text})]}),d.jsx("span",{className:"text-[11px]",style:{color:s.textDim},children:A.description})]}),q?d.jsxs("span",{className:"flex items-center gap-1 text-[11px] px-2.5 py-1 rounded-md",style:{color:s.statusSuccess,background:s.statusSuccessBg},children:[d.jsx(Wt,{size:12})," Added"]}):d.jsxs("button",{type:"button",onClick:()=>I?V(A.id):O(A),className:"flex items-center gap-1.5 text-[11px] px-3 py-1 rounded-md cursor-pointer border-none",style:{background:"#FE500018",color:"#FE5000",fontWeight:600},children:[d.jsx(Ft,{size:12}),"Add"]})]}),I&&Q?.expanded&&d.jsxs("div",{className:"px-4 py-3 ml-11 mr-4 mb-2 rounded-lg",style:{background:s.surfaceElevated},children:[d.jsx("div",{className:"text-[12px] font-medium mb-2",style:{color:s.textPrimary},children:"Configuration"}),d.jsxs("div",{className:"space-y-2",children:[A.configFields.map(F=>d.jsxs("div",{children:[d.jsxs("label",{className:"text-[11px]",style:{color:s.textDim},children:[F.label," ",F.required&&"*"]}),d.jsx("input",{type:F.type==="password"||F.key.toLowerCase().includes("token")||F.key.toLowerCase().includes("key")?"password":"text",placeholder:F.placeholder,value:Q.configValues[F.key]||"",onChange:L=>B(A.id,F.key,L.target.value),className:"w-full mt-1 px-2 py-1 text-[12px] rounded border outline-none",style:{background:s.inputBg,border:`1px solid ${s.border}`,color:s.textPrimary,fontFamily:"'Geist Mono', monospace"}})]},F.key)),d.jsxs("div",{className:"flex gap-2 mt-3",children:[d.jsxs("button",{type:"button",onClick:()=>O(A),disabled:A.configFields.some(F=>F.required&&!Q.configValues[F.key]),className:"flex items-center gap-1 text-[11px] px-3 py-1.5 rounded-md cursor-pointer border-none",style:{background:"#FE5000",color:"white",fontWeight:600,opacity:A.configFields.some(F=>F.required&&!Q.configValues[F.key])?.5:1},children:[d.jsx(Wt,{size:12}),"Save & Add"]}),d.jsx("button",{type:"button",onClick:()=>V(A.id),className:"text-[11px] px-3 py-1.5 rounded-md cursor-pointer border-none",style:{background:s.border,color:s.textDim},children:"Cancel"})]})]})]})]},A.id)};return d.jsx(gS,{open:e,onClose:()=>t(!1),title:"Add Connection",searchPlaceholder:"Search connections...",width:600,children:A=>{const q=A?.toLowerCase()??"",K=T.filter(I=>!q||I.name.toLowerCase().includes(q)||I.description.toLowerCase().includes(q)),Q=ra.filter(I=>{const F=!q||I.name.toLowerCase().includes(q)||I.description.toLowerCase().includes(q)||I.tags&&I.tags.some(z=>z.toLowerCase().includes(q)),L=E==="All"||I.category===E;return F&&L});return d.jsxs(d.Fragment,{children:[K.length>0&&d.jsxs(d.Fragment,{children:[d.jsx(L1,{title:"Quick Connect",collapsed:b,onToggle:()=>y(!b),t:s}),!b&&d.jsx("div",{className:"pb-2",children:K.map(U)})]}),d.jsx(L1,{title:"MCP Library",collapsed:v,onToggle:()=>w(!v),t:s}),!v&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"flex gap-1 px-5 py-2 overflow-x-auto",children:D.map(I=>d.jsx("button",{type:"button",onClick:()=>C(I),className:"text-[11px] px-2 py-1 rounded-md cursor-pointer border-none whitespace-nowrap",style:{background:E===I?"#FE5000":"transparent",color:E===I?"white":s.textDim,fontFamily:"'Geist Mono', monospace",fontWeight:600},children:I},I))}),d.jsx("div",{className:"max-h-[400px] overflow-y-auto pb-2",children:Q.map(_)})]})]})}})}const b6=[{id:"providers",label:"Providers"},{id:"mcp",label:"MCP Servers"},{id:"general",label:"General"}];function Ku(e,t){switch(e){case"connected":return t.statusSuccess;case"configured":return t.statusWarning;case"error":return t.statusError;default:return t.textMuted}}function k6({provider:e}){const t=Ee(),[n,r]=$.useState(!1),[i,s]=$.useState(!1),[l,u]=$.useState(e.apiKey||""),[f,m]=$.useState(e.baseUrl),[h,g]=$.useState(null),b=dt(O=>O.setProviderKey),y=dt(O=>O.setProviderAuthMethod),v=dt(O=>O.setProviderBaseUrl),w=dt(O=>O.testConnection),E=dt(O=>O.testing[e.id]),C=dt(O=>O.deleteProvider),M=dt(O=>O.saveProvider),S=e.id.startsWith("custom-"),N=e.id==="openai",R=N&&e.authMethod==="oauth",T=e.id==="anthropic"?"Claude":e.name,D=Array.isArray(e.models)?e.models:[];$.useEffect(()=>{e.apiKey&&e.apiKey.trim().length>0&&u(e.apiKey),m(e.baseUrl)},[e.apiKey,e.baseUrl]);const H=$.useCallback(()=>{b(e.id,l),v(e.id,f),M(e.id)},[e.id,l,f,b,v,M]),V=$.useCallback(async()=>{H();const O=await w(e.id);g(O)},[e.id,H,w]),B={background:t.inputBg,border:`1px solid ${t.border}`,color:t.textPrimary,fontFamily:"'Geist Sans', sans-serif"};return d.jsxs("div",{style:{background:n?t.surfaceElevated:"transparent",borderBottom:`1px solid ${t.borderSubtle}`},children:[d.jsxs("div",{role:"button",tabIndex:0,className:"nodrag nowheel w-full flex items-center gap-3 px-4 py-3 cursor-pointer border-none bg-transparent text-left",onClick:()=>r(!n),style:{color:t.textPrimary},children:[d.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:Ku(e.status,t),boxShadow:`0 0 6px ${Ku(e.status,t)}40`}}),d.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center shrink-0",style:{background:e.color+"20"},children:d.jsx(wl,{size:14,style:{color:e.color}})}),d.jsx("span",{className:"text-[14px] font-semibold flex-1",style:{fontFamily:"'Geist Mono', monospace"},children:T}),d.jsx("span",{className:"text-[12px]",style:{color:t.textMuted},children:e.status==="connected"?`${D.length} models`:e.status})]}),n&&d.jsxs("div",{className:"px-4 pb-4 flex flex-col gap-3",children:[N&&d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("label",{className:"text-[12px] tracking-wider uppercase",style:{color:t.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Auth Mode"}),d.jsxs("select",{value:e.authMethod,onChange:O=>y(e.id,O.target.value),className:"nodrag nowheel w-full text-[14px] px-3 py-2 rounded-lg outline-none",style:B,children:[d.jsx("option",{value:"api-key",children:"API Key"}),d.jsx("option",{value:"oauth",children:"Local Session (experimental)"})]})]}),e.authMethod==="claude-agent-sdk"?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-2 text-[14px] px-3 py-2.5 rounded-lg",style:{background:t.badgeBg,border:`1px solid ${t.borderSubtle}`},children:[d.jsx(al,{size:14,style:{color:e.color}}),d.jsx("span",{style:{color:t.textSecondary},children:"Authenticates via your Claude Code login — no API key needed."})]}),e.status==="connected"&&d.jsxs("div",{className:"flex items-center gap-2 text-[14px] px-3 py-2 rounded-lg",style:{background:t.statusSuccessBg,border:`1px solid ${t.statusSuccess}30`,color:t.statusSuccess},children:[d.jsx(qu,{size:14}),d.jsxs("span",{children:["Authenticated",e.lastError?` — ${e.lastError}`:" via Claude Code"]})]}),e.status==="error"&&d.jsxs("div",{className:"flex items-center gap-2 text-[14px] px-3 py-2 rounded-lg",style:{background:t.statusErrorBg,border:`1px solid ${t.statusError}30`,color:t.statusError},children:[d.jsx(rl,{size:14}),d.jsx("span",{children:e.lastError||"Not authenticated — install Claude Code and run claude login"})]}),d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("label",{className:"text-[12px] tracking-wider uppercase",style:{color:t.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Available Models"}),d.jsx("div",{className:"flex flex-wrap gap-1",children:D.map(O=>d.jsx("span",{className:"text-[12px] px-2 py-0.5 rounded",style:{background:e.color+"15",color:e.color,fontFamily:"'Geist Mono', monospace"},children:O.label},O.id))})]}),d.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[d.jsxs("button",{type:"button",onClick:V,disabled:E,className:"nodrag nowheel flex items-center gap-1.5 text-[14px] px-3 py-1.5 rounded-lg cursor-pointer font-semibold border-none",style:{background:"#FE5000",color:"#fff",opacity:E?.6:1},children:[E?d.jsx(Ot,{size:12,className:"animate-spin"}):d.jsx(Zw,{size:12}),"Check Status"]}),d.jsx("button",{type:"button",onClick:V,disabled:E,className:"nodrag nowheel flex items-center gap-1 text-[13px] px-2.5 py-1.5 rounded-lg cursor-pointer border-none",style:{color:t.textSecondary,background:t.badgeBg,opacity:E?.6:1},children:"Refresh Models"})]})]}):d.jsxs(d.Fragment,{children:[R?d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs("div",{className:"flex items-start gap-2 text-[14px] px-3 py-2.5 rounded-lg",style:{background:t.badgeBg,border:`1px solid ${t.borderSubtle}`},children:[d.jsx(al,{size:14,style:{color:e.color,marginTop:1}}),d.jsx("span",{style:{color:t.textSecondary},children:"Codex browser sign-in (guided): open OpenAI dashboard, create key, and complete login flow."})]}),d.jsx("button",{type:"button",onClick:async()=>{try{const Y=await(await fetch(`${ze}/auth/codex/start`,{method:"POST"})).json(),Z=Y?.data?.sessionId,U=Y?.data?.authUrl;if(!Z||!U)return;window.open(U,"_blank","noopener,noreferrer");const _=window.prompt("Paste your OpenAI API key to complete Codex login");if(!_)return;const K=(await(await fetch(`${ze}/auth/codex/complete/${Z}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:_.trim()})})).json())?.data?.apiKey;if(!K)return;b(e.id,K),u(K),v(e.id,f),M(e.id),await V()}catch{}},className:"nodrag nowheel flex items-center justify-center gap-1.5 text-[14px] px-3 py-2 rounded-lg cursor-pointer font-semibold border-none",style:{background:"#FE5000",color:"#fff"},children:"Sign in with Codex"})]}):d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("label",{className:"text-[12px] tracking-wider uppercase",style:{color:t.textMuted,fontFamily:"'Geist Mono', monospace"},children:"API Key"}),d.jsxs("div",{className:"relative",children:[d.jsx("input",{type:i?"text":"password",value:l,onChange:O=>u(O.target.value),onBlur:H,placeholder:e._hasStoredKey?"Key stored on server":"sk-...",className:"nodrag nowheel w-full text-[14px] px-3 py-2 pr-9 rounded-lg outline-none",style:B}),d.jsx("button",{type:"button",onClick:()=>s(!i),className:"nodrag nowheel absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer border-none bg-transparent p-0.5",style:{color:t.textDim},children:i?d.jsx(D_,{size:14}):d.jsx(R_,{size:14})})]})]}),d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("label",{className:"text-[12px] tracking-wider uppercase",style:{color:t.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Base URL"}),d.jsx("input",{type:"text",value:f,onChange:O=>m(O.target.value),onBlur:H,className:"nodrag nowheel w-full text-[14px] px-3 py-2 rounded-lg outline-none",style:B})]}),d.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[d.jsxs("button",{type:"button",onClick:V,disabled:E,className:"nodrag nowheel flex items-center gap-1.5 text-[14px] px-3 py-1.5 rounded-lg cursor-pointer font-semibold border-none",style:{background:"#FE5000",color:"#fff",opacity:E?.6:1},children:[E?d.jsx(Ot,{size:12,className:"animate-spin"}):d.jsx(El,{size:12}),"Test Connection"]}),d.jsx("button",{type:"button",onClick:V,disabled:E,className:"nodrag nowheel flex items-center gap-1 text-[13px] px-2.5 py-1.5 rounded-lg cursor-pointer border-none",style:{color:t.textSecondary,background:t.badgeBg,opacity:E?.6:1},children:"Refresh Models"}),e.keyPageUrl&&!R&&d.jsxs("a",{href:e.keyPageUrl,target:"_blank",rel:"noopener noreferrer",className:"nodrag nowheel flex items-center gap-1 text-[13px] px-2 py-1.5 rounded-lg no-underline",style:{color:t.textSecondary,background:t.badgeBg},children:[d.jsx(Bw,{size:10}),"Get API Key"]}),S&&d.jsxs("button",{type:"button",onClick:()=>C(e.id),className:"nodrag nowheel flex items-center gap-1 text-[13px] px-2 py-1.5 rounded-lg cursor-pointer border-none ml-auto",style:{color:t.statusError,background:t.statusErrorBg},children:[d.jsx(yd,{size:10}),"Remove"]})]}),h&&d.jsxs("div",{className:"flex items-center gap-2 text-[14px] px-3 py-2 rounded-lg",style:{background:h.ok?t.statusSuccessBg:t.statusErrorBg,border:`1px solid ${h.ok?t.statusSuccess+"30":t.statusError+"30"}`,color:h.ok?t.statusSuccess:t.statusError},children:[h.ok?d.jsx(qu,{size:14}):d.jsx(rl,{size:14}),h.ok?`Connected${h.models?` — ${h.models.length} models available`:""}`:h.error||"Connection failed"]})]}),e.headerNote&&d.jsx("span",{className:"text-[12px]",style:{color:t.textFaint},children:e.headerNote})]})]})}function v6(){const e=Ee(),t=dt(r=>r.providers),n=dt(r=>r.addCustomProvider);return d.jsxs("div",{className:"flex flex-col",children:[d.jsx("div",{className:"flex flex-col",children:t.filter((r,i,s)=>s.findIndex(l=>l.id===r.id)===i).map(r=>d.jsx(k6,{provider:r},r.id))}),d.jsx("div",{className:"p-4",children:d.jsxs("button",{type:"button",onClick:n,className:"nodrag nowheel flex items-center gap-2 text-[14px] px-3 py-2 rounded-lg cursor-pointer w-full justify-center",style:{border:`1px dashed ${e.border}`,background:"transparent",color:e.textMuted},children:[d.jsx(Ft,{size:12}),"Add Custom Provider"]})})]})}function w6({server:e}){const t=Ee(),[n,r]=$.useState(!1),i=vt(m=>m.connectServer),s=vt(m=>m.disconnectServer),l=vt(m=>m.removeServer),u=ie(m=>m.removeMcpServer),f=$.useCallback(()=>{e.status==="connected"?s(e.id):i(e.id)},[e.id,e.status,i,s]);return d.jsxs("div",{style:{borderBottom:`1px solid ${t.borderSubtle}`},children:[d.jsxs("div",{className:"nodrag nowheel w-full flex items-center gap-3 px-4 py-3",children:[d.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:Ku(e.status,t),boxShadow:`0 0 6px ${Ku(e.status,t)}40`}}),d.jsx(nz,{size:14,style:{color:t.textDim}}),d.jsxs("div",{className:"flex-1",children:[d.jsxs("div",{className:"text-[14px] font-semibold",style:{color:t.textPrimary,fontFamily:"'Geist Mono', monospace"},children:[e.name,e.mcpStatus&&e.mcpStatus!=="enabled"&&d.jsx("span",{className:"text-[12px] px-1.5 py-0.5 rounded ml-2 uppercase",style:{fontFamily:"'Geist Mono', monospace",fontWeight:600,background:e.mcpStatus==="deferred"?t.statusWarningBg:t.statusErrorBg,color:e.mcpStatus==="deferred"?t.statusWarning:t.statusError},children:e.mcpStatus})]}),d.jsx("div",{className:"text-[12px]",style:{color:t.textMuted},children:e.status==="connected"?`Connected · ${e.tools.length} tool${e.tools.length!==1?"s":""}${e.uptime?` · ${Math.round(e.uptime/1e3)}s uptime`:""}`:e.status==="connecting"?"Connecting…":e.status==="error"?e.lastError||"Connection error":"Disconnected"})]}),d.jsxs("button",{type:"button",onClick:m=>{m.stopPropagation(),f()},className:"nodrag nowheel flex items-center gap-1 text-[13px] px-2.5 py-1 rounded-lg cursor-pointer border-none",style:{background:e.status==="connected"?t.statusErrorBg:t.statusSuccessBg,color:e.status==="connected"?t.statusError:t.statusSuccess},children:[e.status==="connecting"?d.jsx(Ot,{size:10,className:"animate-spin"}):e.status==="connected"?d.jsx(Zw,{size:10}):d.jsx(El,{size:10}),e.status==="connecting"?"Connecting...":e.status==="connected"?"Disconnect":"Reconnect"]}),d.jsx("button",{type:"button",onClick:()=>{l(e.id),u(e.id)},className:"nodrag nowheel flex items-center gap-1 text-[13px] px-2 py-1 rounded-lg cursor-pointer border-none",style:{color:t.statusError,background:t.statusErrorBg},title:"Remove server",children:d.jsx(yd,{size:10})})]}),e.tools.length>0&&d.jsxs("div",{className:"px-4 pb-3",children:[d.jsxs("button",{type:"button",onClick:()=>r(!n),className:"nodrag nowheel flex items-center gap-1 text-[12px] cursor-pointer border-none bg-transparent",style:{color:t.textDim},children:[n?d.jsx(Pn,{size:12}):d.jsx(Go,{size:12}),"View Tools (",e.tools.length,")"]}),n&&d.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:e.tools.map(m=>d.jsx("span",{className:"text-[12px] px-2 py-0.5 rounded",style:{background:"#FE500015",color:"#FE5000",fontFamily:"'Geist Mono', monospace"},title:m.description,children:m.name},m.name))})]})]})}function S6(){const e=Ee(),t=ie(B=>B.mcpServers),n=vt(B=>B.servers),r=vt(B=>B.loaded),i=vt(B=>B.loading),s=vt(B=>B.loadServers),l=vt(B=>B.addServer),u=vt(B=>B.error),f=ie(B=>B.upsertMcpServer),m=t.map(B=>{const O=n.find(Y=>Y.id===B.id);return{...B,status:O?.status||"disconnected",tools:O?.tools||[],lastError:O?.lastError||void 0,command:O?.command||B.description||"",args:O?.args||[],env:O?.env||{}}}),h=n.filter(B=>!t.some(O=>O.id===B.id)).map(B=>({...B,isRuntimeOnly:!0})),g=[...m,...h],[b,y]=$.useState(!1),[v,w]=$.useState(""),[E,C]=$.useState(""),[M,S]=$.useState(""),[N,R]=$.useState(""),[T,D]=$.useState(!1);$.useEffect(()=>{!r&&!i&&s()},[r,i,s]);const H=$.useCallback(async()=>{if(!(!v.trim()||!E.trim())){D(!0);try{const B=M.split(`
|
|
131
|
+
`).filter(Z=>Z.trim()).map(Z=>Z.trim()),O={};N.split(`
|
|
132
|
+
`).forEach(Z=>{const[U,..._]=Z.split("=");U?.trim()&&_.length>0&&(O[U.trim()]=_.join("=").trim())});const Y=await l({name:v.trim(),command:E.trim(),args:B,env:O});Y&&f({id:Y.id,name:Y.name,description:Y.command,connected:Y.status==="connected"}),w(""),C(""),S(""),R(""),y(!1)}finally{D(!1)}}},[v,E,M,N,l,f]),V={background:e.inputBg,border:`1px solid ${e.border}`,color:e.textPrimary,fontFamily:"'Geist Sans', sans-serif"};return d.jsxs("div",{className:"flex flex-col",children:[d.jsx("div",{className:"mx-4 mt-3 mb-1 px-3 py-2 rounded-lg text-[12px]",style:{background:e.surfaceElevated,color:e.textMuted,border:`1px solid ${e.borderSubtle}`},children:"Configure new connections in the Connection Picker. This tab shows runtime status."}),i&&d.jsxs("div",{className:"px-4 py-8 text-center text-[14px]",style:{color:e.textMuted},children:[d.jsx(Ot,{size:16,className:"animate-spin mx-auto mb-2"}),"Loading MCP servers..."]}),u&&d.jsx("div",{className:"mx-4 mt-3 px-3 py-2 rounded-lg text-[14px]",style:{background:e.statusErrorBg,color:e.statusError,border:`1px solid ${e.statusError}30`},children:u}),r&&g.map(B=>d.jsx(w6,{server:B},B.id)),r&&g.length===0&&!b&&d.jsx("div",{className:"px-4 py-8 text-center text-[14px]",style:{color:e.textMuted},children:"No MCP servers configured. Add a server below."}),b&&d.jsxs("div",{className:"p-4",style:{borderTop:`1px solid ${e.borderSubtle}`,background:e.surfaceElevated},children:[d.jsx("div",{className:"text-[14px] font-semibold mb-3",style:{color:e.textPrimary,fontFamily:"'Geist Mono', monospace"},children:"Add MCP Server"}),d.jsxs("div",{className:"flex flex-col gap-3",children:[d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("label",{className:"text-[12px] tracking-wider uppercase",style:{color:e.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Name"}),d.jsx("input",{type:"text",value:v,onChange:B=>w(B.target.value),placeholder:"My MCP Server",className:"nodrag nowheel w-full text-[14px] px-3 py-2 rounded-lg outline-none",style:V})]}),d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("label",{className:"text-[12px] tracking-wider uppercase",style:{color:e.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Command"}),d.jsx("input",{type:"text",value:E,onChange:B=>C(B.target.value),placeholder:"uv",className:"nodrag nowheel w-full text-[14px] px-3 py-2 rounded-lg outline-none",style:V})]}),d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("label",{className:"text-[12px] tracking-wider uppercase",style:{color:e.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Arguments (one per line)"}),d.jsx("textarea",{value:M,onChange:B=>S(B.target.value),placeholder:`tool
|
|
133
|
+
run
|
|
134
|
+
--python
|
|
135
|
+
/path/to/server.py`,className:"nodrag nowheel w-full text-[14px] px-3 py-2 rounded-lg outline-none resize-none",style:{...V,minHeight:"60px"},rows:3})]}),d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("label",{className:"text-[12px] tracking-wider uppercase",style:{color:e.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Environment (key=value, one per line)"}),d.jsx("textarea",{value:N,onChange:B=>R(B.target.value),placeholder:`API_KEY=your_key
|
|
136
|
+
DEBUG=1`,className:"nodrag nowheel w-full text-[14px] px-3 py-2 rounded-lg outline-none resize-none",style:{...V,minHeight:"60px"},rows:3})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("button",{type:"button",onClick:H,disabled:T||!v.trim()||!E.trim(),className:"nodrag nowheel flex items-center gap-1.5 text-[14px] px-3 py-1.5 rounded-lg cursor-pointer font-semibold border-none",style:{background:"#FE5000",color:"#fff",opacity:T||!v.trim()||!E.trim()?.6:1},children:[T?d.jsx(Ot,{size:12,className:"animate-spin"}):d.jsx(Ft,{size:12}),"Add Server"]}),d.jsx("button",{type:"button",onClick:()=>y(!1),className:"nodrag nowheel text-[14px] px-3 py-1.5 rounded-lg cursor-pointer border-none",style:{color:e.textMuted,background:e.badgeBg},children:"Cancel"})]})]})]}),r&&!b&&d.jsx("div",{className:"p-4",children:d.jsxs("button",{type:"button",onClick:()=>y(!0),className:"nodrag nowheel flex items-center gap-2 text-[14px] px-3 py-2 rounded-lg cursor-pointer w-full justify-center",style:{border:`1px dashed ${e.border}`,background:"transparent",color:e.textMuted},children:[d.jsx(Ft,{size:12}),"Add MCP Server"]})})]})}function C6(){const e=Ee(),t=Uu(M=>M.theme),n=Uu(M=>M.toggleTheme),[r,i]=$.useState(()=>localStorage.getItem("modular-edge-style")||"smoothstep"),[s,l]=$.useState(()=>localStorage.getItem("modular-grid-snap")!=="false"),[u,f]=$.useState(()=>localStorage.getItem("modular-minimap")!=="false"),[m,h]=$.useState(()=>localStorage.getItem("modular-bg-style")||"dots"),g=(M,S)=>localStorage.setItem(M,S),b=[{id:"system",label:"System",icon:zD},{id:"light",label:"Light",icon:eS},{id:"dark",label:"Dark",icon:Kw}],y=[{id:"smoothstep",label:"SmoothStep",icon:Mz},{id:"bezier",label:"Bezier",icon:wi},{id:"step",label:"Step",icon:B3}],v=[{id:"dots",label:"Dots"},{id:"lines",label:"Lines"},{id:"none",label:"None"}],w={color:e.textMuted,fontFamily:"'Geist Mono', monospace"},E={borderBottom:`1px solid ${e.borderSubtle}`},C=M=>{(M==="light"?"light":"dark")!==t&&n(),g("modular-theme",M)};return d.jsxs("div",{className:"flex flex-col",children:[d.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:E,children:[d.jsx("span",{className:"text-[12px] tracking-wider uppercase",style:w,children:"Theme"}),d.jsx("div",{className:"flex gap-1",children:b.map(M=>{const S=M.id==="system"&&t==="dark"&&localStorage.getItem("modular-theme")==="system"||M.id===t;return d.jsxs("button",{type:"button",onClick:()=>C(M.id),className:"nodrag nowheel flex items-center gap-1 text-[13px] px-2.5 py-1 rounded-md cursor-pointer border-none",style:{background:S?"#FE500020":e.badgeBg,color:S?"#FE5000":e.textDim},children:[d.jsx(M.icon,{size:11}),M.label]},M.id)})})]}),d.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:E,children:[d.jsx("span",{className:"text-[12px] tracking-wider uppercase",style:w,children:"Edge Routing"}),d.jsx("div",{className:"flex gap-1",children:y.map(M=>d.jsxs("button",{type:"button",onClick:()=>{i(M.id),g("modular-edge-style",M.id)},className:"nodrag nowheel flex items-center gap-1 text-[13px] px-2.5 py-1 rounded-md cursor-pointer border-none",style:{background:r===M.id?"#FE500020":e.badgeBg,color:r===M.id?"#FE5000":e.textDim},children:[d.jsx(M.icon,{size:11}),M.label]},M.id))})]}),d.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:E,children:[d.jsx("span",{className:"text-[12px] tracking-wider uppercase",style:w,children:"Grid Snap"}),d.jsx("button",{type:"button",onClick:()=>{const M=!s;l(M),g("modular-grid-snap",String(M))},className:"nodrag nowheel w-9 h-5 rounded-full cursor-pointer border-none relative transition-colors",style:{background:s?"#FE5000":e.badgeBg},children:d.jsx("div",{className:"absolute top-0.5 w-4 h-4 rounded-full transition-transform",style:{background:"#fff",left:s?"18px":"2px",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"}})})]}),d.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:E,children:[d.jsx("span",{className:"text-[12px] tracking-wider uppercase",style:w,children:d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(qh,{size:11})," Minimap"]})}),d.jsx("button",{type:"button",onClick:()=>{const M=!u;f(M),g("modular-minimap",String(M))},className:"nodrag nowheel w-9 h-5 rounded-full cursor-pointer border-none relative transition-colors",style:{background:u?"#FE5000":e.badgeBg},children:d.jsx("div",{className:"absolute top-0.5 w-4 h-4 rounded-full transition-transform",style:{background:"#fff",left:u?"18px":"2px",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"}})})]}),d.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:E,children:[d.jsx("span",{className:"text-[12px] tracking-wider uppercase",style:w,children:d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(W_,{size:11})," Background"]})}),d.jsx("div",{className:"flex gap-1",children:v.map(M=>d.jsx("button",{type:"button",onClick:()=>{h(M.id),g("modular-bg-style",M.id)},className:"nodrag nowheel text-[13px] px-2.5 py-1 rounded-md cursor-pointer border-none",style:{background:m===M.id?"#FE500020":e.badgeBg,color:m===M.id?"#FE5000":e.textDim},children:M.label},M.id))})]})]})}function E6({open:e,onClose:t}){const n=Ee(),r=ie(f=>f.activeSettingsTab),[i,s]=$.useState(r||"providers");$.useEffect(()=>{e&&r&&s(r)},[e,r]);const l=$.useRef(null),u=$.useCallback(f=>{if(f.key!=="Tab"||!l.current)return;const m=l.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(m.length===0)return;const h=m[0],g=m[m.length-1];f.shiftKey?document.activeElement===h&&(f.preventDefault(),g.focus()):document.activeElement===g&&(f.preventDefault(),h.focus())},[]);return $.useEffect(()=>{if(!e)return;const f=m=>{m.key==="Escape"&&t()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e,t]),e?d.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",onClick:t,children:[d.jsx("div",{className:"absolute inset-0",style:{background:n.isDark?"rgba(0,0,0,0.7)":"rgba(0,0,0,0.35)",backdropFilter:"blur(12px)"}}),d.jsxs("div",{ref:l,role:"dialog","aria-modal":"true","aria-label":"Settings",className:"relative w-[560px] max-h-[80vh] rounded-xl overflow-hidden flex flex-col",style:{background:n.surfaceOpaque,border:`1px solid ${n.border}`,boxShadow:"0 24px 48px rgba(0,0,0,0.4)"},onClick:f=>f.stopPropagation(),onKeyDown:u,children:[d.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b shrink-0",style:{borderColor:n.borderSubtle},children:[d.jsx("span",{className:"text-[14px] tracking-wider uppercase flex-1 font-bold",style:{color:n.textPrimary,fontFamily:"'Geist Mono', monospace"},children:"Settings"}),d.jsx("button",{type:"button",onClick:t,className:"nodrag nowheel cursor-pointer border-none bg-transparent p-1 rounded-md",style:{color:n.textDim},"aria-label":"Close settings",children:d.jsx($t,{size:14})})]}),d.jsx("div",{className:"flex gap-1 px-4 pt-2 border-b shrink-0 overflow-x-auto",style:{borderColor:n.borderSubtle,scrollbarWidth:"none"},children:b6.map(f=>d.jsx("button",{type:"button",onClick:()=>s(f.id),className:"nodrag nowheel text-[13px] tracking-wider uppercase px-3 py-2 cursor-pointer border-none bg-transparent font-semibold",style:{color:i===f.id?"#FE5000":n.textDim,borderBottom:i===f.id?"2px solid #FE5000":"2px solid transparent",fontFamily:"'Geist Mono', monospace",marginBottom:"-1px"},children:f.label},f.id))}),d.jsxs("div",{className:"flex-1 overflow-y-auto",style:{scrollbarWidth:"thin"},children:[i==="providers"&&d.jsx(v6,{}),i==="mcp"&&d.jsx(S6,{}),i==="general"&&d.jsx(C6,{})]})]})]}):null}const xS="modular-agent-library-v1";function gm(){return`${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function M6(){try{const e=localStorage.getItem(xS);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function P1(e){try{localStorage.setItem(xS,JSON.stringify(e))}catch{}}const T6=fn((e,t)=>({agents:[],agentLibrary:M6(),sharedFacts:[],edges:[],activeAgentId:null,addAgent:n=>e(r=>({agents:[...r.agents,{...n,factIds:[],knowledgeSourceIds:[],mcpServerIds:[],skillIds:[]}]})),addAgentFromLibrary:n=>{const r=t().agentLibrary.find(s=>s.id===n);if(!r)return;t().addAgent({id:`${r.id}-${Date.now()}`,name:r.name,description:r.description,avatar:r.avatar,version:r.version});const i=t().agents[t().agents.length-1]?.id;i&&t().updateAgent(i,{mcpServerIds:r.mcpServerIds,skillIds:r.skillIds})},addAgentFromBackend:n=>{(async()=>{try{const r=await fetch(`${ze}/agents/${encodeURIComponent(n)}`);if(!r.ok)return;const i=await r.json(),s=i.data??i,l=s.agentMeta??{};t().addAgent({id:`${n}-${Date.now()}`,name:l.name||n,description:l.description||"",avatar:l.avatar||"bot",version:s.version||"1.0.0"});const u=t().agents[t().agents.length-1]?.id;if(!u)return;t().updateAgent(u,{mcpServerIds:(s.mcpServers??[]).map(f=>f.id),skillIds:(s.skills??[]).map(f=>f.id)})}catch{}})()},upsertLibraryAgent:n=>e(r=>{const i=r.agentLibrary.some(s=>s.id===n.id)?r.agentLibrary.map(s=>s.id===n.id?n:s):[...r.agentLibrary,n];return P1(i),{agentLibrary:i}}),removeLibraryAgent:n=>e(r=>{const i=r.agentLibrary.filter(s=>s.id!==n);return P1(i),{agentLibrary:i}}),removeAgent:n=>e(r=>({agents:r.agents.filter(i=>i.id!==n),edges:r.edges.filter(i=>i.fromAgentId!==n&&i.toAgentId!==n)})),updateAgent:(n,r)=>e(i=>({agents:i.agents.map(s=>s.id===n?{...s,...r}:s)})),setActiveAgent:n=>e({activeAgentId:n}),addSharedFact:(n,r,i,s=[])=>{const l=`sf-${gm()}`;return e(u=>({sharedFacts:[...u.sharedFacts,{id:l,content:n,scope:r,originAgentId:i,sharedWith:[],tags:s,timestamp:Date.now()}]})),l},removeSharedFact:n=>e(r=>({sharedFacts:r.sharedFacts.filter(i=>i.id!==n)})),propagateFact:(n,r)=>e(i=>({sharedFacts:i.sharedFacts.map(s=>s.id===n?{...s,sharedWith:[...new Set([...s.sharedWith,...r])]}:s),edges:[...i.edges,...r.filter(s=>!i.edges.some(l=>l.type==="fact_propagation"&&l.fromAgentId===i.sharedFacts.find(u=>u.id===n)?.originAgentId&&l.toAgentId===s)).map(s=>({id:`edge-${gm()}`,fromAgentId:i.sharedFacts.find(l=>l.id===n)?.originAgentId||"",toAgentId:s,type:"fact_propagation",label:"shared fact"}))]})),markFactPromoted:(n,r,i)=>e(s=>({sharedFacts:s.sharedFacts.map(l=>l.id===n?{...l,promotedTo:{agentId:r,target:i,at:Date.now()}}:l)})),addEdge:n=>e(r=>({edges:[...r.edges,{...n,id:`edge-${gm()}`}]})),removeEdge:n=>e(r=>({edges:r.edges.filter(i=>i.id!==n)})),getAgentFacts:n=>t().sharedFacts.filter(r=>r.originAgentId===n),getSharedFactsForAgent:n=>t().sharedFacts.filter(r=>r.scope==="global"||r.originAgentId===n||r.sharedWith.includes(n))}));function j6(e){return{...e}}const A6={"claude-opus-4":"claude-opus-4","claude-sonnet-4":"claude-sonnet-4","claude-haiku-3.5":"claude-haiku-3.5","gpt-4o":"gpt-4o","gpt-4.1":"gpt-4.1"};function bS(e,t){if(!e||!e.persona&&!e.objectives.primary&&!e.constraints.customConstraints)return t||"You are an analyst combining multiple knowledge sources to produce structured output.";const n=[];e.persona&&n.push(`You are ${e.persona}.`),e.tone!=="neutral"&&n.push(`Use a ${e.tone} tone.`),e.objectives.primary&&n.push(`
|
|
137
|
+
Primary objective: ${e.objectives.primary}`),e.objectives.successCriteria.length>0&&n.push("Success criteria: "+e.objectives.successCriteria.join("; "));const r=[];return e.constraints.neverMakeUp&&r.push("Never make up information"),e.constraints.askBeforeActions&&r.push("Ask before taking actions"),e.constraints.stayInScope&&r.push(`Stay in scope${e.constraints.scopeDefinition?": "+e.constraints.scopeDefinition:""}`),e.constraints.useOnlyTools&&r.push("Only use provided tools"),e.constraints.limitWords&&r.push(`Keep responses under ${e.constraints.wordLimit} words`),e.constraints.customConstraints&&r.push(e.constraints.customConstraints),r.length>0&&n.push(`
|
|
138
|
+
Constraints:
|
|
139
|
+
`+r.map(i=>`- ${i}`).join(`
|
|
140
|
+
`)),t&&n.push(`
|
|
141
|
+
`+t),n.join(`
|
|
142
|
+
`)}function Mi(e){const t=e.channels.filter(E=>E.enabled),n=A6[e.selectedModel]??e.selectedModel,r=e.agentMeta.name||L6(e.prompt,t),i=e.agentMeta.description||P6(e.prompt,t),s=e.skills.filter(E=>E.enabled&&E.added),l=e.mcpServers.filter(E=>E.enabled&&E.added),u=s.map(E=>E.name),f=l.map(E=>({name:E.name,transport:"stdio",command:`npx @${E.name.toLowerCase().replace(/\s+/g,"")}hq/mcp`})),m=t.map(E=>E.path),h=e.outputFormats.length>0?e.outputFormats:[e.outputFormat],g=[],b=bS(e.instructionState,e.prompt);g.push(b);const y=e.agentConfig?.temperature??.7,v=e.agentConfig?.planningMode??"single-shot",w=[...(e.connectors??[]).filter(E=>E.enabled).map(E=>({service:E.service,direction:E.direction,config:E.config,type:"connector"})),...(e.mcpServers??[]).filter(E=>E.enabled!==!1).map(E=>({service:E.name||E.id,type:"mcp",id:E.id}))];return{name:r,description:i,model:n,icon:e.agentMeta.icon||"brain",category:e.agentMeta.category||"general",temperature:y,planningMode:v,tools:u,mcp_servers:f,reads:m,output_format:h,token_budget:e.tokenBudget,prompt:e.prompt,system:g.join(`
|
|
143
|
+
|
|
144
|
+
`),connections:w}}function po(e){return e.includes(`
|
|
145
|
+
`)||e.includes(":")||e.includes("#")||e.includes('"')?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:e}function N6(e){const t=["---"];if(t.push(`name: ${po(e.name)}`),t.push(`description: ${po(e.description)}`),t.push(`model: ${e.model}`),t.push(`temperature: ${e.temperature}`),t.push(`icon: ${e.icon}`),t.push(`category: ${e.category}`),e.tools.length>0){t.push("tools:");for(const n of e.tools)t.push(` - ${n}`)}if(e.mcp_servers.length>0){t.push("mcp_servers:");for(const n of e.mcp_servers)t.push(` - name: ${po(n.name)}`),t.push(` transport: ${n.transport}`),n.command&&t.push(` command: ${po(n.command)}`)}if(e.reads.length>0){t.push("reads:");for(const n of e.reads)t.push(` - ${po(n)}`)}if(e.output_format.length>0){t.push("output_format:");for(const n of e.output_format)t.push(` - ${n}`)}return t.push(`token_budget: ${e.token_budget}`),t.push("---"),t.join(`
|
|
146
|
+
`)}function _6(e,t){const n=t.channels.filter(u=>u.enabled),r=t.instructionState,i=t.workflowSteps,s=[""];if(r?.persona&&(s.push("## Persona"),s.push(r.persona),r.tone!=="neutral"&&s.push(`
|
|
147
|
+
Tone: ${r.tone}`),r.expertise!==3&&s.push(`Expertise level: ${r.expertise}/5`),s.push("")),s.push("## Role"),s.push(e.system),s.push(""),r?.objectives.primary){if(s.push("## Objectives"),s.push(`**Primary:** ${r.objectives.primary}`),r.objectives.successCriteria.length>0){s.push(`
|
|
148
|
+
**Success Criteria:**`);for(const u of r.objectives.successCriteria)s.push(`- ${u}`)}if(r.objectives.failureModes.length>0){s.push(`
|
|
149
|
+
**Failure Modes:**`);for(const u of r.objectives.failureModes)s.push(`- ${u}`)}s.push("")}if(r){const u=[];if(r.constraints.neverMakeUp&&u.push("Never make up information"),r.constraints.askBeforeActions&&u.push("Ask before taking actions"),r.constraints.stayInScope&&u.push(`Stay in scope${r.constraints.scopeDefinition?": "+r.constraints.scopeDefinition:""}`),r.constraints.useOnlyTools&&u.push("Only use provided tools"),r.constraints.limitWords&&u.push(`Keep responses under ${r.constraints.wordLimit} words`),r.constraints.customConstraints&&u.push(r.constraints.customConstraints),u.length>0){s.push("## Constraints");for(const f of u)s.push(`- ${f}`);s.push("")}}if(e.prompt&&(s.push("## Default Prompt"),s.push(e.prompt),s.push("")),s.push("## Workflow"),i&&i.length>0)i.forEach((u,f)=>{const m=`${f+1}. ${u.label}`,h=u.action?` — ${u.action}`:"",g=u.condition!=="always"&&u.conditionText?` (${u.condition} ${u.conditionText})`:"";s.push(`${m}${h}${g}`)});else if(n.length>0){s.push("1. Read all knowledge sources");const u=new Map;for(const m of n){const h=m.knowledgeType;u.has(h)||u.set(h,[]),u.get(h).push(m)}let f=2;for(const[m,h]of u){const g=Ar[m];if(g){const b=h.map(y=>y.name).join(", ");s.push(`${f}. Process ${g.label.toLowerCase()} sources: ${b}`),f++}}s.push(`${f}. Synthesize findings`),s.push(`${f+1}. Generate output`)}else s.push("1. Analyze the provided context"),s.push("2. Identify patterns and key insights"),s.push("3. Synthesize findings"),s.push("4. Generate output");s.push("");const l=t.outputFormats.map(u=>Vk.find(m=>m.id===u)?.label??u);if(s.push("## Output Format"),s.push(l.length>0?l.join(", "):"Markdown"),s.push(""),t.knowledgeContent&&t.knowledgeContent.length>0){s.push("## Knowledge Sources");for(const u of t.knowledgeContent)s.push(`- **${u.name}** (${u.knowledgeType}, ${u.tokens} tokens) — \`${u.path}\``),t.portable&&u.content&&(s.push(""),s.push(" ```"),s.push(u.content.split(`
|
|
150
|
+
`).map(f=>" "+f).join(`
|
|
151
|
+
`)),s.push(" ```"),s.push(""));s.push("")}if(t.facts&&t.facts.length>0){s.push("## Extracted Insights");for(const u of t.facts)s.push(`- ${u.text}`);s.push("")}return s.join(`
|
|
152
|
+
`)}function kS(e){const t=Mi(e),n=N6(t),r=_6(t,e);return n+`
|
|
153
|
+
`+r}function D6(e){const t=Mi(e),n=[];if(n.push(`name: ${po(t.name)}`),n.push(`model: ${t.model}`),t.tools.length>0){n.push("tools:");for(const i of t.tools)n.push(` - ${i}`)}if(t.mcp_servers.length>0){n.push("mcp:");for(const i of t.mcp_servers)n.push(` ${i.name.toLowerCase().replace(/\s+/g,"-")}:`),i.command&&n.push(` command: ${po(i.command)}`)}if(t.reads.length>0){n.push("context_files:");for(const i of t.reads)n.push(` - ${po(i)}`)}const r=bS(e.instructionState,e.prompt);if(r){n.push("instructions: |");for(const i of r.split(`
|
|
154
|
+
`))n.push(` ${i}`)}return n.join(`
|
|
155
|
+
`)+`
|
|
156
|
+
`}function z6(e){const t=Mi(e),n={name:t.name,model:t.model,instructions:t.system,tools:t.tools,mcp_servers:t.mcp_servers.map(r=>({name:r.name,transport:r.transport})),context_files:t.reads};return JSON.stringify(n,null,2)}function R6(e){const t=Mi(e),n={};for(const i of t.mcp_servers)n[i.name.toLowerCase().replace(/\s+/g,"-")]={command:i.command||""};const r={template:t.name,agent:"claude-code",context_files:t.reads,mcp_config:n,tools:t.tools,output_format:t.output_format};return JSON.stringify(r,null,2)}function O6(e){const t=Mi(e),n=t.name.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""),r=[];if(r.push("agents:"),r.push(` ${n}:`),r.push(` model: ${t.model}`),r.push(` temperature: ${t.temperature}`),t.tools.length>0){r.push(" skills:");for(const i of t.tools)r.push(` - ${i}`)}if(t.mcp_servers.length>0){r.push(" mcp:"),r.push(" servers:");for(const i of t.mcp_servers){const s=i.name.toLowerCase().replace(/\s+/g,"-");r.push(` ${s}:`),i.command&&r.push(` command: ${po(i.command)}`)}}if(t.reads.length>0){r.push(" context:");for(const i of t.reads)r.push(` - ${po(i)}`)}return r.join(`
|
|
157
|
+
`)+`
|
|
158
|
+
`}function I6(e){const t=Mi(e),n=e.outputTemplateConfig?Object.fromEntries(Object.entries(e.outputTemplateConfig).map(([s,l])=>[s,j6(l)])):void 0,r=e.knowledgeContent?e.knowledgeContent.map(s=>({sourceId:s.sourceId,name:s.name,path:s.path,knowledgeType:s.knowledgeType,depth:s.depth,tokens:s.tokens,...e.portable&&s.content?{content:s.content}:{}})):t.reads.map(s=>({path:s})),i={modular_version:"1.0",agent:{name:t.name,description:t.description,model:t.model,temperature:t.temperature,system_prompt:t.system,planning_mode:t.planningMode,skills:t.tools,mcp_servers:t.mcp_servers,output_formats:t.output_format,token_budget:t.token_budget,connections:t.connections,...e.instructionState?{instructionState:e.instructionState}:{},...e.workflowSteps&&e.workflowSteps.length>0?{workflowSteps:e.workflowSteps}:{},...n&&Object.keys(n).length>0?{output:{templates:n}}:{}},knowledge:r};return e.pipelineSnapshot&&(i.pipeline_snapshot=e.pipelineSnapshot),e.facts&&e.facts.length>0&&(i.facts=e.facts),JSON.stringify(i,null,2)}function F6(e){return kS(e)}function Us(e,t){switch(e){case"claude":return kS(t);case"amp":return D6(t);case"codex":return z6(t);case"vibe-kanban":return R6(t);case"openclaw":return O6(t);case"generic":return I6(t)}}const vS={claude:{name:"Claude Code",ext:".md",mime:"text/markdown"},amp:{name:"Amp",ext:".yaml",mime:"text/yaml"},codex:{name:"Codex",ext:".json",mime:"application/json"},"vibe-kanban":{name:"Vibe Kanban",ext:".json",mime:"application/json"},openclaw:{name:"OpenClaw",ext:".yaml",mime:"text/yaml"},generic:{name:"Generic JSON",ext:".json",mime:"application/json"}};function Sd(e,t,n=".md"){const r={".md":"text/markdown",".json":"application/json",".yaml":"text/yaml"},i=new Blob([e],{type:r[n]||"text/plain"}),s=URL.createObjectURL(i),l=document.createElement("a");l.href=s,l.download=`${t}${n}`,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(s)}function $6(e){const t=(e.agentMeta.name||"modular-agent").toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""),n=["claude","amp","codex","vibe-kanban","openclaw","generic"];for(const r of n){const i=Us(r,e),s=vS[r],l=r==="claude"?t:`${t}-${r}`;Sd(i,l,s.ext)}}function L6(e,t){if(e){const n=e.split(/\s+/).slice(0,4).join("-").toLowerCase().replace(/[^a-z0-9-]/g,"");if(n.length>3)return n}return t.length>0?t[0].name.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""):"modular-agent"}function P6(e,t){return e&&e.length>10?e.length>80?e.slice(0,77)+"...":e:`Analysis using ${t.length} sources via Modular`}function B6(){const e=ie.getState();vt.getState();const t={version:"1.0",kind:"agent",identity:{name:e.agentMeta.name||"modular-agent",display_name:e.agentMeta.name||void 0,description:e.agentMeta.description||void 0,avatar:e.agentMeta.avatar||void 0,author:"Modular Studio",tags:e.agentMeta.tags?.length>0?e.agentMeta.tags:void 0,agent_version:"1.0.0"},instructions:{},context:{}},n={};e.instructionState.persona&&(n.persona=e.instructionState.persona),e.instructionState.tone!=="neutral"&&(n.tone=e.instructionState.tone),e.instructionState.expertise!==3&&(n.expertise=e.instructionState.expertise);const r=[];e.instructionState.constraints.neverMakeUp&&r.push("Never fabricate information or make up facts"),e.instructionState.constraints.askBeforeActions&&r.push("Ask for permission before taking significant actions"),e.instructionState.constraints.stayInScope&&r.push(`Stay within defined scope: ${e.instructionState.constraints.scopeDefinition||"as specified"}`),e.instructionState.constraints.useOnlyTools&&r.push("Only use explicitly provided tools and capabilities"),e.instructionState.constraints.limitWords&&r.push(`Keep responses under ${e.instructionState.constraints.wordLimit} words`),e.instructionState.constraints.customConstraints&&r.push(e.instructionState.constraints.customConstraints),r.length>0&&(n.constraints=r),e.instructionState.objectives.primary&&(n.objectives={primary:e.instructionState.objectives.primary},e.instructionState.objectives.successCriteria.length>0&&(n.objectives.success_criteria=e.instructionState.objectives.successCriteria),e.instructionState.objectives.failureModes.length>0&&(n.objectives.failure_modes=e.instructionState.objectives.failureModes)),e.instructionState.constraints.scopeDefinition&&(n.scope=e.instructionState.constraints.scopeDefinition),t.instructions=n;const i={},s=e.channels.filter(f=>f.enabled);s.length>0&&(i.knowledge=s.map(f=>({type:"file",ref:f.path||f.name,knowledge_type:f.knowledgeType,depth:f.depth})));const l=e.skills.filter(f=>f.enabled);l.length>0&&(i.skills=l.map(f=>({ref:f.name,source:"registry"})));const u=e.mcpServers.filter(f=>f.enabled);return u.length>0&&(i.mcp_servers=u.map(f=>({name:f.name,description:f.description,transport:"stdio",command:void 0,env:void 0}))),t.context=i,e.workflowSteps.length>0&&(t.workflow={steps:e.workflowSteps.map(f=>({id:f.id,action:f.action,tool:f.tool||void 0,condition:f.condition!=="always"?f.condition:void 0}))}),ju(t)}function ju(e,t=0){const n=" ".repeat(t);return Array.isArray(e)?e.map(r=>`${n}- ${ju(r,0).trim()}`).join(`
|
|
159
|
+
`):typeof e=="object"&&e!==null?Object.entries(e).filter(([,r])=>r!=null).map(([r,i])=>{if(Array.isArray(i))return i.length===0?null:`${n}${r}:
|
|
160
|
+
${ju(i,t+1)}`;if(typeof i=="object")return`${n}${r}:
|
|
161
|
+
${ju(i,t+1)}`;{const s=typeof i=="string"&&(i.includes(`
|
|
162
|
+
`)||i.includes(":")||i.includes("#"))?`"${i.replace(/"/g,'\\"')}"`:String(i);return`${n}${r}: ${s}`}}).filter(Boolean).join(`
|
|
163
|
+
`):String(e)}const B1=[{id:"brain",Icon:vl},{id:"code",Icon:Lw},{id:"search",Icon:hd},{id:"bar-chart-3",Icon:Hh},{id:"pen-tool",Icon:Ww},{id:"file-text",Icon:Cl},{id:"globe",Icon:Uw},{id:"layers",Icon:fD},{id:"zap",Icon:Bn},{id:"database",Icon:Sl},{id:"shield",Icon:Vh},{id:"settings",Icon:Qw},{id:"sparkles",Icon:ga},{id:"target",Icon:gd},{id:"book-open",Icon:Iw},{id:"lightbulb",Icon:Gu},{id:"terminal",Icon:al},{id:"box",Icon:Bh},{id:"layout-grid",Icon:qw},{id:"cpu",Icon:wl}],H6=["coding","research","analysis","writing","data","design","domain-specific","general"],H1=[{id:"claude",name:"Claude Code",ext:".md",Icon:al},{id:"amp",name:"Amp",ext:".yaml",Icon:Bn},{id:"codex",name:"Codex",ext:".json",Icon:wl},{id:"vibe-kanban",name:"Vibe Kanban",ext:".json",Icon:qw},{id:"openclaw",name:"OpenClaw",ext:".yaml",Icon:Vw},{id:"generic",name:"Generic JSON",ext:".json",Icon:Bh}];function U6(){const e=ie(L=>L.showSaveModal),t=ie(L=>L.setShowSaveModal),n=ie(L=>L.agentMeta),r=ie(L=>L.setAgentMeta),i=ie(L=>L.channels),s=ie(L=>L.selectedModel),l=ie(L=>L.outputFormat),u=ie(L=>L.outputFormats),f=ie(L=>L.prompt),m=ie(L=>L.tokenBudget),h=ie(L=>L.mcpServers),g=ie(L=>L.skills),b=ie(L=>L.exportTarget),y=ie(L=>L.setExportTarget),v=ie(L=>L.agentConfig),w=ie(L=>L.connectors),E=ie(L=>L.instructionState),C=ie(L=>L.workflowSteps),M=T6(L=>L.upsertLibraryAgent),[S,N]=$.useState(!1),[R,T]=$.useState(!1),[D,H]=$.useState(!0),V=$.useRef(null),B=$.useRef(null),O=Ee(),Y=$.useCallback(L=>{if(L.key!=="Tab"||!B.current)return;const z=B.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(z.length===0)return;const W=z[0],ae=z[z.length-1];L.shiftKey?document.activeElement===W&&(L.preventDefault(),ae.focus()):document.activeElement===ae&&(L.preventDefault(),W.focus())},[]);$.useEffect(()=>{e?(T(!0),setTimeout(()=>V.current?.focus(),100)):T(!1)},[e]),$.useEffect(()=>{if(!e)return;const L=z=>{z.key==="Escape"&&t(!1)};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[e,t]);const Z=$.useMemo(()=>({channels:i,selectedModel:s,outputFormat:l,outputFormats:u,prompt:f,tokenBudget:m,mcpServers:h,skills:g,agentMeta:n,agentConfig:v,connectors:w,instructionState:E,workflowSteps:C}),[i,s,l,u,f,m,h,g,n,v,w,E,C]),U=$.useMemo(()=>Us(b,Z),[Z,b]),_=L=>{H(!1),y(L),setTimeout(()=>H(!0),30)},A=()=>{const L=n.name||"modular-agent",z=L.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"");M({id:z,name:L,description:n.description||"Saved from builder",avatar:n.avatar||"bot",version:"1.0.0",mcpServerIds:h.filter(le=>le.added).map(le=>le.id),skillIds:g.filter(le=>le.added).map(le=>le.id)});const W=Jh();fetch(`${ze}/agents/${encodeURIComponent(z)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(W)}).catch(()=>{});const ae=vS[b];Sd(U,z,ae.ext)},q=async()=>{await navigator.clipboard.writeText(U),N(!0),setTimeout(()=>N(!1),2e3)},K=()=>{$6(Z)},Q=()=>{const L=B6(),W=(n.name||"modular-agent").toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""),ae=new Blob([L],{type:"text/yaml;charset=utf-8"}),le=URL.createObjectURL(ae),me=document.createElement("a");me.href=le,me.download=`${W}.yaml`,document.body.appendChild(me),me.click(),document.body.removeChild(me),URL.revokeObjectURL(le)};if(!e)return null;const I=B1.find(L=>L.id===n.icon),F=H1.find(L=>L.id===b);return d.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",onClick:()=>t(!1),children:[d.jsx("div",{className:"absolute inset-0",style:{background:"rgba(0,0,0,0.7)",backdropFilter:"blur(4px)",opacity:R?1:0,transition:"opacity 0.15s ease"}}),d.jsxs("div",{ref:B,role:"dialog","aria-modal":"true","aria-label":"Save as agent",className:"relative flex flex-col rounded-xl overflow-hidden",style:{width:880,maxHeight:"85vh",background:O.surface,border:`1px solid ${O.border}`,boxShadow:"0 24px 48px rgba(0,0,0,0.4)",opacity:R?1:0,transform:R?"scale(1)":"scale(0.97)",transition:"opacity 0.15s ease, transform 0.15s ease"},onClick:L=>L.stopPropagation(),onKeyDown:Y,children:[d.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{borderBottom:`1px solid ${O.borderSubtle}`},children:[d.jsx("span",{className:"text-[14px] font-bold tracking-[3px] uppercase",style:{fontFamily:"'Geist Mono', monospace",color:O.textPrimary},children:"SAVE AS AGENT"}),d.jsx("button",{type:"button",onClick:()=>t(!1),className:"p-1 rounded-md cursor-pointer border-none",style:{background:"transparent",color:O.textMuted},"aria-label":"Close",children:d.jsx($t,{size:16})})]}),d.jsx("div",{className:"flex gap-2 px-5 py-3",style:{borderBottom:`1px solid ${O.borderSubtle}`},children:H1.map(L=>{const z=b===L.id;return d.jsxs("button",{type:"button",onClick:()=>_(L.id),className:"flex flex-col items-center gap-1 rounded-lg cursor-pointer border-none",style:{width:80,padding:"8px 4px",background:z?"#FE500012":"transparent",border:z?"1.5px solid #FE5000":`1.5px solid ${O.borderSubtle}`,transition:"all 0.12s ease"},children:[d.jsx(L.Icon,{size:18,style:{color:z?"#FE5000":O.textMuted}}),d.jsx("span",{className:"text-[12px] font-semibold leading-tight text-center",style:{fontFamily:"'Geist Mono', monospace",color:z?"#FE5000":O.textSecondary},children:L.name}),d.jsx("span",{className:"text-[13px] px-1.5 py-0.5 rounded",style:{fontFamily:"'Geist Mono', monospace",background:z?"#FE500020":O.badgeBg,color:z?"#FE5000":O.textDim},children:L.ext})]},L.id)})}),d.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[d.jsxs("div",{className:"flex flex-col",style:{width:340,borderRight:`1px solid ${O.borderSubtle}`},children:[d.jsxs("div",{className:"flex-1 overflow-y-auto p-5 flex flex-col gap-4",children:[d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx("label",{className:"text-[13px] font-semibold uppercase tracking-wider",style:{color:O.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Agent Name"}),d.jsx("input",{ref:V,type:"text",value:n.name,onChange:L=>r({name:L.target.value}),placeholder:"my-analysis-agent",className:"w-full outline-none text-[17px] rounded-lg px-3 py-2 nodrag",style:{background:O.inputBg,border:`1px solid ${O.border}`,color:O.textPrimary,fontFamily:"'Geist Sans', sans-serif"}})]}),d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx("label",{className:"text-[13px] font-semibold uppercase tracking-wider",style:{color:O.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Description"}),d.jsx("textarea",{value:n.description,onChange:L=>r({description:L.target.value}),placeholder:"Deep research and synthesis agent...",className:"w-full outline-none text-[17px] rounded-lg px-3 py-2 resize-none",rows:3,style:{background:O.inputBg,border:`1px solid ${O.border}`,color:O.textPrimary,fontFamily:"'Geist Sans', sans-serif",lineHeight:1.5}})]}),d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx("label",{className:"text-[13px] font-semibold uppercase tracking-wider",style:{color:O.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Icon"}),d.jsx("div",{className:"grid grid-cols-10 gap-1",children:B1.map(({id:L,Icon:z})=>d.jsx("button",{type:"button",onClick:()=>r({icon:L}),className:"flex items-center justify-center w-7 h-7 rounded-md cursor-pointer border-none",style:{background:n.icon===L?"#FE500020":"transparent",border:n.icon===L?"1px solid #FE500040":"1px solid transparent",color:n.icon===L?"#FE5000":O.textMuted,transition:"all 0.1s ease"},children:d.jsx(z,{size:14})},L))})]}),d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx("label",{className:"text-[13px] font-semibold uppercase tracking-wider",style:{color:O.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Category"}),d.jsx("select",{value:n.category,onChange:L=>r({category:L.target.value}),className:"w-full outline-none text-[17px] rounded-lg px-3 py-2 cursor-pointer",style:{background:O.inputBg,border:`1px solid ${O.border}`,color:O.textPrimary,fontFamily:"'Geist Sans', sans-serif"},children:H6.map(L=>d.jsx("option",{value:L,children:L.charAt(0).toUpperCase()+L.slice(1).replace("-"," ")},L))})]})]}),d.jsxs("div",{className:"flex flex-col gap-2 px-5 py-4",style:{borderTop:`1px solid ${O.borderSubtle}`},children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsxs("button",{type:"button",onClick:A,className:"flex items-center justify-center gap-1.5 flex-1 py-2 rounded-lg text-[14px] font-semibold tracking-wider uppercase cursor-pointer border-none",style:{background:"#FE5000",color:"#fff",boxShadow:"0 0 8px rgba(254,80,0,0.25)"},children:[d.jsx(md,{size:13}),"Download"]}),d.jsxs("button",{type:"button",onClick:q,className:"flex items-center justify-center gap-1.5 flex-1 py-2 rounded-lg text-[14px] font-semibold tracking-wider uppercase cursor-pointer",style:{background:"transparent",border:`1px solid ${O.border}`,color:S?O.statusSuccess:O.textSecondary,transition:"color 0.15s ease"},children:[S?d.jsx(Wt,{size:13}):d.jsx(Pw,{size:13}),S?"Copied":"Copy"]})]}),d.jsxs("button",{type:"button",onClick:K,className:"flex items-center justify-center gap-1.5 w-full py-2 rounded-lg text-[14px] font-semibold tracking-wider uppercase cursor-pointer",style:{background:"transparent",border:`1px solid ${O.borderSubtle}`,color:O.textMuted},children:[d.jsx(Vw,{size:13}),"Export All Targets"]}),d.jsxs("button",{type:"button",onClick:Q,className:"flex items-center justify-center gap-1.5 w-full py-2 rounded-lg text-[14px] font-semibold tracking-wider uppercase cursor-pointer",style:{background:"transparent",border:`1px solid ${O.borderSubtle}`,color:O.textMuted},children:[d.jsx(Cl,{size:13}),"Export as YAML"]})]})]}),d.jsxs("div",{className:"flex flex-col flex-1",style:{background:O.isDark?"#0d0d10":"#f5f5f8"},children:[d.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${O.borderSubtle}`},children:[d.jsxs("div",{className:"flex items-center gap-2",children:[I&&d.jsx(I.Icon,{size:14,style:{color:"#FE5000"}}),d.jsx("span",{className:"text-[14px] font-bold tracking-[2px] uppercase",style:{fontFamily:"'Geist Mono', monospace",color:O.textMuted},children:"Preview"}),d.jsxs("span",{className:"text-[13px] px-1.5 py-0.5 rounded",style:{fontFamily:"'Geist Mono', monospace",background:"#FE500018",color:"#FE5000"},children:[F.name," ",F.ext]})]}),d.jsxs("span",{className:"text-[12px]",style:{fontFamily:"'Geist Mono', monospace",color:O.textDim},children:[U.split(`
|
|
164
|
+
`).length," lines"]})]}),d.jsx("div",{className:"flex-1 overflow-auto p-4",style:{opacity:D?1:0,transition:"opacity 0.12s ease"},children:d.jsx("pre",{className:"text-[14px] leading-relaxed whitespace-pre-wrap break-all m-0",style:{fontFamily:"'Geist Mono', monospace",color:O.textSecondary},children:U.split(`
|
|
165
|
+
`).map((L,z)=>d.jsxs("div",{className:"flex",children:[d.jsx("span",{className:"inline-block text-right select-none shrink-0",style:{width:32,color:O.textFaint,marginRight:12},children:z+1}),d.jsx("span",{style:{color:q6(L,b,O)},children:L||" "})]},z))})})]})]})]})]})}function q6(e,t,n){return e.trim()?t==="codex"||t==="vibe-kanban"||t==="generic"?/^\s*"\w[\w_-]*"\s*:/.test(e)?"#67d4e8":/:\s*"[^"]*"\s*,?$/.test(e)?"#a8d4a0":/:\s*(\d+\.?\d*|true|false|null)\s*,?$/.test(e)?"#d4a86a":n.textSecondary:e==="---"?"#FE5000":e.startsWith("##")||e.startsWith("# ")?n.textPrimary:/^\s*#/.test(e)?n.isDark?"#666":"#999":/^\s*\w[\w_-]*\s*:/.test(e)?"#67d4e8":/^\s+-\s/.test(e)||/^\d+\./.test(e)?n.textSecondary:n.textMuted:n.textMuted}function G6(){const e=ie.getState();return{channels:e.channels,mcpServers:e.mcpServers,skills:e.skills,instructionState:{...e.instructionState},workflowSteps:[...e.workflowSteps],agentConfig:{...e.agentConfig},prompt:e.prompt,selectedModel:e.selectedModel}}function U1(e,t){const n=[];e.instructionState.persona!==t.instructionState.persona&&t.instructionState.persona.length>0&&n.push({type:"major",category:"instruction",description:"Persona updated"}),e.instructionState.objectives.primary!==t.instructionState.objectives.primary&&n.push({type:"major",category:"instruction",description:"Primary objective changed"}),e.selectedModel!==t.selectedModel&&n.push({type:"major",category:"model",description:`Model → ${t.selectedModel}`}),e.instructionState.tone!==t.instructionState.tone&&n.push({type:"major",category:"instruction",description:`Tone → ${t.instructionState.tone}`});const r=e.channels.filter(M=>M.enabled).map(M=>M.sourceId),i=t.channels.filter(M=>M.enabled).map(M=>M.sourceId),s=i.filter(M=>!r.includes(M)),l=r.filter(M=>!i.includes(M));s.length>0&&n.push({type:"minor",category:"knowledge",description:`+${s.length} knowledge source(s)`}),l.length>0&&n.push({type:"minor",category:"knowledge",description:`-${l.length} knowledge source(s)`});const u=e.skills.filter(M=>M.added).map(M=>M.id),f=t.skills.filter(M=>M.added).map(M=>M.id),m=f.filter(M=>!u.includes(M)),h=u.filter(M=>!f.includes(M));m.length>0&&n.push({type:"minor",category:"skill",description:`+${m.length} skill(s)`}),h.length>0&&n.push({type:"minor",category:"skill",description:`-${h.length} skill(s)`});const g=e.mcpServers.filter(M=>M.added).map(M=>M.id),b=t.mcpServers.filter(M=>M.added).map(M=>M.id),y=b.filter(M=>!g.includes(M)),v=g.filter(M=>!b.includes(M));if(y.length>0&&n.push({type:"minor",category:"mcp",description:`+${y.length} MCP server(s)`}),v.length>0&&n.push({type:"minor",category:"mcp",description:`-${v.length} MCP server(s)`}),t.workflowSteps.length!==e.workflowSteps.length){const M=t.workflowSteps.length-e.workflowSteps.length;n.push({type:"minor",category:"workflow",description:`${M>0?"+":""}${M} workflow step(s)`})}const w=e.instructionState.objectives.successCriteria.length,E=t.instructionState.objectives.successCriteria.length;E!==w&&n.push({type:"minor",category:"instruction",description:`Success criteria ${E>w?"added":"removed"}`});const C=["neverMakeUp","askBeforeActions","stayInScope","useOnlyTools","limitWords"];for(const M of C)e.instructionState.constraints[M]!==t.instructionState.constraints[M]&&n.push({type:"patch",category:"instruction",description:`Constraint "${M}" toggled`});e.instructionState.constraints.customConstraints!==t.instructionState.constraints.customConstraints&&n.push({type:"patch",category:"instruction",description:"Custom constraints updated"}),e.instructionState.expertise!==t.instructionState.expertise&&n.push({type:"patch",category:"instruction",description:`Expertise level → ${t.instructionState.expertise}`}),e.prompt!==t.prompt&&n.push({type:"patch",category:"prompt",description:"Prompt text changed"});for(const M of t.channels){const S=e.channels.find(N=>N.sourceId===M.sourceId);S&&S.depth!==M.depth&&n.push({type:"patch",category:"knowledge",description:`"${M.name}" depth changed`})}if(t.workflowSteps.length===e.workflowSteps.length)for(let M=0;M<t.workflowSteps.length;M++){const S=e.workflowSteps[M],N=t.workflowSteps[M];if(S&&N&&(S.label!==N.label||S.action!==N.action||S.tool!==N.tool||S.condition!==N.condition)){n.push({type:"patch",category:"workflow",description:`Step "${N.label||M+1}" modified`});break}}return e.agentConfig.temperature!==t.agentConfig.temperature&&n.push({type:"patch",category:"config",description:`Temperature → ${t.agentConfig.temperature}`}),e.agentConfig.maxTokens!==t.agentConfig.maxTokens&&n.push({type:"patch",category:"config",description:`Max tokens → ${t.agentConfig.maxTokens}`}),n}function K6(e,t){const[n,r,i]=e.split(".").map(Number),s=t.some(f=>f.type==="major"),l=t.some(f=>f.type==="minor");if(s){const f={major:n+1,minor:0,patch:0};return{...f,version:`${f.major}.${f.minor}.${f.patch}`}}if(l){const f={major:n,minor:r+1,patch:0};return{...f,version:`${f.major}.${f.minor}.${f.patch}`}}const u={major:n,minor:r,patch:i+1};return{...u,version:`${u.major}.${u.minor}.${u.patch}`}}function V6(e){if(e.length===0)return"No changes";if(e.length===1)return e[0].description;const t=[...new Set(e.map(n=>n.category))];return`${e.length} changes (${t.join(", ")})`}const ua=fn((e,t)=>({versions:[],currentVersion:"0.1.0",dirty:!1,autoVersion:!0,maxVersions:50,latestVersion:()=>{const n=t().versions;return n.length>0?n[n.length-1]:void 0},getVersion:n=>t().versions.find(r=>r.version===n),checkpoint:n=>{const r=G6(),i=t().latestVersion()?.snapshot,s=i?U1(i,r):[{type:"minor",category:"init",description:"Initial version"}];if(i&&s.length===0)return;const l=i?K6(t().currentVersion,s):{major:0,minor:1,patch:0,version:"0.1.0"},u={id:`v-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,version:l.version,major:l.major,minor:l.minor,patch:l.patch,timestamp:Date.now(),label:n||V6(s),changes:s,snapshot:r},f=[...t().versions,u].slice(-t().maxVersions);e({versions:f,currentVersion:l.version,dirty:!1})},restoreVersion:n=>{const r=t().getVersion(n);if(!r)return;const i=ie.getState();i.clearChannels();for(const s of r.snapshot.channels)i.addChannel(s),s.enabled||i.toggleChannel(s.sourceId);i.setPrompt(r.snapshot.prompt),i.setModel(r.snapshot.selectedModel),i.updateInstruction({persona:r.snapshot.instructionState.persona,tone:r.snapshot.instructionState.tone,expertise:r.snapshot.instructionState.expertise,constraints:r.snapshot.instructionState.constraints,objectives:r.snapshot.instructionState.objectives,rawPrompt:r.snapshot.instructionState.rawPrompt,autoSync:r.snapshot.instructionState.autoSync}),i.updateWorkflowSteps(r.snapshot.workflowSteps),e({currentVersion:r.version,dirty:!1})},deleteVersion:n=>e({versions:t().versions.filter(r=>r.id!==n)}),setAutoVersion:n=>e({autoVersion:n}),setDirty:()=>e({dirty:!0}),_detectAndVersion:(n,r)=>{if(U1(n,r).length===0||(e({dirty:!0}),!t().autoVersion))return;const s=t().latestVersion();s&&Date.now()-s.timestamp<2e3||t().checkpoint()}}));let fu=null,ym=null;ie.subscribe(e=>{const t={channels:e.channels,mcpServers:e.mcpServers,skills:e.skills,instructionState:e.instructionState,workflowSteps:e.workflowSteps,agentConfig:e.agentConfig,prompt:e.prompt,selectedModel:e.selectedModel};if(!fu){fu=t;return}ym&&clearTimeout(ym);const n=fu;ym=setTimeout(()=>{ua.getState()._detectAndVersion(n,t),fu=t},1500)});const Y6={full:0,detail:1,summary:2,headlines:3,mention:4},W6={opus:"claude-opus-4",sonnet:"claude-sonnet-4",haiku:"claude-haiku-3.5","claude-opus-4":"claude-opus-4","claude-sonnet-4":"claude-sonnet-4","claude-haiku-3.5":"claude-haiku-3.5","gpt-4o":"gpt-4o","gpt-4.1":"gpt-4.1"},q1=new Set(["markdown","html-slides","email","code","csv","json","diagram","slack"]);function X6(e){const t=e.trim();return t.startsWith("{")?Z6(t):t.startsWith("---")?Q6(t):J6(t)}function Z6(e){let t;try{t=JSON.parse(e)}catch{return{}}if(t.modular_version&&t.agent){const r=t.agent,i=Nr({...r,system:r.system_prompt,reads:r.knowledge?.map(s=>s.path),output_format:r.output_formats,token_budget:r.token_budget});return i.detectedFormat="generic",r.instructionState&&(i.instructionState=r.instructionState),r.workflowSteps&&(i.workflowSteps=r.workflowSteps),i}if(t.template&&t.context_files){const r=Nr({name:t.template,reads:t.context_files,tools:t.tools,output_format:t.output_format});return r.detectedFormat="vibe-kanban",r}if(t.instructions&&!t.system){const r=Nr({...t,system:t.instructions,reads:t.context_files||t.reads});return r.detectedFormat="codex",r}const n=Nr(t);return n.detectedFormat="generic",n}function Q6(e){const{frontmatter:t,body:n}=eR(e),r=Nr(t);if(r.detectedFormat="claude",!r.prompt){const u=n.match(/## Default Prompt\n([\s\S]*?)(?=\n## |$)/);u&&(r.prompt=u[1].trim())}if(!r.prompt){const u=n.match(/(?:##? Role)\n([\s\S]*?)(?=\n##? |$)/);u&&(r.prompt=u[1].trim())}if(!r.channels||r.channels.length===0){const u=nR(n);u.length>0&&(r.channels=u)}const i=n.match(/## Persona\n([\s\S]*?)(?=\n## |$)/),s=n.match(/## Constraints\n([\s\S]*?)(?=\n## |$)/),l=n.match(/## Objectives\n([\s\S]*?)(?=\n## |$)/);return(i||s||l)&&(r.instructionState={persona:i?i[1].trim():"",tone:"neutral",expertise:3,constraints:{neverMakeUp:!1,askBeforeActions:!1,stayInScope:!1,useOnlyTools:!1,limitWords:!1,wordLimit:500,customConstraints:s?s[1].trim():"",scopeDefinition:""},objectives:{primary:l?l[1].trim():"",successCriteria:[],failureModes:[]},rawPrompt:"",autoSync:!0}),r}function J6(e){const t=wS(e);if(t.agents&&typeof t.agents=="object"&&!Array.isArray(t.agents)){const r=t.agents,i=Object.keys(r)[0];if(i){const s=r[i],l=Nr({name:i.replace(/-/g," "),model:s.model,temperature:s.temperature,tools:s.skills,reads:s.context});return l.detectedFormat="openclaw",l}}if(t.mcp&&typeof t.mcp=="object"&&!Array.isArray(t.mcp)){const r=Nr({...t,system:t.instructions,reads:t.context_files});return r.detectedFormat="amp",r}const n=Nr(t);return n.detectedFormat="amp",n}function Nr(e){const t={},n={name:so(e.name)||"",description:so(e.description)||"",icon:so(e.icon)||"brain",category:so(e.category)||"general",tags:Array.isArray(e.tags)?e.tags:[],avatar:so(e.avatar)||""};if(t.agentMeta=n,e.model){const s=so(e.model);t.selectedModel=W6[s]??s}e.token_budget!==void 0&&(t.tokenBudget=Number(e.token_budget));const r=e.modular;if(r?.tokenBudget!==void 0&&(t.tokenBudget=Number(r.tokenBudget)),Array.isArray(e.output_format)){const s=e.output_format.filter(l=>q1.has(l));s.length>0&&(t.outputFormat=s[0])}else if(e.output_format){const s=so(e.output_format);q1.has(s)&&(t.outputFormat=s)}!t.outputFormat&&r?.outputFormat&&(t.outputFormat=r.outputFormat),Array.isArray(e.reads)&&(t.channels=e.reads.map((s,l)=>{const u=void 0;return{sourceId:u?.id??`imported-${l}`,name:u?.name??s.split("/").filter(Boolean).pop()??s,path:s,category:u?.category??"knowledge",knowledgeType:$s(u?u.path:s),enabled:!0,depth:0,baseTokens:u?.tokenEstimate??5e3}})),!t.channels&&r?.channels&&(t.channels=r.channels.map((s,l)=>{const u=tR(s.type)?s.type:$s(s.path),f=Y6[s.depth?.toLowerCase()]??0,m=(s.path,void 0);return{sourceId:m?.id??`imported-${l}`,name:m?.name??s.path.split("/").filter(Boolean).pop()??s.path,path:s.path,category:m?.category??"knowledge",knowledgeType:u,enabled:!0,depth:f,baseTokens:m?.tokenEstimate??5e3}})),!t.prompt&&e.system&&(t.prompt=so(e.system)),e.prompt&&(t.prompt=so(e.prompt));const i=so(e.system);if(i){const s=oR(i);t.instructionState={persona:s.persona,tone:"neutral",expertise:3,constraints:{neverMakeUp:!1,askBeforeActions:!1,stayInScope:!1,useOnlyTools:!1,limitWords:!1,wordLimit:500,customConstraints:s.constraints,scopeDefinition:""},objectives:{primary:s.objective,successCriteria:[],failureModes:[]},rawPrompt:"",autoSync:!0}}return t}function so(e){return typeof e=="string"?e:e==null?"":String(e)}function eR(e){const t=e.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);return t?{frontmatter:wS(t[1]),body:t[2]}:{frontmatter:{},body:e}}function wS(e){const t={},n=e.split(`
|
|
166
|
+
`);let r="",i=null,s=null,l=null,u="",f=0,m=[];const h=()=>{if(u&&m.length>0){const g=i||t;g[u]=m.join(`
|
|
167
|
+
`),u="",m=[]}};for(const g of n){if(u)if(g.search(/\S/)>=f&&g.trim()!==""){m.push(g.slice(f));continue}else h();const b=g.match(/^(\w[\w_-]*)\s*:\s*(.*)$/);if(b){l&&s&&(s.push(l),l=null),s=null,i=null;const y=b[1],v=b[2].trim();v===""||v==="|"?v==="|"?(u=y,f=2,m=[]):(r=y,i={},t[y]=i):v.startsWith("[")&&v.endsWith("]")?t[y]=v.slice(1,-1).split(",").map(w=>w.trim()).filter(Boolean):t[y]=ea(v);continue}if(i){const y=g.match(/^ (\w[\w_-]*)\s*:\s*(.*)$/);if(y){l&&s&&(s.push(l),l=null);const v=y[1],w=y[2].trim();w===""||w==="|"?w==="|"?(u=v,f=4,m=[]):(s=[],i[v]=s):(s=null,i[v]=ea(w));continue}if(s){const v=g.match(/^ - (.+)$/);if(v&&!v[1].includes(":")){l&&(s.push(l),l=null),s.push(ea(v[1].trim()));continue}}if(s){const v=g.match(/^ - (\w[\w_-]*)\s*:\s*(.*)$/);if(v){l&&s.push(l),l={[v[1]]:ea(v[2])};continue}const w=g.match(/^ (\w[\w_-]*)\s*:\s*(.*)$/);if(w&&l){l[w[1]]=ea(w[2]);continue}}}if(!i){const y=g.match(/^ - (.+)$/);if(y&&s){if(!y[1].includes(":"))s.push(ea(y[1].trim()));else{const w=y[1].match(/^(\w[\w_-]*)\s*:\s*(.*)$/);w&&(l&&s.push(l),l={[w[1]]:ea(w[2])})}continue}const v=g.match(/^(\w[\w_-]*)\s*:$/);if(v){r=v[1],s=[],t[r]=s;continue}}}return h(),l&&s&&s.push(l),t}function ea(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function tR(e){return["ground-truth","signal","evidence","framework","hypothesis","guideline"].includes(e)}function nR(e){const t=[],n=e.split(`
|
|
168
|
+
`);let r=0;for(const i of n){const s=i.match(/[-*]\s+(?:\*\*.*?\*\*:?\s*)?([A-Za-z0-9_/-]+(?:\/\*)?)/);if(s){const l=s[1];l.includes("/")&&(t.push({sourceId:`body-${r}`,name:l.split("/").filter(Boolean).pop()??l,path:l,category:"knowledge",knowledgeType:$s(l),enabled:!0,depth:0,baseTokens:5e3}),r++)}}return t}function oR(e){const t=e.replace(/\r\n/g,`
|
|
169
|
+
`).trim();if(!t)return{persona:"",constraints:"",objective:""};const n=t.split(/\n\s*\n/).map(C=>C.trim()).filter(Boolean),i=t.split(`
|
|
170
|
+
`).map(C=>C.trim()).filter(Boolean).map(C=>{const M=C.match(/^[-*]\s+(.+)$/);if(M)return M[1].trim();const S=C.match(/^\d+\.\s+(.+)$/);return S?S[1].trim():""}).filter(Boolean),s=/\b(never|always|must|must not|do not|don't|forbidden|required|only|avoid|without)\b/i,l=/\b(objective|goal|task|deliver|ensure|help|outcome|success|mission)\b/i,u=i.filter(C=>s.test(C)),f=i.filter(C=>!s.test(C)&&l.test(C)),m=t.match(/(?:^|\n)(?:#+\s*)?(?:objective|objectives|goal|goals|mission)\s*:?\s*\n?([\s\S]*?)(?=\n(?:#+\s*)?[A-Za-z][^\n]*:\s*|\n\s*\n|$)/i),h=t.match(/(?:^|\n)(?:#+\s*)?(?:constraint|constraints|guardrails|rules)\s*:?\s*\n?([\s\S]*?)(?=\n(?:#+\s*)?[A-Za-z][^\n]*:\s*|\n\s*\n|$)/i),g=m?.[1]?.split(`
|
|
171
|
+
`).map(C=>C.replace(/^[-*]\s+/,"").trim()).find(Boolean)??"",b=h?.[1]?.split(`
|
|
172
|
+
`).map(C=>C.replace(/^[-*]\s+/,"").trim()).filter(Boolean).join(`
|
|
173
|
+
`)??"",v=(n.find(C=>{const M=C.toLowerCase();return!(/^(constraints?|guardrails?|rules|objectives?|goals?|mission)\s*:/.test(M)||l.test(C)||s.test(C))})??n[0]??"").split(new RegExp("(?<=[.!?])\\s+")).map(C=>C.trim()).find(Boolean)??"",w=g||f[0]||n.find(C=>l.test(C))||"",E=b||u.join(`
|
|
174
|
+
`);return{persona:v,constraints:E,objective:typeof w=="string"?w.trim():""}}const G1={strategy:"summarize_and_recent",windowSize:20,summarizeAfter:10,summaryModel:"same",tokenBudget:2e4,maxMessages:20,summarizeEnabled:!0},rR={enabled:!0,store:"local_sqlite",embeddingModel:"text-embedding-3-small",recall:{strategy:"top_k",k:5,minScore:.7},write:{mode:"auto_extract",extractTypes:["user_preferences","decisions","facts"]},scope:"per_user",maxEntries:1e3,ttl:null,tokenBudget:5e3},aR={enabled:!0,maxTokens:2e3,persist:!1,format:"freeform",content:"",tokenBudget:2e3},iR={isolation:"reset_each_run",allowPromoteToShared:!1,domains:{shared:{enabled:!0},agentPrivate:{enabled:!0},runScratchpad:{enabled:!0}}},rt=fn((e,t)=>({session:{...G1},longTerm:{...rR},working:{...aR},facts:[],sandbox:{...iR},sessionMemory:{...G1},longTermMemory:[],workingMemory:"",setSessionConfig:n=>{e(r=>{const i={...r.session,...n};"maxMessages"in n&&(i.windowSize=i.maxMessages),"windowSize"in n&&(i.maxMessages=i.windowSize),"summarizeEnabled"in n&&!i.summarizeEnabled&&(i.strategy="sliding_window"),"strategy"in n&&(i.summarizeEnabled=n.strategy==="summarize_and_recent");const s=i;return{session:s,sessionMemory:s}})},setLongTermConfig:n=>{e(r=>({longTerm:{...r.longTerm,...n}}))},setRecallConfig:n=>{e(r=>({longTerm:{...r.longTerm,recall:{...r.longTerm.recall,...n}}}))},setWriteConfig:n=>{e(r=>({longTerm:{...r.longTerm,write:{...r.longTerm.write,...n}}}))},toggleExtractType:n=>{e(r=>{const i=r.longTerm.write.extractTypes,s=i.includes(n)?i.filter(l=>l!==n):[...i,n];return{longTerm:{...r.longTerm,write:{...r.longTerm.write,extractTypes:s}}}})},setWorkingConfig:n=>{e(r=>({working:{...r.working,...n}}))},updateScratchpad:n=>{e(r=>({working:{...r.working,content:n},workingMemory:n}))},addFact:(n,r=[],i="fact",s="shared",l="fact",u)=>{const f={id:`fact-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,content:n,tags:r,type:i,timestamp:Date.now(),domain:s,granularity:l,embeddingPending:!0,...u&&{ownerAgentId:u}};e(m=>{const h=[...m.facts,f];return{facts:h,longTermMemory:h}})},removeFact:n=>{e(r=>{const i=r.facts.filter(s=>s.id!==n);return{facts:i,longTermMemory:i}})},updateFact:(n,r)=>{e(i=>({facts:i.facts.map(s=>s.id===n?{...s,...r}:s)}))},addEpisode:(n,r=[])=>{const i={id:`episode-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,content:n,tags:r,type:"fact",timestamp:Date.now(),domain:"shared",granularity:"episode",embeddingPending:!0};e(s=>{const l=[...s.facts,i];return{facts:l,longTermMemory:l}})},computeEmbeddings:async()=>{const r=t().facts.filter(i=>i.embeddingPending&&!i.embedding);if(r.length!==0)try{const i=await fetch("/api/knowledge/embed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({texts:r.map(l=>l.content)})});if(!i.ok)return;const s=await i.json();if(!s.embeddings||s.embeddings.length!==r.length)return;e(l=>({facts:l.facts.map(u=>{const f=r.findIndex(m=>m.id===u.id);return f===-1?u:{...u,embedding:s.embeddings[f],embeddingPending:!1}})}))}catch{}},setSandboxConfig:n=>{e(r=>({sandbox:{...r.sandbox,...n}}))},setSandboxDomain:(n,r)=>{e(i=>({sandbox:{...i.sandbox,domains:{...i.sandbox.domains,[n]:{enabled:r}}}}))},getFactsByDomain:n=>t().facts.filter(r=>r.domain===n),getRecallableFacts:n=>{const{facts:r,sandbox:i}=t();return r.filter(s=>s.domain==="run_scratchpad"?!1:s.domain==="agent_private"?i.domains.agentPrivate.enabled?!!n&&s.ownerAgentId===n:!1:s.domain==="shared"?i.domains.shared.enabled:!1)},toYaml:()=>{const{session:n,longTerm:r,working:i,facts:s,sandbox:l}=t();return{memory:{session:{strategy:n.strategy,window_size:n.windowSize,summarize_after:n.summarizeAfter,summary_model:n.summaryModel,token_budget:n.tokenBudget},long_term:{enabled:r.enabled,store:r.store,embedding_model:r.embeddingModel,recall:{strategy:r.recall.strategy,k:r.recall.k,min_score:r.recall.minScore},write:{mode:r.write.mode,extract_types:r.write.extractTypes},scope:r.scope,max_entries:r.maxEntries,ttl:r.ttl,token_budget:r.tokenBudget,...s.length>0?{seed_facts:s.map(u=>({content:u.content,type:u.type,tags:u.tags,domain:u.domain,granularity:u.granularity}))}:{}},working:{enabled:i.enabled,max_tokens:i.maxTokens,persist:i.persist,format:i.format,token_budget:i.tokenBudget},sandbox:{isolation:l.isolation,allow_promote_to_shared:l.allowPromoteToShared,domains:{shared:l.domains.shared.enabled,agent_private:l.domains.agentPrivate.enabled,run_scratchpad:l.domains.runScratchpad.enabled}}}}}}));function Fs({checked:e,onChange:t,label:n,size:r="md",disabled:i}){const s=Ee(),l=r==="sm"?28:36,u=r==="sm"?16:20,f=r==="sm"?12:16;return d.jsxs("button",{type:"button",role:"switch","aria-checked":e,onClick:()=>!i&&t(!e),className:"flex items-center gap-2 cursor-pointer border-none bg-transparent p-0 nodrag",style:{opacity:i?.5:1,cursor:i?"not-allowed":"pointer"},children:[d.jsx("div",{className:"relative rounded-full transition-colors",style:{width:l,height:u,background:e?"#FE5000":s.border},children:d.jsx("div",{className:"absolute top-[2px] rounded-full bg-white transition-transform",style:{width:f,height:f,transform:`translateX(${e?l-f-2:2}px)`,transition:"transform 0.15s ease"}})}),n&&d.jsx("span",{className:"text-[13px]",style:{color:s.textSecondary},children:n})]})}function sR(e,t,n){return`You are an expert AI agent architect. Given a user's rough description of an agent they want to build, produce a COMPLETE agent configuration as JSON.
|
|
175
|
+
|
|
176
|
+
You have access to these MCP servers (pick ONLY from this list):
|
|
177
|
+
<mcp_servers>
|
|
178
|
+
${e}
|
|
179
|
+
</mcp_servers>
|
|
180
|
+
|
|
181
|
+
You have access to these skills (pick ONLY from this list):
|
|
182
|
+
<skills>
|
|
183
|
+
${t}
|
|
184
|
+
</skills>
|
|
185
|
+
|
|
186
|
+
The user has these REAL knowledge sources already connected (indexed repos, documents, files):
|
|
187
|
+
<connected_knowledge>
|
|
188
|
+
${n}
|
|
189
|
+
</connected_knowledge>
|
|
190
|
+
|
|
191
|
+
Produce a JSON response with this EXACT structure:
|
|
192
|
+
{
|
|
193
|
+
"agentMeta": {
|
|
194
|
+
"name": "<short agent name>",
|
|
195
|
+
"description": "<one-line description>",
|
|
196
|
+
"avatar": "<icon id: bot|brain|zap|flame|lightbulb|target|rocket|shield|microscope|chart|palette|file|drama|star|gem|bird|bug|cat|dog|heart>",
|
|
197
|
+
"tags": ["<tag1>", "<tag2>"]
|
|
198
|
+
},
|
|
199
|
+
"instructionState": {
|
|
200
|
+
"persona": "<2-4 sentence persona using 'You are...' framing>",
|
|
201
|
+
"tone": "<formal|neutral|casual>",
|
|
202
|
+
"expertise": <1-5>,
|
|
203
|
+
"constraints": {
|
|
204
|
+
"neverMakeUp": <true|false>,
|
|
205
|
+
"askBeforeActions": <true|false>,
|
|
206
|
+
"stayInScope": <true|false>,
|
|
207
|
+
"useOnlyTools": <true|false>,
|
|
208
|
+
"limitWords": <true|false>,
|
|
209
|
+
"wordLimit": <number or 0>,
|
|
210
|
+
"customConstraints": ["<constraint>"],
|
|
211
|
+
"scopeDefinition": "<what agent handles and does NOT handle>"
|
|
212
|
+
},
|
|
213
|
+
"objectives": {
|
|
214
|
+
"primary": "<primary goal>",
|
|
215
|
+
"successCriteria": ["<criterion>"],
|
|
216
|
+
"failureModes": ["<failure to avoid>"]
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
"workflowSteps": [
|
|
220
|
+
{
|
|
221
|
+
"label": "<step name>",
|
|
222
|
+
"action": "<what the agent does>",
|
|
223
|
+
"condition": false,
|
|
224
|
+
"loop": false
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
"mcpServerIds": ["<mcp-id from the list above>"],
|
|
228
|
+
"skillIds": ["<skill-id from the list above>"],
|
|
229
|
+
"knowledgeSelections": [
|
|
230
|
+
{
|
|
231
|
+
"sourceId": "<exact sourceId from connected_knowledge>",
|
|
232
|
+
"type": "<ground-truth|signal|evidence|framework|hypothesis|guideline>",
|
|
233
|
+
"depth": <0-4>,
|
|
234
|
+
"reason": "<why this source is relevant>"
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"knowledgeGaps": [
|
|
238
|
+
{
|
|
239
|
+
"name": "<what's missing>",
|
|
240
|
+
"type": "<ground-truth|signal|evidence|framework|hypothesis|guideline>",
|
|
241
|
+
"description": "<what the user should connect and why>"
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
"memoryConfig": {
|
|
245
|
+
"maxMessages": <10-50>,
|
|
246
|
+
"summarizeAfter": <5-25>,
|
|
247
|
+
"summarizeEnabled": <true|false>,
|
|
248
|
+
"suggestedFacts": ["<pre-loaded fact for long-term memory>"]
|
|
249
|
+
},
|
|
250
|
+
"outputSuggestions": ["<notion|slack|html-slides|email|github|hubspot>"]
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
Rules:
|
|
254
|
+
1. Pick MCP servers and skills ONLY from the provided lists — use exact IDs
|
|
255
|
+
2. Suggest 2-6 MCP servers and 1-4 skills that are genuinely useful for this agent
|
|
256
|
+
3. Generate 3-8 workflow steps that form a coherent process
|
|
257
|
+
4. **Knowledge: select from REAL connected sources using their exact sourceId**
|
|
258
|
+
- Set the appropriate knowledge type (ground-truth for specs, signal for feedback, etc.)
|
|
259
|
+
- Set depth: 0=Full, 1=Detail(75%), 2=Summary(50%), 3=Headlines(25%), 4=Mention(10%)
|
|
260
|
+
- If no connected sources exist or none are relevant, leave knowledgeSelections empty
|
|
261
|
+
5. **Knowledge gaps: suggest what REAL documents/repos the user should connect**
|
|
262
|
+
- Be specific: "Odfjell fleet spec PDF" not "Company documentation"
|
|
263
|
+
- Only suggest gaps that would genuinely improve the agent
|
|
264
|
+
6. Be opinionated — make real choices, don't hedge
|
|
265
|
+
7. Memory config: enable summarization for conversational agents, disable for one-shot tools
|
|
266
|
+
|
|
267
|
+
Output ONLY the JSON object. No markdown fences, no explanation.`}async function lR(e){if(!e.trim())throw new Error("Describe the agent you want to build");const t=dt.getState(),n=t.providers.filter(S=>(S.status==="connected"||S.status==="configured")&&Array.isArray(S.models)&&S.models.length>0),r=t.providers.find(S=>S.id===t.selectedProviderId&&n.includes(S))||n[0];if(!r)throw new Error("No provider with models available. Connect a provider and refresh models in Settings.");const i=r.models[0],s=typeof i=="string"?i:i?.id||"";if(!s)throw new Error(`Provider ${r.name} has no selectable model.`);const l=r.authMethod==="claude-agent-sdk",u=ie.getState(),f=u.mcpServers.filter(S=>S.added).map(S=>S.id),m=u.skills.filter(S=>S.added).map(S=>S.id),h=f.length>0?ra.filter(S=>f.includes(S.id)):[],g=m.length>0?vu.filter(S=>m.includes(S.id)):[],b=h.length>0?h.map(S=>`${S.id}: ${S.description}`).join(`
|
|
268
|
+
`):"none",y=g.length>0?g.map(S=>`${S.id}: ${S.description}`).join(`
|
|
269
|
+
`):"none",v=u.channels,w=v.length>0?v.map(S=>`- sourceId: "${S.sourceId}" | name: "${S.name}" | path: "${S.path||"(no path)"}" | type: ${S.knowledgeType||"unclassified"} | tokens: ${S.baseTokens} | depth: ${S.depth}`).join(`
|
|
270
|
+
`):"No knowledge sources connected yet. Suggest what the user should add in knowledgeGaps.",E=sR(b,y,w),C=l?await ed({prompt:e,model:s,systemPrompt:E,maxTurns:1}):await Ju({providerId:r.id,model:s,messages:[{role:"system",content:E},{role:"user",content:e}],temperature:.4,maxTokens:4096});let M;try{M=JSON.parse(C)}catch{}if(!M){const S=C.match(/```(?:json)?\s*([\s\S]*?)```/);if(S)try{M=JSON.parse(S[1].trim())}catch{}}if(!M){const S=C.match(/\{[\s\S]*\}/);if(S)try{M=JSON.parse(S[0])}catch{}}if(!M)throw new Error("Could not parse generated agent config");return cR(M),M}function cR(e){const t=ie.getState().channels;if(t.length===0)return;function n(l){const u=e.instructionState.constraints.customConstraints;Array.isArray(u)?u.push(l):typeof u=="string"?e.instructionState.constraints.customConstraints=u?`${u}
|
|
271
|
+
${l}`:l:e.instructionState.constraints.customConstraints=[l]}const r=t.filter(l=>l.repoMeta);if(r.length>0){const l=r.map(f=>{const m=f.repoMeta,h=m.stack.length>0?m.stack.join(", "):"unknown stack";return`${m.name} (${h})`});e.instructionState.persona+=` You have deep access to ${l.join(" and ")}.`,n("Explore connected codebases autonomously — read files, check structure, trace dependencies before asking the user for information.");const u=r.flatMap(f=>f.repoMeta.features).filter(Boolean);if(u.length>0){const f=[...new Set(u)];e.instructionState.persona+=` Key capabilities include: ${f.join(", ")}.`}}const i=new Map;for(const l of t){if(!l.knowledgeType)continue;const u=i.get(l.knowledgeType)??[];u.push(l.name),i.set(l.knowledgeType,u)}const s={"ground-truth":l=>`Do not contradict information from: ${l}`,signal:l=>`When interpreting ${l}, look for underlying user needs, not surface requests`,guideline:l=>`Follow the conventions and rules defined in: ${l}`};for(const[l,u]of i){const f=s[l];f&&n(f(u.join(", ")))}}function uR(e){const t=ie.getState(),n=[t.agentMeta.name&&`Agent: ${t.agentMeta.name}`,t.agentMeta.description&&`Description: ${t.agentMeta.description}`,t.instructionState.persona&&`Persona: ${t.instructionState.persona.slice(0,200)}`,t.instructionState.objectives.primary&&`Objective: ${t.instructionState.objectives.primary}`,t.instructionState.constraints.customConstraints&&`Constraints: ${t.instructionState.constraints.customConstraints.slice(0,200)}`,t.workflowSteps.length>0&&`Workflow: ${t.workflowSteps.map(i=>i.label).join(" → ")}`,t.channels.filter(i=>i.enabled).length>0&&`Knowledge: ${t.channels.filter(i=>i.enabled).map(i=>i.name).join(", ")}`,t.mcpServers.filter(i=>i.enabled!==!1).length>0&&`MCP: ${t.mcpServers.filter(i=>i.enabled!==!1).map(i=>i.name).join(", ")}`,t.skills.filter(i=>i.enabled!==!1).length>0&&`Skills: ${t.skills.filter(i=>i.enabled!==!1).map(i=>i.name).join(", ")}`].filter(Boolean).join(`
|
|
272
|
+
`),r=e.map((i,s)=>`${s+1}. [${i.id}] "${i.content}" (type: ${i.type}, tags: ${i.tags.join(",")})`).join(`
|
|
273
|
+
`);return`You are an expert agent architect analyzing runtime memory facts to improve an agent's design.
|
|
274
|
+
|
|
275
|
+
<agent_context>
|
|
276
|
+
${n}
|
|
277
|
+
</agent_context>
|
|
278
|
+
|
|
279
|
+
<facts>
|
|
280
|
+
${r}
|
|
281
|
+
</facts>
|
|
282
|
+
|
|
283
|
+
Analyze each fact and determine if it should be PROMOTED from runtime memory into a structured agent component. Facts that encode persistent patterns, preferences, or capabilities should graduate into the agent's design.
|
|
284
|
+
|
|
285
|
+
Promotion targets:
|
|
286
|
+
- "instruction": Fact describes HOW the agent should behave → append to persona or instructions
|
|
287
|
+
- "constraint": Fact is a rule or limitation → add as a constraint
|
|
288
|
+
- "workflow": Fact describes a recurring process → add as a workflow step
|
|
289
|
+
- "knowledge": Fact points to a data source the agent needs → add as knowledge source
|
|
290
|
+
- "mcp": Fact mentions a tool/API the agent should use → suggest MCP server
|
|
291
|
+
- "skill": Fact describes a capability the agent needs → suggest a skill
|
|
292
|
+
- "keep": Fact is volatile/contextual → keep in runtime memory
|
|
293
|
+
|
|
294
|
+
Output ONLY valid JSON:
|
|
295
|
+
{
|
|
296
|
+
"promotions": [
|
|
297
|
+
{
|
|
298
|
+
"factId": "<id from facts list>",
|
|
299
|
+
"factContent": "<the fact text>",
|
|
300
|
+
"target": "<promotion target>",
|
|
301
|
+
"confidence": <0.0-1.0>,
|
|
302
|
+
"suggestion": "<human-readable suggestion>",
|
|
303
|
+
"reason": "<why this promotion improves the agent>",
|
|
304
|
+
"payload": {
|
|
305
|
+
"constraintText": "<if target=constraint>",
|
|
306
|
+
"workflowStep": { "label": "<step name>", "action": "<what to do>" },
|
|
307
|
+
"knowledgeSource": { "name": "<source name>", "type": "<ground-truth|signal|evidence|framework>" },
|
|
308
|
+
"mcpServerId": "<id from MCP registry if target=mcp>",
|
|
309
|
+
"skillId": "<skill id if target=skill>",
|
|
310
|
+
"instructionAppend": "<text to append to persona if target=instruction>"
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
],
|
|
314
|
+
"summary": "<one sentence summary of recommended changes>",
|
|
315
|
+
"versionImpact": "<major|minor|patch|none>"
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
Rules:
|
|
319
|
+
- Only promote facts with confidence >= 0.6
|
|
320
|
+
- Facts that are temporary/contextual should stay as "keep"
|
|
321
|
+
- Prefer fewer high-confidence promotions over many low-confidence ones
|
|
322
|
+
- Include payload fields ONLY for the relevant target (omit others)
|
|
323
|
+
- versionImpact: major if persona/objective changes, minor if adding knowledge/tools/steps, patch if constraints only`}async function dR(e){const t=dt.getState(),n=t.providers.find(i=>i.id===t.selectedProviderId);if(!n)throw new Error("No provider configured — add one in Settings");const r=typeof n.models?.[0]=="object"?n.models[0].id:n.models?.[0]||"claude-sonnet-4-20250514";return n.authMethod==="claude-agent-sdk"?ed({prompt:e,model:r,maxTurns:1}):Ju({providerId:n.id,model:r,messages:[{role:"user",content:e}],temperature:.3,maxTokens:4096})}function pR(e){try{return JSON.parse(e)}catch{}const t=e.match(/```(?:json)?\s*([\s\S]*?)```/);if(t)try{return JSON.parse(t[1].trim())}catch{}const n=e.match(/\{[\s\S]*\}/);if(n)try{return JSON.parse(n[0])}catch{}throw new Error("Could not parse analysis response")}async function fR(e){if(e.length===0)return{promotions:[],summary:"No facts to analyze",versionImpact:"none"};const t=uR(e),n=await dR(t),r=pR(n);return r.promotions=r.promotions.filter(i=>i.confidence>=.6&&i.target!=="keep").sort((i,s)=>s.confidence-i.confidence),r}function K1(){return{status:"unknown",latencyMs:null,toolCount:null,errorMessage:null,checkedAt:0}}const V1=fn((e,t)=>({mcpHealth:{},skillHealth:{},setMcpHealth:(n,r)=>e(i=>({mcpHealth:{...i.mcpHealth,[n]:r}})),setSkillHealth:(n,r)=>e(i=>({skillHealth:{...i.skillHealth,[n]:r}})),setMcpChecking:n=>e(r=>({mcpHealth:{...r.mcpHealth,[n]:{...r.mcpHealth[n]||K1(),status:"checking"}}})),setSkillChecking:n=>e(r=>({skillHealth:{...r.skillHealth,[n]:{...r.skillHealth[n]||K1(),status:"checking"}}})),clearHealth:()=>e({mcpHealth:{},skillHealth:{}})})),lh={"ground-truth":.3,guideline:.15,framework:.15,evidence:.2,signal:.12,hypothesis:.08},mR=.03,hR={0:1.5,1:1.2,2:1,3:.6,4:.2};function gR(e,t){if(e.length===0)return[];if(t<=0)return e.map(l=>({name:l.name,knowledgeType:l.knowledgeType,allocatedTokens:0,weight:0,cappedBySize:!1}));const n=new Map;for(const l of e)n.has(l.knowledgeType)||n.set(l.knowledgeType,[]),n.get(l.knowledgeType).push(l);const r=[];for(const[l,u]of n){const f=lh[l],m=u.length;for(const h of u){const g=h.depthMultiplier??1,b=f/m*g,y=Math.max(b,mR);r.push({name:h.name,knowledgeType:h.knowledgeType,allocatedTokens:0,weight:y,cappedBySize:!1})}}const i=r.reduce((l,u)=>l+u.weight,0);if(i>0)for(const l of r)l.weight=l.weight/i;for(const l of r)l.allocatedTokens=Math.round(l.weight*t);const s=new Map(e.map(l=>[l.name,l]));for(let l=0;l<3;l++){let u=0;const f=[];for(const m of r){const h=s.get(m.name);m.allocatedTokens>h.rawTokens?(u+=m.allocatedTokens-h.rawTokens,m.allocatedTokens=h.rawTokens,m.cappedBySize=!0):m.cappedBySize||f.push(m)}if(u>0&&f.length>0){const m=f.reduce((h,g)=>h+g.weight,0);if(m>0)for(const h of f){const g=Math.round(h.weight/m*u);h.allocatedTokens+=g}}else break}return r}function tg({loading:e,onClick:t,label:n="Generate"}){return d.jsxs("button",{type:"button",onClick:r=>{r.stopPropagation(),t()},disabled:e,"aria-label":n,className:"flex items-center gap-1 text-[13px] px-2 py-1 rounded cursor-pointer border-none",style:{background:"#FE500015",color:"#FE5000",fontFamily:"'Geist Mono', monospace",opacity:e?.6:1},children:[e?d.jsx(Ot,{size:9,className:"animate-spin motion-reduce:animate-none"}):d.jsx(ga,{size:9}),n]})}function Ml({icon:e,label:t,color:n,badge:r,collapsed:i,onToggle:s,children:l}){const u=Ee();return d.jsxs("div",{role:"region","aria-label":t,style:{borderBottom:`1px solid ${u.isDark?"#1e1e22":"#e8e8ec"}`},children:[d.jsxs("button",{type:"button",onClick:s,"aria-expanded":!i,className:"flex items-center gap-2 w-full px-5 py-3.5 border-none cursor-pointer select-none",style:{background:"transparent"},children:[d.jsx(e,{size:10,style:{color:n,flexShrink:0}}),i?d.jsx(Go,{size:12,style:{color:u.textDim}}):d.jsx(Pn,{size:12,style:{color:u.textDim}}),d.jsx("span",{className:"text-[12px] font-bold tracking-[0.08em] uppercase flex-1 text-left",style:{fontFamily:"'Geist Mono', monospace",color:u.textSecondary},children:t}),r&&d.jsx("span",{className:"text-[13px] px-2 py-0.5 rounded-full",style:{fontFamily:"'Geist Mono', monospace",color:u.textDim,background:u.badgeBg},children:r})]}),!i&&d.jsx("div",{className:"px-5 pb-4",children:l})]})}function yR({onGapsChange:e}){const t=Ee(),n=ie(w=>w.hydrateFromGenerated),r=rt(w=>w.setSessionConfig),i=rt(w=>w.addFact),[s,l]=$.useState(""),[u,f]=$.useState(!1),[m,h]=$.useState(""),[g,b]=$.useState(null),y=$.useCallback(async()=>{if(!(!s.trim()||u)){f(!0),h("");try{const w=await lR(s);if(b(w),e(w.knowledgeGaps||[]),n(w),w.memoryConfig){r({maxMessages:w.memoryConfig.maxMessages,summarizeAfter:w.memoryConfig.summarizeAfter,summarizeEnabled:w.memoryConfig.summarizeEnabled});for(const E of w.memoryConfig.suggestedFacts||[])i(E,["generated"])}}catch(w){h(w instanceof Error?w.message:"Generation failed")}finally{f(!1)}}},[s,u,n,r,i]),v=g?{mcp:g.mcpServerIds?.length||0,skills:g.skillIds?.length||0,steps:g.workflowSteps?.length||0,knowledge:g.knowledgeSelections?.length||g.knowledgeSuggestions?.length||0,gaps:g.knowledgeGaps?.length||0}:null;return d.jsxs("div",{style:{borderBottom:`1px solid ${t.isDark?"#1e1e22":"#e8e8ec"}`},children:[d.jsxs("div",{className:"px-5 py-3 flex items-center gap-2",style:{background:t.isDark?"#1a1a1e":"#f0f0f5"},children:[d.jsx(wz,{size:13,style:{color:"#FE5000"}}),d.jsx("span",{className:"text-[12px] font-bold tracking-[0.08em] uppercase",style:{fontFamily:"'Geist Mono', monospace",color:t.textSecondary},children:"Generate Agent"})]}),d.jsxs("div",{className:"px-5 py-3 flex flex-col gap-2",children:[d.jsx("div",{className:"flex flex-wrap gap-1",children:[{label:"Code Review",icon:"🔍",prompt:"A code review agent that uses framework sources for coding standards, ground-truth for API specs, and strict constraints. Reviews PRs for correctness, style, and security."},{label:"Research",icon:"🔬",prompt:"A research agent that uses evidence and signal sources with broad exploration. Synthesizes data from multiple sources, identifies patterns, and generates structured research reports."},{label:"Maritime Ops",icon:"⚓",prompt:"A maritime operations agent with ground-truth for SOLAS/MARPOL regulations, evidence from vessel data, and signal from crew feedback. Supports voyage planning, compliance checks, and operational reporting."},{label:"Writing",icon:"✍️",prompt:"A writing agent that uses framework sources for style guides, ground-truth for facts and references, and hypothesis for draft content. Produces polished documents with consistent voice and accurate citations."}].map(w=>d.jsxs("button",{type:"button",onClick:()=>l(w.prompt),className:"text-[12px] px-2 py-1 rounded-full cursor-pointer",title:w.prompt,style:{fontFamily:"'Geist Mono', monospace",fontWeight:500,background:t.isDark?"#1c1c20":"#eeeef3",color:t.textDim,border:`1px solid ${t.border}`,transition:"border-color 150ms"},onMouseEnter:E=>{E.currentTarget.style.borderColor="#FE5000",E.currentTarget.style.color="#FE5000"},onMouseLeave:E=>{E.currentTarget.style.borderColor=t.border,E.currentTarget.style.color=t.textDim},onFocus:E=>{E.currentTarget.style.borderColor="#FE5000",E.currentTarget.style.color="#FE5000"},onBlur:E=>{E.currentTarget.style.borderColor=t.border,E.currentTarget.style.color=t.textDim},children:[w.icon," ",w.label]},w.label))}),d.jsx(ia,{value:s,onChange:w=>l(w.target.value),placeholder:`Describe your agent in plain language...
|
|
324
|
+
|
|
325
|
+
e.g. "A PM agent that tracks competitors, uses GitHub and Notion, and outputs weekly reports to Slack"`,rows:4,style:{minHeight:80}}),m&&d.jsx("div",{role:"alert",className:"text-[12px] px-2 py-1 rounded",style:{background:"#ff000015",color:"#ff4444",border:"1px solid #ff000020"},children:m}),v&&d.jsx("div",{className:"flex flex-wrap gap-1",children:[{label:"MCP",count:v.mcp,color:"#2ecc71"},{label:"Skills",count:v.skills,color:"#f1c40f"},{label:"Steps",count:v.steps,color:"#e67e22"},{label:"Sources",count:v.knowledge,color:"#3498db"},...v.gaps>0?[{label:"Gaps",count:v.gaps,color:"#e74c3c"}]:[]].map(w=>d.jsxs("span",{className:"text-[13px] px-1.5 py-0.5 rounded",style:{fontFamily:"'Geist Mono', monospace",background:`${w.color}15`,color:w.color,border:`1px solid ${w.color}30`},children:[w.count," ",w.label]},w.label))}),d.jsxs("div",{className:"flex gap-2",children:[d.jsxs("button",{type:"button",onClick:y,disabled:u||!s.trim(),className:"flex items-center gap-1.5 px-4 py-2.5 rounded text-[13px] font-semibold tracking-wider uppercase cursor-pointer border-none flex-1 justify-center",style:{background:u?"#CC4000":"#FE5000",color:"#fff",opacity:u||!s.trim()?.6:1,fontFamily:"'Geist Mono', monospace"},children:[u?d.jsx(Ot,{size:11,className:"animate-spin motion-reduce:animate-none"}):d.jsx(ga,{size:11}),u?"Generating...":g?"Regenerate":"Generate"]}),g&&d.jsx("button",{type:"button",onClick:()=>{l(""),b(null),e([]),h("")},className:"flex items-center gap-1 px-2 py-2 rounded text-[12px]",style:{background:"transparent",border:`1px solid ${t.border}`,color:t.textDim,cursor:"pointer"},children:d.jsx(Gh,{size:10})})]})]})]})}function xR({gaps:e}){const t=Ee(),n=ie(s=>s.setShowFilePicker),i=ie(s=>s.agentMeta).name!=="";return e.length===0?i?d.jsx("div",{style:{borderBottom:`1px solid ${t.isDark?"#1e1e22":"#e8e8ec"}`,borderLeft:"3px solid #2ecc71"},children:d.jsx("div",{className:"px-5 py-3",style:{background:t.isDark?"#0f1a0f":"#f0fdf0"},children:d.jsx("span",{className:"text-[12px] font-bold tracking-[0.08em] uppercase",style:{fontFamily:"'Geist Mono', monospace",color:"#2ecc71"},children:"✅ No missing sources detected"})})}):null:d.jsxs("div",{style:{borderBottom:`1px solid ${t.isDark?"#1e1e22":"#e8e8ec"}`,borderLeft:"3px solid #e74c3c"},children:[d.jsx("div",{className:"px-5 py-3",style:{background:t.isDark?"#1a1a1e":"#fff5f5"},children:d.jsxs("span",{className:"text-[12px] font-bold tracking-[0.08em] uppercase",style:{fontFamily:"'Geist Mono', monospace",color:"#e74c3c"},children:["⚠ ",e.length," MISSING SOURCES"]})}),d.jsx("div",{className:"px-5 pb-4 flex flex-col gap-3",children:e.map((s,l)=>d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("span",{style:{color:"#e74c3c",fontSize:10,marginTop:3,flexShrink:0},children:"●"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"text-[13px]",children:[d.jsx("span",{style:{fontWeight:700,color:t.textPrimary},children:s.name}),d.jsxs("span",{style:{color:t.textDim},children:[" (",s.type,")"]})]}),s.description&&d.jsx("div",{className:"text-[12px] mt-0.5",style:{color:t.textDim},children:s.description}),d.jsx("button",{type:"button",onClick:()=>n(!0),className:"mt-1.5 text-[12px] px-2 py-0.5 rounded cursor-pointer border-none",style:{background:"#e74c3c15",color:"#e74c3c",fontFamily:"'Geist Mono', monospace",border:"1px solid #e74c3c30"},children:"+ Add source"})]})]},l))})]})}function bR(){const e=Ee(),t=ie(G=>G.channels),n=ie(G=>G.setChannelDepth),r=ie(G=>G.removeChannel),i=ie(G=>G.addChannel),s=ie(G=>G.setChannelKnowledgeType),l=ie(G=>G.setShowFilePicker),u=ie(G=>G.setShowConnectionPicker),f=ie(G=>G.connectors),m=ie(G=>G.removeConnector),h=Xn(G=>G.indexes),g=Xn(G=>G.loading),b=Xn(G=>G.errors),[y,v]=$.useState(!1),[w,E]=$.useState(!1),[C,M]=$.useState(!1),[S,N]=$.useState(""),[R,T]=$.useState(!1),[D,H]=$.useState(null),[V,B]=$.useState({}),[O,Y]=$.useState(null),Z=["Maximum","High","Normal","Low","Minimal"],U=["ground-truth","signal","evidence","framework","hypothesis","guideline"],_=G=>{const ce=new Set(t.filter(we=>we.enabled).map(we=>we.knowledgeType)),be=Array.from(ce).reduce((we,ve)=>we+(lh[ve]||0),0);return be>0?Math.round(lh[G]/be*100):0},A=G=>{const ce=h[G.path];if(ce){const be=fi[G.depth];return Math.round(ce.index.totalTokens*be.pct)}return G.baseTokens??0},q=t.filter(G=>G.enabled).length,K=t.filter(G=>G.enabled&&h[G.path]).length,Q=t.filter(G=>G.enabled).reduce((G,ce)=>G+A(ce),0),I=t.filter(G=>G.enabled&&/\.compressed\.md$/i.test(G.path||"")),F=I.reduce((G,ce)=>G+(ce.baseTokens||0),0),L=I.reduce((G,ce)=>G+A(ce),0),z=F>0?Math.max(0,(F-L)/F*100):0,W=G=>G>=1e3?`${(G/1e3).toFixed(0)}K`:`${G}`,ae=$.useCallback(async()=>{E(!0);const G=t.filter(ce=>ce.enabled&&ce.path).map(ce=>ce.path);G.length>0&&await Xn.getState().indexFiles(G),E(!1)},[t]),le=$.useCallback(async()=>{if(!(!S.trim()||C)){M(!0);try{const G=S.trim(),ce=/github\.com\//i.test(G)||G.endsWith(".git"),be=ce?`${ze}/repo/index-github`:`${ze}/repo/index`,ke=await(await fetch(be,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ce?{url:G,persist:!0}:{path:G})})).json();if(ke.status==="ok"&&ke.data){const De=ke.data.totalTokens??ke.data.scan?.totalTokens??5e3,oe=ke.data.scan,xe=Array.isArray(oe?.stack)?oe.stack:oe?.stack&&typeof oe.stack=="object"?Object.values(oe.stack).filter(Oe=>typeof Oe=="string"&&Oe!=="unknown"&&Oe!=="none"):[];for(const Oe of ke.data.files){const wt=`${ke.data.outputDir}/${Oe}`,ht=Oe.includes("overview");i({sourceId:`repo-${Oe}-${Date.now()}`,name:Oe.replace(".compressed.md","").replace(".md","").replace(/^\d+-/,""),path:wt,category:"knowledge",knowledgeType:"ground-truth",depth:ce?2:1,baseTokens:Math.round(De/Math.max(ke.data.files.length,1)),...ht&&ke.data.overviewMarkdown?{content:ke.data.overviewMarkdown}:{},...ht&&oe?{repoMeta:{name:ke.data.name??"",stack:xe,totalFiles:oe.totalFiles??0,baseUrl:oe.baseUrl,features:(oe.features??[]).map(St=>St.name)}}:{},...ke.data.contentSourceId?{contentSourceId:ke.data.contentSourceId}:{}})}T(!1),N(""),await Xn.getState().indexFiles(ke.data.files.map(Oe=>`${ke.data.outputDir}/${Oe}`)),oe&&Ho(async()=>{const{populateGraphFromScan:Oe}=await import("./graphPopulator-B3rQxb5A.js");return{populateGraphFromScan:Oe}},[]).then(({populateGraphFromScan:Oe})=>{Oe(ke.data.name??S,oe).catch(()=>{})})}}catch{}M(!1)}},[S,C,i]),me=["#2ecc71","#3498db","#f1c40f","#e67e22","#999"];return $.useEffect(()=>{fetch(`${ze}/connectors/auth`).then(G=>G.json()).then(G=>{G.data&&B(G.data)}).catch(()=>{})},[]),d.jsxs(Ml,{icon:Sl,label:"Knowledge",color:"#3498db",badge:`${K}/${q} indexed · ${W(Q)} tokens`,collapsed:y,onToggle:()=>v(!y),children:[d.jsx("div",{className:"flex justify-end mb-2",children:d.jsx(tg,{loading:w,onClick:ae,label:"Index"})}),d.jsx("div",{className:"flex flex-col",children:t.map(G=>{const ce=Ar[G.knowledgeType]||Ar.evidence,be=G.depth??0,we=/\.compressed\.md$/i.test(G.path||""),ve=(4-be)/4*100,ke=me[be]||"#999",De=!!h[G.path],oe=!!g[G.path],xe=!!b[G.path],Oe=A(G),wt=O===G.sourceId,ht=_(G.knowledgeType);return d.jsxs("div",{className:"py-1.5",style:{borderBottom:`1px solid ${e.isDark?"#1a1a1e":"#eee"}`},children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsxs("div",{style:{position:"relative",flexShrink:0},children:[d.jsx("div",{style:{width:8,height:8,borderRadius:2,background:ce.color}}),De&&d.jsx("div",{style:{position:"absolute",top:-2,right:-2,width:4,height:4,borderRadius:"50%",background:"#00ff88"}}),oe&&d.jsx("div",{style:{position:"absolute",top:-2,right:-2,width:4,height:4,borderRadius:"50%",background:"#ffaa00"}}),xe&&d.jsx("div",{style:{position:"absolute",top:-2,right:-2,width:4,height:4,borderRadius:"50%",background:"#ff3344"}})]}),d.jsx("button",{type:"button",onClick:()=>Y(wt?null:G.sourceId),className:"flex-1 truncate text-[13px] text-left border-none bg-transparent cursor-pointer p-0",title:G.name,style:{color:G.enabled?e.textPrimary:e.textDim,lineHeight:1.2},children:G.name}),d.jsx(ul,{content:`${ce.icon} ${ce.label} — ${ce.instruction}
|
|
326
|
+
Budget: ~${ht}% · Detail: ${Z[be]}`,position:"top",children:d.jsx("span",{className:"text-[7px] px-1.5 py-0.5 rounded-full shrink-0 cursor-default select-none",style:{fontFamily:"'Geist Mono', monospace",fontWeight:600,background:`${ce.color}18`,color:ce.color,border:`1px solid ${ce.color}30`},children:ce.label})}),we&&d.jsx("span",{className:"text-[12px] px-1 py-0.5 rounded shrink-0",style:{fontFamily:"'Geist Mono', monospace",color:"#24292F",background:"#24292F12",border:"1px solid #24292F30"},title:"GitHub indexed & compressed context",children:"GH"}),d.jsx("span",{className:"text-[13px] shrink-0",style:{fontFamily:"'Geist Mono', monospace",color:De?e.textPrimary:e.textDim},title:De?`Indexed: ${h[G.path].index.nodeCount} nodes`:"Estimated",children:W(Oe)}),d.jsx("button",{type:"button","aria-label":`Remove ${G.name}`,onClick:()=>r(G.sourceId),className:"border-none bg-transparent cursor-pointer rounded shrink-0 flex items-center justify-center",style:{color:e.textFaint,width:20,height:20,padding:0},children:d.jsx($t,{size:9})})]}),d.jsxs("div",{className:"flex items-center gap-1 mt-0.5 pl-4",children:[d.jsx("button",{type:"button","aria-label":"Less detail",onClick:()=>n(G.sourceId,Math.min(4,be+1)),className:"border-none bg-transparent cursor-pointer rounded shrink-0 flex items-center justify-center",style:{color:be>=4?e.textFaint:e.textDim,width:20,height:20,padding:0},children:d.jsx(_D,{size:9})}),d.jsx("div",{className:"flex-1",style:{height:4,background:`${ke}18`,borderRadius:2,overflow:"hidden"},children:d.jsx("div",{style:{width:`${ve}%`,height:"100%",background:ke,borderRadius:2,transition:"width 200ms"}})}),d.jsx("button",{type:"button","aria-label":"More detail",onClick:()=>n(G.sourceId,Math.max(0,be-1)),className:"border-none bg-transparent cursor-pointer rounded shrink-0 flex items-center justify-center",style:{color:be<=0?e.textFaint:e.textDim,width:20,height:20,padding:0},children:d.jsx(Ft,{size:9})}),d.jsx("span",{className:"text-[12px] shrink-0",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim,width:44,textAlign:"right"},children:Z[be]})]}),wt&&d.jsxs("div",{className:"mt-1.5 ml-4 px-2.5 py-2 rounded-md",style:{background:e.isDark?"#1a1a1e":"#f5f5f8",border:`1px solid ${e.isDark?"#2a2a30":"#e0e0e5"}`},children:[d.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[d.jsx("span",{className:"text-[12px] tracking-[0.1em] uppercase shrink-0",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim,width:32},children:"Type"}),d.jsx("div",{className:"flex flex-wrap gap-1",children:U.map((St,hn)=>{const en=Ar[St],gn=G.knowledgeType===St;return d.jsx("button",{type:"button",onClick:()=>s(G.sourceId,hn),className:"text-[7px] px-1.5 py-0.5 rounded-full cursor-pointer border-none",style:{fontFamily:"'Geist Mono', monospace",fontWeight:600,background:gn?`${en.color}25`:"transparent",color:gn?en.color:e.textFaint,border:`1px solid ${gn?`${en.color}40`:"transparent"}`},children:en.label},St)})})]}),d.jsxs("div",{className:"flex items-start gap-1.5 mb-2",children:[d.jsx(cD,{size:9,style:{color:ce.color,marginTop:1,flexShrink:0}}),d.jsx("span",{className:"text-[13px]",style:{color:e.textDim,lineHeight:1.3},children:ce.instruction})]}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("span",{className:"text-[12px]",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:["Budget: ~",ht,"%"]}),d.jsxs("span",{className:"text-[12px]",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:["Detail: ",Z[be]]}),d.jsxs("span",{className:"text-[12px]",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:["Tokens: ",W(Oe)]})]})]})]},G.sourceId)})}),f.filter(G=>G.enabled&&G.direction!=="write").length>0&&d.jsxs("div",{className:"mt-2 pt-2",style:{borderTop:`1px solid ${e.isDark?"#1a1a1e":"#eee"}`},children:[d.jsx("div",{className:"text-[13px] tracking-[0.1em] uppercase mb-1.5",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:"Connectors"}),f.filter(G=>G.enabled&&G.direction!=="write").map(G=>{const be={notion:"#000",slack:"#4A154B",hubspot:"#FF7A59",github:"#24292F",granola:"#8B5CF6","google-drive":"#4285F4"}[G.service]||"#666",we=V[G.service],ve=we?.status==="connected",ke=D===G.service;return d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-2 py-2",style:{borderBottom:ke?"none":`1px solid ${e.isDark?"#1a1a1e":"#eee"}`},children:[d.jsxs("div",{style:{position:"relative",flexShrink:0},children:[d.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:be}}),d.jsx("div",{style:{position:"absolute",top:-2,right:-2,width:4,height:4,borderRadius:"50%",background:ve?"#00ff88":we?.hasApiKey?"#ffaa00":"#666"}})]}),d.jsx("span",{className:"flex-1 truncate text-[14px]",style:{color:e.textPrimary},children:G.name}),d.jsx("span",{className:"text-[12px] px-1.5 py-0.5 rounded-full uppercase",style:{fontFamily:"'Geist Mono', monospace",color:G.direction==="both"?"#b88ad4":"#6aafe6",background:G.direction==="both"?"#9b59b610":"#3498db10"},children:G.direction}),d.jsx("button",{type:"button","aria-label":`Configure ${G.name} credentials`,onClick:()=>H(ke?null:G.service),className:"border-none bg-transparent cursor-pointer p-2.5 rounded min-w-[44px] min-h-[44px] flex items-center justify-center",style:{color:ve?"#00ff88":e.textDim},children:d.jsx(dD,{size:10})}),d.jsx("button",{type:"button","aria-label":`Remove ${G.name}`,onClick:()=>m(G.id),className:"border-none bg-transparent cursor-pointer p-2.5 rounded min-w-[44px] min-h-[44px] flex items-center justify-center hover:bg-[#ff000010]",style:{color:e.textFaint},children:d.jsx($t,{size:10})})]}),ke&&d.jsxs("div",{className:"flex items-center gap-2 pb-2 pl-4",style:{borderBottom:`1px solid ${e.isDark?"#1a1a1e":"#eee"}`},children:[d.jsx("span",{className:"text-[13px]",style:{color:e.textDim},children:ve?"✓ Connected":"Authentication required"}),d.jsx("button",{type:"button",onClick:()=>ie.getState().setShowSettings(!0),className:"text-[13px] px-2 py-1 rounded cursor-pointer border-none",style:{background:"#FE500012",color:"#FE5000"},children:"Open Settings"})]})]},G.id)})]}),d.jsxs("div",{className:"flex gap-2 mt-3",children:[d.jsxs("button",{type:"button",onClick:()=>l(!0),className:"flex items-center justify-center gap-1.5 flex-1 px-2.5 py-2 rounded text-[12px] tracking-wide uppercase cursor-pointer",style:{background:"transparent",border:`1px solid ${e.border}`,color:e.textDim,fontFamily:"'Geist Mono', monospace",transition:"border-color 150ms, color 150ms"},onMouseEnter:G=>{G.currentTarget.style.borderColor="#FE5000",G.currentTarget.style.color="#FE5000"},onMouseLeave:G=>{G.currentTarget.style.borderColor=e.border,G.currentTarget.style.color=e.textDim},onFocus:G=>{G.currentTarget.style.borderColor="#FE5000",G.currentTarget.style.color="#FE5000"},onBlur:G=>{G.currentTarget.style.borderColor=e.border,G.currentTarget.style.color=e.textDim},children:[d.jsx(Ft,{size:10})," Files"]}),d.jsxs("button",{type:"button","aria-label":"Add connection",onClick:()=>u(!0),className:"flex items-center justify-center gap-1.5 flex-1 px-2.5 py-2.5 rounded text-[12px] tracking-wide uppercase cursor-pointer min-h-[44px] motion-reduce:transition-none",style:{background:"transparent",border:`1px solid ${e.border}`,color:e.textDim,fontFamily:"'Geist Mono', monospace",transition:"border-color 150ms, color 150ms"},onMouseEnter:G=>{G.currentTarget.style.borderColor="#9b59b6",G.currentTarget.style.color="#9b59b6"},onMouseLeave:G=>{G.currentTarget.style.borderColor=e.border,G.currentTarget.style.color=e.textDim},onFocus:G=>{G.currentTarget.style.borderColor="#9b59b6",G.currentTarget.style.color="#9b59b6"},onBlur:G=>{G.currentTarget.style.borderColor=e.border,G.currentTarget.style.color=e.textDim},children:[d.jsx(Ft,{size:10})," Connect"]}),d.jsxs("button",{type:"button","aria-label":"Index repository",onClick:()=>T(!R),className:"flex items-center justify-center gap-1.5 flex-1 px-2.5 py-2.5 rounded text-[12px] tracking-wide uppercase cursor-pointer min-h-[44px] motion-reduce:transition-none",style:{background:R?"#24292F15":"transparent",border:`1px solid ${R?"#24292F":e.border}`,color:R?"#24292F":e.textDim,fontFamily:"'Geist Mono', monospace",transition:"border-color 150ms, color 150ms"},onMouseEnter:G=>{R||(G.currentTarget.style.borderColor="#24292F",G.currentTarget.style.color="#24292F")},onMouseLeave:G=>{R||(G.currentTarget.style.borderColor=e.border,G.currentTarget.style.color=e.textDim)},onFocus:G=>{R||(G.currentTarget.style.borderColor="#24292F",G.currentTarget.style.color="#24292F")},onBlur:G=>{R||(G.currentTarget.style.borderColor=e.border,G.currentTarget.style.color=e.textDim)},children:[d.jsx(P_,{size:10})," Repo"]})]}),R&&d.jsxs("div",{className:"mt-2 flex gap-1.5",children:[d.jsx("input",{type:"text",value:S,onChange:G=>N(G.target.value),placeholder:"/path/to/repo or https://github.com/org/repo","aria-label":"Repository path",className:"flex-1 px-2.5 py-1.5 rounded text-[13px] outline-none",style:{background:e.inputBg,border:`1px solid ${e.border}`,color:e.textPrimary,fontFamily:"'Geist Sans', sans-serif"},onKeyDown:G=>{G.key==="Enter"&&le()}}),d.jsx("button",{type:"button",onClick:le,disabled:C||!S.trim(),className:"px-3 py-1.5 rounded text-[12px] font-semibold tracking-wider uppercase cursor-pointer border-none",style:{background:"#24292F",color:"#fff",fontFamily:"'Geist Mono', monospace",opacity:C||!S.trim()?.5:1},"aria-label":"Index repository",children:C?d.jsx(Ot,{size:10,className:"animate-spin motion-reduce:animate-none"}):"Index"})]}),I.length>0&&d.jsxs("div",{className:"mt-3 px-2.5 py-2 rounded-lg",style:{border:"1px solid #24292F30",background:"#24292F08"},children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-[13px] tracking-[0.1em] uppercase",style:{fontFamily:"'Geist Mono', monospace",color:"#24292F"},children:"GitHub Context Compression"}),d.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"#00A86B"},children:["-",z.toFixed(1),"%"]})]}),d.jsxs("div",{className:"mt-1 text-[12px]",style:{color:e.textDim},children:["Raw ",W(F)," → Effective ",W(L)," tokens (",I.length," channels)"]})]}),t.length>0&&d.jsxs("div",{className:"mt-3",children:[d.jsx("div",{className:"text-[13px] tracking-[0.1em] uppercase mb-1.5",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:"Context allocation"}),d.jsx("div",{className:"flex gap-0.5 h-1 rounded overflow-hidden",children:Object.entries(Ar).map(([G,ce])=>{const be=t.filter(ve=>ve.enabled&&ve.knowledgeType===G).reduce((ve,ke)=>ve+A(ke),0);if(be===0)return null;const we=Q>0?be/Q*100:0;return d.jsx("div",{style:{width:`${we}%`,background:ce.color,borderRadius:2}},G)})}),d.jsx("div",{className:"flex justify-between mt-1",children:d.jsxs("span",{className:"text-[13px]",style:{fontFamily:"'Geist Mono', monospace",color:"#FE5000"},children:[W(Q)," used"]})})]})]})}function kR(){const e=Ee(),t=ie(C=>C.mcpServers),n=ie(C=>C.removeMcp),r=vt(C=>C.servers),i=V1(C=>C.mcpHealth),[s,l]=$.useState(!1),[u,f]=$.useState(!1),m=t.filter(C=>C.added),h=m.length,g=m.filter(C=>i[C.id]?.status==="error").length,b=(C,M)=>r.find(S=>S.id===C)??r.find(S=>S.name===M),y=(C,M)=>{const S=i[C];if(S){if(S.status==="healthy")return"ok";if(S.status==="degraded")return"warn";if(S.status==="error")return"err";if(S.status==="checking")return"warn"}const N=b(C,M);return N?N.status==="connected"?"ok":N.status==="error"?"err":N.status==="connecting"?"warn":"off":"off"},v=$.useCallback(async()=>{f(!0);const{setMcpHealth:C,setMcpChecking:M}=V1.getState();await Promise.allSettled(m.map(async S=>{const N=b(S.id,S.name);if(!N){C(S.id,{status:"error",latencyMs:0,toolCount:0,tools:[],errorMessage:`Not found: ${S.id}`,checkedAt:Date.now()});return}M(S.id);const R=performance.now();try{const T=await fetch(`${ze}/health/mcp/${N.id}`,{signal:AbortSignal.timeout(15e3)}),D=Math.round(performance.now()-R),H=await T.json(),V=H.data??H;C(S.id,{status:V.status??"error",latencyMs:D,toolCount:V.toolCount??V.tools?.length??0,tools:V.tools??[],errorMessage:V.errorMessage??V.error??null,checkedAt:Date.now()})}catch(T){C(S.id,{status:"error",latencyMs:Math.round(performance.now()-R),toolCount:0,tools:[],errorMessage:T instanceof Error?T.message:"Probe failed",checkedAt:Date.now()})}})),f(!1)},[m,r]),w={ok:{bg:"#00ff88",glow:"0 0 6px rgba(0,255,136,0.4)"},warn:{bg:"#ffaa00",glow:"0 0 6px rgba(255,170,0,0.4)"},err:{bg:"#ff3344",glow:"0 0 6px rgba(255,51,68,0.4)"},off:{bg:"#333",glow:"none"}},E=C=>C==null?{active:0,color:e.textFaint}:C<=10?{active:5,color:"#00ff88"}:C<=30?{active:4,color:"#7DFF5A"}:C<=80?{active:3,color:"#FFD84D"}:C<=200?{active:2,color:"#FF9F43"}:{active:1,color:"#FF4D4D"};return d.jsxs(Ml,{icon:El,label:"MCP Servers",color:"#2ecc71",badge:g>0?`${h} active · ${g} error`:`${h} active`,collapsed:s,onToggle:()=>l(!s),children:[h>0&&d.jsx("div",{className:"flex justify-end mb-2",children:d.jsx(tg,{loading:u,onClick:v,label:"Check Health"})}),d.jsx("div",{className:"flex flex-col",children:m.map(C=>{const M=y(C.id,C.name),S=w[M],N=b(C.id,C.name),R=i[C.id],T=R?.toolCount??N?.tools?.length??0;return d.jsxs("div",{style:{borderBottom:`1px solid ${e.isDark?"#1a1a1e":"#eee"}`},children:[d.jsxs("div",{className:"flex items-center gap-2.5 py-2.5",children:[d.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:S.bg,boxShadow:S.glow,flexShrink:0}}),d.jsx("span",{className:"flex-1 text-[14px]",style:{color:e.textPrimary},children:C.name}),C.type&&d.jsx("span",{className:"text-[12px] px-1.5 py-0.5 rounded",style:{fontFamily:"'Geist Mono', monospace",background:e.badgeBg,color:e.textDim},children:C.type}),T>0&&d.jsxs("span",{className:"text-[12px]",style:{color:e.textDim},children:[T," tools"]}),d.jsx("button",{type:"button","aria-label":`Remove ${C.name}`,onClick:()=>n(C.id),className:"border-none bg-transparent cursor-pointer p-2 rounded hover:bg-[#ff000010] min-w-[44px] min-h-[44px] flex items-center justify-center",style:{color:e.textFaint},children:d.jsx($t,{size:10})})]}),R&&R.status!=="unknown"&&d.jsxs("div",{className:"flex items-center gap-2 pb-1.5 pl-5 text-[13px]",style:{fontFamily:"'Geist Mono', monospace"},children:[R.latencyMs!=null&&d.jsxs("span",{className:"flex items-end gap-[2px]",title:`${R.latencyMs}ms`,children:[Array.from({length:5}).map((D,H)=>{const V=E(R.latencyMs);return d.jsx("span",{style:{width:3,height:4+H*2,borderRadius:1,background:H<V.active?V.color:e.borderSubtle,opacity:H<V.active?1:.5}},`lat-${C.id}-${H}`)}),d.jsxs("span",{style:{color:e.textFaint,marginLeft:4},children:[R.latencyMs,"ms"]})]}),R.tools&&R.tools.length>0&&d.jsxs("span",{className:"truncate",style:{color:e.textFaint,maxWidth:180},title:R.tools.join(", "),children:[R.tools.slice(0,3).join(", "),R.tools.length>3?` +${R.tools.length-3}`:""]}),R.errorMessage&&d.jsx("span",{style:{color:"#e74c3c"},children:R.errorMessage})]})]},C.id)})})]})}function vR(){const e=Ee(),t=ie(f=>f.skills),n=ie(f=>f.removeSkill),r=ie(f=>f.setShowSkillPicker),[i,s]=$.useState(!1),l=t.filter(f=>f.added),u=l.length;return d.jsxs(Ml,{icon:Bn,label:"Skills",color:"#f1c40f",badge:`${u} active`,collapsed:i,onToggle:()=>s(!i),children:[l.length===0&&d.jsx("div",{className:"text-[12px] py-2",style:{color:e.textFaint},children:"No skills selected for this agent."}),d.jsx("div",{className:"flex flex-col",children:l.map(f=>d.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:`1px solid ${e.isDark?"#1a1a1e":"#eee"}`},children:[d.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:"#00ff88",boxShadow:"0 0 6px rgba(0,255,136,0.4)",flexShrink:0}}),d.jsx("span",{className:"flex-1 text-[13px] truncate",style:{color:e.textPrimary},children:f.name}),d.jsx(wd,{skillPath:f.id}),d.jsx("button",{type:"button","aria-label":`Remove ${f.name}`,onClick:()=>n(f.id),className:"border-none bg-transparent cursor-pointer rounded shrink-0 flex items-center justify-center",style:{color:e.textFaint,width:20,height:20,padding:0},children:d.jsx($t,{size:9})})]},f.id))}),d.jsxs("button",{type:"button","aria-label":"Open Skill Library",onClick:()=>r(!0),className:"flex items-center justify-center gap-1.5 w-full mt-3 px-3 py-2.5 rounded text-[13px] tracking-wide uppercase cursor-pointer min-h-[44px] motion-reduce:transition-none",style:{background:"transparent",border:`1px solid ${e.border}`,color:e.textDim,fontFamily:"'Geist Mono', monospace",transition:"border-color 150ms, color 150ms"},onMouseEnter:f=>{f.currentTarget.style.borderColor="#FE5000",f.currentTarget.style.color="#FE5000"},onMouseLeave:f=>{f.currentTarget.style.borderColor=e.border,f.currentTarget.style.color=e.textDim},onFocus:f=>{f.currentTarget.style.borderColor="#FE5000",f.currentTarget.style.color="#FE5000"},onBlur:f=>{f.currentTarget.style.borderColor=e.border,f.currentTarget.style.color=e.textDim},children:[d.jsx(gD,{size:11})," Skill Library"]})]})}const wR=[{value:"full",label:"Full History"},{value:"sliding_window",label:"Sliding Window"},{value:"summarize_and_recent",label:"Summarize + Recent"},{value:"rag",label:"RAG over History"}],SR=[{value:"local_sqlite",label:"SQLite (local)"},{value:"postgres",label:"PostgreSQL"},{value:"redis",label:"Redis"},{value:"chromadb",label:"ChromaDB"},{value:"pinecone",label:"Pinecone"},{value:"custom",label:"Custom"}],CR=[{value:"text-embedding-3-small",label:"Ada 3 Small"},{value:"text-embedding-3-large",label:"Ada 3 Large"},{value:"voyage-3",label:"Voyage 3"},{value:"custom",label:"Custom"}],ER=[{value:"top_k",label:"Top-K"},{value:"threshold",label:"Threshold"},{value:"hybrid",label:"Hybrid"}],MR=[{value:"auto_extract",label:"Auto Extract"},{value:"explicit",label:"Explicit Only"},{value:"both",label:"Both"}],TR=[{value:"per_user",label:"Per User"},{value:"per_agent",label:"Per Agent"},{value:"global",label:"Global"}],jR=[{value:"user_preferences",label:"Preferences",color:"#3498db"},{value:"decisions",label:"Decisions",color:"#e67e22"},{value:"facts",label:"Facts",color:"#2ecc71"},{value:"feedback",label:"Feedback",color:"#9b59b6"},{value:"entities",label:"Entities",color:"#f1c40f"}],AR=[{value:"reset_each_run",label:"Reset Each Run"},{value:"persistent_sandbox",label:"Persistent Sandbox"},{value:"clone_from_shared",label:"Clone from Shared"}],mu={shared:"#2ecc71",agent_private:"#3498db",run_scratchpad:"#e67e22"},xm={preference:"#3498db",decision:"#e67e22",fact:"#2ecc71",entity:"#f1c40f",custom:"#999"};function ta({children:e}){const t=Ee();return d.jsx("div",{className:"text-[13px] uppercase tracking-[0.12em] font-semibold mt-2 mb-1",style:{fontFamily:"'Geist Mono', monospace",color:t.textDim},children:e})}function Mr({label:e,value:t,min:n,max:r,step:i,onChange:s,suffix:l}){const u=Ee(),f=l==="K"?`${(t/1e3).toFixed(0)}K`:`${t}`;return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-[13px] uppercase tracking-wider shrink-0",style:{fontFamily:"'Geist Mono', monospace",color:u.textDim,width:90},children:e}),d.jsx("input",{type:"range",min:n,max:r,step:i,value:t,onChange:m=>s(Number(m.target.value)),"aria-label":e,className:"flex-1",style:{accentColor:"#FE5000"}}),d.jsx("span",{className:"text-[12px] w-10 text-right",style:{fontFamily:"'Geist Mono', monospace",color:u.textSecondary},children:f})]})}function NR(){const e=Ee(),t=rt(_=>_.session),n=rt(_=>_.longTerm),r=rt(_=>_.working),i=rt(_=>_.facts),s=rt(_=>_.setSessionConfig),l=rt(_=>_.setLongTermConfig),u=rt(_=>_.setRecallConfig),f=rt(_=>_.setWriteConfig),m=rt(_=>_.toggleExtractType),h=rt(_=>_.setWorkingConfig),g=rt(_=>_.addFact),b=rt(_=>_.removeFact),y=rt(_=>_.sandbox),v=rt(_=>_.setSandboxConfig),w=rt(_=>_.setSandboxDomain),[E,C]=$.useState(!1),[M,S]=$.useState(""),[N,R]=$.useState("shared"),[T,D]=$.useState(!1),[H,V]=$.useState(!1),B=$.useCallback(async()=>{D(!0);try{const _=await aS();s({maxMessages:_.maxMessages,summarizeAfter:_.summarizeAfter,summarizeEnabled:_.summarizeEnabled});for(const A of _.suggestedFacts||[])g(A,["generated"])}catch{}D(!1)},[s,g]),O=t.tokenBudget+n.tokenBudget+r.tokenBudget,Y=_=>_>=1e3?`${(_/1e3).toFixed(0)}K`:`${_}`,Z=[];n.enabled&&Z.push("long-term"),r.enabled&&Z.push("scratchpad");const U=i.length>0?`${i.length} facts${Z.length?" · "+Z.join(" · "):""}`:Z.length?Z.join(" · "):"session only";return d.jsxs(Ml,{icon:vl,label:"Memory",color:"#e74c3c",badge:U,collapsed:E,onToggle:()=>C(!E),children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsx(ta,{children:"Conversation Window"}),d.jsx(tg,{loading:T,onClick:B,label:"Configure"})]}),d.jsx(Mr,{label:"Messages",value:t.windowSize,min:5,max:100,step:5,onChange:_=>s({windowSize:_})}),d.jsx("div",{className:"mt-1.5",children:d.jsx(Fs,{checked:t.summarizeEnabled,onChange:_=>s({summarizeEnabled:_}),label:"Summarize older messages",size:"sm"})}),d.jsx(ta,{children:"Seed Facts"}),d.jsxs("div",{className:"flex flex-col gap-1 mb-2",children:[i.map(_=>{const A=mu[_.domain]||"#999";return d.jsxs("div",{className:"flex items-center gap-1.5 text-[13px] py-1 px-2 rounded",style:{background:e.surfaceElevated,color:e.textSecondary},children:[d.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:xm[_.type]||"#999",flexShrink:0}}),d.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"'Geist Sans', sans-serif"},children:_.content}),d.jsx("span",{className:"text-[12px] px-1 py-0.5 rounded",style:{background:`${A}15`,color:A,fontFamily:"'Geist Mono', monospace",border:`1px solid ${A}30`},children:_.domain.replace("_"," ")}),_.tags.length>0&&_.tags.map(q=>d.jsx("span",{className:"text-[12px] px-1 py-0.5 rounded",style:{background:`${xm[_.type]||"#999"}15`,color:xm[_.type]||"#999",fontFamily:"'Geist Mono', monospace"},children:q},q)),d.jsx("button",{type:"button","aria-label":"Remove fact",onClick:()=>b(_.id),className:"border-none bg-transparent cursor-pointer p-2 rounded shrink-0 hover:bg-[#ff000010] min-w-[44px] min-h-[44px] flex items-center justify-center",style:{color:e.textFaint},children:d.jsx($t,{size:9})})]},_.id)}),i.length===0&&d.jsx("div",{className:"text-[12px] py-2 text-center",style:{color:e.textFaint},children:"Pre-load facts the agent should always know"})]}),d.jsxs("div",{className:"flex gap-1",children:[d.jsx(Hs,{value:M,onChange:_=>S(_.target.value),onKeyDown:_=>{_.key==="Enter"&&M.trim()&&(g(M.trim(),[],"fact",N),S(""))},placeholder:"Add a seed fact..."}),d.jsxs("select",{value:N,onChange:_=>R(_.target.value),"aria-label":"Fact domain",className:"text-[13px] px-1 rounded border-none cursor-pointer",style:{background:e.surfaceElevated,color:e.textDim,fontFamily:"'Geist Mono', monospace",width:70},children:[d.jsx("option",{value:"shared",children:"shared"}),d.jsx("option",{value:"agent_private",children:"private"}),d.jsx("option",{value:"run_scratchpad",children:"scratch"})]}),d.jsx("button",{type:"button","aria-label":"Add fact",onClick:()=>{M.trim()&&(g(M.trim(),[],"fact",N),S(""))},className:"px-2 border-none rounded cursor-pointer shrink-0 min-w-[44px] min-h-[44px] flex items-center justify-center",style:{background:e.surfaceElevated,color:e.textDim},children:d.jsx(Ft,{size:12})})]}),d.jsxs("button",{type:"button","aria-expanded":H,onClick:()=>V(!H),className:"flex items-center gap-1 mt-3 text-[13px] tracking-wider uppercase cursor-pointer border-none bg-transparent w-full min-h-[44px] motion-reduce:transition-none",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim,padding:"0 8px",transition:"color 150ms"},onMouseEnter:_=>{_.currentTarget.style.color="#FE5000"},onMouseLeave:_=>{_.currentTarget.style.color=e.textDim},onFocus:_=>{_.currentTarget.style.color="#FE5000"},onBlur:_=>{_.currentTarget.style.color=e.textDim},children:[H?d.jsx(Pn,{size:10}):d.jsx(Go,{size:10}),"Advanced memory config"]}),H&&d.jsxs("div",{className:"mt-2 pt-2 flex flex-col gap-1.5",style:{borderTop:`1px solid ${e.isDark?"#1e1e22":"#e8e8ec"}`},children:[d.jsx(ta,{children:"Sandbox Isolation"}),d.jsx(co,{options:AR,value:y.isolation,onChange:_=>v({isolation:_}),size:"sm"}),d.jsx("div",{className:"flex flex-col gap-1 mt-1",children:d.jsx(Fs,{checked:y.allowPromoteToShared,onChange:_=>v({allowPromoteToShared:_}),label:"Allow promote to shared",size:"sm"})}),d.jsx(ta,{children:"Memory Domains"}),d.jsx("div",{className:"flex flex-wrap gap-1",children:[{key:"shared",label:"Shared",color:mu.shared},{key:"agentPrivate",label:"Agent Private",color:mu.agent_private},{key:"runScratchpad",label:"Run Scratchpad",color:mu.run_scratchpad}].map(_=>{const A=y.domains[_.key].enabled;return d.jsx("button",{type:"button","aria-label":`Toggle ${_.label}`,"aria-pressed":A,onClick:()=>w(_.key,!A),className:"text-[13px] px-3 py-2 rounded-full cursor-pointer border-none min-h-[44px]",style:{fontFamily:"'Geist Mono', monospace",background:A?`${_.color}20`:e.isDark?"#1c1c20":"#f0f0f5",color:A?_.color:e.textDim,border:`1px solid ${A?`${_.color}40`:"transparent"}`},children:_.label},_.key)})}),d.jsx(ta,{children:"Session Strategy"}),d.jsx(co,{options:wR,value:t.strategy,onChange:_=>s({strategy:_}),size:"sm"}),t.strategy==="summarize_and_recent"&&d.jsx(Mr,{label:"Summarize at",value:t.summarizeAfter,min:5,max:t.windowSize,step:5,onChange:_=>s({summarizeAfter:_})}),d.jsx(Mr,{label:"Token budget",value:t.tokenBudget,min:1e3,max:6e4,step:1e3,onChange:_=>s({tokenBudget:_}),suffix:"K"}),d.jsx(ta,{children:"Long-Term Memory"}),d.jsx(Fs,{checked:n.enabled,onChange:_=>l({enabled:_}),label:"Enabled",size:"sm"}),n.enabled&&d.jsxs("div",{className:"flex flex-col gap-2 mt-1",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsx("div",{className:"flex-1",children:d.jsx(co,{options:SR,value:n.store,onChange:_=>l({store:_}),size:"sm",label:"Store"})}),d.jsx("div",{className:"flex-1",children:d.jsx(co,{options:TR,value:n.scope,onChange:_=>l({scope:_}),size:"sm",label:"Scope"})})]}),d.jsx(co,{options:CR,value:n.embeddingModel,onChange:_=>l({embeddingModel:_}),size:"sm",label:"Embedding Model"}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("div",{className:"flex-1",children:d.jsx(co,{options:ER,value:n.recall.strategy,onChange:_=>u({strategy:_}),size:"sm",label:"Recall"})}),d.jsx("div",{className:"flex-1",children:d.jsx(Mr,{label:"K",value:n.recall.k,min:1,max:20,step:1,onChange:_=>u({k:_})})})]}),d.jsx(Mr,{label:"Min score",value:Math.round(n.recall.minScore*100),min:0,max:100,step:5,onChange:_=>u({minScore:_/100})}),d.jsx(co,{options:MR,value:n.write.mode,onChange:_=>f({mode:_}),size:"sm",label:"Write Mode"}),d.jsx("div",{className:"flex flex-wrap gap-1",children:jR.map(_=>{const A=n.write.extractTypes.includes(_.value);return d.jsx("button",{type:"button","aria-label":`Toggle ${_.label}`,"aria-pressed":n.write.extractTypes.includes(_.value),onClick:()=>m(_.value),className:"text-[13px] px-3 py-2 rounded-full cursor-pointer border-none min-h-[44px]",style:{fontFamily:"'Geist Mono', monospace",background:A?`${_.color}20`:e.isDark?"#1c1c20":"#f0f0f5",color:A?_.color:e.textDim,border:`1px solid ${A?`${_.color}40`:"transparent"}`},children:_.label},_.value)})}),d.jsx(Mr,{label:"Max entries",value:n.maxEntries,min:100,max:1e4,step:100,onChange:_=>l({maxEntries:_})}),d.jsx(Mr,{label:"Token budget",value:n.tokenBudget,min:1e3,max:3e4,step:1e3,onChange:_=>l({tokenBudget:_}),suffix:"K"})]}),d.jsx(ta,{children:"Working Memory"}),d.jsx(Fs,{checked:r.enabled,onChange:_=>h({enabled:_}),label:"Scratchpad",size:"sm"}),r.enabled&&d.jsx(Mr,{label:"Max tokens",value:r.maxTokens,min:500,max:8e3,step:500,onChange:_=>h({maxTokens:_})})]}),(n.enabled||r.enabled)&&O>0&&d.jsxs("div",{className:"mt-3",children:[d.jsx("div",{className:"text-[13px] tracking-[0.1em] uppercase mb-1.5",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:"Memory budget"}),d.jsxs("div",{className:"flex gap-0.5 h-1.5 rounded overflow-hidden",children:[d.jsx("div",{style:{width:`${t.tokenBudget/O*100}%`,background:"#3498db",borderRadius:2},title:`Session: ${Y(t.tokenBudget)}`}),n.enabled&&d.jsx("div",{style:{width:`${n.tokenBudget/O*100}%`,background:"#2ecc71",borderRadius:2},title:`Long-term: ${Y(n.tokenBudget)}`}),r.enabled&&d.jsx("div",{style:{width:`${r.tokenBudget/O*100}%`,background:"#f1c40f",borderRadius:2},title:`Working: ${Y(r.tokenBudget)}`})]}),d.jsxs("div",{className:"flex justify-between mt-1",children:[d.jsx("div",{className:"flex gap-2",children:[{label:"Session",color:"#3498db",tokens:t.tokenBudget},...n.enabled?[{label:"Long-term",color:"#2ecc71",tokens:n.tokenBudget}]:[],...r.enabled?[{label:"Working",color:"#f1c40f",tokens:r.tokenBudget}]:[]].map(_=>d.jsxs("span",{className:"flex items-center gap-1 text-[12px]",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:[d.jsx("div",{style:{width:4,height:4,borderRadius:1,background:_.color}}),_.label]},_.label))}),d.jsx("span",{className:"text-[13px]",style:{fontFamily:"'Geist Mono', monospace",color:"#FE5000"},children:Y(O)})]})]})]})}const _R={instruction:{icon:kl,color:"#9b59b6",label:"Instruction",verb:"Add to persona"},constraint:{icon:$w,color:"#2ecc71",label:"Constraint",verb:"Add constraint"},workflow:{icon:Bn,color:"#e67e22",label:"Workflow",verb:"Add step"},knowledge:{icon:Sl,color:"#3498db",label:"Knowledge",verb:"Add source"},mcp:{icon:El,color:"#2ecc71",label:"MCP Server",verb:"Add server"},skill:{icon:Bn,color:"#f1c40f",label:"Skill",verb:"Add skill"}};function DR(){const e=Ee(),t=rt(T=>T.facts),n=rt(T=>T.removeFact),r=ie(T=>T.updateInstruction),i=ie(T=>T.instructionState),s=ie(T=>T.addWorkflowStep),l=ie(T=>T.addChannel),u=ua(T=>T.checkpoint),[f,m]=$.useState(t.length===0),[h,g]=$.useState(!1),[b,y]=$.useState(null),[v,w]=$.useState(new Set),[E,C]=$.useState(""),M=$.useCallback(async()=>{if(t.length!==0){g(!0),C(""),w(new Set);try{const T=await fR(t);y(T),f&&m(!1)}catch(T){C(T instanceof Error?T.message:"Analysis failed")}g(!1)}},[t,f]),S=$.useCallback(T=>{const D=T.payload;switch(T.target){case"instruction":if(D.instructionAppend){const H=i.persona;r({persona:H?`${H}
|
|
327
|
+
|
|
328
|
+
${D.instructionAppend}`:D.instructionAppend})}break;case"constraint":if(D.constraintText){const H=i.constraints.customConstraints;r({constraints:{...i.constraints,customConstraints:H?`${H}
|
|
329
|
+
${D.constraintText}`:D.constraintText}})}break;case"workflow":D.workflowStep&&s({label:D.workflowStep.label,action:D.workflowStep.action,tool:"",condition:"always",conditionText:""});break;case"knowledge":D.knowledgeSource&&l({sourceId:`promoted-${crypto.randomUUID().slice(0,8)}`,name:D.knowledgeSource.name,path:"",category:"file",knowledgeType:D.knowledgeSource.type,depth:0,baseTokens:500});break}w(H=>new Set([...H,T.factId])),n(T.factId)},[i,r,s,l,n]),N=$.useCallback(()=>{if(b){for(const T of b.promotions)v.has(T.factId)||S(T);u("Facts promoted to agent design")}},[b,v,S,u]);if(t.length===0&&!b)return null;const R=b?b.promotions.filter(T=>!v.has(T.factId)).length:0;return d.jsxs(Ml,{icon:Gu,label:"Insights",color:"#FE5000",badge:b?`${R} suggestion${R!==1?"s":""}`:`${t.length} facts to analyze`,collapsed:f,onToggle:()=>m(!f),children:[!b&&d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:e.textDim},children:"Analyze your accumulated facts and discover which ones should become permanent parts of your agent — instructions, constraints, workflow steps, or knowledge sources."}),d.jsxs("button",{type:"button",onClick:M,disabled:h||t.length===0,className:"flex items-center justify-center gap-1.5 w-full px-3 py-2.5 rounded text-[13px] tracking-wide uppercase cursor-pointer border-none",style:{background:h?"#CC4000":"#FE5000",color:"#fff",fontFamily:"'Geist Mono', monospace",opacity:h||t.length===0?.6:1},children:[h?d.jsx(Ot,{size:11,className:"animate-spin motion-reduce:animate-none"}):d.jsx(Gu,{size:11}),h?"Analyzing...":`Analyze ${t.length} fact${t.length!==1?"s":""}`]})]}),E&&d.jsx("div",{role:"alert",className:"text-[12px] px-2 py-1.5 rounded mt-1",style:{background:"#ff000012",color:"#ff4444",border:"1px solid #ff000020"},children:E}),b&&d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs("div",{className:"text-[12px] leading-relaxed px-2 py-1.5 rounded",style:{background:"#FE500008",color:e.textSecondary,border:"1px solid #FE500015"},children:[b.summary,b.versionImpact!=="none"&&d.jsxs("span",{className:"text-[12px] ml-1.5 px-1.5 py-0.5 rounded-full",style:{fontFamily:"'Geist Mono', monospace",background:b.versionImpact==="major"?"#e74c3c20":b.versionImpact==="minor"?"#f1c40f20":"#2ecc7120",color:b.versionImpact==="major"?"#e74c3c":b.versionImpact==="minor"?"#f1c40f":"#2ecc71"},children:[b.versionImpact," bump"]})]}),b.promotions.map(T=>{const D=_R[T.target],H=v.has(T.factId);if(!D)return null;const V=D.icon;return d.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:`1px solid ${H?"#2ecc7130":e.border}`,opacity:H?.5:1,transition:"opacity 300ms"},children:[d.jsxs("div",{className:"px-3 py-2 text-[13px]",style:{background:e.surfaceElevated,color:e.textSecondary},children:['"',T.factContent,'"']}),d.jsxs("div",{className:"px-3 py-2 flex items-start gap-2",style:{borderTop:`1px solid ${e.isDark?"#1e1e22":"#eee"}`},children:[d.jsx("div",{className:"mt-0.5",style:{width:16,height:16,borderRadius:4,background:`${D.color}15`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:d.jsx(V,{size:9,style:{color:D.color}})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[d.jsx("span",{className:"text-[12px] px-1.5 py-0.5 rounded-full",style:{fontFamily:"'Geist Mono', monospace",background:`${D.color}15`,color:D.color},children:D.label}),d.jsxs("span",{className:"text-[12px]",style:{fontFamily:"'Geist Mono', monospace",color:e.textFaint},children:[Math.round(T.confidence*100),"%"]})]}),d.jsx("div",{className:"text-[12px] leading-snug",style:{color:e.textPrimary},children:T.suggestion}),d.jsx("div",{className:"text-[13px] mt-0.5",style:{color:e.textDim},children:T.reason})]}),H?d.jsxs("div",{className:"flex items-center gap-1 text-[13px] px-2 py-1 shrink-0",style:{color:"#2ecc71"},children:[d.jsx(Wt,{size:9})," Applied"]}):d.jsxs("button",{type:"button","aria-label":D.verb,onClick:()=>S(T),className:"flex items-center gap-1 text-[13px] px-2 py-1 rounded cursor-pointer border-none shrink-0",style:{background:`${D.color}15`,color:D.color,fontFamily:"'Geist Mono', monospace"},children:[d.jsx(T1,{size:9}),D.verb]})]})]},T.factId)}),R>0&&d.jsxs("div",{className:"flex gap-2 mt-1",children:[d.jsxs("button",{type:"button",onClick:N,className:"flex items-center justify-center gap-1.5 flex-1 px-3 py-2 rounded text-[12px] tracking-wide uppercase cursor-pointer border-none",style:{background:"#FE5000",color:"#fff",fontFamily:"'Geist Mono', monospace"},children:[d.jsx(T1,{size:10})," Apply all (",R,")"]}),d.jsxs("button",{type:"button",onClick:()=>{y(null),w(new Set)},className:"flex items-center gap-1 px-3 py-2 rounded text-[12px] cursor-pointer",style:{background:"transparent",border:`1px solid ${e.border}`,color:e.textDim,fontFamily:"'Geist Mono', monospace"},children:[d.jsx(Gh,{size:9})," Re-analyze"]})]}),R===0&&b.promotions.length>0&&d.jsxs("div",{className:"flex items-center justify-center gap-1.5 py-2 text-[12px]",style:{color:"#2ecc71"},children:[d.jsx(Wt,{size:11})," All suggestions applied",d.jsx("button",{type:"button",onClick:()=>{y(null),w(new Set)},className:"ml-2 text-[13px] cursor-pointer border-none bg-transparent underline",style:{color:e.textDim},children:"Re-analyze"})]}),b.promotions.length===0&&d.jsx("div",{className:"text-[12px] text-center py-2",style:{color:e.textDim},children:"All facts are contextual — no promotions suggested"})]})]})}function zR(){const e=Ee(),{collectContextState:t,restoreContextState:n}=ie(),[r,i]=$.useState(""),[s,l]=$.useState(!1),[u,f]=$.useState(!1),[m,h]=$.useState([]);$.useEffect(()=>{const w=[];for(let E=0;E<localStorage.length;E++){const C=localStorage.key(E);C&&C.startsWith("modular-ctx-")&&w.push(C.replace("modular-ctx-",""))}h(w)},[]);const g=()=>{n({channels:[],mcpServers:[],skills:[],connectors:[]})},b=()=>{if(!r.trim())return;const w=t();localStorage.setItem(`modular-ctx-${r}`,JSON.stringify(w)),i(""),l(!1),h(E=>[...new Set([...E,r])])},y=w=>{const E=localStorage.getItem(`modular-ctx-${w}`);E&&n(JSON.parse(E)),f(!1)},v=()=>{window.confirm("Clear all context (channels, MCPs, skills, connectors)?")&&n({channels:[],mcpServers:[],skills:[],connectors:[]})};return d.jsxs("div",{className:"sticky top-0 z-10 px-5 py-2.5 border-b flex items-center gap-2",style:{background:e.surfaceElevated,borderColor:e.border},children:[d.jsx("span",{className:"text-[13px] uppercase tracking-wider font-semibold flex-shrink-0",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim,minWidth:55},children:"Context"}),d.jsx("button",{type:"button","aria-label":"Demo",onClick:g,className:"p-1.5 rounded border-none cursor-pointer transition-colors",style:{background:"transparent",color:e.textDim},onMouseEnter:w=>{w.currentTarget.style.color="#FE5000"},onMouseLeave:w=>{w.currentTarget.style.color=e.textDim},onFocus:w=>{w.currentTarget.style.color="#FE5000"},onBlur:w=>{w.currentTarget.style.color=e.textDim},children:d.jsx(gd,{size:10})}),d.jsx("button",{type:"button","aria-label":"Save",onClick:()=>l(!0),className:"p-1.5 rounded border-none cursor-pointer transition-colors",style:{background:"transparent",color:e.textDim},onMouseEnter:w=>{w.currentTarget.style.color="#FE5000"},onMouseLeave:w=>{w.currentTarget.style.color=e.textDim},onFocus:w=>{w.currentTarget.style.color="#FE5000"},onBlur:w=>{w.currentTarget.style.color=e.textDim},children:d.jsx(Kh,{size:10})}),d.jsxs("div",{className:"relative",children:[d.jsx("button",{type:"button","aria-label":"Load",onClick:()=>f(!u),className:"p-1.5 rounded border-none cursor-pointer transition-colors",style:{background:"transparent",color:e.textDim},onMouseEnter:w=>{w.currentTarget.style.color="#FE5000"},onMouseLeave:w=>{w.currentTarget.style.color=e.textDim},onFocus:w=>{w.currentTarget.style.color="#FE5000"},onBlur:w=>{w.currentTarget.style.color=e.textDim},children:d.jsx(Uh,{size:10})}),u&&m.length>0&&d.jsx("div",{className:"absolute top-full mt-1 left-0 rounded shadow-lg z-20 min-w-max",style:{background:e.surfaceElevated,border:`1px solid ${e.border}`},children:m.map(w=>d.jsx("button",{type:"button",onClick:()=>y(w),className:"block w-full text-left px-3 py-1.5 text-[12px] border-none cursor-pointer",style:{background:"transparent",color:e.textSecondary},onMouseEnter:E=>{E.currentTarget.style.background="#FE500010"},onFocus:E=>{E.currentTarget.style.background="#FE500010"},onBlur:E=>{E.currentTarget.style.background="transparent"},children:w},w))})]}),d.jsx("button",{type:"button","aria-label":"Clear",onClick:v,className:"p-1.5 rounded border-none cursor-pointer transition-colors",style:{background:"transparent",color:e.textDim},onMouseEnter:w=>{w.currentTarget.style.color="#ff4444"},onMouseLeave:w=>{w.currentTarget.style.color=e.textDim},onFocus:w=>{w.currentTarget.style.color="#ff4444"},onBlur:w=>{w.currentTarget.style.color=e.textDim},children:d.jsx(yd,{size:10})}),s&&d.jsxs("div",{className:"absolute top-12 left-5 rounded shadow-lg p-2 z-20 min-w-max",style:{background:e.surfaceElevated,border:`1px solid ${e.border}`},children:[d.jsx("input",{type:"text",value:r,onChange:w=>i(w.target.value),placeholder:"Context name...",autoFocus:!0,className:"px-2 py-1 rounded text-[12px] outline-none mb-1 block",style:{background:e.inputBg,border:`1px solid ${e.border}`,color:e.textPrimary},onKeyDown:w=>{w.key==="Enter"&&b()}}),d.jsxs("div",{className:"flex gap-1",children:[d.jsx("button",{type:"button",onClick:b,className:"flex-1 px-2 py-1 rounded text-[13px] font-semibold border-none cursor-pointer",style:{background:"#FE5000",color:"#fff"},children:"Save"}),d.jsx("button",{type:"button",onClick:()=>{i(""),l(!1)},className:"flex-1 px-2 py-1 rounded text-[13px] border-none cursor-pointer",style:{background:e.border,color:e.textDim},children:"Cancel"})]})]})]})}function RR(){const[e,t]=$.useState([]);return d.jsxs("div",{className:"flex flex-col",children:[d.jsx(zR,{}),d.jsx(yR,{onGapsChange:t}),d.jsx(xR,{gaps:e}),d.jsx(DR,{}),d.jsx(bR,{}),d.jsx(kR,{}),d.jsx(vR,{}),d.jsx(NR,{})]})}const bm="";let km=null;const $n=fn((e,t)=>({panelOpen:!1,panelHeight:40,activeTab:"chat",conversationId:null,conversations:[],messages:[],inputText:"",streaming:!1,lastPipelineStats:null,testCases:[],runningTests:!1,setPanelOpen:n=>e({panelOpen:n}),setPanelHeight:n=>e({panelHeight:Math.max(20,Math.min(80,n))}),setActiveTab:n=>e({activeTab:n}),setInputText:n=>e({inputText:n}),addMessage:n=>{const r=t(),i={...n,id:`msg-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,timestamp:Date.now()};let s=r.conversationId;!s&&r.messages.length===0&&(s=`conv-${Date.now()}-${Math.random().toString(36).slice(2,8)}`),e({messages:[...r.messages,i],conversationId:s}),km&&clearTimeout(km),km=setTimeout(()=>{t().saveToServer().catch(console.error)},1e3)},updateLastAssistant:n=>{const r=[...t().messages];for(let i=r.length-1;i>=0;i--)if(r[i].role==="assistant"){r[i]={...r[i],content:n};break}e({messages:r})},updateMessagePipelineStats:(n,r)=>{e({messages:t().messages.map(i=>i.id===n?{...i,pipelineStats:r}:i)})},clearMessages:()=>e({messages:[],lastPipelineStats:null}),setStreaming:n=>e({streaming:n}),setLastPipelineStats:n=>e({lastPipelineStats:n}),addTestCase:n=>e({testCases:[...t().testCases,{...n,id:`test-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}]}),updateTestCase:(n,r)=>e({testCases:t().testCases.map(i=>i.id===n?{...i,...r}:i)}),removeTestCase:n=>e({testCases:t().testCases.filter(r=>r.id!==n)}),setRunningTests:n=>e({runningTests:n}),saveCurrentAsTest:(n,r)=>{const s=[...t().messages].reverse().find(l=>l.role==="user");s&&t().addTestCase({name:n,input:s.content,expectedBehavior:r,passed:null})},saveToServer:async()=>{const n=t();if(!(!n.conversationId||n.messages.length===0))try{const r=n.messages[0]?.content?.slice(0,50)||"Untitled Conversation";await fetch(`${bm}/api/conversations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n.conversationId,title:r,messages:n.messages,lastModified:Date.now()})})}catch(r){console.error("Failed to save conversation:",r)}},listFromServer:async()=>{try{const n=await fetch(`${bm}/api/conversations`);if(n.ok){const r=await n.json();e({conversations:r})}}catch(n){console.error("Failed to list conversations:",n)}},loadFromServer:async n=>{try{const r=await fetch(`${bm}/api/conversations/${n}`);if(r.ok){const i=await r.json();e({conversationId:i.id,messages:i.messages||[],lastPipelineStats:null})}}catch(r){console.error("Failed to load conversation:",r)}}})),SS=[{id:"bot",icon:kl},{id:"brain",icon:vl},{id:"zap",icon:Bn},{id:"flame",icon:Hw},{id:"lightbulb",icon:Gu},{id:"target",icon:gd},{id:"rocket",icon:YD},{id:"shield",icon:Vh},{id:"microscope",icon:jD},{id:"chart",icon:Hh},{id:"palette",icon:Yw},{id:"file",icon:Cl},{id:"drama",icon:A_},{id:"star",icon:uz},{id:"gem",icon:G_},{id:"bird",icon:Y3},{id:"bug",icon:e_},{id:"cat",icon:n_},{id:"dog",icon:M_},{id:"heart",icon:oD}];function OR({avatarId:e,size:t=20}){const n=SS.find(r=>r.id===e)?.icon??kl;return d.jsx(n,{size:t})}function IR({open:e,onClose:t,onSave:n,onDelete:r,initial:i="",title:s}){const l=Ee(),[u,f]=$.useState(i),m=$.useRef(null);$.useEffect(()=>{f(i)},[i,e]),$.useEffect(()=>{e&&m.current&&m.current.focus()},[e]);const h=y=>{y.key==="Escape"&&t()},g=y=>{y.target===y.currentTarget&&t()},b=()=>{n(u),t()};return e?d.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},onClick:g,children:d.jsxs("div",{style:{background:l.surfaceOpaque,border:`1px solid ${l.border}`,borderRadius:"12px",width:480,maxHeight:"80vh",overflow:"auto",display:"flex",flexDirection:"column"},onClick:y=>y.stopPropagation(),onKeyDown:h,children:[d.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${l.border}`},children:[d.jsx("span",{style:{color:l.textPrimary,fontSize:17,fontWeight:600},children:s}),d.jsx("button",{type:"button",onClick:t,className:"border-none bg-transparent cursor-pointer p-1 rounded flex items-center justify-center min-w-[44px] min-h-[44px]",style:{color:l.textDim},"aria-label":"Close",children:d.jsx($t,{size:16})})]}),d.jsx("div",{className:"px-6 py-4 flex flex-col gap-3 flex-1",children:d.jsx(ia,{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:h,placeholder:"Enter text...",style:{minHeight:80}})}),d.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderTop:`1px solid ${l.border}`},children:[r?d.jsx("button",{type:"button",onClick:r,className:"text-[16px] px-4 py-2 rounded cursor-pointer border-none",style:{color:"#e74c3c",background:"transparent",border:"1px solid #e74c3c30"},children:"Delete"}):d.jsx("div",{}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{type:"button",onClick:t,className:"text-[16px] px-4 py-2 rounded cursor-pointer border-none",style:{color:l.textPrimary,background:"transparent",border:`1px solid ${l.border}`},children:"Cancel"}),d.jsx("button",{type:"button",onClick:b,className:"text-[16px] px-5 py-2 rounded cursor-pointer border-none",style:{background:"#FE5000",color:"white"},children:"Save"})]})]})]})}):null}function FR({open:e,onClose:t}){const n=Ee(),r=ie(E=>E.workflowSteps),i=ie(E=>E.addWorkflowStep),s=ie(E=>E.updateWorkflowStep),l=ie(E=>E.removeWorkflowStep),u=ie(E=>E.updateWorkflowSteps),f=E=>{E.key==="Escape"&&t()},m=E=>{E.target===E.currentTarget&&t()},h=()=>{i({label:"",action:"action",tool:"",condition:"always"})},[g,b]=$.useState(!1),[y,v]=$.useState(""),w=$.useCallback(async()=>{b(!0),v("");try{const E=r.filter(C=>C.label.trim()).map(C=>C.label.trim());if(E.length>0){const{refineWorkflowSteps:C}=await Ho(async()=>{const{refineWorkflowSteps:S}=await Promise.resolve().then(()=>$z);return{refineWorkflowSteps:S}},void 0),M=await C(E);M&&u(M)}else{const C=await Xh();C&&u(C)}}catch(E){v(E instanceof Error?E.message:"Generation failed")}b(!1)},[u,r]);return e?d.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},onClick:m,children:d.jsxs("div",{style:{background:n.surfaceOpaque,border:`1px solid ${n.border}`,borderRadius:"12px",width:640,maxHeight:"85vh",overflow:"auto",display:"flex",flexDirection:"column"},onClick:E=>E.stopPropagation(),onKeyDown:f,children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,paddingLeft:20,paddingRight:20,paddingTop:16,paddingBottom:16,borderBottom:`1px solid ${n.border}`},children:[d.jsx("div",{style:{width:4,height:18,borderRadius:2,background:"#e67e22",opacity:.8}}),d.jsx("span",{style:{color:n.textPrimary,fontSize:17,fontWeight:600,flex:1},children:"Workflow Editor"}),d.jsxs("span",{style:{color:n.textMuted,fontSize:13,fontFamily:"'Geist Mono', monospace"},children:[r.length," ",r.length===1?"step":"steps"]}),d.jsx("button",{type:"button",onClick:t,className:"border-none bg-transparent cursor-pointer p-1 rounded flex items-center justify-center min-w-[44px] min-h-[44px]",style:{color:n.textDim},"aria-label":"Close",children:d.jsx($t,{size:16})})]}),d.jsx("div",{style:{padding:24,flex:1,overflowY:"auto"},children:r.length===0?d.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:200},children:d.jsx("span",{style:{color:n.textMuted,fontSize:16},children:'No workflow steps yet. Click "Add Step" to begin.'})}):d.jsx("div",{style:{display:"flex",flexDirection:"column"},children:r.map((E,C)=>d.jsxs("div",{children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,paddingTop:12,paddingBottom:12},children:[d.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:"#e67e22",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:d.jsx("span",{style:{color:"white",fontSize:13,fontWeight:600,fontFamily:"'Geist Mono', monospace"},children:C+1})}),d.jsx("div",{style:{flex:1},children:d.jsx("input",{type:"text",value:E.label,onChange:M=>s(E.id,{label:M.target.value}),placeholder:"Step label",className:"w-full px-3 py-2 rounded-md outline-none nodrag",style:{background:n.inputBg,border:`1px solid ${n.border}`,color:n.textPrimary,fontFamily:"'Geist Sans', sans-serif",fontSize:14,lineHeight:1.5}})}),d.jsx("span",{style:{fontSize:13,fontFamily:"'Geist Mono', monospace",fontWeight:600,paddingLeft:8,paddingRight:8,paddingTop:3,paddingBottom:3,borderRadius:4,background:"#e67e2220",color:"#e67e22",textTransform:"uppercase",flexShrink:0},children:E.action||"action"}),d.jsx("button",{type:"button",onClick:()=>l(E.id),className:"border-none bg-transparent cursor-pointer p-1 flex items-center justify-center",style:{color:n.textDim,minWidth:32,minHeight:32},children:d.jsx($t,{size:12})})]}),C<r.length-1&&d.jsx("div",{style:{width:2,height:12,background:"#e67e2220",marginLeft:12}})]},E.id))})}),y&&d.jsx("div",{style:{padding:"0 24px 12px"},children:d.jsx("div",{className:"text-[13px] px-3 py-2 rounded",style:{background:"#ff000012",color:"#e74c3c",border:"1px solid #e74c3c20"},children:y})}),d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:20,paddingRight:20,paddingTop:16,paddingBottom:16,borderTop:`1px solid ${n.border}`},children:[d.jsxs("button",{type:"button",onClick:h,className:"flex items-center gap-1 text-[14px] px-3 py-2 rounded cursor-pointer border-none",style:{color:n.textPrimary,background:"transparent",border:`1px solid ${n.border}`},children:[d.jsx(Ft,{size:11}),"Add Step"]}),d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[d.jsxs("button",{type:"button",onClick:w,disabled:g,className:"flex items-center gap-1 text-[14px] px-3 py-2 rounded cursor-pointer border-none",style:{color:n.textPrimary,background:"transparent",border:`1px solid ${n.border}`,opacity:g?.6:1},children:[g?d.jsx(Ot,{size:11,style:{animation:"spin 1s linear infinite"}}):d.jsx(ga,{size:11}),"Generate"]}),d.jsxs("button",{type:"button",onClick:t,className:"flex items-center gap-1 text-[14px] px-5 py-2 rounded cursor-pointer border-none",style:{background:"#FE5000",color:"white"},children:[d.jsx(Wt,{size:11}),"Done"]})]})]})]})}):null}const $R=`You are an expert prompt engineer. Your job is to take a user's rough brain dump about an AI agent they want to build, and transform it into structured, high-quality agent instructions following Anthropic's prompting best practices.
|
|
330
|
+
|
|
331
|
+
Given the user's rough input, produce a JSON response with this exact structure:
|
|
332
|
+
{
|
|
333
|
+
"persona": "<2-4 sentence persona description. Be specific about expertise, domain, and communication style. Use 'You are...' framing>",
|
|
334
|
+
"tone": "<one of: formal, neutral, casual>",
|
|
335
|
+
"expertise": <1-5 number, where 1=beginner-friendly and 5=expert-level>,
|
|
336
|
+
"constraints": [
|
|
337
|
+
"<clear, actionable constraint in imperative voice>"
|
|
338
|
+
],
|
|
339
|
+
"scopeDefinition": "<one sentence: what the agent handles and what it does NOT handle>",
|
|
340
|
+
"objectives": {
|
|
341
|
+
"primary": "<one clear sentence describing the agent's primary goal>",
|
|
342
|
+
"successCriteria": ["<measurable criterion>"],
|
|
343
|
+
"failureModes": ["<specific failure to avoid>"]
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
Follow these rules:
|
|
348
|
+
1. Be specific — replace vague descriptions with concrete, actionable language
|
|
349
|
+
2. Use XML-tag-friendly language (the output will be assembled into a system prompt)
|
|
350
|
+
3. Infer reasonable constraints from the domain (e.g., a medical agent should cite sources)
|
|
351
|
+
4. Generate 2-4 success criteria and 2-3 failure modes based on the domain
|
|
352
|
+
5. Keep the persona concise but distinctive — give it a clear identity
|
|
353
|
+
6. If the input mentions tools, APIs, or specific capabilities, reference them in constraints
|
|
354
|
+
7. Think step by step about what makes an excellent agent for this use case before writing
|
|
355
|
+
|
|
356
|
+
Output ONLY the JSON object. No markdown fences, no explanation.`;async function LR(e,t){if(!t.trim())throw new Error("Nothing to refine");const n=dt.getState(),r=n.providers.find(h=>h.id===n.selectedProviderId);if(!r)throw new Error("No provider configured — add one in Settings");const i=typeof r.models?.[0]=="object"?r.models[0].id:r.models?.[0]||"claude-sonnet-4-20250514",s=$R,u=r.authMethod==="claude-agent-sdk"?await ed({prompt:t,model:i,systemPrompt:s,maxTurns:1}):await Ju({providerId:r.id,model:i,messages:[{role:"system",content:s},{role:"user",content:t}],temperature:.3,maxTokens:1024});try{return JSON.parse(u)}catch{}const f=u.match(/```(?:json)?\s*([\s\S]*?)```/);if(f)try{return JSON.parse(f[1].trim())}catch{}const m=u.match(/\{[\s\S]*\}/);if(m)try{return JSON.parse(m[0])}catch{}throw new Error("Could not parse agent structure from LLM response")}function vm(e){return e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}const CS=$.forwardRef(function({variant:t="secondary",size:n="md",icon:r,iconRight:i,loading:s,children:l,className:u="",style:f,disabled:m,...h},g){const b=Ee(),y={sm:28,md:32},v={sm:"0 8px",md:"0 14px"},w={sm:12,md:13},C={primary:{bg:"#FE5000",color:"#fff",border:"transparent",hoverBg:"#e54700"},secondary:{bg:b.surfaceElevated,color:b.textSecondary,border:b.border,hoverBg:b.isDark?"#2a2a30":"#eee"},ghost:{bg:"transparent",color:b.textSecondary,border:"transparent",hoverBg:b.isDark?"#ffffff08":"#00000008"},danger:{bg:b.statusErrorBg,color:b.statusError,border:"transparent",hoverBg:b.isDark?"#ff4d4f20":"#ff4d4f15"}}[t];return d.jsxs("button",{ref:g,type:"button",disabled:m||s,className:`ds-btn flex items-center justify-center gap-1.5 rounded-lg cursor-pointer border font-semibold tracking-wide uppercase nodrag ${u}`,style:{height:y[n],padding:v[n],fontSize:w[n],fontFamily:"'Geist Mono', monospace",background:C.bg,color:C.color,borderColor:C.border,opacity:m?.5:1,cursor:m?"not-allowed":"pointer",transition:"background 0.15s, opacity 0.15s",...f},onMouseEnter:M=>{m||(M.currentTarget.style.background=C.hoverBg)},onMouseLeave:M=>{M.currentTarget.style.background=C.bg},...h,children:[s?d.jsx("span",{className:"animate-spin text-[12px]",children:"⟳"}):r,l,i]})});function PR({variant:e="neutral",children:t,dot:n,size:r="sm"}){const i=Ee(),l={success:{bg:i.statusSuccessBg,fg:i.statusSuccess},warning:{bg:i.statusWarningBg,fg:i.statusWarning},error:{bg:i.statusErrorBg,fg:i.statusError},info:{bg:"#3498db15",fg:"#3498db"},neutral:{bg:i.badgeBg,fg:i.textSecondary}}[e],u=r==="sm"?8:9,f=r==="sm"?"1px 6px":"2px 8px";return d.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full font-semibold uppercase tracking-wider",style:{background:l.bg,color:l.fg,fontSize:u,padding:f,fontFamily:"'Geist Mono', monospace"},children:[n&&d.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:l.fg}}),t]})}function BR({open:e,onClose:t,title:n,children:r,footer:i,width:s=520}){const l=Ee(),u=$.useRef(null);return $.useEffect(()=>{if(!e)return;const f=m=>{m.key==="Escape"&&t()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,t]),$.useEffect(()=>{e&&u.current?.focus()},[e]),e?cd.createPortal(d.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center",onClick:t,children:[d.jsx("div",{className:"absolute inset-0",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"}}),d.jsxs("div",{ref:u,tabIndex:-1,onClick:f=>f.stopPropagation(),className:"relative flex flex-col rounded-xl overflow-hidden outline-none",style:{width:s,maxWidth:"90vw",maxHeight:"80vh",background:l.surfaceOpaque,border:`1px solid ${l.border}`,boxShadow:`0 16px 48px ${l.isDark?"rgba(0,0,0,0.6)":"rgba(0,0,0,0.15)"}`},children:[n&&d.jsxs("div",{className:"flex items-center justify-between px-4 py-3 shrink-0",style:{borderBottom:`1px solid ${l.borderSubtle}`},children:[d.jsx("span",{className:"text-[17px] font-bold",style:{fontFamily:"'Geist Mono', monospace",color:l.textPrimary},children:n}),d.jsx("button",{type:"button",onClick:t,className:"flex items-center justify-center w-7 h-7 rounded-md cursor-pointer border-none bg-transparent",style:{color:l.textDim},children:d.jsx($t,{size:14})})]}),d.jsx("div",{className:"flex-1 overflow-y-auto",children:r}),i&&d.jsx("div",{className:"flex items-center justify-end gap-2 px-4 py-3 shrink-0",style:{borderTop:`1px solid ${l.borderSubtle}`},children:i})]})]}),document.body):null}const HR=$.forwardRef(function({icon:t,size:n="md",variant:r="ghost",tooltip:i,active:s,className:l="",style:u,...f},m){const h=Ee(),g=n==="sm"?24:32,y={ghost:{bg:s?"#FE500020":"transparent",color:s?"#FE5000":h.textDim,hoverBg:h.isDark?"#ffffff10":"#00000008"},secondary:{bg:h.surfaceElevated,color:h.textSecondary,hoverBg:h.isDark?"#2a2a30":"#eee"},danger:{bg:"transparent",color:h.statusError,hoverBg:h.statusErrorBg}}[r];return d.jsx("button",{ref:m,type:"button",title:i,"aria-label":i,className:`ds-icon-btn flex items-center justify-center rounded-md cursor-pointer border-none nodrag ${l}`,style:{width:g,height:g,background:y.bg,color:y.color,transition:"background 0.15s",...u},onMouseEnter:v=>v.currentTarget.style.background=y.hoverBg,onMouseLeave:v=>v.currentTarget.style.background=y.bg,...f,children:t})});function UR({type:e}){const t={major:"#FE5000",minor:"#3498db",patch:"#888"};return d.jsx(p_,{size:6,fill:t[e],stroke:"none"})}function qR({v:e,isCurrent:t,onRestore:n,onDelete:r}){const i=Ee(),[s,l]=$.useState(!1);return d.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:`1px solid ${t?"#FE500040":i.borderSubtle}`,background:t?"#FE500008":"transparent"},children:[d.jsxs("button",{type:"button",onClick:()=>l(!s),className:"w-full min-h-[36px] flex items-center gap-2 px-3 py-2 cursor-pointer border-none bg-transparent text-left",children:[d.jsx(Go,{size:10,style:{color:i.textDim,transform:s?"rotate(90deg)":"none",transition:"transform 0.15s"}}),d.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[d.jsxs("span",{className:"text-[14px] font-bold shrink-0",style:{fontFamily:"'Geist Mono', monospace",color:t?"#FE5000":i.textPrimary},children:["v",e.version]}),d.jsx("span",{className:"text-[12px] truncate",style:{color:i.textMuted},children:e.label||"Checkpoint"})]}),t&&d.jsx(PR,{variant:"success",size:"sm",dot:!0,children:"CURRENT"}),d.jsx("span",{className:"text-[13px] shrink-0",style:{color:i.textFaint},children:new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),s&&d.jsxs("div",{className:"px-3 pb-2 flex flex-col gap-1.5",children:[e.changes.length===0&&d.jsx("div",{className:"text-[12px]",style:{color:i.textMuted},children:"No changelog entries recorded for this version."}),e.changes.map((u,f)=>d.jsxs("div",{className:"flex items-center gap-2 text-[12px]",style:{color:i.textSecondary},children:[d.jsx(UR,{type:u.type}),d.jsx("span",{className:"uppercase text-[12px] font-semibold w-14 shrink-0",style:{color:i.textDim},children:u.category}),d.jsx("span",{children:u.description})]},f)),d.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[!t&&d.jsx(CS,{variant:"secondary",size:"sm",icon:d.jsx(Gh,{size:10}),onClick:n,children:"Restore"}),d.jsx(HR,{icon:d.jsx(yd,{size:11}),variant:"danger",size:"sm",tooltip:"Delete version",onClick:r})]})]})]})}function GR(){const e=Ee(),{versions:t,currentVersion:n,dirty:r,checkpoint:i}=ua(),[s,l]=$.useState(!1);return d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",onClick:()=>l(!0),className:"flex items-center gap-1.5 px-2 h-8 rounded-lg cursor-pointer border-none",style:{background:r?"#FE500015":"transparent",color:r?"#FE5000":e.textDim,fontFamily:"'Geist Mono', monospace",fontSize:12,fontWeight:600,transition:"background 0.15s"},title:"Version history",children:[d.jsx(wi,{size:12}),"v",n,r&&d.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#FE5000] animate-pulse"})]}),d.jsx(BR,{open:s,onClose:()=>l(!1),title:"Version History",width:480,footer:d.jsx(CS,{variant:"primary",size:"sm",icon:d.jsx(Kh,{size:10}),onClick:()=>{i()},children:"Save Checkpoint"}),children:d.jsxs("div",{className:"flex flex-col gap-1.5 p-3 max-h-[60vh] overflow-y-auto overscroll-contain pr-1",children:[t.length===0&&d.jsxs("div",{className:"py-8 text-center",children:[d.jsx(wi,{size:20,style:{margin:"0 auto 8px",color:e.textFaint,opacity:.3}}),d.jsx("div",{className:"text-[12px]",style:{color:e.textFaint},children:"No versions yet"}),d.jsx("div",{className:"text-[12px] mt-1",style:{color:e.textMuted},children:"Make changes to your agent — versions are created automatically"})]}),[...t].reverse().map(u=>d.jsx(qR,{v:u,isCurrent:u.version===n,onRestore:()=>{ua.getState().restoreVersion(u.version),l(!1)},onDelete:()=>ua.getState().deleteVersion(u.id)},u.id))]})})]})}function KR({value:e,onChange:t,t:n}){return d.jsx("select",{value:e,onChange:r=>t(r.target.value),className:"appearance-none cursor-pointer outline-none text-[14px] h-8 pl-3 pr-7 rounded-lg",style:{fontFamily:"'Geist Sans', sans-serif",background:n.surfaceOpaque,border:`1px solid ${n.border}`,color:n.isDark?n.textSecondary:"#1a1a20",backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath d='M0 2l4 4 4-4' fill='none' stroke='%23${n.isDark?"555":"999"}' stroke-width='1.5'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 8px center"},children:Vk.map(r=>d.jsx("option",{value:r.id,children:r.label},r.id))})}function VR(){const e=Ee(),t=ie(_=>_.agentMeta),n=ie(_=>_.setAgentMeta),r=ie(_=>_.outputFormat),i=ie(_=>_.setOutputFormat),s=ie(_=>_.loadAgent),l=ie(_=>_.resetAgent),u=ie(_=>_.channels),f=ie(_=>_.selectedModel),m=ie(_=>_.outputFormats),h=ie(_=>_.prompt),g=ie(_=>_.tokenBudget),b=ie(_=>_.mcpServers),y=ie(_=>_.skills),[v,w]=$.useState([]),[E,C]=$.useState(!1),[M,S]=$.useState(!1),[N,R]=$.useState(""),[T,D]=$.useState(!1),[H,V]=$.useState(!1),B=$.useRef(null);$.useEffect(()=>()=>{B.current&&window.clearTimeout(B.current)},[]);const O=$.useCallback(async()=>{try{const _=await fetch(`${ze}/agents`);if(!_.ok)return;const A=await _.json();w(A.data??[])}catch{}},[]),Y=()=>{const _=ie.getState(),A=$n.getState(),q=rt.getState(),K=u.filter(z=>z.enabled).map(z=>({sourceId:z.sourceId,name:z.name,path:z.path,knowledgeType:z.knowledgeType,depth:z.depth,tokens:z.baseTokens,content:z.content})),Q=A.lastPipelineStats?.pipeline;Q&&(Q.context,Q.tokens,Q.utilization,Q.sources.map(z=>({name:z.name,type:z.type,totalTokens:z.totalTokens})),Q.compression.originalTokens,Q.compression.compressedTokens,Q.compression.ratio,Q.timing.totalMs);const I=q.facts.map(z=>({id:z.id,text:z.content,domain:z.domain})),F=F6({channels:u,selectedModel:f,outputFormat:r,outputFormats:m,prompt:h,tokenBudget:g,mcpServers:b,skills:y,agentMeta:t,agentConfig:_.agentConfig,connectors:_.connectors,instructionState:_.instructionState,workflowSteps:_.workflowSteps,knowledgeContent:K,facts:I.length>0?I:void 0}),L=F.match(/^name:\s*(.+)$/m)?.[1]?.trim()??"modular-agent";Sd(F,L)},Z=$.useCallback(()=>{V(!0),B.current&&window.clearTimeout(B.current),B.current=window.setTimeout(()=>{V(!1)},2e3)},[]),U=$.useCallback(async _=>{const A=(_??t.name).trim();if(!A){R(t.name),S(!0);return}A!==t.name&&n({name:A}),D(!0);try{const q=Qh(A),K=Jh();if(K.id=q,K.agentMeta={...K.agentMeta,name:A},!(await fetch(`${ze}/agents/${encodeURIComponent(q)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(K)})).ok)return;S(!1),Z()}catch{}finally{D(!1)}},[t.name,n,Z]);return d.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 shrink-0 border-b select-none",style:{position:"sticky",top:0,zIndex:10,background:e.surface,borderColor:e.border},children:[d.jsx("span",{className:"text-[14px] font-bold tracking-[0.12em] uppercase",style:{fontFamily:"'Geist Mono', monospace",color:e.textPrimary,minWidth:"100px"},children:t.name||"New Agent"}),d.jsx(GR,{}),d.jsx(KR,{value:r,onChange:_=>i(_),t:e}),d.jsx("div",{className:"flex-1"}),d.jsxs("button",{type:"button",onClick:()=>l(),className:"flex items-center justify-center gap-1.5 h-8 px-2.5 rounded-lg text-[14px] font-medium cursor-pointer border-none",style:{background:"#FE500012",color:"#FE5000",transition:"background 0.15s"},onMouseEnter:_=>{_.currentTarget.style.background="#FE500025"},onMouseLeave:_=>{_.currentTarget.style.background="#FE500012"},title:"Create new agent",children:[d.jsx(Ft,{size:13}),"New"]}),d.jsxs("div",{className:"relative",children:[d.jsxs("button",{type:"button",onClick:()=>{C(!E),E||O()},className:"flex items-center justify-center gap-1.5 h-8 px-2.5 rounded-lg text-[14px] font-medium cursor-pointer border-none",style:{background:"#FE500012",color:"#FE5000",transition:"background 0.15s"},onMouseEnter:_=>{_.currentTarget.style.background="#FE500025"},onMouseLeave:_=>{_.currentTarget.style.background="#FE500012"},title:"Load saved agent",children:[d.jsx(Uh,{size:13}),"Load"]}),E&&d.jsx("div",{className:"absolute top-full right-0 mt-1 z-50 min-w-[260px] max-h-[300px] overflow-y-auto rounded-lg shadow-lg",style:{background:e.surface,border:`1px solid ${e.border}`},children:v.length===0?d.jsx("div",{className:"px-3 py-4 text-[14px] text-center",style:{color:e.textDim},children:"No saved agents found"}):v.map(_=>d.jsxs("button",{type:"button",onClick:()=>{s(_.id),C(!1)},className:"w-full text-left px-3 py-2 border-none cursor-pointer block",style:{background:"transparent",color:e.textPrimary},onMouseEnter:A=>{A.currentTarget.style.background=e.surfaceHover},onMouseLeave:A=>{A.currentTarget.style.background="transparent"},children:[d.jsx("div",{className:"text-[14px] font-medium",children:_.agentMeta?.name||_.id}),_.agentMeta?.description&&d.jsx("div",{className:"text-[12px] mt-0.5",style:{color:e.textDim},children:_.agentMeta.description.length>80?_.agentMeta.description.slice(0,80)+"…":_.agentMeta.description})]},_.id))})]}),d.jsxs("button",{type:"button",onClick:()=>{U()},className:"flex items-center justify-center h-8 px-2.5 rounded-lg text-[14px] font-medium cursor-pointer border-none",style:{background:H?"#2ecc7115":"#FE500012",color:H?"#2ecc71":"#FE5000",transition:"background 0.15s",opacity:T?.6:1},onMouseEnter:_=>{H||(_.currentTarget.style.background="#FE500025")},onMouseLeave:_=>{H||(_.currentTarget.style.background="#FE500012")},title:H?"Agent saved":"Save agent",disabled:T,children:[H?d.jsx(Wt,{size:13}):d.jsx(Kh,{size:13}),"Save"]}),d.jsxs("label",{className:"cursor-pointer",children:[d.jsx("input",{type:"file",accept:".agent.yaml,.agent.yml,.yaml,.yml",style:{display:"none"},onChange:_=>{const A=_.target.files?.[0];if(A){const q=new FileReader;q.onload=()=>{try{console.log("Agent import functionality not implemented yet")}catch(K){console.error("Failed to import agent:",K)}},q.readAsText(A)}}}),d.jsxs("button",{type:"button",className:"flex items-center justify-center gap-1.5 h-8 px-2.5 rounded-lg text-[14px] font-medium cursor-pointer border-none",style:{background:"#FE500012",color:"#FE5000",transition:"background 0.15s"},onMouseEnter:_=>{_.currentTarget.style.background="#FE500025"},onMouseLeave:_=>{_.currentTarget.style.background="#FE500012"},title:"Import agent definition",children:[d.jsx(nS,{size:13}),"Import"]})]}),d.jsxs("button",{type:"button",onClick:Y,className:"flex items-center justify-center gap-1.5 h-8 px-2.5 rounded-lg text-[14px] font-medium cursor-pointer border-none",style:{background:"#FE500012",color:"#FE5000",transition:"background 0.15s"},onMouseEnter:_=>{_.currentTarget.style.background="#FE500025"},onMouseLeave:_=>{_.currentTarget.style.background="#FE500012"},title:"Export agent definition",children:[d.jsx(md,{size:13}),"Export"]}),M&&d.jsxs("div",{className:"flex items-center gap-1.5 h-8 px-2 rounded-lg",style:{background:e.surfaceOpaque,border:`1px solid ${e.border}`},children:[d.jsx("input",{type:"text",value:N,onChange:_=>R(_.target.value),onKeyDown:_=>{_.key==="Enter"&&U(N),_.key==="Escape"&&S(!1)},className:"w-44 h-6 px-2 text-[14px] rounded-md outline-none",style:{background:e.inputBg,border:`1px solid ${e.borderSubtle}`,color:e.textPrimary},placeholder:"Agent name required",autoFocus:!0}),d.jsx("button",{type:"button",onClick:()=>{U(N)},className:"flex items-center justify-center w-6 h-6 rounded-md border-none cursor-pointer",style:{background:"#FE5000",color:"#fff"},children:d.jsx(Wt,{size:12})}),d.jsx("button",{type:"button",onClick:()=>S(!1),className:"flex items-center justify-center w-6 h-6 rounded-md border-none cursor-pointer",style:{background:"transparent",color:e.textDim},children:d.jsx($t,{size:12})})]})]})}function js({label:e,color:t,collapsed:n,onToggle:r,right:i,t:s}){return d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"14px 20px",userSelect:"none",borderTop:`1px solid ${s.isDark?"#222226":"#e8e8ec"}`,background:`${t}08`},children:[d.jsxs("button",{type:"button",onClick:r,"aria-expanded":!n,style:{display:"flex",alignItems:"center",gap:10,flex:1,cursor:"pointer",border:"none",background:"transparent",padding:0,textAlign:"left"},children:[n?d.jsx(Go,{size:12,style:{color:s.textDim}}):d.jsx(Pn,{size:12,style:{color:s.textDim}}),d.jsx("div",{style:{width:3,height:14,borderRadius:2,background:t,opacity:.8}}),d.jsx("span",{style:{fontSize:12,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",fontFamily:"'Geist Mono', monospace",color:s.textPrimary},children:e})]}),i]})}function YR({loading:e,onClick:t}){return d.jsxs("button",{type:"button",onClick:n=>{n.stopPropagation(),t()},disabled:e,style:{display:"flex",alignItems:"center",gap:4,fontSize:13,padding:"4px 8px",borderRadius:4,cursor:"pointer",border:"none",background:"#FE500015",color:"#FE5000",fontFamily:"'Geist Mono', monospace"},children:[e?d.jsx(Ot,{size:9,style:{animation:"spin 1s linear infinite"}}):d.jsx(ga,{size:9}),"Generate"]})}function WR(){const e=Ee(),t=ie(oe=>oe.agentMeta),n=ie(oe=>oe.setAgentMeta),r=ie(oe=>oe.instructionState),i=ie(oe=>oe.updateInstruction),s=ie(oe=>oe.workflowSteps),l=ie(oe=>oe.channels),u=ie(oe=>oe.mcpServers),f=ie(oe=>oe.skills),m=ie(oe=>oe.tokenBudget),h=rt(oe=>oe.facts),[g,b]=$.useState(""),[y,v]=$.useState(!0),[w,E]=$.useState(!0),[C,M]=$.useState(!1),[S,N]=$.useState(!1),[R,T]=$.useState(!1),[D,H]=$.useState(!1),[V,B]=$.useState(!1),[O,Y]=$.useState(null),[Z,U]=$.useState(!1),[_,A]=$.useState(null),[q,K]=$.useState(!1),{persona:Q,tone:I,expertise:F,constraints:L,objectives:z,rawPrompt:W,autoSync:ae}=r,le=oe=>{if(_){if(_.mode==="constraint")if(_.index!==void 0){const xe=L.customConstraints.split(`
|
|
357
|
+
`).filter(Boolean);xe[_.index]=oe,i({constraints:{...L,customConstraints:xe.join(`
|
|
358
|
+
`)}})}else{const xe=L.customConstraints?L.customConstraints+`
|
|
359
|
+
`+oe:oe;i({constraints:{...L,customConstraints:xe}})}else if(_.mode==="criteria")if(_.index!==void 0){const xe=[...z.successCriteria];xe[_.index]=oe,i({objectives:{...z,successCriteria:xe}})}else i({objectives:{...z,successCriteria:[...z.successCriteria,oe]}});U(!1),A(null)}},me=()=>{if(!(!_||_.index===void 0)){if(_.mode==="constraint"){const oe=L.customConstraints.split(`
|
|
360
|
+
`).filter(Boolean);oe.splice(_.index,1),i({constraints:{...L,customConstraints:oe.join(`
|
|
361
|
+
`)}})}else if(_.mode==="criteria"){const oe=z.successCriteria.filter((xe,Oe)=>Oe!==_.index);i({objectives:{...z,successCriteria:oe}})}U(!1),A(null)}},G=$.useCallback(async()=>{Y("all");try{const oe=await LR("full",Q);if(typeof oe=="object"&&oe!==null){const xe=oe;xe.persona&&i({persona:xe.persona}),xe.constraints&&i({constraints:{...L,customConstraints:xe.constraints.join(`
|
|
362
|
+
`)}}),xe.objectives&&i({objectives:{...z,primary:xe.objectives.primary||z.primary}})}}catch{}Y(null)},[Q,l,u,f,L,z,i]),ce={identity:!!(t.name&&t.description),persona:Q.length>20,constraints:L.neverMakeUp||L.customConstraints.length>0,workflow:s.length>0},be=Object.values(ce).filter(Boolean).length,we=l.reduce((oe,xe)=>oe+(xe.effectiveTokens??xe.baseTokens??0),0),ve=Math.ceil(Q.length/4)+Math.ceil(L.customConstraints.length/4),ke=s.reduce((oe,xe)=>oe+Math.ceil(xe.label.length/4),0),De=we+ve+ke;return d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[d.jsx("div",{style:{paddingBottom:10,borderBottom:`1px solid ${e.border}`},children:d.jsx("span",{className:"text-[11px] font-bold uppercase tracking-[0.12em]",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:"Agent Configuration"})}),d.jsx(VR,{}),d.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:e.surfaceOpaque,border:`1px solid ${e.border}`,boxShadow:`0 2px 12px ${e.isDark?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.06)"}`},children:[d.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5 select-none",style:{borderBottom:`1px solid ${e.border}`,background:e.surfaceElevated},children:[d.jsx(kl,{size:14,style:{color:"#FE5000"}}),d.jsx(ul,{content:"Build your agent step by step",children:d.jsx("span",{className:"text-[13px] font-bold tracking-[0.08em] uppercase",style:{fontFamily:"'Geist Mono', monospace",color:e.textPrimary},children:"Agent"})}),d.jsx("div",{className:"flex-1"}),d.jsxs("div",{className:"flex items-center gap-1",children:[Object.entries(ce).map(([oe,xe])=>d.jsx("div",{title:oe,style:{width:6,height:6,borderRadius:"50%",background:xe?"#FE5000":e.borderSubtle,transition:"background 200ms"}},oe)),d.jsxs("span",{className:"text-[13px] ml-1",style:{color:e.textDim,fontFamily:"'Geist Mono', monospace"},children:[be,"/4"]})]})]}),d.jsx(js,{label:"Identity",color:"#FE5000",collapsed:!y,onToggle:()=>v(!y),t:e}),y&&d.jsxs("div",{className:"px-5 py-4 flex flex-col gap-4",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("div",{className:"relative",children:[d.jsx("button",{type:"button","aria-label":"Choose avatar",onClick:()=>H(!D),className:"w-11 h-11 rounded-lg cursor-pointer flex items-center justify-center",style:{background:e.surfaceElevated,border:`1.5px solid ${e.border}`,color:"#FE5000"},children:d.jsx(OR,{avatarId:t.avatar,size:20})}),D&&d.jsx("div",{className:"absolute top-13 left-0 z-50 grid grid-cols-5 gap-0.5 p-2 rounded-lg",style:{background:e.surfaceOpaque,border:`1px solid ${e.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.2)",width:185},children:SS.map(oe=>{const xe=oe.icon;return d.jsx("button",{type:"button",title:oe.id,onClick:()=>{n({avatar:oe.id}),H(!1)},className:"w-8 h-8 rounded cursor-pointer flex items-center justify-center border-none",style:{background:t.avatar===oe.id?"#FE500020":"transparent",color:t.avatar===oe.id?"#FE5000":e.textSecondary},children:d.jsx(xe,{size:15})},oe.id)})})]}),d.jsx("div",{className:"flex-1",children:V?d.jsx(Hs,{value:t.name,onChange:oe=>n({name:oe.target.value}),onBlur:()=>B(!1),onKeyDown:oe=>oe.key==="Enter"&&B(!1),autoFocus:!0,style:{fontSize:19,padding:"6px 10px"}}):d.jsx("button",{type:"button",onClick:()=>B(!0),className:"text-left font-semibold cursor-pointer border-none bg-transparent p-0 w-full",style:{color:t.name?e.textPrimary:e.textMuted,fontSize:19,fontFamily:"'Geist Sans', sans-serif"},children:t.name||"Click to name your agent"})})]}),d.jsx(ia,{label:"Description",value:t.description,onChange:oe=>n({description:oe.target.value}),placeholder:"One-line summary of what this agent does...",style:{minHeight:40}}),d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx("span",{className:"text-[13px] tracking-wider uppercase font-semibold",style:{color:e.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Tags"}),d.jsxs("div",{className:"flex flex-wrap gap-1.5 px-2 py-1.5 rounded-lg min-h-[36px]",style:{background:e.inputBg,border:`1px solid ${e.border}`},children:[t.tags.map((oe,xe)=>d.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[12px]",style:{fontFamily:"'Geist Mono', monospace",background:"#FE500015",color:"#FE5000",border:"1px solid #FE500030"},children:[oe,d.jsx("button",{type:"button",onClick:()=>n({tags:t.tags.filter((Oe,wt)=>wt!==xe)}),className:"flex items-center justify-center border-none bg-transparent cursor-pointer p-0",style:{color:"#FE5000",lineHeight:1},"aria-label":`Remove tag ${oe}`,children:d.jsx($t,{size:10})})]},xe)),d.jsx("input",{type:"text",value:g,onChange:oe=>b(oe.target.value),onKeyDown:oe=>{if(oe.key==="Enter"||oe.key===","){oe.preventDefault();const xe=g.trim().replace(/,$/,"");xe&&!t.tags.includes(xe)&&n({tags:[...t.tags,xe]}),b("")}else oe.key==="Backspace"&&g===""&&t.tags.length>0&&n({tags:t.tags.slice(0,-1)})},placeholder:t.tags.length===0?"pm, analysis, competitor":"",className:"flex-1 min-w-[100px] text-[12px] outline-none border-none bg-transparent",style:{fontFamily:"'Geist Mono', monospace",color:e.textPrimary}})]})]})]}),d.jsx(js,{label:"Persona",color:"#9b59b6",collapsed:!w,onToggle:()=>E(!w),t:e,right:d.jsx(YR,{loading:O==="all",onClick:G})}),w&&d.jsxs("div",{className:"px-5 py-4 flex flex-col gap-4",children:[d.jsx(ia,{label:"Who is this agent?",value:Q,onChange:oe=>i({persona:oe.target.value}),placeholder:"Describe the agent's role, expertise, and personality...",style:{minHeight:64}}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx("span",{className:"text-[13px] tracking-wider uppercase font-semibold",style:{color:e.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Tone"}),d.jsx("div",{className:"flex rounded-md overflow-hidden",style:{border:`1px solid ${e.border}`},children:["formal","neutral","casual"].map(oe=>d.jsx("button",{type:"button",onClick:()=>i({tone:oe}),className:"flex-1 text-center text-[13px] py-1.5 cursor-pointer border-none",style:{background:I===oe?"#FE5000":"transparent",color:I===oe?"#fff":e.textDim,transition:"all 150ms"},children:oe.charAt(0).toUpperCase()+oe.slice(1)},oe))})]}),d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx("span",{className:"text-[13px] tracking-wider uppercase font-semibold",style:{color:e.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Expertise"}),d.jsx("div",{className:"flex rounded-md overflow-hidden",style:{border:`1px solid ${e.border}`},children:[{l:"Junior",v:1},{l:"Mid",v:3},{l:"Senior",v:5}].map(oe=>d.jsx("button",{type:"button",onClick:()=>i({expertise:oe.v}),className:"flex-1 text-center text-[13px] py-1.5 cursor-pointer border-none",style:{background:F===oe.v?"#FE5000":"transparent",color:F===oe.v?"#fff":e.textDim,transition:"all 150ms"},children:oe.l},oe.v))})]})]})]}),d.jsx(js,{label:"Constraints",color:"#2ecc71",collapsed:!C,onToggle:()=>M(!C),t:e}),C&&d.jsxs("div",{className:"px-5 py-4 flex flex-col gap-3",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("span",{className:"text-[13px] tracking-wider uppercase font-semibold",style:{color:e.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Safety"}),d.jsx("div",{className:"flex gap-1",children:[{id:"autonomous",label:"Autonomous",desc:"No guardrails",apply:{neverMakeUp:!1,askBeforeActions:!1,stayInScope:!1,useOnlyTools:!1,limitWords:!1}},{id:"balanced",label:"Balanced",desc:"Cite sources, stay in scope",apply:{neverMakeUp:!0,askBeforeActions:!1,stayInScope:!0,useOnlyTools:!1,limitWords:!1}},{id:"careful",label:"Careful",desc:"All guardrails on",apply:{neverMakeUp:!0,askBeforeActions:!0,stayInScope:!0,useOnlyTools:!0,limitWords:!1}}].map(oe=>{const xe=oe.id==="careful"?L.neverMakeUp&&L.askBeforeActions&&L.stayInScope&&L.useOnlyTools:oe.id==="balanced"?L.neverMakeUp&&L.stayInScope&&!L.askBeforeActions&&!L.useOnlyTools:!L.neverMakeUp&&!L.askBeforeActions&&!L.stayInScope&&!L.useOnlyTools;return d.jsx(ul,{content:oe.desc,children:d.jsx("button",{type:"button",onClick:()=>i({constraints:{...L,...oe.apply}}),className:"text-[13px] px-3 py-1.5 rounded-md cursor-pointer border-none font-medium",style:{background:xe?"#2ecc7120":"transparent",color:xe?"#2ecc71":e.textDim,border:`1px solid ${xe?"#2ecc7140":e.border}`,fontFamily:"'Geist Mono', monospace",transition:"all 0.15s"},children:oe.label})},oe.id)})})]}),d.jsxs("div",{children:[d.jsx("span",{className:"text-[13px] tracking-wider uppercase font-semibold block mb-1.5",style:{color:e.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Custom Rules"}),L.customConstraints.split(`
|
|
363
|
+
`).filter(Boolean).map((oe,xe)=>d.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-1.5",style:{background:e.isDark?"#2e1a0a":"#fdf5ee",border:`1px solid ${e.isDark?"#e67e2230":"#e67e2240"}`},children:[d.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:"#e67e22",flexShrink:0}}),d.jsx("span",{className:"flex-1 text-[13px]",style:{color:e.textPrimary,lineHeight:1.4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},children:oe}),d.jsx("button",{type:"button",onClick:()=>{A({mode:"constraint",index:xe,title:"Edit Custom Rule",initial:oe}),U(!0)},className:"border-none bg-transparent cursor-pointer p-1 rounded min-w-[44px] min-h-[44px] flex items-center justify-center",style:{color:e.textDim},"aria-label":"Edit rule",children:d.jsx(A1,{size:11})})]},xe)),d.jsxs("button",{type:"button",onClick:()=>{A({mode:"constraint",title:"Add Custom Rule"}),U(!0)},className:"flex items-center gap-1 text-[12px] cursor-pointer border-none bg-transparent mt-1.5",style:{color:e.textDim},children:[d.jsx(Ft,{size:10})," Add rule"]})]})]}),d.jsx(js,{label:"Objectives",color:"#e74c3c",collapsed:!S,onToggle:()=>N(!S),t:e}),S&&d.jsxs("div",{className:"px-5 py-4 flex flex-col gap-4",children:[d.jsx(ia,{label:"Primary Objective",value:z.primary,onChange:oe=>i({objectives:{...z,primary:oe.target.value}}),placeholder:"What is this agent's main goal?",style:{minHeight:40}}),d.jsxs("div",{children:[d.jsx("span",{className:"text-[13px] tracking-wider uppercase font-semibold block mb-1.5",style:{color:e.textMuted,fontFamily:"'Geist Mono', monospace"},children:"Success Criteria"}),z.successCriteria.map((oe,xe)=>d.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-1.5",style:{background:e.isDark?"#1a2e1a":"#f0faf0",border:`1px solid ${e.isDark?"#2ecc7130":"#2ecc7140"}`},children:[d.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:"#2ecc71",flexShrink:0}}),d.jsx("span",{className:"flex-1 text-[13px]",style:{color:e.textPrimary,lineHeight:1.4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},children:oe}),d.jsx("button",{type:"button",onClick:()=>{A({mode:"criteria",index:xe,title:"Edit Success Criterion",initial:oe}),U(!0)},className:"border-none bg-transparent cursor-pointer p-1 rounded min-w-[44px] min-h-[44px] flex items-center justify-center",style:{color:e.textDim},"aria-label":"Edit criterion",children:d.jsx(A1,{size:11})})]},xe)),d.jsxs("button",{type:"button",onClick:()=>{A({mode:"criteria",title:"Add Success Criterion"}),U(!0)},className:"flex items-center gap-1 text-[12px] cursor-pointer border-none bg-transparent mt-1.5",style:{color:e.textDim},children:[d.jsx(Ft,{size:10})," Add criterion"]})]})]}),d.jsx(js,{label:"System Prompt",color:"#555",collapsed:!R,onToggle:()=>T(!R),t:e,right:d.jsxs("div",{className:"flex items-center gap-1.5",onClick:oe=>oe.stopPropagation(),children:[d.jsx(Fs,{checked:ae,onChange:oe=>i({autoSync:oe}),label:""}),d.jsx("span",{className:"text-[13px]",style:{color:e.textDim},children:"Auto"})]})}),R&&d.jsx("div",{className:"px-5 py-4",children:d.jsx(ia,{value:W,onChange:oe=>i({rawPrompt:oe.target.value}),placeholder:"System prompt will be auto-generated from sections above, or type manually...",style:{minHeight:120,fontFamily:"'Geist Mono', monospace",fontSize:13}})})]}),d.jsx(IR,{open:Z,onClose:()=>{U(!1),A(null)},onSave:le,onDelete:_?.index!==void 0?me:void 0,initial:_?.initial,title:_?.title||""}),d.jsx(FR,{open:q,onClose:()=>K(!1)}),d.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:e.surfaceOpaque,border:`1px solid ${e.border}`,boxShadow:`0 2px 12px ${e.isDark?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.06)"}`},children:[d.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5 select-none",style:{background:e.surfaceElevated},children:[d.jsx("div",{style:{width:3,height:14,borderRadius:2,background:"#e67e22",opacity:.8}}),d.jsx("span",{className:"text-[13px] font-bold tracking-[0.08em] uppercase flex-1",style:{fontFamily:"'Geist Mono', monospace",color:e.textPrimary},children:"Workflow"}),d.jsxs("span",{className:"text-[13px]",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:[s.length," steps"]})]}),d.jsx("div",{className:"px-5 py-4 flex flex-col items-center",children:s.length===0?d.jsxs("button",{type:"button",onClick:()=>K(!0),className:"flex items-center justify-center gap-1.5 text-[13px] px-4 py-2.5 rounded-lg cursor-pointer border-none",style:{background:"#e67e2215",color:"#e67e22",fontFamily:"'Geist Mono', monospace",fontWeight:600},children:[d.jsx(Ft,{size:12})," Define workflow steps"]}):d.jsxs(d.Fragment,{children:[s.map((oe,xe)=>d.jsxs("div",{className:"w-full",children:[d.jsxs("div",{className:"flex items-center gap-3 py-2",children:[d.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:e.surfaceElevated,border:"1.5px solid #e67e2230",display:"flex",alignItems:"center",justifyContent:"center"},children:d.jsx("span",{style:{fontFamily:"'Geist Mono', monospace",fontSize:13,fontWeight:700,color:"#e67e22"},children:xe+1})}),d.jsx("span",{style:{flex:1,fontSize:14,color:e.textPrimary},children:oe.label||"Unnamed step"}),d.jsx("span",{className:"text-[12px] px-2 py-0.5 rounded",style:{background:e.badgeBg,color:e.textDim,fontFamily:"'Geist Mono', monospace"},children:oe.action||"action"})]}),xe<s.length-1&&d.jsx("div",{style:{width:2,height:12,background:"#e67e2220",marginLeft:11}})]},oe.id)),d.jsx("button",{type:"button",onClick:()=>K(!0),className:"text-[12px] px-3 py-2 mt-3 rounded cursor-pointer border-none",style:{background:e.border,color:e.textDim},children:"Edit workflow"})]})})]}),d.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:e.surfaceOpaque,border:`1px solid ${e.border}`,padding:"16px 20px"},children:[d.jsxs("div",{className:"flex items-center justify-between mb-2.5",children:[d.jsx("span",{className:"text-[12px] font-bold tracking-[0.08em] uppercase",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:"Context Budget"}),d.jsxs("span",{className:"text-[13px] font-semibold",style:{fontFamily:"'Geist Mono', monospace",color:"#FE5000"},children:[vm(De)," / ",vm(m)]})]}),d.jsx("div",{style:{height:8,background:e.isDark?"#25252a":"#dddde2",borderRadius:4,overflow:"hidden"},children:d.jsx("div",{style:{width:`${Math.min(De/m*100,100)}%`,height:"100%",borderRadius:4,background:"linear-gradient(90deg, #FE5000, #ff8c55)",transition:"width 500ms"}})}),d.jsx("div",{className:"flex gap-3 mt-2.5",children:[{label:"Knowledge",tokens:we,color:"#3498db"},{label:"Instructions",tokens:ve,color:"#9b59b6"},{label:"Workflow",tokens:ke,color:"#e67e22"}].map(oe=>d.jsxs("span",{className:"flex items-center gap-1 text-[12px]",style:{color:e.textDim},children:[d.jsx("span",{style:{width:8,height:8,borderRadius:2,background:oe.color}}),oe.label," ",vm(oe.tokens)]},oe.label))}),h.length>0&&d.jsxs("div",{className:"mt-2 text-[12px]",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:["💡 Based on ",h.length," insight",h.length!==1?"s":""]})]})]})}function XR(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const ZR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,QR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,JR={};function Y1(e,t){return(JR.jsx?QR:ZR).test(e)}const eO=/[ \t\n\f\r]/g;function tO(e){return typeof e=="object"?e.type==="text"?W1(e.value):!1:W1(e)}function W1(e){return e.replace(eO,"")===""}class Tl{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Tl.prototype.normal={};Tl.prototype.property={};Tl.prototype.space=void 0;function ES(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Tl(n,r,t)}function ch(e){return e.toLowerCase()}class mn{constructor(t,n){this.attribute=n,this.property=t}}mn.prototype.attribute="";mn.prototype.booleanish=!1;mn.prototype.boolean=!1;mn.prototype.commaOrSpaceSeparated=!1;mn.prototype.commaSeparated=!1;mn.prototype.defined=!1;mn.prototype.mustUseProperty=!1;mn.prototype.number=!1;mn.prototype.overloadedBoolean=!1;mn.prototype.property="";mn.prototype.spaceSeparated=!1;mn.prototype.space=void 0;let nO=0;const $e=ya(),At=ya(),uh=ya(),ge=ya(),lt=ya(),pi=ya(),En=ya();function ya(){return 2**++nO}const dh=Object.freeze(Object.defineProperty({__proto__:null,boolean:$e,booleanish:At,commaOrSpaceSeparated:En,commaSeparated:pi,number:ge,overloadedBoolean:uh,spaceSeparated:lt},Symbol.toStringTag,{value:"Module"})),wm=Object.keys(dh);class ng extends mn{constructor(t,n,r,i){let s=-1;if(super(t,n),X1(this,"space",i),typeof r=="number")for(;++s<wm.length;){const l=wm[s];X1(this,wm[s],(r&dh[l])===dh[l])}}}ng.prototype.defined=!0;function X1(e,t,n){n&&(e[t]=n)}function Ti(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new ng(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[ch(r)]=r,n[ch(s.attribute)]=r}return new Tl(t,n,e.space)}const MS=Ti({properties:{ariaActiveDescendant:null,ariaAtomic:At,ariaAutoComplete:null,ariaBusy:At,ariaChecked:At,ariaColCount:ge,ariaColIndex:ge,ariaColSpan:ge,ariaControls:lt,ariaCurrent:null,ariaDescribedBy:lt,ariaDetails:null,ariaDisabled:At,ariaDropEffect:lt,ariaErrorMessage:null,ariaExpanded:At,ariaFlowTo:lt,ariaGrabbed:At,ariaHasPopup:null,ariaHidden:At,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:lt,ariaLevel:ge,ariaLive:null,ariaModal:At,ariaMultiLine:At,ariaMultiSelectable:At,ariaOrientation:null,ariaOwns:lt,ariaPlaceholder:null,ariaPosInSet:ge,ariaPressed:At,ariaReadOnly:At,ariaRelevant:null,ariaRequired:At,ariaRoleDescription:lt,ariaRowCount:ge,ariaRowIndex:ge,ariaRowSpan:ge,ariaSelected:At,ariaSetSize:ge,ariaSort:null,ariaValueMax:ge,ariaValueMin:ge,ariaValueNow:ge,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function TS(e,t){return t in e?e[t]:t}function jS(e,t){return TS(e,t.toLowerCase())}const oO=Ti({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:pi,acceptCharset:lt,accessKey:lt,action:null,allow:null,allowFullScreen:$e,allowPaymentRequest:$e,allowUserMedia:$e,alt:null,as:null,async:$e,autoCapitalize:null,autoComplete:lt,autoFocus:$e,autoPlay:$e,blocking:lt,capture:null,charSet:null,checked:$e,cite:null,className:lt,cols:ge,colSpan:null,content:null,contentEditable:At,controls:$e,controlsList:lt,coords:ge|pi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:$e,defer:$e,dir:null,dirName:null,disabled:$e,download:uh,draggable:At,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:$e,formTarget:null,headers:lt,height:ge,hidden:uh,high:ge,href:null,hrefLang:null,htmlFor:lt,httpEquiv:lt,id:null,imageSizes:null,imageSrcSet:null,inert:$e,inputMode:null,integrity:null,is:null,isMap:$e,itemId:null,itemProp:lt,itemRef:lt,itemScope:$e,itemType:lt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:$e,low:ge,manifest:null,max:null,maxLength:ge,media:null,method:null,min:null,minLength:ge,multiple:$e,muted:$e,name:null,nonce:null,noModule:$e,noValidate:$e,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:$e,optimum:ge,pattern:null,ping:lt,placeholder:null,playsInline:$e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:$e,referrerPolicy:null,rel:lt,required:$e,reversed:$e,rows:ge,rowSpan:ge,sandbox:lt,scope:null,scoped:$e,seamless:$e,selected:$e,shadowRootClonable:$e,shadowRootDelegatesFocus:$e,shadowRootMode:null,shape:null,size:ge,sizes:null,slot:null,span:ge,spellCheck:At,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ge,step:null,style:null,tabIndex:ge,target:null,title:null,translate:null,type:null,typeMustMatch:$e,useMap:null,value:At,width:ge,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:lt,axis:null,background:null,bgColor:null,border:ge,borderColor:null,bottomMargin:ge,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:$e,declare:$e,event:null,face:null,frame:null,frameBorder:null,hSpace:ge,leftMargin:ge,link:null,longDesc:null,lowSrc:null,marginHeight:ge,marginWidth:ge,noResize:$e,noHref:$e,noShade:$e,noWrap:$e,object:null,profile:null,prompt:null,rev:null,rightMargin:ge,rules:null,scheme:null,scrolling:At,standby:null,summary:null,text:null,topMargin:ge,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ge,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:$e,disableRemotePlayback:$e,prefix:null,property:null,results:ge,security:null,unselectable:null},space:"html",transform:jS}),rO=Ti({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:En,accentHeight:ge,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ge,amplitude:ge,arabicForm:null,ascent:ge,attributeName:null,attributeType:null,azimuth:ge,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ge,by:null,calcMode:null,capHeight:ge,className:lt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ge,diffuseConstant:ge,direction:null,display:null,dur:null,divisor:ge,dominantBaseline:null,download:$e,dx:null,dy:null,edgeMode:null,editable:null,elevation:ge,enableBackground:null,end:null,event:null,exponent:ge,externalResourcesRequired:null,fill:null,fillOpacity:ge,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:pi,g2:pi,glyphName:pi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ge,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ge,horizOriginX:ge,horizOriginY:ge,id:null,ideographic:ge,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ge,k:ge,k1:ge,k2:ge,k3:ge,k4:ge,kernelMatrix:En,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ge,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ge,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ge,overlineThickness:ge,paintOrder:null,panose1:null,path:null,pathLength:ge,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:lt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ge,pointsAtY:ge,pointsAtZ:ge,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:En,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:En,rev:En,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:En,requiredFeatures:En,requiredFonts:En,requiredFormats:En,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ge,specularExponent:ge,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ge,strikethroughThickness:ge,string:null,stroke:null,strokeDashArray:En,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ge,strokeOpacity:ge,strokeWidth:null,style:null,surfaceScale:ge,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:En,tabIndex:ge,tableValues:null,target:null,targetX:ge,targetY:ge,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:En,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ge,underlineThickness:ge,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ge,values:null,vAlphabetic:ge,vMathematical:ge,vectorEffect:null,vHanging:ge,vIdeographic:ge,version:null,vertAdvY:ge,vertOriginX:ge,vertOriginY:ge,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ge,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:TS}),AS=Ti({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),NS=Ti({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:jS}),_S=Ti({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),aO={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},iO=/[A-Z]/g,Z1=/-[a-z]/g,sO=/^data[-\w.:]+$/i;function lO(e,t){const n=ch(t);let r=t,i=mn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&sO.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Z1,uO);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Z1.test(s)){let l=s.replace(iO,cO);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=ng}return new i(r,t)}function cO(e){return"-"+e.toLowerCase()}function uO(e){return e.charAt(1).toUpperCase()}const dO=ES([MS,oO,AS,NS,_S],"html"),og=ES([MS,rO,AS,NS,_S],"svg");function pO(e){return e.join(" ").trim()}var ai={},Sm,Q1;function fO(){if(Q1)return Sm;Q1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,u=/^\s+|\s+$/g,f=`
|
|
364
|
+
`,m="/",h="*",g="",b="comment",y="declaration";function v(E,C){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];C=C||{};var M=1,S=1;function N(U){var _=U.match(t);_&&(M+=_.length);var A=U.lastIndexOf(f);S=~A?U.length-A:S+U.length}function R(){var U={line:M,column:S};return function(_){return _.position=new T(U),V(),_}}function T(U){this.start=U,this.end={line:M,column:S},this.source=C.source}T.prototype.content=E;function D(U){var _=new Error(C.source+":"+M+":"+S+": "+U);if(_.reason=U,_.filename=C.source,_.line=M,_.column=S,_.source=E,!C.silent)throw _}function H(U){var _=U.exec(E);if(_){var A=_[0];return N(A),E=E.slice(A.length),_}}function V(){H(n)}function B(U){var _;for(U=U||[];_=O();)_!==!1&&U.push(_);return U}function O(){var U=R();if(!(m!=E.charAt(0)||h!=E.charAt(1))){for(var _=2;g!=E.charAt(_)&&(h!=E.charAt(_)||m!=E.charAt(_+1));)++_;if(_+=2,g===E.charAt(_-1))return D("End of comment missing");var A=E.slice(2,_-2);return S+=2,N(A),E=E.slice(_),S+=2,U({type:b,comment:A})}}function Y(){var U=R(),_=H(r);if(_){if(O(),!H(i))return D("property missing ':'");var A=H(s),q=U({type:y,property:w(_[0].replace(e,g)),value:A?w(A[0].replace(e,g)):g});return H(l),q}}function Z(){var U=[];B(U);for(var _;_=Y();)_!==!1&&(U.push(_),B(U));return U}return V(),Z()}function w(E){return E?E.replace(u,g):g}return Sm=v,Sm}var J1;function mO(){if(J1)return ai;J1=1;var e=ai&&ai.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ai,"__esModule",{value:!0}),ai.default=n;const t=e(fO());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const l=(0,t.default)(r),u=typeof i=="function";return l.forEach(f=>{if(f.type!=="declaration")return;const{property:m,value:h}=f;u?i(m,h,f):h&&(s=s||{},s[m]=h)}),s}return ai}var As={},ek;function hO(){if(ek)return As;ek=1,Object.defineProperty(As,"__esModule",{value:!0}),As.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(m){return!m||n.test(m)||e.test(m)},l=function(m,h){return h.toUpperCase()},u=function(m,h){return"".concat(h,"-")},f=function(m,h){return h===void 0&&(h={}),s(m)?m:(m=m.toLowerCase(),h.reactCompat?m=m.replace(i,u):m=m.replace(r,u),m.replace(t,l))};return As.camelCase=f,As}var Ns,tk;function gO(){if(tk)return Ns;tk=1;var e=Ns&&Ns.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(mO()),n=hO();function r(i,s){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(u,f){u&&f&&(l[(0,n.camelCase)(u,s)]=f)}),l}return r.default=r,Ns=r,Ns}var yO=gO();const xO=Qu(yO),DS=zS("end"),rg=zS("start");function zS(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function bO(e){const t=rg(e),n=DS(e);if(t&&n)return{start:t,end:n}}function qs(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?nk(e.position):"start"in e||"end"in e?nk(e):"line"in e||"column"in e?ph(e):""}function ph(e){return ok(e&&e.line)+":"+ok(e&&e.column)}function nk(e){return ph(e&&e.start)+"-"+ph(e&&e.end)}function ok(e){return e&&typeof e=="number"?e:1}class Xt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},l=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(l=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?s.ruleId=r:(s.source=r.slice(0,f),s.ruleId=r.slice(f+1))}if(!s.place&&s.ancestors&&s.ancestors){const f=s.ancestors[s.ancestors.length-1];f&&(s.place=f.position)}const u=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=u?u.line:void 0,this.name=qs(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=l&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Xt.prototype.file="";Xt.prototype.name="";Xt.prototype.reason="";Xt.prototype.message="";Xt.prototype.stack="";Xt.prototype.column=void 0;Xt.prototype.line=void 0;Xt.prototype.ancestors=void 0;Xt.prototype.cause=void 0;Xt.prototype.fatal=void 0;Xt.prototype.place=void 0;Xt.prototype.ruleId=void 0;Xt.prototype.source=void 0;const ag={}.hasOwnProperty,kO=new Map,vO=/[A-Z]/g,wO=new Set(["table","tbody","thead","tfoot","tr"]),SO=new Set(["td","th"]),RS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function CO(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=DO(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=_O(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?og:dO,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=OS(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function OS(e,t,n){if(t.type==="element")return EO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return MO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return jO(e,t,n);if(t.type==="mdxjsEsm")return TO(e,t);if(t.type==="root")return AO(e,t,n);if(t.type==="text")return NO(e,t)}function EO(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=og,e.schema=i),e.ancestors.push(t);const s=FS(e,t.tagName,!1),l=zO(e,t);let u=sg(e,t);return wO.has(t.tagName)&&(u=u.filter(function(f){return typeof f=="string"?!tO(f):!0})),IS(e,l,s,t),ig(l,u),e.ancestors.pop(),e.schema=r,e.create(t,s,l,n)}function MO(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}dl(e,t.position)}function TO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);dl(e,t.position)}function jO(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=og,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:FS(e,t.name,!0),l=RO(e,t),u=sg(e,t);return IS(e,l,s,t),ig(l,u),e.ancestors.pop(),e.schema=r,e.create(t,s,l,n)}function AO(e,t,n){const r={};return ig(r,sg(e,t)),e.create(t,e.Fragment,r,n)}function NO(e,t){return t.value}function IS(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ig(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function _O(e,t,n){return r;function r(i,s,l,u){const m=Array.isArray(l.children)?n:t;return u?m(s,l,u):m(s,l)}}function DO(e,t){return n;function n(r,i,s,l){const u=Array.isArray(s.children),f=rg(r);return t(i,s,l,u,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function zO(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&ag.call(t.properties,i)){const s=OO(e,i,t.properties[i]);if(s){const[l,u]=s;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&SO.has(t.tagName)?r=u:n[l]=u}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function RO(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const l=s.expression;l.type;const u=l.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else dl(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const u=r.value.data.estree.body[0];u.type,s=e.evaluater.evaluateExpression(u.expression)}else dl(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function sg(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:kO;for(;++r<t.children.length;){const s=t.children[r];let l;if(e.passKeys){const f=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(f){const m=i.get(f)||0;l=f+"-"+m,i.set(f,m+1)}}const u=OS(e,s,l);u!==void 0&&n.push(u)}return n}function OO(e,t,n){const r=lO(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?XR(n):pO(n)),r.property==="style"){let i=typeof n=="object"?n:IO(e,String(n));return e.stylePropertyNameCase==="css"&&(i=FO(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?aO[r.property]||r.property:r.attribute,n]}}function IO(e,t){try{return xO(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Xt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=RS+"#cannot-parse-style-attribute",i}}function FS(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,l;for(;++s<i.length;){const u=Y1(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(s&&u.type==="Literal"),optional:!1}:u}r=l}else r=Y1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return ag.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);dl(e)}function dl(e,t){const n=new Xt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=RS+"#cannot-handle-mdx-estrees-without-createevaluater",n}function FO(e){const t={};let n;for(n in e)ag.call(e,n)&&(t[$O(n)]=e[n]);return t}function $O(e){let t=e.replace(vO,LO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function LO(e){return"-"+e.toLowerCase()}const Cm={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},PO={};function lg(e,t){const n=PO,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return $S(e,r,i)}function $S(e,t,n){if(BO(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return rk(e.children,t,n)}return Array.isArray(e)?rk(e,t,n):""}function rk(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=$S(e[i],t,n);return r.join("")}function BO(e){return!!(e&&typeof e=="object")}const ak=document.createElement("i");function cg(e){const t="&"+e+";";ak.innerHTML=t;const n=ak.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Tn(e,t,n,r){const i=e.length;let s=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);s<r.length;)l=r.slice(s,s+1e4),l.unshift(t,0),e.splice(...l),s+=1e4,t+=1e4}function Ln(e,t){return e.length>0?(Tn(e,e.length,0,t),e):t}const ik={}.hasOwnProperty;function LS(e){const t={};let n=-1;for(;++n<e.length;)HO(t,e[n]);return t}function HO(e,t){let n;for(n in t){const i=(ik.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let l;if(s)for(l in s){ik.call(i,l)||(i[l]=[]);const u=s[l];UO(i[l],Array.isArray(u)?u:u?[u]:[])}}}function UO(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Tn(e,0,0,r)}function PS(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Jn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Jt=Dr(/[A-Za-z]/),Yt=Dr(/[\dA-Za-z]/),qO=Dr(/[#-'*+\--9=?A-Z^-~]/);function Vu(e){return e!==null&&(e<32||e===127)}const fh=Dr(/\d/),GO=Dr(/[\dA-Fa-f]/),KO=Dr(/[!-/:-@[-`{-~]/);function Ae(e){return e!==null&&e<-2}function st(e){return e!==null&&(e<0||e===32)}function He(e){return e===-2||e===-1||e===32}const Cd=Dr(new RegExp("\\p{P}|\\p{S}","u")),ha=Dr(/\s/);function Dr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ji(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let l="";if(s===37&&Yt(e.charCodeAt(n+1))&&Yt(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(l=String.fromCharCode(s));else if(s>55295&&s<57344){const u=e.charCodeAt(n+1);s<56320&&u>56319&&u<57344?(l=String.fromCharCode(s,u),i=1):l="�"}else l=String.fromCharCode(s);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Ve(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return l;function l(f){return He(f)?(e.enter(n),u(f)):t(f)}function u(f){return He(f)&&s++<i?(e.consume(f),u):(e.exit(n),t(f))}}const VO={tokenize:YO};function YO(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Ve(e,t,"linePrefix")}function i(u){return e.enter("paragraph"),s(u)}function s(u){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(u)}function l(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return Ae(u)?(e.consume(u),e.exit("chunkText"),s):(e.consume(u),l)}}const WO={tokenize:XO},sk={tokenize:ZO};function XO(e){const t=this,n=[];let r=0,i,s,l;return u;function u(S){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,f,m)(S)}return m(S)}function f(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&M();const N=t.events.length;let R=N,T;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){T=t.events[R][1].end;break}C(r);let D=N;for(;D<t.events.length;)t.events[D][1].end={...T},D++;return Tn(t.events,R+1,0,t.events.slice(N)),t.events.length=D,m(S)}return u(S)}function m(S){if(r===n.length){if(!i)return b(S);if(i.currentConstruct&&i.currentConstruct.concrete)return v(S);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(sk,h,g)(S)}function h(S){return i&&M(),C(r),b(S)}function g(S){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,v(S)}function b(S){return t.containerState={},e.attempt(sk,y,v)(S)}function y(S){return r++,n.push([t.currentConstruct,t.containerState]),b(S)}function v(S){if(S===null){i&&M(),C(0),e.consume(S);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),w(S)}function w(S){if(S===null){E(e.exit("chunkFlow"),!0),C(0),e.consume(S);return}return Ae(S)?(e.consume(S),E(e.exit("chunkFlow")),r=0,t.interrupt=void 0,u):(e.consume(S),w)}function E(S,N){const R=t.sliceStream(S);if(N&&R.push(null),S.previous=s,s&&(s.next=S),s=S,i.defineSkip(S.start),i.write(R),t.parser.lazy[S.start.line]){let T=i.events.length;for(;T--;)if(i.events[T][1].start.offset<l&&(!i.events[T][1].end||i.events[T][1].end.offset>l))return;const D=t.events.length;let H=D,V,B;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){if(V){B=t.events[H][1].end;break}V=!0}for(C(r),T=D;T<t.events.length;)t.events[T][1].end={...B},T++;Tn(t.events,H+1,0,t.events.slice(D)),t.events.length=T}}function C(S){let N=n.length;for(;N-- >S;){const R=n[N];t.containerState=R[1],R[0].exit.call(t,e)}n.length=S}function M(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function ZO(e,t,n){return Ve(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ei(e){if(e===null||st(e)||ha(e))return 1;if(Cd(e))return 2}function Ed(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const mh={name:"attention",resolveAll:QO,tokenize:JO};function QO(e,t){let n=-1,r,i,s,l,u,f,m,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[r][1].end},b={...e[n][1].start};lk(g,-f),lk(b,f),l={type:f>1?"strongSequence":"emphasisSequence",start:g,end:{...e[r][1].end}},u={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},s={type:f>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:f>1?"strong":"emphasis",start:{...l.start},end:{...u.end}},e[r][1].end={...l.start},e[n][1].start={...u.end},m=[],e[r][1].end.offset-e[r][1].start.offset&&(m=Ln(m,[["enter",e[r][1],t],["exit",e[r][1],t]])),m=Ln(m,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",s,t]]),m=Ln(m,Ed(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),m=Ln(m,[["exit",s,t],["enter",u,t],["exit",u,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,m=Ln(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,Tn(e,r-1,n-r+3,m),n=r+m.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function JO(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ei(r);let s;return l;function l(f){return s=f,e.enter("attentionSequence"),u(f)}function u(f){if(f===s)return e.consume(f),u;const m=e.exit("attentionSequence"),h=Ei(f),g=!h||h===2&&i||n.includes(f),b=!i||i===2&&h||n.includes(r);return m._open=!!(s===42?g:g&&(i||!b)),m._close=!!(s===42?b:b&&(h||!g)),t(f)}}function lk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const e8={name:"autolink",tokenize:t8};function t8(e,t,n){let r=0;return i;function i(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(y){return Jt(y)?(e.consume(y),l):y===64?n(y):m(y)}function l(y){return y===43||y===45||y===46||Yt(y)?(r=1,u(y)):m(y)}function u(y){return y===58?(e.consume(y),r=0,f):(y===43||y===45||y===46||Yt(y))&&r++<32?(e.consume(y),u):(r=0,m(y))}function f(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||Vu(y)?n(y):(e.consume(y),f)}function m(y){return y===64?(e.consume(y),h):qO(y)?(e.consume(y),m):n(y)}function h(y){return Yt(y)?g(y):n(y)}function g(y){return y===46?(e.consume(y),r=0,h):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):b(y)}function b(y){if((y===45||Yt(y))&&r++<63){const v=y===45?b:g;return e.consume(y),v}return n(y)}}const jl={partial:!0,tokenize:n8};function n8(e,t,n){return r;function r(s){return He(s)?Ve(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ae(s)?t(s):n(s)}}const BS={continuation:{tokenize:r8},exit:a8,name:"blockQuote",tokenize:o8};function o8(e,t,n){const r=this;return i;function i(l){if(l===62){const u=r.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),s}return n(l)}function s(l){return He(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function r8(e,t,n){const r=this;return i;function i(l){return He(l)?Ve(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):s(l)}function s(l){return e.attempt(BS,t,n)(l)}}function a8(e){e.exit("blockQuote")}const HS={name:"characterEscape",tokenize:i8};function i8(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return KO(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const US={name:"characterReference",tokenize:s8};function s8(e,t,n){const r=this;let i=0,s,l;return u;function u(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),f}function f(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),s=31,l=Yt,h(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,l=GO,h):(e.enter("characterReferenceValue"),s=7,l=fh,h(g))}function h(g){if(g===59&&i){const b=e.exit("characterReferenceValue");return l===Yt&&!cg(r.sliceSerialize(b))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(g)&&i++<s?(e.consume(g),h):n(g)}}const ck={partial:!0,tokenize:c8},uk={concrete:!0,name:"codeFenced",tokenize:l8};function l8(e,t,n){const r=this,i={partial:!0,tokenize:R};let s=0,l=0,u;return f;function f(T){return m(T)}function m(T){const D=r.events[r.events.length-1];return s=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,u=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(T)}function h(T){return T===u?(l++,e.consume(T),h):l<3?n(T):(e.exit("codeFencedFenceSequence"),He(T)?Ve(e,g,"whitespace")(T):g(T))}function g(T){return T===null||Ae(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(ck,w,N)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===null||Ae(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(T)):He(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ve(e,y,"whitespace")(T)):T===96&&T===u?n(T):(e.consume(T),b)}function y(T){return T===null||Ae(T)?g(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(T))}function v(T){return T===null||Ae(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(T)):T===96&&T===u?n(T):(e.consume(T),v)}function w(T){return e.attempt(i,N,E)(T)}function E(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),C}function C(T){return s>0&&He(T)?Ve(e,M,"linePrefix",s+1)(T):M(T)}function M(T){return T===null||Ae(T)?e.check(ck,w,N)(T):(e.enter("codeFlowValue"),S(T))}function S(T){return T===null||Ae(T)?(e.exit("codeFlowValue"),M(T)):(e.consume(T),S)}function N(T){return e.exit("codeFenced"),t(T)}function R(T,D,H){let V=0;return B;function B(_){return T.enter("lineEnding"),T.consume(_),T.exit("lineEnding"),O}function O(_){return T.enter("codeFencedFence"),He(_)?Ve(T,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):Y(_)}function Y(_){return _===u?(T.enter("codeFencedFenceSequence"),Z(_)):H(_)}function Z(_){return _===u?(V++,T.consume(_),Z):V>=l?(T.exit("codeFencedFenceSequence"),He(_)?Ve(T,U,"whitespace")(_):U(_)):H(_)}function U(_){return _===null||Ae(_)?(T.exit("codeFencedFence"),D(_)):H(_)}}}function c8(e,t,n){const r=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s)}function s(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Em={name:"codeIndented",tokenize:d8},u8={partial:!0,tokenize:p8};function d8(e,t,n){const r=this;return i;function i(m){return e.enter("codeIndented"),Ve(e,s,"linePrefix",5)(m)}function s(m){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?l(m):n(m)}function l(m){return m===null?f(m):Ae(m)?e.attempt(u8,l,f)(m):(e.enter("codeFlowValue"),u(m))}function u(m){return m===null||Ae(m)?(e.exit("codeFlowValue"),l(m)):(e.consume(m),u)}function f(m){return e.exit("codeIndented"),t(m)}}function p8(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):Ae(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):Ve(e,s,"linePrefix",5)(l)}function s(l){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):Ae(l)?i(l):n(l)}}const f8={name:"codeText",previous:h8,resolve:m8,tokenize:g8};function m8(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function h8(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function g8(e,t,n){let r=0,i,s;return l;function l(g){return e.enter("codeText"),e.enter("codeTextSequence"),u(g)}function u(g){return g===96?(e.consume(g),r++,u):(e.exit("codeTextSequence"),f(g))}function f(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),f):g===96?(s=e.enter("codeTextSequence"),i=0,h(g)):Ae(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),f):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||Ae(g)?(e.exit("codeTextData"),f(g)):(e.consume(g),m)}function h(g){return g===96?(e.consume(g),i++,h):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(s.type="codeTextData",m(g))}}class y8{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&_s(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),_s(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),_s(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);_s(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);_s(this.left,n.reverse())}}}function _s(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function qS(e){const t={};let n=-1,r,i,s,l,u,f,m;const h=new y8(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,s=0,s<f.length&&f[s][1].type==="lineEndingBlank"&&(s+=2),s<f.length&&f[s][1].type==="content"))for(;++s<f.length&&f[s][1].type!=="content";)f[s][1].type==="chunkText"&&(f[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,x8(h,n)),n=t[n],m=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(l=h.get(s),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=s);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...h.get(i)[1].start},u=h.slice(i,n),u.unshift(r),h.splice(i,n-i+1,u))}}return Tn(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function x8(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const u=l.events,f=[],m={};let h,g,b=-1,y=n,v=0,w=0;const E=[w];for(;y;){for(;e.get(++i)[1]!==y;);s.push(i),y._tokenizer||(h=r.sliceStream(y),y.next||h.push(null),g&&l.defineSkip(y.start),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(h),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),g=y,y=y.next}for(y=n;++b<u.length;)u[b][0]==="exit"&&u[b-1][0]==="enter"&&u[b][1].type===u[b-1][1].type&&u[b][1].start.line!==u[b][1].end.line&&(w=b+1,E.push(w),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(l.events=[],y?(y._tokenizer=void 0,y.previous=void 0):E.pop(),b=E.length;b--;){const C=u.slice(E[b],E[b+1]),M=s.pop();f.push([M,M+C.length-1]),e.splice(M,2,C)}for(f.reverse(),b=-1;++b<f.length;)m[v+f[b][0]]=v+f[b][1],v+=f[b][1]-f[b][0]-1;return m}const b8={resolve:v8,tokenize:w8},k8={partial:!0,tokenize:S8};function v8(e){return qS(e),e}function w8(e,t){let n;return r;function r(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(u)}function i(u){return u===null?s(u):Ae(u)?e.check(k8,l,s)(u):(e.consume(u),i)}function s(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function l(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function S8(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Ve(e,s,"linePrefix")}function s(l){if(l===null||Ae(l))return n(l);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function GS(e,t,n,r,i,s,l,u,f){const m=f||Number.POSITIVE_INFINITY;let h=0;return g;function g(C){return C===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(C),e.exit(s),b):C===null||C===32||C===41||Vu(C)?n(C):(e.enter(r),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),w(C))}function b(C){return C===62?(e.enter(s),e.consume(C),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===62?(e.exit("chunkString"),e.exit(u),b(C)):C===null||C===60||Ae(C)?n(C):(e.consume(C),C===92?v:y)}function v(C){return C===60||C===62||C===92?(e.consume(C),y):y(C)}function w(C){return!h&&(C===null||C===41||st(C))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),t(C)):h<m&&C===40?(e.consume(C),h++,w):C===41?(e.consume(C),h--,w):C===null||C===32||C===40||Vu(C)?n(C):(e.consume(C),C===92?E:w)}function E(C){return C===40||C===41||C===92?(e.consume(C),w):w(C)}}function KS(e,t,n,r,i,s){const l=this;let u=0,f;return m;function m(y){return e.enter(r),e.enter(i),e.consume(y),e.exit(i),e.enter(s),h}function h(y){return u>999||y===null||y===91||y===93&&!f||y===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?n(y):y===93?(e.exit(s),e.enter(i),e.consume(y),e.exit(i),e.exit(r),t):Ae(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===null||y===91||y===93||Ae(y)||u++>999?(e.exit("chunkString"),h(y)):(e.consume(y),f||(f=!He(y)),y===92?b:g)}function b(y){return y===91||y===92||y===93?(e.consume(y),u++,g):g(y)}}function VS(e,t,n,r,i,s){let l;return u;function u(b){return b===34||b===39||b===40?(e.enter(r),e.enter(i),e.consume(b),e.exit(i),l=b===40?41:b,f):n(b)}function f(b){return b===l?(e.enter(i),e.consume(b),e.exit(i),e.exit(r),t):(e.enter(s),m(b))}function m(b){return b===l?(e.exit(s),f(l)):b===null?n(b):Ae(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),Ve(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(b))}function h(b){return b===l||b===null||Ae(b)?(e.exit("chunkString"),m(b)):(e.consume(b),b===92?g:h)}function g(b){return b===l||b===92?(e.consume(b),h):h(b)}}function Gs(e,t){let n;return r;function r(i){return Ae(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):He(i)?Ve(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const C8={name:"definition",tokenize:M8},E8={partial:!0,tokenize:T8};function M8(e,t,n){const r=this;let i;return s;function s(y){return e.enter("definition"),l(y)}function l(y){return KS.call(r,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function u(y){return i=Jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),f):n(y)}function f(y){return st(y)?Gs(e,m)(y):m(y)}function m(y){return GS(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function h(y){return e.attempt(E8,g,g)(y)}function g(y){return He(y)?Ve(e,b,"whitespace")(y):b(y)}function b(y){return y===null||Ae(y)?(e.exit("definition"),r.parser.defined.push(i),t(y)):n(y)}}function T8(e,t,n){return r;function r(u){return st(u)?Gs(e,i)(u):n(u)}function i(u){return VS(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function s(u){return He(u)?Ve(e,l,"whitespace")(u):l(u)}function l(u){return u===null||Ae(u)?t(u):n(u)}}const j8={name:"hardBreakEscape",tokenize:A8};function A8(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Ae(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const N8={name:"headingAtx",resolve:_8,tokenize:D8};function _8(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Tn(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function D8(e,t,n){let r=0;return i;function i(h){return e.enter("atxHeading"),s(h)}function s(h){return e.enter("atxHeadingSequence"),l(h)}function l(h){return h===35&&r++<6?(e.consume(h),l):h===null||st(h)?(e.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(e.enter("atxHeadingSequence"),f(h)):h===null||Ae(h)?(e.exit("atxHeading"),t(h)):He(h)?Ve(e,u,"whitespace")(h):(e.enter("atxHeadingText"),m(h))}function f(h){return h===35?(e.consume(h),f):(e.exit("atxHeadingSequence"),u(h))}function m(h){return h===null||h===35||st(h)?(e.exit("atxHeadingText"),u(h)):(e.consume(h),m)}}const z8=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],dk=["pre","script","style","textarea"],R8={concrete:!0,name:"htmlFlow",resolveTo:F8,tokenize:$8},O8={partial:!0,tokenize:P8},I8={partial:!0,tokenize:L8};function F8(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function $8(e,t,n){const r=this;let i,s,l,u,f;return m;function m(z){return h(z)}function h(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),g}function g(z){return z===33?(e.consume(z),b):z===47?(e.consume(z),s=!0,w):z===63?(e.consume(z),i=3,r.interrupt?t:I):Jt(z)?(e.consume(z),l=String.fromCharCode(z),E):n(z)}function b(z){return z===45?(e.consume(z),i=2,y):z===91?(e.consume(z),i=5,u=0,v):Jt(z)?(e.consume(z),i=4,r.interrupt?t:I):n(z)}function y(z){return z===45?(e.consume(z),r.interrupt?t:I):n(z)}function v(z){const W="CDATA[";return z===W.charCodeAt(u++)?(e.consume(z),u===W.length?r.interrupt?t:Y:v):n(z)}function w(z){return Jt(z)?(e.consume(z),l=String.fromCharCode(z),E):n(z)}function E(z){if(z===null||z===47||z===62||st(z)){const W=z===47,ae=l.toLowerCase();return!W&&!s&&dk.includes(ae)?(i=1,r.interrupt?t(z):Y(z)):z8.includes(l.toLowerCase())?(i=6,W?(e.consume(z),C):r.interrupt?t(z):Y(z)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(z):s?M(z):S(z))}return z===45||Yt(z)?(e.consume(z),l+=String.fromCharCode(z),E):n(z)}function C(z){return z===62?(e.consume(z),r.interrupt?t:Y):n(z)}function M(z){return He(z)?(e.consume(z),M):B(z)}function S(z){return z===47?(e.consume(z),B):z===58||z===95||Jt(z)?(e.consume(z),N):He(z)?(e.consume(z),S):B(z)}function N(z){return z===45||z===46||z===58||z===95||Yt(z)?(e.consume(z),N):R(z)}function R(z){return z===61?(e.consume(z),T):He(z)?(e.consume(z),R):S(z)}function T(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),f=z,D):He(z)?(e.consume(z),T):H(z)}function D(z){return z===f?(e.consume(z),f=null,V):z===null||Ae(z)?n(z):(e.consume(z),D)}function H(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||st(z)?R(z):(e.consume(z),H)}function V(z){return z===47||z===62||He(z)?S(z):n(z)}function B(z){return z===62?(e.consume(z),O):n(z)}function O(z){return z===null||Ae(z)?Y(z):He(z)?(e.consume(z),O):n(z)}function Y(z){return z===45&&i===2?(e.consume(z),A):z===60&&i===1?(e.consume(z),q):z===62&&i===4?(e.consume(z),F):z===63&&i===3?(e.consume(z),I):z===93&&i===5?(e.consume(z),Q):Ae(z)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(O8,L,Z)(z)):z===null||Ae(z)?(e.exit("htmlFlowData"),Z(z)):(e.consume(z),Y)}function Z(z){return e.check(I8,U,L)(z)}function U(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),_}function _(z){return z===null||Ae(z)?Z(z):(e.enter("htmlFlowData"),Y(z))}function A(z){return z===45?(e.consume(z),I):Y(z)}function q(z){return z===47?(e.consume(z),l="",K):Y(z)}function K(z){if(z===62){const W=l.toLowerCase();return dk.includes(W)?(e.consume(z),F):Y(z)}return Jt(z)&&l.length<8?(e.consume(z),l+=String.fromCharCode(z),K):Y(z)}function Q(z){return z===93?(e.consume(z),I):Y(z)}function I(z){return z===62?(e.consume(z),F):z===45&&i===2?(e.consume(z),I):Y(z)}function F(z){return z===null||Ae(z)?(e.exit("htmlFlowData"),L(z)):(e.consume(z),F)}function L(z){return e.exit("htmlFlow"),t(z)}}function L8(e,t,n){const r=this;return i;function i(l){return Ae(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):n(l)}function s(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function P8(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(jl,t,n)}}const B8={name:"htmlText",tokenize:H8};function H8(e,t,n){const r=this;let i,s,l;return u;function u(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),f}function f(I){return I===33?(e.consume(I),m):I===47?(e.consume(I),R):I===63?(e.consume(I),S):Jt(I)?(e.consume(I),H):n(I)}function m(I){return I===45?(e.consume(I),h):I===91?(e.consume(I),s=0,v):Jt(I)?(e.consume(I),M):n(I)}function h(I){return I===45?(e.consume(I),y):n(I)}function g(I){return I===null?n(I):I===45?(e.consume(I),b):Ae(I)?(l=g,q(I)):(e.consume(I),g)}function b(I){return I===45?(e.consume(I),y):g(I)}function y(I){return I===62?A(I):I===45?b(I):g(I)}function v(I){const F="CDATA[";return I===F.charCodeAt(s++)?(e.consume(I),s===F.length?w:v):n(I)}function w(I){return I===null?n(I):I===93?(e.consume(I),E):Ae(I)?(l=w,q(I)):(e.consume(I),w)}function E(I){return I===93?(e.consume(I),C):w(I)}function C(I){return I===62?A(I):I===93?(e.consume(I),C):w(I)}function M(I){return I===null||I===62?A(I):Ae(I)?(l=M,q(I)):(e.consume(I),M)}function S(I){return I===null?n(I):I===63?(e.consume(I),N):Ae(I)?(l=S,q(I)):(e.consume(I),S)}function N(I){return I===62?A(I):S(I)}function R(I){return Jt(I)?(e.consume(I),T):n(I)}function T(I){return I===45||Yt(I)?(e.consume(I),T):D(I)}function D(I){return Ae(I)?(l=D,q(I)):He(I)?(e.consume(I),D):A(I)}function H(I){return I===45||Yt(I)?(e.consume(I),H):I===47||I===62||st(I)?V(I):n(I)}function V(I){return I===47?(e.consume(I),A):I===58||I===95||Jt(I)?(e.consume(I),B):Ae(I)?(l=V,q(I)):He(I)?(e.consume(I),V):A(I)}function B(I){return I===45||I===46||I===58||I===95||Yt(I)?(e.consume(I),B):O(I)}function O(I){return I===61?(e.consume(I),Y):Ae(I)?(l=O,q(I)):He(I)?(e.consume(I),O):V(I)}function Y(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),i=I,Z):Ae(I)?(l=Y,q(I)):He(I)?(e.consume(I),Y):(e.consume(I),U)}function Z(I){return I===i?(e.consume(I),i=void 0,_):I===null?n(I):Ae(I)?(l=Z,q(I)):(e.consume(I),Z)}function U(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||st(I)?V(I):(e.consume(I),U)}function _(I){return I===47||I===62||st(I)?V(I):n(I)}function A(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function q(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),K}function K(I){return He(I)?Ve(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):Q(I)}function Q(I){return e.enter("htmlTextData"),l(I)}}const ug={name:"labelEnd",resolveAll:K8,resolveTo:V8,tokenize:Y8},U8={tokenize:W8},q8={tokenize:X8},G8={tokenize:Z8};function K8(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Tn(e,0,e.length,n),e}function V8(e,t){let n=e.length,r=0,i,s,l,u;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const f={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[s][1].start},end:{...e[l][1].end}},h={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[l-2][1].start}};return u=[["enter",f,t],["enter",m,t]],u=Ln(u,e.slice(s+1,s+r+3)),u=Ln(u,[["enter",h,t]]),u=Ln(u,Ed(t.parser.constructs.insideSpan.null,e.slice(s+r+4,l-3),t)),u=Ln(u,[["exit",h,t],e[l-2],e[l-1],["exit",m,t]]),u=Ln(u,e.slice(l+1)),u=Ln(u,[["exit",f,t]]),Tn(e,s,e.length,u),e}function Y8(e,t,n){const r=this;let i=r.events.length,s,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return u;function u(b){return s?s._inactive?g(b):(l=r.parser.defined.includes(Jn(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),f):n(b)}function f(b){return b===40?e.attempt(U8,h,l?h:g)(b):b===91?e.attempt(q8,h,l?m:g)(b):l?h(b):g(b)}function m(b){return e.attempt(G8,h,g)(b)}function h(b){return t(b)}function g(b){return s._balanced=!0,n(b)}}function W8(e,t,n){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),i}function i(g){return st(g)?Gs(e,s)(g):s(g)}function s(g){return g===41?h(g):GS(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function l(g){return st(g)?Gs(e,f)(g):h(g)}function u(g){return n(g)}function f(g){return g===34||g===39||g===40?VS(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):h(g)}function m(g){return st(g)?Gs(e,h)(g):h(g)}function h(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function X8(e,t,n){const r=this;return i;function i(u){return KS.call(r,e,s,l,"reference","referenceMarker","referenceString")(u)}function s(u){return r.parser.defined.includes(Jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function l(u){return n(u)}}function Z8(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const Q8={name:"labelStartImage",resolveAll:ug.resolveAll,tokenize:J8};function J8(e,t,n){const r=this;return i;function i(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),s}function s(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),l):n(u)}function l(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const eI={name:"labelStartLink",resolveAll:ug.resolveAll,tokenize:tI};function tI(e,t,n){const r=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),s}function s(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Mm={name:"lineEnding",tokenize:nI};function nI(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ve(e,t,"linePrefix")}}const Au={name:"thematicBreak",tokenize:oI};function oI(e,t,n){let r=0,i;return s;function s(m){return e.enter("thematicBreak"),l(m)}function l(m){return i=m,u(m)}function u(m){return m===i?(e.enter("thematicBreakSequence"),f(m)):r>=3&&(m===null||Ae(m))?(e.exit("thematicBreak"),t(m)):n(m)}function f(m){return m===i?(e.consume(m),r++,f):(e.exit("thematicBreakSequence"),He(m)?Ve(e,u,"whitespace")(m):u(m))}}const un={continuation:{tokenize:sI},exit:cI,name:"list",tokenize:iI},rI={partial:!0,tokenize:uI},aI={partial:!0,tokenize:lI};function iI(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return u;function u(y){const v=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:fh(y)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Au,n,m)(y):m(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(y)}return n(y)}function f(y){return fh(y)&&++l<10?(e.consume(y),f):(!r.interrupt||l<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),m(y)):n(y)}function m(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(jl,r.interrupt?n:h,e.attempt(rI,b,g))}function h(y){return r.containerState.initialBlankLine=!0,s++,b(y)}function g(y){return He(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function sI(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(jl,i,s);function i(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ve(e,t,"listItemIndent",r.containerState.size+1)(u)}function s(u){return r.containerState.furtherBlankLines||!He(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(aI,t,l)(u))}function l(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ve(e,e.attempt(un,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function lI(e,t,n){const r=this;return Ve(e,i,"listItemIndent",r.containerState.size+1);function i(s){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(s):n(s)}}function cI(e){e.exit(this.containerState.type)}function uI(e,t,n){const r=this;return Ve(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const l=r.events[r.events.length-1];return!He(s)&&l&&l[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const pk={name:"setextUnderline",resolveTo:dI,tokenize:pI};function dI(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",l,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function pI(e,t,n){const r=this;let i;return s;function s(m){let h=r.events.length,g;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){g=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),i=m,l(m)):n(m)}function l(m){return e.enter("setextHeadingLineSequence"),u(m)}function u(m){return m===i?(e.consume(m),u):(e.exit("setextHeadingLineSequence"),He(m)?Ve(e,f,"lineSuffix")(m):f(m))}function f(m){return m===null||Ae(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const fI={tokenize:mI};function mI(e){const t=this,n=e.attempt(jl,r,e.attempt(this.parser.constructs.flowInitial,i,Ve(e,e.attempt(this.parser.constructs.flow,i,e.attempt(b8,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const hI={resolveAll:WS()},gI=YS("string"),yI=YS("text");function YS(e){return{resolveAll:WS(e==="text"?xI:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,l,u);return l;function l(h){return m(h)?s(h):u(h)}function u(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),f}function f(h){return m(h)?(n.exit("data"),s(h)):(n.consume(h),f)}function m(h){if(h===null)return!0;const g=i[h];let b=-1;if(g)for(;++b<g.length;){const y=g[b];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function WS(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function xI(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,l=-1,u=0,f;for(;s--;){const m=i[s];if(typeof m=="string"){for(l=m.length;m.charCodeAt(l-1)===32;)u++,l--;if(l)break;l=-1}else if(m===-2)f=!0,u++;else if(m!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const m={type:n===e.length||f||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?l:r.start._bufferIndex+l,_index:r.start._index+s,line:r.end.line,column:r.end.column-u,offset:r.end.offset-u},end:{...r.end}};r.end={...m.start},r.start.offset===r.end.offset?Object.assign(r,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const bI={42:un,43:un,45:un,48:un,49:un,50:un,51:un,52:un,53:un,54:un,55:un,56:un,57:un,62:BS},kI={91:C8},vI={[-2]:Em,[-1]:Em,32:Em},wI={35:N8,42:Au,45:[pk,Au],60:R8,61:pk,95:Au,96:uk,126:uk},SI={38:US,92:HS},CI={[-5]:Mm,[-4]:Mm,[-3]:Mm,33:Q8,38:US,42:mh,60:[e8,B8],91:eI,92:[j8,HS],93:ug,95:mh,96:f8},EI={null:[mh,hI]},MI={null:[42,95]},TI={null:[]},jI=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:MI,contentInitial:kI,disable:TI,document:bI,flow:wI,flowInitial:vI,insideSpan:EI,string:SI,text:CI},Symbol.toStringTag,{value:"Module"}));function AI(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let l=[],u=[];const f={attempt:D(R),check:D(T),consume:M,enter:S,exit:N,interrupt:D(T,{interrupt:!0})},m={code:null,containerState:{},defineSkip:w,events:[],now:v,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:g};let h=t.tokenize.call(m,f);return t.resolveAll&&s.push(t),m;function g(O){return l=Ln(l,O),E(),l[l.length-1]!==null?[]:(H(t,0),m.events=Ed(s,m.events,m),m.events)}function b(O,Y){return _I(y(O),Y)}function y(O){return NI(l,O)}function v(){const{_bufferIndex:O,_index:Y,line:Z,column:U,offset:_}=r;return{_bufferIndex:O,_index:Y,line:Z,column:U,offset:_}}function w(O){i[O.line]=O.column,B()}function E(){let O;for(;r._index<l.length;){const Y=l[r._index];if(typeof Y=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<Y.length;)C(Y.charCodeAt(r._bufferIndex));else C(Y)}}function C(O){h=h(O)}function M(O){Ae(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,B()):O!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),m.previous=O}function S(O,Y){const Z=Y||{};return Z.type=O,Z.start=v(),m.events.push(["enter",Z,m]),u.push(Z),Z}function N(O){const Y=u.pop();return Y.end=v(),m.events.push(["exit",Y,m]),Y}function R(O,Y){H(O,Y.from)}function T(O,Y){Y.restore()}function D(O,Y){return Z;function Z(U,_,A){let q,K,Q,I;return Array.isArray(U)?L(U):"tokenize"in U?L([U]):F(U);function F(le){return me;function me(G){const ce=G!==null&&le[G],be=G!==null&&le.null,we=[...Array.isArray(ce)?ce:ce?[ce]:[],...Array.isArray(be)?be:be?[be]:[]];return L(we)(G)}}function L(le){return q=le,K=0,le.length===0?A:z(le[K])}function z(le){return me;function me(G){return I=V(),Q=le,le.partial||(m.currentConstruct=le),le.name&&m.parser.constructs.disable.null.includes(le.name)?ae():le.tokenize.call(Y?Object.assign(Object.create(m),Y):m,f,W,ae)(G)}}function W(le){return O(Q,I),_}function ae(le){return I.restore(),++K<q.length?z(q[K]):A}}}function H(O,Y){O.resolveAll&&!s.includes(O)&&s.push(O),O.resolve&&Tn(m.events,Y,m.events.length-Y,O.resolve(m.events.slice(Y),m)),O.resolveTo&&(m.events=O.resolveTo(m.events,m))}function V(){const O=v(),Y=m.previous,Z=m.currentConstruct,U=m.events.length,_=Array.from(u);return{from:U,restore:A};function A(){r=O,m.previous=Y,m.currentConstruct=Z,m.events.length=U,u=_,B()}}function B(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function NI(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,s)];else{if(l=e.slice(n,i),r>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(r):l.shift()}s>0&&l.push(e[i].slice(0,s))}return l}function _I(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let l;if(typeof s=="string")l=s;else switch(s){case-5:{l="\r";break}case-4:{l=`
|
|
365
|
+
`;break}case-3:{l=`\r
|
|
366
|
+
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(s)}i=s===-2,r.push(l)}return r.join("")}function DI(e){const r={constructs:LS([jI,...(e||{}).extensions||[]]),content:i(VO),defined:[],document:i(WO),flow:i(fI),lazy:{},string:i(gI),text:i(yI)};return r;function i(s){return l;function l(u){return AI(r,s,u)}}}function zI(e){for(;!qS(e););return e}const fk=/[\0\t\n\r]/g;function RI(){let e=1,t="",n=!0,r;return i;function i(s,l,u){const f=[];let m,h,g,b,y;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(l||void 0).decode(s)),g=0,t="",n&&(s.charCodeAt(0)===65279&&g++,n=void 0);g<s.length;){if(fk.lastIndex=g,m=fk.exec(s),b=m&&m.index!==void 0?m.index:s.length,y=s.charCodeAt(b),!m){t=s.slice(g);break}if(y===10&&g===b&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),g<b&&(f.push(s.slice(g,b)),e+=b-g),y){case 0:{f.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,f.push(-2);e++<h;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:r=!0,e=1}g=b+1}return u&&(r&&f.push(-5),t&&f.push(t),f.push(null)),f}}const OI=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function II(e){return e.replace(OI,FI)}function FI(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return PS(n.slice(s?2:1),s?16:10)}return cg(n)||e}const XS={}.hasOwnProperty;function $I(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),LI(n)(zI(DI(n).document().write(RI()(e,t,!0))))}function LI(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(ht),autolinkProtocol:V,autolinkEmail:V,atxHeading:s(oe),blockQuote:s(be),characterEscape:V,characterReference:V,codeFenced:s(we),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(we,l),codeText:s(ve,l),codeTextData:V,data:V,codeFlowValue:V,definition:s(ke),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s(De),hardBreakEscape:s(xe),hardBreakTrailing:s(xe),htmlFlow:s(Oe,l),htmlFlowData:V,htmlText:s(Oe,l),htmlTextData:V,image:s(wt),label:l,link:s(ht),listItem:s(hn),listItemValue:b,listOrdered:s(St,g),listUnordered:s(St),paragraph:s(en),reference:z,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(oe),strong:s(gn),thematicBreak:s(Vo)},exit:{atxHeading:f(),atxHeadingSequence:R,autolink:f(),autolinkEmail:ce,autolinkProtocol:G,blockQuote:f(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:le,characterReference:me,codeFenced:f(E),codeFencedFence:w,codeFencedFenceInfo:y,codeFencedFenceMeta:v,codeFlowValue:B,codeIndented:f(C),codeText:f(_),codeTextData:B,data:B,definition:f(),definitionDestinationString:N,definitionLabelString:M,definitionTitleString:S,emphasis:f(),hardBreakEscape:f(Y),hardBreakTrailing:f(Y),htmlFlow:f(Z),htmlFlowData:B,htmlText:f(U),htmlTextData:B,image:f(q),label:Q,labelText:K,lineEnding:O,link:f(A),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:W,resourceDestinationString:I,resourceTitleString:F,resource:L,setextHeading:f(H),setextHeadingLineSequence:D,setextHeadingText:T,strong:f(),thematicBreak:f()}};ZS(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ue){let ye={type:"root",children:[]};const Ne={stack:[ye],tokenStack:[],config:t,enter:u,exit:m,buffer:l,resume:h,data:n},Le=[];let Ke=-1;for(;++Ke<ue.length;)if(ue[Ke][1].type==="listOrdered"||ue[Ke][1].type==="listUnordered")if(ue[Ke][0]==="enter")Le.push(Ke);else{const Zt=Le.pop();Ke=i(ue,Zt,Ke)}for(Ke=-1;++Ke<ue.length;){const Zt=t[ue[Ke][0]];XS.call(Zt,ue[Ke][1].type)&&Zt[ue[Ke][1].type].call(Object.assign({sliceSerialize:ue[Ke][2].sliceSerialize},Ne),ue[Ke][1])}if(Ne.tokenStack.length>0){const Zt=Ne.tokenStack[Ne.tokenStack.length-1];(Zt[1]||mk).call(Ne,void 0,Zt[0])}for(ye.position={start:Tr(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Tr(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Ke=-1;++Ke<t.transforms.length;)ye=t.transforms[Ke](ye)||ye;return ye}function i(ue,ye,Ne){let Le=ye-1,Ke=-1,Zt=!1,Un,Lt,xt,Gt;for(;++Le<=Ne;){const Qe=ue[Le];switch(Qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qe[0]==="enter"?Ke++:Ke--,Gt=void 0;break}case"lineEndingBlank":{Qe[0]==="enter"&&(Un&&!Gt&&!Ke&&!xt&&(xt=Le),Gt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Gt=void 0}if(!Ke&&Qe[0]==="enter"&&Qe[1].type==="listItemPrefix"||Ke===-1&&Qe[0]==="exit"&&(Qe[1].type==="listUnordered"||Qe[1].type==="listOrdered")){if(Un){let to=Le;for(Lt=void 0;to--;){const yn=ue[to];if(yn[1].type==="lineEnding"||yn[1].type==="lineEndingBlank"){if(yn[0]==="exit")continue;Lt&&(ue[Lt][1].type="lineEndingBlank",Zt=!0),yn[1].type="lineEnding",Lt=to}else if(!(yn[1].type==="linePrefix"||yn[1].type==="blockQuotePrefix"||yn[1].type==="blockQuotePrefixWhitespace"||yn[1].type==="blockQuoteMarker"||yn[1].type==="listItemIndent"))break}xt&&(!Lt||xt<Lt)&&(Un._spread=!0),Un.end=Object.assign({},Lt?ue[Lt][1].start:Qe[1].end),ue.splice(Lt||Le,0,["exit",Un,Qe[2]]),Le++,Ne++}if(Qe[1].type==="listItemPrefix"){const to={type:"listItem",_spread:!1,start:Object.assign({},Qe[1].start),end:void 0};Un=to,ue.splice(Le,0,["enter",to,Qe[2]]),Le++,Ne++,xt=void 0,Gt=!0}}}return ue[ye][1]._spread=Zt,Ne}function s(ue,ye){return Ne;function Ne(Le){u.call(this,ue(Le),Le),ye&&ye.call(this,Le)}}function l(){this.stack.push({type:"fragment",children:[]})}function u(ue,ye,Ne){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([ye,Ne||void 0]),ue.position={start:Tr(ye.start),end:void 0}}function f(ue){return ye;function ye(Ne){ue&&ue.call(this,Ne),m.call(this,Ne)}}function m(ue,ye){const Ne=this.stack.pop(),Le=this.tokenStack.pop();if(Le)Le[0].type!==ue.type&&(ye?ye.call(this,ue,Le[0]):(Le[1]||mk).call(this,ue,Le[0]));else throw new Error("Cannot close `"+ue.type+"` ("+qs({start:ue.start,end:ue.end})+"): it’s not open");Ne.position.end=Tr(ue.end)}function h(){return lg(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(ue){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=ue}function v(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=ue}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue.replace(/(\r?\n|\r)$/g,"")}function M(ue){const ye=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=ye,Ne.identifier=Jn(this.sliceSerialize(ue)).toLowerCase()}function S(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ue}function N(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ue}function R(ue){const ye=this.stack[this.stack.length-1];if(!ye.depth){const Ne=this.sliceSerialize(ue).length;ye.depth=Ne}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function D(ue){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function H(){this.data.setextHeadingSlurpLineEnding=void 0}function V(ue){const Ne=this.stack[this.stack.length-1].children;let Le=Ne[Ne.length-1];(!Le||Le.type!=="text")&&(Le=_t(),Le.position={start:Tr(ue.start),end:void 0},Ne.push(Le)),this.stack.push(Le)}function B(ue){const ye=this.stack.pop();ye.value+=this.sliceSerialize(ue),ye.position.end=Tr(ue.end)}function O(ue){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ne=ye.children[ye.children.length-1];Ne.position.end=Tr(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ye.type)&&(V.call(this,ue),B.call(this,ue))}function Y(){this.data.atHardBreak=!0}function Z(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function U(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function _(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function A(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ye,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function q(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ye,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function K(ue){const ye=this.sliceSerialize(ue),Ne=this.stack[this.stack.length-2];Ne.label=II(ye),Ne.identifier=Jn(ye).toLowerCase()}function Q(){const ue=this.stack[this.stack.length-1],ye=this.resume(),Ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ne.type==="link"){const Le=ue.children;Ne.children=Le}else Ne.alt=ye}function I(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ue}function F(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ue}function L(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function W(ue){const ye=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=ye,Ne.identifier=Jn(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function ae(ue){this.data.characterReferenceType=ue.type}function le(ue){const ye=this.sliceSerialize(ue),Ne=this.data.characterReferenceType;let Le;Ne?(Le=PS(ye,Ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Le=cg(ye);const Ke=this.stack[this.stack.length-1];Ke.value+=Le}function me(ue){const ye=this.stack.pop();ye.position.end=Tr(ue.end)}function G(ue){B.call(this,ue);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(ue)}function ce(ue){B.call(this,ue);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(ue)}function be(){return{type:"blockquote",children:[]}}function we(){return{type:"code",lang:null,meta:null,value:""}}function ve(){return{type:"inlineCode",value:""}}function ke(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function oe(){return{type:"heading",depth:0,children:[]}}function xe(){return{type:"break"}}function Oe(){return{type:"html",value:""}}function wt(){return{type:"image",title:null,url:"",alt:null}}function ht(){return{type:"link",title:null,url:"",children:[]}}function St(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function hn(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function en(){return{type:"paragraph",children:[]}}function gn(){return{type:"strong",children:[]}}function _t(){return{type:"text",value:""}}function Vo(){return{type:"thematicBreak"}}}function Tr(e){return{line:e.line,column:e.column,offset:e.offset}}function ZS(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ZS(e,r):PI(e,r)}}function PI(e,t){let n;for(n in t)if(XS.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function mk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+qs({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+qs({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+qs({start:t.start,end:t.end})+") is still open")}function BI(e){const t=this;t.parser=n;function n(r){return $I(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function HI(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function UI(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
367
|
+
`}]}function qI(e,t){const n=t.value?t.value+`
|
|
368
|
+
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function GI(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function KI(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function VI(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=ji(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let l,u=e.footnoteCounts.get(r);u===void 0?(u=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=s+1,u+=1,e.footnoteCounts.set(r,u);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,f);const m={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,m),e.applyData(t,m)}function YI(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function WI(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function QS(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function XI(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return QS(e,t);const i={src:ji(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function ZI(e,t){const n={src:ji(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function QI(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function JI(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return QS(e,t);const i={href:ji(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function eF(e,t){const n={href:ji(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function tF(e,t,n){const r=e.all(t),i=n?nF(n):JS(t),s={},l=[];if(typeof t.checked=="boolean"){const h=r[0];let g;h&&h.type==="element"&&h.tagName==="p"?g=h:(g={type:"element",tagName:"p",properties:{},children:[]},r.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const h=r[u];(i||u!==0||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
|
|
369
|
+
`}),h.type==="element"&&h.tagName==="p"&&!i?l.push(...h.children):l.push(h)}const f=r[r.length-1];f&&(i||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
|
|
370
|
+
`});const m={type:"element",tagName:"li",properties:s,children:l};return e.patch(t,m),e.applyData(t,m)}function nF(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=JS(n[r])}return t}function JS(e){const t=e.spread;return t??e.children.length>1}function oF(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const l=r[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function rF(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aF(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function iF(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sF(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=rg(t.children[1]),f=DS(t.children[t.children.length-1]);u&&f&&(l.position={start:u,end:f}),i.push(l)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function lF(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,u=l?l.length:t.children.length;let f=-1;const m=[];for(;++f<u;){const g=t.children[f],b={},y=l?l[f]:void 0;y&&(b.align=y);let v={type:"element",tagName:s,properties:b,children:[]};g&&(v.children=e.all(g),e.patch(g,v),v=e.applyData(g,v)),m.push(v)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,h),e.applyData(t,h)}function cF(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const hk=9,gk=32;function uF(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(yk(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(yk(t.slice(i),i>0,!1)),s.join("")}function yk(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===hk||s===gk;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===hk||s===gk;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function dF(e,t){const n={type:"text",value:uF(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function pF(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const fF={blockquote:HI,break:UI,code:qI,delete:GI,emphasis:KI,footnoteReference:VI,heading:YI,html:WI,imageReference:XI,image:ZI,inlineCode:QI,linkReference:JI,link:eF,listItem:tF,list:oF,paragraph:rF,root:aF,strong:iF,table:sF,tableCell:cF,tableRow:lF,text:dF,thematicBreak:pF,toml:hu,yaml:hu,definition:hu,footnoteDefinition:hu};function hu(){}const e2=-1,Md=0,Ks=1,Yu=2,dg=3,pg=4,fg=5,mg=6,t2=7,n2=8,xk=typeof self=="object"?self:globalThis,mF=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,l]=t[i];switch(s){case Md:case e2:return n(l,i);case Ks:{const u=n([],i);for(const f of l)u.push(r(f));return u}case Yu:{const u=n({},i);for(const[f,m]of l)u[r(f)]=r(m);return u}case dg:return n(new Date(l),i);case pg:{const{source:u,flags:f}=l;return n(new RegExp(u,f),i)}case fg:{const u=n(new Map,i);for(const[f,m]of l)u.set(r(f),r(m));return u}case mg:{const u=n(new Set,i);for(const f of l)u.add(r(f));return u}case t2:{const{name:u,message:f}=l;return n(new xk[u](f),i)}case n2:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:u}=new Uint8Array(l);return n(new DataView(u),l)}}return n(new xk[s](l),i)};return r},bk=e=>mF(new Map,e)(0),ii="",{toString:hF}={},{keys:gF}=Object,Ds=e=>{const t=typeof e;if(t!=="object"||!e)return[Md,t];const n=hF.call(e).slice(8,-1);switch(n){case"Array":return[Ks,ii];case"Object":return[Yu,ii];case"Date":return[dg,ii];case"RegExp":return[pg,ii];case"Map":return[fg,ii];case"Set":return[mg,ii];case"DataView":return[Ks,n]}return n.includes("Array")?[Ks,n]:n.includes("Error")?[t2,n]:[Yu,n]},gu=([e,t])=>e===Md&&(t==="function"||t==="symbol"),yF=(e,t,n,r)=>{const i=(l,u)=>{const f=r.push(l)-1;return n.set(u,f),f},s=l=>{if(n.has(l))return n.get(l);let[u,f]=Ds(l);switch(u){case Md:{let h=l;switch(f){case"bigint":u=n2,h=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);h=null;break;case"undefined":return i([e2],l)}return i([u,h],l)}case Ks:{if(f){let b=l;return f==="DataView"?b=new Uint8Array(l.buffer):f==="ArrayBuffer"&&(b=new Uint8Array(l)),i([f,[...b]],l)}const h=[],g=i([u,h],l);for(const b of l)h.push(s(b));return g}case Yu:{if(f)switch(f){case"BigInt":return i([f,l.toString()],l);case"Boolean":case"Number":case"String":return i([f,l.valueOf()],l)}if(t&&"toJSON"in l)return s(l.toJSON());const h=[],g=i([u,h],l);for(const b of gF(l))(e||!gu(Ds(l[b])))&&h.push([s(b),s(l[b])]);return g}case dg:return i([u,l.toISOString()],l);case pg:{const{source:h,flags:g}=l;return i([u,{source:h,flags:g}],l)}case fg:{const h=[],g=i([u,h],l);for(const[b,y]of l)(e||!(gu(Ds(b))||gu(Ds(y))))&&h.push([s(b),s(y)]);return g}case mg:{const h=[],g=i([u,h],l);for(const b of l)(e||!gu(Ds(b)))&&h.push(s(b));return g}}const{message:m}=l;return i([u,{name:f,message:m}],l)};return s},kk=(e,{json:t,lossy:n}={})=>{const r=[];return yF(!(t||n),!!t,new Map,r)(e),r},Wu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?bk(kk(e,t)):structuredClone(e):(e,t)=>bk(kk(e,t));function xF(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function bF(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function kF(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||xF,r=e.options.footnoteBackLabel||bF,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let f=-1;for(;++f<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[f]);if(!m)continue;const h=e.all(m),g=String(m.identifier).toUpperCase(),b=ji(g.toLowerCase());let y=0;const v=[],w=e.footnoteCounts.get(g);for(;w!==void 0&&++y<=w;){v.length>0&&v.push({type:"text",value:" "});let M=typeof n=="string"?n:n(f,y);typeof M=="string"&&(M={type:"text",value:M}),v.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,y),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}const E=h[h.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const M=E.children[E.children.length-1];M&&M.type==="text"?M.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...v)}else h.push(...v);const C={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(h,!0)};e.patch(m,C),u.push(C)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Wu(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
371
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
372
|
+
`}]}}const Td=(function(e){if(e==null)return CF;if(typeof e=="function")return jd(e);if(typeof e=="object")return Array.isArray(e)?vF(e):wF(e);if(typeof e=="string")return SF(e);throw new Error("Expected function, string, or object as test")});function vF(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Td(e[n]);return jd(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function wF(e){const t=e;return jd(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function SF(e){return jd(t);function t(n){return n&&n.type===e}}function jd(e){return t;function t(n,r,i){return!!(EF(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function CF(){return!0}function EF(e){return e!==null&&typeof e=="object"&&"type"in e}const o2=[],MF=!0,hh=!1,TF="skip";function r2(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=Td(i),l=r?-1:1;u(e,void 0,[])();function u(f,m,h){const g=f&&typeof f=="object"?f:{};if(typeof g.type=="string"){const y=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(f.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=o2,v,w,E;if((!t||s(f,m,h[h.length-1]||void 0))&&(y=jF(n(f,h)),y[0]===hh))return y;if("children"in f&&f.children){const C=f;if(C.children&&y[0]!==TF)for(w=(r?C.children.length:-1)+l,E=h.concat(C);w>-1&&w<C.children.length;){const M=C.children[w];if(v=u(M,w,E)(),v[0]===hh)return v;w=typeof v[1]=="number"?v[1]:w+l}}return y}}}function jF(e){return Array.isArray(e)?e:typeof e=="number"?[MF,e]:e==null?o2:[e]}function hg(e,t,n,r){let i,s,l;typeof t=="function"&&typeof n!="function"?(s=void 0,l=t,i=n):(s=t,l=n,i=r),r2(e,s,u,i);function u(f,m){const h=m[m.length-1],g=h?h.children.indexOf(f):void 0;return l(f,g,h)}}const gh={}.hasOwnProperty,AF={};function NF(e,t){const n=t||AF,r=new Map,i=new Map,s=new Map,l={...fF,...n.handlers},u={all:m,applyData:DF,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:l,one:f,options:n,patch:_F,wrap:RF};return hg(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const g=h.type==="definition"?r:i,b=String(h.identifier).toUpperCase();g.has(b)||g.set(b,h)}}),u;function f(h,g){const b=h.type,y=u.handlers[b];if(gh.call(u.handlers,b)&&y)return y(u,h,g);if(u.options.passThrough&&u.options.passThrough.includes(b)){if("children"in h){const{children:w,...E}=h,C=Wu(E);return C.children=u.all(h),C}return Wu(h)}return(u.options.unknownHandler||zF)(u,h,g)}function m(h){const g=[];if("children"in h){const b=h.children;let y=-1;for(;++y<b.length;){const v=u.one(b[y],h);if(v){if(y&&b[y-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=vk(v.value)),!Array.isArray(v)&&v.type==="element")){const w=v.children[0];w&&w.type==="text"&&(w.value=vk(w.value))}Array.isArray(v)?g.push(...v):g.push(v)}}}return g}}function _F(e,t){e.position&&(t.position=bO(e))}function DF(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&s&&Object.assign(n.properties,Wu(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function zF(e,t){const n=t.data||{},r="value"in t&&!(gh.call(n,"hProperties")||gh.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function RF(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
373
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
374
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
375
|
+
`}),n}function vk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function wk(e,t){const n=NF(e,t),r=n.one(e,void 0),i=kF(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
376
|
+
`},i),s}function OF(e,t){return e&&"run"in e?async function(n,r){const i=wk(n,{file:r,...t});await e.run(i,r)}:function(n,r){return wk(n,{file:r,...e||t})}}function Sk(e){if(e)throw e}var Tm,Ck;function IF(){if(Ck)return Tm;Ck=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},s=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var h=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!h&&!g)return!1;var b;for(b in m);return typeof b>"u"||e.call(m,b)},l=function(m,h){n&&h.name==="__proto__"?n(m,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):m[h.name]=h.newValue},u=function(m,h){if(h==="__proto__")if(e.call(m,h)){if(r)return r(m,h).value}else return;return m[h]};return Tm=function f(){var m,h,g,b,y,v,w=arguments[0],E=1,C=arguments.length,M=!1;for(typeof w=="boolean"&&(M=w,w=arguments[1]||{},E=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});E<C;++E)if(m=arguments[E],m!=null)for(h in m)g=u(w,h),b=u(m,h),w!==b&&(M&&b&&(s(b)||(y=i(b)))?(y?(y=!1,v=g&&i(g)?g:[]):v=g&&s(g)?g:{},l(w,{name:h,newValue:f(M,v,b)})):typeof b<"u"&&l(w,{name:h,newValue:b}));return w},Tm}var FF=IF();const jm=Qu(FF);function yh(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function $F(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...i);function u(f,...m){const h=e[++s];let g=-1;if(f){l(f);return}for(;++g<i.length;)(m[g]===null||m[g]===void 0)&&(m[g]=i[g]);i=m,h?LF(h,u)(...m):l(null,...m)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function LF(e,t){let n;return r;function r(...l){const u=e.length>l.length;let f;u&&l.push(i);try{f=e.apply(this,l)}catch(m){const h=m;if(u&&n)throw h;return i(h)}u||(f&&f.then&&typeof f.then=="function"?f.then(s,i):f instanceof Error?i(f):s(f))}function i(l,...u){n||(n=!0,t(l,...u))}function s(l){i(null,l)}}const lo={basename:PF,dirname:BF,extname:HF,join:UF,sep:"/"};function PF(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Al(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,u=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else l<0&&(s=!0,l=i+1),u>-1&&(e.codePointAt(i)===t.codePointAt(u--)?u<0&&(r=i):(u=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function BF(e){if(Al(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function HF(e){Al(e);let t=e.length,n=-1,r=0,i=-1,s=0,l;for(;t--;){const u=e.codePointAt(t);if(u===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),u===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function UF(...e){let t=-1,n;for(;++t<e.length;)Al(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":qF(n)}function qF(e){Al(e);const t=e.codePointAt(0)===47;let n=GF(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function GF(e,t){let n="",r=0,i=-1,s=0,l=-1,u,f;for(;++l<=e.length;){if(l<e.length)u=e.codePointAt(l);else{if(u===47)break;u=47}if(u===47){if(!(i===l-1||s===1))if(i!==l-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),i=l,s=0;continue}}else if(n.length>0){n="",r=0,i=l,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,l):n=e.slice(i+1,l),r=l-i-1;i=l,s=0}else u===46&&s>-1?s++:s=-1}return n}function Al(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const KF={cwd:VF};function VF(){return"/"}function xh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function YF(e){if(typeof e=="string")e=new URL(e);else if(!xh(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return WF(e)}function WF(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Am=["history","path","basename","stem","extname","dirname"];class a2{constructor(t){let n;t?xh(t)?n={path:t}:typeof t=="string"||XF(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":KF.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Am.length;){const s=Am[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)Am.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?lo.basename(this.path):void 0}set basename(t){_m(t,"basename"),Nm(t,"basename"),this.path=lo.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?lo.dirname(this.path):void 0}set dirname(t){Ek(this.basename,"dirname"),this.path=lo.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?lo.extname(this.path):void 0}set extname(t){if(Nm(t,"extname"),Ek(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=lo.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){xh(t)&&(t=YF(t)),_m(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?lo.basename(this.path,this.extname):void 0}set stem(t){_m(t,"stem"),Nm(t,"stem"),this.path=lo.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Xt(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Nm(e,t){if(e&&e.includes(lo.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+lo.sep+"`")}function _m(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ek(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function XF(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ZF=(function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),QF={}.hasOwnProperty;class gg extends ZF{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=$F()}copy(){const t=new gg;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(jm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Rm("data",this.frozen),this.namespace[t]=n,this):QF.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Rm("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=yu(t),r=this.parser||this.Parser;return Dm("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Dm("process",this.parser||this.Parser),zm("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,l){const u=yu(t),f=r.parse(u);r.run(f,u,function(h,g,b){if(h||!g||!b)return m(h);const y=g,v=r.stringify(y,b);t$(v)?b.value=v:b.result=v,m(h,b)});function m(h,g){h||!g?l(h):s?s(g):n(void 0,g)}}}processSync(t){let n=!1,r;return this.freeze(),Dm("processSync",this.parser||this.Parser),zm("processSync",this.compiler||this.Compiler),this.process(t,i),Tk("processSync","process",n),r;function i(s,l){n=!0,Sk(s),r=l}}run(t,n,r){Mk(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(l,u){const f=yu(n);i.run(t,f,m);function m(h,g,b){const y=g||t;h?u(h):l?l(y):r(void 0,y,b)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),Tk("runSync","run",r),i;function s(l,u){Sk(l),i=u,r=!0}}stringify(t,n){this.freeze();const r=yu(n),i=this.compiler||this.Compiler;return zm("stringify",i),Mk(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Rm("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(m){if(typeof m=="function")f(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[h,...g]=m;f(h,g)}else l(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function l(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(m.plugins),m.settings&&(i.settings=jm(!0,i.settings,m.settings))}function u(m){let h=-1;if(m!=null)if(Array.isArray(m))for(;++h<m.length;){const g=m[h];s(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function f(m,h){let g=-1,b=-1;for(;++g<r.length;)if(r[g][0]===m){b=g;break}if(b===-1)r.push([m,...h]);else if(h.length>0){let[y,...v]=h;const w=r[b][1];yh(w)&&yh(y)&&(y=jm(!0,w,y)),r[b]=[m,y,...v]}}}}const JF=new gg().freeze();function Dm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function zm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Rm(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Mk(e){if(!yh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Tk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function yu(e){return e$(e)?e:new a2(e)}function e$(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function t$(e){return typeof e=="string"||n$(e)}function n$(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const o$="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",jk=[],Ak={allowDangerousHtml:!0},r$=/^(https?|ircs?|mailto|xmpp)$/i,a$=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function i$(e){const t=s$(e),n=l$(e);return c$(t.runSync(t.parse(n),n),e)}function s$(e){const t=e.rehypePlugins||jk,n=e.remarkPlugins||jk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ak}:Ak;return JF().use(BI).use(n).use(OF,r).use(t)}function l$(e){const t=e.children||"",n=new a2;return typeof t=="string"&&(n.value=t),n}function c$(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,f=t.urlTransform||u$;for(const h of a$)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+o$+h.id,void 0);return hg(e,m),CO(e,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function m(h,g,b){if(h.type==="raw"&&b&&typeof g=="number")return l?b.children.splice(g,1):b.children[g]={type:"text",value:h.value},g;if(h.type==="element"){let y;for(y in Cm)if(Object.hasOwn(Cm,y)&&Object.hasOwn(h.properties,y)){const v=h.properties[y],w=Cm[y];(w===null||w.includes(h.tagName))&&(h.properties[y]=f(String(v||""),y,h))}}if(h.type==="element"){let y=n?!n.includes(h.tagName):s?s.includes(h.tagName):!1;if(!y&&r&&typeof g=="number"&&(y=!r(h,g,b)),y&&b&&typeof g=="number")return u&&h.children?b.children.splice(g,1,...h.children):b.children.splice(g,1),g}}}function u$(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||r$.test(e.slice(0,t))?e:""}function Nk(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function d$(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function p$(e,t,n){const i=Td((n||{}).ignore||[]),s=f$(t);let l=-1;for(;++l<s.length;)r2(e,"text",u);function u(m,h){let g=-1,b;for(;++g<h.length;){const y=h[g],v=b?b.children:void 0;if(i(y,v?v.indexOf(y):void 0,b))return;b=y}if(b)return f(m,h)}function f(m,h){const g=h[h.length-1],b=s[l][0],y=s[l][1];let v=0;const E=g.children.indexOf(m);let C=!1,M=[];b.lastIndex=0;let S=b.exec(m.value);for(;S;){const N=S.index,R={index:S.index,input:S.input,stack:[...h,m]};let T=y(...S,R);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?b.lastIndex=N+1:(v!==N&&M.push({type:"text",value:m.value.slice(v,N)}),Array.isArray(T)?M.push(...T):T&&M.push(T),v=N+S[0].length,C=!0),!b.global)break;S=b.exec(m.value)}return C?(v<m.value.length&&M.push({type:"text",value:m.value.slice(v)}),g.children.splice(E,1,...M)):M=[m],E+M.length}}function f$(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([m$(i[0]),h$(i[1])])}return t}function m$(e){return typeof e=="string"?new RegExp(d$(e),"g"):e}function h$(e){return typeof e=="function"?e:function(){return e}}const Om="phrasing",Im=["autolink","link","image","label"];function g$(){return{transforms:[S$],enter:{literalAutolink:x$,literalAutolinkEmail:Fm,literalAutolinkHttp:Fm,literalAutolinkWww:Fm},exit:{literalAutolink:w$,literalAutolinkEmail:v$,literalAutolinkHttp:b$,literalAutolinkWww:k$}}}function y$(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Om,notInConstruct:Im},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Om,notInConstruct:Im},{character:":",before:"[ps]",after:"\\/",inConstruct:Om,notInConstruct:Im}]}}function x$(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Fm(e){this.config.enter.autolinkProtocol.call(this,e)}function b$(e){this.config.exit.autolinkProtocol.call(this,e)}function k$(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function v$(e){this.config.exit.autolinkEmail.call(this,e)}function w$(e){this.exit(e)}function S$(e){p$(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,C$],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),E$]],{ignore:["link","linkReference"]})}function C$(e,t,n,r,i){let s="";if(!i2(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!M$(n)))return!1;const l=T$(n+r);if(!l[0])return!1;const u={type:"link",title:null,url:s+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function E$(e,t,n,r){return!i2(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function M$(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function T$(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=Nk(e,"(");let s=Nk(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function i2(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ha(n)||Cd(n))&&(!t||n!==47)}s2.peek=I$;function j$(){this.buffer()}function A$(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function N$(){this.buffer()}function _$(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function D$(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Jn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function z$(e){this.exit(e)}function R$(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Jn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function O$(e){this.exit(e)}function I$(){return"["}function s2(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const l=n.enter("footnoteReference"),u=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),u(),l(),s+=i.move("]"),s}function F$(){return{enter:{gfmFootnoteCallString:j$,gfmFootnoteCall:A$,gfmFootnoteDefinitionLabelString:N$,gfmFootnoteDefinition:_$},exit:{gfmFootnoteCallString:D$,gfmFootnoteCall:z$,gfmFootnoteDefinitionLabelString:R$,gfmFootnoteDefinition:O$}}}function $$(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:s2},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,l){const u=s.createTracker(l);let f=u.move("[^");const m=s.enter("footnoteDefinition"),h=s.enter("label");return f+=u.move(s.safe(s.associationId(r),{before:f,after:"]"})),h(),f+=u.move("]:"),r.children&&r.children.length>0&&(u.shift(4),f+=u.move((t?`
|
|
377
|
+
`:" ")+s.indentLines(s.containerFlow(r,u.current()),t?l2:L$))),m(),f}}function L$(e,t,n){return t===0?e:l2(e,t,n)}function l2(e,t,n){return(n?"":" ")+e}const P$=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];c2.peek=G$;function B$(){return{canContainEols:["delete"],enter:{strikethrough:U$},exit:{strikethrough:q$}}}function H$(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:P$}],handlers:{delete:c2}}}function U$(e){this.enter({type:"delete",children:[]},e)}function q$(e){this.exit(e)}function c2(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let l=i.move("~~");return l+=n.containerPhrasing(e,{...i.current(),before:l,after:"~"}),l+=i.move("~~"),s(),l}function G$(){return"~"}function K$(e){return e.length}function V$(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||K$,s=[],l=[],u=[],f=[];let m=0,h=-1;for(;++h<e.length;){const w=[],E=[];let C=-1;for(e[h].length>m&&(m=e[h].length);++C<e[h].length;){const M=Y$(e[h][C]);if(n.alignDelimiters!==!1){const S=i(M);E[C]=S,(f[C]===void 0||S>f[C])&&(f[C]=S)}w.push(M)}l[h]=w,u[h]=E}let g=-1;if(typeof r=="object"&&"length"in r)for(;++g<m;)s[g]=_k(r[g]);else{const w=_k(r);for(;++g<m;)s[g]=w}g=-1;const b=[],y=[];for(;++g<m;){const w=s[g];let E="",C="";w===99?(E=":",C=":"):w===108?E=":":w===114&&(C=":");let M=n.alignDelimiters===!1?1:Math.max(1,f[g]-E.length-C.length);const S=E+"-".repeat(M)+C;n.alignDelimiters!==!1&&(M=E.length+M+C.length,M>f[g]&&(f[g]=M),y[g]=M),b[g]=S}l.splice(1,0,b),u.splice(1,0,y),h=-1;const v=[];for(;++h<l.length;){const w=l[h],E=u[h];g=-1;const C=[];for(;++g<m;){const M=w[g]||"";let S="",N="";if(n.alignDelimiters!==!1){const R=f[g]-(E[g]||0),T=s[g];T===114?S=" ".repeat(R):T===99?R%2?(S=" ".repeat(R/2+.5),N=" ".repeat(R/2-.5)):(S=" ".repeat(R/2),N=S):N=" ".repeat(R)}n.delimiterStart!==!1&&!g&&C.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&M==="")&&(n.delimiterStart!==!1||g)&&C.push(" "),n.alignDelimiters!==!1&&C.push(S),C.push(M),n.alignDelimiters!==!1&&C.push(N),n.padding!==!1&&C.push(" "),(n.delimiterEnd!==!1||g!==m-1)&&C.push("|")}v.push(n.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return v.join(`
|
|
378
|
+
`)}function Y$(e){return e==null?"":String(e)}function _k(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function W$(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const l=n.indentLines(n.containerFlow(e,s.current()),X$);return i(),l}function X$(e,t,n){return">"+(n?"":" ")+e}function Z$(e,t){return Dk(e,t.inConstruct,!0)&&!Dk(e,t.notInConstruct,!1)}function Dk(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function zk(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
379
|
+
`&&Z$(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
380
|
+
`}function Q$(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>l&&(l=s):s=1,i=r+t.length,r=n.indexOf(t,i);return l}function J$(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function eL(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function tL(e,t,n,r){const i=eL(n),s=e.value||"",l=i==="`"?"GraveAccent":"Tilde";if(J$(e,n)){const g=n.enter("codeIndented"),b=n.indentLines(s,nL);return g(),b}const u=n.createTracker(r),f=i.repeat(Math.max(Q$(s,i)+1,3)),m=n.enter("codeFenced");let h=u.move(f);if(e.lang){const g=n.enter(`codeFencedLang${l}`);h+=u.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...u.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${l}`);h+=u.move(" "),h+=u.move(n.safe(e.meta,{before:h,after:`
|
|
381
|
+
`,encode:["`"],...u.current()})),g()}return h+=u.move(`
|
|
382
|
+
`),s&&(h+=u.move(s+`
|
|
383
|
+
`)),h+=u.move(f),m(),h}function nL(e,t,n){return(n?"":" ")+e}function yg(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function oL(e,t,n,r){const i=yg(n),s=i==='"'?"Quote":"Apostrophe",l=n.enter("definition");let u=n.enter("label");const f=n.createTracker(r);let m=f.move("[");return m+=f.move(n.safe(n.associationId(e),{before:m,after:"]",...f.current()})),m+=f.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),m+=f.move("<"),m+=f.move(n.safe(e.url,{before:m,after:">",...f.current()})),m+=f.move(">")):(u=n.enter("destinationRaw"),m+=f.move(n.safe(e.url,{before:m,after:e.title?" ":`
|
|
384
|
+
`,...f.current()}))),u(),e.title&&(u=n.enter(`title${s}`),m+=f.move(" "+i),m+=f.move(n.safe(e.title,{before:m,after:i,...f.current()})),m+=f.move(i),u()),l(),m}function rL(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function pl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Xu(e,t,n){const r=Ei(e),i=Ei(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}u2.peek=aL;function u2(e,t,n,r){const i=rL(n),s=n.enter("emphasis"),l=n.createTracker(r),u=l.move(i);let f=l.move(n.containerPhrasing(e,{after:i,before:u,...l.current()}));const m=f.charCodeAt(0),h=Xu(r.before.charCodeAt(r.before.length-1),m,i);h.inside&&(f=pl(m)+f.slice(1));const g=f.charCodeAt(f.length-1),b=Xu(r.after.charCodeAt(0),g,i);b.inside&&(f=f.slice(0,-1)+pl(g));const y=l.move(i);return s(),n.attentionEncodeSurroundingInfo={after:b.outside,before:h.outside},u+f+y}function aL(e,t,n){return n.options.emphasis||"*"}function iL(e,t){let n=!1;return hg(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,hh}),!!((!e.depth||e.depth<3)&&lg(e)&&(t.options.setext||n))}function sL(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(iL(e,n)){const h=n.enter("headingSetext"),g=n.enter("phrasing"),b=n.containerPhrasing(e,{...s.current(),before:`
|
|
385
|
+
`,after:`
|
|
386
|
+
`});return g(),h(),b+`
|
|
387
|
+
`+(i===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
388
|
+
`))+1))}const l="#".repeat(i),u=n.enter("headingAtx"),f=n.enter("phrasing");s.move(l+" ");let m=n.containerPhrasing(e,{before:"# ",after:`
|
|
389
|
+
`,...s.current()});return/^[\t ]/.test(m)&&(m=pl(m.charCodeAt(0))+m.slice(1)),m=m?l+" "+m:l,n.options.closeAtx&&(m+=" "+l),f(),u(),m}d2.peek=lL;function d2(e){return e.value||""}function lL(){return"<"}p2.peek=cL;function p2(e,t,n,r){const i=yg(n),s=i==='"'?"Quote":"Apostrophe",l=n.enter("image");let u=n.enter("label");const f=n.createTracker(r);let m=f.move("![");return m+=f.move(n.safe(e.alt,{before:m,after:"]",...f.current()})),m+=f.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),m+=f.move("<"),m+=f.move(n.safe(e.url,{before:m,after:">",...f.current()})),m+=f.move(">")):(u=n.enter("destinationRaw"),m+=f.move(n.safe(e.url,{before:m,after:e.title?" ":")",...f.current()}))),u(),e.title&&(u=n.enter(`title${s}`),m+=f.move(" "+i),m+=f.move(n.safe(e.title,{before:m,after:i,...f.current()})),m+=f.move(i),u()),m+=f.move(")"),l(),m}function cL(){return"!"}f2.peek=uL;function f2(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let l=n.enter("label");const u=n.createTracker(r);let f=u.move("![");const m=n.safe(e.alt,{before:f,after:"]",...u.current()});f+=u.move(m+"]["),l();const h=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:f,after:"]",...u.current()});return l(),n.stack=h,s(),i==="full"||!m||m!==g?f+=u.move(g+"]"):i==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function uL(){return"!"}m2.peek=dL;function m2(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const l=n.unsafe[s],u=n.compilePattern(l);let f;if(l.atBreak)for(;f=u.exec(r);){let m=f.index;r.charCodeAt(m)===10&&r.charCodeAt(m-1)===13&&m--,r=r.slice(0,m)+" "+r.slice(f.index+1)}}return i+r+i}function dL(){return"`"}function h2(e,t){const n=lg(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}g2.peek=pL;function g2(e,t,n,r){const i=yg(n),s=i==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let u,f;if(h2(e,n)){const h=n.stack;n.stack=[],u=n.enter("autolink");let g=l.move("<");return g+=l.move(n.containerPhrasing(e,{before:g,after:">",...l.current()})),g+=l.move(">"),u(),n.stack=h,g}u=n.enter("link"),f=n.enter("label");let m=l.move("[");return m+=l.move(n.containerPhrasing(e,{before:m,after:"](",...l.current()})),m+=l.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),m+=l.move("<"),m+=l.move(n.safe(e.url,{before:m,after:">",...l.current()})),m+=l.move(">")):(f=n.enter("destinationRaw"),m+=l.move(n.safe(e.url,{before:m,after:e.title?" ":")",...l.current()}))),f(),e.title&&(f=n.enter(`title${s}`),m+=l.move(" "+i),m+=l.move(n.safe(e.title,{before:m,after:i,...l.current()})),m+=l.move(i),f()),m+=l.move(")"),u(),m}function pL(e,t,n){return h2(e,n)?"<":"["}y2.peek=fL;function y2(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let l=n.enter("label");const u=n.createTracker(r);let f=u.move("[");const m=n.containerPhrasing(e,{before:f,after:"]",...u.current()});f+=u.move(m+"]["),l();const h=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:f,after:"]",...u.current()});return l(),n.stack=h,s(),i==="full"||!m||m!==g?f+=u.move(g+"]"):i==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function fL(){return"["}function xg(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function mL(e){const t=xg(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function hL(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function x2(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function gL(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let l=e.ordered?hL(n):xg(n);const u=e.ordered?l==="."?")":".":mL(n);let f=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),x2(n)===l&&h){let g=-1;for(;++g<e.children.length;){const b=e.children[g];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(l=u),n.bulletCurrent=l;const m=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=s,i(),m}function yL(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function xL(e,t,n,r){const i=yL(n);let s=n.bulletCurrent||xg(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let l=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const u=n.createTracker(r);u.move(s+" ".repeat(l-s.length)),u.shift(l);const f=n.enter("listItem"),m=n.indentLines(n.containerFlow(e,u.current()),h);return f(),m;function h(g,b,y){return b?(y?"":" ".repeat(l))+g:(y?s:s+" ".repeat(l-s.length))+g}}function bL(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),l=n.containerPhrasing(e,r);return s(),i(),l}const kL=Td(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function vL(e,t,n,r){return(e.children.some(function(l){return kL(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function wL(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}b2.peek=SL;function b2(e,t,n,r){const i=wL(n),s=n.enter("strong"),l=n.createTracker(r),u=l.move(i+i);let f=l.move(n.containerPhrasing(e,{after:i,before:u,...l.current()}));const m=f.charCodeAt(0),h=Xu(r.before.charCodeAt(r.before.length-1),m,i);h.inside&&(f=pl(m)+f.slice(1));const g=f.charCodeAt(f.length-1),b=Xu(r.after.charCodeAt(0),g,i);b.inside&&(f=f.slice(0,-1)+pl(g));const y=l.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:b.outside,before:h.outside},u+f+y}function SL(e,t,n){return n.options.strong||"*"}function CL(e,t,n,r){return n.safe(e.value,r)}function EL(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function ML(e,t,n){const r=(x2(n)+(n.options.ruleSpaces?" ":"")).repeat(EL(n));return n.options.ruleSpaces?r.slice(0,-1):r}const k2={blockquote:W$,break:zk,code:tL,definition:oL,emphasis:u2,hardBreak:zk,heading:sL,html:d2,image:p2,imageReference:f2,inlineCode:m2,link:g2,linkReference:y2,list:gL,listItem:xL,paragraph:bL,root:vL,strong:b2,text:CL,thematicBreak:ML};function TL(){return{enter:{table:jL,tableData:Rk,tableHeader:Rk,tableRow:NL},exit:{codeText:_L,table:AL,tableData:$m,tableHeader:$m,tableRow:$m}}}function jL(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function AL(e){this.exit(e),this.data.inTable=void 0}function NL(e){this.enter({type:"tableRow",children:[]},e)}function $m(e){this.exit(e)}function Rk(e){this.enter({type:"tableCell",children:[]},e)}function _L(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,DL));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function DL(e,t){return t==="|"?t:e}function zL(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
390
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:l,tableCell:f,tableRow:u}};function l(y,v,w,E){return m(h(y,w,E),y.align)}function u(y,v,w,E){const C=g(y,w,E),M=m([C]);return M.slice(0,M.indexOf(`
|
|
391
|
+
`))}function f(y,v,w,E){const C=w.enter("tableCell"),M=w.enter("phrasing"),S=w.containerPhrasing(y,{...E,before:s,after:s});return M(),C(),S}function m(y,v){return V$(y,{align:v,alignDelimiters:r,padding:n,stringLength:i})}function h(y,v,w){const E=y.children;let C=-1;const M=[],S=v.enter("table");for(;++C<E.length;)M[C]=g(E[C],v,w);return S(),M}function g(y,v,w){const E=y.children;let C=-1;const M=[],S=v.enter("tableRow");for(;++C<E.length;)M[C]=f(E[C],y,v,w);return S(),M}function b(y,v,w){let E=k2.inlineCode(y,v,w);return w.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function RL(){return{exit:{taskListCheckValueChecked:Ok,taskListCheckValueUnchecked:Ok,paragraph:IL}}}function OL(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:FL}}}function Ok(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function IL(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,l;for(;++s<i.length;){const u=i[s];if(u.type==="paragraph"){l=u;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function FL(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);s&&u.move(l);let f=k2.listItem(e,t,n,{...r,...u.current()});return s&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),f;function m(h){return h+l}}function $L(){return[g$(),F$(),B$(),TL(),RL()]}function LL(e){return{extensions:[y$(),$$(e),H$(),zL(e),OL()]}}const PL={tokenize:KL,partial:!0},v2={tokenize:VL,partial:!0},w2={tokenize:YL,partial:!0},S2={tokenize:WL,partial:!0},BL={tokenize:XL,partial:!0},C2={name:"wwwAutolink",tokenize:qL,previous:M2},E2={name:"protocolAutolink",tokenize:GL,previous:T2},Ko={name:"emailAutolink",tokenize:UL,previous:j2},go={};function HL(){return{text:go}}let na=48;for(;na<123;)go[na]=Ko,na++,na===58?na=65:na===91&&(na=97);go[43]=Ko;go[45]=Ko;go[46]=Ko;go[95]=Ko;go[72]=[Ko,E2];go[104]=[Ko,E2];go[87]=[Ko,C2];go[119]=[Ko,C2];function UL(e,t,n){const r=this;let i,s;return l;function l(g){return!bh(g)||!j2.call(r,r.previous)||bg(r.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(g))}function u(g){return bh(g)?(e.consume(g),u):g===64?(e.consume(g),f):n(g)}function f(g){return g===46?e.check(BL,h,m)(g):g===45||g===95||Yt(g)?(s=!0,e.consume(g),f):h(g)}function m(g){return e.consume(g),i=!0,f}function h(g){return s&&i&&Jt(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function qL(e,t,n){const r=this;return i;function i(l){return l!==87&&l!==119||!M2.call(r,r.previous)||bg(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(PL,e.attempt(v2,e.attempt(w2,s),n),n)(l))}function s(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function GL(e,t,n){const r=this;let i="",s=!1;return l;function l(g){return(g===72||g===104)&&T2.call(r,r.previous)&&!bg(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(g),e.consume(g),u):n(g)}function u(g){if(Jt(g)&&i.length<5)return i+=String.fromCodePoint(g),e.consume(g),u;if(g===58){const b=i.toLowerCase();if(b==="http"||b==="https")return e.consume(g),f}return n(g)}function f(g){return g===47?(e.consume(g),s?m:(s=!0,f)):n(g)}function m(g){return g===null||Vu(g)||st(g)||ha(g)||Cd(g)?n(g):e.attempt(v2,e.attempt(w2,h),n)(g)}function h(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function KL(e,t,n){let r=0;return i;function i(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),i):l===46&&r===3?(e.consume(l),s):n(l)}function s(l){return l===null?n(l):t(l)}}function VL(e,t,n){let r,i,s;return l;function l(m){return m===46||m===95?e.check(S2,f,u)(m):m===null||st(m)||ha(m)||m!==45&&Cd(m)?f(m):(s=!0,e.consume(m),l)}function u(m){return m===95?r=!0:(i=r,r=void 0),e.consume(m),l}function f(m){return i||r||!s?n(m):t(m)}}function YL(e,t){let n=0,r=0;return i;function i(l){return l===40?(n++,e.consume(l),i):l===41&&r<n?s(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(S2,t,s)(l):l===null||st(l)||ha(l)?t(l):(e.consume(l),i)}function s(l){return l===41&&r++,e.consume(l),i}}function WL(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),s):u===93?(e.consume(u),i):u===60||u===null||st(u)||ha(u)?t(u):n(u)}function i(u){return u===null||u===40||u===91||st(u)||ha(u)?t(u):r(u)}function s(u){return Jt(u)?l(u):n(u)}function l(u){return u===59?(e.consume(u),r):Jt(u)?(e.consume(u),l):n(u)}}function XL(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return Yt(s)?n(s):t(s)}}function M2(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||st(e)}function T2(e){return!Jt(e)}function j2(e){return!(e===47||bh(e))}function bh(e){return e===43||e===45||e===46||e===95||Yt(e)}function bg(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ZL={tokenize:aP,partial:!0};function QL(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:nP,continuation:{tokenize:oP},exit:rP}},text:{91:{name:"gfmFootnoteCall",tokenize:tP},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:JL,resolveTo:eP}}}}function JL(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const f=r.events[i][1];if(f.type==="labelImage"){l=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return u;function u(f){if(!l||!l._balanced)return n(f);const m=Jn(r.sliceSerialize({start:l.end,end:r.now()}));return m.codePointAt(0)!==94||!s.includes(m.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function eP(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function tP(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,l;return u;function u(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),f}function f(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(g){if(s>999||g===93&&!l||g===null||g===91||st(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return i.includes(Jn(r.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return st(g)||(l=!0),s++,e.consume(g),g===92?h:m}function h(g){return g===91||g===92||g===93?(e.consume(g),s++,m):m(g)}}function nP(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,l=0,u;return f;function f(v){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(v){return v===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(v)}function h(v){if(l>999||v===93&&!u||v===null||v===91||st(v))return n(v);if(v===93){e.exit("chunkString");const w=e.exit("gfmFootnoteDefinitionLabelString");return s=Jn(r.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return st(v)||(u=!0),l++,e.consume(v),v===92?g:h}function g(v){return v===91||v===92||v===93?(e.consume(v),l++,h):h(v)}function b(v){return v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),i.includes(s)||i.push(s),Ve(e,y,"gfmFootnoteDefinitionWhitespace")):n(v)}function y(v){return t(v)}}function oP(e,t,n){return e.check(jl,t,e.attempt(ZL,t,n))}function rP(e){e.exit("gfmFootnoteDefinition")}function aP(e,t,n){const r=this;return Ve(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(s):n(s)}}function iP(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(l,u){let f=-1;for(;++f<l.length;)if(l[f][0]==="enter"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._close){let m=f;for(;m--;)if(l[m][0]==="exit"&&l[m][1].type==="strikethroughSequenceTemporary"&&l[m][1]._open&&l[f][1].end.offset-l[f][1].start.offset===l[m][1].end.offset-l[m][1].start.offset){l[f][1].type="strikethroughSequence",l[m][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},l[m][1].start),end:Object.assign({},l[f][1].end)},g={type:"strikethroughText",start:Object.assign({},l[m][1].end),end:Object.assign({},l[f][1].start)},b=[["enter",h,u],["enter",l[m][1],u],["exit",l[m][1],u],["enter",g,u]],y=u.parser.constructs.insideSpan.null;y&&Tn(b,b.length,0,Ed(y,l.slice(m+1,f),u)),Tn(b,b.length,0,[["exit",g,u],["enter",l[f][1],u],["exit",l[f][1],u],["exit",h,u]]),Tn(l,m-1,f-m+3,b),f=m+b.length-2;break}}for(f=-1;++f<l.length;)l[f][1].type==="strikethroughSequenceTemporary"&&(l[f][1].type="data");return l}function s(l,u,f){const m=this.previous,h=this.events;let g=0;return b;function b(v){return m===126&&h[h.length-1][1].type!=="characterEscape"?f(v):(l.enter("strikethroughSequenceTemporary"),y(v))}function y(v){const w=Ei(m);if(v===126)return g>1?f(v):(l.consume(v),g++,y);if(g<2&&!n)return f(v);const E=l.exit("strikethroughSequenceTemporary"),C=Ei(v);return E._open=!C||C===2&&!!w,E._close=!w||w===2&&!!C,u(v)}}}class sP{constructor(){this.map=[]}add(t,n,r){lP(this,t,n,r)}consume(t){if(this.map.sort(function(s,l){return s[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function lP(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function cP(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function uP(){return{flow:{null:{name:"table",tokenize:dP,resolveAll:pP}}}}function dP(e,t,n){const r=this;let i=0,s=0,l;return u;function u(B){let O=r.events.length-1;for(;O>-1;){const U=r.events[O][1].type;if(U==="lineEnding"||U==="linePrefix")O--;else break}const Y=O>-1?r.events[O][1].type:null,Z=Y==="tableHead"||Y==="tableRow"?T:f;return Z===T&&r.parser.lazy[r.now().line]?n(B):Z(B)}function f(B){return e.enter("tableHead"),e.enter("tableRow"),m(B)}function m(B){return B===124||(l=!0,s+=1),h(B)}function h(B){return B===null?n(B):Ae(B)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),y):n(B):He(B)?Ve(e,h,"whitespace")(B):(s+=1,l&&(l=!1,i+=1),B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),l=!0,h):(e.enter("data"),g(B)))}function g(B){return B===null||B===124||st(B)?(e.exit("data"),h(B)):(e.consume(B),B===92?b:g)}function b(B){return B===92||B===124?(e.consume(B),g):g(B)}function y(B){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(B):(e.enter("tableDelimiterRow"),l=!1,He(B)?Ve(e,v,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):v(B))}function v(B){return B===45||B===58?E(B):B===124?(l=!0,e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),w):R(B)}function w(B){return He(B)?Ve(e,E,"whitespace")(B):E(B)}function E(B){return B===58?(s+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),C):B===45?(s+=1,C(B)):B===null||Ae(B)?N(B):R(B)}function C(B){return B===45?(e.enter("tableDelimiterFiller"),M(B)):R(B)}function M(B){return B===45?(e.consume(B),M):B===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(B))}function S(B){return He(B)?Ve(e,N,"whitespace")(B):N(B)}function N(B){return B===124?v(B):B===null||Ae(B)?!l||i!==s?R(B):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(B)):R(B)}function R(B){return n(B)}function T(B){return e.enter("tableRow"),D(B)}function D(B){return B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),D):B===null||Ae(B)?(e.exit("tableRow"),t(B)):He(B)?Ve(e,D,"whitespace")(B):(e.enter("data"),H(B))}function H(B){return B===null||B===124||st(B)?(e.exit("data"),D(B)):(e.consume(B),B===92?V:H)}function V(B){return B===92||B===124?(e.consume(B),H):H(B)}}function pP(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],l=[0,0,0,0],u=!1,f=0,m,h,g;const b=new sP;for(;++n<e.length;){const y=e[n],v=y[1];y[0]==="enter"?v.type==="tableHead"?(u=!1,f!==0&&(Ik(b,t,f,m,h),h=void 0,f=0),m={type:"table",start:Object.assign({},v.start),end:Object.assign({},v.end)},b.add(n,0,[["enter",m,t]])):v.type==="tableRow"||v.type==="tableDelimiterRow"?(r=!0,g=void 0,s=[0,0,0,0],l=[0,n+1,0,0],u&&(u=!1,h={type:"tableBody",start:Object.assign({},v.start),end:Object.assign({},v.end)},b.add(n,0,[["enter",h,t]])),i=v.type==="tableDelimiterRow"?2:h?3:1):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(s[1]!==0&&(l[0]=l[1],g=xu(b,t,s,i,void 0,g),s=[0,0,0,0]),l[2]=n)):v.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(l[0]=l[1],g=xu(b,t,s,i,void 0,g)),s=l,l=[s[1],n,0,0])):v.type==="tableHead"?(u=!0,f=n):v.type==="tableRow"||v.type==="tableDelimiterRow"?(f=n,s[1]!==0?(l[0]=l[1],g=xu(b,t,s,i,n,g)):l[1]!==0&&(g=xu(b,t,l,i,n,g)),i=0):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(l[3]=n)}for(f!==0&&Ik(b,t,f,m,h),b.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=cP(t.events,n))}return e}function xu(e,t,n,r,i,s){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(s.end=Object.assign({},si(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const f=si(t.events,n[1]);if(s={type:l,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const m=si(t.events,n[2]),h=si(t.events,n[3]),g={type:u,start:Object.assign({},m),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",g,t]]),r!==2){const b=t.events[n[2]],y=t.events[n[3]];if(b[1].end=Object.assign({},y[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const v=n[2]+1,w=n[3]-n[2]-1;e.add(v,w,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return i!==void 0&&(s.end=Object.assign({},si(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Ik(e,t,n,r,i){const s=[],l=si(t.events,n);i&&(i.end=Object.assign({},l),s.push(["exit",i,t])),r.end=Object.assign({},l),s.push(["exit",r,t]),e.add(n+1,0,s)}function si(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const fP={name:"tasklistCheck",tokenize:hP};function mP(){return{text:{91:fP}}}function hP(e,t,n){const r=this;return i;function i(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),s)}function s(f){return st(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),l):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),l):n(f)}function l(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(f)}function u(f){return Ae(f)?t(f):He(f)?e.check({tokenize:gP},t,n)(f):n(f)}}function gP(e,t,n){return Ve(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function yP(e){return LS([HL(),QL(),iP(e),uP(),mP()])}const xP={};function bP(e){const t=this,n=e||xP,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(yP(n)),s.push($L()),l.push(LL(n))}function Nu(e){return e?e.includes(`
|
|
392
|
+
`)?`|
|
|
393
|
+
${e.split(`
|
|
394
|
+
`).map(t=>" "+t).join(`
|
|
395
|
+
`)}`:/[:#"'{}\[\],&*?|>!%@`]/.test(e)?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:e:'""'}function Fk(e,t=0){const n=" ".repeat(t);return e.map(r=>`${n}- ${Nu(r)}`).join(`
|
|
396
|
+
`)}function kP(e){const t=e.agentMeta,n=e.agentConfig,r=[];return r.push(`name: ${Nu(t.name||"Untitled Agent")}`),t.description&&r.push(`description: ${Nu(t.description)}`),r.push('version: "1.0.0"'),t.tags?.length&&r.push(`tags:
|
|
397
|
+
${Fk(t.tags)}`),t.avatar&&r.push(`avatar: ${t.avatar}`),t.icon&&r.push(`icon: ${t.icon}`),r.push(""),r.push("# Runtime"),r.push(`model: ${Nu(e.selectedModel)}`),n?.temperature!==void 0&&r.push(`temperature: ${n.temperature}`),n?.planningMode&&r.push(`planning: ${n.planningMode}`),r.push(`token_budget: ${e.tokenBudget}`),r.push(""),r.push("# Output"),r.push(`output_format: ${e.outputFormat}`),e.outputFormats.length>1&&r.push(`output_formats:
|
|
398
|
+
${Fk(e.outputFormats)}`),r.join(`
|
|
399
|
+
`)+`
|
|
400
|
+
`}function vP(e){const t=e.instructionState,n=e.agentMeta,r=[];if(r.push(`# ${n.name||"Agent"}`),r.push(""),n.description&&(r.push(n.description),r.push("")),t?.persona&&(r.push("## Persona"),r.push(""),r.push(t.persona),r.push("")),t?.tone&&t.tone!=="neutral"&&(r.push(`**Tone:** ${t.tone}`),r.push("")),t?.expertise&&t.expertise!==3){const i=["Beginner","Novice","Intermediate","Advanced","Expert"];r.push(`**Expertise:** ${i[t.expertise-1]} (${t.expertise}/5)`),r.push("")}return r.join(`
|
|
401
|
+
`)}function wP(e){const t=e.instructionState,n=["# Instructions",""];t?.objectives?.primary&&(n.push("## Objective"),n.push(""),n.push(t.objectives.primary),n.push(""),t.objectives.successCriteria.length>0&&(n.push("### Success Criteria"),n.push(""),t.objectives.successCriteria.forEach(i=>n.push(`- ${i}`)),n.push("")),t.objectives.failureModes.length>0&&(n.push("### Failure Modes to Avoid"),n.push(""),t.objectives.failureModes.forEach(i=>n.push(`- ${i}`)),n.push("")));const r=[];if(t?.constraints){const i=t.constraints;i.neverMakeUp&&r.push("Never fabricate information or make up facts"),i.askBeforeActions&&r.push("Ask for permission before taking significant actions"),i.stayInScope&&r.push(`Stay within scope${i.scopeDefinition?": "+i.scopeDefinition:""}`),i.useOnlyTools&&r.push("Only use tools and capabilities that are explicitly provided"),i.limitWords&&r.push(`Keep responses under ${i.wordLimit} words`),i.customConstraints&&i.customConstraints.split(`
|
|
402
|
+
`).filter(Boolean).forEach(s=>r.push(s.trim()))}return r.length>0&&(n.push("## Constraints"),n.push(""),r.forEach(i=>n.push(`- ${i}`)),n.push("")),e.workflowSteps&&e.workflowSteps.length>0&&(n.push("## Workflow"),n.push(""),e.workflowSteps.forEach((i,s)=>{n.push(`${s+1}. **${i.label}** — ${i.action}`)}),n.push("")),e.prompt&&!t?.persona&&!t?.objectives?.primary&&(n.push("## Additional Instructions"),n.push(""),n.push(e.prompt),n.push("")),n.join(`
|
|
403
|
+
`)}function SP(e){const t=["# Tools",""],n=e.mcpServers.filter(i=>i.enabled&&i.added),r=e.skills.filter(i=>i.enabled&&i.added);return n.length>0&&(t.push("## MCP Servers"),t.push(""),n.forEach(i=>{t.push(`### ${i.name}`),t.push(""),i.description&&t.push(i.description),t.push(""),t.push("```yaml"),t.push(`id: ${i.id}`),t.push("transport: stdio"),t.push("command: npx"),t.push(`args: ["@${i.id}/mcp"]`),t.push("```"),t.push("")})),r.length>0&&(t.push("## Skills"),t.push(""),r.forEach(i=>{t.push(`- **${i.name}**${i.description?" — "+i.description:""}`)}),t.push("")),n.length===0&&r.length===0&&(t.push("No tools configured."),t.push("")),t.join(`
|
|
404
|
+
`)}function CP(e){const t=["# Knowledge",""],n=e.channels.filter(i=>i.enabled),r=(e.connectors??[]).filter(i=>i.enabled);return n.length>0&&(t.push("## Sources"),t.push(""),n.forEach(i=>{const s=i.knowledgeType||"signal";t.push(`### ${i.name||i.path}`),t.push(""),t.push(`- **Path:** \`${i.path}\``),t.push(`- **Type:** ${s}`),i.content&&t.push(`- **Content Preview:** ${i.content.slice(0,100)}${i.content.length>100?"...":""}`),i.hint&&t.push(`- **Hint:** ${i.hint}`),t.push("")})),r.length>0&&(t.push("## Connectors"),t.push(""),r.forEach(i=>{t.push(`- **${i.name}** (${i.service}) — ${i.direction}${i.hint?", scope: "+i.hint:""}`)}),t.push("")),t.push("## Budget"),t.push(""),t.push(`Token budget: ${e.tokenBudget}`),t.push(""),t.join(`
|
|
405
|
+
`)}function EP(e){return["# Memory","","<!-- Initial memory for this agent. Add seed context, key facts, or preferences here. -->",""].join(`
|
|
406
|
+
`)}function A2(e){return{"agent.yaml":kP(e),"SOUL.md":vP(e),"INSTRUCTIONS.md":wP(e),"TOOLS.md":SP(e),"KNOWLEDGE.md":CP(e),"MEMORY.md":EP()}}async function MP(e){const t=A2(e),n=(e.agentMeta.name||"modular-agent").toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"");try{const r=(await Ho(async()=>{const{default:m}=await import("./jszip.min-BK6ZQWkj.js").then(h=>h.j);return{default:m}},[])).default,i=new r,s=i.folder(n);for(const[m,h]of Object.entries(t))s.file(m,h);const l=await i.generateAsync({type:"blob"}),u=URL.createObjectURL(l),f=document.createElement("a");f.href=u,f.download=`${n}.zip`,f.click(),URL.revokeObjectURL(u)}catch{for(const[r,i]of Object.entries(t)){const s=new Blob([i],{type:"text/plain"}),l=URL.createObjectURL(s),u=document.createElement("a");u.href=l,u.download=r,u.click(),URL.revokeObjectURL(l)}}}function N2(e){const t={};return e["agent.yaml"]&&(t.agentYaml=_2(e["agent.yaml"])),e["SOUL.md"]&&(t.soul=e["SOUL.md"]),e["INSTRUCTIONS.md"]&&(t.instructions=e["INSTRUCTIONS.md"]),e["TOOLS.md"]&&(t.tools=e["TOOLS.md"]),e["KNOWLEDGE.md"]&&(t.knowledge=e["KNOWLEDGE.md"]),e["MEMORY.md"]&&(t.memory=e["MEMORY.md"]),t}function _2(e){const t={};let n=null,r="";for(const i of e.split(`
|
|
407
|
+
`)){const s=i.trim();if(!s||s.startsWith("#"))continue;if(s.startsWith("- ")&&n!==null){n.push(s.slice(2).replace(/^["']|["']$/g,"")),t[r]=n;continue}n=null;const l=s.indexOf(":");if(l===-1)continue;const u=s.slice(0,l).trim();if(u==="__proto__"||u==="constructor"||u==="prototype")continue;const f=s.slice(l+1).trim();if(!f){r=u,n=[];continue}const m=f.replace(/^["']|["']$/g,"");m==="true"?t[u]=!0:m==="false"?t[u]=!1:/^\d+(\.\d+)?$/.test(m)?t[u]=Number(m):t[u]=m}return t}function D2(e){const t={};if(e.agentYaml){const n=e.agentYaml;t.agentMeta={name:n.name||"",description:n.description||"",avatar:n.avatar||"",icon:n.icon||"",category:n.category||"general",tags:Array.isArray(n.tags)?n.tags:[]},n.model&&(t.selectedModel=n.model),n.token_budget&&(t.tokenBudget=n.token_budget),n.output_format&&(t.outputFormat=n.output_format),t.agentConfig={temperature:n.temperature??.7,planningMode:n.planning??"single-shot",model:n.model??""}}if(e.soul||e.instructions){const n={persona:"",tone:"neutral",expertise:3,constraints:{neverMakeUp:!1,askBeforeActions:!1,stayInScope:!1,useOnlyTools:!1,limitWords:!1,wordLimit:500,customConstraints:"",scopeDefinition:""},objectives:{primary:"",successCriteria:[],failureModes:[]},rawPrompt:"",autoSync:!1};if(e.soul){const r=e.soul.split(`
|
|
408
|
+
`);let i="",s="";for(const l of r){const u=l.trim();u.startsWith("## ")?(i==="persona"&&s.trim()&&(n.persona=s.trim()),i=u.toLowerCase().includes("persona")?"persona":"",s=""):!u.startsWith("#")&&u&&(i||!n.persona)&&(s+=l+`
|
|
409
|
+
`,!n.persona&&!i&&(n.persona=s.trim()))}i==="persona"&&s.trim()&&(n.persona=s.trim())}if(e.instructions){const r=e.instructions.split(`
|
|
410
|
+
`);let i="",s=!1,l=[];for(const u of r){const f=u.trim();if(f.startsWith("## ")){i==="successCriteria"&&l.length>0?n.objectives.successCriteria=l:i==="failureModes"&&l.length>0&&(n.objectives.failureModes=l);const m=f.toLowerCase();m.includes("objective")?i="objective":m.includes("constraint")&&(i="constraints"),s=!1,l=[]}else if(f.startsWith("### ")){const m=f.toLowerCase();m.includes("success")?(i="successCriteria",s=!0,l=[]):m.includes("failure")&&(i="failureModes",s=!0,l=[])}else if(f.startsWith("- ")){if(s)l.push(f.substring(2));else if(i==="constraints"){const m=f.substring(2);if((m.toLowerCase().includes("never fabricate")||m.toLowerCase().includes("never make up"))&&(n.constraints.neverMakeUp=!0),m.toLowerCase().includes("ask")&&m.toLowerCase().includes("permission")&&(n.constraints.askBeforeActions=!0),m.toLowerCase().includes("scope")&&(n.constraints.stayInScope=!0),m.toLowerCase().includes("only use tools")&&(n.constraints.useOnlyTools=!0),m.toLowerCase().includes("word")&&/\d+/.test(m)){n.constraints.limitWords=!0;const h=m.match(/(\d+)/);h&&(n.constraints.wordLimit=parseInt(h[1]))}}}else i==="objective"&&f&&!f.startsWith("#")&&(n.objectives.primary||(n.objectives.primary=f))}i==="successCriteria"&&l.length>0?n.objectives.successCriteria=l:i==="failureModes"&&l.length>0&&(n.objectives.failureModes=l)}t.instructionState=n}return t}async function z2(e){try{const t=(await Ho(async()=>{const{default:b}=await import("./jszip.min-BK6ZQWkj.js").then(y=>y.j);return{default:b}},[])).default,n=new t,r=10*1024*1024;if(e.size>r)throw new Error(`ZIP file too large (${(e.size/1024/1024).toFixed(1)}MB). Maximum is 10MB.`);const i=await n.loadAsync(e),s=2*1024*1024,l={},u=["agent.yaml","SOUL.md","INSTRUCTIONS.md","TOOLS.md","KNOWLEDGE.md","MEMORY.md"];for(const[b,y]of Object.entries(i.files)){if(y.dir)continue;const v=b.split("/").pop()||"";if(u.includes(v))try{const w=await y.async("text");if(w.length>s){console.warn(`Skipping ${v}: exceeds 2MB limit`);continue}l[v]=w}catch(w){console.warn(`Failed to read ${v}:`,w)}}if(!l["agent.yaml"])throw new Error("agent.yaml is required but not found in the ZIP file");const f=N2(l),m=D2(f),{useConsoleStore:h}=await Ho(async()=>{const{useConsoleStore:b}=await Promise.resolve().then(()=>fS);return{useConsoleStore:b}},void 0);h.getState().restoreFullState(m)}catch(t){throw console.error("Import failed:",t),t instanceof Error?t:new Error("Unknown import error")}}const TP=Object.freeze(Object.defineProperty({__proto__:null,agentDirectoryToState:D2,downloadAgentDirectory:MP,exportAgentDirectory:A2,importAgentFromZip:z2,parseAgentDirectory:N2,parseSimpleYaml:_2},Symbol.toStringTag,{value:"Module"}));function $k(){return`${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function jP(e){let t=0,n=0,r=0,i=0,s=0;const l=e.map(f=>f.timestamp),u=l.length>=2?Math.max(...l)-Math.min(...l):0;for(const f of e)f.kind==="llm_call"&&(t+=(f.inputTokens||0)+(f.outputTokens||0),n+=f.costUsd||0),f.kind==="tool_call"&&(r++,f.toolError&&i++),f.kind==="retrieval"&&s++;return{totalTokens:t,totalCostUsd:n,toolCalls:r,toolErrors:i,retrievals:s,durationMs:u}}const Hn=fn((e,t)=>({traces:[],activeTraceId:null,maxTraces:50,startTrace:(n,r)=>{const i=`trace-${$k()}`,s={id:i,conversationId:n,agentVersion:r,startedAt:Date.now(),events:[]};return e(l=>({traces:[...l.traces,s].slice(-l.maxTraces),activeTraceId:i})),i},addEvent:(n,r)=>e(i=>({traces:i.traces.map(s=>s.id===n?{...s,events:[...s.events,{...r,id:$k(),timestamp:Date.now()}]}:s)})),endTrace:n=>e(r=>({traces:r.traces.map(i=>i.id===n?{...i,summary:jP(i.events)}:i),activeTraceId:r.activeTraceId===n?null:r.activeTraceId})),getTrace:n=>t().traces.find(r=>r.id===n),getActiveTrace:()=>{const n=t().activeTraceId;return n?t().traces.find(r=>r.id===n):void 0},clearTraces:()=>e({traces:[],activeTraceId:null})}));function AP(e){const t=e.toLowerCase();return["what is","where is","how does","who is","when did","which","define","explain"].some(i=>t.includes(i))||/["'`].+["'`]/.test(e)||/[A-Z][a-z]+[A-Z]/.test(e)||/[A-Z_]{3,}/.test(e)?"specific":["summarize","summary","overview","what happened","recap","yesterday","last week","last month","today","recently","so far","progress","status update"].some(i=>t.includes(i))?"summary":"exploratory"}const NP={fact:1,episode:.8,raw:.6};function _P(e,t){if(e.length!==t.length||e.length===0)return 0;let n=0,r=0,i=0;for(let l=0;l<e.length;l++)n+=e[l]*t[l],r+=e[l]*e[l],i+=t[l]*t[l];const s=Math.sqrt(r)*Math.sqrt(i);return s===0?0:n/s}async function DP(e){try{const t=await fetch("/api/knowledge/embed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({texts:[e]})});return t.ok?(await t.json()).embeddings?.[0]??null:null}catch{return null}}async function R2(e){const t=Date.now(),n=rt.getState(),{longTerm:r,sandbox:i}=n;if(!r.enabled)return{facts:[],contextBlock:"",tokenEstimate:0,durationMs:0};let s=n.getRecallableFacts(e.agentId);i.isolation==="reset_each_run"?s=s.filter(D=>D.domain!=="run_scratchpad"):i.isolation==="clone_from_shared"&&(s=s.filter(D=>D.domain==="shared"));const l=AP(e.userMessage),u={specific:{k:3,granularityBoost:{fact:1.3,episode:.7,raw:.5}},summary:{k:5,granularityBoost:{fact:.8,episode:1.3,raw:.6}},exploratory:{k:8,granularityBoost:{fact:1,episode:1,raw:1}}},{k:f,granularityBoost:m}=u[l],h=s.some(D=>D.embedding&&D.embedding.length>0);let g=null;h&&(g=await DP(e.userMessage));const b=s.map(D=>{let H;g&&D.embedding&&D.embedding.length>0?H=_P(g,D.embedding):H=OP(D.content,e.userMessage);const V=NP[D.granularity??"fact"],B=m[D.granularity??"fact"]??1;return{fact:D,score:H*V*B}}),{strategy:y,k:v,minScore:w}=r.recall,E=Math.min(f,v||f);let C;y==="threshold"?C=b.filter(D=>D.score>=w).sort((D,H)=>H.score-D.score):y==="hybrid"?C=b.filter(D=>D.score>=w).sort((D,H)=>H.score-D.score).slice(0,E):C=b.sort((D,H)=>H.score-D.score).slice(0,E);const M=C.map(D=>D.fact),S=IP(M),N=Math.ceil(S.length/4),R=Date.now()-t;return Hn.getState().addEvent(e.traceId,{kind:"memory_recall",sourceName:"memory:pre-recall",memoryFactCount:M.length,memoryFactIds:M.map(D=>D.id),memoryDomain:M.length>0?[...new Set(M.map(D=>D.domain))].join(","):void 0,durationMs:R}),{facts:M,contextBlock:S,tokenEstimate:N,durationMs:R}}function zP(e){const t=Date.now(),n=rt.getState(),{longTerm:r,sandbox:i}=n;if(!r.enabled||!e.assistantResponse)return{extracted:[],stored:[],durationMs:0};const{write:s}=r;if(s.mode==="explicit")return{extracted:[],stored:[],durationMs:0};const l=FP(e.assistantResponse,e.userMessage,s.extractTypes),u=BP(i.isolation,e.sandboxRunId),f=[];for(const g of l){if(g.confidence<.5)continue;const b=HP(u,i),v={decisions:"decision",user_preferences:"preference",facts:"fact",feedback:"fact",entities:"entity"}[g.type]||g.type;n.addFact(g.content,[g.type],v,b,"fact",e.agentId);const w=rt.getState().facts,E=w[w.length-1];E&&f.push(E)}const m=Date.now()-t;return Hn.getState().addEvent(e.traceId,{kind:"memory_write",sourceName:"memory:post-write",memoryFactCount:f.length,memoryFactIds:f.map(g=>g.id),memoryDomain:u,durationMs:m}),{extracted:l,stored:f,durationMs:m}}function RP(){const e=rt.getState(),t=e.facts.filter(n=>n.domain==="run_scratchpad").map(n=>n.id);for(const n of t)e.removeFact(n)}function OP(e,t){const n=new Set(e.toLowerCase().split(/\s+/).filter(s=>s.length>2)),r=t.toLowerCase().split(/\s+/).filter(s=>s.length>2);if(r.length===0)return .1;let i=0;for(const s of r)n.has(s)&&i++;return i/r.length}function IP(e){return e.length===0?"":`<memory_recall>
|
|
411
|
+
Relevant facts from memory:
|
|
412
|
+
${e.map(n=>{const r=n.domain!=="shared"?` [${n.domain}]`:"";return`- [${n.type}]${r} ${n.content}`}).join(`
|
|
413
|
+
`)}
|
|
414
|
+
</memory_recall>`}function FP(e,t,n){const r=[],i=e.split(/[.!?\n]+/).map(s=>s.trim()).filter(s=>s.length>10);for(const s of i){const l=s.toLowerCase();n.includes("decisions")&&$P(l)?r.push({content:s,type:"decisions",confidence:.7}):n.includes("user_preferences")&&LP(l,t)?r.push({content:s,type:"user_preferences",confidence:.6}):n.includes("facts")&&PP(l)&&r.push({content:s,type:"facts",confidence:.5})}return r.slice(0,5)}function $P(e){return["decided","will use","chosen","selected","going with","we should","let's go with"].some(n=>e.includes(n))}function LP(e,t){const n=t.toLowerCase();return["prefer","like","want","favorite","always use","rather"].some(i=>n.includes(i)||e.includes(i))}function PP(e){return["is a","are used","works by","consists of","requires","means"].some(n=>e.includes(n))}function BP(e,t){return t||e==="reset_each_run"?"run_scratchpad":e==="clone_from_shared"?"agent_private":"shared"}function HP(e,t){return e==="shared"&&!t.allowPromoteToShared?"agent_private":e}function UP(e){const t=[];if(t.push("<provenance>"),e.sources.length>0)for(const n of e.sources)t.push(` <source path="${n.path}" type="${n.type}" sections="${n.sections}" depth="${n.depth}" />`);if(e.derivations.length>0){t.push(" <derivation>");for(const n of e.derivations)t.push(` <step from="${n.from}" method="${n.method}" to="${n.to}" />`);t.push(" </derivation>")}return t.push("</provenance>"),e.conflictResolution&&(t.push(""),t.push("<context_provenance>"),t.push(e.conflictResolution.instructions),t.push("</context_provenance>")),t.join(`
|
|
415
|
+
`)}function Vs(e){const t=ie.getState(),{instructionState:n,workflowSteps:r,agentMeta:i}=t,s=[];if(i.name){const f=[`Name: ${i.name}`];i.description&&f.push(`Description: ${i.description}`),i.avatar&&f.push(`Avatar: ${i.avatar}`),i.tags?.length&&f.push(`Tags: ${i.tags.join(", ")}`),s.push(`<identity>
|
|
416
|
+
${f.join(`
|
|
417
|
+
`)}
|
|
418
|
+
</identity>`)}if(n.persona||n.objectives.primary){const f=[];if(n.persona&&f.push(`Persona: ${n.persona}`),n.tone!=="neutral"&&f.push(`Tone: ${n.tone}`),n.expertise!==3){const m=["Beginner","Novice","Intermediate","Advanced","Expert"];f.push(`Expertise Level: ${m[n.expertise-1]} (${n.expertise}/5)`)}n.objectives.primary&&(f.push(`Primary Objective: ${n.objectives.primary}`),n.objectives.successCriteria.length>0&&f.push(`Success Criteria:
|
|
419
|
+
${n.objectives.successCriteria.map(m=>`- ${m}`).join(`
|
|
420
|
+
`)}`),n.objectives.failureModes.length>0&&f.push(`Failure Modes to Avoid:
|
|
421
|
+
${n.objectives.failureModes.map(m=>`- ${m}`).join(`
|
|
422
|
+
`)}`)),s.push(`<instructions>
|
|
423
|
+
${f.join(`
|
|
424
|
+
|
|
425
|
+
`)}
|
|
426
|
+
</instructions>`)}const l=[];if(n.constraints.neverMakeUp&&l.push("Never fabricate information or make up facts"),n.constraints.askBeforeActions&&l.push("Ask for permission before taking significant actions"),n.constraints.stayInScope&&l.push(`Stay within the defined scope: ${n.constraints.scopeDefinition||"as specified"}`),n.constraints.useOnlyTools&&l.push("Only use tools and capabilities that are explicitly provided"),n.constraints.limitWords&&l.push(`Keep responses under ${n.constraints.wordLimit} words`),n.constraints.customConstraints&&l.push(`Additional constraints: ${n.constraints.customConstraints}`),l.length>0&&s.push(`<constraints>
|
|
427
|
+
${l.map(f=>`- ${f}`).join(`
|
|
428
|
+
`)}
|
|
429
|
+
</constraints>`),r.length>0){const f=iS(r);s.push(`<workflow>
|
|
430
|
+
${f}
|
|
431
|
+
</workflow>`)}const u=qP();if(u&&s.push(u),e){const f=UP(e);s.push(f)}return s.join(`
|
|
432
|
+
|
|
433
|
+
`)}function O2(){return`<knowledge_format>
|
|
434
|
+
The knowledge below is produced by an automated indexing pipeline. Here is how to read it:
|
|
435
|
+
|
|
436
|
+
## Heading Hierarchy = Depth Levels
|
|
437
|
+
- # (H1) = Feature name — top-level grouping
|
|
438
|
+
- ## (H2) = Section: Architecture, Key Files, Data Flow, State Management, Components
|
|
439
|
+
- ### (H3) = Individual file entry with metadata
|
|
440
|
+
|
|
441
|
+
## How to Read a Key File Entry
|
|
442
|
+
Each file under "Key Files" has structured metadata:
|
|
443
|
+
- **Category**: What the file DOES (component=UI, store=state, service=logic, route=endpoint, util=helper, test=tests, config=settings, type=contracts)
|
|
444
|
+
- **Exports**: The public API surface — function/class/constant names this file makes available
|
|
445
|
+
- **Types**: TypeScript interfaces/types defined in this file
|
|
446
|
+
- **Size/Tokens**: File size and estimated token count for budget decisions
|
|
447
|
+
- **Imports**: Direct dependencies of this file
|
|
448
|
+
|
|
449
|
+
## How to Use Data Flow (CRITICAL)
|
|
450
|
+
The "Data Flow" section contains the import graph between files. Each line is:
|
|
451
|
+
source_file → imported_module
|
|
452
|
+
This IS the dependency graph. You do NOT need to open files to trace dependencies.
|
|
453
|
+
Example: if Data Flow shows \`App.tsx → ./providers/AuthProvider\`, you already know App depends on AuthProvider.
|
|
454
|
+
|
|
455
|
+
## Escalation Strategy
|
|
456
|
+
1. **Check the knowledge docs first** — most answers are already here (exports, types, data flow, architecture)
|
|
457
|
+
2. **Use get_file_contents ONLY when you need actual implementation details** — the code itself, not its structure
|
|
458
|
+
3. **Build exact file URLs** using the base URL from orientation + the file path from Key Files
|
|
459
|
+
|
|
460
|
+
## What You Can Answer WITHOUT Reading Files
|
|
461
|
+
- "What does X export?" → Check Exports field
|
|
462
|
+
- "What depends on X?" → Check Data Flow
|
|
463
|
+
- "What state does X manage?" → Check State Management section
|
|
464
|
+
- "What type is X?" → Check Types field
|
|
465
|
+
- "What stack/framework?" → Check Architecture section
|
|
466
|
+
</knowledge_format>`}function qP(){const e=vt.getState().getConnectedTools(),{skills:t}=ie.getState(),n=t.filter(m=>m.enabled),i=ie.getState().channels.some(m=>m.enabled&&m.repoMeta);if(e.length===0&&n.length===0)return"";const s=[];if(e.length>0){s.push("## Available MCP Tools");for(const m of e)s.push(`- **${m.name}**: ${m.description||"No description"}`)}if(n.length>0){s.length>0&&s.push(""),s.push("## Available Skills");for(const m of n)s.push(`- **${m.name}**: ${m.description||"No description"}`)}s.push(""),s.push("## Tool Usage Patterns");const l=e.filter(m=>/get_file|read_file|file_content/i.test(m.name));l.length>0&&i&&(s.push("### File Access"),s.push("- **FIRST**: Check your loaded knowledge (Key Files, Data Flow, Exports) — most structural questions are answered there"),s.push("- **THEN**: Use file tools ONLY for actual source code / implementation details"),s.push(`- Tool: \`${l[0].name}\` — pass a single file path, NOT a directory`));const u=e.filter(m=>/search|find|grep|query/i.test(m.name)&&!/search_nodes/i.test(m.name));if(u.length>0){s.push("### Search");for(const m of u)s.push(`- \`${m.name}\`: Use for finding files or symbols not in loaded knowledge`)}return e.filter(m=>/search_nodes|read_graph|knowledge_graph/i.test(m.name)).length>0&&i&&(s.push("### Knowledge Graph (Low Priority)"),s.push("- Your loaded knowledge already contains structure, dependencies, and exports"),s.push("- Do NOT use graph tools to find basic repo structure — it is already in your context"),s.push("- Use graph tools ONLY for cross-repo relationship queries not covered by loaded knowledge")),s.push(""),s.push("## Anti-Patterns (NEVER do these)"),l.length>0&&s.push(`- NEVER pass a directory path to \`${l[0].name}\` — it only accepts single files`),i&&(s.push("- NEVER open a file just to check its exports or types — that information is in your loaded knowledge"),s.push("- NEVER fabricate file URLs — use base URL from orientation + exact file path from Key Files"),s.push("- NEVER call search_nodes/read_graph for structure already in your context")),i&&(s.push(""),s.push("## Recommended Workflow"),s.push("1. Check orientation block → find which repo/feature is relevant"),s.push("2. Check loaded knowledge → exports, data flow, types, architecture"),s.push("3. Need implementation details? → `get_file_contents` with exact file path"),s.push("4. Need something not indexed? → search tools"),s.push("5. Need cross-repo relationships? → graph tools")),`<tool_guide>
|
|
467
|
+
${s.join(`
|
|
468
|
+
`)}
|
|
469
|
+
</tool_guide>`}const GP=[{headingPatterns:[/(naming|branch|commit|file|variable|function|class|component)\s*(naming|convention|format|pattern|rule|standard)/i],contentPatterns:[/\b(format|pattern|example|convention):/i,/\b(feat|fix|chore|docs|refactor|test|style)\//,/\b(camelCase|PascalCase|snake_case|kebab-case|SCREAMING_SNAKE)\b/i],target:"naming"},{headingPatterns:[/^(rules?|constraints?|conventions?|standards?|guidelines?|requirements?|policies?|must|never|always)/i,/^(code\s*style|coding\s*standards?|linting|formatting)/i,/^(security|safety|boundaries)/i],contentPatterns:[/\b(MUST|SHALL|MUST NOT|SHALL NOT|REQUIRED|NEVER|ALWAYS|DO NOT|FORBIDDEN)\b/,/\b(rule|convention|standard|pattern|format):/i,/^[-*]\s*(always|never|do not|must|required|forbidden)/im],target:"constraint"},{headingPatterns:[/^(workflow|process|checklist|steps?|pipeline|review|procedure)/i,/^(before|after)\s*(commit|merge|push|deploy|review|submit)/i,/^(ci|cd|testing|deploy|release)\s*(process|steps|workflow)?/i],contentPatterns:[/\b(step\s*\d|first|then|next|finally|before|after)\b/i,/^\d+\.\s+/m,/^[-*]\s*\[[\sx]?\]/m],target:"workflow"},{headingPatterns:[/^(persona|identity|tone|voice|style|character|vibe)/i,/^(communication|behavior|personality)/i,/^(soul|core\s*truths?|principles?)/i,/who\s*(you|i)\s*a(m|re)/i],contentPatterns:[/\b(tone|voice|style|personality|character):/i,/\bbe\s+(concise|direct|formal|casual|friendly|professional|warm|snarky)/i],target:"persona"},{headingPatterns:[/^(tools?|tooling|stack|tech|preferred\s*stack|dependencies|preferred)/i,/^(use|prefer|recommended)\s*(tools?|frameworks?|libraries?)/i],contentPatterns:[/\b(prefer|use|recommended|required):\s*/i,/\b(npm|yarn|pnpm|pip|cargo|go)\s+(run|install|test|build)\b/i],target:"tool"},{headingPatterns:[/^(output|response|format|template|formatting|structure)/i,/^(how to|writing|documentation)\s*(format|style|write|structure)/i,/^(pr|pull\s*request|commit|changelog|report)\s*(template|format|description)/i],contentPatterns:[/\b(format|template|structure|layout|output|response)\b.*\b(must|should|always)/i,/\b(markdown|json|yaml|table|list|bullet|heading|section)\b/i,/```[\s\S]*?```/],target:"output"}];function KP(e){const t=[],n=e.split(`
|
|
470
|
+
`);let r="",i=0,s=[];for(const l of n){const u=l.match(/^(#{1,6})\s+(.+)/);u?((r||s.length>0)&&t.push({heading:r,level:i,content:s.join(`
|
|
471
|
+
`).trim()}),i=u[1].length,r=u[2],s=[]):s.push(l)}return(r||s.length>0)&&t.push({heading:r,level:i,content:s.join(`
|
|
472
|
+
`).trim()}),t}function VP(e,t){return t.headingPatterns.some(i=>i.test(e.heading))?!0:t.contentPatterns.filter(i=>i.test(e.content)).length>=2}function YP(e){const t=[],n=e.content.split(`
|
|
473
|
+
`);for(const r of n){const i=r.replace(/^[-*]\s*/,"").trim();!i||i.startsWith("#")||i.startsWith("```")||(/\b(MUST|SHALL|NEVER|ALWAYS|DO NOT|FORBIDDEN|REQUIRED|should|must not)\b/i.test(i)||/^(use|prefer|avoid|ensure|keep|maintain|follow|check|run|test|verify|write|create|name)/i.test(i)&&r.match(/^[-*]\s/))&&t.push(i)}return t}function WP(e){const t=[],n=e.content.split(`
|
|
474
|
+
`);for(const r of n){const i=r.trim(),s=i.match(/^\d+\.\s+(.+)/);if(s){t.push(s[1]);continue}const l=i.match(/^[-*]\s*\[[\sx]?\]\s*(.+)/);l&&t.push(l[1])}if(t.length===0)for(const r of n){const i=r.match(/^[-*]\s+(.+)/);i&&i[1].length>10&&t.push(i[1])}return t}function XP(e){const t=[],n=`${e.heading}
|
|
475
|
+
${e.content}`,r=n.match(/branch.*?(?:format|pattern|naming|convention).*?[:`]\s*(.+?)(?:\n|$)/i)||n.match(/(?:feat|fix|chore|hotfix)\/[<\[{]?\w+/);if(r){const u=n.match(/(?:example|e\.g\.|e\.g).*?[:`]\s*(.+?)(?:\n|$)/i);t.push({target:"branch",pattern:r[1]||r[0],example:u?.[1]?.trim()})}const i=n.match(/commit.*?(?:format|pattern|message|convention).*?[:`]\s*(.+?)(?:\n|$)/i)||n.match(/(?:type)\(scope\):\s*description/i);i&&t.push({target:"commit",pattern:i[1]||i[0]});const s=n.match(/file.*?(?:naming|convention|pattern).*?[:`]\s*(.+?)(?:\n|$)/i);s&&t.push({target:"file",pattern:s[1]});const l=n.match(/(?:pr|pull\s*request).*?(?:format|title|naming).*?[:`]\s*(.+?)(?:\n|$)/i);return l&&t.push({target:"pr",pattern:l[1]}),t}function ZP(e,t){const n=KP(e),r={constraints:[],workflowSteps:[],personaHints:[],toolHints:[],outputRules:[],namingPatterns:[],residual:"",source:t},i=[];for(const s of n){let l=!1;for(const u of GP)if(VP(s,u)){switch(l=!0,u.target){case"constraint":r.constraints.push(...YP(s));break;case"workflow":r.workflowSteps.push(...WP(s));break;case"persona":s.content.trim()&&r.personaHints.push(s.content.trim());break;case"tool":for(const f of s.content.split(`
|
|
476
|
+
`)){const m=f.match(/^[-*]\s+(.+)/);m&&r.toolHints.push(m[1].trim())}break;case"naming":r.namingPatterns.push(...XP(s));break;case"output":{for(const m of s.content.split(`
|
|
477
|
+
`)){const h=m.match(/^[-*]\s+(.+)/);h&&h[1].length>10&&r.outputRules.push(h[1].trim())}const f=s.content.match(/```[\s\S]*?```/g);if(f)for(const m of f)r.outputRules.push(m);break}}break}!l&&s.content.trim()&&i.push(s.heading?`${"#".repeat(s.level)} ${s.heading}
|
|
478
|
+
${s.content}`:s.content)}return r.residual=i.join(`
|
|
479
|
+
|
|
480
|
+
`),r}function bu(e,t){const n=e.replace(/\b(must|never|always|should|do not|avoid|use|prefer)\b/gi,"").split(/\s+/).filter(i=>i.length>=3),r=new Set(t.replace(/\b(must|never|always|should|do not|avoid|use|prefer)\b/gi,"").split(/\s+/).filter(i=>i.length>=3));return n.some(i=>r.has(i))}function QP(e){const t=e.flatMap(h=>h.constraints),n=e.flatMap(h=>h.workflowSteps),r=e.flatMap(h=>h.personaHints),i=e.flatMap(h=>h.toolHints),s=e.map(h=>h.residual).filter(Boolean),l=[...new Set(t)],u=[];for(let h=0;h<l.length;h++)for(let g=h+1;g<l.length;g++){const b=l[h].toLowerCase(),y=l[g].toLowerCase();(b.includes("must")&&y.includes("never")&&bu(b,y)||b.includes("never")&&y.includes("must")&&bu(b,y)||b.includes("use ")&&y.includes("avoid ")&&bu(b,y)||b.includes("avoid ")&&y.includes("use ")&&bu(b,y))&&u.push(`⚠️ Conflict: "${l[h]}" vs "${l[g]}"`)}const f=e.flatMap(h=>h.namingPatterns).map(h=>{const g=h.example?` (e.g. ${h.example})`:"";return`${h.target} naming: ${h.pattern}${g}`}),m=[...l,...f];return{conflicts:u,constraintsBlock:m.length>0?`<framework_constraints source="guidelines">
|
|
481
|
+
${m.map(h=>`- ${h}`).join(`
|
|
482
|
+
`)}${u.length>0?`
|
|
483
|
+
|
|
484
|
+
Conflicts detected:
|
|
485
|
+
`+u.join(`
|
|
486
|
+
`):""}
|
|
487
|
+
</framework_constraints>`:"",workflowBlock:n.length>0?`<framework_workflow>
|
|
488
|
+
${n.map((h,g)=>`${g+1}. ${h}`).join(`
|
|
489
|
+
`)}
|
|
490
|
+
</framework_workflow>`:"",personaBlock:r.length>0?`<framework_persona>
|
|
491
|
+
${r.join(`
|
|
492
|
+
|
|
493
|
+
`)}
|
|
494
|
+
</framework_persona>`:"",toolHintsBlock:i.length>0?`<tool_hints>
|
|
495
|
+
${i.map(h=>`- ${h}`).join(`
|
|
496
|
+
`)}
|
|
497
|
+
</tool_hints>`:"",outputBlock:e.flatMap(h=>h.outputRules).length>0?`<output_format>
|
|
498
|
+
Format your responses according to these rules:
|
|
499
|
+
${e.flatMap(h=>h.outputRules).map(h=>h.startsWith("```")?h:`- ${h}`).join(`
|
|
500
|
+
`)}
|
|
501
|
+
</output_format>`:"",residualKnowledge:s.length>0?s.join(`
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
`):""}}async function I2(e,t){const n=Xn.getState(),r=Hn.getState(),i=new Set(["framework","guideline"]),s=e.filter(g=>i.has(g.knowledgeType)),l=e.filter(g=>!i.has(g.knowledgeType));let u="",f,m="";const h=e.filter(g=>g.path);if(h.length>0){const g=Date.now();await n.indexFiles(h.map(b=>b.path)),r.addEvent(t,{kind:"retrieval",sourceName:"pipeline:fetch",query:`${h.length} sources`,resultCount:h.filter(b=>n.getIndex(b.path)!=null).length,durationMs:Date.now()-g})}if(s.length>0){const g=s.map(b=>{let y=b.path?n.getIndex(b.path):null;if(!y&&b.content){const E=`content://${b.contentSourceId||b.sourceId}`;y=Ci(E,b.content)}if(!y)return null;const v=ll(y,0),w=cl(v.filtered);return w.trim()?ZP(w,b.name):null}).filter(b=>b!==null);if(g.length>0){const b=QP(g);u=[b.constraintsBlock,b.workflowBlock,b.personaBlock,b.toolHintsBlock,b.outputBlock].filter(Boolean).join(`
|
|
506
|
+
|
|
507
|
+
`),f={constraints:g.reduce((v,w)=>v+w.constraints.length,0),workflowSteps:g.reduce((v,w)=>v+w.workflowSteps.length,0),personaHints:g.reduce((v,w)=>v+w.personaHints.length,0),toolHints:g.reduce((v,w)=>v+w.toolHints.length,0),outputRules:g.reduce((v,w)=>v+w.outputRules.length,0),namingPatterns:g.reduce((v,w)=>v+w.namingPatterns.length,0),sources:g.map(v=>v.source)},b.residualKnowledge.trim()&&(m=`<knowledge type="framework-residual">
|
|
508
|
+
${b.residualKnowledge}
|
|
509
|
+
</knowledge>`),r.addEvent(t,{kind:"retrieval",sourceName:"pipeline:framework",query:`${g.length} framework sources`,resultCount:g.reduce((v,w)=>v+w.constraints.length+w.workflowSteps.length,0),durationMs:0})}}return{frameworkBlock:u,frameworkSummary:f,regularChannels:l,residualKnowledgeBlock:m}}function kg(e){const t=[];t.push(`Source: ${e.source} (${e.totalTokens} tokens, ${e.nodeCount} nodes)`),t.push("");function n(r,i){if(r.depth===0&&r.children.length>0){for(const m of r.children)n(m,i);return}const s=" ".repeat(i),l=r.totalTokens>0?` [${r.totalTokens} tokens]`:"",u=r.children.length>0?` (${r.children.length} subsections)`:"",f=r.meta?.firstSentence?` — ${r.meta.firstSentence}`:"";t.push(`${s}[${r.nodeId}] ${r.title}${l}${u}${f}`);for(const m of r.children)n(m,i+1)}return n(e.root,0),t.join(`
|
|
510
|
+
`)}function vg(e,t){return`You are selecting which parts of the knowledge base to include in context for a coding task.
|
|
511
|
+
|
|
512
|
+
TASK: ${t.task}
|
|
513
|
+
TOKEN BUDGET: ${t.tokenBudget} tokens available for knowledge
|
|
514
|
+
|
|
515
|
+
Below are the available knowledge sources with their tree structure. Each node shows:
|
|
516
|
+
- [nodeId] Title [total tokens] (subsections) — first sentence
|
|
517
|
+
|
|
518
|
+
YOUR JOB: Select which branches to include and at what depth:
|
|
519
|
+
- depth 0 (Full): Include everything — use for critical sections you need to read carefully
|
|
520
|
+
- depth 1 (Detail): First paragraph per leaf — use for important context
|
|
521
|
+
- depth 2 (Summary): First sentence per section — use for orientation
|
|
522
|
+
- depth 3 (Headlines): Just titles — use for awareness
|
|
523
|
+
- depth 4 (Mention): Skip content — just note it exists
|
|
524
|
+
|
|
525
|
+
RULES:
|
|
526
|
+
- Stay within the token budget (depths reduce tokens: Full=100%, Detail=75%, Summary=50%, Headlines=25%, Mention=10%)
|
|
527
|
+
- Prioritize sections directly relevant to the task
|
|
528
|
+
- Include architectural context at Summary/Headlines even if not directly relevant
|
|
529
|
+
- Be specific about WHY you selected each branch
|
|
530
|
+
|
|
531
|
+
SOURCES:
|
|
532
|
+
${e.join(`
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
`)}
|
|
537
|
+
|
|
538
|
+
Respond with a JSON array of selections:
|
|
539
|
+
[
|
|
540
|
+
{ "nodeId": "n1-0", "depth": 0, "reason": "Need full implementation details for the order store", "priority": 0 },
|
|
541
|
+
{ "nodeId": "n1-3", "depth": 2, "reason": "Architecture context for understanding the module", "priority": 2 },
|
|
542
|
+
...
|
|
543
|
+
]${t.existingContext?`
|
|
544
|
+
|
|
545
|
+
ALREADY IN CONTEXT (don't duplicate):
|
|
546
|
+
${t.existingContext}`:""}`}function F2(e,t){if(e.nodeId===t)return e;for(const n of e.children){const r=F2(n,t);if(r)return r}return null}function $2(e,t){const n=[];if(t===4)return"";if(t===3){e.depth>0&&n.push(`${"#".repeat(e.depth)} ${e.title}`);for(const r of e.children)r.depth<=2&&n.push(`${"#".repeat(r.depth)} ${r.title}`);return n.join(`
|
|
547
|
+
`)}e.depth>0&&n.push(`${"#".repeat(e.depth)} ${e.title}`),t===0?e.text&&n.push(e.text):t===1?e.children.length===0&&e.meta?.firstParagraph?n.push(e.meta.firstParagraph):e.text&&n.push(e.text):t===2&&e.meta?.firstSentence&&n.push(e.meta.firstSentence);for(const r of e.children){const i=$2(r,t);i&&n.push(i)}return n.join(`
|
|
548
|
+
|
|
549
|
+
`)}function JP(e,t){const n=[],r=new Map;for(const l of e)r.set(l.source,l);for(const l of t.selections){let u=null;for(const m of e)if(u=F2(m.root,l.nodeId),u)break;if(!u)continue;const f=$2(u,l.depth);f.trim()&&n.push({priority:l.priority,nodeId:l.nodeId,content:f,tokens:at(f),depth:l.depth})}n.sort((l,u)=>l.priority-u.priority);const i=n.map(l=>l.content).join(`
|
|
550
|
+
|
|
551
|
+
---
|
|
552
|
+
|
|
553
|
+
`),s=n.map(l=>({nodeId:l.nodeId,tokens:l.tokens,depth:l.depth}));return{content:i,tokens:at(i),breakdown:s}}function Zu(e){const t=e.match(/\[[\s\S]*\]/);if(!t)return[];try{const n=JSON.parse(t[0]);return Array.isArray(n)?n.filter(r=>r.nodeId&&typeof r.depth=="number").map(r=>({nodeId:r.nodeId,depth:Math.max(0,Math.min(4,r.depth)),reason:r.reason||"",priority:r.priority??2})):[]}catch{return[]}}function e9(e,t){const n=t.length>4e3?t.slice(0,4e3)+"...[truncated]":t;return`You are auditing whether the provided context contains enough information to complete a coding task.
|
|
554
|
+
|
|
555
|
+
TASK: ${e}
|
|
556
|
+
|
|
557
|
+
CURRENT CONTEXT:
|
|
558
|
+
${n}
|
|
559
|
+
|
|
560
|
+
YOUR JOB: Identify what critical information is MISSING from the context to complete this task. Look for:
|
|
561
|
+
- Missing implementation details or code examples
|
|
562
|
+
- Missing architectural context or relationships
|
|
563
|
+
- Missing configuration or setup information
|
|
564
|
+
- Missing error handling or edge case patterns
|
|
565
|
+
|
|
566
|
+
Respond with a JSON array of missing information gaps (maximum 3):
|
|
567
|
+
["Missing error handling patterns for API failures", "Missing database schema for user table", "Missing authentication flow details"]
|
|
568
|
+
|
|
569
|
+
If the context appears complete for the task, respond with: []`}function t9(e){const t=e.match(/\[[\s\S]*?\]/);if(!t)return[];try{const n=JSON.parse(t[0]);return Array.isArray(n)?n.filter(r=>typeof r=="string"&&r.trim().length>0).slice(0,3):[]}catch{return[]}}function n9(e){return`You are writing a hypothetical documentation passage that would perfectly answer this query.
|
|
570
|
+
|
|
571
|
+
QUERY: ${e}
|
|
572
|
+
|
|
573
|
+
Write a comprehensive documentation passage that would ideally exist in a codebase to answer this question. Include:
|
|
574
|
+
- Relevant code examples
|
|
575
|
+
- Implementation details
|
|
576
|
+
- Configuration options
|
|
577
|
+
- Common patterns and best practices
|
|
578
|
+
|
|
579
|
+
Write as if this documentation already exists and covers exactly what the user needs to know:`}function o9(e){return e.trim().split(/\s+/).length>=10}function r9(e,t=8){return e.toLowerCase().replace(/[^\w\s]/g,"").replace(/\s+/g," ").trim().split(" ").slice(0,t).join(" ")}function a9(e,t){const n=new Set,r=[];let i=0;for(let s=0;s<e.length;s++){const l=e[s];if(t.has(s)){r.push(l);continue}const u=r9(l);if(u.length<10){r.push(l);continue}if(n.has(u)){i++;continue}n.add(u),r.push(l)}return{result:r,removed:i}}const i9=[/^(as mentioned|as noted|as described|as stated|as shown|as seen)\b/i,/^(it is worth noting|it should be noted|it is important to note|note that)\b/i,/^(in this section|in the following|the following section|this section)\b/i,/^(let's|let us|we will|we'll|we can|we should)\s+(look at|examine|explore|consider|discuss|review|take a look)/i,/^(basically|essentially|fundamentally|generally speaking|in general)\b/i,/^(it goes without saying|needless to say|obviously|of course|clearly)\b/i,/^(furthermore|moreover|additionally|in addition|also|besides|what's more)\s*,?\s*$/i,/^(in conclusion|to summarize|to sum up|in summary|overall)\s*,?\s*$/i];function s9(e){const t=e.trim();if(!t)return 1;let n=0;for(const u of i9)if(u.test(t)){n+=.6;break}const r=t.split(/\s+/).length;r<4&&(n+=.3);const i=new Set(["the","a","an","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","could","should","may","might","shall","can","this","that","these","those","it","its","to","of","in","for","on","with","at","by","from","as","into","about"]),s=t.toLowerCase().split(/\s+/);return s.filter(u=>i.has(u)).length/s.length>.7&&r>5&&(n+=.2),Math.min(1,n)}function l9(e,t=.5,n){let r=0;const i=[];for(let s=0;s<e.length;s++){const l=e[s];if(n.has(s)){i.push(l);continue}const f=l.split(new RegExp("(?<=[.!?])\\s+")).filter(m=>s9(m)>=t?(r++,!1):!0);f.length>0&&i.push(f.join(" "))}return{result:i,removed:r}}function c9(e){let t=0;return{result:e.replace(/```[\s\S]*?```/g,r=>{const i=r.split(`
|
|
580
|
+
`),s=i[0],l=i[i.length-1],f=i.slice(1,-1).filter(m=>{const h=m.trim();return h.startsWith("//")&&!h.startsWith("///")&&!h.startsWith("//!")||h.startsWith("#")&&!h.startsWith("#!")&&!h.startsWith("# ")?(t++,!1):!!h});return[s,...f,l].join(`
|
|
581
|
+
`)}),removedComments:t}}function u9(e,t={}){const{dedup:n=!0,removeFiller:r=!0,compressCode:i=!0,aggressiveness:s=.5,tokenBudget:l,preservePatterns:u=[]}=t,f=at(e);let m=e,h=0,g=0,b=0;if(i){const C=c9(m);m=C.result,b=C.removedComments}let y=m.split(/\n\s*\n/).filter(C=>C.trim());const v=u.map(C=>new RegExp(C,"i")),w=C=>{const M=new Set;if(v.length===0)return M;for(let S=0;S<C.length;S++)v.some(N=>N.test(C[S]))&&M.add(S);return M};if(n){const C=a9(y,w(y));y=C.result,h=C.removed}if(r){const C=.3+.4*(1-s),M=l9(y,C,w(y));y=M.result,g=M.removed}if(m=y.join(`
|
|
582
|
+
|
|
583
|
+
`),l){let C=at(m);if(C>l){const M=w(y);for(;y.length>1&&C>l;){let S=-1;for(let N=y.length-1;N>=0;N--)if(!M.has(N)){S=N;break}if(S<0)break;y.splice(S,1),m=y.join(`
|
|
584
|
+
|
|
585
|
+
`),C=at(m)}}}const E=at(m);return{content:m,originalTokens:f,compressedTokens:E,ratio:f>0?E/f:1,removals:{duplicates:h,filler:g,codeComments:b}}}function d9(e){switch(e.type){case"markdown":return Ci(e.name,e.content||"");case"structured":return Lz(e.name,e.fields||[],e.sourceType);case"chronological":return Pz(e.name,e.entries||[],e.sourceType);case"flat":return D1(e.name,e.content||"",e.sourceType);default:return D1(e.name,e.content||"")}}function p9(e){const t=Date.now(),n=e.sources.map(d9),r=Date.now()-t,i=n.map(kg),s=vg(i,{task:e.task,tokenBudget:e.tokenBudget});return{indexes:n,headlines:i,navigationPrompt:s,indexMs:r}}function Lk(e,t,n,r){const i=Date.now(),s=n.manualSelections||Zu(t),l=Date.now()-i,u={source:n.sources.map(w=>w.name).join(", "),selections:s,taskRelevance:n.task},f=JP(e,u),m=Date.now();let h,g={originalTokens:0,compressedTokens:0,ratio:1,removals:{duplicates:0,filler:0,codeComments:0}};if(n.compression?.enabled!==!1&&f.content)if(f.breakdown.map(E=>({content:f.content,priority:s.find(C=>C.nodeId===E.nodeId)?.priority??2})).length>0){const E=u9(f.content,{tokenBudget:n.tokenBudget,aggressiveness:n.compression?.aggressiveness??.5});h=E.content,g={originalTokens:E.originalTokens,compressedTokens:E.compressedTokens,ratio:E.ratio,removals:E.removals}}else h=f.content;else h=f.content,g.originalTokens=at(f.content),g.compressedTokens=g.originalTokens;const b=Date.now()-m,y=r+l+b,v=at(h);return{context:h,tokens:v,utilization:n.tokenBudget>0?v/n.tokenBudget:0,sources:e.map(w=>({name:w.source,type:w.sourceType,totalTokens:w.totalTokens,indexedNodes:w.nodeCount})),navigation:{selections:s,prompt:void 0},compression:g,indexes:e,timing:{indexMs:r,navigationMs:l,compressionMs:b,totalMs:y}}}const f9=[/\bnot\b/i,/\bhowever\b/i,/\bcontrary to\b/i,/\bunlike\b/i,/\bfails to\b/i,/\bbut\b/i,/\balthough\b/i,/\bwhile\b/i,/\bwhereas\b/i,/\binstead\b/i,/\brather than\b/i,/\bon the other hand\b/i,/\bin contrast\b/i,/\bnevertheless\b/i,/\bnonetheless\b/i,/\bdespite\b/i,/\bin spite of\b/i],m9=[/\blimitations?\b/i,/\brestrictions?\b/i,/\bchallenges?\b/i,/\bproblems?\b/i,/\bissues?\b/i,/\brisks?\b/i,/\bdisadvantages?\b/i,/\bcons\b/i,/\bweaknesses?\b/i,/\bfailures?\b/i,/\berrors?\b/i,/\bmistakes?\b/i,/\balternatives?\b/i,/\bother approaches?\b/i,/\bdifferent view\b/i,/\bopposing\b/i,/\bcounter\b/i],h9=[/\bresults?\b/i,/\bbenefits?\b/i,/\badvantages?\b/i,/\bpros\b/i,/\bstrengths?\b/i,/\bsuccesses?\b/i,/\bachievements?\b/i,/\bimprovements?\b/i,/\bgains?\b/i,/\bpositive\b/i,/\brecommendations?\b/i,/\bbest practices?\b/i];function Pk(e){const t=new Set;return(e.match(/\b[A-Z][a-z]+(?:\s+[A-Z][a-z]*)*\b/g)||[]).forEach(u=>t.add(u.toLowerCase())),(e.match(/"([^"]+)"/g)||[]).forEach(u=>t.add(u.replace(/"/g,"").toLowerCase())),(e.match(/`([^`]+)`/g)||[]).forEach(u=>t.add(u.replace(/`/g,"").toLowerCase())),(e.match(/\*\*([^*]+)\*\*/g)||[]).forEach(u=>t.add(u.replace(/\*\*/g,"").toLowerCase())),(e.match(/\*([^*]+)\*/g)||[]).forEach(u=>t.add(u.replace(/\*/g,"").toLowerCase())),t}function g9(e,t){const n=Pk(e.content),r=Pk(t.content);if(n.size===0&&r.size===0)return 0;const i=new Set(Array.from(n).filter(l=>r.has(l))),s=new Set([...Array.from(n),...Array.from(r)]);return i.size/s.size}function y9(e){return f9.some(t=>t.test(e))}function Bk(e){const t=e.toLowerCase();return m9.some(n=>n.test(t))?"contrasting":h9.some(n=>n.test(t))?"supporting":"neutral"}function x9(e,t,n=.2){const r=[],i=[],s=new Set(e.map(l=>`${l.source}:${l.section}`));for(const l of e){let u=null,f="",m=0;for(const h of t){const g=`${h.source}:${h.section}`;if(g===`${l.source}:${l.section}`||s.has(g))continue;const b=g9(l,h);if(b<n)continue;let y=0,v="";const w=Bk(l.section),E=Bk(h.section);w==="supporting"&&E==="contrasting"?(y+=.6,v=`contrasting section types: "${l.section}" vs "${h.section}"`):w==="contrasting"&&E==="supporting"&&(y+=.6,v=`contrasting section types: "${l.section}" vs "${h.section}"`),y9(h.content)&&(y+=.4,v?v+=" + negation patterns":v="negation patterns detected"),y+=b*.3,y>m&&(m=y,u=h,f=v)}if(u&&m>.3){const h=`${u.source}:${u.section}`;r.some(g=>`${g.source}:${g.section}`===h)||r.push(u),i.push({supporting:l,contrasting:u,reason:f})}}return{supporting:e,contrasting:r,pairs:i}}function b9(e){return[/\bshould we\b/i,/\bcompare\b/i,/\bwhich is better\b/i,/\bpros and cons\b/i,/\bevaluate\b/i,/\banalyz(e|ation)/i,/\bassess\b/i,/\balternatives?\b/i,/\bdecid[ei](on)?\b/i,/\btrade-?offs?\b/i,/\badvantages?\b/i,/\bdisadvantages?\b/i,/\bvs\.?\s/i,/\bversus\b/i,/\bweigh\b/i].some(n=>n.test(e))}function Lm(e){const t=e.toLowerCase();return/\b(compare|vs|versus|evaluate|pros and cons|advantages|disadvantages|should we|tradeoffs?|better|worse|choose|decide|recommend)\b/.test(t)?"analytical":t.length<50||/\b(what is|how does|who is|when did|where is|define|definition)\b/.test(t)||/\b(version|spec|api|format|syntax|command)\b/.test(t)?"factual":"exploratory"}function k9(e){switch(e){case"factual":return .9;case"analytical":return .5;case"exploratory":return .7}}function v9(e,t=500){if(e.tokens<=t)return[{content:e.text,nodeId:e.nodeId,source:"",section:e.title,parentNodeId:void 0,depth:e.depth,knowledgeType:"signal"}];const n=e.text.split(/\n\s*\n/),r=[];let i="",s=0;for(const l of n){const u=i?`${i}
|
|
586
|
+
|
|
587
|
+
${l}`:l;at(u)>t&&i?(r.push({content:i.trim(),nodeId:`${e.nodeId}-${s++}`,source:"",section:`${e.title} (part ${s})`,parentNodeId:e.nodeId,depth:e.depth+1,knowledgeType:"signal"}),i=l):i=u}return i.trim()&&r.push({content:i.trim(),nodeId:`${e.nodeId}-${s}`,source:"",section:`${e.title} (part ${s+1})`,parentNodeId:e.nodeId,depth:e.depth+1,knowledgeType:"signal"}),r}function w9(e){const t=[];for(const{treeIndex:n,knowledgeType:r}of e){const i=[{node:n.root}];for(;i.length>0;){const{node:s,parentId:l}=i.pop();if((s.children.length===0||s.text&&s.text.trim().length>0)&&s.text&&s.text.trim().length>0){const u=v9(s);for(const f of u)f.source=n.source,f.knowledgeType=r,f.parentNodeId=l,t.push(f)}for(const u of s.children)i.push({node:u,parentId:s.nodeId})}}return t}async function L2(e,t=2){if(e.length===0)return[];const n=[],r=[];for(let f=0;f<e.length;f++)e[f]&&e[f].trim().length>0&&(n.push(f),r.push(e[f]));if(r.length===0)return e.map(()=>[]);const i=100,s=[];for(let f=0;f<r.length;f+=i){const m=r.slice(f,f+i),h=await fetch(`${ze}/embeddings/embed`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({texts:m})});if(h.status===503&&t>0)return await new Promise(y=>setTimeout(y,3e3)),L2(e,t-1);if(!h.ok)throw new Error(`Embedding service error: ${h.status} ${h.statusText}`);const g=await h.json();s.push(...g.embeddings||[])}const l={embeddings:s},u=e.map(()=>[]);for(let f=0;f<n.length;f++)u[n[f]]=l.embeddings[f];return u}function Ys(e,t){if(e.length!==t.length||e.length===0)return 0;let n=0,r=0,i=0;for(let l=0;l<e.length;l++)n+=e[l]*t[l],r+=e[l]*e[l],i+=t[l]*t[l];const s=Math.sqrt(r)*Math.sqrt(i);return s===0?0:n/s}function S9(e){if(e.length<=1)return 1;const t=e.map(i=>i.embedding).filter(i=>i);if(t.length<=1)return 1;let n=0,r=0;for(let i=0;i<t.length;i++)for(let s=i+1;s<t.length;s++)n+=Ys(t[i],t[s]),r++;return r===0?1:1-n/r}function C9(e,t,n){if(e.length===0)return[];const r=[],i=[...e];let s=0;for(;i.length>0&&s<n;){let l=-1/0,u=-1;for(let h=0;h<i.length;h++){const g=i[h];if(!g.embedding)continue;const b=at(g.content);if(s+b>n)continue;const y=g.relevanceScore;let v=0;for(const E of r)if(E.embedding){const C=Ys(g.embedding,E.embedding);v=Math.max(v,C)}const w=t*y-(1-t)*v;w>l&&(l=w,u=h)}if(u===-1)break;const f=i.splice(u,1)[0],m=at(f.content);r.push(f),s+=m}return r}async function E9(e,t,n){const r=Date.now();let i=w9(t);if(i.length===0)return{chunks:[],diversityScore:1,collapseWarning:!1,totalChunks:0,queryType:Lm(e),retrievalMs:Date.now()-r,embeddingMs:0,budgetUsed:0,budgetTotal:n};const s=Date.now(),l=i.filter(B=>B.content&&B.content.trim().length>0);if(l.length===0)return{chunks:[],diversityScore:1,collapseWarning:!1,totalChunks:i.length,queryType:Lm(e),retrievalMs:Date.now()-r,embeddingMs:0,budgetUsed:0,budgetTotal:n};i=l;const u=[e,...i.map(B=>B.content)],f=await L2(u),m=Date.now()-s,h=f[0],g=f.slice(1);i.forEach((B,O)=>{B.embedding=g[O]});const b=.3,y=i.map(B=>({...B,relevanceScore:B.embedding?Ys(h,B.embedding):0,inclusionReason:"direct"})).filter(B=>B.relevanceScore>b),v=new Map(i.map(B=>[B.nodeId,B])),w=new Map;for(const B of y)if(w.set(B.nodeId,B),B.parentNodeId){const O=v.get(B.parentNodeId);if(O&&O.embedding&&!w.has(O.nodeId)){const Y=B.relevanceScore*.6;Y>b&&w.set(O.nodeId,{...O,relevanceScore:Y,inclusionReason:"parent-expansion"})}}const E=.5,C=.4;for(const B of y)if(B.relevanceScore>E&&B.parentNodeId&&B.embedding){const O=i.filter(Y=>Y.parentNodeId===B.parentNodeId&&Y.nodeId!==B.nodeId&&!w.has(Y.nodeId));for(const Y of O)if(Y.embedding&&Ys(B.embedding,Y.embedding)>C){const U=Ys(h,Y.embedding);w.set(Y.nodeId,{...Y,relevanceScore:U,inclusionReason:"sibling-coherence"})}}const M=Lm(e),S=k9(M),N=Array.from(w.values()),R=C9(N,S,n),T=S9(R),D=T<.3,H=R.reduce((B,O)=>B+at(O.content),0),V=Date.now()-r;return{chunks:R,diversityScore:T,collapseWarning:D,totalChunks:i.length,queryType:M,retrievalMs:V,embeddingMs:m,budgetUsed:H,budgetTotal:n}}const P2={"ground-truth":1,evidence:.8,signal:.6,hypothesis:.4},B2={full:1,summary:.7,headline:.4};function kh(e,t){const n=[],r=[],i=new Map;t.forEach(l=>{i.set(l.name,l),l.path&&i.set(l.path,l)});for(const l of e.sources){const u=i.get(l.name);if(!u)continue;const f=H2(u.knowledgeType),m=A9(u.depth);n.push({path:u.path||u.name,type:f,sections:l.indexedNodes,depth:m,method:"tree-index",chunkCount:Math.floor(l.totalTokens/100)}),r.push({from:u.path||u.name,method:"tree-index",to:`index-${l.name}`}),e.compression.ratio<1&&r.push({from:`index-${l.name}`,method:"rtk-compression",to:`compressed-${l.name}`})}const s={weights:P2,depthWeights:B2,instructions:_9()};return{sources:n,derivations:r,conflictResolution:s}}function M9(e){return e.map(t=>{const n=H2(t.type),r=N9(t.depth),i=j9(n,r);return{content:t.content,provenance:{source:t.source,section:t.section,type:n,depth:r,method:t.method,confidence:i}}})}function T9(e){const t=[],n=new Set,r=D9(e);for(const[i,s]of Object.entries(r)){if(s.length<2)continue;const l=z9(s);for(const u of l){const f=u.map(h=>`${h.provenance.source}:${h.provenance.section}`).sort().join("|");if(n.has(f))continue;n.add(f);const m=R9(u);m&&t.push({conflictingChunks:u,resolution:m})}}return t}function j9(e,t){const n=P2[e]||.5,r=B2[t]||.5;return n*r}function H2(e){switch(e){case"ground-truth":return"ground-truth";case"evidence":return"evidence";case"signal":return"signal";case"hypothesis":return"hypothesis";default:return"signal"}}function A9(e){switch(e){case 0:return"full";case 1:return"summary";case 2:return"headline";default:return"summary"}}function N9(e){switch(e){case"full":return"full";case"summary":return"summary";case"headline":return"headline";default:return"summary"}}function _9(){return`When sources conflict, apply this priority order:
|
|
588
|
+
1. Source reliability: ground-truth > evidence > signal > hypothesis
|
|
589
|
+
2. Content depth: full > summary > headline
|
|
590
|
+
3. Recency: prefer more recent information when timestamps are available
|
|
591
|
+
4. Specificity: prefer specific details over general statements
|
|
592
|
+
|
|
593
|
+
When presenting conflicting information, acknowledge the conflict and explain your reasoning based on source reliability.`}function D9(e){const t={};for(const n of e){const r=n.provenance.section||"general";t[r]||(t[r]=[]),t[r].push(n)}return t}function z9(e){const t=[];for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){const i=e[n],s=e[r];i.provenance.source!==s.provenance.source&&i.provenance.section===s.provenance.section&&O9(i.content,s.content)<.7&&t.push([i,s])}return t}function R9(e){let t=e[0],n=t.provenance.confidence;for(const i of e)i.provenance.confidence>n&&(t=i,n=i.provenance.confidence);const r=`Preferred ${t.provenance.type} source (confidence: ${n.toFixed(2)}) over other sources`;return{preferredChunk:t,reason:r,confidence:n}}function O9(e,t){const n=new Set(e.toLowerCase().split(/\s+/)),r=new Set(t.toLowerCase().split(/\s+/)),i=new Set([...n].filter(l=>r.has(l))),s=new Set([...n,...r]);return i.size/s.size}function vh(e,t,n,r,i,s){return`<chunk source="${t}" section="${n}" type="${r}" depth="${i}" method="${s}">
|
|
594
|
+
${e}
|
|
595
|
+
</chunk>`}function I9(e,t){const n=[];if(!e.context)return n;const r=new Map;for(const s of t)r.set(s.name,s),s.path&&r.set(s.path,s);const i=F9(e.context);for(const s of i){let l;for(const f of e.sources)if(s.content.length>0&&r.has(f.name)){l=r.get(f.name);break}const u=l?fi[l.depth]?.label??"full":"full";n.push({content:s.content,source:l?.path||l?.name||"unknown",section:s.heading||"main",type:l?.knowledgeType||"signal",depth:u,method:"tree-index-pipeline",node:{}})}return n}function F9(e){const t=e.split(`
|
|
596
|
+
`),n=[];let r="",i=[];for(const s of t){const l=s.match(/^#{1,4}\s+(.+)/);if(l){if(i.length>0){const u=i.join(`
|
|
597
|
+
`).trim();u&&n.push({heading:r,content:u})}r=l[1],i=[]}else i.push(s)}if(i.length>0){const s=i.join(`
|
|
598
|
+
`).trim();s&&n.push({heading:r,content:s})}return n}function $9(e,t,n){const r=kh(e,t);if(!b9(n))return{knowledgeBlock:`<knowledge sources="${e.sources.map(w=>`${w.name} (${w.type}, ${w.totalTokens} tokens, ${w.indexedNodes} nodes)`).join(", ")}">
|
|
599
|
+
${e.context}
|
|
600
|
+
</knowledge>`,provenance:r};const i=I9(e,t);if(i.length===0)return{knowledgeBlock:`<knowledge sources="${e.sources.map(w=>`${w.name} (${w.type}, ${w.totalTokens} tokens, ${w.indexedNodes} nodes)`).join(", ")}">
|
|
601
|
+
${e.context}
|
|
602
|
+
</knowledge>`,provenance:r};const s=M9(i),l=T9(s),u=x9(i,i),f=u.supporting.map(y=>vh(y.content,y.source,y.section,y.type,y.depth,y.method)),m=u.contrasting.map(y=>vh(y.content,y.source,y.section,y.type,y.depth,y.method));let h="";if(f.length>0&&(h+=`<supporting>
|
|
603
|
+
${f.join(`
|
|
604
|
+
|
|
605
|
+
`)}
|
|
606
|
+
</supporting>`),m.length>0&&(h&&(h+=`
|
|
607
|
+
|
|
608
|
+
`),h+=`<contrasting>
|
|
609
|
+
${m.join(`
|
|
610
|
+
|
|
611
|
+
`)}
|
|
612
|
+
</contrasting>`),l.length>0){h&&(h+=`
|
|
613
|
+
|
|
614
|
+
`),h+=`<conflicts_resolved>
|
|
615
|
+
`;for(const y of l)h+=`Conflict: ${y.conflictingChunks.map(v=>v.provenance.source).join(" vs ")}
|
|
616
|
+
`,h+=`Resolution: ${y.resolution.reason}
|
|
617
|
+
|
|
618
|
+
`;h+="</conflicts_resolved>"}return h||(h=e.context),{knowledgeBlock:`<knowledge sources="${e.sources.map(y=>`${y.name} (${y.type}, ${y.totalTokens} tokens, ${y.indexedNodes} nodes)`).join(", ")}">
|
|
619
|
+
${h}
|
|
620
|
+
</knowledge>`,provenance:r}}function L9(e){const t=e.filter(s=>s.enabled);if(t.length===0)return"";const n={},r=["ground-truth","signal","evidence","framework","hypothesis","guideline"];for(const s of t)n[s.knowledgeType]||(n[s.knowledgeType]=[]),n[s.knowledgeType].push(s);const i=[];for(const s of r){const l=n[s];if(!l?.length)continue;const u=Ar[s],f=l.map(m=>{const h=fi[m.depth];return`- ${m.name} (${h.label}, ~${Math.round(m.baseTokens*h.pct).toLocaleString()} tokens) [${m.path}]`});i.push(`[${u.label.toUpperCase()}] ${u.instruction}
|
|
621
|
+
${f.join(`
|
|
622
|
+
`)}`)}return`<knowledge>
|
|
623
|
+
${i.join(`
|
|
624
|
+
|
|
625
|
+
`)}
|
|
626
|
+
</knowledge>`}async function _u(e,t,n){const r=await fetch(`${ze}/llm/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerId:t,model:n,messages:[{role:"system",content:"You are a context navigation agent. Respond with ONLY a JSON array, no markdown, no explanation."},{role:"user",content:e}]}),signal:AbortSignal.timeout(3e4)});if(!r.ok)throw new Error(`Navigation LLM call failed: ${r.status}`);const s=(await r.text()).split(`
|
|
627
|
+
`).filter(u=>u.startsWith("data: ")).map(u=>u.slice(6)).filter(u=>u!=="[DONE]");let l="";for(const u of s)try{const m=JSON.parse(u).choices?.[0]?.delta?.content;m&&(l+=m)}catch{}return l}async function P9(e,t,n,r,i){const s=Hn.getState(),l=Date.now();try{const u=e.join(". "),f=Math.floor(r.totalBudget*.2),m=new Set(n.map(w=>w.nodeId)),h=t.map(kg),g=vg(h,{task:u,tokenBudget:f}),b=await _u(g,r.providerId,r.model),v=Zu(b).filter(w=>!m.has(w.nodeId));return s.addEvent(i,{kind:"llm_call",model:r.model,durationMs:Date.now()-l,toolResult:`Gap navigation selected ${v.length} new branches for ${e.length} gaps`}),v}catch(u){return s.addEvent(i,{kind:"error",errorMessage:`Gap navigation failed: ${u instanceof Error?u.message:"Unknown"}`,durationMs:Date.now()-l}),[]}}async function U2(e,t,n,r,i){const s=Xn.getState(),l=Hn.getState(),{userMessage:u,navigationMode:f="tree-aware",providerId:m,model:h}=r,g=e.filter(C=>C.enabled);let b=n,y=null,v=null,w;const E=[];for(const C of t)if(C.content){const M=`content://${C.contentSourceId||C.sourceId}`,S=Ci(M,C.content),N=cl(ll(S,0).filtered);N.trim()&&E.push({name:C.name,type:"markdown",content:N,sourceType:C.knowledgeType})}else if(C.path){const M=s.getIndex(C.path);if(M){const S=cl(ll(M,0).filtered);S.trim()&&E.push({name:C.name,type:"markdown",content:S,sourceType:C.knowledgeType})}}if(f==="tree-aware"&&t.length>0){const C=g.reduce((S,N)=>S+N.baseTokens,0),M=[];for(const S of t)if(S.content){if(S.content.trim().length===0)continue;const N=`content://${S.contentSourceId||S.sourceId}`,R=Ci(N,S.content);M.push({treeIndex:R,knowledgeType:S.knowledgeType})}else if(S.path){const N=s.getIndex(S.path);N&&M.push({treeIndex:N,knowledgeType:S.knowledgeType})}if(M.length>0)try{if(l.addEvent(i,{kind:"retrieval",sourceName:"tree-aware-retrieval",query:u,resultCount:M.length,durationMs:0}),w=await E9(u,M,C),l.addEvent(i,{kind:"retrieval",sourceName:"tree-aware-retrieval",query:u,resultCount:w.chunks.length,durationMs:w.retrievalMs}),w.chunks.length>0){const S=w.chunks.map(H=>vh(H.content,H.source,H.section,H.knowledgeType,H.depth.toString(),"tree-aware")),N=M.map(H=>`${H.treeIndex.source} (${H.knowledgeType}, ${H.treeIndex.totalTokens} tokens, ${H.treeIndex.nodeCount} nodes)`).join(", "),R=`Query type: ${w.queryType}, Diversity: ${w.diversityScore.toFixed(2)}, Total chunks: ${w.totalChunks}`;b=`<knowledge sources="${N}" method="tree-aware" metadata="${R}">
|
|
628
|
+
${S.join(`
|
|
629
|
+
|
|
630
|
+
`)}
|
|
631
|
+
</knowledge>`;const T=S.join(`
|
|
632
|
+
|
|
633
|
+
`),D=at(T);y={context:T,tokens:D,utilization:C>0?D/C:0,sources:M.map(H=>({name:H.treeIndex.source,type:H.treeIndex.sourceType,totalTokens:H.treeIndex.totalTokens,indexedNodes:H.treeIndex.nodeCount})),navigation:{selections:[]},compression:{originalTokens:w.totalChunks>0?M.reduce((H,V)=>H+V.treeIndex.totalTokens,0):0,compressedTokens:D,ratio:C>0?D/Math.max(1,M.reduce((H,V)=>H+V.treeIndex.totalTokens,0)):1,removals:{duplicates:0,filler:0,codeComments:0}},indexes:M.map(H=>H.treeIndex),timing:{indexMs:0,navigationMs:0,compressionMs:w.retrievalMs,totalMs:w.retrievalMs}},y&&(v=kh(y,t)),w.collapseWarning&&l.addEvent(i,{kind:"error",errorMessage:`Low diversity score (${w.diversityScore.toFixed(2)}) - chunks may be too similar`,durationMs:0})}}catch(S){const N=S instanceof Error?S.message:"Unknown error";l.addEvent(i,{kind:"error",errorMessage:`Tree-aware retrieval failed: ${N} — falling back to pipeline`,durationMs:0})}}if(E.length>0&&(f!=="tree-aware"||!b)){const C=g.reduce((O,Y)=>O+Y.baseTokens,0),M=new Map;for(const O of t)M.set(O.name,O.depth);const S=E.map(O=>({name:O.name,knowledgeType:O.sourceType,rawTokens:at(O.content||""),depthMultiplier:hR[M.get(O.name)??2]??1})),N=gR(S,C),R=new Map;for(const O of N)R.set(O.name,O.allocatedTokens);for(const O of E){const Z=(R.get(O.name)??C)*4;O.content&&O.content.length>Z&&(O.content=O.content.slice(0,Z))}const T=f==="agent-driven",D=p9({task:u,sources:E,tokenBudget:C});l.addEvent(i,{kind:"retrieval",sourceName:"pipeline:index",query:u,resultCount:D.indexes.length,durationMs:D.indexMs});let H="",V=g.filter(O=>O.path&&s.getIndex(O.path)!=null||O.content).map(O=>({nodeId:O.name,depth:O.depth,priority:O.knowledgeType==="ground-truth"?0:O.knowledgeType==="signal"?1:2}));if(T&&D.indexes.length>0){const O=Date.now();try{let Y=u;if(o9(u))try{const A=n9(u),q=await _u(A,m,h);q.length>20&&(Y=q,l.addEvent(i,{kind:"llm_call",model:h,durationMs:Date.now()-O,toolResult:`HyDE generated ${q.length} chars for navigation`}))}catch(A){l.addEvent(i,{kind:"error",errorMessage:`HyDE failed: ${A instanceof Error?A.message:"Unknown"} — using original query`,durationMs:0})}const Z=D.indexes.map(kg),U=vg(Z,{task:Y,tokenBudget:C});H=await _u(U,m,h);const _=Zu(H);_.length>0&&(V=_),l.addEvent(i,{kind:"llm_call",model:h,durationMs:Date.now()-O,toolResult:`Agent selected ${_.length} branches`})}catch(Y){l.addEvent(i,{kind:"error",errorMessage:`Navigation failed: ${Y instanceof Error?Y.message:"Unknown"} — using manual depths`,durationMs:Date.now()-O})}}y=Lk(D.indexes,H,{task:u,sources:E,tokenBudget:C,manualSelections:H?void 0:V,compression:{enabled:!0,aggressiveness:.5}},D.indexMs),l.addEvent(i,{kind:"retrieval",sourceName:"pipeline:compress",resultCount:y.sources.length,durationMs:y.timing.compressionMs});const B=Zu(H);if(T&&B.length>0&&y.context.trim())try{const O=e9(u,y.context),Y=await _u(O,m,h),Z=t9(Y);if(Z.length>0){const U=await P9(Z,D.indexes,B,{providerId:m,model:h,totalBudget:C},i);if(U.length>0){const _=[...B,...U],A=JSON.stringify(_);y=Lk(D.indexes,A,{task:u,sources:E,tokenBudget:C,manualSelections:void 0,compression:{enabled:!0,aggressiveness:.5}},D.indexMs),l.addEvent(i,{kind:"retrieval",sourceName:"pipeline:re-navigation",resultCount:U.length,durationMs:0})}}}catch(O){l.addEvent(i,{kind:"error",errorMessage:`Corrective re-navigation failed: ${O instanceof Error?O.message:"Unknown"}`,durationMs:0})}if(y.context.trim()){const O=$9(y,t,u);b=O.knowledgeBlock,v=O.provenance}else y&&(v=kh(y,t))}return b||(b=L9(e)),v&&l.addEvent(i,{kind:"provenance",provenanceSources:v.sources.map(C=>({path:C.path,type:C.type,sections:C.sections,depth:C.depth,chunkCount:C.chunkCount||0})),provenanceDerivations:v.derivations,resultCount:v.sources.length}),{knowledgeBlock:b,pipelineResult:y,provenance:v,retrievalResult:w}}const Pm=new Map;async function B9(e){const{url:t,ref:n,subdir:r}=e;if(!t||typeof t!="string")throw new Error("GitHub URL is required");try{const i={url:t,persist:!0};n&&typeof n=="string"&&(i.ref=n),r&&typeof r=="string"&&(i.subdir=r);const s=await fetch(`${ze}/repo/index-github`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok){const y=await s.text();throw new Error(`Failed to index GitHub repo: ${s.status} ${y}`)}const l=await s.json();if(l.status!=="ok"||!l.data)throw new Error(l.error||"Indexing failed");const{data:u}=l,f=u.totalTokens??u.scan?.totalTokens??5e3,m=u.scan,h=Array.isArray(m?.stack)?m.stack:m?.stack&&typeof m.stack=="object"?Object.values(m.stack).filter(y=>typeof y=="string"&&y!=="unknown"&&y!=="none"):[],g=ie.getState().addChannel;let b=0;for(const y of u.files){const v=`${u.outputDir}/${y}`,w=y.includes("overview"),E={sourceId:`repo-${y}-${Date.now()}`,name:y.replace(".compressed.md","").replace(".md","").replace(/^\d+-/,""),path:v,category:"knowledge",knowledgeType:"ground-truth",depth:w?1:2,baseTokens:Math.floor(f/u.files.length),repoMeta:{name:u.name||Hk(t),totalFiles:m?.totalFiles??u.files.length,stack:h,features:m?.features?.map(C=>C.name)??[],baseUrl:m?.baseUrl}};w&&u.overviewMarkdown&&(E.content=u.overviewMarkdown),g(E),b++}return`Successfully indexed GitHub repository "${Hk(t)}". Added ${b} knowledge sources:
|
|
634
|
+
`+u.files.map(y=>`- ${y.replace(".compressed.md","").replace(".md","").replace(/^\d+-/,"")}`).join(`
|
|
635
|
+
`)+`
|
|
636
|
+
|
|
637
|
+
Repository stats: ${m?.totalFiles??u.files.length} files, ${h.length} tech stack items, ${f} tokens`}catch(i){throw new Error(`GitHub indexing failed: ${i instanceof Error?i.message:String(i)}`)}}async function H9(e){const{path:t}=e;if(!t||typeof t!="string")throw new Error("Local repository path is required");try{const n=await fetch(`${ze}/repo/index`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!n.ok){const u=await n.text();throw new Error(`Failed to index local repo: ${n.status} ${u}`)}const r=await n.json();if(r.status!=="ok"||!r.data)throw new Error(r.error||"Indexing failed");const{data:i}=r,s=ie.getState().addChannel;let l=0;for(const u of i.files){const f=`${i.outputDir}/${u}`,m={sourceId:`local-repo-${u}-${Date.now()}`,name:u.replace(".compressed.md","").replace(".md","").replace(/^\d+-/,""),path:f,category:"knowledge",knowledgeType:"ground-truth",depth:2,baseTokens:Math.floor((i.totalTokens??5e3)/i.files.length)};s(m),l++}return`Successfully indexed local repository at "${t}". Added ${l} knowledge sources:
|
|
638
|
+
`+i.files.map(u=>`- ${u.replace(".compressed.md","").replace(".md","").replace(/^\d+-/,"")}`).join(`
|
|
639
|
+
`)}catch(n){throw new Error(`Local repository indexing failed: ${n instanceof Error?n.message:String(n)}`)}}async function U9(e){const{path:t}=e;if(!t||typeof t!="string")throw new Error("Directory path is required");try{const n=await fetch(`${ze}/repo/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!n.ok){const u=await n.text();throw new Error(`Failed to scan directory: ${n.status} ${u}`)}const r=await n.json();if(r.status!=="ok"||!r.data)throw new Error(r.error||"Scan failed");const{data:i}=r,s=Array.isArray(i.stack)?i.stack:Object.values(i.stack).filter(u=>typeof u=="string"&&u!=="unknown"&&u!=="none");let l=`Directory scan results for "${t}":
|
|
640
|
+
|
|
641
|
+
`;return l+=`📁 Files: ${i.totalFiles}
|
|
642
|
+
`,l+=`📊 Estimated tokens: ${i.totalTokens}
|
|
643
|
+
|
|
644
|
+
`,s.length>0&&(l+=`🛠️ Tech stack detected:
|
|
645
|
+
${s.map(u=>`- ${u}`).join(`
|
|
646
|
+
`)}
|
|
647
|
+
|
|
648
|
+
`),i.features.length>0&&(l+=`✨ Features found:
|
|
649
|
+
${i.features.map(u=>`- ${u.name}${u.description?": "+u.description:""}`).join(`
|
|
650
|
+
`)}
|
|
651
|
+
|
|
652
|
+
`),l+="Use `index_local_repo` to add this as a knowledge source.",l}catch(n){throw new Error(`Directory scanning failed: ${n instanceof Error?n.message:String(n)}`)}}async function q9(e){const{path:t}=e;if(!t||typeof t!="string")throw new Error("File path is required");try{const n=await fetch(`${ze}/knowledge/index`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!n.ok){const u=await n.text();throw new Error(`Failed to index file: ${n.status} ${u}`)}const r=await n.json();if(r.status!=="ok"||!r.data)throw new Error(r.error||"Indexing failed");const{data:i}=r,s=ie.getState().addChannel,l={sourceId:`file-${Date.now()}`,name:i.name,path:t,category:"knowledge",knowledgeType:"evidence",depth:1,baseTokens:i.tokens};return s(l),`Successfully indexed "${i.name}" (${i.tokens} tokens) as a knowledge source.`}catch(n){throw new Error(`File indexing failed: ${n instanceof Error?n.message:String(n)}`)}}async function G9(e){const{query:t,limit:n=5}=e;if(!t||typeof t!="string")throw new Error("Search query is required");try{const r=ie.getState().channels.filter(v=>v.enabled&&(v.content||v.path));if(r.length===0)return"No knowledge sources indexed yet. Use `index_github_repo` or `index_knowledge_file` to add sources first.";const i=[];for(const v of r){let w=v.content;if(!w&&v.path)if(Pm.has(v.path))w=Pm.get(v.path);else try{const E=await fetch(`${ze}/knowledge/read?path=${encodeURIComponent(v.path)}`);E.ok&&(w=await E.text(),Pm.set(v.path,w))}catch(E){console.error(`Failed to fetch content for ${v.path}:`,E)}if(w){const E=w.split(/(?=^#{1,3}\s)/m).filter(C=>C.trim());for(const C of E)C.trim().length>20&&i.push({text:C.trim().slice(0,1024),source:v.name})}}if(i.length===0)return"Knowledge sources exist but have no inline content to search. Try reading specific files with `read_file`.";const s=[t,...i.map(v=>v.text)],l=await fetch(`${ze}/embeddings/embed`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({texts:s})});if(!l.ok)throw new Error(`Embedding service error: ${l.status}`);const{embeddings:u}=await l.json(),f=u[0],m=u.slice(1),h=(v,w)=>{let E=0,C=0,M=0;for(let S=0;S<v.length;S++)E+=v[S]*w[S],C+=v[S]**2,M+=w[S]**2;return E/(Math.sqrt(C)*Math.sqrt(M)||1)},g=i.map((v,w)=>({...v,score:h(f,m[w])}));g.sort((v,w)=>w.score-v.score);const b=g.slice(0,Number(n)||5);let y=`Found ${b.length} relevant chunks for "${t}":
|
|
653
|
+
|
|
654
|
+
`;for(const v of b)y+=`**[${v.source}]** (relevance: ${(v.score*100).toFixed(0)}%)
|
|
655
|
+
`,y+=v.text.slice(0,500)+(v.text.length>500?"...":"")+`
|
|
656
|
+
|
|
657
|
+
---
|
|
658
|
+
|
|
659
|
+
`;return y}catch(r){throw new Error(`Knowledge search failed: ${r instanceof Error?r.message:String(r)}`)}}async function K9(e){const{path:t}=e;if(!t||typeof t!="string")throw new Error("File path is required");try{const n=await fetch(`${ze}/knowledge/read?path=${encodeURIComponent(t)}`);if(!n.ok){const i=await n.text();throw new Error(`Failed to read file: ${n.status} ${i}`)}const r=await n.text();return r.length>8e3?r.substring(0,8e3)+`
|
|
660
|
+
|
|
661
|
+
[Content truncated - file is very large]`:r}catch(n){throw new Error(`File reading failed: ${n instanceof Error?n.message:String(n)}`)}}function Hk(e){const t=e.match(/github\.com\/([^\/]+\/[^\/]+)/);return t?t[1]:e}function q2(){return[{name:"index_github_repo",description:"Clone and index a GitHub repository to make its code available as knowledge context. Returns an overview and feature documentation.",inputSchema:{type:"object",properties:{url:{type:"string",description:"GitHub repository URL"},ref:{type:"string",description:"Git reference (branch, tag, or commit) to clone (optional)"},subdir:{type:"string",description:"Subdirectory to focus on (optional)"}},required:["url"]},execute:B9},{name:"index_local_repo",description:"Index a local repository to make its code available as knowledge context.",inputSchema:{type:"object",properties:{path:{type:"string",description:"Local repository path"}},required:["path"]},execute:H9},{name:"scan_directory",description:"Scan a local directory to discover its structure, tech stack, and features.",inputSchema:{type:"object",properties:{path:{type:"string",description:"Directory path to scan"}},required:["path"]},execute:U9},{name:"index_knowledge_file",description:"Index a markdown or text file to make it available as knowledge context.",inputSchema:{type:"object",properties:{path:{type:"string",description:"Path to the markdown or text file"}},required:["path"]},execute:q9},{name:"search_knowledge",description:"Semantically search across all indexed knowledge sources using embeddings.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search query text"},limit:{type:"number",description:"Maximum number of results to return (default: 10)"}},required:["query"]},execute:G9},{name:"read_file",description:"Read the content of a file from an allowed directory.",inputSchema:{type:"object",properties:{path:{type:"string",description:"File path to read"}},required:["path"]},execute:K9}]}function G2(){const e=[],t=vt.getState();for(const r of t.servers)if(r.status==="connected")for(const i of r.tools)e.push({name:i.name,description:i.description||"No description",inputSchema:i.inputSchema||{type:"object",properties:{}},origin:{kind:"mcp",serverId:r.id,serverName:r.name}});for(const r of q2())e.push({name:r.name,description:r.description,inputSchema:r.inputSchema,origin:{kind:"builtin",serverId:"modular-studio",serverName:"Modular Studio"}});const n=new Map;for(const r of e)n.set(r.name,(n.get(r.name)??0)+1);return e.map(r=>(n.get(r.name)??0)>1?{...r,name:`${r.origin.serverId}__${r.name}`}:r)}function K2(e){return e==="anthropic"||e==="openai"||e==="openrouter"}function V9(e){return e.map(t=>({name:t.name,description:t.description,input_schema:t.inputSchema}))}function Y9(e){return e.map(t=>({type:"function",function:{name:t.name,description:t.description,parameters:t.inputSchema}}))}function W9(e,t){const n=e.find(i=>i.name===t);if(n)return n.origin;const r=t.includes("__")?t.split("__").slice(1).join("__"):null;return r?e.find(i=>i.name===r)?.origin??null:null}async function X9(e,t,n){const r=W9(n,e);if(!r)return{result:"",serverId:"",error:`Tool "${e}" not found in registry`};if(r.kind==="builtin"){const l=q2().find(u=>u.name===e);if(!l)return{result:"",serverId:r.serverId,error:`Built-in tool "${e}" not found`};try{return{result:await l.execute(t),serverId:r.serverId}}catch(u){const f=u instanceof Error?u.message:String(u);return{result:"",serverId:r.serverId,error:f}}}const i=vt.getState();try{const s=await i.callTool(r.serverId,e,t);if(s==null)return e==="get_file_contents"?{result:"No content returned. This path may be a directory - use list_directory first, or check the file tree in your context.",serverId:r.serverId}:{result:"Tool returned no result. Check arguments.",serverId:r.serverId};let l;return s&&typeof s=="object"&&"content"in s?(l=s.content.filter(f=>f.type==="text"&&f.text).map(f=>f.text).join(`
|
|
662
|
+
`),l||(l=JSON.stringify(s))):l=typeof s=="string"?s:JSON.stringify(s),{result:l,serverId:r.serverId}}catch(s){const l=s instanceof Error?s.message:String(s);return{result:"",serverId:r.serverId,error:l}}}async function Z9(e,t,n,r){const l=dt.getState().providers.find(h=>h.id===e)?.type??"openai",u=l==="anthropic"?V9(r):Y9(r),f=await fetch(`${ze}/llm/chat-tools`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,model:t,messages:n,tools:u})});if(!f.ok){const h=await f.text().catch(()=>"");throw new Error(`LLM tool call failed (${f.status}): ${h||f.statusText}`)}const m=await f.json();return l==="anthropic"?Q9(m):J9(m)}function Q9(e){const t=e.content??[],n=e.usage,r=e.stop_reason??"end_turn",i=t.filter(l=>l.type==="text").map(l=>l.text??""),s=t.filter(l=>l.type==="tool_use");return{content:i.join(""),toolCalls:s.map(l=>({id:l.id??`tc-${Date.now()}`,name:l.name??"",args:l.input??{}})),inputTokens:n?.input_tokens??0,outputTokens:n?.output_tokens??0,rawAssistantMessage:{role:"assistant",content:t},stopReason:r}}function J9(e){const t=e.choices??[],n=e.usage,r=t[0]?.message,i=t[0]?.finish_reason??"stop";return{content:r?.content??"",toolCalls:(r?.tool_calls??[]).map(s=>{let l={};try{l=JSON.parse(s.function.arguments)}catch{l={_raw:s.function.arguments,_parseError:!0}}return{id:s.id,name:s.function.name,args:l}}),inputTokens:n?.prompt_tokens??0,outputTokens:n?.completion_tokens??0,rawAssistantMessage:{role:"assistant",...r},stopReason:i}}function e7(e,t){return e==="anthropic"?[{role:"user",content:t.map(n=>({type:"tool_result",tool_use_id:n.id,content:n.error?`Error: ${n.error}`:n.result,...n.error?{is_error:!0}:{}}))}]:t.map(n=>({role:"tool",tool_call_id:n.id,content:n.error?`Error: ${n.error}`:n.result}))}async function t7(e){const{providerId:t,model:n,messages:r,traceId:i,maxTurns:s=10,callbacks:l}=e,u=Hn.getState(),h=dt.getState().providers.find(E=>E.id===t)?.type??"openai",g=G2(),b=[];let y=0,v=0;const w=[...r];if(g.length===0||!K2(h)){l.onError(new Error("No tools available or provider does not support tool calling"));return}try{for(let E=0;E<s;E++){const C=Date.now(),M=await Z9(t,n,w,g);if(y+=M.inputTokens,v+=M.outputTokens,u.addEvent(i,{kind:"llm_call",model:n,inputTokens:M.inputTokens,outputTokens:M.outputTokens,durationMs:Date.now()-C}),M.content&&l.onChunk(M.content),M.toolCalls.length===0){l.onDone({turns:E+1,toolCalls:b,totalInputTokens:y,totalOutputTokens:v});return}w.push(M.rawAssistantMessage);const S=[];for(const R of M.toolCalls){l.onToolCallStart(R.name,R.args);const T=Date.now(),D=await X9(R.name,R.args,g),H=Date.now()-T,V={id:R.id,name:R.name,args:R.args,result:D.result,error:D.error,durationMs:H,serverId:D.serverId};S.push(V),b.push(V),u.addEvent(i,{kind:"tool_call",toolName:R.name,toolArgs:R.args,toolResult:(D.error||D.result).slice(0,500),toolError:D.error,mcpServerId:D.serverId,durationMs:H}),l.onToolCallEnd(V)}const N=e7(h,S);w.push(...N)}l.onDone({turns:s,toolCalls:b,totalInputTokens:y,totalOutputTokens:v})}catch(E){l.onError(E instanceof Error?E:new Error(String(E)))}}async function n7(e){const{providerId:t,model:n,messages:r,userMessage:i,systemPrompt:s,traceId:l,onChunk:u}=e,f=Hn.getState(),m=G2(),b=dt.getState().providers.find(C=>C.id===t)?.type??"openai",y=m.length>0&&K2(b)&&t!=="claude-agent-sdk";let v=[],w=0,E="";if(y){const C=Date.now();f.addEvent(l,{kind:"llm_call",model:n,inputTokens:r.reduce((M,S)=>M+at(typeof S.content=="string"?S.content:JSON.stringify(S.content)),0)}),await new Promise((M,S)=>{t7({providerId:t,model:n,messages:r,traceId:l,maxTurns:10,callbacks:{onChunk:N=>{E+=N,u(N)},onToolCallStart:(N,R)=>{u(`
|
|
663
|
+
|
|
664
|
+
🔧 Calling **${N}**...
|
|
665
|
+
`)},onToolCallEnd:N=>{N.error?u(`❌ ${N.name} failed: ${N.error}
|
|
666
|
+
`):u(`✅ ${N.name} (${N.durationMs}ms)
|
|
667
|
+
`)},onDone:N=>{v=N.toolCalls,w=N.turns,f.addEvent(l,{kind:"llm_call",model:n,outputTokens:N.totalOutputTokens,durationMs:Date.now()-C}),M()},onError:N=>S(N)}})})}else{const C=Date.now();f.addEvent(l,{kind:"llm_call",model:n,inputTokens:r.reduce((S,N)=>S+at(typeof N.content=="string"?N.content:JSON.stringify(N.content)),0)});let M="";await new Promise((S,N)=>{const R={onChunk:T=>{M+=T,E+=T,u(T)},onDone:()=>{f.addEvent(l,{kind:"llm_call",model:n,outputTokens:at(M),durationMs:Date.now()-C}),S()},onError:T=>N(T)};t==="claude-agent-sdk"?Wk({prompt:i,model:n,systemPrompt:s,...R}):Xk({providerId:t,model:n,messages:r,...R})})}return{fullResponse:E,toolCallResults:v,toolTurns:w}}async function o7(e){const{fullResponse:t,userMessage:n,agentId:r,sandboxRunId:i,traceId:s,activeChannels:l,memoryStats:u}=e,f=Hn.getState(),m=rt.getState();let h=u;if(m.longTerm.enabled&&t){const y=zP({userMessage:n,assistantResponse:t,agentId:r,traceId:s,sandboxRunId:i});h&&(h={...h,writtenFacts:y.stored.length,writeMs:y.durationMs,domains:y.stored.length>0?[...new Set([...h.domains,...y.stored.map(v=>v.domain)])]:h.domains})}f.endTrace(s);const g=[],b=Xn.getState();for(const y of l){let v=function(M){M.depth>0&&M.depth<=2&&E.push({nodeId:M.nodeId,title:M.title,depth:M.depth,tokens:M.totalTokens});for(const S of M.children)v(S)},w=y.path?b.getIndex(y.path):null;if(!w&&y.content){const M=`content://${y.contentSourceId||y.sourceId}`;w=Ci(M,y.content)}if(!w)continue;const E=[];v(w.root);const C=ll(w,y.depth);g.push({name:y.name,path:y.path||`content://${y.contentSourceId||y.sourceId}`,nodeCount:w.nodeCount,totalTokens:w.totalTokens,filteredTokens:C.totalTokens,depth:y.depth,knowledgeType:y.knowledgeType,headings:E})}return{heatmap:g,memoryStats:h}}function wh(){const{agentConfig:e}=ie.getState(),{selectedProviderId:t,providers:n}=dt.getState(),r=n.find(l=>l.id===t),i=Array.isArray(r?.models)?r.models:[];if(!r||r.status!=="connected"&&r.status!=="configured"||i.length===0)return{providerId:"",model:"",error:"No provider/model configured. Open Settings → Providers, connect one provider, refresh models, then retry."};const s=i.some(l=>l.id===e.model);return{providerId:r.id,model:s?e.model:i[0].id}}async function r7(e){const{userMessage:t,channels:n,history:r,providerId:i,model:s,onChunk:l,onDone:u,onError:f}=e,m=Hn.getState(),g=ua.getState().currentVersion||"0.0.0",b=m.startTrace(`chat-${Date.now()}`,g);try{let y=Vs();const v=n.filter(z=>z.enabled),{frameworkBlock:w,frameworkSummary:E,regularChannels:C,residualKnowledgeBlock:M}=v.length>0?await I2(v,b):{frameworkBlock:"",frameworkSummary:void 0,regularChannels:[],residualKnowledgeBlock:""};let{knowledgeBlock:S,pipelineResult:N,provenance:R,retrievalResult:T}=v.length>0?await U2(n,C,M,{userMessage:t,navigationMode:e.navigationMode,providerId:i,model:s},b):{knowledgeBlock:"",pipelineResult:null,provenance:null,retrievalResult:void 0};const D=(e.connectors||[]).filter(z=>z.enabled&&z.direction!=="write");if(D.length>0){const W=`<connectors>
|
|
668
|
+
Available data connectors (use via MCP tools):
|
|
669
|
+
${D.map(ae=>{const le=ae.hint?` (scope: ${ae.hint})`:"";return`- ${ae.name} [${ae.service}] — ${ae.direction}${le}`}).join(`
|
|
670
|
+
`)}
|
|
671
|
+
</connectors>`;S=S?`${S}
|
|
672
|
+
|
|
673
|
+
${W}`:W}const H=rt.getState();let V="",B;if(H.longTerm.enabled){H.sandbox.isolation==="reset_each_run"&&RP();const z=await R2({userMessage:t,agentId:e.agentId,traceId:b,sandboxRunId:e.sandboxRunId});z.contextBlock&&(V=z.contextBlock),B={recalledFacts:z.facts.length,writtenFacts:0,recallMs:z.durationMs,writeMs:0,recallTokens:z.tokenEstimate,domains:[...new Set(z.facts.map(W=>W.domain))]}}R&&(y=Vs(R));const O=uS(n,Xn.getState().getIndex),Y=n.some(z=>z.enabled&&z.repoMeta),Z=dS({frame:y,orientationBlock:O,hasRepos:Y,knowledgeFormatGuide:O2(),frameworkBlock:w,memoryBlock:V,knowledgeBlock:S}),U=at(Z),_=[{role:"system",content:Z},...r.filter(z=>z.content.trim()!=="").map(z=>({role:z.role,content:z.content})),{role:"user",content:t}],{fullResponse:A,toolCallResults:q,toolTurns:K}=await n7({providerId:i,model:s,messages:_,userMessage:t,systemPrompt:Z,traceId:b,onChunk:l}),{heatmap:Q,memoryStats:I}=await o7({fullResponse:A,userMessage:t,agentId:e.agentId,sandboxRunId:e.sandboxRunId,traceId:b,activeChannels:v,memoryStats:B}),F=U+r.reduce((z,W)=>z+at(W.content),0)+at(t),L=T?{queryType:T.queryType,diversityScore:T.diversityScore,collapseWarning:T.collapseWarning,totalChunks:T.totalChunks,selectedChunks:T.chunks.length,budgetUsed:T.budgetUsed,budgetTotal:T.budgetTotal,retrievalMs:T.retrievalMs,embeddingMs:T.embeddingMs,chunks:T.chunks.map(z=>({section:z.section,source:z.source,relevanceScore:z.relevanceScore||0,inclusionReason:z.inclusionReason||"unknown",knowledgeType:z.knowledgeType,tokens:at(z.content)}))}:void 0;u({pipeline:N,systemTokens:U,totalContextTokens:F,heatmap:Q,frameworkSummary:E,toolCalls:q.length>0?q:void 0,toolTurns:K>0?K:void 0,memory:I,retrieval:L})}catch(y){m.addEvent(b,{kind:"error",errorMessage:y instanceof Error?y.message:"Unknown error"}),m.endTrace(b),f(y instanceof Error?y:new Error("Unknown error"))}}const Uk={llm_call:{icon:kl,color:"#9b59b6",label:"LLM Call"},tool_call:{icon:Bn,color:"#2ecc71",label:"Tool Call"},retrieval:{icon:Sl,color:"#3498db",label:"Retrieval"},error:{icon:tS,color:"#e74c3c",label:"Error"},token_usage:{icon:wl,color:"#f1c40f",label:"Tokens"},fact_extracted:{icon:oh,color:"#FE5000",label:"Fact"},handoff:{icon:G3,color:"#1abc9c",label:"Handoff"}};function a7({event:e}){const t=Ee(),[n,r]=$.useState(!1),i=Uk[e.kind]||Uk.error,s=i.icon,l=e.toolArgs||e.toolResult||e.toolError||e.errorStack||e.pageRefs;return d.jsxs("div",{style:{borderBottom:`1px solid ${t.isDark?"#1a1a1e":"#f0f0f5"}`},children:[d.jsxs("button",{type:"button",onClick:()=>l&&r(!n),className:"flex items-center gap-2 w-full px-3 py-2 border-none bg-transparent text-left",style:{cursor:l?"pointer":"default"},children:[d.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:e.toolError||e.errorMessage?"#e74c3c":i.color,flexShrink:0}}),d.jsx(s,{size:10,style:{color:i.color,flexShrink:0}}),d.jsxs("span",{className:"text-[12px] flex-1 truncate",style:{fontFamily:"'Geist Sans', sans-serif",color:t.textPrimary},children:[e.kind==="tool_call"&&`${e.mcpServerName||e.mcpServerId}.${e.toolName}`,e.kind==="llm_call"&&`${e.model||"LLM"} — ${e.inputTokens||"?"}→${e.outputTokens||"?"} tokens`,e.kind==="retrieval"&&`${e.sourceName||e.sourceId} (${e.resultCount||0} results)`,e.kind==="error"&&(e.rootCause||e.errorMessage||"Unknown error"),e.kind==="fact_extracted"&&"Fact extracted from conversation",e.kind==="handoff"&&`→ ${e.toAgentId}`,e.kind==="token_usage"&&`${(e.inputTokens||0)+(e.outputTokens||0)} tokens`]}),e.durationMs!=null&&d.jsxs("span",{className:"text-[12px] shrink-0",style:{fontFamily:"'Geist Mono', monospace",color:e.durationMs>2e3?"#e74c3c":t.textFaint},children:[e.durationMs,"ms"]}),e.costUsd!=null&&e.costUsd>0&&d.jsxs("span",{className:"text-[12px] shrink-0",style:{fontFamily:"'Geist Mono', monospace",color:t.textFaint},children:["$",e.costUsd.toFixed(4)]}),l&&(n?d.jsx(Pn,{size:9,style:{color:t.textFaint}}):d.jsx(Go,{size:9,style:{color:t.textFaint}}))]}),n&&d.jsxs("div",{className:"px-3 pb-2 ml-6 text-[13px] flex flex-col gap-1",style:{fontFamily:"'Geist Mono', monospace",color:t.textDim},children:[e.toolArgs&&d.jsxs("div",{children:[d.jsx("span",{style:{color:t.textFaint},children:"Args:"}),d.jsx("pre",{className:"mt-0.5 p-1.5 rounded overflow-x-auto",style:{background:t.isDark?"#0d0d10":"#f5f5fa",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-all"},children:JSON.stringify(e.toolArgs,null,2).slice(0,500)})]}),e.toolResult&&d.jsxs("div",{children:[d.jsx("span",{style:{color:t.textFaint},children:"Result:"}),d.jsx("pre",{className:"mt-0.5 p-1.5 rounded overflow-x-auto",style:{background:t.isDark?"#0d0d10":"#f5f5fa",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-all"},children:e.toolResult.slice(0,500)})]}),e.toolError&&d.jsxs("div",{style:{color:"#e74c3c"},children:[d.jsx("span",{style:{color:"#e74c3c99"},children:"Error:"})," ",e.toolError]}),e.rootCause&&d.jsxs("div",{style:{color:"#e74c3c"},children:[d.jsx("span",{style:{color:"#e74c3c99"},children:"Root cause:"})," ",e.rootCause]}),e.pageRefs&&e.pageRefs.length>0&&d.jsxs("div",{children:[d.jsx("span",{style:{color:t.textFaint},children:"Page refs:"})," ",e.pageRefs.join(", ")]}),e.errorStack&&d.jsxs("details",{children:[d.jsx("summary",{style:{cursor:"pointer",color:t.textFaint},children:"Stack trace"}),d.jsx("pre",{className:"mt-0.5 p-1.5 rounded overflow-x-auto",style:{background:t.isDark?"#0d0d10":"#f5f5fa",margin:0,fontSize:"8px"},children:e.errorStack})]})]})]})}function i7({trace:e}){const t=Ee(),n=e.summary;return n?d.jsxs("div",{className:"flex gap-3 px-3 py-1.5 text-[12px]",style:{fontFamily:"'Geist Mono', monospace",color:t.textDim,borderBottom:`1px solid ${t.isDark?"#1a1a1e":"#f0f0f5"}`},children:[d.jsxs("span",{children:[n.totalTokens.toLocaleString()," tokens"]}),n.totalCostUsd>0&&d.jsxs("span",{children:["$",n.totalCostUsd.toFixed(4)]}),d.jsxs("span",{children:[n.toolCalls," tools"]}),n.toolErrors>0&&d.jsxs("span",{style:{color:"#e74c3c"},children:[n.toolErrors," errors"]}),d.jsxs("span",{children:[n.retrievals," retrievals"]}),d.jsxs("span",{children:[(n.durationMs/1e3).toFixed(1),"s"]})]}):null}function s7(){const e=Ee(),t=Hn(l=>l.traces),n=Hn(l=>l.clearTraces),[r,i]=$.useState(null),s=r?t.find(l=>l.id===r):t[t.length-1];return t.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-2",children:[d.jsx(oh,{size:20,style:{color:e.textFaint}}),d.jsx("div",{className:"text-[13px]",style:{color:e.textDim},children:"No traces yet"}),d.jsx("div",{className:"text-[13px] text-center px-4",style:{color:e.textFaint},children:"Run a conversation to capture execution traces — tool calls, retrievals, errors, and token usage."})]}):d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:`1px solid ${e.isDark?"#1e1e22":"#e8e8ec"}`},children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(oh,{size:11,style:{color:"#FE5000"}}),d.jsx("span",{className:"text-[12px] uppercase tracking-wider font-bold",style:{fontFamily:"'Geist Mono', monospace",color:e.textPrimary},children:"Traces"}),d.jsx("span",{className:"text-[13px] px-1.5 py-0.5 rounded-full",style:{background:"#FE500015",color:"#FE5000",fontFamily:"'Geist Mono', monospace"},children:t.length})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[t.length>1&&d.jsx("select",{value:s?.id||"",onChange:l=>i(l.target.value),className:"text-[13px] px-1 py-0.5 rounded border-none outline-none cursor-pointer",style:{background:e.surfaceElevated,color:e.textDim,fontFamily:"'Geist Mono', monospace"},children:t.map((l,u)=>d.jsxs("option",{value:l.id,children:["Run #",u+1," (",l.events.length," events)"]},l.id))}),d.jsx("button",{type:"button","aria-label":"Clear traces",onClick:n,className:"p-2.5 border-none bg-transparent cursor-pointer rounded min-w-[44px] min-h-[44px] flex items-center justify-center",style:{color:e.textFaint},children:d.jsx($t,{size:10})})]})]}),s&&d.jsx(i7,{trace:s}),d.jsx("div",{className:"flex-1 overflow-y-auto",children:s?.events.map(l=>d.jsx(a7,{event:l},l.id))})]})}function l7({stats:e}){const[t,n]=$.useState(!1),r=Ee(),i=e.totalContextTokens||0,s=e.retrieval?.selectedChunks||0,l=e.retrieval?.retrievalMs||0,u=e.retrieval?.embeddingMs||0,f=l+u,m=e.retrieval?.queryType||"none",h=e.toolTurns||0;return d.jsxs("div",{className:"mt-2 border rounded-md overflow-hidden transition-all duration-200",style:{border:`1px solid ${r.borderSubtle}`,background:r.isDark?"#0d0d10":"#f8f8fa",fontFamily:"'Geist Mono', monospace"},children:[d.jsxs("button",{onClick:()=>n(!t),className:"w-full px-3 py-2 text-left text-xs flex items-center justify-between hover:opacity-80 transition-opacity",style:{color:r.textDim},children:[d.jsxs("span",{children:["📊 ",i," tokens • ",s," sources • ",f,"ms",h>0&&` • ${h} tool calls`]}),d.jsx("span",{className:"text-[10px]",style:{color:"#FE5000"},children:t?"▼":"▶"})]}),t&&d.jsxs("div",{className:"px-3 pb-3 pt-1 text-xs space-y-2 border-t",style:{borderTop:`1px solid ${r.borderSubtle}`,color:r.textSecondary},children:[d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Context tokens:"}),d.jsx("span",{style:{color:r.textPrimary},children:i.toLocaleString()})]}),e.retrieval&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Retrieval mode:"}),d.jsx("span",{style:{color:r.textPrimary},children:m})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Sources selected:"}),d.jsxs("span",{style:{color:r.textPrimary},children:[s," / ",e.retrieval.totalChunks]})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Retrieval time:"}),d.jsxs("span",{style:{color:r.textPrimary},children:[l,"ms"]})]}),u>0&&d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Embedding time:"}),d.jsxs("span",{style:{color:r.textPrimary},children:[u,"ms"]})]})]}),h>0&&d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Tool turns:"}),d.jsx("span",{style:{color:r.textPrimary},children:h})]}),e.systemTokens&&e.systemTokens!==i&&d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"System tokens:"}),d.jsx("span",{style:{color:r.textPrimary},children:e.systemTokens.toLocaleString()})]}),e.memory&&d.jsxs("div",{className:"pt-1 border-t",style:{borderTop:`1px solid ${r.borderSubtle}`},children:[d.jsx("div",{className:"text-[10px] mb-1",style:{color:r.textDim},children:"Memory"}),d.jsxs("div",{className:"flex justify-between text-[11px]",children:[d.jsx("span",{children:"Facts written:"}),d.jsx("span",{style:{color:r.textPrimary},children:e.memory.writtenFacts})]}),e.memory.recalledFacts>0&&d.jsxs("div",{className:"flex justify-between text-[11px]",children:[d.jsx("span",{children:"Facts recalled:"}),d.jsx("span",{style:{color:r.textPrimary},children:e.memory.recalledFacts})]})]})]})]})}const c7={toolCalling:"Tool Calling",streaming:"Streaming",structuredOutput:"Structured Output",memoryHooks:"Memory Hooks",agentLoop:"Agent Loop",mcpBridge:"MCP Bridge"},Rt="supported",Fn="degraded",zs="unsupported",ku={anthropic:{toolCalling:{status:Rt},streaming:{status:Rt},structuredOutput:{status:Rt},memoryHooks:{status:Rt},agentLoop:{status:Rt},mcpBridge:{status:Rt}},"claude-agent-sdk":{toolCalling:{status:Rt},streaming:{status:Rt},structuredOutput:{status:Rt},memoryHooks:{status:Rt},agentLoop:{status:Rt},mcpBridge:{status:Rt}},openai:{toolCalling:{status:Rt},streaming:{status:Rt},structuredOutput:{status:Rt},memoryHooks:{status:Fn,note:"Requires external memory layer"},agentLoop:{status:Rt},mcpBridge:{status:Fn,note:"Via OpenAI-compatible proxy"}},google:{toolCalling:{status:Rt},streaming:{status:Rt},structuredOutput:{status:Fn,note:"JSON mode only, no strict schema"},memoryHooks:{status:zs,note:"Not natively supported"},agentLoop:{status:Fn,note:"Manual orchestration required"},mcpBridge:{status:zs,note:"No MCP support"}},openrouter:{toolCalling:{status:Fn,note:"Depends on underlying model"},streaming:{status:Rt},structuredOutput:{status:Fn,note:"Depends on underlying model"},memoryHooks:{status:Fn,note:"Depends on underlying model"},agentLoop:{status:Fn,note:"Depends on underlying model"},mcpBridge:{status:zs,note:"Not available through proxy"}},custom:{toolCalling:{status:Fn,note:"Depends on implementation"},streaming:{status:Fn,note:"Depends on implementation"},structuredOutput:{status:Fn,note:"Depends on implementation"},memoryHooks:{status:zs,note:"Unknown provider"},agentLoop:{status:Fn,note:"Depends on implementation"},mcpBridge:{status:zs,note:"Unknown provider"}}};function u7(e){return ku[e]?ku[e]:(e.startsWith("custom"),ku.custom)}function d7(e,t){const n=[];for(const r of t){const i=e[r],s=c7[r];i.status==="unsupported"?n.push({level:"error",capability:r,message:`${s} is not supported by this provider${i.note?`: ${i.note}`:""}`}):i.status==="degraded"?n.push({level:"warning",capability:r,message:`${s} has limited support${i.note?`: ${i.note}`:""}`}):n.push({level:"ok",capability:r,message:`${s} is fully supported`})}return n}function p7({matrix:e,requiredCapabilities:t}){const n=Ee();if(t.length===0)return null;const r=d7(e,t),i=r.filter(l=>l.level==="error"),s=r.filter(l=>l.level==="warning");return i.length===0&&s.length===0?null:d.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.map(l=>d.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg text-[12px]",style:{background:n.statusErrorBg,color:n.statusError,border:`1px solid ${n.statusError}30`},role:"alert",children:[d.jsx(rl,{size:12,className:"shrink-0 mt-0.5"}),d.jsx("span",{children:l.message})]},l.capability)),s.map(l=>d.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg text-[12px]",style:{background:n.statusWarningBg,color:n.statusWarning,border:`1px solid ${n.statusWarning}30`},role:"status",children:[d.jsx(tS,{size:12,className:"shrink-0 mt-0.5"}),d.jsx("span",{children:l.message})]},l.capability))]})}function f7(){return`run-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}const qk={id:"",status:"idle",agents:[],sharedFacts:[],contractFacts:[]},dn=fn(e=>({...qk,startRun:(t,n,r)=>e({id:f7(),teamId:n,featureSpec:r,status:"running",agents:t.map(i=>({agentId:i.agentId,name:i.name,status:"waiting",turns:0,facts:[],toolCalls:[],isAgentSdk:i.isAgentSdk})),sharedFacts:[],contractFacts:[],startedAt:Date.now(),completedAt:void 0,error:void 0}),updateAgent:(t,n)=>e(r=>({agents:r.agents.map(i=>i.agentId===t?{...i,...n}:i)})),addFact:(t,n)=>e(r=>n==="shared"?{sharedFacts:[...r.sharedFacts,t]}:n==="contract"?{contractFacts:[...r.contractFacts,t]}:{agents:r.agents.map(i=>i.agentId===n.agentId?{...i,facts:[...i.facts,t]}:i)}),setStatus:(t,n)=>e({status:t,error:n,completedAt:t==="completed"||t==="error"?Date.now():void 0}),reset:()=>e({...qk})})),m7={observation:"#3498db",inference:"#f1c40f",decision:"#2ecc71",hypothesis:"#9b59b6",contract:"#FE5000"};function V2({fact:e}){const t=m7[e.epistemicType]??"#888";return d.jsx("span",{style:{fontSize:12,padding:"2px 6px",borderRadius:4,background:t+"15",color:t,fontFamily:"'Geist Mono', monospace"},children:e.key})}function h7({text:e}){const[t,n]=$.useState(!1);return d.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},style:{background:"none",border:"none",cursor:"pointer",padding:2,opacity:.6},title:"Copy output",children:t?d.jsx(Wt,{size:12,style:{color:"#2ecc71"}}):d.jsx(Pw,{size:12})})}function g7({agent:e,expanded:t}){const n=Ee(),[r,i]=$.useState(t??!1),s={waiting:d.jsx(g_,{size:14,style:{color:n.textDim}}),running:d.jsx(Ot,{size:14,className:"animate-spin",style:{color:"#FE5000"}}),completed:d.jsx(qu,{size:14,style:{color:"#2ecc71"}}),error:d.jsx(rl,{size:14,style:{color:"#dc2626"}})}[e.status],l=e.status==="completed"?e.output:e.currentMessage,u=(l?.length??0)>300;return d.jsxs("div",{style:{padding:12,borderRadius:8,border:`1px solid ${e.status==="running"?"#FE500040":n.border}`,background:e.status==="running"?"#FE500008":n.surface},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:l?8:0},children:[s,d.jsx("span",{style:{fontSize:14,fontWeight:600,color:n.textPrimary,fontFamily:"'Geist Mono', monospace"},children:e.name}),e.isAgentSdk&&d.jsx("span",{style:{fontSize:10,padding:"2px 6px",borderRadius:4,background:"#FE500015",color:"#FE5000",fontFamily:"'Geist Mono', monospace",fontWeight:600,border:"1px solid #FE500030"},children:"Agent SDK"}),d.jsxs("span",{style:{fontSize:12,color:n.textDim,marginLeft:"auto",display:"flex",alignItems:"center",gap:6},children:[e.status==="running"?`Turn ${e.turns}`:e.status,e.tokens&&(e.tokens.input>0||e.tokens.output>0)&&d.jsxs("span",{style:{fontSize:11,color:n.textFaint},children:[((e.tokens.input+e.tokens.output)/1e3).toFixed(1),"k tok"]})]})]}),l&&d.jsxs("div",{style:{position:"relative"},children:[d.jsx("div",{style:{fontSize:13,padding:10,borderRadius:6,background:n.inputBg,color:n.textPrimary,lineHeight:1.6,whiteSpace:"pre-wrap",overflowY:"auto",maxHeight:r?"none":200},children:l}),d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginTop:4},children:[u&&d.jsx("button",{type:"button",onClick:()=>i(!r),style:{background:"none",border:"none",cursor:"pointer",padding:"2px 6px",fontSize:12,color:"#FE5000",display:"flex",alignItems:"center",gap:4,fontFamily:"'Geist Mono', monospace"},children:r?d.jsxs(d.Fragment,{children:[d.jsx(Pn,{size:12})," Collapse"]}):d.jsxs(d.Fragment,{children:[d.jsx(Go,{size:12})," Expand (",Math.ceil((l?.length??0)/1e3),"k chars)"]})}),l&&d.jsx(h7,{text:l})]})]}),e.toolCalls.length>0&&d.jsxs("div",{style:{marginTop:8},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6},children:[d.jsx(Bn,{size:12,style:{color:"#2ecc71"}}),d.jsxs("span",{style:{fontSize:12,fontWeight:600,color:n.textSecondary,fontFamily:"'Geist Mono', monospace"},children:["Tool Calls (",e.toolCalls.length,")"]})]}),d.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:e.toolCalls.map((f,m)=>d.jsxs("div",{style:{fontSize:12,padding:6,borderRadius:4,background:"#2ecc7115",border:"1px solid #2ecc7130",color:n.textSecondary,fontFamily:"'Geist Mono', monospace"},children:[d.jsx("div",{style:{fontWeight:600,color:"#2ecc71",marginBottom:2},children:f.tool}),f.args&&d.jsx("div",{style:{color:n.textDim,fontSize:11,lineHeight:1.4},children:f.args.length>100?f.args.slice(0,100)+"…":f.args})]},m))})]}),e.facts.length>0&&d.jsx("div",{style:{marginTop:8,display:"flex",flexWrap:"wrap",gap:4},children:e.facts.map((f,m)=>d.jsx(V2,{fact:f},m))})]})}function y7({facts:e}){const t=Ee();return e.length===0?null:d.jsxs("div",{style:{padding:12,borderRadius:8,border:`1px solid ${t.border}`,background:t.surface},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[d.jsx(vl,{size:14,style:{color:"#FE5000"}}),d.jsxs("span",{style:{fontSize:13,fontWeight:600,color:t.textPrimary,fontFamily:"'Geist Mono', monospace"},children:["Shared Memory (",e.length,")"]})]}),d.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:e.map((n,r)=>d.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[d.jsx(V2,{fact:n}),d.jsx("span",{style:{fontSize:12,color:t.textDim,flex:1},children:n.value})]},r))})]})}function x7(){const e=Ee(),t=dn(g=>g.status),n=dn(g=>g.agents),r=dn(g=>g.sharedFacts),i=dn(g=>g.startedAt),s=dn(g=>g.completedAt),l=dn(g=>g.error),[u,f]=$.useState(!1);if(t==="idle")return null;const m=s&&i?((s-i)/1e3).toFixed(1):i?((Date.now()-i)/1e3).toFixed(0):"0",h=d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,height:"100%"},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t==="running"&&d.jsx(Ot,{size:14,className:"animate-spin",style:{color:"#FE5000"}}),t==="completed"&&d.jsx(qu,{size:14,style:{color:"#2ecc71"}}),t==="error"&&d.jsx(rl,{size:14,style:{color:"#dc2626"}}),d.jsx("span",{style:{fontSize:13,fontWeight:600,color:e.textPrimary},children:t==="running"?"Running...":t==="completed"?"Completed":"Error"}),d.jsxs("span",{style:{fontSize:12,color:e.textDim},children:[m,"s"]}),d.jsx("button",{type:"button",onClick:()=>f(!u),style:{marginLeft:"auto",background:"none",border:"none",cursor:"pointer",padding:4,color:e.textDim},title:u?"Minimize":"Maximize results",children:u?d.jsx(qh,{size:14}):d.jsx(Gw,{size:14})})]}),l&&d.jsx("div",{style:{fontSize:13,color:"#dc2626",padding:8,borderRadius:6,background:"#dc262610"},children:l}),d.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,flex:1,overflowY:"auto"},children:n.map(g=>d.jsx(g7,{agent:g,expanded:u},g.agentId))}),d.jsx(y7,{facts:r})]});return u?d.jsx("div",{style:{position:"fixed",inset:0,zIndex:100,background:e.bg,padding:24,overflowY:"auto"},children:h}):h}function b7({retrieval:e}){const t=Ee();if(!e)return null;const n=new Map;for(const g of e.chunks){const b=n.get(g.source)||[];b.push(g),n.set(g.source,b)}const r=g=>({"ground-truth":"#e74c3c",signal:"#f1c40f",evidence:"#3498db",framework:"#2ecc71",guideline:"#FE5000",hypothesis:"#9b59b6"})[g]||t.textDim,i=g=>({"ground-truth":"🔴 Ground Truth",signal:"🟡 Signal",evidence:"🔵 Evidence",framework:"🟢 Framework",guideline:"📏 Guideline",hypothesis:"🟣 Hypothesis"})[g]||g,s=g=>{const b={direct:{background:"#2ecc71",color:"#fff"},"parent-expansion":{background:"#f1c40f",color:"#333"},"sibling-coherence":{background:"#3498db",color:"#fff"},unknown:{background:t.border,color:t.textDim}};return b[g]||b.unknown},l=g=>({direct:"● Direct match","parent-expansion":"↑ Parent expanded","sibling-coherence":"↔ Sibling context",unknown:"? Unknown"})[g]||g,u=g=>({direct:"●","parent-expansion":"↑","sibling-coherence":"↔",unknown:"?"})[g]||"?",f=Array.from(n.keys()),m=e.chunks.length,h=e.chunks.reduce((g,b)=>g+b.tokens,0);return d.jsxs("div",{style:{maxHeight:400,overflowY:"auto",padding:12,fontFamily:"'Geist Mono', monospace",fontSize:12},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12,paddingBottom:8,borderBottom:`1px solid ${t.border}30`},children:[d.jsx("span",{style:{fontSize:10,color:t.textDim,textTransform:"uppercase",fontWeight:700},children:"Retrieved Context"}),d.jsxs("span",{style:{fontSize:10,color:t.textDim},children:[m," chunks selected → ",h.toLocaleString()," tokens sent to LLM"]}),d.jsxs("span",{style:{fontSize:10,color:t.textDim,marginLeft:"auto"},children:["Budget: ",e.budgetUsed.toLocaleString()," / ",e.budgetTotal.toLocaleString()," tokens"]})]}),d.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:10},children:f.map((g,b)=>{const y=n.get(g)||[],v=y.reduce((C,M)=>C+M.tokens,0),w=y[0]?.knowledgeType||"signal",E=y.reduce((C,M)=>{const S=M.inclusionReason||"unknown";return C[S]=(C[S]||0)+1,C},{});return d.jsxs("div",{style:{width:280,border:`1px solid ${t.border}40`,borderRadius:8,padding:10,background:t.isDark?"#ffffff04":"#00000003"},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[d.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:r(w),flexShrink:0}}),d.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:g.split("/").pop()||g}),d.jsxs("span",{style:{fontSize:10,color:"#FE5000",fontWeight:600,flexShrink:0},children:[v.toLocaleString()," tok"]})]}),d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6},children:[d.jsx("span",{style:{fontSize:9,color:t.textDim},children:i(w)}),d.jsxs("span",{style:{fontSize:9,color:t.textDim,marginLeft:"auto"},children:[y.length," chunk",y.length>1?"s":""]})]}),d.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:Object.entries(E).map(([C,M])=>d.jsxs("span",{title:l(C),style:{fontSize:9,padding:"2px 5px",borderRadius:3,...s(C)},children:[u(C)," ",M]},C))}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[y.sort((C,M)=>M.relevanceScore-C.relevanceScore).slice(0,5).map((C,M)=>d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[d.jsx("div",{style:{width:20,height:3,borderRadius:1,background:"#333",overflow:"hidden",flexShrink:0},children:d.jsx("div",{style:{width:`${C.relevanceScore*100}%`,height:"100%",background:"#2ecc71"}})}),d.jsxs("span",{style:{fontSize:9,width:22,textAlign:"right",color:t.textDim,flexShrink:0},children:[(C.relevanceScore*100).toFixed(0),"%"]}),d.jsx("span",{style:{fontSize:10,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:t.textPrimary},children:C.section}),d.jsx("span",{style:{fontSize:8,color:t.textFaint,flexShrink:0},children:C.tokens})]},M)),y.length>5&&d.jsxs("span",{style:{fontSize:9,color:t.textDim,paddingTop:2},children:["+",y.length-5," more"]})]})]},b)})}),d.jsxs("div",{style:{display:"flex",gap:12,marginTop:12,paddingTop:8,borderTop:`1px solid ${t.border}30`,flexWrap:"wrap"},children:[d.jsx("span",{style:{fontSize:9,color:t.textDim,fontWeight:600},children:"HOW CHUNKS ARE SELECTED:"}),[{icon:"●",label:"Direct match (semantic similarity)",color:"#2ecc71"},{icon:"↑",label:"Parent expanded (tree context)",color:"#f1c40f"},{icon:"↔",label:"Sibling coherence (related sections)",color:"#3498db"}].map(g=>d.jsxs("span",{style:{fontSize:9,color:g.color,display:"flex",alignItems:"center",gap:3},children:[d.jsx("span",{style:{fontWeight:700},children:g.icon})," ",g.label]},g.icon))]})]})}async function k7(e,t){const n=new TextDecoder;let r="";for(;;){const{done:i,value:s}=await e.read();if(i)break;r+=n.decode(s,{stream:!0});const l=r.split(`
|
|
674
|
+
`);r=l.pop()??"";for(const u of l){const f=u.trim();if(!f||!f.startsWith("data: "))continue;const m=f.slice(6);if(m==="[DONE]"||t(m))return}}}function Gk(e){const t=new AbortController;dn.getState().startRun(e.agents.map(i=>({agentId:i.agentId,name:i.name,isAgentSdk:e.isAgentSdk})),e.teamId);const r={teamId:e.teamId,systemPrompt:e.systemPrompt,task:e.task,providerId:e.providerId,model:e.model,agents:e.agents.map(i=>({agentId:i.agentId,name:i.name,systemPrompt:i.systemPrompt,rolePrompt:i.rolePrompt,repoUrl:i.repoUrl})),tools:e.tools};return fetch(`${ze}/runtime/run-team`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r),signal:t.signal}).then(async i=>{if(!i.ok){const u=await i.text().catch(()=>"");throw new Error(`Runtime error ${i.status}: ${u||i.statusText}`)}const s=i.body?.getReader();if(!s)throw new Error("No response body");let l=!1;await k7(s,u=>{try{const f=JSON.parse(u);if(f.type==="error")return l=!0,dn.getState().setStatus("error",f.error||"Runtime execution failed"),!0;v7(f)}catch{}}),!l&&dn.getState().status!=="error"&&dn.getState().setStatus("completed")}).catch(i=>{i instanceof DOMException&&i.name==="AbortError"||dn.getState().setStatus("error",i instanceof Error?i.message:String(i))}),t}function v7(e){const t=dn.getState();switch(e.type){case"start":e.isAgentSdk!==void 0&&t.agents.forEach(n=>{t.updateAgent(n.agentId,{isAgentSdk:e.isAgentSdk})});break;case"turn":e.agentId&&t.updateAgent(e.agentId,{status:"running",turns:e.turn??0,currentMessage:e.message,...e.tokens&&{tokens:e.tokens}});break;case"fact":e.fact&&(e.agentId&&t.addFact(e.fact,{agentId:e.agentId}),t.addFact(e.fact,"shared"));break;case"tool_call":if(e.agentId){const n=t.agents.find(r=>r.agentId===e.agentId);n&&t.updateAgent(e.agentId,{toolCalls:[...n.toolCalls,{tool:e.tool??"",args:e.args??""}]})}break;case"done":e.agentId&&t.updateAgent(e.agentId,{status:"completed",output:e.result,...e.tokens&&{tokens:e.tokens}});break}}function w7(){const e=Ee(),t=$n(h=>h.lastPipelineStats),[n,r]=$.useState(!1);if(!t)return null;const i=t.pipeline,s=h=>h>=1e3?`${(h/1e3).toFixed(1)}K`:`${h}`,l=["#2ecc71","#3498db","#f1c40f","#e67e22","#999"],u=["Full","Detail","Summary","Headlines","Mention"],f=h=>h>.5?"#2ecc71":h>.3?"#f1c40f":"#e74c3c",m=h=>{switch(h){case"factual":return"#3498db";case"analytical":return"#e67e22";case"exploratory":return"#9b59b6";default:return e.textDim}};return d.jsxs("div",{style:{borderTop:`1px solid ${e.border}`},children:[t.retrieval&&d.jsxs("div",{className:"flex items-center gap-3 px-4 py-1.5",style:{fontFamily:"'Geist Mono', monospace",fontSize:11,borderBottom:`1px solid ${e.border}30`},children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("span",{style:{color:e.textDim},children:"Diversity"}),d.jsx("div",{style:{width:40,height:4,borderRadius:2,background:"#333",overflow:"hidden"},children:d.jsx("div",{style:{width:`${t.retrieval.diversityScore*100}%`,height:"100%",background:f(t.retrieval.diversityScore),borderRadius:2}})}),d.jsxs("span",{style:{fontFamily:"'Geist Mono', monospace",color:f(t.retrieval.diversityScore),fontSize:11},children:[(t.retrieval.diversityScore*100).toFixed(0),"%"]})]}),d.jsxs("span",{style:{color:e.textDim},children:[t.retrieval.selectedChunks,"/",t.retrieval.totalChunks," chunks"]}),d.jsxs("span",{style:{color:e.textDim},children:["Budget ",Math.round(t.retrieval.budgetUsed/t.retrieval.budgetTotal*100),"%"]}),d.jsx("span",{style:{fontSize:10,padding:"1px 5px",borderRadius:3,background:m(t.retrieval.queryType)+"15",color:m(t.retrieval.queryType)},children:t.retrieval.queryType}),d.jsxs("span",{style:{fontSize:11,color:e.textFaint,marginLeft:"auto"},children:[t.retrieval.embeddingMs+t.retrieval.retrievalMs,"ms"]}),t.retrieval.collapseWarning&&d.jsx("span",{style:{fontSize:11,color:"#e74c3c"},children:"⚠ Low diversity"})]}),d.jsxs("button",{type:"button",onClick:()=>r(!n),className:"flex items-center gap-3 px-4 py-1.5 text-[13px] w-full border-none cursor-pointer min-h-[44px]",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim,background:"transparent",transition:"background-color 150ms"},onMouseEnter:h=>{h.currentTarget.style.background=e.isDark?"#ffffff08":"#00000005"},onMouseLeave:h=>{h.currentTarget.style.background="transparent"},"aria-label":"Toggle pipeline statistics","aria-expanded":n,children:[d.jsx(Bn,{size:9,style:{color:"#FE5000",flexShrink:0}}),d.jsxs("span",{title:"Total context tokens sent to LLM",children:["Context: ",s(t.totalContextTokens)]}),d.jsxs("span",{title:"System prompt tokens (persona + instructions)",children:["System: ",s(t.systemTokens)]}),i&&d.jsxs(d.Fragment,{children:[d.jsxs("span",{title:"How much the knowledge was compressed before sending",style:{color:i.compression.ratio<.8?"#2ecc71":e.textDim},children:["Compressed: ",Math.round((1-i.compression.ratio)*100),"%"]}),d.jsxs("span",{title:"Number of knowledge sources indexed",children:[i.sources.length," source",i.sources.length!==1?"s":""]}),d.jsxs("span",{title:"Pipeline processing time",children:[i.timing.totalMs,"ms"]})]}),d.jsx(Pn,{size:8,className:"ml-auto",style:{transform:n?"none":"rotate(-90deg)",transition:"transform 150ms"}})]}),n&&d.jsx("div",{style:{maxHeight:280,overflowY:"auto",borderBottom:`1px solid ${e.border}30`},children:t.retrieval?d.jsx(b7,{retrieval:t.retrieval}):t.heatmap.length>0&&d.jsx("div",{className:"px-4 pb-2 flex flex-col gap-2",children:t.heatmap.map(h=>d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[d.jsx("span",{className:"text-[12px] font-medium",style:{color:e.textPrimary},children:h.name}),d.jsx("span",{className:"text-[12px] px-1.5 py-0.5 rounded",style:{fontFamily:"'Geist Mono', monospace",background:l[h.depth]+"18",color:l[h.depth]},children:u[h.depth]}),d.jsxs("span",{className:"text-[12px]",style:{fontFamily:"'Geist Mono', monospace",color:e.textFaint},children:[s(h.filteredTokens),"/",s(h.totalTokens)]})]}),h.headings.length>0&&d.jsxs("div",{className:"flex flex-col gap-0.5 pl-2",children:[h.headings.slice(0,8).map(g=>{const b=Math.max(...h.headings.map(w=>w.tokens),1),y=Math.max(5,g.tokens/b*100),v=l[Math.min(g.depth,4)];return d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("span",{className:"text-[10px] truncate w-20 text-right",style:{fontFamily:"'Geist Mono', monospace",color:e.textFaint},children:g.title}),d.jsx("div",{style:{flex:1,height:3,background:`${v}18`,borderRadius:1,overflow:"hidden"},children:d.jsx("div",{style:{width:`${y}%`,height:"100%",background:v,borderRadius:1}})}),d.jsx("span",{className:"text-[8px] w-6 text-right",style:{fontFamily:"'Geist Mono', monospace",color:e.textFaint},children:s(g.tokens)})]},g.nodeId)}),h.headings.length>8&&d.jsxs("span",{className:"text-[12px]",style:{fontFamily:"'Geist Mono', monospace",color:e.textFaint},children:["+",h.headings.length-8," more"]})]})]},h.path))})})]})}function S7(){const e=Ee(),t=$n(R=>R.messages),n=$n(R=>R.inputText),r=$n(R=>R.setInputText),i=$n(R=>R.streaming),s=$n(R=>R.addMessage),l=$n(R=>R.setStreaming),u=$n(R=>R.updateLastAssistant),f=$n(R=>R.setLastPipelineStats),m=$n(R=>R.updateMessagePipelineStats),h=ie(R=>R.channels),g=ie(R=>R.connectors),b=ie(R=>R.mcpServers),y=ie(R=>R.agentMeta),v=ie(R=>R.navigationMode),w=(()=>{const R=["streaming"];return g.length>0&&R.push("toolCalling"),b.length>0&&R.push("mcpBridge"),R})(),E=wh(),C=u7(E.providerId||"custom"),M=$.useRef(null);$.useEffect(()=>{const R=window.matchMedia("(prefers-reduced-motion: reduce)").matches;M.current?.scrollIntoView({behavior:R?"auto":"smooth"})},[t]);const S=$.useCallback(async()=>{if(!n.trim()||i)return;const R=n.trim();r(""),s({role:"user",content:R}),s({role:"assistant",content:""}),l(!0);let T="";try{const{providerId:D,model:H,error:V}=wh();if(V){u(V),l(!1);return}await r7({userMessage:R,channels:h,connectors:g,history:t.filter(B=>!(B.role==="assistant"&&B.content.trim()==="")).map(B=>({role:B.role,content:B.content})),agentMeta:{name:y.name,description:y.description,avatar:y.avatar,tags:y.tags},providerId:D,model:H,navigationMode:v,onChunk:B=>{T+=B,u(T)},onDone:B=>{f(B);const Y=[...$n.getState().messages].reverse().find(Z=>Z.role==="assistant");Y&&m(Y.id,B)},onError:B=>{u(T+`
|
|
675
|
+
|
|
676
|
+
_Error: ${B.message}_`)}})}catch(D){u(T+`
|
|
677
|
+
|
|
678
|
+
_Error: ${D instanceof Error?D.message:"Unknown error"}_`)}finally{l(!1)}},[n,i,t,h,g,y,v,r,s,l,u,f]),N=R=>{(R.metaKey||R.ctrlKey)&&R.key==="Enter"&&(R.preventDefault(),S())};return d.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[d.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 flex flex-col gap-3","aria-live":"polite","aria-relevant":"additions",children:[t.length===0&&d.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:d.jsxs("div",{className:"max-w-md text-center space-y-4",children:[d.jsx("div",{className:"text-[16px] font-semibold",style:{color:e.textPrimary,fontFamily:"'Geist Mono', monospace"},children:"Ready to test your agent"}),d.jsx("div",{className:"text-[13px] leading-relaxed",style:{color:e.textDim},children:"Start a conversation to see how your agent responds with the current knowledge and configuration."}),d.jsxs("div",{className:"flex flex-wrap gap-2 justify-center mt-6",children:[d.jsx("button",{type:"button",onClick:()=>r("What is this codebase about?"),className:"px-3 py-2 rounded-lg border cursor-pointer text-[12px] hover:border-[#FE5000] transition-colors",style:{background:e.surface,border:`1px solid ${e.border}`,color:e.textSecondary,fontFamily:"'Geist Mono', monospace"},children:"What is this codebase about?"}),d.jsx("button",{type:"button",onClick:()=>r("Explain the main architecture"),className:"px-3 py-2 rounded-lg border cursor-pointer text-[12px] hover:border-[#FE5000] transition-colors",style:{background:e.surface,border:`1px solid ${e.border}`,color:e.textSecondary,fontFamily:"'Geist Mono', monospace"},children:"Explain the main architecture"}),d.jsx("button",{type:"button",onClick:()=>r("What are the key features?"),className:"px-3 py-2 rounded-lg border cursor-pointer text-[12px] hover:border-[#FE5000] transition-colors",style:{background:e.surface,border:`1px solid ${e.border}`,color:e.textSecondary,fontFamily:"'Geist Mono', monospace"},children:"What are the key features?"})]})]})}),t.map(R=>d.jsxs("div",{className:"max-w-[85%] px-3.5 py-2.5 rounded-xl text-[14px] leading-relaxed",style:{alignSelf:R.role==="user"?"flex-end":"flex-start",background:R.role==="user"?"#FE500015":e.isDark?"#1c1c20":"#f0f0f5",border:`1px solid ${R.role==="user"?"#FE500020":e.border}`,color:R.role==="user"?e.textPrimary:e.textSecondary,borderBottomRightRadius:R.role==="user"?4:12,borderBottomLeftRadius:R.role==="assistant"?4:12},children:[R.role==="assistant"?d.jsx(i$,{remarkPlugins:[bP],components:{pre:({children:T})=>d.jsx("pre",{style:{background:e.isDark?"#0d0d10":"#e8e8f0",borderRadius:6,padding:"8px 12px",overflowX:"auto",fontSize:13,margin:"8px 0"},children:T}),code:({children:T,className:D})=>!D?d.jsx("code",{style:{background:e.isDark?"#0d0d10":"#e8e8f0",borderRadius:3,padding:"1px 4px",fontSize:13},children:T}):d.jsx("code",{style:{fontFamily:"'Geist Mono', monospace"},children:T}),a:({href:T,children:D})=>d.jsx("a",{href:T,target:"_blank",rel:"noopener noreferrer",style:{color:"#FE5000",textDecoration:"underline"},children:D}),h1:({children:T})=>d.jsx("h1",{style:{fontSize:16,fontWeight:600,margin:"8px 0 4px"},children:T}),h2:({children:T})=>d.jsx("h2",{style:{fontSize:15,fontWeight:600,margin:"8px 0 4px"},children:T}),h3:({children:T})=>d.jsx("h3",{style:{fontSize:14,fontWeight:600,margin:"6px 0 2px"},children:T}),ul:({children:T})=>d.jsx("ul",{style:{paddingLeft:20,margin:"4px 0"},children:T}),ol:({children:T})=>d.jsx("ol",{style:{paddingLeft:20,margin:"4px 0"},children:T}),li:({children:T})=>d.jsx("li",{style:{marginBottom:2},children:T}),blockquote:({children:T})=>d.jsx("blockquote",{style:{borderLeft:"3px solid #FE5000",paddingLeft:12,margin:"8px 0",color:e.textDim},children:T}),table:({children:T})=>d.jsx("table",{style:{borderCollapse:"collapse",width:"100%",margin:"8px 0",fontSize:13},children:T}),th:({children:T})=>d.jsx("th",{style:{border:`1px solid ${e.border}`,padding:"4px 8px",textAlign:"left",fontWeight:600},children:T}),td:({children:T})=>d.jsx("td",{style:{border:`1px solid ${e.border}`,padding:"4px 8px"},children:T})},children:R.content||(i?"...":"")}):R.content||"",R.role==="assistant"&&R.pipelineStats&&d.jsx(l7,{stats:R.pipelineStats})]},R.id)),d.jsx("div",{ref:M})]}),w.length>0&&d.jsx("div",{className:"px-4 py-1.5",children:d.jsx(p7,{matrix:C,requiredCapabilities:w})}),d.jsx(w7,{}),d.jsxs("div",{className:"px-4 py-3 flex gap-2",style:{borderTop:`1px solid ${e.border}`},children:[d.jsx("input",{type:"text",value:n,onChange:R=>r(R.target.value),onKeyDown:N,placeholder:"Test your agent...","aria-label":"Test message",className:"flex-1 px-3.5 py-2.5 rounded-lg outline-none text-[14px]",style:{background:e.inputBg,border:`1px solid ${e.border}`,color:e.textPrimary,fontFamily:"'Geist Sans', sans-serif"}}),d.jsx("button",{type:"button","aria-label":"Send message",onClick:S,disabled:i||!n.trim(),className:"px-4 rounded-lg cursor-pointer border-none text-[12px] font-semibold tracking-wider uppercase min-h-[44px] min-w-[44px]",style:{background:"#FE5000",color:"#fff",fontFamily:"'Geist Mono', monospace",opacity:i||!n.trim()?.5:1},children:d.jsx(ez,{size:12})})]})]})}function C7(){const e=Ee(),[t,n]=$.useState([{id:"agent-1",name:"Agent 1",rolePrompt:"",repoUrl:"",source:"blank"},{id:"agent-2",name:"Agent 2",rolePrompt:"",repoUrl:"",source:"blank"}]),[r,i]=$.useState(""),[s,l]=$.useState([]),[u,f]=$.useState(null),m=$.useRef(null),h=dn(D=>D.status),g=dn(D=>D.reset),b=h==="running";$.useEffect(()=>{fetch(`${ze}/agents`).then(D=>D.ok?D.json():{data:[]}).then(D=>{const H=D.data??D??[];l(H.map(V=>({id:V.id,name:V.agentMeta?.name||V.id,description:V.agentMeta?.description||""})))}).catch(()=>{})},[]);const y=()=>{const D=t.length+1;n([...t,{id:`agent-${Date.now()}`,name:`Agent ${D}`,rolePrompt:"",repoUrl:"",source:"blank"}])},v=async(D,H)=>{try{const V=await fetch(`${ze}/agents/${encodeURIComponent(H)}`);if(!V.ok)return;const B=await V.json(),O=B.data??B,Y=O.agentMeta??{},Z=[],U=O.instructionState??{};Y.name&&Z.push(`You are ${Y.name}. ${Y.description||""}`),U.persona&&Z.push(`Persona: ${U.persona}`),U.objectives?.primary&&Z.push(`Primary Objective: ${U.objectives.primary}`),U.constraints?.customConstraints&&Z.push(`Constraints: ${U.constraints.customConstraints}`);const _=Z.join(`
|
|
679
|
+
|
|
680
|
+
`);n(A=>A.map(q=>q.id===D?{...q,name:Y.name||H,savedSystemPrompt:_,source:H}:q))}catch{}f(null)},w=D=>{t.length<=1||n(t.filter(H=>H.id!==D))},E=(D,H)=>{n(t.map(V=>V.id===D?{...V,...H}:V))},[C,M]=$.useState(null),[S,N]=$.useState(null),R=$.useCallback(async()=>{if(!r.trim()||b)return;M(null),N(null);const{providerId:D,model:H,error:V}=wh();if(V){M(V),console.error("[TeamRunner] Provider error:",V);return}const Y=dt.getState().providers.find(Z=>Z.id===D)?.authMethod==="claude-agent-sdk";console.log("[TeamRunner] Starting team run with provider:",D,"model:",H,"Agent SDK:",Y);try{const Z=Hn.getState(),_=ua.getState().currentVersion||"0.0.0",A=Z.startTrace(`team-${Date.now()}`,_);let q=Vs();const K=ie.getState(),Q=K.channels,I=Q.filter(G=>G.enabled);let F="",L="",z=null;if(I.length>0){console.log("[TeamRunner] Preparing knowledge..."),N("Preparing knowledge...");const G=await I2(I,A);L=G.frameworkBlock;const ce=await U2(Q,G.regularChannels,G.residualKnowledgeBlock,{userMessage:r,navigationMode:"manual",providerId:D,model:H},A);F=ce.knowledgeBlock,z=ce.provenance}const W=K.connectors.filter(G=>G.enabled&&G.direction!=="write");if(W.length>0){const ce=`<connectors>
|
|
681
|
+
Available data connectors (use via MCP tools):
|
|
682
|
+
${W.map(be=>{const we=be.hint?` (scope: ${be.hint})`:"";return`- ${be.name} [${be.service}] — ${be.direction}${we}`}).join(`
|
|
683
|
+
`)}
|
|
684
|
+
</connectors>`;F=F?`${F}
|
|
685
|
+
|
|
686
|
+
${ce}`:ce}const ae=rt.getState();let le="";if(ae.longTerm.enabled){console.log("[TeamRunner] Recalling memory..."),N("Recalling memory...");const G=await R2({userMessage:r,agentId:"team",traceId:A});G.contextBlock&&(le=G.contextBlock)}if(z&&(q=Vs(z)),I.length>0||F||le){const G=uS(Q,Xn.getState().getIndex),ce=Q.some(we=>we.enabled&&we.repoMeta);q=dS({frame:q,orientationBlock:G,hasRepos:ce,knowledgeFormatGuide:O2(),frameworkBlock:L,memoryBlock:le,knowledgeBlock:F})}console.log("[TeamRunner] Running team..."),N("Running team..."),M(null);const me={teamId:`team-${Date.now()}`,systemPrompt:q,task:r.trim(),providerId:D,model:H,isAgentSdk:Y,agents:t.map(G=>({agentId:G.id,name:G.name,systemPrompt:G.savedSystemPrompt||void 0,rolePrompt:G.rolePrompt||void 0,repoUrl:G.repoUrl||void 0}))};m.current=Gk(me),N(null)}catch(Z){console.error("[TeamRunner] Knowledge pipeline error:",Z),N(null),M(`Knowledge pipeline error: ${Z instanceof Error?Z.message:"Unknown error"}`);const U=Vs(),_={teamId:`team-${Date.now()}`,systemPrompt:U,task:r.trim(),providerId:D,model:H,isAgentSdk:Y,agents:t.map(A=>({agentId:A.id,name:A.name,systemPrompt:A.savedSystemPrompt||void 0,rolePrompt:A.rolePrompt||void 0,repoUrl:A.repoUrl||void 0}))};m.current=Gk(_),N(null)}},[r,t,b]),T=()=>{m.current?.abort(),m.current=null};return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsxs("div",{className:"px-4 py-3 flex flex-col gap-2 overflow-y-auto",style:{maxHeight:"45%"},children:[d.jsxs("div",{className:"flex items-center justify-between mb-1",children:[d.jsxs("span",{className:"text-[12px] font-bold tracking-[0.08em] uppercase",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:["Team Agents (",t.length,")"]}),d.jsxs("button",{type:"button",onClick:y,disabled:t.length>=5,className:"flex items-center gap-1 text-[12px] px-2 py-1 rounded cursor-pointer border-none",style:{background:"#FE500015",color:"#FE5000",fontFamily:"'Geist Mono', monospace",opacity:t.length>=5?.4:1},children:[d.jsx(Ft,{size:10})," Add"]})]}),t.map(D=>d.jsxs("div",{style:{padding:10,borderRadius:8,border:`1px solid ${D.source!=="blank"?"#FE500030":e.border}`,background:e.surface},children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx(kz,{size:12,style:{color:D.source!=="blank"?"#FE5000":e.textDim}}),d.jsx("input",{type:"text",value:D.name,onChange:H=>E(D.id,{name:H.target.value}),className:"flex-1 text-[13px] font-semibold px-1.5 py-0.5 rounded outline-none border-none",style:{background:"transparent",color:e.textPrimary,fontFamily:"'Geist Mono', monospace"}}),d.jsx("button",{type:"button",onClick:()=>f(u===D.id?null:D.id),className:"text-[11px] px-2 py-0.5 rounded cursor-pointer border-none",style:{background:"#FE500010",color:"#FE5000",fontFamily:"'Geist Mono', monospace"},children:D.source!=="blank"?"↻ Swap":"↗ Load"}),t.length>1&&d.jsx("button",{type:"button",onClick:()=>w(D.id),className:"border-none cursor-pointer p-0.5 rounded",style:{background:"transparent",color:e.textDim},children:d.jsx($t,{size:12})})]}),u===D.id&&s.length>0&&d.jsxs("div",{className:"mb-2 flex flex-col gap-1 p-2 rounded",style:{background:e.inputBg,border:`1px solid ${e.border}`},children:[d.jsx("span",{className:"text-[11px] uppercase font-bold tracking-[0.08em] mb-1",style:{color:e.textDim,fontFamily:"'Geist Mono', monospace"},children:"Load from library"}),s.map(H=>d.jsxs("button",{type:"button",onClick:()=>v(D.id,H.id),className:"text-left text-[12px] px-2 py-1.5 rounded cursor-pointer border-none w-full",style:{background:"transparent",color:e.textPrimary},onMouseEnter:V=>{V.currentTarget.style.background=e.surfaceHover},onMouseLeave:V=>{V.currentTarget.style.background="transparent"},children:[d.jsx("span",{style:{fontWeight:600},children:H.name}),H.description&&d.jsxs("span",{style:{color:e.textDim,marginLeft:6},children:["— ",H.description.slice(0,40)]})]},H.id)),s.length===0&&d.jsx("span",{className:"text-[12px]",style:{color:e.textFaint},children:"No saved agents. Save one from the Agent Builder first."})]}),D.source!=="blank"&&d.jsx("div",{className:"mb-1.5",children:d.jsxs("span",{className:"text-[11px] px-1.5 py-0.5 rounded",style:{background:"#FE500015",color:"#FE5000",fontFamily:"'Geist Mono', monospace"},children:["↗ ",D.source]})}),d.jsx("input",{type:"text",value:D.rolePrompt,onChange:H=>E(D.id,{rolePrompt:H.target.value}),placeholder:"Role override (optional — appended to agent instructions)",className:"w-full text-[12px] px-2 py-1.5 rounded outline-none mb-1.5",style:{background:e.inputBg,border:`1px solid ${e.borderSubtle}`,color:e.textSecondary}}),d.jsx("input",{type:"text",value:D.repoUrl,onChange:H=>E(D.id,{repoUrl:H.target.value}),placeholder:"Repository URL (optional — e.g., https://github.com/user/repo)",className:"w-full text-[12px] px-2 py-1.5 rounded outline-none",style:{background:e.inputBg,border:`1px solid ${e.borderSubtle}`,color:e.textSecondary}})]},D.id))]}),d.jsxs("div",{className:"px-4 py-2",style:{borderTop:`1px solid ${e.border}`},children:[d.jsx("textarea",{value:r,onChange:D=>i(D.target.value),placeholder:"Describe the task for the team...",rows:3,className:"w-full text-[13px] px-3 py-2.5 rounded-lg outline-none resize-none",style:{background:e.inputBg,border:`1px solid ${e.border}`,color:e.textPrimary,lineHeight:1.5}}),S&&d.jsx("div",{className:"text-[12px] px-3 py-2 rounded mb-2",style:{background:"#10b98115",color:"#10b981",border:"1px solid #10b98130"},children:S}),C&&d.jsx("div",{className:"text-[12px] px-3 py-2 rounded mb-2",style:{background:"#dc262615",color:"#dc2626",border:"1px solid #dc262630"},children:C}),d.jsxs("div",{className:"flex gap-2 mt-2",children:[b?d.jsxs("button",{type:"button",onClick:T,className:"flex items-center gap-1.5 px-4 py-2 rounded-lg cursor-pointer border-none text-[12px] font-bold tracking-[0.08em] uppercase min-h-[44px]",style:{background:"#dc2626",color:"#fff",fontFamily:"'Geist Mono', monospace"},children:[d.jsx(Jw,{size:12})," Stop"]}):d.jsxs("button",{type:"button",onClick:R,disabled:!r.trim(),className:"flex items-center gap-1.5 px-4 py-2 rounded-lg cursor-pointer border-none text-[12px] font-bold tracking-[0.08em] uppercase min-h-[44px]",style:{background:"#FE5000",color:"#fff",fontFamily:"'Geist Mono', monospace",opacity:r.trim()?1:.5},children:[d.jsx(Xw,{size:12})," Run Team"]}),h!=="idle"&&!b&&d.jsx("button",{type:"button",onClick:g,className:"text-[12px] px-3 py-2 rounded-lg cursor-pointer border-none",style:{background:e.border,color:e.textDim},children:"Clear"})]})]}),d.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3",style:{borderTop:`1px solid ${e.border}`},children:d.jsx(x7,{})})]})}function E7(){const e=Ee(),[t,n]=$.useState(null),[r,i]=$.useState(!1),[s,l]=$.useState(null),[u,f]=$.useState(!1),m=$.useRef(null),h=$.useCallback(()=>{const N=ie.getState();return{channels:N.channels,selectedModel:N.selectedModel,outputFormat:N.outputFormat,outputFormats:N.outputFormats,prompt:N.prompt,tokenBudget:N.tokenBudget,mcpServers:N.mcpServers,skills:N.skills,agentMeta:N.agentMeta,agentConfig:N.agentConfig,connectors:N.connectors,instructionState:N.instructionState,workflowSteps:N.workflowSteps}},[]),g=$.useCallback(async()=>{try{const{downloadAgentDirectory:N}=await Ho(async()=>{const{downloadAgentDirectory:R}=await Promise.resolve().then(()=>TP);return{downloadAgentDirectory:R}},void 0);await N(h()),n("dir"),setTimeout(()=>n(null),2e3)}catch(N){console.error("Directory export failed:",N)}},[h]),b=$.useCallback(async N=>{try{const R=h();let T,D;N==="md"?(T=Us("claude",R),D=".md"):N==="yaml"?(T=Us("openclaw",R),D=".yaml"):(T=Us("generic",R),D=".json");const H=(R.agentMeta.name||"modular-agent").toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"");Sd(T,H,D),await navigator.clipboard.writeText(T),n(N),setTimeout(()=>n(null),2e3)}catch{}},[h]),y=$.useCallback(async N=>{if(!N.name.endsWith(".zip")){l("Please select a ZIP file containing an agent directory");return}i(!0),l(null);try{await z2(N),n("import"),setTimeout(()=>n(null),2e3)}catch(R){const T=R instanceof Error?R.message:"Unknown import error";l(T),setTimeout(()=>l(null),5e3)}finally{i(!1)}},[]),v=$.useCallback(()=>{m.current?.click()},[]),w=$.useCallback(N=>{const R=N.target.files?.[0];R&&y(R),N.target&&(N.target.value="")},[y]),E=$.useCallback(N=>{N.preventDefault(),N.stopPropagation(),f(!0)},[]),C=$.useCallback(N=>{N.preventDefault(),N.stopPropagation(),f(!1)},[]),M=$.useCallback(N=>{N.preventDefault(),N.stopPropagation(),f(!1);const T=Array.from(N.dataTransfer.files).find(D=>D.name.endsWith(".zip"));if(!T){l("Please drop a ZIP file containing an agent directory"),setTimeout(()=>l(null),5e3);return}y(T)},[y]),S=[{id:"dir",icon:Uh,label:"Agent Directory",fmt:".zip",primary:!0},{id:"md",icon:Cl,label:"Claude Code / .claude",fmt:".md",primary:!1},{id:"yaml",icon:I_,label:"OpenClaw Agent",fmt:".yaml",primary:!1},{id:"json",icon:md,label:"Vibe Kanban / BloopAI",fmt:".json",primary:!1}];return d.jsxs("div",{className:"px-4 py-3",style:{borderTop:`1px solid ${e.border}`},onDragOver:E,onDragLeave:C,onDrop:M,children:[d.jsxs("div",{className:"mb-4",children:[d.jsx("div",{className:"text-[12px] font-bold tracking-[0.08em] uppercase mb-2.5",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:"Import from"}),d.jsxs("button",{type:"button","aria-label":"Import agent from ZIP",onClick:v,disabled:r,className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg cursor-pointer w-full text-left min-h-[44px] motion-reduce:transition-none",style:{background:u?"#FE500020":"#FE500010",border:`1px solid ${u?"#FE500060":"#FE500030"}`,transition:"all 150ms",opacity:r?.6:1},onMouseEnter:N=>{r||(N.currentTarget.style.borderColor="#FE500040")},onMouseLeave:N=>{r||(N.currentTarget.style.borderColor="#FE500030")},onFocus:N=>{r||(N.currentTarget.style.borderColor="#FE500040")},onBlur:N=>{r||(N.currentTarget.style.borderColor="#FE500030")},children:[d.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center",style:{background:e.surfaceElevated},children:t==="import"?d.jsx(Wt,{size:12,style:{color:"#00ff88"}}):r?d.jsx("div",{className:"w-3 h-3 border border-t-0 border-l-0",style:{borderColor:"#FE5000",borderRadius:"50%",animation:"spin 1s linear infinite"}}):d.jsx(nS,{size:12,style:{color:e.textDim}})}),d.jsx("span",{className:"flex-1 text-[13px]",style:{color:e.textPrimary},children:u?"Drop ZIP file here":r?"Importing...":"Import Agent"}),d.jsx("span",{className:"text-[13px]",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:".zip"})]}),s&&d.jsxs("div",{className:"mt-2 p-2 rounded-lg flex items-start gap-2",style:{background:"#dc262615",border:"1px solid #dc262630"},children:[d.jsx($w,{size:14,style:{color:"#dc2626",flexShrink:0,marginTop:1}}),d.jsx("span",{className:"text-[12px] leading-relaxed",style:{color:"#dc2626"},children:s})]}),d.jsx("input",{ref:m,type:"file",accept:".zip",style:{display:"none"},onChange:w,"aria-label":"Import agent ZIP file"})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[12px] font-bold tracking-[0.08em] uppercase mb-2.5",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:"Export to"}),d.jsx("div",{className:"flex flex-col gap-1.5",children:S.map(N=>{const R=N.icon,T=N.id==="dir"?g:()=>b(N.id);return d.jsxs("button",{type:"button","aria-label":`Export as ${N.fmt}`,onClick:T,className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg cursor-pointer w-full text-left min-h-[44px] motion-reduce:transition-none",style:{background:N.primary?"#FE500010":e.isDark?"#1c1c20":"#f0f0f5",border:`1px solid ${N.primary?"#FE500030":e.border}`,transition:"border-color 150ms"},onMouseEnter:D=>{D.currentTarget.style.borderColor="#FE500040"},onMouseLeave:D=>{D.currentTarget.style.borderColor=e.border},onFocus:D=>{D.currentTarget.style.borderColor="#FE500040"},onBlur:D=>{D.currentTarget.style.borderColor=e.border},children:[d.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center",style:{background:e.surfaceElevated},children:t===N.id?d.jsx(Wt,{size:12,style:{color:"#00ff88"}}):d.jsx(R,{size:12,style:{color:e.textDim}})}),d.jsx("span",{className:"flex-1 text-[13px]",style:{color:e.textPrimary},children:N.label}),d.jsx("span",{className:"text-[13px]",style:{fontFamily:"'Geist Mono', monospace",color:e.textDim},children:N.fmt})]},N.id)})})]})]})}function M7({onCollapse:e,onExpand:t,onMinimize:n,isExpanded:r}){const i=Ee(),[s,l]=$.useState("chat");return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsxs("div",{className:"flex items-center gap-2 px-4 py-3",style:{borderBottom:`1px solid ${i.border}`},children:[d.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:"#00ff88",boxShadow:"0 0 6px rgba(0,255,136,0.4)"}}),d.jsx("span",{className:"text-[12px] font-bold tracking-[0.08em] uppercase flex-1",style:{fontFamily:"'Geist Mono', monospace",color:i.textSecondary},children:s==="chat"?"Conversation Tester":s==="team"?"Team Runner":s==="traces"?"Execution Traces":"Export"}),d.jsxs("div",{className:"flex gap-0.5 rounded-md overflow-hidden",role:"tablist",style:{border:`1px solid ${i.border}`},children:[d.jsx("button",{type:"button",role:"tab",id:"tab-chat","aria-selected":s==="chat","aria-controls":"tabpanel-chat",onClick:()=>l("chat"),className:"text-[13px] px-2.5 py-2 cursor-pointer border-none min-h-[44px]",style:{background:s==="chat"?"#FE5000":"transparent",color:s==="chat"?"#fff":i.textDim,fontFamily:"'Geist Mono', monospace"},children:"Chat"}),d.jsx("button",{type:"button",role:"tab",id:"tab-team","aria-selected":s==="team","aria-controls":"tabpanel-team",onClick:()=>l("team"),className:"text-[13px] px-2.5 py-2 cursor-pointer border-none min-h-[44px]",style:{background:s==="team"?"#FE5000":"transparent",color:s==="team"?"#fff":i.textDim,fontFamily:"'Geist Mono', monospace"},children:"Team"}),d.jsx("button",{type:"button",role:"tab",id:"tab-traces","aria-selected":s==="traces","aria-controls":"tabpanel-traces",onClick:()=>l("traces"),className:"text-[13px] px-2.5 py-2 cursor-pointer border-none min-h-[44px]",style:{background:s==="traces"?"#FE5000":"transparent",color:s==="traces"?"#fff":i.textDim,fontFamily:"'Geist Mono', monospace"},children:"Traces"}),d.jsx("button",{type:"button",role:"tab",id:"tab-export","aria-selected":s==="export","aria-controls":"tabpanel-export",onClick:()=>l("export"),className:"text-[13px] px-2.5 py-2 cursor-pointer border-none min-h-[44px]",style:{background:s==="export"?"#FE5000":"transparent",color:s==="export"?"#fff":i.textDim,fontFamily:"'Geist Mono', monospace"},children:"Export"})]}),r&&n&&d.jsx("button",{type:"button",onClick:n,"aria-label":"Minimize test panel",className:"w-7 h-7 rounded-md border-none cursor-pointer flex items-center justify-center",style:{background:"transparent",color:i.textDim},children:d.jsx(qh,{size:14})}),!r&&t&&d.jsx("button",{type:"button",onClick:t,"aria-label":"Expand test panel",className:"w-7 h-7 rounded-md border-none cursor-pointer flex items-center justify-center",style:{background:"transparent",color:i.textDim},children:d.jsx(Gw,{size:14})}),e&&d.jsx("button",{type:"button",onClick:e,"aria-label":"Collapse test panel",className:"w-7 h-7 rounded-md border-none cursor-pointer flex items-center justify-center",style:{background:"transparent",color:i.textDim},children:d.jsx(Go,{size:14})})]}),s==="chat"&&d.jsx("div",{role:"tabpanel",id:"tabpanel-chat","aria-labelledby":"tab-chat",className:"flex flex-col flex-1 min-h-0",children:d.jsx(S7,{})}),s==="team"&&d.jsx("div",{role:"tabpanel",id:"tabpanel-team","aria-labelledby":"tab-team",className:"flex flex-col flex-1 min-h-0",children:d.jsx(C7,{})}),s==="traces"&&d.jsx("div",{role:"tabpanel",id:"tabpanel-traces","aria-labelledby":"tab-traces",className:"flex-1 overflow-y-auto",children:d.jsx(s7,{})}),s==="export"&&d.jsx("div",{role:"tabpanel",id:"tabpanel-export","aria-labelledby":"tab-export",className:"flex-1 overflow-y-auto",children:d.jsx(E7,{})})]})}function T7(){const e=Ee(),[t,n]=$.useState(!0),[r,i]=$.useState(!1);return d.jsxs("div",{role:"main",className:"flex-1 flex overflow-hidden",style:{background:e.bg},children:[!r&&d.jsx("nav",{"aria-label":"Agent sources",className:"flex flex-col overflow-y-auto",style:{width:"30%",minWidth:300,maxWidth:480,background:e.isDark?"#161619":"#f8f8fa",borderRight:`1px solid ${e.border}`},children:d.jsx(RR,{})}),!r&&d.jsx("section",{"aria-label":"Agent configuration",className:"flex-1 overflow-y-auto",style:{padding:"24px 32px"},children:d.jsx(WR,{})}),d.jsx("aside",{"aria-label":"Test and export",className:"flex flex-col overflow-hidden",style:{width:t?48:r?"100%":400,minWidth:t?48:r?"100%":400,background:e.isDark?"#161619":"#f8f8fa",borderLeft:r?"none":`1px solid ${e.border}`,transition:"width 200ms ease, min-width 200ms ease"},children:t?d.jsx("button",{type:"button",onClick:()=>n(!1),className:"flex flex-col items-center justify-center gap-2 h-full cursor-pointer border-none",style:{background:"transparent",color:e.textDim},"aria-label":"Open test panel",children:d.jsx("span",{style:{writingMode:"vertical-rl",textOrientation:"mixed",fontSize:13,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",fontFamily:"'Geist Mono', monospace",color:e.textDim},children:"Test ▶"})}):d.jsx(M7,{onCollapse:()=>n(!0),onExpand:()=>i(!0),onMinimize:()=>i(!1),isExpanded:r})})]})}function j7(){const e=Ee(),t=ie(y=>y.showFilePicker),n=ie(y=>y.setShowFilePicker),r=ie(y=>y.setShowSkillPicker),i=ie(y=>y.setShowConnectionPicker),s=ie(y=>y.setShowMarketplace),l=ie(y=>y.run),u=ie(y=>y.running),f=ie(y=>y.showSettings),m=ie(y=>y.setShowSettings),h=vt(y=>y.loadServers),g=$.useRef(null),b=$.useCallback(y=>{const v=y.target.files?.[0];if(!v)return;const w=new FileReader;w.onload=E=>{const C=E.target?.result;if(!C)return;const M=X6(C),S=ie.getState();if(M.channels){S.clearChannels();for(const N of M.channels)S.addChannel(N)}M.selectedModel&&S.setModel(M.selectedModel),M.outputFormat&&S.setOutputFormat(M.outputFormat),M.prompt&&S.setPrompt(M.prompt),M.tokenBudget&&S.setTokenBudget(M.tokenBudget),M.agentMeta&&S.setAgentMeta(M.agentMeta),M.instructionState&&S.setInstructionState(M.instructionState),M.workflowSteps&&S.setWorkflowSteps(M.workflowSteps)},w.readAsText(v),y.target.value=""},[]);return $.useEffect(()=>{const y=v=>{(v.metaKey||v.ctrlKey)&&v.key==="k"&&(v.preventDefault(),n(!t)),(v.metaKey||v.ctrlKey)&&v.key==="Enter"&&(v.preventDefault(),u||l()),v.key==="Escape"&&(n(!1),r(!1),i(!1),s(!1),m(!1),ie.getState().setShowSaveModal(!1))};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[n,t,r,i,s,l,u]),$.useEffect(()=>{h()},[h]),d.jsxs("div",{"data-theme":e.isDark?"dark":"light",style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",background:e.bg},children:[d.jsx("input",{ref:g,type:"file",accept:".md,.yaml,.yml,.json",onChange:b,style:{display:"none"},"aria-hidden":"true"}),d.jsx(Jz,{onSettingsClick:()=>m(!0,"providers")}),d.jsx(T7,{}),d.jsx("div",{"aria-live":"polite",id:"canvas-announcements",style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}}),d.jsx(e6,{}),d.jsx(n6,{}),d.jsx(d6,{}),d.jsx(x6,{}),d.jsx(p6,{}),d.jsx(E6,{open:f,onClose:()=>m(!1)}),d.jsx(U6,{})]})}sM.createRoot(document.getElementById("root")).render(d.jsx($.StrictMode,{children:d.jsx(j7,{})}));export{A7 as c,Qu as g,vt as u};
|