@goondocks/myco 1.0.12 → 1.0.13
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/ui/assets/index-xpXpcgR9.js +415 -0
- package/dist/ui/index.html +1 -1
- package/package.json +11 -11
- package/dist/ui/assets/index-C4i-Ck9f.js +0 -415
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),h=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},ee=[],z=-1;function B(e){return{current:e}}function V(e){0>z||(e.current=ee[z],ee[z]=null,z--)}function H(e,t){z++,ee[z]=e.current,e.current=t}var te=B(null),ne=B(null),U=B(null),re=B(null);function ie(e,t){switch(H(U,t),H(ne,e),H(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=Kd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}V(te),H(te,e)}function ae(){V(te),V(ne),V(U)}function oe(e){e.memoizedState!==null&&H(re,e);var t=te.current,n=Kd(t,e.type);t!==n&&(H(ne,e),H(te,n))}function se(e){ne.current===e&&(V(te),V(ne)),re.current===e&&(V(re),np._currentValue=R)}var ce,le;function ue(e){if(ce===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ce=t&&t[1]||``,le=-1<e.stack.indexOf(`
|
|
2
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
-
`+ce+e+le}var de=!1;function fe(e,t){if(!e||de)return``;de=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
|
-
`),l=s.split(`
|
|
5
|
-
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
6
|
-
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{de=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ue(n):``}function pe(e,t){switch(e.tag){case 26:case 27:case 5:return ue(e.type);case 16:return ue(`Lazy`);case 13:return e.child!==t&&t!==null?ue(`Suspense Fallback`):ue(`Suspense`);case 19:return ue(`SuspenseList`);case 0:case 15:return fe(e.type,!1);case 11:return fe(e.type.render,!1);case 1:return fe(e.type,!0);case 31:return ue(`Activity`);default:return``}}function me(e){try{var t=``,n=null;do t+=pe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
-
Error generating stack: `+e.message+`
|
|
8
|
-
`+e.stack}}var he=Object.prototype.hasOwnProperty,ge=t.unstable_scheduleCallback,_e=t.unstable_cancelCallback,ve=t.unstable_shouldYield,ye=t.unstable_requestPaint,be=t.unstable_now,xe=t.unstable_getCurrentPriorityLevel,Se=t.unstable_ImmediatePriority,Ce=t.unstable_UserBlockingPriority,we=t.unstable_NormalPriority,Te=t.unstable_LowPriority,Ee=t.unstable_IdlePriority,De=t.log,Oe=t.unstable_setDisableYieldValue,ke=null,Ae=null;function je(e){if(typeof De==`function`&&Oe(e),Ae&&typeof Ae.setStrictMode==`function`)try{Ae.setStrictMode(ke,e)}catch{}}var Me=Math.clz32?Math.clz32:Fe,Ne=Math.log,Pe=Math.LN2;function Fe(e){return e>>>=0,e===0?32:31-(Ne(e)/Pe|0)|0}var Ie=256,Le=262144,Re=4194304;function ze(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Be(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=ze(n))):i=ze(o):i=ze(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ze(n))):i=ze(o)):i=ze(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ve(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function He(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function W(){var e=Re;return Re<<=1,!(Re&62914560)&&(Re=4194304),e}function G(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ue(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function We(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Me(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ge(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ge(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Me(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ke(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Me(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function qe(e,t){var n=t&-t;return n=n&42?1:Je(n),(n&(e.suspendedLanes|t))===0?n:0}function Je(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ye(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Xe(){var e=L.p;return e===0?(e=window.event,e===void 0?32:vp(e.type)):e}function Ze(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var Qe=Math.random().toString(36).slice(2),$e=`__reactFiber$`+Qe,et=`__reactProps$`+Qe,tt=`__reactContainer$`+Qe,nt=`__reactEvents$`+Qe,rt=`__reactListeners$`+Qe,it=`__reactHandles$`+Qe,at=`__reactResources$`+Qe,ot=`__reactMarker$`+Qe;function st(e){delete e[$e],delete e[et],delete e[nt],delete e[rt],delete e[it]}function ct(e){var t=e[$e];if(t)return t;for(var n=e.parentNode;n;){if(t=n[tt]||n[$e]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hf(e);e!==null;){if(n=e[$e])return n;e=hf(e)}return t}e=n,n=e.parentNode}return null}function lt(e){if(e=e[$e]||e[tt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ut(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function dt(e){var t=e[at];return t||=e[at]={hoistableStyles:new Map,hoistableScripts:new Map},t}function ft(e){e[ot]=!0}var pt=new Set,mt={};function ht(e,t){gt(e,t),gt(e+`Capture`,t)}function gt(e,t){for(mt[e]=t,e=0;e<t.length;e++)pt.add(t[e])}var _t=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]*$`),vt={},yt={};function bt(e){return he.call(yt,e)?!0:he.call(vt,e)?!1:_t.test(e)?yt[e]=!0:(vt[e]=!0,!1)}function xt(e,t,n){if(bt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function St(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Ct(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function wt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Tt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Et(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Dt(e){if(!e._valueTracker){var t=Tt(e)?`checked`:`value`;e._valueTracker=Et(e,t,``+e[t])}}function Ot(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Tt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function kt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var At=/[\n"\\]/g;function jt(e){return e.replace(At,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Mt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+wt(t)):e.value!==``+wt(t)&&(e.value=``+wt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Pt(e,o,wt(n)):Pt(e,o,wt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+wt(s):e.removeAttribute(`name`)}function Nt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Dt(e);return}n=n==null?``:``+wt(n),t=t==null?n:``+wt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Dt(e)}function Pt(e,t,n){t===`number`&&kt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Ft(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+wt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function It(e,t,n){if(t!=null&&(t=``+wt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+wt(n)}function Lt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(F(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=wt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Dt(e)}function Rt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var zt=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 Bt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||zt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Vt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Bt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Bt(e,o,t[o])}function Ht(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Ut=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`]]),Wt=/^[\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 Gt(e){return Wt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Kt(){}var qt=null;function Jt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yt=null,Xt=null;function Zt(e){var t=lt(e);if(t&&(e=t.stateNode)){var n=e[et]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Mt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+jt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[et]||null;if(!a)throw Error(i(90));Mt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Ot(r)}break a;case`textarea`:It(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Ft(e,!!n.multiple,t,!1)}}}var Qt=!1;function $t(e,t,n){if(Qt)return e(t,n);Qt=!0;try{return e(t)}finally{if(Qt=!1,(Yt!==null||Xt!==null)&&(xu(),Yt&&(t=Yt,e=Xt,Xt=Yt=null,Zt(t),e)))for(t=0;t<e.length;t++)Zt(e[t])}}function en(e,t){var n=e.stateNode;if(n===null)return null;var r=n[et]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var tn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),nn=!1;if(tn)try{var rn={};Object.defineProperty(rn,"passive",{get:function(){nn=!0}}),window.addEventListener(`test`,rn,rn),window.removeEventListener(`test`,rn,rn)}catch{nn=!1}var an=null,on=null,sn=null;function cn(){if(sn)return sn;var e,t=on,n=t.length,r,i=`value`in an?an.value:an.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return sn=i.slice(e,1<r?1-r:void 0)}function ln(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function un(){return!0}function dn(){return!1}function fn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?un:dn,this.isPropagationStopped=dn,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=un)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=un)},persist:function(){},isPersistent:un}),t}var pn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mn=fn(pn),hn=m({},pn,{view:0,detail:0}),gn=fn(hn),_n,vn,yn,bn=m({},hn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==yn&&(yn&&e.type===`mousemove`?(_n=e.screenX-yn.screenX,vn=e.screenY-yn.screenY):vn=_n=0,yn=e),_n)},movementY:function(e){return`movementY`in e?e.movementY:vn}}),xn=fn(bn),Sn=fn(m({},bn,{dataTransfer:0})),Cn=fn(m({},hn,{relatedTarget:0})),wn=fn(m({},pn,{animationName:0,elapsedTime:0,pseudoElement:0})),Tn=fn(m({},pn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),En=fn(m({},pn,{data:0})),Dn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},On={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`},kn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function An(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=kn[e])?!!t[e]:!1}function jn(){return An}var Mn=fn(m({},hn,{key:function(e){if(e.key){var t=Dn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=ln(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?On[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jn,charCode:function(e){return e.type===`keypress`?ln(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?ln(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Nn=fn(m({},bn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Pn=fn(m({},hn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jn})),Fn=fn(m({},pn,{propertyName:0,elapsedTime:0,pseudoElement:0})),In=fn(m({},bn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Ln=fn(m({},pn,{newState:0,oldState:0})),Rn=[9,13,27,32],zn=tn&&`CompositionEvent`in window,Bn=null;tn&&`documentMode`in document&&(Bn=document.documentMode);var Vn=tn&&`TextEvent`in window&&!Bn,Hn=tn&&(!zn||Bn&&8<Bn&&11>=Bn),Un=` `,Wn=!1;function Gn(e,t){switch(e){case`keyup`:return Rn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Kn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var qn=!1;function Jn(e,t){switch(e){case`compositionend`:return Kn(t);case`keypress`:return t.which===32?(Wn=!0,Un):null;case`textInput`:return e=t.data,e===Un&&Wn?null:e;default:return null}}function Yn(e,t){if(qn)return e===`compositionend`||!zn&&Gn(e,t)?(e=cn(),sn=on=an=null,qn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Hn&&t.locale!==`ko`?null:t.data;default:return null}}var Xn={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 Zn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Xn[e.type]:t===`textarea`}function Qn(e,t,n,r){Yt?Xt?Xt.push(r):Xt=[r]:Yt=r,t=kd(t,`onChange`),0<t.length&&(n=new mn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var $n=null,er=null;function tr(e){xd(e,0)}function nr(e){if(Ot(ut(e)))return e}function rr(e,t){if(e===`change`)return t}var ir=!1;if(tn){var ar;if(tn){var or=`oninput`in document;if(!or){var sr=document.createElement(`div`);sr.setAttribute(`oninput`,`return;`),or=typeof sr.oninput==`function`}ar=or}else ar=!1;ir=ar&&(!document.documentMode||9<document.documentMode)}function cr(){$n&&($n.detachEvent(`onpropertychange`,lr),er=$n=null)}function lr(e){if(e.propertyName===`value`&&nr(er)){var t=[];Qn(t,er,e,Jt(e)),$t(tr,t)}}function ur(e,t,n){e===`focusin`?(cr(),$n=t,er=n,$n.attachEvent(`onpropertychange`,lr)):e===`focusout`&&cr()}function dr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return nr(er)}function fr(e,t){if(e===`click`)return nr(t)}function pr(e,t){if(e===`input`||e===`change`)return nr(t)}function mr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var hr=typeof Object.is==`function`?Object.is:mr;function gr(e,t){if(hr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!he.call(t,i)||!hr(e[i],t[i]))return!1}return!0}function _r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vr(e,t){var n=_r(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=_r(n)}}function yr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function br(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=kt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=kt(e.document)}return t}function xr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Sr=tn&&`documentMode`in document&&11>=document.documentMode,Cr=null,wr=null,Tr=null,Er=!1;function Dr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Er||Cr==null||Cr!==kt(r)||(r=Cr,`selectionStart`in r&&xr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Tr&&gr(Tr,r)||(Tr=r,r=kd(wr,`onSelect`),0<r.length&&(t=new mn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Cr)))}function Or(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var kr={animationend:Or(`Animation`,`AnimationEnd`),animationiteration:Or(`Animation`,`AnimationIteration`),animationstart:Or(`Animation`,`AnimationStart`),transitionrun:Or(`Transition`,`TransitionRun`),transitionstart:Or(`Transition`,`TransitionStart`),transitioncancel:Or(`Transition`,`TransitionCancel`),transitionend:Or(`Transition`,`TransitionEnd`)},Ar={},jr={};tn&&(jr=document.createElement(`div`).style,`AnimationEvent`in window||(delete kr.animationend.animation,delete kr.animationiteration.animation,delete kr.animationstart.animation),`TransitionEvent`in window||delete kr.transitionend.transition);function Mr(e){if(Ar[e])return Ar[e];if(!kr[e])return e;var t=kr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in jr)return Ar[e]=t[n];return e}var Nr=Mr(`animationend`),Pr=Mr(`animationiteration`),Fr=Mr(`animationstart`),Ir=Mr(`transitionrun`),Lr=Mr(`transitionstart`),Rr=Mr(`transitioncancel`),zr=Mr(`transitionend`),Br=new Map,Vr=`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(` `);Vr.push(`scrollEnd`);function Hr(e,t){Br.set(e,t),ht(t,[e])}var Ur=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Wr=[],Gr=0,Kr=0;function qr(){for(var e=Gr,t=Kr=Gr=0;t<e;){var n=Wr[t];Wr[t++]=null;var r=Wr[t];Wr[t++]=null;var i=Wr[t];Wr[t++]=null;var a=Wr[t];if(Wr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Zr(n,i,a)}}function Jr(e,t,n,r){Wr[Gr++]=e,Wr[Gr++]=t,Wr[Gr++]=n,Wr[Gr++]=r,Kr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Yr(e,t,n,r){return Jr(e,t,n,r),Qr(e)}function Xr(e,t){return Jr(e,null,null,t),Qr(e)}function Zr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Me(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Qr(e){if(50<fu)throw fu=0,pu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var $r={};function ei(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(e,t,n,r){return new ei(e,t,n,r)}function ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ri(e,t){var n=e.alternate;return n===null?(n=ti(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ii(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ai(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ni(e)&&(s=1);else if(typeof e==`string`)s=qf(e,n,te.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ti(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return oi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ti(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ti(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ti(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ti(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function oi(e,t,n,r){return e=ti(7,e,r,t),e.lanes=n,e}function si(e,t,n){return e=ti(6,e,null,t),e.lanes=n,e}function ci(e){var t=ti(18,null,null,0);return t.stateNode=e,t}function li(e,t,n){return t=ti(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ui=new WeakMap;function di(e,t){if(typeof e==`object`&&e){var n=ui.get(e);return n===void 0?(t={value:e,source:t,stack:me(t)},ui.set(e,t),t):n}return{value:e,source:t,stack:me(t)}}var fi=[],pi=0,mi=null,hi=0,gi=[],_i=0,vi=null,yi=1,bi=``;function xi(e,t){fi[pi++]=hi,fi[pi++]=mi,mi=e,hi=t}function Si(e,t,n){gi[_i++]=yi,gi[_i++]=bi,gi[_i++]=vi,vi=e;var r=yi;e=bi;var i=32-Me(r)-1;r&=~(1<<i),n+=1;var a=32-Me(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,yi=1<<32-Me(t)+i|n<<i|r,bi=a+e}else yi=1<<a|n<<i|r,bi=e}function Ci(e){e.return!==null&&(xi(e,1),Si(e,1,0))}function wi(e){for(;e===mi;)mi=fi[--pi],fi[pi]=null,hi=fi[--pi],fi[pi]=null;for(;e===vi;)vi=gi[--_i],gi[_i]=null,bi=gi[--_i],gi[_i]=null,yi=gi[--_i],gi[_i]=null}function Ti(e,t){gi[_i++]=yi,gi[_i++]=bi,gi[_i++]=vi,yi=t.id,bi=t.overflow,vi=e}var Ei=null,Di=null,Oi=!1,ki=null,Ai=!1,ji=Error(i(519));function Mi(e){throw Ri(di(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ji}function Ni(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[$e]=e,t[et]=r,n){case`dialog`:Sd(`cancel`,t),Sd(`close`,t);break;case`iframe`:case`object`:case`embed`:Sd(`load`,t);break;case`video`:case`audio`:for(n=0;n<yd.length;n++)Sd(yd[n],t);break;case`source`:Sd(`error`,t);break;case`img`:case`image`:case`link`:Sd(`error`,t),Sd(`load`,t);break;case`details`:Sd(`toggle`,t);break;case`input`:Sd(`invalid`,t),Nt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Sd(`invalid`,t);break;case`textarea`:Sd(`invalid`,t),Lt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Fd(t.textContent,n)?(r.popover!=null&&(Sd(`beforetoggle`,t),Sd(`toggle`,t)),r.onScroll!=null&&Sd(`scroll`,t),r.onScrollEnd!=null&&Sd(`scrollend`,t),r.onClick!=null&&(t.onclick=Kt),t=!0):t=!1,t||Mi(e,!0)}function Pi(e){for(Ei=e.return;Ei;)switch(Ei.tag){case 5:case 31:case 13:Ai=!1;return;case 27:case 3:Ai=!0;return;default:Ei=Ei.return}}function Fi(e){if(e!==Ei)return!1;if(!Oi)return Pi(e),Oi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||qd(e.type,e.memoizedProps)),n=!n),n&&Di&&Mi(e),Pi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Di=mf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Di=mf(e)}else t===27?(t=Di,tf(e.type)?(e=pf,pf=null,Di=e):Di=t):Di=Ei?ff(e.stateNode.nextSibling):null;return!0}function Ii(){Di=Ei=null,Oi=!1}function Li(){var e=ki;return e!==null&&(Ql===null?Ql=e:Ql.push.apply(Ql,e),ki=null),e}function Ri(e){ki===null?ki=[e]:ki.push(e)}var zi=B(null),Bi=null,Vi=null;function Hi(e,t,n){H(zi,t._currentValue),t._currentValue=n}function Ui(e){e._currentValue=zi.current,V(zi)}function Wi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function K(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Wi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Wi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Gi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;hr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===re.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[np]:e.push(np))}a=a.return}e!==null&&K(t,e,n,r),t.flags|=262144}function Ki(e){for(e=e.firstContext;e!==null;){if(!hr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function qi(e){Bi=e,Vi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ji(e){return Xi(Bi,e)}function Yi(e,t){return Bi===null&&qi(e),Xi(e,t)}function Xi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Vi===null){if(e===null)throw Error(i(308));Vi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Vi=Vi.next=t;return n}var Zi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Qi=t.unstable_scheduleCallback,$i=t.unstable_NormalPriority,ea={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ta(){return{controller:new Zi,data:new Map,refCount:0}}function na(e){e.refCount--,e.refCount===0&&Qi($i,function(){e.controller.abort()})}var ra=null,ia=0,aa=0,oa=null;function sa(e,t){if(ra===null){var n=ra=[];ia=0,aa=pd(),oa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ia++,t.then(ca,ca),t}function ca(){if(--ia===0&&ra!==null){oa!==null&&(oa.status=`fulfilled`);var e=ra;ra=null,aa=0,oa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function la(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ua=I.S;I.S=function(e,t){tu=be(),typeof t==`object`&&t&&typeof t.then==`function`&&sa(e,t),ua!==null&&ua(e,t)};var da=B(null);function fa(){var e=da.current;return e===null?Il.pooledCache:e}function pa(e,t){t===null?H(da,da.current):H(da,t.pool)}function ma(){var e=fa();return e===null?null:{parent:ea._currentValue,pool:e}}var ha=Error(i(460)),ga=Error(i(474)),_a=Error(i(542)),va={then:function(){}};function ya(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ba(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Kt,Kt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e;default:if(typeof t.status==`string`)t.then(Kt,Kt);else{if(e=Il,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e}throw Sa=t,ha}}function xa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Sa=e,ha):e}}var Sa=null;function Ca(){if(Sa===null)throw Error(i(459));var e=Sa;return Sa=null,e}function wa(e){if(e===ha||e===_a)throw Error(i(483))}var Ta=null,Ea=0;function Da(e){var t=Ea;return Ea+=1,Ta===null&&(Ta=[]),ba(Ta,e,t)}function Oa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ka(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Aa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ri(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=si(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&xa(i)===t.type)?(t=a(t,n.props),Oa(t,n),t.return=e,t):(t=ai(n.type,n.key,n.props,null,e.mode,r),Oa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=li(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=oi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=si(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ai(t.type,t.key,t.props,null,e.mode,n),Oa(n,t),n.return=e,n;case v:return t=li(t,e.mode,n),t.return=e,t;case O:return t=xa(t),f(e,t,n)}if(F(t)||M(t))return t=oi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Da(t),n);if(t.$$typeof===C)return f(e,Yi(e,t),n);ka(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=xa(n),p(e,t,n,r)}if(F(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Da(n),r);if(n.$$typeof===C)return p(e,t,Yi(e,n),r);ka(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=xa(r),m(e,t,n,r,i)}if(F(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Da(r),i);if(r.$$typeof===C)return m(e,t,n,Yi(t,r),i);ka(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Oi&&xi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Oi&&xi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Oi&&xi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Oi&&xi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Oi&&xi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Oi&&xi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&xa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Oa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=oi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ai(o.type,o.key,o.props,null,e.mode,c),Oa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=li(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=xa(o),b(e,r,o,c)}if(F(o))return h(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Da(o),c);if(o.$$typeof===C)return b(e,r,Yi(e,o),c);ka(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=si(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ea=0;var i=b(e,t,n,r);return Ta=null,i}catch(t){if(t===ha||t===_a)throw t;var a=ti(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ja=Aa(!0),Ma=Aa(!1),Na=!1;function Pa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ia(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function La(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Fl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Qr(e),Zr(e,null,n),t}return Jr(e,r,t,n),Qr(e)}function Ra(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ke(e,n)}}function za(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ba=!1;function Va(){if(Ba){var e=oa;if(e!==null)throw e}}function Ha(e,t,n,r){Ba=!1;var i=e.updateQueue;Na=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Rl&f)===f:(r&f)===f){f!==0&&f===aa&&(Ba=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Na=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Kl|=o,e.lanes=o,e.memoizedState=d}}function Ua(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Wa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ua(n[e],t)}var Ga=B(null),Ka=B(0);function qa(e,t){e=Wl,H(Ka,e),H(Ga,t),Wl=e|t.baseLanes}function Ja(){H(Ka,Wl),H(Ga,Ga.current)}function Ya(){Wl=Ka.current,V(Ga),V(Ka)}var Xa=B(null),Za=null;function Qa(e){var t=e.alternate;H(ro,ro.current&1),H(Xa,e),Za===null&&(t===null||Ga.current!==null||t.memoizedState!==null)&&(Za=e)}function $a(e){H(ro,ro.current),H(Xa,e),Za===null&&(Za=e)}function eo(e){e.tag===22?(H(ro,ro.current),H(Xa,e),Za===null&&(Za=e)):to(e)}function to(){H(ro,ro.current),H(Xa,Xa.current)}function no(e){V(Xa),Za===e&&(Za=null),V(ro)}var ro=B(0);function io(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lf(n)||uf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ao=0,oo=null,so=null,co=null,lo=!1,uo=!1,fo=!1,po=0,mo=0,ho=null,go=0;function _o(){throw Error(i(321))}function vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!hr(e[n],t[n]))return!1;return!0}function yo(e,t,n,r,i,a){return ao=a,oo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Fs:Is,fo=!1,a=n(r,i),fo=!1,uo&&(a=xo(t,n,r,i)),bo(e),a}function bo(e){I.H=Ps;var t=so!==null&&so.next!==null;if(ao=0,co=so=oo=null,lo=!1,mo=0,ho=null,t)throw Error(i(300));e===null||$s||(e=e.dependencies,e!==null&&Ki(e)&&($s=!0))}function xo(e,t,n,r){oo=e;var a=0;do{if(uo&&(ho=null),mo=0,uo=!1,25<=a)throw Error(i(301));if(a+=1,co=so=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}I.H=Ls,o=t(n,r)}while(uo);return o}function So(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?ko(t):t,e=e.useState()[0],(so===null?null:so.memoizedState)!==e&&(oo.flags|=1024),t}function Co(){var e=po!==0;return po=0,e}function wo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function To(e){if(lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}lo=!1}ao=0,co=so=oo=null,uo=!1,mo=po=0,ho=null}function Eo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return co===null?oo.memoizedState=co=e:co=co.next=e,co}function Do(){if(so===null){var e=oo.alternate;e=e===null?null:e.memoizedState}else e=so.next;var t=co===null?oo.memoizedState:co.next;if(t!==null)co=t,so=e;else{if(e===null)throw oo.alternate===null?Error(i(467)):Error(i(310));so=e,e={memoizedState:so.memoizedState,baseState:so.baseState,baseQueue:so.baseQueue,queue:so.queue,next:null},co===null?oo.memoizedState=co=e:co=co.next=e}return co}function Oo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ko(e){var t=mo;return mo+=1,ho===null&&(ho=[]),e=ba(ho,e,t),t=oo,(co===null?t.memoizedState:co.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Fs:Is),e}function Ao(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ko(e);if(e.$$typeof===C)return Ji(e)}throw Error(i(438,String(e)))}function jo(e){var t=null,n=oo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=oo.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Oo(),oo.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function Mo(e,t){return typeof t==`function`?t(e):t}function No(e){return Po(Do(),so,e)}function Po(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ao&f)===f:(Rl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===aa&&(d=!0);else if((ao&p)===p){u=u.next,p===aa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,oo.lanes|=p,Kl|=p;f=u.action,fo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,oo.lanes|=f,Kl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!hr(o,e.memoizedState)&&($s=!0,d&&(n=oa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Fo(e){var t=Do(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);hr(o,t.memoizedState)||($s=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Io(e,t,n){var r=oo,a=Do(),o=Oi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!hr((so||a).memoizedState,n);if(s&&(a.memoizedState=n,$s=!0),a=a.queue,os(zo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||co!==null&&co.memoizedState.tag&1){if(r.flags|=2048,ts(9,{destroy:void 0},Ro.bind(null,r,a,n,t),null),Il===null)throw Error(i(349));o||ao&127||Lo(r,t,n)}return n}function Lo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=oo.updateQueue,t===null?(t=Oo(),oo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ro(e,t,n,r){t.value=n,t.getSnapshot=r,Bo(t)&&Vo(e)}function zo(e,t,n){return n(function(){Bo(t)&&Vo(e)})}function Bo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!hr(e,n)}catch{return!0}}function Vo(e){var t=Xr(e,2);t!==null&&gu(t,e,2)}function Ho(e){var t=Eo();if(typeof e==`function`){var n=e;if(e=n(),fo){je(!0);try{n()}finally{je(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:e},t}function Uo(e,t,n,r){return e.baseState=n,Po(e,so,typeof r==`function`?r:Mo)}function Wo(e,t,n,r,a){if(js(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};I.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Go(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Go(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=I.T,o={};I.T=o;try{var s=n(i,r),c=I.S;c!==null&&c(o,s),Ko(e,t,s)}catch(n){qo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Ko(e,t,a)}catch(n){qo(e,t,n)}}function Ko(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){q(e,t,n)},function(n){return qo(e,t,n)}):q(e,t,n)}function q(e,t,n){t.status=`fulfilled`,t.value=n,Jo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Go(e,n)))}function qo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Jo(t),t=t.next;while(t!==r)}e.action=null}function Jo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Yo(e,t){return t}function Xo(e,t){if(Oi){var n=Il.formState;if(n!==null){a:{var r=oo;if(Oi){if(Di){b:{for(var i=Di,a=Ai;i.nodeType!==8;){if(!a){i=null;break b}if(i=ff(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Di=ff(i.nextSibling),r=i.data===`F!`;break a}}Mi(r)}r=!1}r&&(t=n[0])}}return n=Eo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:t},n.queue=r,n=Os.bind(null,oo,r),r.dispatch=n,r=Ho(!1),a=As.bind(null,oo,!1,r.queue),r=Eo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Wo.bind(null,oo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Zo(e){return Qo(Do(),so,e)}function Qo(e,t,n){if(t=Po(e,t,Yo)[0],e=No(Mo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ko(t)}catch(e){throw e===ha?_a:e}else r=t;t=Do();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(oo.flags|=2048,ts(9,{destroy:void 0},$o.bind(null,i,n),null)),[r,a,e]}function $o(e,t){e.action=t}function es(e){var t=Do(),n=so;if(n!==null)return Qo(t,n,e);Do(),t=t.memoizedState,n=Do();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ts(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=oo.updateQueue,t===null&&(t=Oo(),oo.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ns(){return Do().memoizedState}function rs(e,t,n,r){var i=Eo();oo.flags|=e,i.memoizedState=ts(1|t,{destroy:void 0},n,r===void 0?null:r)}function is(e,t,n,r){var i=Do();r=r===void 0?null:r;var a=i.memoizedState.inst;so!==null&&r!==null&&vo(r,so.memoizedState.deps)?i.memoizedState=ts(t,a,n,r):(oo.flags|=e,i.memoizedState=ts(1|t,a,n,r))}function as(e,t){rs(8390656,8,e,t)}function os(e,t){is(2048,8,e,t)}function ss(e){oo.flags|=4;var t=oo.updateQueue;if(t===null)t=Oo(),oo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function cs(e){var t=Do().memoizedState;return ss({ref:t,nextImpl:e}),function(){if(Fl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ls(e,t){return is(4,2,e,t)}function us(e,t){return is(4,4,e,t)}function ds(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function fs(e,t,n){n=n==null?null:n.concat([e]),is(4,4,ds.bind(null,t,e),n)}function ps(){}function ms(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&vo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function hs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&vo(t,r[1]))return r[0];if(r=e(),fo){je(!0);try{e()}finally{je(!1)}}return n.memoizedState=[r,t],r}function gs(e,t,n){return n===void 0||ao&1073741824&&!(Rl&261930)?e.memoizedState=t:(e.memoizedState=n,e=hu(),oo.lanes|=e,Kl|=e,n)}function _s(e,t,n,r){return hr(n,t)?n:Ga.current===null?!(ao&42)||ao&1073741824&&!(Rl&261930)?($s=!0,e.memoizedState=n):(e=hu(),oo.lanes|=e,Kl|=e,t):(e=gs(e,n,r),hr(e,t)||($s=!0),e)}function vs(e,t,n,r,i){var a=L.p;L.p=a!==0&&8>a?a:8;var o=I.T,s={};I.T=s,As(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ks(e,t,la(c,r),mu(e)):ks(e,t,r,mu(e))}catch(n){ks(e,t,{then:function(){},status:`rejected`,reason:n},mu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function ys(){}function bs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=xs(e).queue;vs(e,a,t,R,n===null?ys:function(){return Ss(e),n(r)})}function xs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ss(e){var t=xs(e);t.next===null&&(t=e.alternate.memoizedState),ks(e,t.next.queue,{},mu())}function Cs(){return Ji(np)}function ws(){return Do().memoizedState}function Ts(){return Do().memoizedState}function Es(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=mu();e=Ia(n);var r=La(t,e,n);r!==null&&(gu(r,t,n),Ra(r,t,n)),t={cache:ta()},e.payload=t;return}t=t.return}}function Ds(e,t,n){var r=mu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},js(e)?Ms(t,n):(n=Yr(e,t,n,r),n!==null&&(gu(n,e,r),Ns(n,t,r)))}function Os(e,t,n){ks(e,t,n,mu())}function ks(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(js(e))Ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,hr(s,o))return Jr(e,t,i,0),Il===null&&qr(),!1}catch{}if(n=Yr(e,t,i,r),n!==null)return gu(n,e,r),Ns(n,t,r),!0}return!1}function As(e,t,n,r){if(r={lane:2,revertLane:pd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},js(e)){if(t)throw Error(i(479))}else t=Yr(e,n,r,2),t!==null&&gu(t,e,2)}function js(e){var t=e.alternate;return e===oo||t!==null&&t===oo}function Ms(e,t){uo=lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ns(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ke(e,n)}}var Ps={readContext:Ji,use:Ao,useCallback:_o,useContext:_o,useEffect:_o,useImperativeHandle:_o,useLayoutEffect:_o,useInsertionEffect:_o,useMemo:_o,useReducer:_o,useRef:_o,useState:_o,useDebugValue:_o,useDeferredValue:_o,useTransition:_o,useSyncExternalStore:_o,useId:_o,useHostTransitionStatus:_o,useFormState:_o,useActionState:_o,useOptimistic:_o,useMemoCache:_o,useCacheRefresh:_o};Ps.useEffectEvent=_o;var Fs={readContext:Ji,use:Ao,useCallback:function(e,t){return Eo().memoizedState=[e,t===void 0?null:t],e},useContext:Ji,useEffect:as,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),rs(4194308,4,ds.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){rs(4,2,e,t)},useMemo:function(e,t){var n=Eo();t=t===void 0?null:t;var r=e();if(fo){je(!0);try{e()}finally{je(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Eo();if(n!==void 0){var i=n(t);if(fo){je(!0);try{n(t)}finally{je(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ds.bind(null,oo,e),[r.memoizedState,e]},useRef:function(e){var t=Eo();return e={current:e},t.memoizedState=e},useState:function(e){e=Ho(e);var t=e.queue,n=Os.bind(null,oo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ps,useDeferredValue:function(e,t){return gs(Eo(),e,t)},useTransition:function(){var e=Ho(!1);return e=vs.bind(null,oo,e.queue,!0,!1),Eo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=oo,a=Eo();if(Oi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Il===null)throw Error(i(349));Rl&127||Lo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,as(zo.bind(null,r,o,e),[e]),r.flags|=2048,ts(9,{destroy:void 0},Ro.bind(null,r,o,n,t),null),n},useId:function(){var e=Eo(),t=Il.identifierPrefix;if(Oi){var n=bi,r=yi;n=(r&~(1<<32-Me(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=po++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=go++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Cs,useFormState:Xo,useActionState:Xo,useOptimistic:function(e){var t=Eo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=As.bind(null,oo,!0,n),n.dispatch=t,[e,t]},useMemoCache:jo,useCacheRefresh:function(){return Eo().memoizedState=Es.bind(null,oo)},useEffectEvent:function(e){var t=Eo(),n={impl:e};return t.memoizedState=n,function(){if(Fl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Is={readContext:Ji,use:Ao,useCallback:ms,useContext:Ji,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:No,useRef:ns,useState:function(){return No(Mo)},useDebugValue:ps,useDeferredValue:function(e,t){return _s(Do(),so.memoizedState,e,t)},useTransition:function(){var e=No(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:ws,useHostTransitionStatus:Cs,useFormState:Zo,useActionState:Zo,useOptimistic:function(e,t){return Uo(Do(),so,e,t)},useMemoCache:jo,useCacheRefresh:Ts};Is.useEffectEvent=cs;var Ls={readContext:Ji,use:Ao,useCallback:ms,useContext:Ji,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Fo,useRef:ns,useState:function(){return Fo(Mo)},useDebugValue:ps,useDeferredValue:function(e,t){var n=Do();return so===null?gs(n,e,t):_s(n,so.memoizedState,e,t)},useTransition:function(){var e=Fo(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:ws,useHostTransitionStatus:Cs,useFormState:es,useActionState:es,useOptimistic:function(e,t){var n=Do();return so===null?(n.baseState=e,[e,n.queue.dispatch]):Uo(n,so,e,t)},useMemoCache:jo,useCacheRefresh:Ts};Ls.useEffectEvent=cs;function Rs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var zs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Ia(r);i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(gu(t,e,r),Ra(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Ia(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(gu(t,e,r),Ra(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=mu(),r=Ia(n);r.tag=2,t!=null&&(r.callback=t),t=La(e,r,n),t!==null&&(gu(t,e,n),Ra(t,e,n))}};function Bs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!gr(n,r)||!gr(i,a):!0}function Vs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&zs.enqueueReplaceState(t,t.state,null)}function Hs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Us(e){Ur(e)}function Ws(e){console.error(e)}function Gs(e){Ur(e)}function Ks(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function qs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Js(e,t,n){return n=Ia(n),n.tag=3,n.payload={element:null},n.callback=function(){Ks(e,t)},n}function Ys(e){return e=Ia(e),e.tag=3,e}function Xs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){qs(t,n,r),typeof i!=`function`&&(iu===null?iu=new Set([this]):iu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Zs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Gi(t,n,a,!0),n=Xa.current,n!==null){switch(n.tag){case 31:case 13:return Za===null?Ou():n.alternate===null&&Gl===0&&(Gl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===va?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),qu(e,r,a)),!1;case 22:return n.flags|=65536,r===va?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),qu(e,r,a)),!1}throw Error(i(435,n.tag))}return qu(e,r,a),Ou(),!1}if(Oi)return t=Xa.current,t===null?(r!==ji&&(t=Error(i(423),{cause:r}),Ri(di(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=di(r,n),a=Js(e.stateNode,r,a),za(e,a),Gl!==4&&(Gl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ji&&(e=Error(i(422),{cause:r}),Ri(di(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=di(o,n),Zl===null?Zl=[o]:Zl.push(o),Gl!==4&&(Gl=2),t===null)return!0;r=di(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Js(n.stateNode,r,e),za(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(iu===null||!iu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ys(a),Xs(a,e,n,r),za(n,a),!1}n=n.return}while(n!==null);return!1}var Qs=Error(i(461)),$s=!1;function ec(e,t,n,r){t.child=e===null?Ma(t,null,n,r):ja(t,e.child,n,r)}function tc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return qi(t),r=yo(e,t,n,o,a,i),s=Co(),e!==null&&!$s?(wo(e,t,i),Tc(e,t,i)):(Oi&&s&&Ci(t),t.flags|=1,ec(e,t,r,i),t.child)}function nc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ni(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,rc(e,t,a,r,i)):(e=ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Ec(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?gr:n,n(o,r)&&e.ref===t.ref)return Tc(e,t,i)}return t.flags|=1,e=ri(a,r),e.ref=t.ref,e.return=t,t.child=e}function rc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(gr(a,r)&&e.ref===t.ref)if($s=!1,t.pendingProps=r=a,Ec(e,i))e.flags&131072&&($s=!0);else return t.lanes=e.lanes,Tc(e,t,i)}return dc(e,t,n,r,i)}function ic(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return oc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pa(t,a===null?null:a.cachePool),a===null?Ja():qa(t,a),eo(t);else return r=t.lanes=536870912,oc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&pa(t,null),Ja(),to(t)):(pa(t,a.cachePool),qa(t,a),to(t),t.memoizedState=null);return ec(e,t,i,n),t.child}function ac(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function oc(e,t,n,r,i){var a=fa();return a=a===null?null:{parent:ea._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&pa(t,null),Ja(),eo(t),e!==null&&Gi(e,t,r,!0),t.childLanes=i,null}function sc(e,t){return t=bc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function cc(e,t,n){return ja(t,e.child,null,n),e=sc(t,t.pendingProps),e.flags|=2,no(t),t.memoizedState=null,e}function lc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Oi){if(r.mode===`hidden`)return e=sc(t,r),t.lanes=536870912,ac(null,e);if($a(t),(e=Di)?(e=cf(e,Ai),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vi===null?null:{id:yi,overflow:bi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,Ei=t,Di=null)):e=null,e===null)throw Mi(t);return t.lanes=536870912,null}return sc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if($a(t),a)if(t.flags&256)t.flags&=-257,t=cc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if($s||Gi(e,t,n,!1),a=(n&e.childLanes)!==0,$s||a){if(r=Il,r!==null&&(s=qe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Xr(e,s),gu(r,e,s),Qs;Ou(),t=cc(e,t,n)}else e=o.treeContext,Di=ff(s.nextSibling),Ei=t,Oi=!0,ki=null,Ai=!1,e!==null&&Ti(t,e),t=sc(t,r),t.flags|=4096;return t}return e=ri(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function uc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function dc(e,t,n,r,i){return qi(t),n=yo(e,t,n,r,void 0,i),r=Co(),e!==null&&!$s?(wo(e,t,i),Tc(e,t,i)):(Oi&&r&&Ci(t),t.flags|=1,ec(e,t,n,i),t.child)}function fc(e,t,n,r,i,a){return qi(t),t.updateQueue=null,n=xo(t,r,n,i),bo(e),r=Co(),e!==null&&!$s?(wo(e,t,a),Tc(e,t,a)):(Oi&&r&&Ci(t),t.flags|=1,ec(e,t,n,a),t.child)}function pc(e,t,n,r,i){if(qi(t),t.stateNode===null){var a=$r,o=n.contextType;typeof o==`object`&&o&&(a=Ji(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=zs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Pa(t),o=n.contextType,a.context=typeof o==`object`&&o?Ji(o):$r,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Rs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&zs.enqueueReplaceState(a,a.state,null),Ha(t,r,a,i),Va(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Hs(n,s);a.props=c;var l=a.context,u=n.contextType;o=$r,typeof u==`object`&&u&&(o=Ji(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Vs(t,a,r,o),Na=!1;var f=t.memoizedState;a.state=f,Ha(t,r,a,i),Va(),l=t.memoizedState,s||f!==l||Na?(typeof d==`function`&&(Rs(t,n,d,r),l=t.memoizedState),(c=Na||Bs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Fa(e,t),o=t.memoizedProps,u=Hs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=$r,typeof l==`object`&&l&&(c=Ji(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Vs(t,a,r,c),Na=!1,f=t.memoizedState,a.state=f,Ha(t,r,a,i),Va();var p=t.memoizedState;o!==d||f!==p||Na||e!==null&&e.dependencies!==null&&Ki(e.dependencies)?(typeof s==`function`&&(Rs(t,n,s,r),p=t.memoizedState),(u=Na||Bs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ki(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,uc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ja(t,e.child,null,i),t.child=ja(t,null,n,i)):ec(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Tc(e,t,i),e}function mc(e,t,n,r){return Ii(),t.flags|=256,ec(e,t,n,r),t.child}var hc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gc(e){return{baseLanes:e,cachePool:ma()}}function _c(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Yl),e}function vc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(ro.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Oi){if(a?Qa(t):to(t),(e=Di)?(e=cf(e,Ai),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vi===null?null:{id:yi,overflow:bi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,Ei=t,Di=null)):e=null,e===null)throw Mi(t);return uf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(to(t),a=t.mode,c=bc({mode:`hidden`,children:c},a),r=oi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(null,r)):(Qa(t),yc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Qa(t),t.flags&=-257,t=xc(e,t,n)):t.memoizedState===null?(to(t),c=r.fallback,a=t.mode,r=bc({mode:`visible`,children:r.children},a),c=oi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,ja(t,e.child,null,n),r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,t=ac(null,r)):(to(t),t.child=e.child,t.flags|=128,t=null);else if(Qa(t),uf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ri({value:r,source:null,stack:null}),t=xc(e,t,n)}else if($s||Gi(e,t,n,!1),s=(n&e.childLanes)!==0,$s||s){if(s=Il,s!==null&&(r=qe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Xr(e,r),gu(s,e,r),Qs;lf(c)||Ou(),t=xc(e,t,n)}else lf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Di=ff(c.nextSibling),Ei=t,Oi=!0,ki=null,Ai=!1,e!==null&&Ti(t,e),t=yc(t,r.children),t.flags|=4096);return t}return a?(to(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ri(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=oi(c,a,n,null),c.flags|=2):c=ri(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ac(null,r),r=t.child,c=e.child.memoizedState,c===null?c=gc(n):(a=c.cachePool,a===null?a=ma():(l=ea._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(e.child,r)):(Qa(t),n=e.child,e=n.sibling,n=ri(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function yc(e,t){return t=bc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function bc(e,t){return e=ti(22,e,null,t),e.lanes=0,e}function xc(e,t,n){return ja(t,e.child,null,n),e=yc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Sc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Wi(e.return,t,n)}function Cc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function wc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ro.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,H(ro,o),ec(e,t,r,n),r=Oi?hi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sc(e,n,t);else if(e.tag===19)Sc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&io(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Cc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&io(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Cc(t,!0,n,null,a,r);break;case`together`:Cc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Tc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Kl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Gi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ri(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ri(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ec(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Ki(e))):!0}function Dc(e,t,n){switch(t.tag){case 3:ie(t,t.stateNode.containerInfo),Hi(t,ea,e.memoizedState.cache),Ii();break;case 27:case 5:oe(t);break;case 4:ie(t,t.stateNode.containerInfo);break;case 10:Hi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,$a(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Qa(t),e=Tc(e,t,n),e===null?null:e.sibling):vc(e,t,n):(Qa(t),t.flags|=128,null);Qa(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Gi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return wc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),H(ro,ro.current),r)break;return null;case 22:return t.lanes=0,ic(e,t,n,t.pendingProps);case 24:Hi(t,ea,e.memoizedState.cache)}return Tc(e,t,n)}function Oc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)$s=!0;else{if(!Ec(e,n)&&!(t.flags&128))return $s=!1,Dc(e,t,n);$s=!!(e.flags&131072)}else $s=!1,Oi&&t.flags&1048576&&Si(t,hi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=xa(t.elementType),t.type=e,typeof e==`function`)ni(e)?(r=Hs(e,r),t.tag=1,t=pc(null,t,e,r,n)):(t.tag=0,t=dc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=tc(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=nc(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return dc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Hs(r,t.pendingProps),pc(e,t,r,a,n);case 3:a:{if(ie(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Fa(e,t),Ha(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Hi(t,ea,r),r!==o.cache&&K(t,[ea],n,!0),Va(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=mc(e,t,r,n);break a}else if(r!==a){a=di(Error(i(424)),t),Ri(a),t=mc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Di=ff(e.firstChild),Ei=t,Oi=!0,ki=null,Ai=!0,n=Ma(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ii(),r===a){t=Tc(e,t,n);break a}ec(e,t,r,n)}t=t.child}return t;case 26:return uc(e,t),e===null?(n=Nf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Oi||(n=t.type,e=t.pendingProps,r=Wd(U.current).createElement(n),r[$e]=t,r[et]=e,Rd(r,n,e),ft(r),t.stateNode=r):t.memoizedState=Nf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return oe(t),e===null&&Oi&&(r=t.stateNode=gf(t.type,t.pendingProps,U.current),Ei=t,Ai=!0,a=Di,tf(t.type)?(pf=a,Di=ff(r.firstChild)):Di=a),ec(e,t,t.pendingProps.children,n),uc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Oi&&((a=r=Di)&&(r=of(r,t.type,t.pendingProps,Ai),r===null?a=!1:(t.stateNode=r,Ei=t,Di=ff(r.firstChild),Ai=!1,a=!0)),a||Mi(t)),oe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,qd(a,o)?r=null:s!==null&&qd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=yo(e,t,So,null,null,n),np._currentValue=a),uc(e,t),ec(e,t,r,n),t.child;case 6:return e===null&&Oi&&((e=n=Di)&&(n=sf(n,t.pendingProps,Ai),n===null?e=!1:(t.stateNode=n,Ei=t,Di=null,e=!0)),e||Mi(t)),null;case 13:return vc(e,t,n);case 4:return ie(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ja(t,null,r,n):ec(e,t,r,n),t.child;case 11:return tc(e,t,t.type,t.pendingProps,n);case 7:return ec(e,t,t.pendingProps,n),t.child;case 8:return ec(e,t,t.pendingProps.children,n),t.child;case 12:return ec(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Hi(t,t.type,r.value),ec(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,qi(t),a=Ji(a),r=r(a),t.flags|=1,ec(e,t,r,n),t.child;case 14:return nc(e,t,t.type,t.pendingProps,n);case 15:return rc(e,t,t.type,t.pendingProps,n);case 19:return wc(e,t,n);case 31:return lc(e,t,n);case 22:return ic(e,t,n,t.pendingProps);case 24:return qi(t),r=Ji(ea),e===null?(a=fa(),a===null&&(a=Il,o=ta(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Pa(t),Hi(t,ea,a)):((e.lanes&n)!==0&&(Fa(e,t),Ha(t,null,null,n),Va()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Hi(t,ea,r),r!==a.cache&&K(t,[ea],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Hi(t,ea,r))),ec(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function kc(e){e.flags|=4}function Ac(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Tu())e.flags|=8192;else throw Sa=va,ga}else e.flags&=-16777217}function jc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Jf(t))if(Tu())e.flags|=8192;else throw Sa=va,ga}function Mc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:W(),e.lanes|=t,Xl|=t)}function Nc(e,t){if(!Oi)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Pc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Fc(e,t,n){var r=t.pendingProps;switch(wi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pc(t),null;case 1:return Pc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ui(ea),ae(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?kc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Li())),Pc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(kc(t),o===null?(Pc(t),Ac(t,a,null,r,n)):(Pc(t),jc(t,o))):o?o===e.memoizedState?(Pc(t),t.flags&=-16777217):(kc(t),Pc(t),jc(t,o)):(e=e.memoizedProps,e!==r&&kc(t),Pc(t),Ac(t,a,e,r,n)),null;case 27:if(se(t),n=U.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Pc(t),null}e=te.current,Fi(t)?Ni(t,e):(e=gf(a,r,n),t.stateNode=e,kc(t))}return Pc(t),null;case 5:if(se(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Pc(t),null}if(o=te.current,Fi(t))Ni(t,o);else{var s=Wd(U.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[$e]=t,o[et]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Rd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&kc(t)}}return Pc(t),Ac(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=U.current,Fi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ei,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[$e]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Fd(e.nodeValue,n)),e||Mi(t,!0)}else e=Wd(e).createTextNode(r),e[$e]=t,t.stateNode=e}return Pc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Fi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[$e]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),e=!1}else n=Li(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(no(t),t):(no(t),null);if(t.flags&128)throw Error(i(558))}return Pc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Fi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[$e]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),a=!1}else a=Li(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(no(t),t):(no(t),null)}return no(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Mc(t,t.updateQueue),Pc(t),null);case 4:return ae(),e===null&&Td(t.stateNode.containerInfo),Pc(t),null;case 10:return Ui(t.type),Pc(t),null;case 19:if(V(ro),r=t.memoizedState,r===null)return Pc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Nc(r,!1);else{if(Gl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=io(e),o!==null){for(t.flags|=128,Nc(r,!1),e=o.updateQueue,t.updateQueue=e,Mc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ii(n,e),n=n.sibling;return H(ro,ro.current&1|2),Oi&&xi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&be()>nu&&(t.flags|=128,a=!0,Nc(r,!1),t.lanes=4194304)}else{if(!a)if(e=io(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Mc(t,e),Nc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Oi)return Pc(t),null}else 2*be()-r.renderingStartTime>nu&&n!==536870912&&(t.flags|=128,a=!0,Nc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Pc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=be(),e.sibling=null,n=ro.current,H(ro,a?n&1|2:n&1),Oi&&xi(t,r.treeForkCount),e);case 22:case 23:return no(t),Ya(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Pc(t),t.subtreeFlags&6&&(t.flags|=8192)):Pc(t),n=t.updateQueue,n!==null&&Mc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&V(da),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ui(ea),Pc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Ic(e,t){switch(wi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ui(ea),ae(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return se(t),null;case 31:if(t.memoizedState!==null){if(no(t),t.alternate===null)throw Error(i(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(no(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(ro),null;case 4:return ae(),null;case 10:return Ui(t.type),null;case 22:case 23:return no(t),Ya(),e!==null&&V(da),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ui(ea),null;case 25:return null;default:return null}}function Lc(e,t){switch(wi(t),t.tag){case 3:Ui(ea),ae();break;case 26:case 27:case 5:se(t);break;case 4:ae();break;case 31:t.memoizedState!==null&&no(t);break;case 13:no(t);break;case 19:V(ro);break;case 10:Ui(t.type);break;case 22:case 23:no(t),Ya(),e!==null&&V(da);break;case 24:Ui(ea)}}function Rc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Ku(t,t.return,e)}}function zc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Ku(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ku(t,t.return,e)}}function Bc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Wa(t,n)}catch(t){Ku(e,e.return,t)}}}function Vc(e,t,n){n.props=Hs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ku(e,t,n)}}function Hc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Ku(e,t,n)}}function Uc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Ku(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Ku(e,t,n)}else n.current=null}function Wc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ku(e,e.return,t)}}function Gc(e,t,n){try{var r=e.stateNode;zd(r,e.type,n,t),r[et]=t}catch(t){Ku(e,e.return,t)}}function Kc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tf(e.type)||e.tag===4}function qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Kc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&tf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Kt));else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Rd(t,r,n),t[$e]=e,t[et]=n}catch(t){Ku(e,e.return,t)}}var Zc=!1,Qc=!1,$c=!1,el=typeof WeakSet==`function`?WeakSet:Set,tl=null;function nl(e,t){if(e=e.containerInfo,Hd=dp,e=br(e),xr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ud={focusedElem:e,selectionRange:n},dp=!1,tl=t;tl!==null;)if(t=tl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,tl=e;else for(;tl!==null;){switch(t=tl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Hs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ku(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)af(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:af(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,tl=e;break}tl=t.return}}function rl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:J(e,n),r&4&&Rc(5,n);break;case 1:if(J(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ku(n,n.return,e)}else{var i=Hs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ku(n,n.return,e)}}r&64&&Bc(n),r&512&&Hc(n,n.return);break;case 3:if(J(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Wa(e,t)}catch(e){Ku(n,n.return,e)}}break;case 27:t===null&&r&4&&Xc(n);case 26:case 5:J(e,n),t===null&&r&4&&Wc(n),r&512&&Hc(n,n.return);break;case 12:J(e,n);break;case 31:J(e,n),r&4&&ll(e,n);break;case 13:J(e,n),r&4&&ul(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Xu.bind(null,n),df(e,n))));break;case 22:if(r=n.memoizedState!==null||Zc,!r){t=t!==null&&t.memoizedState!==null||Qc,i=Zc;var a=Qc;Zc=r,(Qc=t)&&!a?Y(e,n,(n.subtreeFlags&8772)!=0):J(e,n),Zc=i,Qc=a}break;case 30:break;default:J(e,n)}}function il(e){var t=e.alternate;t!==null&&(e.alternate=null,il(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&st(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var al=null,ol=!1;function sl(e,t,n){for(n=n.child;n!==null;)cl(e,t,n),n=n.sibling}function cl(e,t,n){if(Ae&&typeof Ae.onCommitFiberUnmount==`function`)try{Ae.onCommitFiberUnmount(ke,n)}catch{}switch(n.tag){case 26:Qc||Uc(n,t),sl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Qc||Uc(n,t);var r=al,i=ol;tf(n.type)&&(al=n.stateNode,ol=!1),sl(e,t,n),_f(n.stateNode),al=r,ol=i;break;case 5:Qc||Uc(n,t);case 6:if(r=al,i=ol,al=null,sl(e,t,n),al=r,ol=i,al!==null)if(ol)try{(al.nodeType===9?al.body:al.nodeName===`HTML`?al.ownerDocument.body:al).removeChild(n.stateNode)}catch(e){Ku(n,t,e)}else try{al.removeChild(n.stateNode)}catch(e){Ku(n,t,e)}break;case 18:al!==null&&(ol?(e=al,nf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Lp(e)):nf(al,n.stateNode));break;case 4:r=al,i=ol,al=n.stateNode.containerInfo,ol=!0,sl(e,t,n),al=r,ol=i;break;case 0:case 11:case 14:case 15:zc(2,n,t),Qc||zc(4,n,t),sl(e,t,n);break;case 1:Qc||(Uc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Vc(n,t,r)),sl(e,t,n);break;case 21:sl(e,t,n);break;case 22:Qc=(r=Qc)||n.memoizedState!==null,sl(e,t,n),Qc=r;break;default:sl(e,t,n)}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Lp(e)}catch(e){Ku(t,t.return,e)}}}function ul(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Lp(e)}catch(e){Ku(t,t.return,e)}}function dl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new el),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new el),t;default:throw Error(i(435,e.tag))}}function fl(e,t){var n=dl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Zu.bind(null,e,t);t.then(r,r)}})}function pl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(tf(c.type)){al=c.stateNode,ol=!1;break a}break;case 5:al=c.stateNode,ol=!1;break a;case 3:case 4:al=c.stateNode.containerInfo,ol=!0;break a}c=c.return}if(al===null)throw Error(i(160));cl(o,s,a),al=null,ol=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)hl(t,e),t=t.sibling}var ml=null;function hl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pl(t,e),gl(e),r&4&&(zc(3,e,e.return),Rc(3,e),zc(5,e,e.return));break;case 1:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&64&&Zc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=ml;if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[ot]||o[$e]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Rd(o,r,n),o[$e]=e,ft(o),r=o;break a;case`link`:var s=Gf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Rd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Gf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Rd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[$e]=e,ft(o),r=o}e.stateNode=r}else Kf(a,e.type,e.stateNode);else e.stateNode=Bf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Gc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Kf(a,e.type,e.stateNode):Bf(a,r,e.memoizedProps))}break;case 27:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),n!==null&&r&4&&Gc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),e.flags&32){a=e.stateNode;try{Rt(a,``)}catch(t){Ku(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Gc(e,a,n===null?a:n.memoizedProps)),r&1024&&($c=!0);break;case 6:if(pl(t,e),gl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ku(e,e.return,t)}}break;case 3:if(Wf=null,a=ml,ml=bf(t.containerInfo),pl(t,e),ml=a,gl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Lp(t.containerInfo)}catch(t){Ku(e,e.return,t)}$c&&($c=!1,_l(e));break;case 4:r=ml,ml=bf(e.stateNode.containerInfo),pl(t,e),gl(e),ml=r;break;case 12:pl(t,e),gl(e);break;case 31:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 13:pl(t,e),gl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(eu=be()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Zc,d=Qc;if(Zc=u||a,Qc=d||l,pl(t,e),Qc=d,Zc=u,gl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Zc||Qc||vl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Ku(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ku(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?rf(m,!0):rf(l.stateNode,!1)}catch(e){Ku(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,fl(e,n))));break;case 19:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 30:break;case 21:break;default:pl(t,e),gl(e)}}function gl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Kc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Yc(e,qc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Rt(o,``),n.flags&=-33),Yc(e,qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Jc(e,qc(e),s);break;default:throw Error(i(161))}}catch(t){Ku(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _l(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;_l(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function J(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)rl(e,t.alternate,t),t=t.sibling}function vl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:zc(4,t,t.return),vl(t);break;case 1:Uc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Vc(t,t.return,n),vl(t);break;case 27:_f(t.stateNode);case 26:case 5:Uc(t,t.return),vl(t);break;case 22:t.memoizedState===null&&vl(t);break;case 30:vl(t);break;default:vl(t)}e=e.sibling}}function Y(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Y(i,a,n),Rc(4,a);break;case 1:if(Y(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ku(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ua(c[i],s)}catch(e){Ku(r,r.return,e)}}n&&o&64&&Bc(a),Hc(a,a.return);break;case 27:Xc(a);case 26:case 5:Y(i,a,n),n&&r===null&&o&4&&Wc(a),Hc(a,a.return);break;case 12:Y(i,a,n);break;case 31:Y(i,a,n),n&&o&4&&ll(i,a);break;case 13:Y(i,a,n),n&&o&4&&ul(i,a);break;case 22:a.memoizedState===null&&Y(i,a,n),Hc(a,a.return);break;case 30:break;default:Y(i,a,n)}t=t.sibling}}function yl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&na(n))}function bl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e))}function xl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Sl(e,t,n,r),t=t.sibling}function Sl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:xl(e,t,n,r),i&2048&&Rc(9,t);break;case 1:xl(e,t,n,r);break;case 3:xl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e)));break;case 12:if(i&2048){xl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Ku(t,t.return,e)}}else xl(e,t,n,r);break;case 31:xl(e,t,n,r);break;case 13:xl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?xl(e,t,n,r):(a._visibility|=2,Cl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?xl(e,t,n,r):wl(e,t),i&2048&&yl(o,t);break;case 24:xl(e,t,n,r),i&2048&&bl(t.alternate,t);break;default:xl(e,t,n,r)}}function Cl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Cl(a,o,s,c,i),Rc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Cl(a,o,s,c,i)):u._visibility&2?Cl(a,o,s,c,i):wl(a,o),i&&l&2048&&yl(o.alternate,o);break;case 24:Cl(a,o,s,c,i),i&&l&2048&&bl(o.alternate,o);break;default:Cl(a,o,s,c,i)}t=t.sibling}}function wl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:wl(n,r),i&2048&&yl(r.alternate,r);break;case 24:wl(n,r),i&2048&&bl(r.alternate,r);break;default:wl(n,r)}t=t.sibling}}var Tl=8192;function El(e,t,n){if(e.subtreeFlags&Tl)for(e=e.child;e!==null;)Dl(e,t,n),e=e.sibling}function Dl(e,t,n){switch(e.tag){case 26:El(e,t,n),e.flags&Tl&&e.memoizedState!==null&&Yf(n,ml,e.memoizedState,e.memoizedProps);break;case 5:El(e,t,n);break;case 3:case 4:var r=ml;ml=bf(e.stateNode.containerInfo),El(e,t,n),ml=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Tl,Tl=16777216,El(e,t,n),Tl=r):El(e,t,n));break;default:El(e,t,n)}}function Ol(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function kl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Ml(r,e)}Ol(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Al(e),e=e.sibling}function Al(e){switch(e.tag){case 0:case 11:case 15:kl(e),e.flags&2048&&zc(9,e,e.return);break;case 3:kl(e);break;case 12:kl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,jl(e)):kl(e);break;default:kl(e)}}function jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Ml(r,e)}Ol(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:zc(8,t,t.return),jl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,jl(t));break;default:jl(t)}e=e.sibling}}function Ml(e,t){for(;tl!==null;){var n=tl;switch(n.tag){case 0:case 11:case 15:zc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:na(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,tl=r;else a:for(n=e;tl!==null;){r=tl;var i=r.sibling,a=r.return;if(il(r),r===n){tl=null;break a}if(i!==null){i.return=a,tl=i;break a}tl=a}}}var Nl={getCacheForType:function(e){var t=Ji(ea),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ji(ea).controller.signal}},Pl=typeof WeakMap==`function`?WeakMap:Map,Fl=0,Il=null,Ll=null,Rl=0,zl=0,Bl=null,Vl=!1,Hl=!1,Ul=!1,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=null,Ql=null,$l=!1,eu=0,tu=0,nu=1/0,ru=null,iu=null,au=0,ou=null,su=null,cu=0,lu=0,uu=null,du=null,fu=0,pu=null;function mu(){return Fl&2&&Rl!==0?Rl&-Rl:I.T===null?Xe():pd()}function hu(){if(Yl===0)if(!(Rl&536870912)||Oi){var e=Le;Le<<=1,!(Le&3932160)&&(Le=262144),Yl=e}else Yl=536870912;return e=Xa.current,e!==null&&(e.flags|=32),Yl}function gu(e,t,n){(e===Il&&(zl===2||zl===9)||e.cancelPendingCommit!==null)&&(Cu(e,0),bu(e,Rl,Yl,!1)),Ue(e,n),(!(Fl&2)||e!==Il)&&(e===Il&&(!(Fl&2)&&(ql|=n),Gl===4&&bu(e,Rl,Yl,!1)),ad(e))}function _u(e,t,n){if(Fl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ve(e,t),a=r?ju(e,t):ku(e,t,!0),o=r;do{if(a===0){Hl&&!r&&bu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!yu(n)){a=ku(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Zl;var l=c.current.memoizedState.isDehydrated;if(l&&(Cu(c,s).flags|=256),s=ku(c,s,!1),s!==2){if(Ul&&!l){c.errorRecoveryDisabledLanes|=o,ql|=o,a=4;break a}o=Ql,Ql=a,o!==null&&(Ql===null?Ql=o:Ql.push.apply(Ql,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Cu(e,0),bu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:bu(r,t,Yl,!Vl);break a;case 2:Ql=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=eu+300-be(),10<a)){if(bu(r,t,Yl,!Vl),Be(r,0,!0)!==0)break a;cu=t,r.timeoutHandle=Xd(vu.bind(null,r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,`Throttled`,-0,0),a);break a}vu(r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,null,-0,0)}}break}while(1);ad(e)}function vu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Kt},Dl(t,a,d);var m=(a&62914560)===a?eu-be():(a&4194048)===a?tu-be():0;if(m=Zf(d,m),m!==null){cu=a,e.cancelPendingCommit=m(Ru.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),bu(e,a,o,!l);return}}Ru(e,t,a,n,r,i,o,s,c)}function yu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!hr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function bu(e,t,n,r){t&=~Jl,t&=~ql,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Me(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ge(e,n,t)}function xu(){return Fl&6?!0:(od(0,!1),!1)}function Su(){if(Ll!==null){if(zl===0)var e=Ll.return;else e=Ll,Vi=Bi=null,To(e),Ta=null,Ea=0,e=Ll;for(;e!==null;)Lc(e.alternate,e),e=e.return;Ll=null}}function Cu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Zd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),cu=0,Su(),Il=e,Ll=n=ri(e.current,null),Rl=t,zl=0,Bl=null,Vl=!1,Hl=Ve(e,t),Ul=!1,Xl=Yl=Jl=ql=Kl=Gl=0,Ql=Zl=null,$l=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Me(r),a=1<<i;t|=e[i],r&=~a}return Wl=t,qr(),n}function wu(e,t){oo=null,I.H=Ps,t===ha||t===_a?(t=Ca(),zl=3):t===ga?(t=Ca(),zl=4):zl=t===Qs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Bl=t,Ll===null&&(Gl=1,Ks(e,di(t,e.current)))}function Tu(){var e=Xa.current;return e===null?!0:(Rl&4194048)===Rl?Za===null:(Rl&62914560)===Rl||Rl&536870912?e===Za:!1}function Eu(){var e=I.H;return I.H=Ps,e===null?Ps:e}function Du(){var e=I.A;return I.A=Nl,e}function Ou(){Gl=4,Vl||(Rl&4194048)!==Rl&&Xa.current!==null||(Hl=!0),!(Kl&134217727)&&!(ql&134217727)||Il===null||bu(Il,Rl,Yl,!1)}function ku(e,t,n){var r=Fl;Fl|=2;var i=Eu(),a=Du();(Il!==e||Rl!==t)&&(ru=null,Cu(e,t)),t=!1;var o=Gl;a:do try{if(zl!==0&&Ll!==null){var s=Ll,c=Bl;switch(zl){case 8:Su(),o=6;break a;case 3:case 2:case 9:case 6:Xa.current===null&&(t=!0);var l=zl;if(zl=0,Bl=null,Fu(e,s,c,l),n&&Hl){o=0;break a}break;default:l=zl,zl=0,Bl=null,Fu(e,s,c,l)}}Au(),o=Gl;break}catch(t){wu(e,t)}while(1);return t&&e.shellSuspendCounter++,Vi=Bi=null,Fl=r,I.H=i,I.A=a,Ll===null&&(Il=null,Rl=0,qr()),o}function Au(){for(;Ll!==null;)Nu(Ll)}function ju(e,t){var n=Fl;Fl|=2;var r=Eu(),a=Du();Il!==e||Rl!==t?(ru=null,nu=be()+500,Cu(e,t)):Hl=Ve(e,t);a:do try{if(zl!==0&&Ll!==null){t=Ll;var o=Bl;b:switch(zl){case 1:zl=0,Bl=null,Fu(e,t,o,1);break;case 2:case 9:if(ya(o)){zl=0,Bl=null,Pu(t);break}t=function(){zl!==2&&zl!==9||Il!==e||(zl=7),ad(e)},o.then(t,t);break a;case 3:zl=7;break a;case 4:zl=5;break a;case 7:ya(o)?(zl=0,Bl=null,Pu(t)):(zl=0,Bl=null,Fu(e,t,o,7));break;case 5:var s=null;switch(Ll.tag){case 26:s=Ll.memoizedState;case 5:case 27:var c=Ll;if(s?Jf(s):c.stateNode.complete){zl=0,Bl=null;var l=c.sibling;if(l!==null)Ll=l;else{var u=c.return;u===null?Ll=null:(Ll=u,Iu(u))}break b}}zl=0,Bl=null,Fu(e,t,o,5);break;case 6:zl=0,Bl=null,Fu(e,t,o,6);break;case 8:Su(),Gl=6;break a;default:throw Error(i(462))}}Mu();break}catch(t){wu(e,t)}while(1);return Vi=Bi=null,I.H=r,I.A=a,Fl=n,Ll===null?(Il=null,Rl=0,qr(),Gl):0}function Mu(){for(;Ll!==null&&!ve();)Nu(Ll)}function Nu(e){var t=Oc(e.alternate,e,Wl);e.memoizedProps=e.pendingProps,t===null?Iu(e):Ll=t}function Pu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=fc(n,t,t.pendingProps,t.type,void 0,Rl);break;case 11:t=fc(n,t,t.pendingProps,t.type.render,t.ref,Rl);break;case 5:To(t);default:Lc(n,t),t=Ll=ii(t,Wl),t=Oc(n,t,Wl)}e.memoizedProps=e.pendingProps,t===null?Iu(e):Ll=t}function Fu(e,t,n,r){Vi=Bi=null,To(t),Ta=null,Ea=0;var i=t.return;try{if(Zs(e,i,t,n,Rl)){Gl=1,Ks(e,di(n,e.current)),Ll=null;return}}catch(t){if(i!==null)throw Ll=i,t;Gl=1,Ks(e,di(n,e.current)),Ll=null;return}t.flags&32768?(Oi||r===1?e=!0:Hl||Rl&536870912?e=!1:(Vl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Xa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Lu(t,e)):Iu(t)}function Iu(e){var t=e;do{if(t.flags&32768){Lu(t,Vl);return}e=t.return;var n=Fc(t.alternate,t,Wl);if(n!==null){Ll=n;return}if(t=t.sibling,t!==null){Ll=t;return}Ll=t=e}while(t!==null);Gl===0&&(Gl=5)}function Lu(e,t){do{var n=Ic(e.alternate,e);if(n!==null){n.flags&=32767,Ll=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ll=e;return}Ll=e=n}while(e!==null);Gl=6,Ll=null}function Ru(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Uu();while(au!==0);if(Fl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Kr,We(e,n,o,s,c,l),e===Il&&(Ll=Il=null,Rl=0),su=t,ou=e,cu=n,lu=o,uu=a,du=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Qu(we,function(){return Wu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=I.T,I.T=null,a=L.p,L.p=2,s=Fl,Fl|=4;try{nl(e,t,n)}finally{Fl=s,L.p=a,I.T=r}}au=1,zu(),Bu(),Vu()}}function zu(){if(au===1){au=0;var e=ou,t=su,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Fl;Fl|=4;try{hl(t,e);var a=Ud,o=br(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&yr(s.ownerDocument.documentElement,s)){if(c!==null&&xr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=vr(s,h),v=vr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}dp=!!Hd,Ud=Hd=null}finally{Fl=i,L.p=r,I.T=n}}e.current=t,au=2}}function Bu(){if(au===2){au=0;var e=ou,t=su,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Fl;Fl|=4;try{rl(e,t.alternate,t)}finally{Fl=i,L.p=r,I.T=n}}au=3}}function Vu(){if(au===4||au===3){au=0,ye();var e=ou,t=su,n=cu,r=du;t.subtreeFlags&10256||t.flags&10256?au=5:(au=0,su=ou=null,Hu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(iu=null),Ye(n),t=t.stateNode,Ae&&typeof Ae.onCommitFiberRoot==`function`)try{Ae.onCommitFiberRoot(ke,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=I.T,i=L.p,L.p=2,I.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{I.T=t,L.p=i}}cu&3&&Uu(),ad(e),i=e.pendingLanes,n&261930&&i&42?e===pu?fu++:(fu=0,pu=e):fu=0,od(0,!1)}}function Hu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,na(t)))}function Uu(){return zu(),Bu(),Vu(),Wu()}function Wu(){if(au!==5)return!1;var e=ou,t=lu;lu=0;var n=Ye(cu),r=I.T,a=L.p;try{L.p=32>n?32:n,I.T=null,n=uu,uu=null;var o=ou,s=cu;if(au=0,su=ou=null,cu=0,Fl&6)throw Error(i(331));var c=Fl;if(Fl|=4,Al(o.current),Sl(o,o.current,s,n),Fl=c,od(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot==`function`)try{Ae.onPostCommitFiberRoot(ke,o)}catch{}return!0}finally{L.p=a,I.T=r,Hu(e,t)}}function Gu(e,t,n){t=di(n,t),t=Js(e.stateNode,t,2),e=La(e,t,2),e!==null&&(Ue(e,2),ad(e))}function Ku(e,t,n){if(e.tag===3)Gu(e,e,n);else for(;t!==null;){if(t.tag===3){Gu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(iu===null||!iu.has(r))){e=di(n,e),n=Ys(2),r=La(t,n,2),r!==null&&(Xs(n,r,t,e),Ue(r,2),ad(r));break}}t=t.return}}function qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Pl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ul=!0,i.add(n),e=Ju.bind(null,e,t,n),t.then(e,e))}function Ju(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Il===e&&(Rl&n)===n&&(Gl===4||Gl===3&&(Rl&62914560)===Rl&&300>be()-eu?!(Fl&2)&&Cu(e,0):Jl|=n,Xl===Rl&&(Xl=0)),ad(e)}function Yu(e,t){t===0&&(t=W()),e=Xr(e,t),e!==null&&(Ue(e,t),ad(e))}function Xu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yu(e,n)}function Zu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Yu(e,n)}function Qu(e,t){return ge(e,t)}var $u=null,ed=null,td=!1,nd=!1,rd=!1,id=0;function ad(e){e!==ed&&e.next===null&&(ed===null?$u=ed=e:ed=ed.next=e),nd=!0,td||(td=!0,fd())}function od(e,t){if(!rd&&nd){rd=!0;do for(var n=!1,r=$u;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Me(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,dd(r,a))}else a=Rl,a=Be(r,r===Il?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ve(r,a)||(n=!0,dd(r,a));r=r.next}while(n);rd=!1}}function sd(){cd()}function cd(){nd=td=!1;var e=0;id!==0&&Yd()&&(e=id);for(var t=be(),n=null,r=$u;r!==null;){var i=r.next,a=ld(r,t);a===0?(r.next=null,n===null?$u=i:n.next=i,i===null&&(ed=n)):(n=r,(e!==0||a&3)&&(nd=!0)),r=i}au!==0&&au!==5||od(e,!1),id!==0&&(id=0)}function ld(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Me(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=He(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Il,n=Rl,n=Be(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(zl===2||zl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&_e(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ve(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&_e(r),Ye(n)){case 2:case 8:n=Ce;break;case 32:n=we;break;case 268435456:n=Ee;break;default:n=we}return r=ud.bind(null,e),n=ge(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&_e(r),e.callbackPriority=2,e.callbackNode=null,2}function ud(e,t){if(au!==0&&au!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Uu()&&e.callbackNode!==n)return null;var r=Rl;return r=Be(e,e===Il?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(_u(e,r,t),ld(e,be()),e.callbackNode!=null&&e.callbackNode===n?ud.bind(null,e):null)}function dd(e,t){if(Uu())return null;_u(e,t,!0)}function fd(){$d(function(){Fl&6?ge(Se,sd):cd()})}function pd(){if(id===0){var e=aa;e===0&&(e=Ie,Ie<<=1,!(Ie&261888)&&(Ie=256)),id=e}return id}function md(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Gt(``+e)}function hd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function gd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=md((i[et]||null).action),o=r.submitter;o&&(t=(t=o[et]||null)?md(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new mn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(id!==0){var e=o?hd(i,o):new FormData(i);bs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?hd(i,o):new FormData(i),bs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var _d=0;_d<Vr.length;_d++){var vd=Vr[_d];Hr(vd.toLowerCase(),`on`+(vd[0].toUpperCase()+vd.slice(1)))}Hr(Nr,`onAnimationEnd`),Hr(Pr,`onAnimationIteration`),Hr(Fr,`onAnimationStart`),Hr(`dblclick`,`onDoubleClick`),Hr(`focusin`,`onFocus`),Hr(`focusout`,`onBlur`),Hr(Ir,`onTransitionRun`),Hr(Lr,`onTransitionStart`),Hr(Rr,`onTransitionCancel`),Hr(zr,`onTransitionEnd`),gt(`onMouseEnter`,[`mouseout`,`mouseover`]),gt(`onMouseLeave`,[`mouseout`,`mouseover`]),gt(`onPointerEnter`,[`pointerout`,`pointerover`]),gt(`onPointerLeave`,[`pointerout`,`pointerover`]),ht(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),ht(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),ht(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),ht(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),ht(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),ht(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var yd=`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(` `),bd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(yd));function xd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ur(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ur(e)}i.currentTarget=null,a=c}}}}function Sd(e,t){var n=t[nt];n===void 0&&(n=t[nt]=new Set);var r=e+`__bubble`;n.has(r)||(Ed(t,e,2,!1),n.add(r))}function Cd(e,t,n){var r=0;t&&(r|=4),Ed(n,e,r,t)}var wd=`_reactListening`+Math.random().toString(36).slice(2);function Td(e){if(!e[wd]){e[wd]=!0,pt.forEach(function(t){t!==`selectionchange`&&(bd.has(t)||Cd(t,!1,e),Cd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wd]||(t[wd]=!0,Cd(`selectionchange`,!1,t))}}function Ed(e,t,n,r){switch(vp(t)){case 2:var i=fp;break;case 8:i=pp;break;default:i=mp}n=i.bind(null,t,n,e),i=void 0,!nn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Dd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=ct(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}$t(function(){var r=a,i=Jt(n),s=[];a:{var c=Br.get(e);if(c!==void 0){var l=mn,u=e;switch(e){case`keypress`:if(ln(n)===0)break a;case`keydown`:case`keyup`:l=Mn;break;case`focusin`:u=`focus`,l=Cn;break;case`focusout`:u=`blur`,l=Cn;break;case`beforeblur`:case`afterblur`:l=Cn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=xn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Sn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Pn;break;case Nr:case Pr:case Fr:l=wn;break;case zr:l=Fn;break;case`scroll`:case`scrollend`:l=gn;break;case`wheel`:l=In;break;case`copy`:case`cut`:case`paste`:l=Tn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Nn;break;case`toggle`:case`beforetoggle`:l=Ln}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=en(m,p),g!=null&&d.push(Od(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==qt&&(u=n.relatedTarget||n.fromElement)&&(ct(u)||u[tt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?ct(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=xn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Nn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:ut(l),h=u==null?c:ut(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ct(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Ad,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&jd(s,c,l,d,!1),u!==null&&f!==null&&jd(s,f,u,d,!0)}}a:{if(c=r?ut(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=rr;else if(Zn(c))if(ir)v=pr;else{v=dr;var y=ur}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Ht(r.elementType)&&(v=rr):v=fr;if(v&&=v(e,r)){Qn(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Pt(c,`number`,c.value)}switch(y=r?ut(r):window,e){case`focusin`:(Zn(y)||y.contentEditable===`true`)&&(Cr=y,wr=r,Tr=null);break;case`focusout`:Tr=wr=Cr=null;break;case`mousedown`:Er=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Er=!1,Dr(s,n,i);break;case`selectionchange`:if(Sr)break;case`keydown`:case`keyup`:Dr(s,n,i)}var b;if(zn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else qn?Gn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Hn&&n.locale!==`ko`&&(qn||x!==`onCompositionStart`?x===`onCompositionEnd`&&qn&&(b=cn()):(an=i,on=`value`in an?an.value:an.textContent,qn=!0)),y=kd(r,x),0<y.length&&(x=new En(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Kn(n),b!==null&&(x.data=b)))),(b=Vn?Jn(e,n):Yn(e,n))&&(x=kd(r,`onBeforeInput`),0<x.length&&(y=new En(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),gd(s,e,r,n,i)}xd(s,t)})}function Od(e,t,n){return{instance:e,listener:t,currentTarget:n}}function kd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=en(e,n),i!=null&&r.unshift(Od(e,i,a)),i=en(e,t),i!=null&&r.push(Od(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ad(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function jd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=en(n,a),l!=null&&o.unshift(Od(n,l,c))):i||(l=en(n,a),l!=null&&o.push(Od(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Md=/\r\n?/g,Nd=/\u0000|\uFFFD/g;function Pd(e){return(typeof e==`string`?e:``+e).replace(Md,`
|
|
9
|
-
`).replace(Nd,``)}function Fd(e,t){return t=Pd(t),Pd(e)===t}function Id(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Rt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Rt(e,``+r);break;case`className`:St(e,`class`,r);break;case`tabIndex`:St(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:St(e,n,r);break;case`style`:Vt(e,r,o);break;case`data`:if(t!==`object`){St(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Gt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Id(e,t,`name`,a.name,a,null),Id(e,t,`formEncType`,a.formEncType,a,null),Id(e,t,`formMethod`,a.formMethod,a,null),Id(e,t,`formTarget`,a.formTarget,a,null)):(Id(e,t,`encType`,a.encType,a,null),Id(e,t,`method`,a.method,a,null),Id(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Gt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Kt);break;case`onScroll`:r!=null&&Sd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Sd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Gt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Sd(`beforetoggle`,e),Sd(`toggle`,e),xt(e,`popover`,r);break;case`xlinkActuate`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Ct(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Ct(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Ct(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:xt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Ut.get(n)||n,xt(e,n,r))}}function Ld(e,t,n,r,a,o){switch(n){case`style`:Vt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Rt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Rt(e,``+r);break;case`onScroll`:r!=null&&Sd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Sd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Kt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!mt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[et]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):xt(e,n,r)}}}function Rd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Sd(`error`,e),Sd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Id(e,t,o,s,n,null)}}a&&Id(e,t,`srcSet`,n.srcSet,n,null),r&&Id(e,t,`src`,n.src,n,null);return;case`input`:Sd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Id(e,t,r,d,n,null)}}Nt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Sd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Id(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Ft(e,!!r,n,!0):Ft(e,!!r,t,!1);return;case`textarea`:for(s in Sd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Id(e,t,s,c,n,null)}Lt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Id(e,t,l,r,n,null)}return;case`dialog`:Sd(`beforetoggle`,e),Sd(`toggle`,e),Sd(`cancel`,e),Sd(`close`,e);break;case`iframe`:case`object`:Sd(`load`,e);break;case`video`:case`audio`:for(r=0;r<yd.length;r++)Sd(yd[r],e);break;case`image`:Sd(`error`,e),Sd(`load`,e);break;case`details`:Sd(`toggle`,e);break;case`embed`:case`source`:case`link`:Sd(`error`,e),Sd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Id(e,t,u,r,n,null)}return;default:if(Ht(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Ld(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Id(e,t,c,r,n,null))}function zd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Id(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Id(e,t,p,m,r,f)}}Mt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Id(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Id(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ft(e,!!n,n?[]:``,!1):Ft(e,!!n,t,!0)):Ft(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Id(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Id(e,t,s,a,r,o)}It(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Id(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Id(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Id(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Id(e,t,u,p,r,m)}return;default:if(Ht(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Ld(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Ld(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Id(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Id(e,t,f,p,r,m)}function Bd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Vd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Bd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Bd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Hd=null,Ud=null;function Wd(e){return e.nodeType===9?e:e.ownerDocument}function Gd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Kd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function qd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Jd=null;function Yd(){var e=window.event;return e&&e.type===`popstate`?e===Jd?!1:(Jd=e,!0):(Jd=null,!1)}var Xd=typeof setTimeout==`function`?setTimeout:void 0,Zd=typeof clearTimeout==`function`?clearTimeout:void 0,Qd=typeof Promise==`function`?Promise:void 0,$d=typeof queueMicrotask==`function`?queueMicrotask:Qd===void 0?Xd:function(e){return Qd.resolve(null).then(e).catch(ef)};function ef(e){setTimeout(function(){throw e})}function tf(e){return e===`head`}function nf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Lp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_f(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_f(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ot]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_f(e.ownerDocument.body);n=i}while(n);Lp(t)}function rf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function af(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:af(n),st(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function of(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[ot])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=ff(e.nextSibling),e===null)break}return null}function sf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=ff(e.nextSibling),e===null))return null;return e}function cf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=ff(e.nextSibling),e===null))return null;return e}function lf(e){return e.data===`$?`||e.data===`$~`}function uf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function df(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function ff(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var pf=null;function mf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return ff(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function hf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function gf(e,t,n){switch(t=Wd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function _f(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);st(e)}var vf=new Map,yf=new Set;function bf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xf=L.d;L.d={f:Sf,r:Cf,D:Ef,C:Df,L:Of,m:kf,X:jf,S:Af,M:Mf};function Sf(){var e=xf.f(),t=xu();return e||t}function Cf(e){var t=lt(e);t!==null&&t.tag===5&&t.type===`form`?Ss(t):xf.r(e)}var wf=typeof document>`u`?null:document;function Tf(e,t,n){var r=wf;if(r&&typeof t==`string`&&t){var i=jt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),yf.has(i)||(yf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Rd(t,`link`,e),ft(t),r.head.appendChild(t)))}}function Ef(e){xf.D(e),Tf(`dns-prefetch`,e,null)}function Df(e,t){xf.C(e,t),Tf(`preconnect`,e,t)}function Of(e,t,n){xf.L(e,t,n);var r=wf;if(r&&e&&t){var i=`link[rel="preload"][as="`+jt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+jt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+jt(n.imageSizes)+`"]`)):i+=`[href="`+jt(e)+`"]`;var a=i;switch(t){case`style`:a=Pf(e);break;case`script`:a=Rf(e)}vf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Ff(a))||t===`script`&&r.querySelector(zf(a))||(t=r.createElement(`link`),Rd(t,`link`,e),ft(t),r.head.appendChild(t)))}}function kf(e,t){xf.m(e,t);var n=wf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+jt(r)+`"][href="`+jt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rf(e)}if(!vf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),vf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zf(a)))return}r=n.createElement(`link`),Rd(r,`link`,e),ft(r),n.head.appendChild(r)}}}function Af(e,t,n){xf.S(e,t,n);var r=wf;if(r&&e){var i=dt(r).hoistableStyles,a=Pf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Ff(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vf.get(a))&&Hf(e,n);var c=o=r.createElement(`link`);ft(c),Rd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jf(e,t){xf.X(e,t);var n=wf;if(n&&e){var r=dt(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=m({src:e,async:!0},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),ft(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t){xf.M(e,t);var n=wf;if(n&&e){var r=dt(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),ft(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nf(e,t,n,r){var a=(a=U.current)?bf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Pf(n.href),n=dt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pf(n.href);var o=dt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Ff(e)))&&!o._p&&(s.instance=o,s.state.loading=5),vf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vf.set(e,n),o||Lf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Rf(n),n=dt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pf(e){return`href="`+jt(e)+`"`}function Ff(e){return`link[rel="stylesheet"][`+e+`]`}function If(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Lf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Rd(t,`link`,n),ft(t),e.head.appendChild(t))}function Rf(e){return`[src="`+jt(e)+`"]`}function zf(e){return`script[async]`+e}function Bf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+jt(n.href)+`"]`);if(r)return t.instance=r,ft(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ft(r),Rd(r,`style`,a),Vf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pf(n.href);var o=e.querySelector(Ff(a));if(o)return t.state.loading|=4,t.instance=o,ft(o),o;r=If(n),(a=vf.get(a))&&Hf(r,a),o=(e.ownerDocument||e).createElement(`link`),ft(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Rd(o,`link`,r),t.state.loading|=4,Vf(o,n.precedence,e),t.instance=o;case`script`:return o=Rf(n.src),(a=e.querySelector(zf(o)))?(t.instance=a,ft(a),a):(r=n,(a=vf.get(o))&&(r=m({},n),Uf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),ft(a),Rd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vf(r,n.precedence,e));return t.instance}function Vf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Uf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wf=null;function Gf(e,t,n){if(Wf===null){var r=new Map,i=Wf=new Map;i.set(n,r)}else i=Wf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ot]||a[$e]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Kf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Yf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pf(r.href),a=t.querySelector(Ff(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Qf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ft(a);return}a=t.ownerDocument||t,r=If(r),(i=vf.get(i))&&Hf(r,i),a=a.createElement(`link`),ft(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Rd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Qf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Xf=0;function Zf(e,t){return e.stylesheets&&e.count===0&&ep(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Xf===0&&(Xf=62500*Vd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Xf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Qf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ep(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var $f=null;function ep(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$f=new Map,t.forEach(tp,e),$f=null,Qf.call(e))}function tp(e,t){if(!(t.state.loading&4)){var n=$f.get(e);if(n)var r=n.get(null);else{n=new Map,$f.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Qf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var np={$$typeof:C,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function rp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=G(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=G(0),this.hiddenUpdates=G(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ip(e,t,n,r,i,a,o,s,c,l,u,d){return e=new rp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ti(3,null,null,t),e.current=a,a.stateNode=e,t=ta(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Pa(a),e}function ap(e){return e?(e=$r,e):$r}function op(e,t,n,r,i,a){i=ap(i),r.context===null?r.context=i:r.pendingContext=i,r=Ia(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=La(e,r,t),n!==null&&(gu(n,e,t),Ra(n,e,t))}function sp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function cp(e,t){sp(e,t),(e=e.alternate)&&sp(e,t)}function lp(e){if(e.tag===13||e.tag===31){var t=Xr(e,67108864);t!==null&&gu(t,e,67108864),cp(e,67108864)}}function up(e){if(e.tag===13||e.tag===31){var t=mu();t=Je(t);var n=Xr(e,t);n!==null&&gu(n,e,t),cp(e,t)}}var dp=!0;function fp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,mp(e,t,n,r)}finally{L.p=a,I.T=i}}function pp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,mp(e,t,n,r)}finally{L.p=a,I.T=i}}function mp(e,t,n,r){if(dp){var i=hp(r);if(i===null)Dd(e,t,r,gp,n),Dp(e,r);else if(kp(i,e,t,n,r))r.stopPropagation();else if(Dp(e,r),t&4&&-1<Ep.indexOf(e)){for(;i!==null;){var a=lt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=ze(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Me(o);s.entanglements[1]|=c,o&=~c}ad(a),!(Fl&6)&&(nu=be()+500,od(0,!1))}}break;case 31:case 13:s=Xr(a,2),s!==null&&gu(s,a,2),xu(),cp(a,2)}if(a=hp(r),a===null&&Dd(e,t,r,gp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Dd(e,t,r,null,n)}}function hp(e){return e=Jt(e),_p(e)}var gp=null;function _p(e){if(gp=null,e=ct(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return gp=e,null}function vp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(xe()){case Se:return 2;case Ce:return 8;case we:case Te:return 32;case Ee:return 268435456;default:return 32}default:return 32}}var yp=!1,bp=null,xp=null,Sp=null,Cp=new Map,wp=new Map,Tp=[],Ep=`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 Dp(e,t){switch(e){case`focusin`:case`focusout`:bp=null;break;case`dragenter`:case`dragleave`:xp=null;break;case`mouseover`:case`mouseout`:Sp=null;break;case`pointerover`:case`pointerout`:Cp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:wp.delete(t.pointerId)}}function Op(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=lt(t),t!==null&&lp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function kp(e,t,n,r,i){switch(t){case`focusin`:return bp=Op(bp,e,t,n,r,i),!0;case`dragenter`:return xp=Op(xp,e,t,n,r,i),!0;case`mouseover`:return Sp=Op(Sp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Cp.set(a,Op(Cp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,wp.set(a,Op(wp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ap(e){var t=ct(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Ze(e.priority,function(){up(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Ze(e.priority,function(){up(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function jp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);qt=r,n.target.dispatchEvent(r),qt=null}else return t=lt(n),t!==null&&lp(t),e.blockedOn=n,!1;t.shift()}return!0}function Mp(e,t,n){jp(e)&&n.delete(t)}function Np(){yp=!1,bp!==null&&jp(bp)&&(bp=null),xp!==null&&jp(xp)&&(xp=null),Sp!==null&&jp(Sp)&&(Sp=null),Cp.forEach(Mp),wp.forEach(Mp)}function Pp(e,n){e.blockedOn===n&&(e.blockedOn=null,yp||(yp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Np)))}var Fp=null;function Ip(e){Fp!==e&&(Fp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Fp===e&&(Fp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(_p(r||n)===null)continue;break}var a=lt(n);a!==null&&(e.splice(t,3),t-=3,bs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Lp(e){function t(t){return Pp(t,e)}bp!==null&&Pp(bp,e),xp!==null&&Pp(xp,e),Sp!==null&&Pp(Sp,e),Cp.forEach(t),wp.forEach(t);for(var n=0;n<Tp.length;n++){var r=Tp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Tp.length&&(n=Tp[0],n.blockedOn===null);)Ap(n),n.blockedOn===null&&Tp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[et]||null;if(typeof a==`function`)o||Ip(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[et]||null)s=o.formAction;else if(_p(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Ip(n)}}}function Rp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function zp(e){this._internalRoot=e}Bp.prototype.render=zp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;op(n,mu(),e,t,null,null)},Bp.prototype.unmount=zp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;op(e.current,2,null,e,null,null),xu(),t[tt]=null}};function Bp(e){this._internalRoot=e}Bp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Xe();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Tp.length&&t!==0&&t<Tp[n].priority;n++);Tp.splice(n,0,e),n===0&&Ap(e)}};var Vp=n.version;if(Vp!==`19.2.7`)throw Error(i(527,Vp,`19.2.7`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Hp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Up=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Up.isDisabled&&Up.supportsFiber)try{ke=Up.inject(Hp),Ae=Up}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Us,s=Ws,c=Gs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ip(e,1,!1,null,null,n,r,null,o,s,c,Rp),e[tt]=t.current,Td(e),new zp(t)}})),_=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},y=new class extends v{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},b={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},x=new class{#e=b;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function S(e){setTimeout(e,0)}var C=typeof window>`u`||`Deno`in globalThis;function w(){}function T(e,t){return typeof e==`function`?e(t):e}function E(e){return typeof e==`number`&&e>=0&&e!==1/0}function D(e,t){return Math.max(e+(t||0)-Date.now(),0)}function O(e,t){return typeof e==`function`?e(t):e}function k(e,t){return typeof e==`function`?e(t):e}function A(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==M(o,t.options))return!1}else if(!P(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function j(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(N(t.options.mutationKey)!==N(a))return!1}else if(!P(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function M(e,t){return(t?.queryKeyHashFn||N)(e)}function N(e){return JSON.stringify(e,(e,t)=>ee(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function P(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>P(e[n],t[n])):!1}var F=Object.prototype.hasOwnProperty;function I(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=R(e)&&R(t);if(!r&&!(ee(e)&&ee(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:F.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=I(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function L(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function R(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ee(e){if(!z(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!z(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function z(e){return Object.prototype.toString.call(e)===`[object Object]`}function B(e){return new Promise(t=>{x.setTimeout(t,e)})}function V(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:I(e,t)}function H(e){return e}function te(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ne(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var U=Symbol();function re(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===U?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ie(e,t){return typeof e==`function`?e(...t):!!e}function ae(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var oe=(()=>{let e=()=>C;return{isServer(){return e()},setIsServer(t){e=t}}})();function se(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var ce=S;function le(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ce,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var ue=le(),de=new class extends v{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function fe(e){return Math.min(1e3*2**e,3e4)}function pe(e){return(e??`online`)===`online`?de.isOnline():!0}var me=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function he(e){let t=!1,n=0,r,i=se(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new me(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>y.isFocused()&&(e.networkMode===`always`||de.isOnline())&&e.canRun(),u=()=>pe(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(oe.isServer()?0:3),o=e.retryDelay??fe,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),B(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var ge=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),E(this.gcTime)&&(this.#e=x.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(oe.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(x.clearTimeout(this.#e),this.#e=void 0)}};function _e(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ae(e,()=>t.signal,()=>n=!0)},u=re(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ne:te;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?ye:ve,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:ve(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function ve(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function ye(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var be=class extends ge{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ce(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ce(this.options);e.data!==void 0&&(this.setState(Se(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=V(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(w).catch(w):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>k(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===U||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>O(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!D(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=re(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?_e(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=he({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof me&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof me){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...xe(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Se(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ue.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function xe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:pe(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Se(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ce(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var we=class extends v{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=se(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ee(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return De(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return De(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof k(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!L(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Oe(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||O(this.options.staleTime,this.#t)!==O(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Ae(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(w)),t}#g(){this.#b();let e=O(this.options.staleTime,this.#t);if(oe.isServer()||this.#r.isStale||!E(e))return;let t=D(this.#r.dataUpdatedAt,e)+1;this.#d=x.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(oe.isServer()||k(this.options.enabled,this.#t)===!1||!E(this.#p)||this.#p===0)&&(this.#f=x.setInterval(()=>{(this.options.refetchIntervalInBackground||y.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(x.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(x.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ee(e,t),o=i&&Oe(e,n,t,r);(a||o)&&(l={...l,...xe(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=V(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=V(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:ke(e,t),refetch:this.refetch,promise:this.#o,isEnabled:k(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=se())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!L(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){ue.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Te(e,t){return k(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&k(t.retryOnMount,e)===!1)}function Ee(e,t){return Te(e,t)||e.state.data!==void 0&&De(e,t,t.refetchOnMount)}function De(e,t,n){if(k(t.enabled,e)!==!1&&O(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ke(e,t)}return!1}function Oe(e,t,n,r){return(e!==t||k(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ke(e,n)}function ke(e,t){return k(t.enabled,e)!==!1&&e.isStaleByTime(O(t.staleTime,e))}function Ae(e,t){return!L(e.getCurrentResult(),t)}var je=class extends ge{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Me(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=he({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),ue.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Me(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ne=class extends v{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new je({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Pe(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Pe(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Pe(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Pe(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ue.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>j(t,e))}findAll(e={}){return this.getAll().filter(t=>j(e,t))}notify(e){ue.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ue.batch(()=>Promise.all(e.map(e=>e.continue().catch(w))))}};function Pe(e){return e.options.scope?.id}var Fe=class extends v{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),L(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&N(t.mutationKey)!==N(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Me();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){ue.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Ie(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Le(e,t,n){let r=e.slice(0);return r[t]=n,r}var Re=class extends v{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,ue.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!L(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ie(e,n).forEach(e=>{e.destroy()}),Ie(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=I(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new we(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Le(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&ue.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},ze=class extends v{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??M(r,t),a=this.get(i);return a||(a=new be({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ue.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>A(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>A(e,t)):t}notify(e){ue.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ue.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ue.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Be=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ze,this.#t=e.mutationCache||new Ne,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=y.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=de.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(O(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=T(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ue.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ue.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ue.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=ue.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(w).catch(w)}invalidateQueries(e,t={}){return ue.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ue.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(w)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(w)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(O(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(w).catch(w)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(w).catch(w)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return de.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(N(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{P(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(N(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{P(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=M(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===U&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ve=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),He=o(((e,t)=>{t.exports=Ve()})),W=l(d(),1),G=He(),Ue=W.createContext(void 0),We=e=>{let t=W.useContext(Ue);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ge=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,G.jsx)(Ue.Provider,{value:e,children:t})),Ke=W.createContext(!1),qe=()=>W.useContext(Ke);Ke.Provider;function Je(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ye=W.createContext(Je()),Xe=()=>W.useContext(Ye),Ze=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ie(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Qe=e=>{W.useEffect(()=>{e.clearReset()},[e])},$e=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ie(n,[e.error,r])),et=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},tt=(e,t)=>e.isLoading&&e.isFetching&&!t,nt=(e,t)=>e?.suspense&&t.isPending,rt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function it({queries:e,...t},n){let r=We(n),i=qe(),a=Xe(),o=W.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{et(e),Ze(e,a,r.getQueryCache().get(e.queryHash))}),Qe(a);let[s]=W.useState(()=>new Re(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;W.useSyncExternalStore(W.useCallback(e=>d?s.subscribe(ue.batchCalls(e)):w,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),W.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>nt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&nt(n,e)?rt(n,new we(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&$e({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function at(e,t,n){let r=qe(),i=Xe(),a=We(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,et(o),Ze(o,i,s),Qe(i);let l=!a.getQueryCache().get(o.queryHash),[u]=W.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(W.useSyncExternalStore(W.useCallback(e=>{let t=f?u.subscribe(ue.batchCalls(e)):w;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),W.useEffect(()=>{u.setOptions(o)},[o,u]),nt(o,d))throw rt(o,u,i);if($e({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!oe.isServer()&&tt(d,r)&&(l?rt(o,u,i):s?.promise)?.catch(w).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function ot(e,t){return at(e,we,t)}function st(e,t){let n=We(t),[r]=W.useState(()=>new Fe(n,e));W.useEffect(()=>{r.setOptions(e)},[r,e]);let i=W.useSyncExternalStore(W.useCallback(e=>r.subscribe(ue.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=W.useCallback((e,t)=>{r.mutate(e,t).catch(w)},[r]);if(i.error&&ie(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var ct=`modulepreload`,lt=function(e){return`/`+e},ut={},dt=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=lt(t,n),t in ut)return;ut[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:ct,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},ft=`popstate`;function pt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function mt(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return yt(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:bt(t)}return St(t,n,null,e)}function ht(e,t){if(e===!1||e==null)throw Error(t)}function gt(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function _t(){return Math.random().toString(36).substring(2,10)}function vt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function yt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?xt(t):t,state:n,key:t&&t.key||r||_t(),mask:i}}function bt({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function xt(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function St(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=pt(e)?e:yt(h.location,e,t);n&&n(r,e),l=u()+1;let d=vt(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=pt(e)?e:yt(h.location,e,t);n&&n(r,e),l=u();let i=vt(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Ct(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(ft,d),c=e,()=>{i.removeEventListener(ft,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Ct(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),ht(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:bt(t);return i=i.replace(/ $/,`%20`),!n&&i.startsWith(`//`)&&(i=r+i),new URL(i,r)}function wt(e,t,n=`/`){return Tt(e,t,n,!1)}function Tt(e,t,n,r,i){let a=Wt((typeof t==`string`?xt(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Dt(e),s=null,c=Ut(a);for(let e=0;s==null&&e<o.length;++e)s=Bt(o[e],c,r);return s}function Et(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Dt(e){let t=Ot(e);return At(t),t}function Ot(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;ht(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=$t([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(ht(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Ot(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Rt(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of kt(e.path))a(e,t,!0,n)}),t}function kt(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=kt(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function At(e){e.sort((e,t)=>e.score===t.score?zt(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var jt=/^:[\w-]+$/,Mt=3,Nt=2,Pt=1,Ft=10,It=-2,Lt=e=>e===`*`;function Rt(e,t){let n=e.split(`/`),r=n.length;return n.some(Lt)&&(r+=It),t&&(r+=Nt),n.filter(e=>!Lt(e)).reduce((e,t)=>e+(jt.test(t)?Mt:t===``?Pt:Ft),r)}function zt(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Bt(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=Vt({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Vt({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:$t([a,u.pathname]),pathnameBase:tn($t([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=$t([a,u.pathnameBase]))}return o}function Vt(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Ht(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Ht(e,t=!1,n=!0){gt(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Ut(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return gt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Wt(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var Gt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Kt(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?xt(e):e,a;return n?(n=Qt(n),a=n.startsWith(`/`)?qt(n.substring(1),`/`):qt(n,t)):a=t,{pathname:a,search:nn(r),hash:rn(i)}}function qt(e,t){let n=en(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Jt(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Yt(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Xt(e){let t=Yt(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Zt(e,t,n,r=!1){let i;typeof e==`string`?i=xt(e):(i={...e},ht(!i.pathname||!i.pathname.includes(`?`),Jt(`?`,`pathname`,`search`,i)),ht(!i.pathname||!i.pathname.includes(`#`),Jt(`#`,`pathname`,`hash`,i)),ht(!i.search||!i.search.includes(`#`),Jt(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Kt(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Qt=e=>e.replace(/\/\/+/g,`/`),$t=e=>Qt(e.join(`/`)),en=e=>e.replace(/\/+$/,``),tn=e=>en(e).replace(/^\/*/,`/`),nn=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,rn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,an=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function on(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function sn(e){return $t(e.map(e=>e.route.path).filter(Boolean))||`/`}var cn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function ln(e,t){let n=e;if(typeof n!=`string`||!Gt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(cn)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=Wt(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{gt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var un=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(un);var dn=[`GET`,...un];new Set(dn);var fn=W.createContext(null);fn.displayName=`DataRouter`;var pn=W.createContext(null);pn.displayName=`DataRouterState`;var mn=W.createContext(!1);function hn(){return W.useContext(mn)}var gn=W.createContext({isTransitioning:!1});gn.displayName=`ViewTransition`;var _n=W.createContext(new Map);_n.displayName=`Fetchers`;var vn=W.createContext(null);vn.displayName=`Await`;var yn=W.createContext(null);yn.displayName=`Navigation`;var bn=W.createContext(null);bn.displayName=`Location`;var xn=W.createContext({outlet:null,matches:[],isDataRoute:!1});xn.displayName=`Route`;var Sn=W.createContext(null);Sn.displayName=`RouteError`;var Cn=`REACT_ROUTER_ERROR`,wn=`REDIRECT`,Tn=`ROUTE_ERROR_RESPONSE`;function En(e){if(e.startsWith(`${Cn}:${wn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Dn(e){if(e.startsWith(`${Cn}:${Tn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new an(t.status,t.statusText,t.data)}catch{}}function On(e,{relative:t}={}){ht(kn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=W.useContext(yn),{hash:i,pathname:a,search:o}=Rn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:$t([n,a])),r.createHref({pathname:s,search:o,hash:i})}function kn(){return W.useContext(bn)!=null}function An(){return ht(kn(),`useLocation() may be used only in the context of a <Router> component.`),W.useContext(bn).location}var jn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Mn(e){W.useContext(yn).static||W.useLayoutEffect(e)}function Nn(){let{isDataRoute:e}=W.useContext(xn);return e?rr():Pn()}function Pn(){ht(kn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=W.useContext(fn),{basename:t,navigator:n}=W.useContext(yn),{matches:r}=W.useContext(xn),{pathname:i}=An(),a=JSON.stringify(Xt(r)),o=W.useRef(!1);return Mn(()=>{o.current=!0}),W.useCallback((r,s={})=>{if(gt(o.current,jn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Zt(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:$t([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Fn=W.createContext(null);function In(e){let t=W.useContext(xn).outlet;return W.useMemo(()=>t&&W.createElement(Fn.Provider,{value:e},t),[t,e])}function Ln(){let{matches:e}=W.useContext(xn);return e[e.length-1]?.params??{}}function Rn(e,{relative:t}={}){let{matches:n}=W.useContext(xn),{pathname:r}=An(),i=JSON.stringify(Xt(n));return W.useMemo(()=>Zt(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function zn(e,t){return Bn(e,t)}function Bn(e,t,n){ht(kn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=W.useContext(yn),{matches:i}=W.useContext(xn),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;ar(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
10
|
-
|
|
11
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=An(),d;if(t){let e=typeof t==`string`?xt(t):t;ht(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):wt(e,{pathname:p});gt(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),gt(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=qn(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:$t([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:$t([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?W.createElement(bn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Vn(){let e=nr(),t=on(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=W.createElement(W.Fragment,null,W.createElement(`p`,null,`💿 Hey developer 👋`),W.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,W.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,W.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),W.createElement(W.Fragment,null,W.createElement(`h2`,null,`Unexpected Application Error!`),W.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?W.createElement(`pre`,{style:i},n):null,o)}var Hn=W.createElement(Vn,null),Un=class extends W.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Dn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:W.createElement(xn.Provider,{value:this.props.routeContext},W.createElement(Sn.Provider,{value:e,children:this.props.component}));return this.context?W.createElement(Gn,{error:e},t):t}};Un.contextType=mn;var Wn=new WeakMap;function Gn({children:e,error:t}){let{basename:n}=W.useContext(yn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=En(t.digest);if(e){let r=Wn.get(t);if(r)throw r;let i=ln(e.location,n);if(cn&&!Wn.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw Wn.set(t,n),n}return W.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function Kn({routeContext:e,match:t,children:n}){let r=W.useContext(fn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),W.createElement(xn.Provider,{value:e},n)}function qn(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);ht(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:sn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Hn,o&&(s<0&&c===0?(ar(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?W.createElement(n.route.Component,null):n.route.element?n.route.element:e,W.createElement(Kn,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?W.createElement(Un,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Jn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Yn(e){let t=W.useContext(fn);return ht(t,Jn(e)),t}function Xn(e){let t=W.useContext(pn);return ht(t,Jn(e)),t}function Zn(e){let t=W.useContext(xn);return ht(t,Jn(e)),t}function Qn(e){let t=Zn(e),n=t.matches[t.matches.length-1];return ht(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function $n(){return Qn(`useRouteId`)}function er(){let e=Xn(`useNavigation`);return W.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function tr(){let{matches:e,loaderData:t}=Xn(`useMatches`);return W.useMemo(()=>e.map(e=>Et(e,t)),[e,t])}function nr(){let e=W.useContext(Sn),t=Xn(`useRouteError`),n=Qn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function rr(){let{router:e}=Yn(`useNavigate`),t=Qn(`useNavigate`),n=W.useRef(!1);return Mn(()=>{n.current=!0}),W.useCallback(async(r,i={})=>{gt(n.current,jn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var ir={};function ar(e,t,n){!t&&!ir[e]&&(ir[e]=!0,gt(!1,n))}W.memo(or);function or({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Bn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function sr({to:e,replace:t,state:n,relative:r}){ht(kn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=W.useContext(yn);gt(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=W.useContext(xn),{pathname:o}=An(),s=Nn(),c=Zt(e,Xt(a),o,r===`path`),l=JSON.stringify(c);return W.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function cr(e){return In(e.context)}function lr(e){ht(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function ur({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){ht(!kn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=W.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=xt(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=W.useMemo(()=>{let e=Wt(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return gt(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:W.createElement(yn.Provider,{value:c},W.createElement(bn.Provider,{children:t,value:h}))}function dr({children:e,location:t}){return zn(fr(e),t)}W.Component;function fr(e,t=[]){let n=[];return W.Children.forEach(e,(e,r)=>{if(!W.isValidElement(e))return;let i=[...t,r];if(e.type===W.Fragment){n.push.apply(n,fr(e.props.children,i));return}ht(e.type===lr,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ht(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=fr(e.props.children,i)),n.push(a)}),n}var pr=`get`,mr=`application/x-www-form-urlencoded`;function hr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function gr(e){return hr(e)&&e.tagName.toLowerCase()===`button`}function _r(e){return hr(e)&&e.tagName.toLowerCase()===`form`}function vr(e){return hr(e)&&e.tagName.toLowerCase()===`input`}function yr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function br(e,t){return e.button===0&&(!t||t===`_self`)&&!yr(e)}function xr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Sr(e,t){let n=xr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Cr=null;function wr(){if(Cr===null)try{new FormData(document.createElement(`form`),0),Cr=!1}catch{Cr=!0}return Cr}var Tr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Er(e){return e!=null&&!Tr.has(e)?(gt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${mr}"`),null):e}function Dr(e,t){let n,r,i,a,o;if(_r(e)){let o=e.getAttribute(`action`);r=o?Wt(o,t):null,n=e.getAttribute(`method`)||pr,i=Er(e.getAttribute(`enctype`))||mr,a=new FormData(e)}else if(gr(e)||vr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?Wt(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||pr,i=Er(e.getAttribute(`formenctype`))||Er(o.getAttribute(`enctype`))||mr,a=new FormData(o,e),!wr()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(hr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=pr,r=null,i=mr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Or={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},kr=/[&><\u2028\u2029]/g;function Ar(e){return e.replace(kr,e=>Or[e])}function jr(e,t){if(e===!1||e==null)throw Error(t)}function Mr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&Wt(i.pathname,t)===`/`?i.pathname=`${en(t)}/_root.${r}`:i.pathname=`${en(i.pathname)}.${r}`,i}async function Nr(e,t){if(e.id in t)return t[e.id];try{let n=await dt(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Pr(e){return e!=null&&typeof e.page==`string`}function Fr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Ir(e,t,n){return Vr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Nr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Fr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Lr(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Rr(e,t,{includeHydrateFallback:n}={}){return zr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function zr(e){return[...new Set(e)]}function Br(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Vr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Pr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Br(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Hr(){let e=W.useContext(fn);return jr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Ur(){let e=W.useContext(pn);return jr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Wr=W.createContext(void 0);Wr.displayName=`FrameworkContext`;function Gr(){let e=W.useContext(Wr);return jr(e,`You must render this element inside a <HydratedRouter> element`),e}function Kr(e,t){let n=W.useContext(Wr),[r,i]=W.useState(!1),[a,o]=W.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=W.useRef(null);W.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),W.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:qr(s,p),onBlur:qr(c,m),onMouseEnter:qr(l,p),onMouseLeave:qr(u,m),onTouchStart:qr(d,p)}]:[a,f,{}]:[!1,f,{}]}function qr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Jr({page:e,...t}){let n=hn(),{router:r}=Hr(),i=W.useMemo(()=>wt(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?W.createElement(Xr,{page:e,matches:i,...t}):W.createElement(Zr,{page:e,matches:i,...t}):null}function Yr(e){let{manifest:t,routeModules:n}=Gr(),[r,i]=W.useState([]);return W.useEffect(()=>{let r=!1;return Ir(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Xr({page:e,matches:t,...n}){let r=An(),{future:i}=Gr(),{basename:a}=Hr(),o=W.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Mr(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return W.createElement(W.Fragment,null,o.map(e=>W.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Zr({page:e,matches:t,...n}){let r=An(),{future:i,manifest:a,routeModules:o}=Gr(),{basename:s}=Hr(),{loaderData:c,matches:l}=Ur(),u=W.useMemo(()=>Lr(e,t,l,a,r,`data`),[e,t,l,a,r]),d=W.useMemo(()=>Lr(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=W.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Mr(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=W.useMemo(()=>Rr(d,a),[d,a]),m=Yr(d);return W.createElement(W.Fragment,null,f.map(e=>W.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>W.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>W.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Qr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}W.Component;var $r=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{$r&&(window.__reactRouterVersion=`7.16.0`)}catch{}function ei({basename:e,children:t,useTransitions:n,window:r}){let i=W.useRef();i.current??=mt({window:r,v5Compat:!0});let a=i.current,[o,s]=W.useState({action:a.action,location:a.location}),c=W.useCallback(e=>{n===!1?s(e):W.startTransition(()=>s(e))},[n]);return W.useLayoutEffect(()=>a.listen(c),[a,c]),W.createElement(ur,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function ti({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=W.useState({action:n.action,location:n.location}),o=W.useCallback(e=>{r===!1?a(e):W.startTransition(()=>a(e))},[r]);return W.useLayoutEffect(()=>n.listen(o),[n,o]),W.createElement(ur,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}ti.displayName=`unstable_HistoryRouter`;var ni=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ri=W.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=W.useContext(yn),v=typeof l==`string`&&ni.test(l),y=ln(l,h);l=y.to;let b=On(l,{relative:r}),x=An(),S=null;if(o){let e=Zt(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:$t([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=Kr(n,p),E=ui(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=W.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:Qr(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?W.createElement(W.Fragment,null,k,W.createElement(Jr,{page:b})):k});ri.displayName=`Link`;var ii=W.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Rn(a,{relative:c.relative}),d=An(),f=W.useContext(pn),{navigator:p,basename:m}=W.useContext(yn),h=f!=null&&xi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=Wt(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return W.createElement(ri,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});ii.displayName=`NavLink`;var ai=W.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=pr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=W.useContext(yn),g=mi(),_=hi(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&ni.test(s);return W.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?W.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});ai.displayName=`Form`;function oi({getKey:e,storageKey:t,...n}){let r=W.useContext(Wr),{basename:i}=W.useContext(yn),a=An(),o=tr();yi({getKey:e,storageKey:t});let s=W.useMemo(()=>{if(!r||!e)return null;let t=vi(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return W.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Ar(JSON.stringify(t||gi))}, ${Ar(JSON.stringify(s))})`}})}oi.displayName=`ScrollRestoration`;function si(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ci(e){let t=W.useContext(fn);return ht(t,si(e)),t}function li(e){let t=W.useContext(pn);return ht(t,si(e)),t}function ui(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Nn(),d=An(),f=Rn(e,{relative:o});return W.useCallback(p=>{if(br(p,t)){p.preventDefault();let t=n===void 0?bt(d)===bt(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?W.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function di(e){gt(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=W.useRef(xr(e)),n=W.useRef(!1),r=An(),i=W.useMemo(()=>Sr(r.search,n.current?null:t.current),[r.search]),a=Nn();return[i,W.useCallback((e,t)=>{let r=xr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var fi=0,pi=()=>`__${String(++fi)}__`;function mi(){let{router:e}=ci(`useSubmit`),{basename:t}=W.useContext(yn),n=$n(),r=e.fetch,i=e.navigate;return W.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Dr(e,t);a.navigate===!1?await r(a.fetcherKey||pi(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function hi(e,{relative:t}={}){let{basename:n}=W.useContext(yn),r=W.useContext(xn);ht(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Rn(e||`.`,{relative:t})},o=An();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:$t([n,a.pathname])),bt(a)}var gi=`react-router-scroll-positions`,_i={};function vi(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:Wt(e.pathname,n)||e.pathname},t)),i??=e.key,i}function yi({getKey:e,storageKey:t}={}){let{router:n}=ci(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=li(`useScrollRestoration`),{basename:a}=W.useContext(yn),o=An(),s=tr(),c=er();W.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),bi(W.useCallback(()=>{if(c.state===`idle`){let t=vi(o,s,a,e);_i[t]=window.scrollY}try{sessionStorage.setItem(t||gi,JSON.stringify(_i))}catch(e){gt(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(W.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||gi);e&&(_i=JSON.parse(e))}catch{}},[t]),W.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(_i,()=>window.scrollY,e?(t,n)=>vi(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),W.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{gt(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function bi(e,t){let{capture:n}=t||{};W.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function xi(e,{relative:t}={}){let n=W.useContext(gn);ht(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ci(`useViewTransitionState`),i=Rn(e,{relative:t});if(!n.isTransitioning)return!1;let a=Wt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Wt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Vt(i.pathname,o)!=null||Vt(i.pathname,a)!=null}var Si=l(_(),1),Ci=6e4,wi=3e5,Ti=200,Ei={active:1,idle:2,deep_sleep:5,hidden:10},Di=[`mousemove`,`mousedown`,`keydown`,`scroll`,`touchstart`],Oi=(0,W.createContext)(void 0);function ki({children:e}){let[t,n]=(0,W.useState)(`active`),r=(0,W.useRef)(null),i=(0,W.useRef)(null),a=(0,W.useRef)(Date.now()),o=(0,W.useCallback)(()=>{r.current&&=(clearTimeout(r.current),null),i.current&&=(clearTimeout(i.current),null)},[]),s=(0,W.useCallback)(()=>{o(),r.current=setTimeout(()=>{n(`idle`),i.current=setTimeout(()=>{n(`deep_sleep`)},wi-Ci)},Ci)},[o]),c=(0,W.useCallback)(()=>{let e=Date.now();e-a.current<Ti||(a.current=e,n(`active`),s())},[s]),l=(0,W.useCallback)(()=>{document.hidden?(o(),n(`hidden`)):(n(`active`),a.current=Date.now(),s())},[o,s]);return(0,W.useEffect)(()=>{s();for(let e of Di)document.addEventListener(e,c,{passive:!0});return document.addEventListener(`visibilitychange`,l),()=>{o();for(let e of Di)document.removeEventListener(e,c);document.removeEventListener(`visibilitychange`,l)}},[c,l,s,o]),(0,G.jsx)(Oi.Provider,{value:{powerState:t},children:e})}function Ai(){let e=(0,W.useContext)(Oi);if(!e)throw Error(`usePowerState must be used within a PowerProvider`);return e.powerState}var ji={enabled:`cortex.enabled`,instructions:{injectOnSessionStart:`cortex.instructions.inject_on_session_start`,injectOnSubagentStart:`cortex.instructions.inject_on_subagent_start`},digest:{tier:`cortex.digest.tier`,injectOnSessionStart:`cortex.digest.inject_on_session_start`},spores:{injectOnPromptSubmit:`cortex.spores.inject_on_prompt_submit`,maxPerPrompt:`cortex.spores.max_per_prompt`},canopy:{injectOnPreToolUse:`cortex.canopy.inject_on_pre_tool_use`,minFileBytes:`cortex.canopy.min_file_bytes`,refresh:{backgroundEnabled:`cortex.canopy.refresh.background_enabled`,backgroundPeriodMinutes:`cortex.canopy.refresh.background_period_minutes`},exclude:{defaultPatterns:`cortex.canopy.exclude.default_patterns`,patterns:`cortex.canopy.exclude.patterns`}}},Mi={scheduledTasksEnabled:`agent.scheduled_tasks_enabled`,eventTasksEnabled:`agent.event_tasks_enabled`,summaryBatchInterval:`agent.summary_batch_interval`},Ni=`config-field-`,Pi={appearance:`config-section-appearance`,cortexInstructions:`config-section-cortex-instructions`,cortexBuilder:`config-section-cortex-builder`,cortexDigest:`config-section-cortex-digest`,settingsAgent:`config-section-settings-agent`,settingsEmbedding:`config-section-settings-embedding`,settingsNotifications:`config-section-settings-notifications`,settingsPlanCapture:`config-section-settings-plan-capture`,settingsProject:`config-section-settings-project`,agentOperations:`config-section-agent-operations`,operationsMaintenance:`config-section-operations-maintenance`,operationsBackup:`config-section-operations-backup`};Pi.appearance,Pi.settingsAgent,Pi.settingsEmbedding,Pi.cortexDigest,Pi.cortexInstructions,Pi.cortexInstructions,Pi.cortexInstructions,Pi.cortexInstructions,Pi.settingsNotifications,Pi.settingsPlanCapture,Pi.agentOperations,ji.digest.tier,ji.digest.injectOnSessionStart,ji.instructions.injectOnSessionStart,ji.instructions.injectOnSubagentStart,ji.spores.injectOnPromptSubmit,ji.spores.maxPerPrompt,ji.canopy.injectOnPreToolUse,ji.canopy.minFileBytes,Mi.scheduledTasksEnabled,Mi.eventTasksEnabled,Mi.summaryBatchInterval;function Fi(e){return`${Ni}${e.replace(/[^a-zA-Z0-9]+/g,`-`)}`}var Ii=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Li=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Ri=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),zi=e=>{let t=Ri(e);return t.charAt(0).toUpperCase()+t.slice(1)},Bi={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`},Vi=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Hi=(0,W.createContext)({}),Ui=()=>(0,W.useContext)(Hi),Wi=(0,W.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Ui()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,W.createElement)(`svg`,{ref:c,...Bi,width:t??l??Bi.width,height:t??l??Bi.height,stroke:e??f,strokeWidth:m,className:Ii(`lucide`,p,i),...!a&&!Vi(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,W.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),K=(e,t)=>{let n=(0,W.forwardRef)(({className:n,...r},i)=>(0,W.createElement)(Wi,{ref:i,iconNode:t,className:Ii(`lucide-${Li(zi(e))}`,`lucide-${e}`,n),...r}));return n.displayName=zi(e),n},Gi=K(`activity`,[[`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`}]]),Ki=K(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),qi=K(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Ji=K(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Yi=K(`book-open`,[[`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`}]]),Xi=K(`bot`,[[`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`}]]),Zi=K(`brain`,[[`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`}]]),Qi=K(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),$i=K(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ea=K(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ta=K(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),na=K(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ra=K(`circle-alert`,[[`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`}]]),ia=K(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),aa=K(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),oa=K(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),sa=K(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ca=K(`circle-x`,[[`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`}]]),la=K(`clipboard-list`,[[`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`}]]),ua=K(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),da=K(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),fa=K(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),pa=K(`copy`,[[`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`}]]),ma=K(`cpu`,[[`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`}]]),ha=K(`database`,[[`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`}]]),ga=K(`download`,[[`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`}]]),_a=K(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),va=K(`external-link`,[[`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`}]]),ya=K(`eye-off`,[[`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`}]]),ba=K(`eye`,[[`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`}]]),xa=K(`file-code`,[[`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`}]]),Sa=K(`file-search`,[[`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`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]),Ca=K(`file-text`,[[`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`}]]),wa=K(`file-x`,[[`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:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),Ta=K(`file`,[[`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`}]]),Ea=K(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),Da=K(`folder-open`,[[`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`}]]),Oa=K(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),ka=K(`git-branch`,[[`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`}]]),Aa=K(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),ja=K(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),Ma=K(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Na=K(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),Pa=K(`layers`,[[`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`}]]),Fa=K(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Ia=K(`layout-grid`,[[`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`}]]),La=K(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),Ra=K(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),za=K(`mail-check`,[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`m16 19 2 2 4-4`,key:`1b14m6`}]]),Ba=K(`map`,[[`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`}]]),Va=K(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Ha=K(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Ua=K(`monitor`,[[`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`}]]),Wa=K(`moon`,[[`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`}]]),Ga=K(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Ka=K(`panels-top-left`,[[`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`}]]),qa=K(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Ja=K(`play`,[[`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`}]]),Ya=K(`plug`,[[`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`}]]),Xa=K(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Za=K(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),Qa=K(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),$a=K(`rotate-ccw`,[[`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`}]]),eo=K(`save`,[[`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`}]]),to=K(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),no=K(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ro=K(`server`,[[`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`}]]),io=K(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),ao=K(`settings`,[[`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`}]]),oo=K(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),so=K(`shield`,[[`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`}]]),co=K(`sparkles`,[[`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`}]]),lo=K(`sprout`,[[`path`,{d:`M14 9.536V7a4 4 0 0 1 4-4h1.5a.5.5 0 0 1 .5.5V5a4 4 0 0 1-4 4 4 4 0 0 0-4 4c0 2 1 3 1 5a5 5 0 0 1-1 3`,key:`139s4v`}],[`path`,{d:`M4 9a5 5 0 0 1 8 4 5 5 0 0 1-8-4`,key:`1dlkgp`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),uo=K(`star`,[[`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`}]]),fo=K(`sun`,[[`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`}]]),po=K(`target`,[[`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`}]]),mo=K(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),ho=K(`trash-2`,[[`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`}]]),go=K(`trees`,[[`path`,{d:`M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z`,key:`1l6gj6`}],[`path`,{d:`M7 16v6`,key:`1a82de`}],[`path`,{d:`M13 19v3`,key:`13sx9i`}],[`path`,{d:`M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5`,key:`1sj9kv`}]]),_o=K(`triangle-alert`,[[`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`}]]),vo=K(`upload`,[[`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`}]]),yo=K(`users`,[[`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`}]]),bo=K(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),xo=K(`wrench`,[[`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`}]]),So=K(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Co=K(`zap`,[[`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`}]]),wo=`myco.lastSelectedProject`,To=null;function Eo(e){To=e}function Do(){return To}function Oo(){return ko(Do())}function ko(e){return e?{"x-myco-grove-id":e.grove.id,"x-myco-project-id":e.project.project_id}:{}}function Ao(e,t,n){if(!t||!n)return null;let r=e.find(e=>e.slug===t||e.id===t);if(!r)return null;let i=r.projects.find(e=>e.slug===n||e.project_id===n);return i?{grove:r,project:i}:null}function jo(e){let t=e.find(e=>e.is_default&&e.projects.length>0)??e.find(e=>e.projects.length>0);return t?{grove:t,project:t.projects[0]}:null}function Mo(e,t=``){let n=t&&t!==`/`?`/${t.replace(/^\/+/,``)}`:``;return`/g/${e.grove.slug}/p/${e.project.slug}${n}`}function No(e){let t=e.match(/^\/g\/[^/]+\/p\/[^/]+(?<suffix>\/.*)?$/)?.groups?.suffix??`/`;return/^\/sessions\/[^/]+/.test(t)?`/sessions`:t}function Po(e){return e?`${e.grove.id}:${e.project.project_id}`:`none`}function Fo(){try{let e=window.localStorage.getItem(wo);if(!e)return null;let t=JSON.parse(e);return typeof t.groveId!=`string`||typeof t.projectId!=`string`?null:{groveId:t.groveId,projectId:t.projectId}}catch{return null}}function Io(e){try{window.localStorage.setItem(wo,JSON.stringify({groveId:e.grove.id,projectId:e.project.project_id}))}catch{}}function Lo(e){let t=Fo();if(!t)return null;let n=e.find(e=>e.id===t.groveId),r=n?.projects.find(e=>e.project_id===t.projectId);return n&&r?{grove:n,project:r}:null}function Ro(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?`M`:(t.length===1?t[0].slice(0,2):`${t[0][0]}${t[1][0]}`).toUpperCase()}function zo(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return`hsl(${t%360} 58% 48%)`}function Bo(){return``}function Vo(e){return e.startsWith(`/`)?e:`/${e}`}var Ho=`/api`,Uo=[`/groves`,`/version`,`/logs`,`/logs/search`,`/logs/stream`],Wo=`1.0.12`,Go=!1;function Ko(e){if(Go)return;let t=e.headers.get(`X-Myco-Api-Version`);t&&t!==Wo&&(Go=!0,console.warn(`[myco] UI version ${Wo} is talking to daemon ${t} — reload to pick up the new UI build.`))}async function q(e,t){let n=t?.method?.toUpperCase(),r=t?.body!==void 0&&t.body!==null||n===`POST`||n===`PUT`,i=$o(e,t?.headers,r),a=await fetch(Vo(`${Ho}${e}`),{...t,headers:i});if(Ko(a),!a.ok){let e=await qo(a).catch(()=>({}));throw Zo(a.status,e),new ls(a.status,e)}return qo(a)}async function qo(e){if(!(e.status===204||e.status===205||e.headers.get(`Content-Length`)===`0`)){if(typeof e.text==`function`){let t=await e.text();return t.length===0?void 0:JSON.parse(t)}return e.json()}}var Jo=`myco:auth-reload-ts`,Yo=1e4,Xo=()=>{window.location.reload()};function Zo(e,t){if(e===401&&us(t)===`unauthorized_context_switch`&&!(typeof window>`u`||window.sessionStorage===void 0)){try{let e=Number(window.sessionStorage.getItem(Jo)??`0`);if(Number.isFinite(e)&&Date.now()-e<Yo)return;window.sessionStorage.setItem(Jo,String(Date.now()))}catch{return}Xo()}}function Qo(){if(typeof window>`u`)return;let e=window.__MYCO_AUTH__;return typeof e==`string`&&e.length>0?e:void 0}function $o(e,t,n){let r=new Headers;if(!es(e)){for(let[e,t]of Object.entries(Oo()))r.set(e,t);let e=Qo();e&&r.set(`x-myco-auth`,e)}return n&&r.set(`Content-Type`,`application/json`),t&&new Headers(t).forEach((e,t)=>r.set(t,e)),Array.from(r.keys()).length>0?r:void 0}function es(e){return Uo.some(t=>e===t||e.startsWith(`${t}/`))}async function ts(e,t){return q(e,{method:`POST`,body:t?JSON.stringify(t):void 0})}async function ns(e,t,n){return q(e,{...n,method:`PUT`,body:JSON.stringify(t)})}async function rs(e,t){return q(e,{method:`PATCH`,body:JSON.stringify(t)})}async function is(e,t){return q(e,{method:`DELETE`,body:t?JSON.stringify(t):void 0})}function as(e,t){return q(`/config/merged`,{signal:e,headers:t})}function os(e,t){return q(`/config/local`,{signal:e,headers:t})}function ss(e,t,n,r){let i={scope:e,patch:t};return n&&n.length>0&&(i.clear=n),ns(`/config/scoped`,i,{headers:r})}function cs(e,t){return ns(`/config/scoped`,{scope:`local`,patch:{},clear:e},{headers:t})}var ls=class extends Error{status;body;constructor(e,t){let n=ds(t);super(n?`${n} (API ${e})`:`API error ${e}`),this.status=e,this.body=t}};function us(e){if(typeof e!=`object`||!e||!(`error`in e))return null;let t=e.error;if(typeof t==`string`)return t;if(typeof t==`object`&&t&&`code`in t){let e=t.code;return typeof e==`string`?e:null}return null}function ds(e){if(typeof e!=`object`||!e)return null;if(`error`in e){let t=e.error;if(typeof t==`string`)return t;if(typeof t==`object`&&t){let e=`message`in t?t.message:null;if(typeof e==`string`&&e.length>0)return e;let n=`code`in t?t.code:null;if(typeof n==`string`&&n.length>0)return n}}let t=`message`in e?e.message:null;return typeof t==`string`&&t.length>0?t:null}function fs(e={}){let t=e.includeArchived??!1;return ot({queryKey:[`groves`,{includeArchived:t}],queryFn:({signal:e})=>q(t?`/groves?include_archived=true`:`/groves`,{signal:e}),staleTime:5e3,refetchInterval:e.refetchInterval})}var ps=(0,W.createContext)(null);function ms({selection:e,children:t}){let n=We(),r=Po(e),[i,a]=(0,W.useState)(null);return(0,W.useLayoutEffect)(()=>{Eo(e),Io(e),n.removeQueries({predicate:e=>e.queryKey[0]!==`groves`}),a(r)},[r,n]),i===r?(0,G.jsx)(ps.Provider,{value:e,children:t}):(0,G.jsx)(`div`,{className:`flex h-64 items-center justify-center text-sm text-on-surface-variant`,children:`Switching project...`})}function hs({children:e}){return(0,W.useLayoutEffect)(()=>{Eo(null)},[]),(0,G.jsx)(G.Fragment,{children:e})}function gs(){return(0,W.useContext)(ps)}function _s(){let e=(0,W.useContext)(ps),t=fs();if(e)return e;let n=t.data?.groves??[];return Lo(n)??jo(n)}function vs(e=``){let t=gs();return t?Mo(t,e):e||`/`}function ys(){let e=gs();return(0,W.useCallback)((t=``)=>e?Mo(e,t):t||`/`,[e])}function bs(e,t){if(!e)return t;let[n,...r]=t;return[n,{projectSelection:Po(e)},...r]}function xs(e){return bs(gs(),e)}var Ss=6e4,Cs=3e4;function ws(e,t,n){if(t===`heartbeat`){let t=e*Ei[n];return n===`hidden`?Math.min(t,Ss):n===`deep_sleep`?Math.min(t,Cs):t}return n===`deep_sleep`||n===`hidden`?!1:e*Ei[n]}function Ts(e){let t=Ai(),{pollCategory:n,refetchInterval:r,contextFree:i=!1,...a}=e,o=xs(a.queryKey??[]),s=e=>e===!1||e===void 0?e:ws(e,n,t),c=typeof r==`function`?e=>s(r(e)):s(r);return ot({...a,queryKey:i?a.queryKey:o,refetchInterval:c})}var Es={HEALTH:5e3,STATS:1e4,LOGS:3e3,PROGRESS:1e3,UPDATE:3e5,RUNS_ACTIVE:3e3,RUN_DETAIL:5e3,SESSIONS:8e3,SESSION_DETAIL:8e3,SPORES:3e4,CANOPY_ENTRIES:6e4,GIT_IDENTITY:5e3,TEAM:5e3},Ds=1e4,Os=3e4,ks=[`debug`,`info`,`warn`,`error`],As={debug:0,info:1,warn:2,error:3},js=[`stable`,`beta`],Ms=1e3;function Ns(e){switch(e){case`info`:return`default`;case`warn`:return`warning`;case`error`:return`destructive`;default:return`secondary`}}function Ps(e){switch(e){case`info`:return`bg-primary`;case`debug`:return`bg-outline`;case`warn`:return`bg-secondary`;case`error`:return`bg-tertiary`;default:return`bg-outline`}}function Fs(){return Ts({queryKey:[`daemon-stats`],queryFn:({signal:e})=>q(`/stats`,{signal:e}),refetchInterval:Es.STATS,pollCategory:`standard`})}var Is=500,Ls=3e4;function Rs(){let[e,t]=(0,W.useState)(!1),n=(0,W.useRef)(null);return{restart:(0,W.useCallback)(async(e=!1)=>{t(!0);try{let r=await ts(`/restart`,{force:e});if(r.status===`busy`)return t(!1),r;let i=Date.now()+Ls;n.current=new AbortController,await new Promise((e,t)=>{let r=async()=>{if(Date.now()>i){t(Error(`Restart timeout`));return}try{if((await fetch(Vo(`/health`),{signal:n.current.signal})).ok){e();return}setTimeout(r,Is)}catch{setTimeout(r,Is)}};setTimeout(r,Is)}),window.location.reload()}catch(e){throw t(!1),e}},[]),isRestarting:e}}function zs(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=zs(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Bs(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=zs(e))&&(r&&(r+=` `),r+=t);return r}var Vs=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Hs=Bs,Us=(e,t)=>n=>{if(t?.variants==null)return Hs(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Vs(t)||Vs(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Hs(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Ws=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Gs=(e,t)=>({classGroupId:e,validator:t}),Ks=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),qs=`-`,Js=[],Ys=`arbitrary..`,Xs=e=>{let t=$s(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Qs(e);let n=e.split(qs);return Zs(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ws(i,t):t:i||Js}return n[e]||Js}}},Zs=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Zs(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(qs):e.slice(t).join(qs),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Qs=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Ys+r:void 0})(),$s=e=>{let{theme:t,classGroups:n}=e;return ec(n,t)},ec=(e,t)=>{let n=Ks();for(let r in e){let i=e[r];tc(i,n,r,t)}return n},tc=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];nc(i,t,n,r)}},nc=(e,t,n,r)=>{if(typeof e==`string`){rc(e,t,n);return}if(typeof e==`function`){ic(e,t,n,r);return}ac(e,t,n,r)},rc=(e,t,n)=>{let r=e===``?t:oc(t,e);r.classGroupId=n},ic=(e,t,n,r)=>{if(sc(e)){tc(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Gs(n,e))},ac=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];tc(o,oc(t,a),n,r)}},oc=(e,t)=>{let n=e,r=t.split(qs),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Ks(),n.nextPart.set(t,i)),n=i}return n},sc=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,cc=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},lc=`!`,uc=`:`,dc=[],fc=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),pc=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===uc){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(lc)?(c=s.slice(0,-1),l=!0):s.startsWith(lc)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return fc(t,l,c,u)};if(t){let e=t+uc,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):fc(dc,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},mc=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},hc=e=>({cache:cc(e.cacheSize),parseClassName:pc(e),sortModifiers:mc(e),postfixLookupClassGroupIds:gc(e),...Xs(e)}),gc=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},_c=/\s+/,vc=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(_c),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+lc:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},yc=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=bc(n))&&(i&&(i+=` `),i+=r);return i},bc=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=bc(e[r]))&&(n&&(n+=` `),n+=t);return n},xc=(e,...t)=>{let n,r,i,a,o=o=>(n=hc(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=vc(e,n);return i(e,a),a};return a=o,(...e)=>a(yc(...e))},Sc=[],Cc=e=>{let t=t=>t[e]||Sc;return t.isThemeGetter=!0,t},wc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Tc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ec=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Dc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Oc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,kc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ac=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mc=e=>Ec.test(e),Nc=e=>!!e&&!Number.isNaN(Number(e)),Pc=e=>!!e&&Number.isInteger(Number(e)),Fc=e=>e.endsWith(`%`)&&Nc(e.slice(0,-1)),Ic=e=>Dc.test(e),Lc=()=>!0,Rc=e=>Oc.test(e)&&!kc.test(e),zc=()=>!1,Bc=e=>Ac.test(e),Vc=e=>jc.test(e),Hc=e=>!Gc(e)&&!$c(e),Uc=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Wc=e=>sl(e,dl,zc),Gc=e=>wc.test(e),Kc=e=>sl(e,fl,Rc),qc=e=>sl(e,pl,Nc),Jc=e=>sl(e,hl,Lc),Yc=e=>sl(e,ml,zc),Xc=e=>sl(e,ll,zc),Zc=e=>sl(e,ul,Vc),Qc=e=>sl(e,gl,Bc),$c=e=>Tc.test(e),el=e=>cl(e,fl),tl=e=>cl(e,ml),nl=e=>cl(e,ll),rl=e=>cl(e,dl),il=e=>cl(e,ul),al=e=>cl(e,gl,!0),ol=e=>cl(e,hl,!0),sl=(e,t,n)=>{let r=wc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},cl=(e,t,n=!1)=>{let r=Tc.exec(e);return r?r[1]?t(r[1]):n:!1},ll=e=>e===`position`||e===`percentage`,ul=e=>e===`image`||e===`url`,dl=e=>e===`length`||e===`size`||e===`bg-size`,fl=e=>e===`length`,pl=e=>e===`number`,ml=e=>e===`family-name`,hl=e=>e===`number`||e===`weight`,gl=e=>e===`shadow`,_l=xc(()=>{let e=Cc(`color`),t=Cc(`font`),n=Cc(`text`),r=Cc(`font-weight`),i=Cc(`tracking`),a=Cc(`leading`),o=Cc(`breakpoint`),s=Cc(`container`),c=Cc(`spacing`),l=Cc(`radius`),u=Cc(`shadow`),d=Cc(`inset-shadow`),f=Cc(`text-shadow`),p=Cc(`drop-shadow`),m=Cc(`blur`),h=Cc(`perspective`),g=Cc(`aspect`),_=Cc(`ease`),v=Cc(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),$c,Gc],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$c,Gc,c],T=()=>[Mc,`full`,`auto`,...w()],E=()=>[Pc,`none`,`subgrid`,$c,Gc],D=()=>[`auto`,{span:[`full`,Pc,$c,Gc]},Pc,$c,Gc],O=()=>[Pc,`auto`,$c,Gc],k=()=>[`auto`,`min`,`max`,`fr`,$c,Gc],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Mc,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Mc,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Mc,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,$c,Gc],L=()=>[...b(),nl,Xc,{position:[$c,Gc]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,rl,Wc,{size:[$c,Gc]}],z=()=>[Fc,el,Kc],B=()=>[``,`none`,`full`,l,$c,Gc],V=()=>[``,Nc,el,Kc],H=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ne=()=>[Nc,Fc,nl,Xc],U=()=>[``,`none`,m,$c,Gc],re=()=>[`none`,Nc,$c,Gc],ie=()=>[`none`,Nc,$c,Gc],ae=()=>[Nc,$c,Gc],oe=()=>[Mc,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Ic],breakpoint:[Ic],color:[Lc],container:[Ic],"drop-shadow":[Ic],ease:[`in`,`out`,`in-out`],font:[Hc],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Ic],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Ic],shadow:[Ic],spacing:[`px`,Nc],text:[Ic],"text-shadow":[Ic],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Mc,Gc,$c,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,$c,Gc]}],"container-named":[Uc],columns:[{columns:[Nc,Gc,$c,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Pc,`auto`,$c,Gc]}],basis:[{basis:[Mc,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Nc,Mc,`auto`,`initial`,`none`,Gc]}],grow:[{grow:[``,Nc,$c,Gc]}],shrink:[{shrink:[``,Nc,$c,Gc]}],order:[{order:[Pc,`first`,`last`,`none`,$c,Gc]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,el,Kc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,ol,Jc]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Fc,Gc]}],"font-family":[{font:[tl,Yc,t]}],"font-features":[{"font-features":[Gc]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,$c,Gc]}],"line-clamp":[{"line-clamp":[Nc,`none`,$c,qc]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$c,Gc]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$c,Gc]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...H(),`wavy`]}],"text-decoration-thickness":[{decoration:[Nc,`from-font`,`auto`,$c,Kc]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Nc,`auto`,$c,Gc]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Pc,$c,Gc]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$c,Gc]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,$c,Gc]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Pc,$c,Gc],radial:[``,$c,Gc],conic:[Pc,$c,Gc]},il,Zc]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-bs":[{"border-bs":V()}],"border-w-be":[{"border-be":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":V()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...H(),`hidden`,`none`]}],"divide-style":[{divide:[...H(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...H(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Nc,$c,Gc]}],"outline-w":[{outline:[``,Nc,el,Kc]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,al,Qc]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,al,Qc]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Nc,Kc]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,al,Qc]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Nc,$c,Gc]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Nc]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[$c,Gc]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Nc]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,$c,Gc]}],filter:[{filter:[``,`none`,$c,Gc]}],blur:[{blur:U()}],brightness:[{brightness:[Nc,$c,Gc]}],contrast:[{contrast:[Nc,$c,Gc]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,al,Qc]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Nc,$c,Gc]}],"hue-rotate":[{"hue-rotate":[Nc,$c,Gc]}],invert:[{invert:[``,Nc,$c,Gc]}],saturate:[{saturate:[Nc,$c,Gc]}],sepia:[{sepia:[``,Nc,$c,Gc]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$c,Gc]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[Nc,$c,Gc]}],"backdrop-contrast":[{"backdrop-contrast":[Nc,$c,Gc]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Nc,$c,Gc]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Nc,$c,Gc]}],"backdrop-invert":[{"backdrop-invert":[``,Nc,$c,Gc]}],"backdrop-opacity":[{"backdrop-opacity":[Nc,$c,Gc]}],"backdrop-saturate":[{"backdrop-saturate":[Nc,$c,Gc]}],"backdrop-sepia":[{"backdrop-sepia":[``,Nc,$c,Gc]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,$c,Gc]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Nc,`initial`,$c,Gc]}],ease:[{ease:[`linear`,`initial`,_,$c,Gc]}],delay:[{delay:[Nc,$c,Gc]}],animate:[{animate:[`none`,v,$c,Gc]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$c,Gc]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":[`scale-3d`],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[$c,Gc,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":[`translate-none`],zoom:[{zoom:[Pc,$c,Gc]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,$c,Gc]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,$c,Gc]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Nc,el,Kc,qc]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function J(...e){return _l(Bs(e))}var vl=Us(`inline-flex items-center justify-center whitespace-nowrap rounded-md font-sans text-sm font-medium transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-surface disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-gradient-to-br from-primary to-primary-container text-on-primary shadow-xs hover:shadow-[0_0_0_1px_rgba(171,207,184,0.4)]`,destructive:`bg-gradient-to-br from-tertiary to-tertiary-container text-on-surface shadow-xs hover:shadow-[0_0_0_1px_rgba(255,180,161,0.4)]`,outline:`border border-[var(--ghost-border)] bg-transparent shadow-xs hover:bg-surface-container-high hover:text-on-surface`,secondary:`border border-outline-variant/20 bg-transparent hover:bg-surface-container-high text-on-surface`,ghost:`hover:bg-surface-container-high text-on-surface-variant hover:text-on-surface`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),Y=(0,W.forwardRef)(({className:e,variant:t,size:n,...r},i)=>(0,G.jsx)(`button`,{className:J(vl({variant:t,size:n,className:e})),ref:i,...r}));Y.displayName=`Button`,typeof window<`u`&&window.document&&window.document.createElement;function yl(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function bl(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function xl(...e){return t=>{let n=!1,r=e.map(e=>{let r=bl(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():bl(e[t],null)}}}}function Sl(...e){return W.useCallback(xl(...e),e)}function Cl(e,t){let n=W.createContext(t),r=e=>{let{children:t,...r}=e,i=W.useMemo(()=>r,Object.values(r));return(0,G.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=W.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function wl(e,t=[]){let n=[];function r(t,r){let i=W.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=W.useMemo(()=>o,Object.values(o));return(0,G.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=W.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>W.createContext(e));return function(n){let r=n?.[e]||t;return W.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Tl(i,...t)]}function Tl(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return W.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var El=globalThis?.document?W.useLayoutEffect:()=>{},Dl=W.useId||(()=>void 0),Ol=0;function kl(e){let[t,n]=W.useState(Dl());return El(()=>{e||n(e=>e??String(Ol++))},[e]),e||(t?`radix-${t}`:``)}var Al=W.useInsertionEffect||El;function jl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Ml({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=W.useRef(e!==void 0);W.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,W.useCallback(t=>{if(s){let n=Nl(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Ml({defaultProp:e,onChange:t}){let[n,r]=W.useState(e),i=W.useRef(n),a=W.useRef(t);return Al(()=>{a.current=t},[t]),W.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Nl(e){return typeof e==`function`}var Pl=l(h(),1);function Fl(e){let t=Il(e),n=W.forwardRef((e,n)=>{let{children:r,...i}=e,a=W.Children.toArray(r),o=a.find(Rl);if(o){let e=o.props.children,r=a.map(t=>t===o?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return(0,G.jsx)(t,{...i,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return(0,G.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Il(e){let t=W.forwardRef((e,t)=>{let{children:n,...r}=e;if(W.isValidElement(n)){let e=Bl(n),i=zl(r,n.props);return n.type!==W.Fragment&&(i.ref=t?xl(t,e):e),W.cloneElement(n,i)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ll=Symbol(`radix.slottable`);function Rl(e){return W.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ll}function zl(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Bl(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Vl=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Fl(`Primitive.${t}`),r=W.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,G.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Hl(e,t){e&&Pl.flushSync(()=>e.dispatchEvent(t))}function Ul(e){let t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...e)=>t.current?.(...e),[])}function Wl(e,t=globalThis?.document){let n=Ul(e);W.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Gl=`DismissableLayer`,Kl=`dismissableLayer.update`,ql=`dismissableLayer.pointerDownOutside`,Jl=`dismissableLayer.focusOutside`,Yl,Xl=W.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Zl=W.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=W.useContext(Xl),[u,d]=W.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=W.useState({}),m=Sl(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=eu(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=tu(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Wl(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),W.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Yl=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),nu(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Yl)}},[u,f,n,l]),W.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),nu())},[u,l]),W.useEffect(()=>{let e=()=>p({});return document.addEventListener(Kl,e),()=>document.removeEventListener(Kl,e)},[]),(0,G.jsx)(Vl.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:yl(e.onFocusCapture,S.onFocusCapture),onBlurCapture:yl(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:yl(e.onPointerDownCapture,x.onPointerDownCapture)})});Zl.displayName=Gl;var Ql=`DismissableLayerBranch`,$l=W.forwardRef((e,t)=>{let n=W.useContext(Xl),r=W.useRef(null),i=Sl(t,r);return W.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,G.jsx)(Vl.div,{...e,ref:i})});$l.displayName=Ql;function eu(e,t=globalThis?.document){let n=Ul(e),r=W.useRef(!1),i=W.useRef(()=>{});return W.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){ru(ql,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function tu(e,t=globalThis?.document){let n=Ul(e),r=W.useRef(!1);return W.useEffect(()=>{let e=e=>{e.target&&!r.current&&ru(Jl,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function nu(){let e=new CustomEvent(Kl);document.dispatchEvent(e)}function ru(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Hl(i,a):i.dispatchEvent(a)}var iu=`focusScope.autoFocusOnMount`,au=`focusScope.autoFocusOnUnmount`,ou={bubbles:!1,cancelable:!0},su=`FocusScope`,cu=W.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=W.useState(null),l=Ul(i),u=Ul(a),d=W.useRef(null),f=Sl(t,e=>c(e)),p=W.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;W.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:hu(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||hu(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&hu(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),W.useEffect(()=>{if(s){gu.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(iu,ou);s.addEventListener(iu,l),s.dispatchEvent(t),t.defaultPrevented||(lu(yu(du(s)),{select:!0}),document.activeElement===e&&hu(s))}return()=>{s.removeEventListener(iu,l),setTimeout(()=>{let t=new CustomEvent(au,ou);s.addEventListener(au,u),s.dispatchEvent(t),t.defaultPrevented||hu(e??document.body,{select:!0}),s.removeEventListener(au,u),gu.remove(p)},0)}}},[s,l,u,p]);let m=W.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=uu(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&hu(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&hu(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,G.jsx)(Vl.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});cu.displayName=su;function lu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(hu(r,{select:t}),document.activeElement!==n)return}function uu(e){let t=du(e);return[fu(t,e),fu(t.reverse(),e)]}function du(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function fu(e,t){for(let n of e)if(!pu(n,{upTo:t}))return n}function pu(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function mu(e){return e instanceof HTMLInputElement&&`select`in e}function hu(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mu(e)&&t&&e.select()}}var gu=_u();function _u(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=vu(e,t),e.unshift(t)},remove(t){e=vu(e,t),e[0]?.resume()}}}function vu(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function yu(e){return e.filter(e=>e.tagName!==`A`)}var bu=`Portal`,xu=W.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=W.useState(!1);El(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Pl.createPortal((0,G.jsx)(Vl.div,{...r,ref:t}),o):null});xu.displayName=bu;function Su(e,t){return W.useReducer((e,n)=>t[e][n]??e,e)}var Cu=e=>{let{present:t,children:n}=e,r=wu(t),i=typeof n==`function`?n({present:r.isPresent}):W.Children.only(n),a=Sl(r.ref,Eu(i));return typeof n==`function`||r.isPresent?W.cloneElement(i,{ref:a}):null};Cu.displayName=`Presence`;function wu(e){let[t,n]=W.useState(),r=W.useRef(null),i=W.useRef(e),a=W.useRef(`none`),[o,s]=Su(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return W.useEffect(()=>{let e=Tu(r.current);a.current=o===`mounted`?e:`none`},[o]),El(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Tu(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),El(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Tu(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Tu(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:W.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Tu(e){return e?.animationName||`none`}function Eu(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Du=0;function Ou(){W.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??ku()),document.body.insertAdjacentElement(`beforeend`,e[1]??ku()),Du++,()=>{Du===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Du--}},[])}function ku(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Au=function(){return Au=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Au.apply(this,arguments)};function ju(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Mu(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Nu=`right-scroll-bar-position`,Pu=`width-before-scroll-bar`,Fu=`with-scroll-bars-hidden`,Iu=`--removed-body-scroll-bar-size`;function Lu(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ru(e,t){var n=(0,W.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var zu=typeof window<`u`?W.useLayoutEffect:W.useEffect,Bu=new WeakMap;function Vu(e,t){var n=Ru(t||null,function(t){return e.forEach(function(e){return Lu(e,t)})});return zu(function(){var t=Bu.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Lu(e,null)}),i.forEach(function(e){r.has(e)||Lu(e,a)})}Bu.set(n,e)},[e]),n}function Hu(e){return e}function Uu(e,t){t===void 0&&(t=Hu);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Wu(e){e===void 0&&(e={});var t=Uu(null);return t.options=Au({async:!0,ssr:!1},e),t}var Gu=function(e){var t=e.sideCar,n=ju(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return W.createElement(r,Au({},n))};Gu.isSideCarExport=!0;function Ku(e,t){return e.useMedium(t),Gu}var qu=Wu(),Ju=function(){},Yu=W.forwardRef(function(e,t){var n=W.useRef(null),r=W.useState({onScrollCapture:Ju,onWheelCapture:Ju,onTouchMoveCapture:Ju}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=ju(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Vu([n,t]),C=Au(Au({},b),i);return W.createElement(W.Fragment,null,u&&W.createElement(x,{sideCar:qu,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?W.cloneElement(W.Children.only(s),Au(Au({},C),{ref:S})):W.createElement(v,Au({},C,{className:c,ref:S}),s))});Yu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Yu.classNames={fullWidth:Pu,zeroRight:Nu};var Xu,Zu=function(){if(Xu)return Xu;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Qu(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Zu();return t&&e.setAttribute(`nonce`,t),e}function $u(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ed(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var td=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Qu())&&($u(t,n),ed(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nd=function(){var e=td();return function(t,n){W.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},rd=function(){var e=nd();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},id={left:0,top:0,right:0,gap:0},ad=function(e){return parseInt(e||``,10)||0},od=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[ad(n),ad(r),ad(i)]},sd=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return id;var t=od(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},cd=rd(),ld=`data-scroll-locked`,ud=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
12
|
-
.${Fu} {
|
|
13
|
-
overflow: hidden ${r};
|
|
14
|
-
padding-right: ${s}px ${r};
|
|
15
|
-
}
|
|
16
|
-
body[${ld}] {
|
|
17
|
-
overflow: hidden ${r};
|
|
18
|
-
overscroll-behavior: contain;
|
|
19
|
-
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
20
|
-
padding-left: ${i}px;
|
|
21
|
-
padding-top: ${a}px;
|
|
22
|
-
padding-right: ${o}px;
|
|
23
|
-
margin-left:0;
|
|
24
|
-
margin-top:0;
|
|
25
|
-
margin-right: ${s}px ${r};
|
|
26
|
-
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.${Nu} {
|
|
30
|
-
right: ${s}px ${r};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.${Pu} {
|
|
34
|
-
margin-right: ${s}px ${r};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.${Nu} .${Nu} {
|
|
38
|
-
right: 0 ${r};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.${Pu} .${Pu} {
|
|
42
|
-
margin-right: 0 ${r};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
body[${ld}] {
|
|
46
|
-
${Iu}: ${s}px;
|
|
47
|
-
}
|
|
48
|
-
`},dd=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},fd=function(){W.useEffect(function(){return document.body.setAttribute(ld,(dd()+1).toString()),function(){var e=dd()-1;e<=0?document.body.removeAttribute(ld):document.body.setAttribute(ld,e.toString())}},[])},pd=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;fd();var a=W.useMemo(function(){return sd(i)},[i]);return W.createElement(cd,{styles:ud(a,!t,i,n?``:`!important`)})},md=!1;if(typeof window<`u`)try{var hd=Object.defineProperty({},"passive",{get:function(){return md=!0,!0}});window.addEventListener(`test`,hd,hd),window.removeEventListener(`test`,hd,hd)}catch{md=!1}var gd=md?{passive:!1}:!1,_d=function(e){return e.tagName===`TEXTAREA`},vd=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!_d(e)&&n[t]===`visible`)},yd=function(e){return vd(e,`overflowY`)},bd=function(e){return vd(e,`overflowX`)},xd=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),wd(e,r)){var i=Td(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Sd=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Cd=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},wd=function(e,t){return e===`v`?yd(t):bd(t)},Td=function(e,t){return e===`v`?Sd(t):Cd(t)},Ed=function(e,t){return e===`h`&&t===`rtl`?-1:1},Dd=function(e,t,n,r,i){var a=Ed(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Td(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&wd(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Od=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},kd=function(e){return[e.deltaX,e.deltaY]},Ad=function(e){return e&&`current`in e?e.current:e},jd=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Md=function(e){return`
|
|
49
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
50
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
51
|
-
`},Nd=0,Pd=[];function Fd(e){var t=W.useRef([]),n=W.useRef([0,0]),r=W.useRef(),i=W.useState(Nd++)[0],a=W.useState(rd)[0],o=W.useRef(e);W.useEffect(function(){o.current=e},[e]),W.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Mu([e.lockRef.current],(e.shards||[]).map(Ad),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=W.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Od(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=xd(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=xd(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Dd(h,t,e,h===`h`?s:c,!0)},[]),c=W.useCallback(function(e){var n=e;if(!(!Pd.length||Pd[Pd.length-1]!==a)){var r=`deltaY`in n?kd(n):Od(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&jd(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Ad).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=W.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Id(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=W.useCallback(function(e){n.current=Od(e),r.current=void 0},[]),d=W.useCallback(function(t){l(t.type,kd(t),t.target,s(t,e.lockRef.current))},[]),f=W.useCallback(function(t){l(t.type,Od(t),t.target,s(t,e.lockRef.current))},[]);W.useEffect(function(){return Pd.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,gd),document.addEventListener(`touchmove`,c,gd),document.addEventListener(`touchstart`,u,gd),function(){Pd=Pd.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,gd),document.removeEventListener(`touchmove`,c,gd),document.removeEventListener(`touchstart`,u,gd)}},[]);var p=e.removeScrollBar,m=e.inert;return W.createElement(W.Fragment,null,m?W.createElement(a,{styles:Md(i)}):null,p?W.createElement(pd,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Id(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Ld=Ku(qu,Fd),Rd=W.forwardRef(function(e,t){return W.createElement(Yu,Au({},e,{ref:t,sideCar:Ld}))});Rd.classNames=Yu.classNames;var zd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Bd=new WeakMap,Vd=new WeakMap,Hd={},Ud=0,Wd=function(e){return e&&(e.host||Wd(e.parentNode))},Gd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Wd(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Kd=function(e,t,n,r){var i=Gd(t,Array.isArray(e)?e:[e]);Hd[n]||(Hd[n]=new WeakMap);var a=Hd[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Bd.get(e)||0)+1,l=(a.get(e)||0)+1;Bd.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Vd.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Ud++,function(){o.forEach(function(e){var t=Bd.get(e)-1,i=a.get(e)-1;Bd.set(e,t),a.set(e,i),t||(Vd.has(e)||e.removeAttribute(r),Vd.delete(e)),i||e.removeAttribute(n)}),Ud--,Ud||(Bd=new WeakMap,Bd=new WeakMap,Vd=new WeakMap,Hd={})}},qd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||zd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Kd(r,i,n,`aria-hidden`)):function(){return null}},Jd=`Dialog`,[Yd,Xd]=wl(Jd),[Zd,Qd]=Yd(Jd),$d=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=W.useRef(null),c=W.useRef(null),[l,u]=jl({prop:r,defaultProp:i??!1,onChange:a,caller:Jd});return(0,G.jsx)(Zd,{scope:t,triggerRef:s,contentRef:c,contentId:kl(),titleId:kl(),descriptionId:kl(),open:l,onOpenChange:u,onOpenToggle:W.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};$d.displayName=Jd;var ef=`DialogTrigger`,tf=W.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Qd(ef,n),a=Sl(t,i.triggerRef);return(0,G.jsx)(Vl.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Sf(i.open),...r,ref:a,onClick:yl(e.onClick,i.onOpenToggle)})});tf.displayName=ef;var nf=`DialogPortal`,[rf,af]=Yd(nf,{forceMount:void 0}),of=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Qd(nf,t);return(0,G.jsx)(rf,{scope:t,forceMount:n,children:W.Children.map(r,e=>(0,G.jsx)(Cu,{present:n||a.open,children:(0,G.jsx)(xu,{asChild:!0,container:i,children:e})}))})};of.displayName=nf;var sf=`DialogOverlay`,cf=W.forwardRef((e,t)=>{let n=af(sf,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Qd(sf,e.__scopeDialog);return a.modal?(0,G.jsx)(Cu,{present:r||a.open,children:(0,G.jsx)(uf,{...i,ref:t})}):null});cf.displayName=sf;var lf=Fl(`DialogOverlay.RemoveScroll`),uf=W.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Qd(sf,n);return(0,G.jsx)(Rd,{as:lf,allowPinchZoom:!0,shards:[i.contentRef],children:(0,G.jsx)(Vl.div,{"data-state":Sf(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),df=`DialogContent`,ff=W.forwardRef((e,t)=>{let n=af(df,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Qd(df,e.__scopeDialog);return(0,G.jsx)(Cu,{present:r||a.open,children:a.modal?(0,G.jsx)(pf,{...i,ref:t}):(0,G.jsx)(mf,{...i,ref:t})})});ff.displayName=df;var pf=W.forwardRef((e,t)=>{let n=Qd(df,e.__scopeDialog),r=W.useRef(null),i=Sl(t,n.contentRef,r);return W.useEffect(()=>{let e=r.current;if(e)return qd(e)},[]),(0,G.jsx)(hf,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:yl(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:yl(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:yl(e.onFocusOutside,e=>e.preventDefault())})}),mf=W.forwardRef((e,t)=>{let n=Qd(df,e.__scopeDialog),r=W.useRef(!1),i=W.useRef(!1);return(0,G.jsx)(hf,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),hf=W.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Qd(df,n),c=W.useRef(null),l=Sl(t,c);return Ou(),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(cu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,G.jsx)(Zl,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Sf(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ef,{titleId:s.titleId}),(0,G.jsx)(Of,{contentRef:c,descriptionId:s.descriptionId})]})]})}),gf=`DialogTitle`,_f=W.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Qd(gf,n);return(0,G.jsx)(Vl.h2,{id:i.titleId,...r,ref:t})});_f.displayName=gf;var vf=`DialogDescription`,yf=W.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Qd(vf,n);return(0,G.jsx)(Vl.p,{id:i.descriptionId,...r,ref:t})});yf.displayName=vf;var bf=`DialogClose`,xf=W.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Qd(bf,n);return(0,G.jsx)(Vl.button,{type:`button`,...r,ref:t,onClick:yl(e.onClick,()=>i.onOpenChange(!1))})});xf.displayName=bf;function Sf(e){return e?`open`:`closed`}var Cf=`DialogTitleWarning`,[wf,Tf]=Cl(Cf,{contentName:df,titleName:gf,docsSlug:`dialog`}),Ef=({titleId:e})=>{let t=Tf(Cf),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
52
|
-
|
|
53
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
54
|
-
|
|
55
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return W.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Df=`DialogDescriptionWarning`,Of=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Tf(Df).contentName}}.`;return W.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},kf=$d,Af=tf,jf=of,Mf=cf,Nf=ff,Pf=_f,Ff=yf,If=xf,Lf=kf,Rf=Af,zf=jf,Bf=(0,W.forwardRef)(({className:e,...t},n)=>(0,G.jsx)(Mf,{ref:n,className:J(`fixed inset-0 z-50 bg-black/60 backdrop-blur-xs`,e),...t}));Bf.displayName=Mf.displayName;var Vf=(0,W.forwardRef)(({className:e,children:t,...n},r)=>(0,G.jsxs)(zf,{children:[(0,G.jsx)(Bf,{}),(0,G.jsxs)(Nf,{ref:r,className:J(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 [&>*]:min-w-0 border-0 bg-surface-container-highest p-6 shadow-ambient duration-200 sm:rounded-lg`,e),...n,children:[t,(0,G.jsxs)(If,{className:`absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,G.jsx)(So,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Vf.displayName=Nf.displayName;function Hf({className:e,...t}){return(0,G.jsx)(`div`,{className:J(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t})}Hf.displayName=`DialogHeader`;function Uf({className:e,...t}){return(0,G.jsx)(`div`,{className:J(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t})}Uf.displayName=`DialogFooter`;var Wf=(0,W.forwardRef)(({className:e,...t},n)=>(0,G.jsx)(Pf,{ref:n,className:J(`text-lg font-serif font-semibold leading-none tracking-tight`,e),...t}));Wf.displayName=Pf.displayName;var Gf=(0,W.forwardRef)(({className:e,...t},n)=>(0,G.jsx)(Ff,{ref:n,className:J(`text-sm text-on-surface-variant`,e),...t}));Gf.displayName=Ff.displayName;var Kf=(0,W.forwardRef)(({className:e,type:t,...n},r)=>(0,G.jsx)(`input`,{type:t,className:J(`flex h-9 w-full rounded-md bg-surface-container-lowest border border-[var(--ghost-border)] px-3 py-1 font-sans text-sm text-on-surface shadow-none transition-colors`,`file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-on-surface`,`placeholder:text-on-surface-variant/50`,`focus-visible:outline-hidden focus-visible:border-primary/40`,`disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));Kf.displayName=`Input`;function qf(e,[t,n]){return Math.min(n,Math.max(t,e))}function Jf(e){let t=e+`CollectionProvider`,[n,r]=wl(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=W.useRef(null),a=W.useRef(new Map).current;return(0,G.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=Fl(s),l=W.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,G.jsx)(c,{ref:Sl(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Fl(u),p=W.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=W.useRef(null),s=Sl(t,o),c=a(u,n);return W.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,G.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return W.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var Yf=W.createContext(void 0);function Xf(e){let t=W.useContext(Yf);return e||t||`ltr`}var Zf=[`top`,`right`,`bottom`,`left`],Qf=Math.min,$f=Math.max,ep=Math.round,tp=Math.floor,np=e=>({x:e,y:e}),rp={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ip(e,t,n){return $f(e,Qf(t,n))}function ap(e,t){return typeof e==`function`?e(t):e}function op(e){return e.split(`-`)[0]}function sp(e){return e.split(`-`)[1]}function cp(e){return e===`x`?`y`:`x`}function lp(e){return e===`y`?`height`:`width`}function up(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function dp(e){return cp(up(e))}function fp(e,t,n){n===void 0&&(n=!1);let r=sp(e),i=dp(e),a=lp(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=xp(o)),[o,xp(o)]}function pp(e){let t=xp(e);return[mp(e),t,mp(t)]}function mp(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var hp=[`left`,`right`],gp=[`right`,`left`],_p=[`top`,`bottom`],vp=[`bottom`,`top`];function yp(e,t,n){switch(e){case`top`:case`bottom`:return n?t?gp:hp:t?hp:gp;case`left`:case`right`:return t?_p:vp;default:return[]}}function bp(e,t,n,r){let i=sp(e),a=yp(op(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(mp)))),a}function xp(e){let t=op(e);return rp[t]+e.slice(t.length)}function Sp(e){return{top:0,right:0,bottom:0,left:0,...e}}function Cp(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Sp(e)}function wp(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Tp(e,t,n){let{reference:r,floating:i}=e,a=up(t),o=dp(t),s=lp(o),c=op(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(sp(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Ep(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=ap(t,e),p=Cp(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=wp(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=wp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Dp=50,Op=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ep},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Tp(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Dp&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Tp(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},kp=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=ap(e,t)||{};if(l==null)return{};let d=Cp(u),f={x:n,y:r},p=dp(i),m=lp(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Qf(d[_],T),D=Qf(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=ip(O,A,k),M=!c.arrow&&sp(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Ap=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=ap(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=op(r),_=up(o),v=op(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[xp(o)]:pp(o)),x=p!==`none`;!d&&x&&b.push(...bp(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=fp(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==up(t))||T.every(e=>up(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=up(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function jp(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Mp(e){return Zf.some(t=>e[t]>=0)}var Np=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=ap(e,t);switch(i){case`referenceHidden`:{let e=jp(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Mp(e)}}}case`escaped`:{let e=jp(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Mp(e)}}}default:return{}}}}},Pp=new Set([`left`,`top`]);async function Fp(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=op(n),s=sp(n),c=up(n)===`y`,l=Pp.has(o)?-1:1,u=a&&c?-1:1,d=ap(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Ip=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Fp(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Lp=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=ap(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=up(op(i)),p=cp(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=ip(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=ip(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Rp=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=ap(e,t),u={x:n,y:r},d=up(i),f=cp(d),p=u[f],m=u[d],h=ap(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Pp.has(op(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},zp=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=ap(e,t),u=await o.detectOverflow(t,l),d=op(i),f=sp(i),p=up(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Qf(h-u[g],v),x=Qf(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=$f(u.left,0),t=$f(u.right,0),n=$f(u.top,0),r=$f(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:$f(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:$f(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Bp(){return typeof window<`u`}function Vp(e){return Wp(e)?(e.nodeName||``).toLowerCase():`#document`}function Hp(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Up(e){return((Wp(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Wp(e){return Bp()?e instanceof Node||e instanceof Hp(e).Node:!1}function Gp(e){return Bp()?e instanceof Element||e instanceof Hp(e).Element:!1}function Kp(e){return Bp()?e instanceof HTMLElement||e instanceof Hp(e).HTMLElement:!1}function qp(e){return!Bp()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Hp(e).ShadowRoot}function Jp(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=am(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Yp(e){return/^(table|td|th)$/.test(Vp(e))}function Xp(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Zp=/transform|translate|scale|rotate|perspective|filter/,Qp=/paint|layout|strict|content/,$p=e=>!!e&&e!==`none`,em;function tm(e){let t=Gp(e)?am(e):e;return $p(t.transform)||$p(t.translate)||$p(t.scale)||$p(t.rotate)||$p(t.perspective)||!rm()&&($p(t.backdropFilter)||$p(t.filter))||Zp.test(t.willChange||``)||Qp.test(t.contain||``)}function nm(e){let t=sm(e);for(;Kp(t)&&!im(t);){if(tm(t))return t;if(Xp(t))return null;t=sm(t)}return null}function rm(){return em??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),em}function im(e){return/^(html|body|#document)$/.test(Vp(e))}function am(e){return Hp(e).getComputedStyle(e)}function om(e){return Gp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sm(e){if(Vp(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||qp(e)&&e.host||Up(e);return qp(t)?t.host:t}function cm(e){let t=sm(e);return im(t)?e.ownerDocument?e.ownerDocument.body:e.body:Kp(t)&&Jp(t)?t:cm(t)}function lm(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=cm(e),i=r===e.ownerDocument?.body,a=Hp(r);if(i){let e=um(a);return t.concat(a,a.visualViewport||[],Jp(r)?r:[],e&&n?lm(e):[])}else return t.concat(r,lm(r,[],n))}function um(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dm(e){let t=am(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Kp(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ep(n)!==a||ep(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function fm(e){return Gp(e)?e:e.contextElement}function pm(e){let t=fm(e);if(!Kp(t))return np(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=dm(t),o=(a?ep(n.width):n.width)/r,s=(a?ep(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var mm=np(0);function hm(e){let t=Hp(e);return!rm()||!t.visualViewport?mm:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gm(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Hp(e)?!1:t}function _m(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=fm(e),o=np(1);t&&(r?Gp(r)&&(o=pm(r)):o=pm(e));let s=gm(a,n,r)?hm(a):np(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Hp(a),t=r&&Gp(r)?Hp(r):r,n=e,i=um(n);for(;i&&r&&t!==n;){let e=pm(i),t=i.getBoundingClientRect(),r=am(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Hp(i),i=um(n)}}return wp({width:u,height:d,x:c,y:l})}function vm(e,t){let n=om(e).scrollLeft;return t?t.left+n:_m(Up(e)).left+n}function ym(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-vm(e,n),y:n.top+t.scrollTop}}function bm(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Up(r),s=t?Xp(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=np(1),u=np(0),d=Kp(r);if((d||!d&&!a)&&((Vp(r)!==`body`||Jp(o))&&(c=om(r)),d)){let e=_m(r);l=pm(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ym(o,c):np(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function xm(e){return Array.from(e.getClientRects())}function Sm(e){let t=Up(e),n=om(e),r=e.ownerDocument.body,i=$f(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=$f(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+vm(e),s=-n.scrollTop;return am(r).direction===`rtl`&&(o+=$f(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Cm=25;function wm(e,t){let n=Hp(e),r=Up(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=rm();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=vm(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Cm&&(a-=o)}else l<=Cm&&(a+=l);return{width:a,height:o,x:s,y:c}}function Tm(e,t){let n=_m(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Kp(e)?pm(e):np(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Em(e,t,n){let r;if(t===`viewport`)r=wm(e,n);else if(t===`document`)r=Sm(Up(e));else if(Gp(t))r=Tm(t,n);else{let n=hm(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return wp(r)}function Dm(e,t){let n=sm(e);return n===t||!Gp(n)||im(n)?!1:am(n).position===`fixed`||Dm(n,t)}function Om(e,t){let n=t.get(e);if(n)return n;let r=lm(e,[],!1).filter(e=>Gp(e)&&Vp(e)!==`body`),i=null,a=am(e).position===`fixed`,o=a?sm(e):e;for(;Gp(o)&&!im(o);){let t=am(o),n=tm(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Jp(o)&&!n&&Dm(e,o))?r=r.filter(e=>e!==o):i=t,o=sm(o)}return t.set(e,r),r}function km(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Xp(t)?[]:Om(t,this._c):[].concat(n),r],o=Em(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Em(t,a[e],i);s=$f(n.top,s),c=Qf(n.right,c),l=Qf(n.bottom,l),u=$f(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Am(e){let{width:t,height:n}=dm(e);return{width:t,height:n}}function jm(e,t,n){let r=Kp(t),i=Up(t),a=n===`fixed`,o=_m(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=np(0);function l(){c.x=vm(i)}if(r||!r&&!a)if((Vp(t)!==`body`||Jp(i))&&(s=om(t)),r){let e=_m(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?ym(i,s):np(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Mm(e){return am(e).position===`static`}function Nm(e,t){if(!Kp(e)||am(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Up(e)===n&&(n=n.ownerDocument.body),n}function Pm(e,t){let n=Hp(e);if(Xp(e))return n;if(!Kp(e)){let t=sm(e);for(;t&&!im(t);){if(Gp(t)&&!Mm(t))return t;t=sm(t)}return n}let r=Nm(e,t);for(;r&&Yp(r)&&Mm(r);)r=Nm(r,t);return r&&im(r)&&Mm(r)&&!tm(r)?n:r||nm(e)||n}var Fm=async function(e){let t=this.getOffsetParent||Pm,n=this.getDimensions,r=await n(e.floating);return{reference:jm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Im(e){return am(e).direction===`rtl`}var Lm={convertOffsetParentRelativeRectToViewportRelativeRect:bm,getDocumentElement:Up,getClippingRect:km,getOffsetParent:Pm,getElementRects:Fm,getClientRects:xm,getDimensions:Am,getScale:pm,isElement:Gp,isRTL:Im};function Rm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function zm(e,t){let n=null,r,i=Up(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=tp(d),h=tp(i.clientWidth-(u+f)),g=tp(i.clientHeight-(d+p)),_=tp(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:$f(0,Qf(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Rm(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Bm(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=fm(e),u=i||a?[...l?lm(l):[],...t?lm(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?zm(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?_m(e):null;c&&g();function g(){let t=_m(e);h&&!Rm(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Vm=Ip,Hm=Lp,Um=Ap,Wm=zp,Gm=Np,Km=kp,qm=Rp,Jm=(e,t,n)=>{let r=new Map,i={platform:Lm,...n},a={...i.platform,_c:r};return Op(e,t,{...i,platform:a})},Ym=typeof document<`u`?W.useLayoutEffect:function(){};function Xm(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Xm(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Xm(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Zm(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qm(e,t){let n=Zm(e);return Math.round(t*n)/n}function $m(e){let t=W.useRef(e);return Ym(()=>{t.current=e}),t}function eh(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=W.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=W.useState(r);Xm(f,r)||p(r);let[m,h]=W.useState(null),[g,_]=W.useState(null),v=W.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=W.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=W.useRef(null),C=W.useRef(null),w=W.useRef(u),T=c!=null,E=$m(c),D=$m(i),O=$m(l),k=W.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Jm(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Xm(w.current,t)&&(w.current=t,Pl.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Ym(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=W.useRef(!1);Ym(()=>(A.current=!0,()=>{A.current=!1}),[]),Ym(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=W.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=W.useMemo(()=>({reference:b,floating:x}),[b,x]),N=W.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Qm(M.floating,u.x),r=Qm(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Zm(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return W.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var th=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Km({element:r.current,padding:i}).fn(n):r?Km({element:r,padding:i}).fn(n):{}}}},nh=(e,t)=>{let n=Vm(e);return{name:n.name,fn:n.fn,options:[e,t]}},rh=(e,t)=>{let n=Hm(e);return{name:n.name,fn:n.fn,options:[e,t]}},ih=(e,t)=>({fn:qm(e).fn,options:[e,t]}),ah=(e,t)=>{let n=Um(e);return{name:n.name,fn:n.fn,options:[e,t]}},oh=(e,t)=>{let n=Wm(e);return{name:n.name,fn:n.fn,options:[e,t]}},sh=(e,t)=>{let n=Gm(e);return{name:n.name,fn:n.fn,options:[e,t]}},ch=(e,t)=>{let n=th(e);return{name:n.name,fn:n.fn,options:[e,t]}},lh=`Arrow`,uh=W.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,G.jsx)(Vl.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,G.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});uh.displayName=lh;var dh=uh;function fh(e){let[t,n]=W.useState(void 0);return El(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var ph=`Popper`,[mh,hh]=wl(ph),[gh,_h]=mh(ph),vh=e=>{let{__scopePopper:t,children:n}=e,[r,i]=W.useState(null);return(0,G.jsx)(gh,{scope:t,anchor:r,onAnchorChange:i,children:n})};vh.displayName=ph;var yh=`PopperAnchor`,bh=W.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=_h(yh,n),o=W.useRef(null),s=Sl(t,o),c=W.useRef(null);return W.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,G.jsx)(Vl.div,{...i,ref:s})});bh.displayName=yh;var xh=`PopperContent`,[Sh,Ch]=mh(xh),wh=W.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=_h(xh,n),[_,v]=W.useState(null),y=Sl(t,e=>v(e)),[b,x]=W.useState(null),S=fh(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(Oh),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=eh({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>Bm(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[nh({mainAxis:i+w,alignmentAxis:o}),c&&rh({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?ih():void 0,...k}),c&&ah({...k}),oh({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&ch({element:b,padding:s}),kh({arrowWidth:C,arrowHeight:w}),f&&sh({strategy:`referenceHidden`,...k})]}),[F,I]=Ah(M),L=Ul(m);El(()=>{N&&L?.()},[N,L]);let R=P.arrow?.x,ee=P.arrow?.y,z=P.arrow?.centerOffset!==0,[B,V]=W.useState();return El(()=>{_&&V(window.getComputedStyle(_).zIndex)},[_]),(0,G.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:B,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,G.jsx)(Sh,{scope:n,placedSide:F,onArrowChange:x,arrowX:R,arrowY:ee,shouldHideArrow:z,children:(0,G.jsx)(Vl.div,{"data-side":F,"data-align":I,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});wh.displayName=xh;var Th=`PopperArrow`,Eh={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Dh=W.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Ch(Th,n),a=Eh[i.placedSide];return(0,G.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,G.jsx)(dh,{...r,ref:t,style:{...r.style,display:`block`}})})});Dh.displayName=Th;function Oh(e){return e!==null}var kh=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Ah(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Ah(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var jh=vh,Mh=bh,Nh=wh,Ph=Dh;function Fh(e){let t=W.useRef({value:e,previous:e});return W.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Ih=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Lh=`VisuallyHidden`,Rh=W.forwardRef((e,t)=>(0,G.jsx)(Vl.span,{...e,ref:t,style:{...Ih,...e.style}}));Rh.displayName=Lh;var zh=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Bh=[` `,`Enter`],Vh=`Select`,[Hh,Uh,Wh]=Jf(Vh),[Gh,Kh]=wl(Vh,[Wh,hh]),qh=hh(),[Jh,Yh]=Gh(Vh),[Xh,Zh]=Gh(Vh),Qh=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=qh(t),[g,_]=W.useState(null),[v,y]=W.useState(null),[b,x]=W.useState(!1),S=Xf(l),[C,w]=jl({prop:r,defaultProp:i??!1,onChange:a,caller:Vh}),[T,E]=jl({prop:o,defaultProp:s,onChange:c,caller:Vh}),D=W.useRef(null),O=g?m||!!g.closest(`form`):!0,[k,A]=W.useState(new Set),j=Array.from(k).map(e=>e.props.value).join(`;`);return(0,G.jsx)(jh,{...h,children:(0,G.jsxs)(Jh,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:kl(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,G.jsx)(Hh.Provider,{scope:t,children:(0,G.jsx)(Xh,{scope:e.__scopeSelect,onNativeOptionAdd:W.useCallback(e=>{A(t=>new Set(t).add(e))},[]),onNativeOptionRemove:W.useCallback(e=>{A(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,G.jsxs)(qg,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,G.jsx)(`option`,{value:``}):null,Array.from(k)]},j):null]})})};Qh.displayName=Vh;var $h=`SelectTrigger`,eg=W.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=qh(n),o=Yh($h,n),s=o.disabled||r,c=Sl(t,o.onTriggerChange),l=Uh(n),u=W.useRef(`touch`),[d,f,p]=Yg(e=>{let t=l().filter(e=>!e.disabled),n=Xg(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,G.jsx)(Mh,{asChild:!0,...a,children:(0,G.jsx)(Vl.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Jg(o.value)?``:void 0,...i,ref:c,onClick:yl(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:yl(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:yl(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&zh.includes(e.key)&&(m(),e.preventDefault())})})})});eg.displayName=$h;var tg=`SelectValue`,ng=W.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=Yh(tg,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Sl(t,c.onValueNodeChange);return El(()=>{l(u)},[l,u]),(0,G.jsx)(Vl.span,{...s,ref:d,style:{pointerEvents:`none`},children:Jg(c.value)?(0,G.jsx)(G.Fragment,{children:o}):a})});ng.displayName=tg;var rg=`SelectIcon`,ig=W.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,G.jsx)(Vl.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ig.displayName=rg;var ag=`SelectPortal`,og=e=>(0,G.jsx)(xu,{asChild:!0,...e});og.displayName=ag;var sg=`SelectContent`,cg=W.forwardRef((e,t)=>{let n=Yh(sg,e.__scopeSelect),[r,i]=W.useState();if(El(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Pl.createPortal((0,G.jsx)(ug,{scope:e.__scopeSelect,children:(0,G.jsx)(Hh.Slot,{scope:e.__scopeSelect,children:(0,G.jsx)(`div`,{children:e.children})})}),t):null}return(0,G.jsx)(mg,{...e,ref:t})});cg.displayName=sg;var lg=10,[ug,dg]=Gh(sg),fg=`SelectContentImpl`,pg=Fl(`SelectContent.RemoveScroll`),mg=W.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=Yh(sg,n),[y,b]=W.useState(null),[x,S]=W.useState(null),C=Sl(t,e=>b(e)),[w,T]=W.useState(null),[E,D]=W.useState(null),O=Uh(n),[k,A]=W.useState(!1),j=W.useRef(!1);W.useEffect(()=>{if(y)return qd(y)},[y]),Ou();let M=W.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),N=W.useCallback(()=>M([w,y]),[M,w,y]);W.useEffect(()=>{k&&N()},[k,N]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;W.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,F]),W.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[I,L]=Yg(e=>{let t=O().filter(e=>!e.disabled),n=Xg(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),R=W.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),ee=W.useCallback(()=>y?.focus(),[y]),z=W.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),B=r===`popper`?vg:gg,V=B===vg?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,G.jsx)(ug,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:R,selectedItem:w,onItemLeave:ee,itemTextRefCallback:z,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:k,searchRef:I,children:(0,G.jsx)(Rd,{as:pg,allowPinchZoom:!0,children:(0,G.jsx)(cu,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:yl(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,G.jsx)(Zl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,G.jsx)(B,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...V,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:yl(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&L(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})});mg.displayName=fg;var hg=`SelectItemAlignedPosition`,gg=W.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Yh(sg,n),o=dg(sg,n),[s,c]=W.useState(null),[l,u]=W.useState(null),d=Sl(t,e=>u(e)),f=Uh(n),p=W.useRef(!1),m=W.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=W.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-lg,d=qf(a,[lg,Math.max(lg,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-lg,d=qf(a,[lg,Math.max(lg,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-lg*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-lg,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${lg}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);El(()=>y(),[y]);let[b,x]=W.useState();return El(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,G.jsx)(yg,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:W.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,G.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,G.jsx)(Vl.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});gg.displayName=hg;var _g=`SelectPopperPosition`,vg=W.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=lg,...a}=e,o=qh(n);return(0,G.jsx)(Nh,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});vg.displayName=_g;var[yg,bg]=Gh(sg,{}),xg=`SelectViewport`,Sg=W.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=dg(xg,n),o=bg(xg,n),s=Sl(t,a.onViewportChange),c=W.useRef(0);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,G.jsx)(Hh.Slot,{scope:n,children:(0,G.jsx)(Vl.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:yl(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-lg*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Sg.displayName=xg;var Cg=`SelectGroup`,[wg,Tg]=Gh(Cg),Eg=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=kl();return(0,G.jsx)(wg,{scope:n,id:i,children:(0,G.jsx)(Vl.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Eg.displayName=Cg;var Dg=`SelectLabel`,Og=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Tg(Dg,n);return(0,G.jsx)(Vl.div,{id:i.id,...r,ref:t})});Og.displayName=Dg;var kg=`SelectItem`,[Ag,jg]=Gh(kg),Mg=W.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Yh(kg,n),c=dg(kg,n),l=s.value===r,[u,d]=W.useState(a??``),[f,p]=W.useState(!1),m=Sl(t,e=>c.itemRefCallback?.(e,r,i)),h=kl(),g=W.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,G.jsx)(Ag,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:W.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,G.jsx)(Hh.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,G.jsx)(Vl.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:yl(o.onFocus,()=>p(!0)),onBlur:yl(o.onBlur,()=>p(!1)),onClick:yl(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:yl(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:yl(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:yl(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:yl(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:yl(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Bh.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});Mg.displayName=kg;var Ng=`SelectItemText`,Pg=W.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Yh(Ng,n),s=dg(Ng,n),c=jg(Ng,n),l=Zh(Ng,n),[u,d]=W.useState(null),f=Sl(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=W.useMemo(()=>(0,G.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return El(()=>(h(m),()=>g(m)),[h,g,m]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vl.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Pl.createPortal(a.children,o.valueNode):null]})});Pg.displayName=Ng;var Fg=`SelectItemIndicator`,Ig=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return jg(Fg,n).isSelected?(0,G.jsx)(Vl.span,{"aria-hidden":!0,...r,ref:t}):null});Ig.displayName=Fg;var Lg=`SelectScrollUpButton`,Rg=W.forwardRef((e,t)=>{let n=dg(Lg,e.__scopeSelect),r=bg(Lg,e.__scopeSelect),[i,a]=W.useState(!1),o=Sl(t,r.onScrollButtonChange);return El(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,G.jsx)(Vg,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Rg.displayName=Lg;var zg=`SelectScrollDownButton`,Bg=W.forwardRef((e,t)=>{let n=dg(zg,e.__scopeSelect),r=bg(zg,e.__scopeSelect),[i,a]=W.useState(!1),o=Sl(t,r.onScrollButtonChange);return El(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,G.jsx)(Vg,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Bg.displayName=zg;var Vg=W.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=dg(`SelectScrollButton`,n),o=W.useRef(null),s=Uh(n),c=W.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return W.useEffect(()=>()=>c(),[c]),El(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,G.jsx)(Vl.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:yl(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:yl(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:yl(i.onPointerLeave,()=>{c()})})}),Hg=`SelectSeparator`,Ug=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,G.jsx)(Vl.div,{"aria-hidden":!0,...r,ref:t})});Ug.displayName=Hg;var Wg=`SelectArrow`,Gg=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=qh(n),a=Yh(Wg,n),o=dg(Wg,n);return a.open&&o.position===`popper`?(0,G.jsx)(Ph,{...i,...r,ref:t}):null});Gg.displayName=Wg;var Kg=`SelectBubbleInput`,qg=W.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=W.useRef(null),a=Sl(r,i),o=Fh(t);return W.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,G.jsx)(Vl.select,{...n,style:{...Ih,...n.style},ref:a,defaultValue:t})});qg.displayName=Kg;function Jg(e){return e===``||e===void 0}function Yg(e){let t=Ul(e),n=W.useRef(``),r=W.useRef(0),i=W.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=W.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return W.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Xg(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Zg(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Zg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Qg=Qh,$g=eg,e_=ng,t_=ig,n_=og,r_=cg,i_=Sg,a_=Mg,o_=Pg,s_=Ig,c_=Qg,l_=e_,u_=(0,W.forwardRef)(({className:e,children:t,...n},r)=>(0,G.jsxs)($g,{ref:r,className:J(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-sm shadow-xs ring-offset-background placeholder:text-muted-foreground focus:outline-hidden focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,G.jsx)(t_,{asChild:!0,children:(0,G.jsx)($i,{className:`h-4 w-4 opacity-50`})})]}));u_.displayName=$g.displayName;var d_=(0,W.forwardRef)(({className:e,children:t,position:n=`popper`,...r},i)=>(0,G.jsx)(n_,{children:(0,G.jsx)(r_,{ref:i,className:J(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border-0 bg-surface-container-highest text-card-foreground shadow-ambient`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:(0,G.jsx)(i_,{className:J(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t})})}));d_.displayName=r_.displayName;var f_=(0,W.forwardRef)(({className:e,children:t,...n},r)=>(0,G.jsxs)(a_,{ref:r,className:J(`relative flex w-full cursor-default select-none items-center rounded-xs py-1.5 pl-2 pr-8 text-sm outline-hidden focus:bg-surface-bright focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,G.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,G.jsx)(s_,{children:(0,G.jsx)(Qi,{className:`h-4 w-4`})})}),(0,G.jsx)(o_,{children:t})]}));f_.displayName=a_.displayName;var p_=`Toggle`,m_=W.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=jl({prop:n,onChange:i,defaultProp:r??!1,caller:p_});return(0,G.jsx)(Vl.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:yl(e.onClick,()=>{e.disabled||s(!o)})})});m_.displayName=p_;var h_=m_,g_=Us(`inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-surface-container-high/80 hover:text-on-surface-variant focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-primary data-[state=on]:text-on-primary`,{variants:{variant:{default:`bg-surface-container-high text-on-surface-variant`,outline:`border border-input bg-surface-container-high text-on-surface-variant shadow-xs hover:bg-surface-container-high/80 hover:text-on-surface-variant`},size:{default:`h-9 px-3`,sm:`h-8 px-2`,lg:`h-10 px-3`}},defaultVariants:{variant:`default`,size:`default`}}),__=(0,W.forwardRef)(({className:e,variant:t,size:n,...r},i)=>(0,G.jsx)(h_,{ref:i,className:J(g_({variant:t,size:n,className:e})),...r}));__.displayName=h_.displayName;var v_=Us(`inline-flex items-center rounded-xs px-2 py-0.5 font-sans text-xs font-medium transition-colors`,{variants:{variant:{default:`bg-primary/15 text-primary`,secondary:`bg-surface-container-high text-on-surface-variant`,destructive:`bg-tertiary/15 text-tertiary`,warning:`bg-secondary/15 text-secondary`,outline:`border border-[var(--ghost-border)] text-on-surface-variant`}},defaultVariants:{variant:`default`}});function X({className:e,variant:t,...n}){return(0,G.jsx)(`div`,{className:J(v_({variant:t}),e),...n})}var y_=120,b_={session:{label:`Sessions`,icon:Ha},spore:{label:`Spores`,icon:co},plan:{label:`Plans`,icon:la},prompt_batch:{label:`Prompt Batches`,icon:Gi},activity:{label:`Activities`,icon:Gi},canopy:{label:`Canopy`,icon:xa}};function x_(e){return b_[e]??{label:e,icon:Ca}}function S_(e){return e.type===`canopy`}function C_(e,t){return e.length<=t?e:e.slice(0,t)+`…`}function w_({score:e}){return(0,G.jsxs)(X,{variant:`outline`,className:`shrink-0 text-xs tabular-nums text-on-surface-variant`,children:[Math.round(e*100),`%`]})}function T_({result:e,onSelect:t,isHighlighted:n}){let{icon:r}=x_(`canopy`),i=e.path??`(unknown path)`;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(e),"data-testid":`search-result-canopy`,className:[`w-full flex items-start gap-3 px-3 py-2 text-left rounded-md transition-colors`,n?`bg-surface-container-high text-on-surface`:`hover:bg-surface-container-high hover:text-on-surface`].join(` `),children:[(0,G.jsx)(r,{className:`h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-mono truncate`,children:i}),e.language&&(0,G.jsx)(X,{variant:`secondary`,className:`shrink-0 text-[10px] uppercase tracking-wider`,children:e.language})]}),e.llm_description&&(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant mt-0.5 truncate`,children:C_(e.llm_description,y_)})]}),(0,G.jsx)(w_,{score:e.score})]})}function E_({result:e,onSelect:t,isHighlighted:n}){if(S_(e))return(0,G.jsx)(T_,{result:e,onSelect:t,isHighlighted:n});let{icon:r}=x_(e.type);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:[`w-full flex items-start gap-3 px-3 py-2 text-left rounded-md transition-colors`,n?`bg-surface-container-high text-on-surface`:`hover:bg-surface-container-high hover:text-on-surface`].join(` `),children:[(0,G.jsx)(r,{className:`h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsx)(`span`,{className:`text-sm font-medium truncate`,children:e.title})}),e.preview&&(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant mt-0.5 line-clamp-2`,children:C_(e.preview,y_)})]}),(0,G.jsx)(w_,{score:e.score})]})}function D_(e,t){return S_(e)?`canopy:${e.path??t}`:e.id??String(t)}function O_({results:e,onSelect:t,highlightedIndex:n}){let r=e.reduce((e,t)=>{let n=t.type??`unknown`;return(e[n]??=[]).push(t),e},{}),i=0;return(0,G.jsx)(`div`,{className:`py-2 space-y-1`,children:Object.entries(r).map(([e,r])=>{let{label:a}=x_(e),o=i;return i+=r.length,(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`px-3 py-1`,children:(0,G.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-on-surface-variant`,children:a})}),r.map((e,r)=>(0,G.jsx)(E_,{result:e,onSelect:t,isHighlighted:n===o+r},D_(e,o+r)))]},e)})})}var k_=2,A_=3e4;function j_(e){let t=Math.floor(Date.now()/1e3);switch(e){case`24h`:return t-1440*60;case`7d`:return t-10080*60;case`30d`:return t-720*60*60;default:return}}function M_(e,t,n){let r=new URLSearchParams({q:e,mode:t});if(t===`semantic`&&n){n.namespace&&n.namespace!==`all`&&r.set(`namespace`,n.namespace),n.observationType&&n.observationType!==`all`&&r.set(`observation_type`,n.observationType);let e=j_(n.recentWindow??`any`);e!==void 0&&r.set(`since`,String(e))}return`/search?${r.toString()}`}function N_(e,t){let n=new URLSearchParams({q:e,type:`canopy`});return t?.language&&n.set(`language`,t.language),`/search?${n.toString()}`}function P_(e,t=`semantic`,n){return ot({queryKey:xs([`search`,e,t,n?.namespace??`all`,n?.observationType??`all`,n?.recentWindow??`any`]),queryFn:({signal:r})=>q(M_(e,t,n),{signal:r}),enabled:e.length>k_,staleTime:A_})}function F_(e,t,n=!0){return ot({queryKey:xs([`search-canopy`,e,t?.language??`all`]),queryFn:async({signal:n})=>{let r=await q(N_(e,t),{signal:n});return{mode:r.mode,results:(r.results??[]).map(e=>({...e,type:`canopy`})),provider_unavailable:r.provider_unavailable}},enabled:n&&e.length>k_,staleTime:A_})}var I_=300,L_=20,R_=[{value:`all`,label:`All`},{value:`sessions`,label:`Sessions`},{value:`spores`,label:`Spores`},{value:`plans`,label:`Plans`},{value:`skills`,label:`Skills`},{value:`canopy`,label:`Canopy`}];function z_(e){switch(e){case`sessions`:return`sessions`;case`spores`:return`spores`;case`plans`:return`plans`;case`skills`:return`skill_records`;default:return`all`}}var B_=[{value:`any`,label:`Any time`},{value:`24h`,label:`24 hours`},{value:`7d`,label:`7 days`},{value:`30d`,label:`30 days`}],V_=[{value:`all`,label:`All spore types`},{value:`decision`,label:`Decision`},{value:`gotcha`,label:`Gotcha`},{value:`discovery`,label:`Discovery`},{value:`bug_fix`,label:`Bug fix`},{value:`trade_off`,label:`Trade-off`},{value:`cross-cutting`,label:`Cross-cutting`}];function H_(e){return e.path?`/cortex?tab=canopy§ion=entries&path=${encodeURIComponent(e.path)}`:`/cortex?tab=canopy§ion=entries`}function U_(e){if(e.type===`canopy`)return H_(e);let t=e;switch(t.type){case`session`:return`/sessions/${t.id}`;case`spore`:return`/mycelium?tab=spores&spore=${encodeURIComponent(t.id)}`;case`plan`:return t.session_id?`/sessions/${t.session_id}?tab=plans&plan=${encodeURIComponent(t.id)}`:`/sessions`;case`prompt_batch`:return t.session_id?`/sessions/${t.session_id}`:`/sessions`;case`activity`:return t.session_id?`/sessions/${t.session_id}`:`/sessions`;case`skill`:return`/skills?skill=${encodeURIComponent(t.id)}`;default:return`/`}}function W_({open:e,onOpenChange:t}){let n=Nn(),[r,i]=(0,W.useState)(``),[a,o]=(0,W.useState)(``),[s,c]=(0,W.useState)(`semantic`),[l,u]=(0,W.useState)(`all`),[d,f]=(0,W.useState)(`all`),[p,m]=(0,W.useState)(`any`),[h,g]=(0,W.useState)(0),_=(0,W.useRef)(null),v=l===`canopy`,y=z_(l);(0,W.useEffect)(()=>{let e=setTimeout(()=>{o(r.trim())},I_);return()=>clearTimeout(e)},[r]),(0,W.useEffect)(()=>{e&&(i(``),o(``),u(`all`),f(`all`),m(`any`),g(0),setTimeout(()=>_.current?.focus(),50))},[e]);let{data:b,isLoading:x}=P_(a,s,s===`semantic`?{namespace:y,observationType:y===`spores`||y===`all`?d:`all`,recentWindow:p}:void 0),{data:S,isLoading:C}=F_(a,void 0,v),w=v?S:b,T=v?C:x,E=(0,W.useMemo)(()=>v?(S?.results??[]).slice(0,L_):(b?.results??[]).slice(0,L_),[v,S,b]);(0,W.useEffect)(()=>{g(0)},[E.length,a]);let D=(0,W.useCallback)(e=>{let r=U_(e);t(!1),n(r)},[n,t]),O=(0,W.useCallback)(e=>{if(E.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),g(e=>Math.min(e+1,E.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),g(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=E[h];t&&D(t)}}},[E,h,D]),k=a.length>2&&!T&&E.length===0,A=a.length<=2&&!T;return(0,G.jsx)(Lf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Vf,{className:`max-w-2xl p-0 gap-0 overflow-hidden`,onKeyDown:O,children:[(0,G.jsx)(Wf,{className:`sr-only`,children:`Search vault`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--ghost-border)] pl-4 pr-12 py-3`,children:[(0,G.jsx)(no,{className:`h-4 w-4 shrink-0 text-on-surface-variant`}),(0,G.jsx)(Kf,{ref:_,value:r,onChange:e=>i(e.target.value),placeholder:`Search sessions, spores, plans…`,className:`border-0 shadow-none focus-visible:ring-0 px-0 h-auto text-base bg-surface-bright font-mono`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,G.jsx)(__,{size:`sm`,pressed:s===`semantic`,onPressedChange:()=>c(`semantic`),"aria-label":`Semantic search`,title:`Semantic (embedded knowledge)`,children:`Semantic`}),(0,G.jsx)(__,{size:`sm`,pressed:s===`fts`,onPressedChange:()=>c(`fts`),"aria-label":`Full-text search`,title:`Full text (raw data)`,children:`Full Text`})]})]}),(s===`semantic`||v)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-[var(--ghost-border)] px-4 py-2 bg-surface-container-lowest/30`,children:[(0,G.jsx)(`div`,{className:`w-[132px]`,children:(0,G.jsxs)(c_,{value:l,onValueChange:e=>u(e),children:[(0,G.jsx)(u_,{className:`h-8 text-xs`,"aria-label":`Facet`,children:(0,G.jsx)(l_,{placeholder:`Scope`})}),(0,G.jsx)(d_,{children:R_.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})}),!v&&(0,G.jsx)(`div`,{className:`w-[132px]`,children:(0,G.jsxs)(c_,{value:p,onValueChange:e=>m(e),children:[(0,G.jsx)(u_,{className:`h-8 text-xs`,children:(0,G.jsx)(l_,{placeholder:`Recent`})}),(0,G.jsx)(d_,{children:B_.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})}),!v&&(y===`all`||y===`spores`)&&(0,G.jsx)(`div`,{className:`w-[156px]`,children:(0,G.jsxs)(c_,{value:d,onValueChange:e=>f(e),children:[(0,G.jsx)(u_,{className:`h-8 text-xs`,children:(0,G.jsx)(l_,{placeholder:`Spore type`})}),(0,G.jsx)(d_,{children:V_.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})})]}),(0,G.jsxs)(`div`,{className:`max-h-96 overflow-y-auto`,children:[T&&a.length>2&&(0,G.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(`div`,{className:`h-4 w-32 rounded bg-muted animate-pulse`}),(0,G.jsx)(`div`,{className:`h-3 w-24 rounded bg-muted animate-pulse`}),(0,G.jsx)(`div`,{className:`h-3 w-28 rounded bg-muted animate-pulse`})]})}),A&&(0,G.jsx)(`div`,{className:`px-4 py-8 text-center text-sm text-on-surface-variant`,children:`Type to search your vault…`}),k&&(0,G.jsxs)(`div`,{className:`px-4 py-8 text-center text-sm text-on-surface-variant`,children:[`No results for `,(0,G.jsxs)(`span`,{className:`font-medium text-on-surface`,children:[`"`,a,`"`]})]}),E.length>0&&!T&&(0,G.jsx)(O_,{results:E,onSelect:D,highlightedIndex:h})]}),(0,G.jsxs)(`div`,{className:`border-t border-[var(--ghost-border)] px-4 py-2 flex items-center gap-4 text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`kbd`,{className:`font-mono`,children:`↑↓`}),` navigate`]}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`kbd`,{className:`font-mono`,children:`↵`}),` open`]}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`kbd`,{className:`font-mono`,children:`Esc`}),` close`]}),(0,G.jsx)(`span`,{className:`ml-auto`,children:w?.mode&&E.length>0&&`${E.length} result${E.length===1?``:`s`} · ${w.mode}`})]})]})})}function G_(){return Ts({queryKey:[`maintenance-summary`],queryFn:({signal:e})=>q(`/maintenance/summary`,{signal:e}),refetchInterval:Es.STATS,pollCategory:`standard`})}function K_(){return Ts({queryKey:[`projects-activity`],queryFn:({signal:e})=>q(`/projects/activity`,{signal:e}),refetchInterval:Es.STATS,pollCategory:`standard`})}var q_=3600,J_=86400,Y_=1e3;function X_(e){return e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/q_)}h ${Math.floor(e%q_/60)}m`:`${Math.floor(e/J_)}d ${Math.floor(e%J_/q_)}h`}function Z_(e){let t=(Date.now()-new Date(e).getTime())/Y_;return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/q_)}h ago`:`${Math.floor(t/J_)}d ago`}function Q_(e){return Z_(new Date(e*Y_).toISOString())}function $_(e){return new Date(e*Y_).toLocaleString()}function ev(e,t){return e?e.length>t?e.slice(0,t)+`…`:e:``}function tv(e){return e?e.slice(0,8):``}function nv(e){return e.split(`/`).pop()||e}function rv(e){return e.charAt(0).toUpperCase()+e.slice(1)}function iv(e,t){if(e===null||t===null)return`—`;let n=(t-e)*Y_;return n<Y_?`${n}ms`:n<60*Y_?`${(n/Y_).toFixed(1)}s`:`${Math.floor(n/(60*Y_))}m ${Math.floor(n%(60*Y_)/Y_)}s`}function av(e){return e===null?`—`:e<Y_?`${e}ms`:`${(e/Y_).toFixed(1)}s`}function ov(e){return e===null?`—`:Q_(e)}var sv=1024,cv=[`KB`,`MB`,`GB`,`TB`];function lv(e){if(e<sv)return`${e} B`;let t=e/sv,n=0;for(;t>=sv&&n<cv.length-1;)t/=sv,n++;let r=t>=100?0:1;return`${t.toFixed(r)} ${cv[n]}`}function uv({collapsed:e=!1}){let t=gs(),{data:n}=fs(),{data:r}=K_(),i=Nn(),a=An(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(``),u=(0,W.useRef)(null),d=n?.groves??[],f=d.reduce((e,t)=>e+t.projects.length,0),p=(0,W.useMemo)(()=>t?null:Lo(d),[t,d]),m=t??p,h=(0,W.useMemo)(()=>{let e=new Map;for(let t of r?.projects??[])e.set(t.project_id,t.last_activity_at);return e},[r]),g=e=>{let t=h.get(e);return t?Date.parse(t):0},_=(0,W.useMemo)(()=>{let e=c.trim().toLowerCase(),t=(e,t)=>g(t.project_id)-g(e.project_id);return d.map(n=>{let r=e?n.projects.filter(t=>`${n.name} ${t.name}`.toLowerCase().includes(e)):n.projects;return{...n,projects:[...r].sort(t)}}).filter(t=>t.projects.length>0||!e)},[d,c,h]);if((0,W.useEffect)(()=>{if(!o)return;let e=e=>{u.current?.contains(e.target)||s(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[o]),!m)return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(`/groves`),className:J(`flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,e?`justify-center px-2 py-2`:`gap-3 px-3 py-2`),children:[(0,G.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center rounded-md bg-primary/15 text-xs font-semibold text-primary`,children:`M`}),!e&&(0,G.jsx)(`span`,{className:`truncate`,children:`Select project`})]});let v=zo(m.project.project_id),y=f>1,b=(e,t)=>{i(Mo({grove:e,project:t},No(a.pathname))),s(!1),l(``)};return(0,G.jsxs)(`div`,{ref:u,className:`relative px-2 pb-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>y&&s(e=>!e),title:e?m.project.name:void 0,className:J(`flex w-full items-center rounded-md text-sm transition-colors`,y?`hover:bg-surface-container-high`:`cursor-default`,e?`justify-center px-0 py-1.5`:`gap-2 px-2 py-2 text-left`),children:[(0,G.jsx)(dv,{project:m.project,color:v}),!e&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-on-surface`,children:m.project.name}),(0,G.jsx)(`span`,{className:`block truncate text-[11px] text-on-surface-variant`,children:m.grove.name})]}),y&&(0,G.jsx)($i,{className:`h-4 w-4 text-on-surface-variant`})]})]}),o&&(0,G.jsxs)(`div`,{className:`absolute left-2 top-full z-50 mt-1 w-72 rounded-md border border-outline-variant/30 bg-surface-container-high p-2 shadow-lg`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface px-2 py-1.5 text-sm`,children:[(0,G.jsx)(no,{className:`h-4 w-4 text-on-surface-variant`}),(0,G.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),autoFocus:!0,placeholder:`Find project`,className:`min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-on-surface-variant`})]}),(0,G.jsx)(`div`,{className:`mt-2 max-h-80 overflow-auto`,children:_.map(e=>(0,G.jsxs)(`div`,{className:`py-1`,children:[(0,G.jsx)(`div`,{className:`px-2 py-1 text-[11px] font-medium uppercase tracking-wide text-on-surface-variant`,children:e.name}),e.projects.map(t=>{let n=m.grove.id===e.id&&m.project.project_id===t.project_id,r=h.get(t.project_id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>b(e,t),className:J(`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm transition-colors`,n?`bg-primary/10 text-primary`:`text-on-surface hover:bg-surface-container`),children:[(0,G.jsx)(dv,{project:t,color:zo(t.project_id)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.name}),n?(0,G.jsx)(Qi,{className:`h-4 w-4 shrink-0`}):r?(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] text-on-surface-variant`,children:Z_(r)}):null]},t.project_id)})]},e.id))})]})]})}function dv({project:e,color:t}){return(0,G.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-xs font-semibold text-white`,style:{backgroundColor:t},"aria-hidden":`true`,children:Ro(e.name)})}var fv=Es.LOGS;function pv(e){let t=e?.includeDaemon?`/notifications/unread-count?include_daemon=1`:`/notifications/unread-count`;return Ts({queryKey:[`notifications`,`unread-count`,{includeDaemon:!!e?.includeDaemon}],queryFn:({signal:e})=>q(t,{signal:e}),refetchInterval:fv,pollCategory:`standard`})}function mv(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.domain&&t.set(`domain`,e.domain),e?.mode&&t.set(`mode`,e.mode),e?.limit&&t.set(`limit`,String(e.limit)),e?.includeDaemon&&t.set(`include_daemon`,`1`);let n=t.toString(),r=n?`/notifications?${n}`:`/notifications`;return Ts({queryKey:[`notifications`,`list`,e],queryFn:({signal:e})=>q(r,{signal:e}),enabled:e?.enabled,pollCategory:e?.pollCategory??`standard`,refetchInterval:e?.refetchInterval??!1})}function hv(){return ot({queryKey:[`notifications`,`registry`],queryFn:({signal:e})=>q(`/notifications/registry`,{signal:e}),staleTime:6e4})}function gv(){let e=We();return st({mutationFn:({id:e,status:t})=>q(`/notifications/${e}`,{method:`PATCH`,body:JSON.stringify({status:t}),headers:{"Content-Type":`application/json`}}),onSuccess:()=>{e.invalidateQueries({queryKey:[`notifications`]})}})}function _v(){let e=We();return st({mutationFn:e=>ts(`/notifications/dismiss-all`,e?{domain:e}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`notifications`]})}})}function vv(){let e=We();return st({mutationFn:e=>ts(`/notifications/mark-all-read`,e?{domain:e}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`notifications`]})}})}var yv=3,bv=5e3,xv=12,Sv=400,Cv=`notification-banner`,wv={info:`bg-primary/10 border-primary/20 text-primary`,success:`bg-green-500/10 border-green-500/20 text-green-600 dark:text-green-400`,warning:`bg-secondary/10 border-secondary/20 text-secondary`,error:`bg-tertiary/10 border-tertiary/20 text-tertiary`},Tv={info:Ma,success:oa,warning:_o,error:ra};function Ev({panelOpen:e=!1}){let{data:t}=mv({status:`unread`,mode:`banner`,limit:yv,pollCategory:`realtime`,refetchInterval:Es.LOGS,includeDaemon:!0}),n=gv(),r=Nn(),[i,a]=(0,W.useState)(new Set),o=(t?.items??[]).filter(e=>!i.has(e.id));if((0,W.useEffect)(()=>{let e=[];for(let t of o)e.push(setTimeout(()=>{a(e=>new Set(e).add(t.id)),n.mutate({id:t.id,status:`read`})},bv));return()=>e.forEach(clearTimeout)},[o.map(e=>e.id).join(`,`)]),o.length===0)return null;let s=e=>{n.mutate({id:e.id,status:`read`}),a(t=>new Set(t).add(e.id)),e.link&&r(e.link,{state:{source:Cv,triggeredAt:Date.now()}})},c=(e,t)=>{e.stopPropagation(),a(e=>new Set(e).add(t.id)),n.mutate({id:t.id,status:`read`})};return(0,G.jsx)(`div`,{className:`fixed top-3 z-[60] flex w-80 flex-col gap-2`,style:{right:e?Sv:xv},children:o.map(e=>{let t=Tv[e.level];return(0,G.jsxs)(`div`,{onClick:()=>s(e),className:J(`flex items-start gap-2 rounded-md border px-3 py-2.5 text-sm shadow-lg cursor-pointer transition-all animate-in slide-in-from-right-5 fade-in duration-200`,wv[e.level]),children:[(0,G.jsx)(t,{className:`h-4 w-4 mt-0.5 shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-medium truncate`,children:e.title}),e.message&&(0,G.jsx)(`div`,{className:`text-xs mt-0.5 opacity-80 line-clamp-2`,children:e.message})]}),(0,G.jsx)(`button`,{onClick:t=>c(t,e),className:`shrink-0 rounded p-0.5 opacity-60 hover:opacity-100 transition-opacity`,"aria-label":`Dismiss`,children:(0,G.jsx)(So,{className:`h-3.5 w-3.5`})})]},e.id)})})}function Dv(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Ov=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Av={};function jv(e,t){return((t||Av).jsx?kv:Ov).test(e)}var Mv=/[ \t\n\f\r]/g;function Nv(e){return typeof e==`object`?e.type===`text`?Pv(e.value):!1:Pv(e)}function Pv(e){return e.replace(Mv,``)===``}var Fv=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Fv.prototype.normal={},Fv.prototype.property={},Fv.prototype.space=void 0;function Iv(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Fv(n,r,t)}function Lv(e){return e.toLowerCase()}var Rv=class{constructor(e,t){this.attribute=t,this.property=e}};Rv.prototype.attribute=``,Rv.prototype.booleanish=!1,Rv.prototype.boolean=!1,Rv.prototype.commaOrSpaceSeparated=!1,Rv.prototype.commaSeparated=!1,Rv.prototype.defined=!1,Rv.prototype.mustUseProperty=!1,Rv.prototype.number=!1,Rv.prototype.overloadedBoolean=!1,Rv.prototype.property=``,Rv.prototype.spaceSeparated=!1,Rv.prototype.space=void 0;var zv=s({boolean:()=>Vv,booleanish:()=>Hv,commaOrSpaceSeparated:()=>Kv,commaSeparated:()=>Gv,number:()=>Z,overloadedBoolean:()=>Uv,spaceSeparated:()=>Wv}),Bv=0,Vv=qv(),Hv=qv(),Uv=qv(),Z=qv(),Wv=qv(),Gv=qv(),Kv=qv();function qv(){return 2**++Bv}var Jv=Object.keys(zv),Yv=class extends Rv{constructor(e,t,n,r){let i=-1;if(super(e,t),Xv(this,`space`,r),typeof n==`number`)for(;++i<Jv.length;){let e=Jv[i];Xv(this,Jv[i],(n&zv[e])===zv[e])}}};Yv.prototype.defined=!0;function Xv(e,t,n){n&&(e[t]=n)}function Zv(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Yv(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Lv(r)]=r,n[Lv(a.attribute)]=r}return new Fv(t,n,e.space)}var Qv=Zv({properties:{ariaActiveDescendant:null,ariaAtomic:Hv,ariaAutoComplete:null,ariaBusy:Hv,ariaChecked:Hv,ariaColCount:Z,ariaColIndex:Z,ariaColSpan:Z,ariaControls:Wv,ariaCurrent:null,ariaDescribedBy:Wv,ariaDetails:null,ariaDisabled:Hv,ariaDropEffect:Wv,ariaErrorMessage:null,ariaExpanded:Hv,ariaFlowTo:Wv,ariaGrabbed:Hv,ariaHasPopup:null,ariaHidden:Hv,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Wv,ariaLevel:Z,ariaLive:null,ariaModal:Hv,ariaMultiLine:Hv,ariaMultiSelectable:Hv,ariaOrientation:null,ariaOwns:Wv,ariaPlaceholder:null,ariaPosInSet:Z,ariaPressed:Hv,ariaReadOnly:Hv,ariaRelevant:null,ariaRequired:Hv,ariaRoleDescription:Wv,ariaRowCount:Z,ariaRowIndex:Z,ariaRowSpan:Z,ariaSelected:Hv,ariaSetSize:Z,ariaSort:null,ariaValueMax:Z,ariaValueMin:Z,ariaValueNow:Z,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function $v(e,t){return t in e?e[t]:t}function ey(e,t){return $v(e,t.toLowerCase())}var ty=Zv({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Gv,acceptCharset:Wv,accessKey:Wv,action:null,allow:null,allowFullScreen:Vv,allowPaymentRequest:Vv,allowUserMedia:Vv,alt:null,as:null,async:Vv,autoCapitalize:null,autoComplete:Wv,autoFocus:Vv,autoPlay:Vv,blocking:Wv,capture:null,charSet:null,checked:Vv,cite:null,className:Wv,cols:Z,colSpan:null,content:null,contentEditable:Hv,controls:Vv,controlsList:Wv,coords:Z|Gv,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Vv,defer:Vv,dir:null,dirName:null,disabled:Vv,download:Uv,draggable:Hv,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Vv,formTarget:null,headers:Wv,height:Z,hidden:Uv,high:Z,href:null,hrefLang:null,htmlFor:Wv,httpEquiv:Wv,id:null,imageSizes:null,imageSrcSet:null,inert:Vv,inputMode:null,integrity:null,is:null,isMap:Vv,itemId:null,itemProp:Wv,itemRef:Wv,itemScope:Vv,itemType:Wv,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Vv,low:Z,manifest:null,max:null,maxLength:Z,media:null,method:null,min:null,minLength:Z,multiple:Vv,muted:Vv,name:null,nonce:null,noModule:Vv,noValidate:Vv,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:Vv,optimum:Z,pattern:null,ping:Wv,placeholder:null,playsInline:Vv,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Vv,referrerPolicy:null,rel:Wv,required:Vv,reversed:Vv,rows:Z,rowSpan:Z,sandbox:Wv,scope:null,scoped:Vv,seamless:Vv,selected:Vv,shadowRootClonable:Vv,shadowRootDelegatesFocus:Vv,shadowRootMode:null,shape:null,size:Z,sizes:null,slot:null,span:Z,spellCheck:Hv,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Z,step:null,style:null,tabIndex:Z,target:null,title:null,translate:null,type:null,typeMustMatch:Vv,useMap:null,value:Hv,width:Z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Wv,axis:null,background:null,bgColor:null,border:Z,borderColor:null,bottomMargin:Z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Vv,declare:Vv,event:null,face:null,frame:null,frameBorder:null,hSpace:Z,leftMargin:Z,link:null,longDesc:null,lowSrc:null,marginHeight:Z,marginWidth:Z,noResize:Vv,noHref:Vv,noShade:Vv,noWrap:Vv,object:null,profile:null,prompt:null,rev:null,rightMargin:Z,rules:null,scheme:null,scrolling:Hv,standby:null,summary:null,text:null,topMargin:Z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Z,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Vv,disableRemotePlayback:Vv,prefix:null,property:null,results:Z,security:null,unselectable:null},space:`html`,transform:ey}),ny=Zv({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:Kv,accentHeight:Z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Z,amplitude:Z,arabicForm:null,ascent:Z,attributeName:null,attributeType:null,azimuth:Z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Z,by:null,calcMode:null,capHeight:Z,className:Wv,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:Z,diffuseConstant:Z,direction:null,display:null,dur:null,divisor:Z,dominantBaseline:null,download:Vv,dx:null,dy:null,edgeMode:null,editable:null,elevation:Z,enableBackground:null,end:null,event:null,exponent:Z,externalResourcesRequired:null,fill:null,fillOpacity:Z,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:Gv,g2:Gv,glyphName:Gv,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Z,horizOriginX:Z,horizOriginY:Z,id:null,ideographic:Z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Z,k:Z,k1:Z,k2:Z,k3:Z,k4:Z,kernelMatrix:Kv,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Z,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:Z,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:Z,overlineThickness:Z,paintOrder:null,panose1:null,path:null,pathLength:Z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Wv,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Z,pointsAtY:Z,pointsAtZ:Z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Kv,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Kv,rev:Kv,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Kv,requiredFeatures:Kv,requiredFonts:Kv,requiredFormats:Kv,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:Z,specularExponent:Z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Z,strikethroughThickness:Z,string:null,stroke:null,strokeDashArray:Kv,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Z,strokeOpacity:Z,strokeWidth:null,style:null,surfaceScale:Z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Kv,tabIndex:Z,tableValues:null,target:null,targetX:Z,targetY:Z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Kv,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Z,underlineThickness:Z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Z,values:null,vAlphabetic:Z,vMathematical:Z,vectorEffect:null,vHanging:Z,vIdeographic:Z,version:null,vertAdvY:Z,vertOriginX:Z,vertOriginY:Z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:$v}),ry=Zv({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()}}),iy=Zv({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:ey}),ay=Zv({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),oy={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`},sy=/[A-Z]/g,cy=/-[a-z]/g,ly=/^data[-\w.:]+$/i;function uy(e,t){let n=Lv(t),r=t,i=Rv;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&ly.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(cy,fy);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!cy.test(e)){let n=e.replace(sy,dy);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Yv}return new i(r,t)}function dy(e){return`-`+e.toLowerCase()}function fy(e){return e.charAt(1).toUpperCase()}var py=Iv([Qv,ty,ry,iy,ay],`html`),my=Iv([Qv,ny,ry,iy,ay],`svg`);function hy(e){return e.join(` `).trim()}var gy=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
56
|
-
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),_y=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(gy());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),vy=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),yy=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(_y()),r=vy();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),by=Sy(`end`),xy=Sy(`start`);function Sy(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Cy(e){let t=xy(e),n=by(e);if(t&&n)return{start:t,end:n}}function wy(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ey(e.position):`start`in e||`end`in e?Ey(e):`line`in e||`column`in e?Ty(e):``}function Ty(e){return Dy(e&&e.line)+`:`+Dy(e&&e.column)}function Ey(e){return Ty(e&&e.start)+`-`+Ty(e&&e.end)}function Dy(e){return e&&typeof e==`number`?e:1}var Oy=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=wy(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Oy.prototype.file=``,Oy.prototype.name=``,Oy.prototype.reason=``,Oy.prototype.message=``,Oy.prototype.stack=``,Oy.prototype.column=void 0,Oy.prototype.line=void 0,Oy.prototype.ancestors=void 0,Oy.prototype.cause=void 0,Oy.prototype.fatal=void 0,Oy.prototype.place=void 0,Oy.prototype.ruleId=void 0,Oy.prototype.source=void 0;var ky=l(yy(),1),Ay={}.hasOwnProperty,jy=new Map,My=/[A-Z]/g,Ny=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Py=new Set([`td`,`th`]);function Fy(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Ky(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Gy(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?my:py,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Iy(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Iy(e,t,n){if(t.type===`element`)return Ly(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Ry(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return By(e,t,n);if(t.type===`mdxjsEsm`)return zy(e,t);if(t.type===`root`)return Vy(e,t,n);if(t.type===`text`)return Hy(e,t)}function Ly(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=my,e.schema=i),e.ancestors.push(t);let a=Qy(e,t.tagName,!1),o=qy(e,t),s=Yy(e,t);return Ny.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Nv(e):!0})),Uy(e,o,a,t),Wy(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ry(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}$y(e,t.position)}function zy(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);$y(e,t.position)}function By(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=my,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Qy(e,t.name,!0),o=Jy(e,t),s=Yy(e,t);return Uy(e,o,a,t),Wy(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Vy(e,t,n){let r={};return Wy(r,Yy(e,t)),e.create(t,e.Fragment,r,n)}function Hy(e,t){return t.value}function Uy(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Wy(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Gy(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Ky(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=xy(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function qy(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Ay.call(t.properties,i)){let a=Xy(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Py.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Jy(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else $y(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else $y(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Yy(e,t){let n=[],r=-1,i=e.passKeys?new Map:jy;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Iy(e,a,o);s!==void 0&&n.push(s)}return n}function Xy(e,t,n){let r=uy(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Dv(n):hy(n)),r.property===`style`){let t=typeof n==`object`?n:Zy(e,String(n));return e.stylePropertyNameCase===`css`&&(t=eb(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?oy[r.property]||r.property:r.attribute,n]}}function Zy(e,t){try{return(0,ky.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Oy("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function Qy(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=jv(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=jv(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Ay.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);$y(e)}function $y(e,t){let n=new Oy("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=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function eb(e){let t={},n;for(n in e)Ay.call(e,n)&&(t[tb(n)]=e[n]);return t}function tb(e){let t=e.replace(My,nb);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function nb(e){return`-`+e.toLowerCase()}var rb={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`]},ib={};function ab(e,t){let n=t||ib;return ob(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function ob(e,t,n){if(cb(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 sb(e.children,t,n)}return Array.isArray(e)?sb(e,t,n):``}function sb(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=ob(e[i],t,n);return r.join(``)}function cb(e){return!!(e&&typeof e==`object`)}var lb=document.createElement(`i`);function ub(e){let t=`&`+e+`;`;lb.innerHTML=t;let n=lb.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function db(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function fb(e,t){return e.length>0?(db(e,e.length,0,t),e):t}var pb={}.hasOwnProperty;function mb(e){let t={},n=-1;for(;++n<e.length;)hb(t,e[n]);return t}function hb(e,t){let n;for(n in t){let r=(pb.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){pb.call(r,a)||(r[a]=[]);let e=i[a];gb(r[a],Array.isArray(e)?e:e?[e]:[])}}}function gb(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);db(e,0,0,r)}function _b(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function vb(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var yb=jb(/[A-Za-z]/),bb=jb(/[\dA-Za-z]/),xb=jb(/[#-'*+\--9=?A-Z^-~]/);function Sb(e){return e!==null&&(e<32||e===127)}var Cb=jb(/\d/),wb=jb(/[\dA-Fa-f]/),Tb=jb(/[!-/:-@[-`{-~]/);function Eb(e){return e!==null&&e<-2}function Db(e){return e!==null&&(e<0||e===32)}function Ob(e){return e===-2||e===-1||e===32}var kb=jb(/\p{P}|\p{S}/u),Ab=jb(/\s/);function jb(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Mb(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&bb(e.charCodeAt(n+1))&&bb(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Nb(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Ob(r)?(e.enter(n),s(r)):t(r)}function s(r){return Ob(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Pb={tokenize:Fb};function Fb(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Nb(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Eb(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Ib={tokenize:Rb},Lb={tokenize:zb};function Rb(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return db(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Lb,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Lb,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Eb(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;db(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function zb(e,t,n){return Nb(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Bb(e){if(e===null||Db(e)||Ab(e))return 1;if(kb(e))return 2}function Vb(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Hb={name:`attention`,resolveAll:Ub,tokenize:Wb};function Ub(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Gb(d,-c),Gb(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=fb(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=fb(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=fb(l,Vb(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=fb(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=fb(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,db(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Wb(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Bb(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Bb(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Gb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Kb={name:`autolink`,tokenize:qb};function qb(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return yb(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||bb(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||bb(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Sb(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):xb(t)?(e.consume(t),l):n(t)}function u(e){return bb(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||bb(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Jb={partial:!0,tokenize:Yb};function Yb(e,t,n){return r;function r(t){return Ob(t)?Nb(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Eb(e)?t(e):n(e)}}var Xb={continuation:{tokenize:Qb},exit:$b,name:`blockQuote`,tokenize:Zb};function Zb(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Ob(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Qb(e,t,n){let r=this;return i;function i(t){return Ob(t)?Nb(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Xb,t,n)(r)}}function $b(e){e.exit(`blockQuote`)}var ex={name:`characterEscape`,tokenize:tx};function tx(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Tb(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var nx={name:`characterReference`,tokenize:rx};function rx(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=bb,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=wb,u):(e.enter(`characterReferenceValue`),a=7,o=Cb,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===bb&&!ub(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var ix={partial:!0,tokenize:sx},ax={concrete:!0,name:`codeFenced`,tokenize:ox};function ox(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Ob(t)?Nb(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Eb(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(ix,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Eb(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Ob(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Nb(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Eb(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Eb(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Ob(t)?Nb(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Eb(t)?e.check(ix,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Eb(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Ob(t)?Nb(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Ob(t)?Nb(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Eb(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function sx(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var cx={name:`codeIndented`,tokenize:ux},lx={partial:!0,tokenize:dx};function ux(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Nb(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Eb(t)?e.attempt(lx,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Eb(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function dx(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Eb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Nb(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Eb(e)?i(e):n(e)}}var fx={name:`codeText`,previous:mx,resolve:px,tokenize:hx};function px(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 mx(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function hx(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Eb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Eb(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var gx=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&_x(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),_x(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),_x(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);_x(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);_x(this.left,t.reverse())}}};function _x(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 vx(e){let t={},n=-1,r,i,a,o,s,c,l,u=new gx(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,yx(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return db(e,0,1/0,u.slice(0)),!l}function yx(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var bx={resolve:Sx,tokenize:Cx},xx={partial:!0,tokenize:wx};function Sx(e){return vx(e),e}function Cx(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Eb(t)?e.check(xx,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function wx(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Nb(e,a,`linePrefix`)}function a(i){if(i===null||Eb(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Tx(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Sb(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Eb(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Db(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Sb(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Ex(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Eb(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Eb(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Ob(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Dx(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Eb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Nb(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Eb(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Ox(e,t){let n;return r;function r(i){return Eb(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Ob(i)?Nb(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var kx={name:`definition`,tokenize:jx},Ax={partial:!0,tokenize:Mx};function jx(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Ex.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=vb(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Db(t)?Ox(e,l)(t):l(t)}function l(t){return Tx(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Ax,d,d)(t)}function d(t){return Ob(t)?Nb(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Eb(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Mx(e,t,n){return r;function r(t){return Db(t)?Ox(e,i)(t):n(t)}function i(t){return Dx(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Ob(t)?Nb(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Eb(e)?t(e):n(e)}}var Nx={name:`hardBreakEscape`,tokenize:Px};function Px(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Eb(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Fx={name:`headingAtx`,resolve:Ix,tokenize:Lx};function Ix(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},db(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Lx(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Db(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Eb(n)?(e.exit(`atxHeading`),t(n)):Ob(n)?Nb(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Db(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Rx=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),zx=[`pre`,`script`,`style`,`textarea`],Bx={concrete:!0,name:`htmlFlow`,resolveTo:Ux,tokenize:Wx},Vx={partial:!0,tokenize:Kx},Hx={partial:!0,tokenize:Gx};function Ux(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 Wx(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):yb(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):yb(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return yb(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Db(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&zx.includes(l)?(i=1,r.interrupt?t(s):O(s)):Rx.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||bb(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Ob(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||yb(t)?(e.consume(t),b):Ob(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||bb(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Ob(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Ob(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Eb(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Db(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Ob(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Eb(t)?O(t):Ob(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):Eb(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Vx,R,k)(t)):t===null||Eb(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Hx,A,R)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Eb(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return zx.includes(n)?(e.consume(t),L):O(t)}return yb(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||Eb(t)?(e.exit(`htmlFlowData`),R(t)):(e.consume(t),L)}function R(n){return e.exit(`htmlFlow`),t(n)}}function Gx(e,t,n){let r=this;return i;function i(t){return Eb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Kx(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Jb,t,n)}}var qx={name:`htmlText`,tokenize:Jx};function Jx(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):yb(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):yb(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Eb(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Eb(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):Eb(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Eb(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return yb(t)?(e.consume(t),S):n(t)}function S(t){return t===45||bb(t)?(e.consume(t),S):C(t)}function C(t){return Eb(t)?(o=C,N(t)):Ob(t)?(e.consume(t),C):M(t)}function w(t){return t===45||bb(t)?(e.consume(t),w):t===47||t===62||Db(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||yb(t)?(e.consume(t),E):Eb(t)?(o=T,N(t)):Ob(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||bb(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Eb(t)?(o=D,N(t)):Ob(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Eb(t)?(o=O,N(t)):Ob(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):Eb(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Db(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Db(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return Ob(t)?Nb(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var Yx={name:`labelEnd`,resolveAll:$x,resolveTo:eS,tokenize:tS},Xx={tokenize:nS},Zx={tokenize:rS},Qx={tokenize:iS};function $x(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&db(e,0,e.length,n),e}function eS(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=fb(s,e.slice(a+1,a+r+3)),s=fb(s,[[`enter`,u,t]]),s=fb(s,Vb(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=fb(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=fb(s,e.slice(o+1)),s=fb(s,[[`exit`,c,t]]),db(e,a,e.length,s),e}function tS(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(vb(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Xx,u,o?u:d)(t):t===91?e.attempt(Zx,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Qx,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function nS(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Db(t)?Ox(e,a)(t):a(t)}function a(t){return t===41?u(t):Tx(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Db(t)?Ox(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Dx(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Db(t)?Ox(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function rS(e,t,n){let r=this;return i;function i(t){return Ex.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(vb(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function iS(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var aS={name:`labelStartImage`,resolveAll:Yx.resolveAll,tokenize:oS};function oS(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var sS={name:`labelStartLink`,resolveAll:Yx.resolveAll,tokenize:cS};function cS(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var lS={name:`lineEnding`,tokenize:uS};function uS(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Nb(e,t,`linePrefix`)}}var dS={name:`thematicBreak`,tokenize:fS};function fS(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Eb(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Ob(t)?Nb(e,s,`whitespace`)(t):s(t))}}var pS={continuation:{tokenize:_S},exit:yS,name:`list`,tokenize:gS},mS={partial:!0,tokenize:bS},hS={partial:!0,tokenize:vS};function gS(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Cb(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(dS,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Cb(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Jb,r.interrupt?n:u,e.attempt(mS,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Ob(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function _S(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Jb,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Nb(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Ob(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(hS,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Nb(e,e.attempt(pS,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function vS(e,t,n){let r=this;return Nb(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function yS(e){e.exit(this.containerState.type)}function bS(e,t,n){let r=this;return Nb(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Ob(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var xS={name:`setextUnderline`,resolveTo:SS,tokenize:CS};function SS(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function CS(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Ob(t)?Nb(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Eb(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var wS={tokenize:TS};function TS(e){let t=this,n=e.attempt(Jb,r,e.attempt(this.parser.constructs.flowInitial,i,Nb(e,e.attempt(this.parser.constructs.flow,i,e.attempt(bx,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var ES={resolveAll:AS()},DS=kS(`string`),OS=kS(`text`);function kS(e){return{resolveAll:AS(e===`text`?jS:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function AS(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function jS(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var MS=s({attentionMarkers:()=>BS,contentInitial:()=>PS,disable:()=>VS,document:()=>NS,flow:()=>IS,flowInitial:()=>FS,insideSpan:()=>zS,string:()=>LS,text:()=>RS}),NS={42:pS,43:pS,45:pS,48:pS,49:pS,50:pS,51:pS,52:pS,53:pS,54:pS,55:pS,56:pS,57:pS,62:Xb},PS={91:kx},FS={[-2]:cx,[-1]:cx,32:cx},IS={35:Fx,42:dS,45:[xS,dS],60:Bx,61:xS,95:dS,96:ax,126:ax},LS={38:nx,92:ex},RS={[-5]:lS,[-4]:lS,[-3]:lS,33:aS,38:nx,42:Hb,60:[Kb,qx],91:sS,92:[Nx,ex],93:Yx,95:Hb,96:fx},zS={null:[Hb,ES]},BS={null:[42,95]},VS={null:[]};function HS(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=fb(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Vb(a,l.events,l),l.events):[]}function f(e,t){return WS(p(e),t)}function p(e){return US(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Eb(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&db(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function US(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function WS(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
57
|
-
`;break;case-3:o=`\r
|
|
58
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function GS(e){let t={constructs:mb([MS,...(e||{}).extensions||[]]),content:n(Pb),defined:[],document:n(Ib),flow:n(wS),lazy:{},string:n(DS),text:n(OS)};return t;function n(e){return n;function n(n){return HS(t,e,n)}}}function KS(e){for(;!vx(e););return e}var qS=/[\0\t\n\r]/g;function JS(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(qS.lastIndex=u,c=qS.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var YS=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function XS(e){return e.replace(YS,ZS)}function ZS(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return _b(n.slice(t?2:1),t?16:10)}return ub(n)||e}var QS={}.hasOwnProperty;function $S(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),eC(n)(KS(GS(n).document().write(JS()(e,t,!0))))}function eC(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(de),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(se),blockQuote:a(U),characterEscape:T,characterReference:T,codeFenced:a(re),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(re,o),codeText:a(ie,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ae),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(oe),hardBreakEscape:a(ce),hardBreakTrailing:a(ce),htmlFlow:a(le,o),htmlFlowData:T,htmlText:a(le,o),htmlTextData:T,image:a(ue),label:o,link:a(de),listItem:a(pe),listItemValue:f,listOrdered:a(fe,d),listUnordered:a(fe),paragraph:a(me),reference:ee,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(se),strong:a(he),thematicBreak:a(_e)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ne,autolinkProtocol:te,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:B,characterReferenceMarkerNumeric:B,characterReferenceValue:V,characterReference:H,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:z,resourceDestinationString:I,resourceTitleString:L,resource:R,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};nC(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];QS.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||iC).call(a,void 0,e[0])}for(r.position={start:tC(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:tC(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:tC(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||iC).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+wy({start:e.start,end:e.end})+`): it’s not open`);n.position.end=tC(e.end)}function u(){return ab(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=vb(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=ge(),n.position={start:tC(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=tC(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=tC(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=XS(t),n.identifier=vb(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function R(){this.data.inReference=void 0}function ee(){this.data.referenceType=`collapsed`}function z(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=vb(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function B(e){this.data.characterReferenceType=e.type}function V(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=_b(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=ub(t);let i=this.stack[this.stack.length-1];i.value+=r}function H(e){let t=this.stack.pop();t.position.end=tC(e.end)}function te(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ne(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function U(){return{type:`blockquote`,children:[]}}function re(){return{type:`code`,lang:null,meta:null,value:``}}function ie(){return{type:`inlineCode`,value:``}}function ae(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function oe(){return{type:`emphasis`,children:[]}}function se(){return{type:`heading`,depth:0,children:[]}}function ce(){return{type:`break`}}function le(){return{type:`html`,value:``}}function ue(){return{type:`image`,title:null,url:``,alt:null}}function de(){return{type:`link`,title:null,url:``,children:[]}}function fe(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function pe(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function me(){return{type:`paragraph`,children:[]}}function he(){return{type:`strong`,children:[]}}function ge(){return{type:`text`,value:``}}function _e(){return{type:`thematicBreak`}}}function tC(e){return{line:e.line,column:e.column,offset:e.offset}}function nC(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?nC(e,r):rC(e,r)}}function rC(e,t){let n;for(n in t)if(QS.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function iC(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+wy({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+wy({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+wy({start:t.start,end:t.end})+`) is still open`)}function aC(e){let t=this;t.parser=n;function n(n){return $S(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function oC(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function sC(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
59
|
-
`}]}function cC(e,t){let n=t.value?t.value+`
|
|
60
|
-
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function lC(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uC(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dC(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Mb(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function fC(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pC(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function mC(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function hC(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return mC(e,t);let i={src:Mb(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function gC(e,t){let n={src:Mb(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function _C(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function vC(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return mC(e,t);let i={href:Mb(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function yC(e,t){let n={href:Mb(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function bC(e,t,n){let r=e.all(t),i=n?xC(n):SC(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
61
|
-
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
62
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function xC(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=SC(n[r])}return t}function SC(e){return e.spread??e.children.length>1}function CC(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function wC(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TC(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function EC(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DC(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=xy(t.children[1]),o=by(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function OC(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function kC(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var AC=9,jC=32;function MC(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(NC(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(NC(t.slice(i),i>0,!1)),a.join(``)}function NC(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===AC||t===jC;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===AC||t===jC;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function PC(e,t){let n={type:`text`,value:MC(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function FC(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var IC={blockquote:oC,break:sC,code:cC,delete:lC,emphasis:uC,footnoteReference:dC,heading:fC,html:pC,imageReference:hC,image:gC,inlineCode:_C,linkReference:vC,link:yC,listItem:bC,list:CC,paragraph:wC,root:TC,strong:EC,table:DC,tableCell:kC,tableRow:OC,text:PC,thematicBreak:FC,toml:LC,yaml:LC,definition:LC,footnoteDefinition:LC};function LC(){}var RC=typeof self==`object`?self:globalThis,zC=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new RC[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new RC[a](o),i)};return r},BC=e=>zC(new Map,e)(0),VC=``,{toString:HC}={},{keys:UC}=Object,WC=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=HC.call(e).slice(8,-1);switch(n){case`Array`:return[1,VC];case`Object`:return[2,VC];case`Date`:return[3,VC];case`RegExp`:return[4,VC];case`Map`:return[5,VC];case`Set`:return[6,VC];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},GC=([e,t])=>e===0&&(t===`function`||t===`symbol`),KC=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=WC(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of UC(r))(e||!GC(WC(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(GC(WC(n))||GC(WC(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!GC(WC(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},qC=(e,{json:t,lossy:n}={})=>{let r=[];return KC(!(t||n),!!t,new Map,r)(e),r},JC=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?BC(qC(e,t)):structuredClone(e):(e,t)=>BC(qC(e,t));function YC(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function XC(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function ZC(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||YC,r=e.options.footnoteBackLabel||XC,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=Mb(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...JC(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
63
|
-
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
64
|
-
`}]}}var QC=(function(e){if(e==null)return rw;if(typeof e==`function`)return nw(e);if(typeof e==`object`)return Array.isArray(e)?$C(e):ew(e);if(typeof e==`string`)return tw(e);throw Error(`Expected function, string, or object as test`)});function $C(e){let t=[],n=-1;for(;++n<e.length;)t[n]=QC(e[n]);return nw(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function ew(e){let t=e;return nw(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function tw(e){return nw(t);function t(t){return t&&t.type===e}}function nw(e){return t;function t(t,n,r){return!!(iw(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function rw(){return!0}function iw(e){return typeof e==`object`&&!!e&&`type`in e}function aw(e){return e}var ow=[];function sw(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=QC(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+aw(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=ow,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=cw(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function cw(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?ow:[e]}function lw(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),sw(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var uw={}.hasOwnProperty,dw={};function fw(e,t){let n=t||dw,r=new Map,i=new Map,a={all:s,applyData:mw,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...IC,...n.handlers},one:o,options:n,patch:pw,wrap:gw};return lw(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(uw.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=JC(n);return r.children=a.all(e),r}return JC(e)}return(a.options.unknownHandler||hw)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=_w(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=_w(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function pw(e,t){e.position&&(t.position=Cy(e))}function mw(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,JC(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function hw(e,t){let n=t.data||{},r=`value`in t&&!(uw.call(n,`hProperties`)||uw.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 gw(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
65
|
-
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
66
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
67
|
-
`}),n}function _w(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function vw(e,t){let n=fw(e,t),r=n.one(e,void 0),i=ZC(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
68
|
-
`},i)),a}function yw(e,t){return e&&`run`in e?async function(n,r){let i=vw(n,{file:r,...t});await e.run(i,r)}:function(n,r){return vw(n,{file:r,...e||t})}}function bw(e){if(e)throw e}var xw=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Sw(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Cw(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?ww(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function ww(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var Tw={basename:Ew,dirname:Dw,extname:Ow,join:kw,sep:`/`};function Ew(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Mw(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Dw(e){if(Mw(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Ow(e){Mw(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function kw(...e){let t=-1,n;for(;++t<e.length;)Mw(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Aw(n)}function Aw(e){Mw(e);let t=e.codePointAt(0)===47,n=jw(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function jw(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Mw(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Nw={cwd:Pw};function Pw(){return`/`}function Fw(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Iw(e){if(typeof e==`string`)e=new URL(e);else if(!Fw(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Lw(e)}function Lw(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Rw=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],zw=class{constructor(e){let t;t=e?Fw(e)?{path:e}:typeof e==`string`||Uw(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Nw.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Rw.length;){let e=Rw[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Rw.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Tw.basename(this.path):void 0}set basename(e){Vw(e,`basename`),Bw(e,`basename`),this.path=Tw.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Tw.dirname(this.path):void 0}set dirname(e){Hw(this.basename,`dirname`),this.path=Tw.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Tw.extname(this.path):void 0}set extname(e){if(Bw(e,`extname`),Hw(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=Tw.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Fw(e)&&(e=Iw(e)),Vw(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Tw.basename(this.path,this.extname):void 0}set stem(e){Vw(e,`stem`),Bw(e,`stem`),this.path=Tw.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Oy(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Bw(e,t){if(e&&e.includes(Tw.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Tw.sep+"`")}function Vw(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Hw(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Uw(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Ww=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Gw=l(xw(),1),Kw={}.hasOwnProperty,qw=new class e extends Ww{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=Cw()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Gw.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Xw(`data`,this.frozen),this.namespace[e]=t,this):Kw.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Xw(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=$w(e),n=this.parser||this.Parser;return Jw(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Jw(`process`,this.parser||this.Parser),Yw(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=$w(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);tT(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Jw(`processSync`,this.parser||this.Parser),Yw(`processSync`,this.compiler||this.Compiler),this.process(e,r),Qw(`processSync`,`process`,t),n;function r(e,r){t=!0,bw(e),n=r}}run(e,t,n){Zw(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=$w(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Qw(`runSync`,`run`,n),r;function i(e,t){bw(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=$w(t),r=this.compiler||this.Compiler;return Yw(`stringify`,r),Zw(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Xw(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,Gw.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Sw(o)&&Sw(r)&&(r=(0,Gw.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Jw(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Yw(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Xw(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Zw(e){if(!Sw(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Qw(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function $w(e){return eT(e)?e:new zw(e)}function eT(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function tT(e){return typeof e==`string`||nT(e)}function nT(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var rT=[],iT={allowDangerousHtml:!0},aT=/^(https?|ircs?|mailto|xmpp)$/i,oT=[{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 sT(e){let t=cT(e),n=lT(e);return uT(t.runSync(t.parse(n),n),e)}function cT(e){let t=e.rehypePlugins||rT,n=e.remarkPlugins||rT,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...iT}:iT;return qw().use(aC).use(n).use(yw,r).use(t)}function lT(e){let t=e.children||``,n=new zw;return typeof t==`string`?n.value=t:``+t,n}function uT(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||dT;for(let e of oT)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return lw(e,l),Fy(e,{Fragment:G.Fragment,components:i,ignoreInvalidStyle:!0,jsx:G.jsx,jsxs:G.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in rb)if(Object.hasOwn(rb,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=rb[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function dT(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||aT.test(e.slice(0,t))?e:``}function fT(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function pT(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function mT(e,t,n){let r=QC((n||{}).ignore||[]),i=hT(t),a=-1;for(;++a<i.length;)sw(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function hT(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([gT(e[0]),_T(e[1])])}return t}function gT(e){return typeof e==`string`?new RegExp(pT(e),`g`):e}function _T(e){return typeof e==`function`?e:function(){return e}}var vT=`phrasing`,yT=[`autolink`,`link`,`image`,`label`];function bT(){return{transforms:[OT],enter:{literalAutolink:ST,literalAutolinkEmail:CT,literalAutolinkHttp:CT,literalAutolinkWww:CT},exit:{literalAutolink:DT,literalAutolinkEmail:ET,literalAutolinkHttp:wT,literalAutolinkWww:TT}}}function xT(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:vT,notInConstruct:yT},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:vT,notInConstruct:yT},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:vT,notInConstruct:yT}]}}function ST(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function CT(e){this.config.enter.autolinkProtocol.call(this,e)}function wT(e){this.config.exit.autolinkProtocol.call(this,e)}function TT(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function ET(e){this.config.exit.autolinkEmail.call(this,e)}function DT(e){this.exit(e)}function OT(e){mT(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,kT],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,AT]],{ignore:[`link`,`linkReference`]})}function kT(e,t,n,r,i){let a=``;if(!NT(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!jT(n)))return!1;let o=MT(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function AT(e,t,n,r){return!NT(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function jT(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function MT(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=fT(e,`(`),a=fT(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function NT(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Ab(n)||kb(n))&&(!t||n!==47)}UT.peek=HT;function PT(){this.buffer()}function FT(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function IT(){this.buffer()}function LT(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function RT(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vb(this.sliceSerialize(e)).toLowerCase(),n.label=t}function zT(e){this.exit(e)}function BT(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vb(this.sliceSerialize(e)).toLowerCase(),n.label=t}function VT(e){this.exit(e)}function HT(){return`[`}function UT(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function WT(){return{enter:{gfmFootnoteCallString:PT,gfmFootnoteCall:FT,gfmFootnoteDefinitionLabelString:IT,gfmFootnoteDefinition:LT},exit:{gfmFootnoteCallString:RT,gfmFootnoteCall:zT,gfmFootnoteDefinitionLabelString:BT,gfmFootnoteDefinition:VT}}}function GT(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:UT},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
69
|
-
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?qT:KT))),s(),o}}function KT(e,t,n){return t===0?e:qT(e,t,n)}function qT(e,t,n){return(n?``:` `)+e}var JT=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];$T.peek=eE;function YT(){return{canContainEols:[`delete`],enter:{strikethrough:ZT},exit:{strikethrough:QT}}}function XT(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:JT}],handlers:{delete:$T}}}function ZT(e){this.enter({type:`delete`,children:[]},e)}function QT(e){this.exit(e)}function $T(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function eE(){return`~`}function tE(e){return e.length}function nE(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||tE,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=rE(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=iE(r[d]);else{let e=iE(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
70
|
-
`)}function rE(e){return e==null?``:String(e)}function iE(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function aE(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),oE);return i(),o}function oE(e,t,n){return`>`+(n?``:` `)+e}function sE(e,t){return cE(e,t.inConstruct,!0)&&!cE(e,t.notInConstruct,!1)}function cE(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 lE(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
71
|
-
`&&sE(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
72
|
-
`}function uE(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function dE(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 fE(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function pE(e,t,n,r){let i=fE(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(dE(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,mE);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(uE(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
73
|
-
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
74
|
-
`),a&&(u+=s.move(a+`
|
|
75
|
-
`)),u+=s.move(c),l(),u}function mE(e,t,n){return(n?``:` `)+e}function hE(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function gE(e,t,n,r){let i=hE(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
76
|
-
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function _E(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function vE(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function yE(e,t,n){let r=Bb(e),i=Bb(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}}bE.peek=xE;function bE(e,t,n,r){let i=_E(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=yE(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=vE(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=yE(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+vE(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function xE(e,t,n){return n.options.emphasis||`*`}function SE(e,t){let n=!1;return lw(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&ab(e)&&(t.options.setext||n))}function CE(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(SE(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
77
|
-
`,after:`
|
|
78
|
-
`});return r(),t(),o+`
|
|
79
|
-
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
80
|
-
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
81
|
-
`,...a.current()});return/^[\t ]/.test(l)&&(l=vE(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}wE.peek=TE;function wE(e){return e.value||``}function TE(){return`<`}EE.peek=DE;function EE(e,t,n,r){let i=hE(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function DE(){return`!`}OE.peek=kE;function OE(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function kE(){return`!`}AE.peek=jE;function AE(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function jE(){return"`"}function ME(e,t){let n=ab(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))}NE.peek=PE;function NE(e,t,n,r){let i=hE(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(ME(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function PE(e,t,n){return ME(e,n)?`<`:`[`}FE.peek=IE;function FE(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function IE(){return`[`}function LE(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function RE(e){let t=LE(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function zE(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function BE(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function VE(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?zE(n):LE(n),s=e.ordered?o===`.`?`)`:`.`:RE(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),BE(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function HE(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function UE(e,t,n,r){let i=HE(n),a=n.bulletCurrent||LE(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function WE(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var GE=QC([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function KE(e,t,n,r){return(e.children.some(function(e){return GE(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function qE(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}JE.peek=YE;function JE(e,t,n,r){let i=qE(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=yE(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=vE(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=yE(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+vE(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function YE(e,t,n){return n.options.strong||`*`}function XE(e,t,n,r){return n.safe(e.value,r)}function ZE(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function QE(e,t,n){let r=(BE(n)+(n.options.ruleSpaces?` `:``)).repeat(ZE(n));return n.options.ruleSpaces?r.slice(0,-1):r}var $E={blockquote:aE,break:lE,code:pE,definition:gE,emphasis:bE,hardBreak:lE,heading:CE,html:wE,image:EE,imageReference:OE,inlineCode:AE,link:NE,linkReference:FE,list:VE,listItem:UE,paragraph:WE,root:KE,strong:JE,text:XE,thematicBreak:QE};function eD(){return{enter:{table:tD,tableData:aD,tableHeader:aD,tableRow:rD},exit:{codeText:oD,table:nD,tableData:iD,tableHeader:iD,tableRow:iD}}}function tD(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function nD(e){this.exit(e),this.data.inTable=void 0}function rD(e){this.enter({type:`tableRow`,children:[]},e)}function iD(e){this.exit(e)}function aD(e){this.enter({type:`tableCell`,children:[]},e)}function oD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,sD));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function sD(e,t){return t===`|`?t:e}function cD(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
82
|
-
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
83
|
-
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return nE(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=$E.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function lD(){return{exit:{taskListCheckValueChecked:dD,taskListCheckValueUnchecked:dD,paragraph:fD}}}function uD(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:pD}}}function dD(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function fD(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function pD(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=$E.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function mD(){return[bT(),WT(),YT(),eD(),lD()]}function hD(e){return{extensions:[xT(),GT(e),XT(),cD(e),uD()]}}var gD={tokenize:AD,partial:!0},_D={tokenize:jD,partial:!0},vD={tokenize:MD,partial:!0},yD={tokenize:ND,partial:!0},bD={tokenize:PD,partial:!0},xD={name:`wwwAutolink`,tokenize:OD,previous:FD},SD={name:`protocolAutolink`,tokenize:kD,previous:ID},CD={name:`emailAutolink`,tokenize:DD,previous:LD},wD={};function TD(){return{text:wD}}for(var ED=48;ED<123;)wD[ED]=CD,ED++,ED===58?ED=65:ED===91&&(ED=97);wD[43]=CD,wD[45]=CD,wD[46]=CD,wD[95]=CD,wD[72]=[CD,SD],wD[104]=[CD,SD],wD[87]=[CD,xD],wD[119]=[CD,xD];function DD(e,t,n){let r=this,i,a;return o;function o(t){return!RD(t)||!LD.call(r,r.previous)||zD(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return RD(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(bD,u,l)(t):t===45||t===95||bb(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&yb(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function OD(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!FD.call(r,r.previous)||zD(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(gD,e.attempt(_D,e.attempt(vD,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function kD(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&ID.call(r,r.previous)&&!zD(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(yb(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||Sb(t)||Db(t)||Ab(t)||kb(t)?n(t):e.attempt(_D,e.attempt(vD,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function AD(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function jD(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(yD,c,s)(t):t===null||Db(t)||Ab(t)||t!==45&&kb(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function MD(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(yD,t,a)(o):o===null||Db(o)||Ab(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function ND(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||Db(o)||Ab(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Db(e)||Ab(e)?t(e):r(e)}function a(e){return yb(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):yb(t)?(e.consume(t),o):n(t)}}function PD(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return bb(e)?n(e):t(e)}}function FD(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Db(e)}function ID(e){return!yb(e)}function LD(e){return!(e===47||RD(e))}function RD(e){return e===43||e===45||e===46||e===95||bb(e)}function zD(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var BD={tokenize:JD,partial:!0};function VD(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:GD,continuation:{tokenize:KD},exit:qD}},text:{91:{name:`gfmFootnoteCall`,tokenize:WD},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:HD,resolveTo:UD}}}}function HD(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=vb(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function UD(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function WD(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||Db(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(vb(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Db(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function GD(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||Db(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=vb(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Db(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Nb(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function KD(e,t,n){return e.check(Jb,t,e.attempt(BD,t,n))}function qD(e){e.exit(`gfmFootnoteDefinition`)}function JD(e,t,n){let r=this;return Nb(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function YD(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&db(o,o.length,0,Vb(s,e.slice(r+1,n),t)),db(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),db(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Bb(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Bb(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var XD=class{constructor(){this.map=[]}add(e,t,n){ZD(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function ZD(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 QD(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function $D(){return{flow:{null:{name:`table`,tokenize:eO,resolveAll:tO}}}}function eO(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Eb(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Ob(t)?Nb(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||Db(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Ob(t)?Nb(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Ob(t)?Nb(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Eb(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Ob(t)?Nb(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Eb(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Eb(n)?(e.exit(`tableRow`),t(n)):Ob(n)?Nb(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Db(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function tO(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new XD;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(rO(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=nO(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=nO(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=nO(f,t,o,i,n,d)):(o[0]=o[1],d=nO(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&rO(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=QD(t.events,n))}return e}function nO(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},iO(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=iO(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=iO(t.events,n[2]),a=iO(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},iO(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function rO(e,t,n,r,i){let a=[],o=iO(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function iO(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var aO={name:`tasklistCheck`,tokenize:sO};function oO(){return{text:{91:aO}}}function sO(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return Db(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Eb(r)?t(r):Ob(r)?e.check({tokenize:cO},t,n)(r):n(r)}}function cO(e,t,n){return Nb(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function lO(e){return mb([TD(),VD(),YD(e),$D(),oO()])}var uO={};function dO(e){let t=this,n=e||uO,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(lO(n)),a.push(mD()),o.push(hD(n))}function fO({content:e,className:t,compact:n=!1}){return(0,G.jsx)(`div`,{className:J(n?`prose-myco-compact`:`prose-myco`,t),children:(0,G.jsx)(sT,{remarkPlugins:[dO],children:e})})}var pO={info:`bg-primary`,success:`bg-green-500`,warning:`bg-secondary`,error:`bg-tertiary`},mO={info:Ma,success:oa,warning:_o,error:ra},hO={unread:`New`,read:`Earlier`},gO=`notification-panel`;function _O(e){let t=Math.floor(Date.now()/1e3)-e;if(t<60)return`just now`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function vO({title:e,count:t}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-on-surface-variant`,children:e}),(0,G.jsx)(`span`,{className:`text-[11px] text-on-surface-variant/70`,children:t})]})}function yO({notification:e,onOpen:t,onDismiss:n}){let r=mO[e.level],i=e.status===`unread`;return(0,G.jsx)(`div`,{onClick:()=>t(e),className:J(`group cursor-pointer rounded-lg border border-transparent px-4 py-3 transition-colors hover:border-outline-variant/20 hover:bg-surface-container-high/70`,i&&`border-primary/10 bg-primary/[0.04]`),children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`relative mt-0.5 shrink-0`,children:[(0,G.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-surface-container-high text-on-surface-variant`,children:(0,G.jsx)(r,{className:`h-4 w-4`})}),i&&(0,G.jsx)(`span`,{className:J(`absolute -top-0.5 -right-0.5 h-2.5 w-2.5 rounded-full ring-2 ring-surface-container`,pO[e.level])})]}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:J(`text-sm font-medium`,i?`text-on-surface`:`text-on-surface-variant`),children:e.title}),(0,G.jsx)(`span`,{className:`rounded-full bg-surface-container-high px-2 py-0.5 text-[10px] uppercase tracking-wider text-on-surface-variant`,children:e.domain})]}),e.message&&(0,G.jsx)(fO,{content:e.message,compact:!0,className:`line-clamp-3 text-xs leading-5 text-on-surface-variant`})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[(0,G.jsx)(`span`,{className:`pt-0.5 text-[10px] font-mono text-on-surface-variant/70`,children:_O(e.created_at)}),(0,G.jsx)(`button`,{onClick:t=>n(t,e),className:`rounded p-0.5 text-on-surface-variant/40 opacity-0 transition hover:text-on-surface-variant group-hover:opacity-100`,"aria-label":`Dismiss`,children:(0,G.jsx)(So,{className:`h-3.5 w-3.5`})})]})]})})]})})}function bO({open:e,onClose:t}){let{data:n,refetch:r}=mv({limit:50,enabled:e,pollCategory:`realtime`,refetchInterval:Es.LOGS}),i=gv(),a=vv(),o=_v(),s=Nn();(0,W.useEffect)(()=>{e&&r()},[e,r]),(0,W.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]);let c=(0,W.useCallback)(e=>{e.status===`unread`&&i.mutate({id:e.id,status:`read`}),e.link&&(s(e.link,{state:{source:gO,triggeredAt:Date.now()}}),t())},[i,s,t]),l=(0,W.useCallback)((e,t)=>{e.stopPropagation(),i.mutate({id:t.id,status:`dismissed`})},[i]),u=(n?.items??[]).filter(e=>e.status!==`dismissed`),d=n?.unread_count??0,f=u.filter(e=>e.status===`unread`),p=u.filter(e=>e.status!==`unread`);return(0,G.jsxs)(G.Fragment,{children:[e&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-40 bg-surface-dim/40 backdrop-blur-xs transition-opacity`,onClick:t,"aria-hidden":`true`}),(0,G.jsxs)(`aside`,{className:J(`fixed top-0 right-0 bottom-0 z-50 flex w-96 max-w-[calc(100vw-3rem)] flex-col border-l border-outline-variant/20 bg-surface-container shadow-2xl transition-transform duration-200 ease-out`,e?`translate-x-0`:`translate-x-full`),children:[(0,G.jsxs)(`div`,{className:`border-b border-outline-variant/20 px-4 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ji,{className:`h-4 w-4 shrink-0 text-primary`}),(0,G.jsx)(`h2`,{className:`min-w-0 text-sm font-medium text-on-surface`,children:`Notifications`}),d>0&&(0,G.jsx)(`span`,{className:`inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full bg-primary/15 px-1.5 text-xs font-medium text-primary`,children:d})]})}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`h-7 shrink-0 px-2`,children:(0,G.jsx)(So,{className:`h-4 w-4`})})]}),(d>0||u.length>0)&&(0,G.jsxs)(`div`,{className:`mt-3 flex items-center justify-end gap-1 border-t border-outline-variant/10 pt-3`,children:[d>0&&(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:e=>{e.stopPropagation(),a.mutate(void 0)},title:`Mark all as read`,className:`h-7 gap-1 px-2 text-xs text-on-surface-variant`,children:[(0,G.jsx)(za,{className:`h-3.5 w-3.5`}),`Mark all read`]}),u.length>0&&(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:e=>{e.stopPropagation(),o.mutate(void 0)},title:`Clear all notifications`,className:`h-7 gap-1 px-2 text-xs text-on-surface-variant`,children:[(0,G.jsx)(ho,{className:`h-3.5 w-3.5`}),`Clear`]})]})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:u.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,G.jsx)(Ji,{className:`h-5 w-5 text-on-surface-variant/50`}),(0,G.jsx)(`div`,{className:`text-sm text-on-surface-variant`,children:`No notifications yet`}),(0,G.jsx)(`div`,{className:`text-xs text-on-surface-variant/70`,children:`New events will appear here whether they display as banners or summary-only items.`})]}):(0,G.jsxs)(`div`,{className:`space-y-4 px-3 py-3`,children:[f.length>0&&(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(vO,{title:hO.unread,count:f.length}),(0,G.jsx)(`div`,{className:`space-y-2`,children:f.map(e=>(0,G.jsx)(yO,{notification:e,onOpen:c,onDismiss:l},e.id))})]}),p.length>0&&(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(vO,{title:hO.read,count:p.length}),(0,G.jsx)(`div`,{className:`space-y-2`,children:p.map(e=>(0,G.jsx)(yO,{notification:e,onOpen:c,onDismiss:l},e.id))})]})]})})]})]})}function xO(e){return Array.isArray(e)?e:e?e.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(e=>e.length>0):[]}function SO(e,t){let n=xO(t),r=e;for(let e of n){if(r==null)return;if(Array.isArray(r)){let t=Number(e);if(!Number.isInteger(t))return;r=r[t];continue}if(typeof r!=`object`)return;r=r[e]}return r}function CO(e,t,n){let r=xO(t);if(r.length===0)return;let i=e;for(let e=0;e<r.length-1;e+=1){let t=r[e],n=i[t];(typeof n!=`object`||!n||Array.isArray(n))&&(i[t]={}),i=i[t]}i[r[r.length-1]]=n}var wO=[`grove-config`];function TO(e){return[...wO,e??`none`]}function EO(){let e=_s(),t=e?.grove.id??null,n=ko(e);return ot({queryKey:TO(t),queryFn:({signal:e})=>q(`/grove-config`,{signal:e,headers:n}),enabled:t!==null})}function DO(){let e=We(),t=_s(),n=t?.grove.id??null,r=ko(t);return st({mutationFn:e=>ns(`/grove-config`,{patch:e},{headers:r}),onSuccess:()=>{e.invalidateQueries({queryKey:TO(n)}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}var OO=[`machine-config`];function kO(){return Ts({queryKey:[...OO],queryFn:({signal:e})=>q(`/machine-config`,{signal:e}),refetchInterval:!1,pollCategory:`standard`,contextFree:!0})}function AO(){let e=We();return st({mutationFn:e=>ns(`/machine-config`,{patch:e}),onSuccess:t=>{e.setQueryData([...OO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}function jO(){let e=We();return st({mutationFn:({path:e,value:t})=>ns(`/machine-config`,{addToList:[{path:e,values:[t]}]}),onSuccess:t=>{e.setQueryData([...OO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}function MO(){let e=We();return st({mutationFn:({path:e,value:t})=>ns(`/machine-config`,{removeFromList:[{path:e,values:[t]}]}),onSuccess:t=>{e.setQueryData([...OO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}var NO=[`config`,`merged`],PO=[`config`,`local`],FO=[`notifications`];function IO(e){let t=We(),n=DO(),r=AO(),i=e?Po(e):`none`,a=(0,W.useMemo)(()=>ko(e),[e?.grove.id,e?.project.project_id]),o=ot({queryKey:[...NO,i],queryFn:({signal:e})=>as(e,a)}),s=ot({queryKey:[...PO,i],queryFn:({signal:e})=>os(e,a)}),c=(0,W.useRef)(o.data);c.current=o.data;let l=(0,W.useRef)(s.data);l.current=s.data;let u=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:FO})},[t]),d=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:PO}),t.invalidateQueries({queryKey:NO}),u()},[u,t]),f=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:NO}),u()},[u,t]),p=(0,W.useCallback)(e=>e===`local`?d():f(),[d,f]),m=(0,W.useCallback)(async(e,t,i)=>{let o={};CO(o,e,t),i===`grove`?(await n.mutateAsync(o),u()):i===`machine`?(await r.mutateAsync(o),u()):(await ss(i,o,void 0,a),p(i))},[a,p,u,n,r]),h=(0,W.useCallback)(async(e,t,i)=>{let o={};for(let{path:t,value:n}of e)CO(o,t,n);t===`grove`?(await n.mutateAsync(o),u()):t===`machine`?(await r.mutateAsync(o),u()):(await ss(t,o,i,a),p(t))},[a,p,u,n,r]),g=(0,W.useCallback)(async e=>{await cs([e],a),d()},[a,d]),_=(0,W.useCallback)(async e=>{e.length!==0&&(await cs(e,a),d())},[a,d]),v=(0,W.useCallback)(async e=>{let t=SO(c.current??{},e),n={};CO(n,e,t),await ss(`project`,n,void 0,a),await cs([e],a),d()},[a,d]),y=(0,W.useCallback)(e=>SO(l.current??{},e)!==void 0,[]),b=(0,W.useCallback)(async(e,n,r)=>{if(r===`machine`){let r=await ns(`/machine-config`,{addToList:[{path:e,values:[n]}]});t.setQueryData([`machine-config`],{config:r}),t.invalidateQueries({queryKey:[`config`,`merged`]});return}let i=SO(c.current??{},e),a=Array.isArray(i)?i:[];a.includes(n)||await m(e,[...a,n],r)},[t,m]),x=(0,W.useCallback)(async(e,n,r)=>{if(r===`machine`){let r=await ns(`/machine-config`,{removeFromList:[{path:e,values:[n]}]});t.setQueryData([`machine-config`],{config:r}),t.invalidateQueries({queryKey:[`config`,`merged`]});return}let i=SO(c.current??{},e);await m(e,(Array.isArray(i)?i:[]).filter(e=>e!==n),r)},[t,m]);return{effective:o.data,local:s.data??{},isLoading:o.isLoading||s.isLoading,isLocalOverride:y,setField:m,setFields:h,resetField:g,resetFields:_,promoteField:v,addToConfigList:b,removeFromConfigList:x}}function LO(){return IO(_s())}function RO(){let{effective:e}=LO(),t=e?.notifications?.system_notifications??!1,{data:n,refetch:r}=mv({status:`unread`,mode:`banner`,limit:5,enabled:t,pollCategory:`heartbeat`,refetchInterval:Es.PROGRESS,includeDaemon:!0}),i=(0,W.useRef)(new Set);return(0,W.useEffect)(()=>{t&&`Notification`in window&&Notification.permission==="default"&&Notification.requestPermission()},[t]),(0,W.useEffect)(()=>{if(!t||!(`Notification`in window)||Notification.permission!==`granted`||document.hasFocus())return;let e=n?.items??[];for(let t of e)i.current.has(t.id)||(i.current.add(t.id),zO(t))},[t,n]),(0,W.useEffect)(()=>{if(!t)return;let e=()=>{(document.hidden||!document.hasFocus())&&r()};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`blur`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`blur`,e)}},[t,r]),null}function zO(e){try{new window.Notification(e.title,{body:e.message??void 0,tag:e.id,icon:`/favicon.svg`})}catch{}}var BO=[`sage`,`moss`,`terracotta`,`dusk`,`plum`,`slate`],VO=[`light`,`dark`,`system`],HO=[`default`,`geist-mono`,`system`,`sf-mono`,`fira-code`,`jetbrains-mono`],UO=[`compact`,`normal`,`comfy`],WO=`myco-appearance`,GO={compact:.85,normal:1,comfy:1.15},KO={default:{heading:`'Newsreader', Georgia, serif`,ui:`'Inter', system-ui, sans-serif`,data:`'JetBrains Mono', 'Fira Code', monospace`},"geist-mono":{heading:`'Geist Mono', 'SF Mono', 'Fira Code', monospace`,ui:`'Geist Mono', 'SF Mono', 'Fira Code', monospace`,data:`'Geist Mono', 'SF Mono', 'Fira Code', monospace`},system:{heading:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`,ui:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`,data:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`},"sf-mono":{heading:`'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace`,ui:`'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace`,data:`'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace`},"fira-code":{heading:`'Fira Code', 'Fira Mono', ui-monospace, monospace`,ui:`'Fira Code', 'Fira Mono', ui-monospace, monospace`,data:`'Fira Code', 'Fira Mono', ui-monospace, monospace`},"jetbrains-mono":{heading:`'JetBrains Mono', ui-monospace, monospace`,ui:`'JetBrains Mono', ui-monospace, monospace`,data:`'JetBrains Mono', ui-monospace, monospace`}},qO=`(prefers-color-scheme: light)`;function JO(e){let t=document.documentElement;t.setAttribute(`data-theme`,e.theme);let n=e.mode===`system`?window.matchMedia(qO).matches?`light`:`dark`:e.mode;t.classList.toggle(`light`,n===`light`);let r=KO[e.font];t.style.setProperty(`--font-heading`,r.heading),t.style.setProperty(`--font-ui`,r.ui),t.style.setProperty(`--font-data`,r.data);let i=GO[e.density];t.style.setProperty(`--density`,String(i)),t.style.fontSize=`calc(14px * ${i})`;let a=document.querySelector(`link[rel="icon"]`);if(a){let t=`/favicon-${e.theme}.svg`;a.href.endsWith(t)||(a.href=t)}}function YO(e){try{localStorage.setItem(WO,JSON.stringify(e))}catch{}}function XO(){let e=null;try{e=localStorage.getItem(WO)}catch{return}if(e)try{JO(JSON.parse(e))}catch{try{localStorage.removeItem(WO)}catch{}}}var ZO=(0,W.createContext)(null),QO={theme:`sage`,mode:`dark`,font:`default`,density:`normal`},$O=`(prefers-color-scheme: light)`;function ek({children:e}){let{effective:t,setField:n}=LO(),r=(0,W.useMemo)(()=>t?.appearance??QO,[t?.appearance]),i=(0,W.useRef)(r);i.current=r,(0,W.useLayoutEffect)(()=>{t?.appearance&&(JO(r),YO(r))},[r,t?.appearance]),(0,W.useEffect)(()=>{if(r.mode!==`system`)return;let e=window.matchMedia($O),t=()=>JO(r);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[r]);let a=(0,W.useCallback)(async(e,t)=>{let r=i.current,a={...r,[e]:t};JO(a),YO(a);try{await n(`appearance.${e}`,t,`grove`)}catch(e){throw JO(r),YO(r),e}},[n]),o=(0,W.useMemo)(()=>({effective:r,set:a}),[r,a]);return(0,G.jsx)(ZO.Provider,{value:o,children:e})}function tk(){let e=(0,W.useContext)(ZO);if(!e)throw Error(`useAppearance must be used inside AppearanceProvider`);return e}var nk=[`cortex`,`canopy`,`skills`,`vault_evolution`],rk={capture:{home:`machine`,overridableBy:[]},machine_id:{home:`machine`,overridableBy:[]},"daemon.stale_session_threshold_ms":{home:`grove`,overridableBy:[]},"daemon.log_level":{home:`machine`,overridableBy:[]},"daemon.log_retention_days":{home:`machine`,overridableBy:[]},"daemon.update_channel":{home:`machine`,overridableBy:[]},"update.channel":{home:`machine`,overridableBy:[]},notifications:{home:`machine`,overridableBy:[`local`]},embedding:{home:`grove`,overridableBy:[]},appearance:{home:`grove`,overridableBy:[]},team:{home:`grove`,overridableBy:[]},agent:{home:`grove`,overridableBy:[`local`]},"agent.scheduled_tasks_enabled":{home:`grove`,overridableBy:[]},"agent.event_tasks_enabled":{home:`grove`,overridableBy:[]},skills:{home:`grove`,overridableBy:[`local`],gate:`skills`},vault_evolution:{home:`grove`,overridableBy:[`local`],gate:`vault_evolution`},maintenance:{home:`grove`,overridableBy:[`local`]},backup:{home:`grove`,overridableBy:[]},release_provenance:{home:`project`,overridableBy:[]},"release_provenance.reconcile_interval_minutes":{home:`grove`,overridableBy:[`project`,`local`]},cortex:{home:`project`,overridableBy:[`local`],gate:`cortex`},"cortex.canopy":{home:`project`,overridableBy:[`local`],gate:`canopy`},symbionts:{home:`project`,overridableBy:[`local`]},version:{home:`project`,overridableBy:[]},config_version:{home:`project`,overridableBy:[]}},ik=Object.keys(rk).sort((e,t)=>t.length-e.length);function ak(e){for(let t of ik)if(e===t||e.startsWith(`${t}.`))return rk[t];throw Error(`No scope registry entry for config path: ${e}`)}var ok={machine:`Machine`,grove:`Grove`,project:`Project`,local:`Personal`},sk={machine:`Every Grove on this machine`,grove:`Every project in this Grove`,project:`This project, shared via the repo`,local:`Personal — this project, on this machine (not shared via git)`},ck={personal:`Personal`,project:`Project`,grove:`Grove`,"all-groves":`All Groves`,machine:`Machine`},lk={personal:`This setting is overridden on this machine`,project:`This setting is using the shared project value`,grove:`This setting applies to every project in this Grove`,"all-groves":`This view aggregates every Grove on this machine`,machine:`This setting applies to every Grove on this machine`},uk={personal:`border-sage/40 bg-sage/5 text-sage`,project:`border-[var(--ghost-border)] bg-surface-container/40 text-on-surface-variant`,grove:`border-ochre/40 bg-ochre/5 text-ochre`,"all-groves":`border-terracotta/40 bg-terracotta/5 text-terracotta`,machine:`border-terracotta/40 bg-terracotta/5 text-terracotta`};function dk({scope:e}){let t=ck[e];return(0,G.jsxs)(`span`,{title:lk[e],className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${uk[e]}`,children:[(0,G.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full ${e===`personal`?`bg-sage`:`bg-outline-variant/80`}`,"aria-hidden":!0}),t]})}var fk={machine:`machine`,grove:`grove`,project:`project`,local:`personal`};function pk({path:e,hasLocalOverride:t,onSavePersonal:n,onReset:r}){let[i,a]=(0,W.useState)(!1),o=(0,W.useRef)(null);(0,W.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=ak(e),c=fk[s.home]??`project`,l=t?`personal`:c,u=t?lk.personal:sk[s.home]??lk[c],d=ok[s.home]??ck[c];return(0,G.jsxs)(`span`,{ref:o,className:`relative inline-block`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-haspopup":`menu`,"aria-expanded":i,title:u,className:`cursor-pointer transition-colors hover:bg-sage/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 rounded-sm`,children:(0,G.jsx)(dk,{scope:l})}),i&&(0,G.jsx)(`div`,{role:`menu`,className:`absolute left-0 top-full z-10 mt-1 w-44 rounded-md border border-[var(--ghost-border)] bg-surface-container-high p-1 text-xs shadow-lg`,children:t?(0,G.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r(),a(!1)},className:`block w-full rounded px-2 py-1 text-left hover:bg-surface-container-highest focus-visible:outline-none focus-visible:bg-surface-container-highest`,children:[`Reset to `,d]}):(0,G.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{n(),a(!1)},className:`block w-full rounded px-2 py-1 text-left hover:bg-surface-container-highest focus-visible:outline-none focus-visible:bg-surface-container-highest`,children:`Save Personal`})})]})}var mk={sage:{label:`Sage`,swatch:`#abcfb8`},moss:{label:`Moss`,swatch:`#9ca884`},terracotta:{label:`Terracotta`,swatch:`#d28a73`},dusk:{label:`Dusk`,swatch:`#8faed1`},plum:{label:`Plum`,swatch:`#b59ec8`},slate:{label:`Slate`,swatch:`#a6b0b8`}},hk={light:{icon:fo,label:`Light`},dark:{icon:Wa,label:`Dark`},system:{icon:Ua,label:`System`}},gk={default:`Default`,"geist-mono":`Geist`,system:`System`,"sf-mono":`SF Mono`,"fira-code":`Fira Code`,"jetbrains-mono":`JetBrains`},_k=`myco-ui-appearance-expanded`;function vk(){let e=typeof window<`u`?localStorage.getItem(_k):null;return e===null?!0:e===`true`}function yk({collapsed:e}){let{effective:t,set:n}=tk(),[r,i]=(0,W.useState)(vk);(0,W.useEffect)(()=>{localStorage.setItem(_k,String(r))},[r]);let a=(e,t)=>{n(e,t).catch(e=>console.error(`[appearance] grove write failed`,e))};if(e)return null;let o=(e,t,n)=>(0,G.jsxs)(`div`,{id:Fi(`appearance.${t}`),"data-config-field":`appearance.${t}`,className:`rounded-md transition-all duration-300`,children:[(0,G.jsxs)(`div`,{className:`flex items-center text-xs text-on-surface-variant`,children:[e,(0,G.jsx)(dk,{scope:`grove`})]}),n]});return(0,G.jsxs)(`div`,{id:Pi.appearance,className:`rounded-md border border-[var(--ghost-border)] p-3 ${r?`space-y-3`:``}`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`-m-1 flex flex-1 items-center gap-1.5 rounded p-1 text-left hover:bg-surface-container-high`,"aria-expanded":r,"aria-label":r?`Collapse appearance section`:`Expand appearance section`,children:[(0,G.jsx)($i,{className:`h-3 w-3 text-on-surface-variant transition-transform ${r?``:`-rotate-90`}`}),(0,G.jsx)(`h3`,{className:`text-[10px] uppercase tracking-[0.22em] text-on-surface-variant`,children:`Appearance`})]})}),r&&(0,G.jsxs)(G.Fragment,{children:[o(`Color theme`,`theme`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-6 gap-1.5`,children:BO.map(e=>{let n=mk[e];return(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(`theme`,e),title:n.label,"aria-label":n.label,className:`relative aspect-square rounded-md border ${t.theme===e?`border-primary`:`border-[var(--ghost-border)]`}`,style:{backgroundColor:n.swatch},children:t.theme===e&&(0,G.jsx)(Qi,{className:`absolute inset-0 m-auto h-3 w-3 text-on-surface`})},e)})})),o(`Mode`,`mode`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-3 gap-1.5`,children:VO.map(e=>{let{icon:n,label:r}=hk[e];return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>a(`mode`,e),className:`flex items-center justify-center gap-1 rounded-md border py-1 text-xs ${t.mode===e?`border-primary text-on-surface`:`border-[var(--ghost-border)] text-on-surface-variant`}`,"aria-label":r,children:[(0,G.jsx)(n,{className:`h-3 w-3`}),` `,r]},e)})})),o(`Font`,`font`,(0,G.jsx)(`select`,{value:t.font,onChange:e=>a(`font`,e.target.value),className:`mt-2 h-8 w-full rounded-md border border-[var(--ghost-border)] bg-[var(--surface-container-lowest)] px-2 text-xs`,children:HO.map(e=>(0,G.jsx)(`option`,{value:e,children:gk[e]},e))})),o(`Density`,`density`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-3 gap-1.5`,children:UO.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(`density`,e),className:`rounded-md border py-1 text-xs capitalize ${t.density===e?`border-primary text-on-surface`:`border-[var(--ghost-border)] text-on-surface-variant`}`,children:e},e))}))]})]})}function bk(){return Ts({queryKey:[`git-identity`],queryFn:({signal:e})=>q(`/git/status`,{signal:e}),refetchInterval:Es.GIT_IDENTITY,pollCategory:`standard`})}function xk(e){if(!e)return`?`;let t=e.trim();if(!t)return`?`;let n=t.split(/\s+/),r=n[0]??``;if(n.length===1)return r.slice(0,2).toUpperCase();let i=n[n.length-1]??``;return((r[0]??``)+(i[0]??``)).toUpperCase()}function Sk({data:e,isPending:t,isError:n,to:r,className:i}){if(t||n||!e)return(0,G.jsxs)(`button`,{type:`button`,disabled:!0,"data-testid":`git-identity-pill`,className:J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 text-on-surface-variant`,i),title:n?`Failed to load git state`:`Loading git state`,children:[(0,G.jsx)(ka,{className:`h-3 w-3`}),(0,G.jsx)(`span`,{className:`font-mono text-xs`,children:`—`})]});let a=xk(e.author),o=`${e.author} <${e.author_email}> · ${e.branch}${e.dirty?` (dirty)`:``}`,s=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ka,{className:`h-3 w-3 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex flex-col items-start leading-tight`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:e.branch}),(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant inline-flex items-center gap-1`,children:[e.dirty&&(0,G.jsx)(`span`,{title:`working tree dirty`,className:`text-secondary`,children:`●`}),e.ahead>0&&(0,G.jsxs)(`span`,{title:`ahead of upstream`,children:[`↑`,e.ahead]}),e.behind>0&&(0,G.jsxs)(`span`,{title:`behind upstream`,children:[`↓`,e.behind]}),(0,G.jsx)(`span`,{children:e.author})]})]}),(0,G.jsx)(`span`,{className:`ml-1 inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary/20 font-sans text-[10px] font-semibold text-primary`,children:a})]}),c=J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 no-underline hover:bg-surface-container-high transition-colors`,i);return r?(0,G.jsx)(ri,{to:r,title:`${o}. Open release provenance settings.`,"data-testid":`git-identity-pill`,className:c,children:s}):(0,G.jsx)(`button`,{type:`button`,title:o,"data-testid":`git-identity-pill`,className:c,children:s})}var Ck={sage:`bg-primary`,ochre:`bg-secondary`,terracotta:`bg-tertiary`,outline:`bg-outline-variant`};function wk({tone:e,pulse:t=!1,sizePx:n=6,className:r}){return(0,G.jsx)(`span`,{"data-testid":`status-dot`,"data-tone":e,"data-pulsing":t?`true`:`false`,className:J(`inline-block rounded-full`,Ck[e],t&&`animate-pulse`,r),style:{width:n,height:n},"aria-hidden":!0})}var Tk=[`update-status`];function Ek(){return Ts({queryKey:[...Tk],queryFn:({signal:e})=>q(`/update/status`,{signal:e}),refetchInterval:Es.UPDATE,pollCategory:`standard`,contextFree:!0})}function Dk(){let e=We();return st({mutationFn:()=>ts(`/update/check`),onSuccess:()=>{e.invalidateQueries({queryKey:[...Tk]})}})}function Ok(){return st({mutationFn:()=>ts(`/update/apply`)})}function kk(){let e=We();return st({mutationFn:e=>ns(`/update/channel`,{channel:e}),onSuccess:()=>{e.invalidateQueries({queryKey:[...Tk]})}})}function Ak(e){return e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`}function jk(e){return e.startsWith(`v`)?e:`v${e}`}function Mk({uptimeSeconds:e,version:t,updateAvailable:n=!1,latestVersion:r,to:i,className:a}){let o=n&&r?`Daemon uptime · update available: ${jk(r)}`:t?`Daemon uptime · ${jk(t)}`:`Daemon uptime`,s=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(wk,{tone:n?`ochre`:`sage`,pulse:n}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`daemon`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:e===void 0?`—`:Ak(e)}),t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`text-on-surface-variant`,children:`·`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:jk(t)})]})]}),c=J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 no-underline`,i&&`hover:bg-surface-container-high transition-colors`,a);return i?(0,G.jsx)(ri,{to:i,className:c,title:`${o}. Open update settings.`,"aria-live":`polite`,children:s}):(0,G.jsx)(`div`,{className:J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1`,a),title:o,"aria-live":`polite`,children:s})}function Nk({to:e,className:t}){let{data:n}=Fs(),r=Ek(),i=!!(r.data&&!r.data.exempt&&(r.data.update_available||r.data.revert_available));return(0,G.jsx)(Mk,{uptimeSeconds:n?.daemon.uptime_seconds,version:n?.daemon.version_label??n?.daemon.version,updateAvailable:i,latestVersion:r.data?.latest_version,to:e,className:t})}function Pk(e,t){return!t||t<=0?0:Math.floor(e/t*100)}function Fk({describedCount:e,entriesCount:t,to:n,className:r}){let i=e!==void 0&&t!==void 0,a=i?Pk(e,t):null,o=i&&a<100,s=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(wk,{tone:o?`ochre`:`sage`,pulse:o}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`cortex`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:a===null?`—`:`${a}%`})]}),c=J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 no-underline`,n&&`hover:bg-surface-container-high transition-colors`,r);return n?(0,G.jsx)(ri,{to:n,className:c,title:`Cortex (Canopy) describe coverage. Open Cortex.`,children:s}):(0,G.jsx)(`div`,{className:c,title:`Cortex (Canopy) describe coverage`,children:s})}function Ik({to:e,className:t}){let{data:n}=Fs();return(0,G.jsx)(Fk,{describedCount:n?.canopy.described_count,entriesCount:n?.canopy.entries_count,to:e,className:t})}var Lk={"/":`Dashboard`,"/sessions":`Sessions`,"/cortex":`Cortex`,"/mycelium":`Mycelium`,"/skills":`Skills`,"/agent":`Agent`,"/settings":`Settings`,"/logs":`Logs`,"/machine":`Machine`,"/groves":`Groves`};function Rk(e){let t=e,n=e.match(/^\/g\/[^/]+\/p\/[^/]+(\/.*)?$/);if(n)t=n[1]||`/`;else{let n=e.match(/^\/g\/[^/]+(\/.*)?$/);n&&(t=n[1]||`/`)}if(t===`/`)return[`Dashboard`];let r=t.split(`/`).filter(Boolean);return[Lk[`/${r[0]}`]??r[0]]}function zk({onOpenSearch:e,onOpenNotifications:t,unreadCount:n,className:r}){let i=Rk(An().pathname),a=bk(),o=vs(`/cortex`);return(0,G.jsxs)(`header`,{className:J(`sticky top-0 z-20 flex h-12 items-center gap-3 border-b border-outline-variant/20 bg-surface-container/90 backdrop-blur px-4`,r),children:[(0,G.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`flex items-center gap-1 font-sans text-xs text-on-surface-variant`,children:i.map((e,t)=>(0,G.jsxs)(`span`,{className:J(t===i.length-1&&`text-on-surface`),children:[t>0&&(0,G.jsx)(`span`,{className:`mx-1`,children:`/`}),e]},t))}),(0,G.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Search`,className:`ml-auto inline-flex h-7 items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 text-on-surface-variant hover:bg-surface-container-high transition-colors`,children:[(0,G.jsx)(no,{className:`h-3 w-3`}),(0,G.jsx)(`span`,{className:`font-sans text-xs`,children:`Search`}),(0,G.jsxs)(`kbd`,{className:`inline-flex items-center gap-0.5 font-mono text-[10px] text-on-surface-variant/70`,children:[(0,G.jsx)(fa,{className:`h-2.5 w-2.5`}),`K`]})]}),(0,G.jsx)(Nk,{to:`/settings?configSection=update#update`}),(0,G.jsx)(Ik,{to:o}),(0,G.jsx)(Sk,{data:a.data,isPending:a.isPending,isError:a.isError,to:`/settings?configSection=release-provenance#release-provenance`}),(0,G.jsxs)(`button`,{type:`button`,onClick:t,"aria-label":`Notifications`,className:`relative rounded-md p-1.5 text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface transition-colors`,children:[(0,G.jsx)(Ji,{className:`h-4 w-4`}),n>0&&(0,G.jsx)(`span`,{className:`absolute top-0.5 right-0.5 h-2 w-2 rounded-full bg-primary`})]})]})}var Bk=[`Project`,`Observability`,`Grove management`,`Settings`],Vk=[{to:`/`,label:`Dashboard`,icon:Fa,scope:`project`,category:`Project`},{to:`/sessions`,label:`Sessions`,icon:Ha,scope:`project`,category:`Project`},{to:`/agent`,label:`Agent`,icon:Xi,scope:`project`,category:`Project`},{to:`/cortex`,label:`Cortex`,icon:Zi,scope:`project`,category:`Project`},{to:`/mycelium`,label:`Mycelium`,icon:Ga,scope:`project`,category:`Project`},{to:`/skills`,label:`Skills`,icon:co,scope:`project`,category:`Project`},{to:`/g/:groveSlug/operations`,label:`Operations`,icon:Gi,scope:`grove`,category:`Observability`},{to:`/logs`,label:`Logs`,icon:to,scope:`machine`,category:`Observability`},{to:`/g/:groveSlug/dashboard`,label:`Grove`,icon:go,scope:`grove`,category:`Grove management`},{to:`/groves`,label:`Groves`,icon:Oa,scope:`machine`,category:`Grove management`},{to:`/symbionts`,label:`Symbionts`,icon:Ya,scope:`machine`,category:`Grove management`},{to:`/g/:groveSlug/team`,label:`Team`,icon:yo,scope:`grove`,category:`Grove management`},{to:`/settings`,label:`Settings`,icon:ao,scope:`machine`,category:`Settings`}],Hk=`myco-ui-sidebar-collapsed`,Uk=768,Wk=80,Gk=2e3,Kk=[`ring-2`,`ring-primary/40`,`bg-primary/5`];function qk(){let[e,t]=(0,W.useState)(()=>localStorage.getItem(Hk)===`true`);return{collapsed:e,toggle:(0,W.useCallback)(()=>{t(e=>{let t=!e;return localStorage.setItem(Hk,String(t)),t})},[])}}function Jk(){let[e,t]=(0,W.useState)(!1),[n,r]=(0,W.useState)(()=>typeof window<`u`&&window.innerWidth<Uk);return(0,W.useEffect)(()=>{let e=window.matchMedia(`(max-width: ${Uk-1}px)`),n=e=>{r(e.matches),e.matches||t(!1)};return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),(0,W.useEffect)(()=>{t(!1)},[An().pathname]),(0,W.useEffect)(()=>{if(e)return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=``}},[e]),{open:e,isMobile:n,toggle:(0,W.useCallback)(()=>t(e=>!e),[]),close:(0,W.useCallback)(()=>t(!1),[])}}function Yk({collapsed:e=!1}){let{restart:t,isRestarting:n}=Rs();return(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(),disabled:n,title:e?n?`Restarting...`:`Restart Daemon`:void 0,className:J(`text-on-surface-variant hover:text-on-surface`,e?`w-8 p-0 justify-center`:`w-full justify-start gap-2`),children:[(0,G.jsx)($a,{className:J(`h-4 w-4`,n&&`animate-spin`)}),!e&&(0,G.jsx)(`span`,{children:n?`Restarting...`:`Restart Daemon`})]})}function Xk({collapsed:e}){let{data:t}=Fs(),n=t?.daemon.runtime;if(!n||n.source===`stable`)return null;let r=n.source===`dev`,i=r?`DEV`:`BETA`,a=r?`Daemon is running from a dev binary (make dev-link / npm link).`:`Daemon is running from the managed beta runtime under ~/.myco/runtime/.`,o=r?`bg-tertiary/20 text-tertiary border-tertiary/40`:`bg-secondary/20 text-secondary border-secondary/40`;return e?(0,G.jsx)(`div`,{className:J(`mx-auto flex h-5 w-8 items-center justify-center rounded border text-[10px] font-bold tracking-wider`,o),title:a,children:i}):(0,G.jsxs)(`div`,{className:J(`mx-2 flex items-center justify-center rounded border px-2 py-1 text-[11px] font-semibold tracking-wider`,o),title:a,children:[i,` runtime`]})}function Zk({collapsed:e,onSearchOpen:t,onNotificationsOpen:n,unreadCount:r,onCollapseToggle:i,showCollapseToggle:a}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(uv,{collapsed:e}),(0,G.jsxs)(`div`,{className:`px-2 pt-2 pb-1 space-y-0.5`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:t,title:e?`Search (⌘K)`:void 0,className:J(`flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,e?`justify-center px-2 py-2`:`gap-3 px-3 py-2`),children:[(0,G.jsx)(no,{className:`h-4 w-4 shrink-0`}),!e&&(0,G.jsx)(`span`,{className:`flex-1 text-left`,children:`Search`}),!e&&(0,G.jsxs)(`kbd`,{className:`text-xs text-on-surface-variant/60 font-mono`,children:[`⌘`,`K`]})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:n,title:e?`Notifications`:void 0,className:J(`flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,e?`justify-center px-2 py-2`:`gap-3 px-3 py-2`),children:[(0,G.jsx)(Ji,{className:`h-4 w-4 shrink-0`}),!e&&(0,G.jsx)(`span`,{className:`flex-1 text-left`,children:`Notifications`}),r>0&&(0,G.jsx)(`span`,{className:J(`h-2 w-2 rounded-full bg-primary shrink-0`,!e&&`ml-auto`)})]})]}),(0,G.jsx)(`nav`,{className:`min-h-0 flex-1 space-y-1 overflow-y-auto px-2 py-2`,"aria-label":`Main navigation`,children:Bk.map(t=>{let n=Vk.filter(e=>e.category===t);return n.length===0?null:(0,G.jsx)(Qk,{label:t,collapsed:e,children:n.map(t=>(0,G.jsx)(eA,{item:t,collapsed:e},t.to))},t)})}),(0,G.jsxs)(`div`,{className:J(`py-3 space-y-2 mt-auto`,e?`px-1 flex flex-col items-center`:`px-2`),children:[(0,G.jsx)(Xk,{collapsed:e}),!e&&(0,G.jsx)(yk,{collapsed:e}),(0,G.jsx)(Yk,{collapsed:e})]}),a&&i&&(0,G.jsx)(`div`,{className:J(`px-2 py-2`,e&&`flex justify-center`),children:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,className:J(`text-on-surface-variant hover:text-on-surface`,e?`w-8 p-0 justify-center`:`w-full justify-start gap-2`),title:e?`Expand sidebar`:`Collapse sidebar`,children:[e?(0,G.jsx)(ta,{className:`h-4 w-4`}):(0,G.jsx)(ea,{className:`h-4 w-4`}),!e&&(0,G.jsx)(`span`,{children:`Collapse`})]})})]})}function Qk({label:e,collapsed:t,children:n}){return(0,G.jsxs)(`div`,{role:`group`,"aria-label":e,className:J(`space-y-0.5`,t&&`border-t border-[var(--ghost-border)] pt-3 mt-3 first:border-t-0 first:pt-0 first:mt-0`),children:[!t&&(0,G.jsx)(`div`,{className:`px-3 pt-4 pb-1 text-[10px] uppercase tracking-wider text-on-surface-variant`,children:e}),n]})}function $k(e,t,n,r){if(e.scope===`project`)return n;if(e.scope===`machine`)return e.to;if(!e.to.includes(`:groveSlug`))return n;let i=t?.grove??Lo(r)?.grove??jo(r)?.grove??r[0];return i?e.to.replace(`:groveSlug`,i.slug):`/`}function eA({item:e,collapsed:t}){return(0,G.jsxs)(ii,{to:$k(e,gs(),vs(e.to),fs().data?.groves??[]),end:e.to===`/`,title:t?e.label:void 0,className:({isActive:e})=>J(`flex items-center rounded-md text-sm font-medium transition-colors`,t?`justify-center px-2 py-2`:`gap-3 px-3 py-2`,e?`bg-primary/10 text-primary`:`text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface`),children:[(0,G.jsx)(e.icon,{className:`h-4 w-4 shrink-0`}),!t&&e.label]})}function tA(e){let t=gs();(0,W.useEffect)(()=>{let n=t?.project.name??e??null;document.title=n?`${t?`${Ro(t.project.name)} `:``}${n} - Myco`:`Myco`},[t,e])}function nA(){let{collapsed:e,toggle:t}=qk(),{data:n}=Fs(),r=gs()?.project.name??n?.context.project.name??n?.vault.name;tA(r);let[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),{data:c}=pv(),l=c?.count??0,u=Jk();(0,W.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`k`&&(e.preventDefault(),a(e=>!e))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]),(0,W.useEffect)(()=>{if(!u.open)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),u.close())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[u.open,u.close]);let d=(0,W.useCallback)(()=>a(!0),[]),f=(0,W.useCallback)(()=>s(!0),[]),p=(0,W.useCallback)(()=>s(!1),[]);return(0,W.useEffect)(()=>{let e=new URLSearchParams(location.search),t=e.get(`configField`)??void 0,n=e.get(`configSection`)??void 0;if(!t&&!n)return;let r=window.setTimeout(()=>{let e=rA(t,n);e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),e.classList.add(...Kk),window.setTimeout(()=>{e.classList.remove(...Kk)},Gk))},Wk);return()=>window.clearTimeout(r)},[location.key,location.search]),(0,G.jsxs)(`div`,{className:`flex h-screen overflow-hidden bg-background`,children:[(0,G.jsx)(W_,{open:i,onOpenChange:a}),(0,G.jsx)(Ev,{panelOpen:o}),(0,G.jsx)(bO,{open:o,onClose:p}),(0,G.jsx)(RO,{}),u.isMobile&&(0,G.jsxs)(`div`,{className:`fixed top-0 left-0 right-0 z-40 flex h-12 items-center gap-3 border-b border-outline-variant/20 bg-surface-container px-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:u.toggle,className:`rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,"aria-label":u.open?`Close navigation`:`Open navigation`,children:u.open?(0,G.jsx)(So,{className:`h-5 w-5`}):(0,G.jsx)(Va,{className:`h-5 w-5`})}),(0,G.jsx)(`span`,{className:`font-serif text-base text-primary tracking-wider`,children:`myco`}),r&&(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline uppercase tracking-widest`,children:r}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:f,className:`relative rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,"aria-label":`Notifications`,children:[(0,G.jsx)(Ji,{className:`h-4 w-4`}),l>0&&(0,G.jsx)(`span`,{className:`absolute top-0.5 right-0.5 h-2 w-2 rounded-full bg-primary`})]}),(0,G.jsx)(`button`,{type:`button`,onClick:d,className:`rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,"aria-label":`Search`,children:(0,G.jsx)(no,{className:`h-4 w-4`})})]})]}),u.isMobile&&u.open&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-40 bg-surface-dim/60 backdrop-blur-xs transition-opacity`,onClick:u.close,"aria-hidden":`true`}),u.isMobile&&(0,G.jsx)(`aside`,{className:J(`fixed top-12 left-0 bottom-0 z-50 w-64 flex flex-col bg-surface-container transition-transform duration-200 ease-out`,u.open?`translate-x-0`:`-translate-x-full`),children:(0,G.jsx)(Zk,{collapsed:!1,onSearchOpen:d,onNotificationsOpen:f,unreadCount:l,showCollapseToggle:!1})}),!u.isMobile&&(0,G.jsx)(`aside`,{className:J(`flex flex-col bg-surface-container transition-[width] duration-200`,e?`w-14`:`w-56`),children:(0,G.jsx)(Zk,{collapsed:e,onSearchOpen:d,onNotificationsOpen:f,unreadCount:l,onCollapseToggle:t,showCollapseToggle:!0})}),(0,G.jsxs)(`main`,{className:J(`flex flex-1 flex-col overflow-hidden bg-surface`,u.isMobile&&`pt-12`),"aria-label":`Page content`,children:[!u.isMobile&&(0,G.jsx)(zk,{onOpenSearch:d,onOpenNotifications:f,unreadCount:l}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,G.jsx)(cr,{})})]})]})}function rA(e,t){if(e){let t=e;for(;t.length>0;){let e=document.getElementById(Fi(t));if(e instanceof HTMLElement)return e;let n=t.lastIndexOf(`.`);if(n===-1)break;t=t.slice(0,n)}}if(t){let e=document.getElementById(t);if(e instanceof HTMLElement)return e}return null}var iA=0,aA=[],oA=new Set;function sA(){for(let e of oA)e(aA)}function cA(e){let t=++iA,n={...e,id:t};aA=[...aA,n],sA();let r=e.ttlMs??5e3;r>0&&setTimeout(()=>{aA=aA.filter(e=>e.id!==t),sA()},r)}function lA(){let[e,t]=(0,W.useState)(aA);return(0,W.useEffect)(()=>(oA.add(t),()=>{oA.delete(t)}),[]),e.length===0?null:(0,G.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`pointer-events-none fixed bottom-4 right-4 z-[60] flex w-full max-w-sm flex-col gap-2`,children:e.map(e=>(0,G.jsxs)(`div`,{className:J(`pointer-events-auto rounded-md border bg-surface-container-highest px-4 py-3 shadow-lg`,e.level===`success`&&`border-primary/30`,e.level===`error`&&`border-tertiary/40`,e.level===`info`&&`border-outline-variant/30`),children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-on-surface`,children:e.title}),e.detail&&(0,G.jsx)(`div`,{className:`mt-1 break-all font-mono text-xs text-on-surface-variant`,children:e.detail})]},e.id))})}var uA=Es.SESSIONS,dA=Es.SESSION_DETAIL,fA=Es.SESSION_DETAIL,pA=3e4,mA=6e4,hA=1e4,gA=Es.SESSION_DETAIL;function _A(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.agent&&t.set(`agent`,e.agent),e?.search&&t.set(`search`,e.search),e?.hasPlan&&t.set(`has_plan`,`true`),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset));let n=t.toString(),r=n?`/sessions?${n}`:`/sessions`;return Ts({queryKey:[`sessions`,e],queryFn:({signal:e})=>q(r,{signal:e}),pollCategory:`standard`,refetchInterval:uA})}function vA(e){return Ts({queryKey:[`session`,e],queryFn:({signal:t})=>q(`/sessions/${e}`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:dA})}function yA(e,t=[`human`]){let n=t===`all`?``:`?origins=${t.join(`,`)}`;return Ts({queryKey:[`session-batches`,e,t===`all`?`all`:[...t].sort().join(`,`)],queryFn:({signal:t})=>q(`/sessions/${e}/batches${n}`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:fA})}function bA(e){return ot({queryKey:xs([`batch-activities`,e]),queryFn:({signal:t})=>q(`/batches/${e}/activities`,{signal:t}),enabled:e!==void 0,staleTime:pA})}function xA(e){return ot({queryKey:xs([`session-attachments`,e]),queryFn:({signal:t})=>q(`/sessions/${e}/attachments`,{signal:t}),enabled:e!==void 0,staleTime:mA})}function SA(){let e=We();return st({mutationFn:e=>is(`/sessions/${e}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`sessions`]})}})}function CA(){let e=We();return st({mutationFn:e=>ts(`/sessions/${e}/complete`),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`session`,n]}),e.invalidateQueries({queryKey:[`sessions`]})}})}function wA(e){return ot({queryKey:xs([`session-impact`,e]),queryFn:({signal:t})=>q(`/sessions/${e}/impact`,{signal:t}),enabled:e!==null,staleTime:hA})}function TA(e){return Ts({queryKey:[`session-plans`,e],queryFn:async({signal:t})=>(await q(`/sessions/${e}/plans`,{signal:t})).plans,enabled:!!e,pollCategory:`standard`,refetchInterval:gA})}function EA(e){let t=We();return st({mutationFn:e=>is(`/plans/${e}`),onSuccess:()=>{t.invalidateQueries({queryKey:[`session-plans`,e]})}})}var DA=Es.RUNS_ACTIVE,OA=Es.RUN_DETAIL,kA=Es.STATS,AA=new Set([`completed`,`failed`,`skipped`]),jA=Es.STATS,MA=6e4,NA=50;function PA(e){let t=e?.limit??NA,n=new URLSearchParams;n.set(`limit`,String(t)),e?.offset!==void 0&&n.set(`offset`,String(e.offset)),e?.search&&n.set(`search`,e.search),e?.status&&n.set(`status`,e.status),e?.task&&n.set(`task`,e.task);let r=n.toString();return Ts({queryKey:[`agent-runs`,e],queryFn:({signal:e})=>q(`/agent/runs?${r}`,{signal:e}),pollCategory:`standard`,refetchInterval:DA})}function FA(e){return Ts({queryKey:[`agent-run`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:e=>{let t=e.state.data?.run?.status;return t&&AA.has(t)?!1:OA}})}function IA(e,t){let n=t?AA.has(t):!1;return Ts({queryKey:[`agent-reports`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/reports`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:n?!1:kA})}function LA(e,t){let n=t?AA.has(t):!1;return Ts({queryKey:[`agent-turns`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/turns`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:n?!1:jA})}function RA(){return ot({queryKey:xs([`agent-tasks`]),queryFn:({signal:e})=>q(`/agent/tasks`,{signal:e}),staleTime:MA})}function zA(e){return ot({queryKey:xs([`agent-task`,e]),queryFn:({signal:t})=>q(`/agent/tasks/${e}`,{signal:t}),enabled:e!==void 0,staleTime:MA})}function BA(){let e=We();return st({mutationFn:({taskId:e,name:t})=>ts(`/agent/tasks/${e}/copy`,t?{name:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]})}})}function VA(){let e=We();return st({mutationFn:e=>is(`/agent/tasks/${e}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]})}})}function HA(e){return ot({queryKey:xs([`agent-task-yaml`,e]),queryFn:({signal:t})=>q(`/agent/tasks/${e}/yaml`,{signal:t}),enabled:e!==void 0,staleTime:MA})}function UA(){let e=We();return st({mutationFn:({taskId:e,yaml:t})=>ns(`/agent/tasks/${e}`,{yaml:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]}),e.invalidateQueries({queryKey:[`agent-task`]}),e.invalidateQueries({queryKey:[`agent-task-yaml`]})}})}function WA(){let e=We();return st({mutationFn:e=>ts(`/agent/run`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-runs`]})}})}function GA(){let e=We();return st({mutationFn:({runId:e,mode:t})=>ts(`/agent/runs/${e}/resume`,t?{mode:t}:{}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`agent-runs`]}),e.invalidateQueries({queryKey:[`agent-run`,n.runId]})}})}function KA(e){return Ts({queryKey:[`agent-run-write-intents`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/write-intents`,{signal:t}),enabled:e!==null,pollCategory:`standard`,refetchInterval:!1})}function qA(e){return Ts({queryKey:[`agent-run-audit`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/audit`,{signal:t}),enabled:e!==null,pollCategory:`standard`,refetchInterval:!1})}function JA(e,t){let n=new URLSearchParams;n.set(`agentId`,e),n.set(`tier`,String(t));let r=n.toString();return Ts({queryKey:[`digest-revisions`,e,t],queryFn:({signal:e})=>q(`/digest/revisions?${r}`,{signal:e}),enabled:!!e&&Number.isFinite(t),pollCategory:`standard`,refetchInterval:!1})}function YA(){let e=We();return st({mutationFn:({revisionId:e,runId:t})=>ts(`/digest/revisions/${e}/restore`,t?{runId:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`digest-revisions`]})}})}function XA(e){return{id:e.id,agent_id:e.agent_id,task:e.task,instruction:e.instruction,status:e.status,harness:e.harness,provider:e.provider,model:e.model,session_ref:e.session_ref,started_at:e.started_at,completed_at:e.completed_at,tokens_used:e.tokens_used,cost_usd:e.cost_usd,usage_data:e.usage_data,error:e.error,dry_run:e.dry_run??!1,reasoning_level:e.reasoning_level??null,execution_overrides:e.execution_overrides??null,write_intents:e.write_intents,duration_ms:e.duration_ms}}function ZA(e){let t=gs(),n=it({queries:e.map(e=>({queryKey:bs(t,[`agent-run`,e]),queryFn:({signal:t})=>q(`/agent/runs/${e}`,{signal:t}),enabled:!!e}))}),r=[],i=[],a=!1;for(let e of n){e.isLoading&&(a=!0),e.error&&i.push(e.error);let t=e.data?.run;t&&r.push(XA(t))}return{runs:r,isLoading:a,errors:i,isError:i.length>0}}function QA(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset));let n=t.toString(),r=n?`/skill-candidates?${n}`:`/skill-candidates`;return ot({queryKey:xs([`skill-candidates`,e]),queryFn:({signal:e})=>q(r,{signal:e})})}function $A(){let e=We();return st({mutationFn:({id:e,...t})=>ns(`/skill-candidates/${e}`,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`skill-candidates`]})}})}function ej(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset));let n=t.toString(),r=n?`/skill-records?${n}`:`/skill-records`;return ot({queryKey:xs([`skill-records`,e]),queryFn:({signal:e})=>q(r,{signal:e})})}function tj(e){return ot({queryKey:xs([`skill-record`,e]),queryFn:({signal:t})=>q(`/skill-records/${e}`,{signal:t}),enabled:!!e})}function nj(){let e=We();return st({mutationFn:e=>is(`/skill-records/${encodeURIComponent(e)}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`skill-records`]}),e.invalidateQueries({queryKey:[`skill-record`]})}})}var rj=6e4,ij=36e5,aj=3e4;function oj(e,t,n=``){return e?.myco_tool_calls?e.myco_tool_calls.find(e=>e.tool_name===t&&e.op===n)?.count??0:0}async function sj(e,t){try{return await q(e,{signal:t})}catch(e){if(e instanceof ls&&e.status===404)return null;throw e}}function cj(e){return ot({queryKey:xs([`session-canopy`,e]),queryFn:({signal:t})=>sj(`/sessions/${e}/canopy`,t),enabled:e!==void 0,staleTime:rj,retry:(e,t)=>t instanceof ls&&t.status===404?!1:e<2})}function lj(e){let t=new URLSearchParams;e.limit!==void 0&&t.set(`limit`,String(e.limit)),e.offset!==void 0&&t.set(`offset`,String(e.offset)),e.language!==void 0&&t.set(`language`,e.language),e.described!==void 0&&t.set(`described`,String(e.described)),e.embedded!==void 0&&t.set(`embedded`,String(e.embedded)),e.path_prefix!==void 0&&t.set(`path_prefix`,e.path_prefix),e.q!==void 0&&e.q!==``&&t.set(`q`,e.q),e.sort_by!==void 0&&t.set(`sort_by`,e.sort_by),e.sort_dir!==void 0&&t.set(`sort_dir`,e.sort_dir);let n=t.toString();return n?`?${n}`:``}function uj(e){return Ts({queryKey:[`canopy-entries`,e.limit??null,e.offset??null,e.language??null,e.described??null,e.embedded??null,e.path_prefix??null,e.q??null,e.sort_by??null,e.sort_dir??null],queryFn:({signal:t})=>q(`/canopy/entries${lj(e)}`,{signal:t}),staleTime:aj,pollCategory:`standard`,refetchInterval:Es.CANOPY_ENTRIES})}function dj(e){return ot({queryKey:xs([`canopy-entry`,e]),queryFn:({signal:t})=>sj(`/canopy/entries/${encodeURIComponent(e??``)}`,t),enabled:typeof e==`string`&&e.length>0,staleTime:aj,retry:(e,t)=>t instanceof ls&&t.status===404?!1:e<2})}function fj(){let e=We();return st({mutationFn:async e=>ts(`/canopy/entries/${encodeURIComponent(e)}/reembed`),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`canopy-entries`]}),e.invalidateQueries({queryKey:[`canopy-entry`,n]})}})}function pj(){let e=We();return st({mutationFn:async e=>ts(`/canopy/entries/${encodeURIComponent(e)}/redescribe`,{}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`canopy-entries`]}),e.invalidateQueries({queryKey:[`canopy-entry`,n]})}})}var mj=3e4;function hj(){return ot({queryKey:xs([`canopy-map`]),queryFn:({signal:e})=>q(`/canopy/map`,{signal:e}),staleTime:mj})}function gj(){let e=We();return st({mutationFn:async e=>ts(`/canopy/map/regenerate`,{force_cold_start:e.force_cold_start===!0}),onSuccess:()=>{e.invalidateQueries({queryKey:[`canopy-map`]})}})}function _j(e,t){return ot({queryKey:xs([`canopy-tool-call-blob`,e,t]),queryFn:({signal:n})=>sj(`/sessions/${e}/canopy/tool-calls/${t}/blob`,n),enabled:e!==void 0&&t!==void 0,staleTime:ij,retry:(e,t)=>t instanceof ls&&t.status===404?!1:e<2})}function vj({isLoading:e,error:t,loadingText:n=`Loading...`,children:r}){return e?(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:n})]}):t?(0,G.jsxs)(`div`,{className:`flex h-64 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to connect to daemon`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:t.message})]}):(0,G.jsx)(G.Fragment,{children:r})}var yj={default:`w-full`,narrow:`mx-auto w-full max-w-3xl`},bj=(0,W.forwardRef)(({variant:e=`default`,className:t,children:n,...r},i)=>(0,G.jsx)(`div`,{ref:i,className:J(`flex flex-col gap-6 p-6`,yj[e],t),...r,children:n}));bj.displayName=`PageContainer`;var xj=Us(`rounded-xl bg-surface-container-low border border-outline-variant`,{variants:{accent:{sage:`border-t-2 border-t-sage`,ochre:`border-t-2 border-t-ochre`,terra:`border-t-2 border-t-terracotta`,outline:`border-t-2 border-t-outline-variant`},padded:{true:`p-4`,false:``}},defaultVariants:{accent:`sage`,padded:!1}}),Sj=(0,W.forwardRef)(({className:e,accent:t,padded:n,...r},i)=>(0,G.jsx)(`div`,{ref:i,className:J(xj({accent:t,padded:n}),e),...r}));Sj.displayName=`AccentSurface`;var Cj=Us(`inline-flex items-center myco-eyebrow`,{variants:{tone:{default:`text-outline`,sage:`text-sage`,ochre:`text-ochre`,terra:`text-terracotta`,outline:`text-outline`},size:{sm:`myco-eyebrow-sm`,md:`myco-eyebrow`}},defaultVariants:{tone:`default`,size:`md`}}),wj=(0,W.forwardRef)(({className:e,tone:t,size:n,...r},i)=>(0,G.jsx)(`span`,{ref:i,className:J(Cj({tone:t,size:n}),e),...r}));wj.displayName=`Eyebrow`;var Tj=(0,W.forwardRef)(({tone:e=`sage`,eyebrow:t,title:n,actions:r,footer:i,padded:a=!0,className:o,children:s,...c},l)=>{let u=t!=null||n!=null||r!=null;return(0,G.jsxs)(Sj,{ref:l,accent:e,className:J(`flex flex-col`,o),...c,children:[u&&(0,G.jsxs)(`header`,{className:J(`flex items-start justify-between gap-3`,a?`px-5 pt-4`:`px-5 py-4`),children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[t!=null&&(0,G.jsx)(wj,{tone:e,children:t}),n!=null&&(0,G.jsx)(`h3`,{className:`myco-display-sm text-on-surface m-0`,children:n})]}),r!=null&&(0,G.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:r})]}),s!=null&&(0,G.jsx)(`div`,{className:J(a?`px-5 py-4`:``),children:s}),i!=null&&(0,G.jsx)(`footer`,{className:`border-t border-[var(--ghost-border)] px-5 py-3`,children:i})]})});Tj.displayName=`Panel`;function Ej({data:e,widthPx:t=56,heightPx:n=16,barClassName:r=`fill-primary/60`,zeroBarClassName:i,minValueHeightPx:a=0,zeroValueHeightPx:o=0,ariaLabel:s=`Activity sparkline`,title:c,className:l}){let u=e.length;if(u===0)return(0,G.jsx)(`svg`,{role:`img`,"aria-label":s,title:c??s,width:t,height:n,className:J(`inline-block`,l)});let d=Math.max(...e,1),f=Math.max(1,(t-1*(u-1))/u);return(0,G.jsx)(`svg`,{role:`img`,"aria-label":s,title:c??s,width:t,height:n,className:J(`inline-block`,l),children:e.map((e,t)=>{let s=d===0?0:Math.round(e/d*n),c=Math.min(n,e>0?Math.max(a,s):o);return(0,G.jsx)(`rect`,{x:t*(f+1),y:n-c,width:f,height:c,className:e>0?r:i??r,rx:.5},t)})})}var Dj=8;function Oj(e){let t=e??[];return t.length>=Dj?t.slice(t.length-Dj):[...t,...Array(Dj-t.length).fill(0)]}function kj(e,t){return e===`session`?t===1?`prompt batch`:`prompt batches`:t===1?`agent turn`:`agent turns`}function Aj(e){return e===`session`?`this session`:`this run`}function jj({data:e,kind:t,widthPx:n=48,heightPx:r=14,className:i,title:a,...o}){let s=Oj(e),c=s.reduce((e,t)=>e+t,0),l=`${c.toLocaleString()} ${kj(t,c)} across ${Aj(t)}`,u=Math.max(...s,1),d=Math.max(2,(n-2*(s.length-1))/s.length),f=t===`session`?`var(--sage)`:`var(--primary)`;return(0,G.jsx)(`svg`,{role:`img`,"aria-label":l,title:a??l,width:n,height:r,viewBox:`0 0 ${n} ${r}`,className:J(`inline-block`,i),...o,children:s.map((e,t)=>{let n=Math.round(e/u*r),i=e>0?Math.max(3,n):1;return(0,G.jsx)(`rect`,{x:t*(d+2),y:r-i,width:d,height:i,rx:1,fill:f,opacity:e>0?.75:.18},t)})})}var Mj=Us(`flex min-w-0 flex-col gap-1 overflow-hidden rounded-md bg-surface-container-lowest border border-[var(--ghost-border)] px-4 py-3`,{variants:{tone:{default:``,sage:`border-t-2 border-t-sage`,ochre:`border-t-2 border-t-ochre`,terra:`border-t-2 border-t-terracotta`}},defaultVariants:{tone:`default`}}),Nj=(0,W.forwardRef)(({label:e,value:t,sub:n,tone:r,mono:i=!1,sparklineData:a,className:o,...s},c)=>(0,G.jsxs)(`div`,{ref:c,className:J(Mj({tone:r}),o),...s,children:[(0,G.jsx)(wj,{size:`sm`,children:e}),(0,G.jsxs)(`div`,{className:J(`flex min-w-0 items-end justify-between gap-2`),children:[(0,G.jsx)(`div`,{className:J(`min-w-0 max-w-full [overflow-wrap:anywhere]`,i?`font-mono text-base leading-tight text-on-surface`:`myco-display-md text-on-surface`),children:t}),a&&a.length>=2&&(0,G.jsx)(Ej,{data:a,widthPx:80,heightPx:20,className:`opacity-60 shrink-0`})]}),n!=null&&(0,G.jsx)(`div`,{className:`font-mono text-[10px] text-outline`,children:n})]}));Nj.displayName=`MetricCard`;var Pj=6,Fj=6,Ij=6,Lj=6;function Rj(e){return e===`running`?`sage`:e===`failed`||e===`error`?`terracotta`:e===`completed`||e===`succeeded`?`outline`:`ochre`}function zj(){let{data:e,isLoading:t,isError:n,error:r}=Fs(),{data:i}=_A({status:`active`,limit:Pj}),{data:a}=_A({limit:1}),{data:o}=PA({limit:Fj}),{data:s}=ej({limit:Ij}),{data:c}=uj({limit:Lj,sort_by:`llm_updated_at`,sort_dir:`desc`});return(0,G.jsx)(vj,{isLoading:t,error:n?r instanceof Error?r:Error(`Unable to reach daemon`):null,loadingText:`Connecting to daemon...`,children:e&&(0,G.jsxs)(bj,{className:`gap-8`,children:[(0,G.jsx)(Bj,{stats:e,activeSessionCount:i?.total??0,inFlightRunCount:(o?.runs??[]).filter(e=>e.status===`running`).length,lastSession:a?.sessions?.[0]}),(0,G.jsx)(Wj,{stats:e}),(0,G.jsx)(Jj,{sessions:i?.sessions??[],totalSporeCount:e.vault.spore_count,totalActiveCount:i?.total??0}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,G.jsx)(Xj,{runs:o?.runs??[]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,G.jsx)(Qj,{skills:s?.records??[]}),(0,G.jsx)($j,{entries:c?.rows??[]})]})]})]})})}function Bj({stats:e,activeSessionCount:t,inFlightRunCount:n,lastSession:r}){let i=e.context.project.name||nv(e.context.project.root),a=Uj(t,n,e.embedding.queue_depth);return(0,G.jsxs)(`header`,{className:`flex items-start justify-between gap-4 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(wj,{children:i}),(0,G.jsx)(`h1`,{className:`myco-display-lg text-on-surface m-0`,children:`Dashboard`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:a})]}),(0,G.jsx)(Hj,{lastSession:r,activeCount:t,totalSessions:e.vault.session_count})]})}var Vj=10080*60;function Hj({lastSession:e,activeCount:t,totalSessions:n}){let r,i;if(t>0)r=`sage`,i=`Capturing now`;else if(n===0||!e)r=`outline`,i=`No sessions captured yet`;else{let t=e.ended_at??e.started_at,n=Date.now()/1e3-t<=Vj;r=n?`sage`:`ochre`,i=n?`Last captured ${Q_(t)}`:`No capture in 7 days · last ${Q_(t)}`}return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-outline-variant/40 bg-surface-container/40 px-2.5 py-1 font-sans text-xs text-on-surface-variant`,title:`Capture health for this project — when a session last landed`,children:[(0,G.jsx)(wk,{tone:r}),(0,G.jsx)(`span`,{children:i})]})}function Uj(e,t,n){let r=[];return e>0&&r.push(`${e} ${e===1?`active session`:`active sessions`}`),t>0&&r.push(`${t} ${t===1?`run`:`runs`} running`),n>0&&r.push(`${n} in the embed queue`),r.length===0?`Quiet right now — nothing running.`:r.join(` · `)}function Wj({stats:e}){return(0,G.jsxs)(`section`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,G.jsx)(Kj,{stats:e}),(0,G.jsx)(qj,{stats:e})]})}function Gj({accent:e,Icon:t,eyebrow:n,name:r,sub:i,children:a}){let o=e===`sage`?`text-sage`:e===`ochre`?`text-ochre`:`text-terracotta`,s=e===`sage`?`sage`:e===`ochre`?`ochre`:`default`;return(0,G.jsxs)(Sj,{accent:e,className:`p-5 flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(t,{className:J(`h-3.5 w-3.5`,o)}),(0,G.jsx)(wj,{tone:s,children:n})]}),(0,G.jsx)(`div`,{className:`myco-display-md text-on-surface truncate`,title:r,children:r}),(0,G.jsx)(`div`,{className:`font-mono text-[10px] text-outline truncate`,title:i,children:i})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:a})]})}function Kj({stats:e}){return(0,G.jsxs)(Gj,{accent:`sage`,Icon:Ka,eyebrow:`Project`,name:e.context.project.name||nv(e.context.project.root),sub:e.context.project.root,children:[(0,G.jsx)(Nj,{label:`Sessions`,value:e.vault.session_count.toLocaleString(),tone:`sage`}),(0,G.jsx)(Nj,{label:`Spores`,value:e.vault.spore_count.toLocaleString()}),(0,G.jsx)(Nj,{label:`Plans`,value:e.vault.plan_count.toLocaleString()}),(0,G.jsx)(Nj,{label:`Canopy`,value:`${e.canopy.described_count}/${e.canopy.entries_count}`,sub:`described`,mono:!0})]})}function qj({stats:e}){let t=e.context.grove,n=t.name??`Local only`,r=t.slug?`${t.mode??`local`} · ${t.connection_state}`:`no grove bound`,i=e.embedding.total_embeddable,a=e.embedding.embedded_count,o=e.embedding.queue_depth;return(0,G.jsxs)(Gj,{accent:`ochre`,Icon:go,eyebrow:`Grove`,name:n,sub:r,children:[(0,G.jsx)(Nj,{label:`Embeddings`,value:i>0?`${a}/${i}`:`—`,sub:i>0?`embedded`:`no items`,mono:!0,tone:`ochre`}),(0,G.jsx)(Nj,{label:`Embed queue`,value:o.toLocaleString(),sub:o>0?`pending`:`idle`})]})}function Jj({sessions:e,totalSporeCount:t,totalActiveCount:n}){let r=Nn(),i=ys(),a=n===0?`No active sessions`:`${n} ${n===1?`active session`:`active sessions`}`;return(0,G.jsxs)(Tj,{tone:`sage`,eyebrow:`Active sessions · ${n}`,title:a,children:[e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`Sessions appear here when a symbiont starts a new conversation.`}):(0,G.jsx)(`div`,{className:`space-y-2`,children:e.map((e,t)=>(0,G.jsx)(Yj,{session:e,accent:[`sage`,`ochre`,`terra`][t%3],onClick:()=>r(i(`/sessions/${e.id}`))},e.id))}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between border-t border-[var(--ghost-border)] pt-3 text-xs font-mono text-outline`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-on-surface tabular-nums`,children:t.toLocaleString()}),` spores total`]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(i(`/sessions`)),className:`inline-flex items-center gap-1 text-sage hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 rounded`,children:[`View session archive`,(0,G.jsx)(qi,{className:`h-3 w-3`})]})]})]})}function Yj({session:e,accent:t,onClick:n}){return(0,G.jsxs)(`button`,{type:`button`,onClick:n,className:J(`w-full text-left rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-4 py-3 transition-colors`,`hover:bg-surface-container focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,t===`sage`&&`border-l-2 border-l-sage`,t===`ochre`&&`border-l-2 border-l-ochre`,t===`terra`&&`border-l-2 border-l-terracotta`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(wk,{tone:e.status===`active`?`sage`:`ochre`,pulse:e.status===`active`}),(0,G.jsx)(`span`,{className:`font-serif italic text-sm text-on-surface truncate flex-1 min-w-0`,children:e.title||`Untitled session`}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:Q_(e.started_at)})]}),(0,G.jsxs)(`div`,{className:`mt-1 font-mono text-[11px] text-on-surface-variant flex items-center gap-3 flex-wrap`,children:[(0,G.jsx)(`span`,{children:e.agent}),e.branch&&(0,G.jsxs)(`span`,{children:[`· `,e.branch]}),(0,G.jsxs)(`span`,{children:[`· `,e.prompt_count,`p · `,e.tool_count,`t`]}),e.activity_buckets&&e.activity_buckets.length>1&&(0,G.jsx)(`span`,{className:`ml-auto`,children:(0,G.jsx)(Ej,{data:e.activity_buckets,widthPx:64,heightPx:14})})]})]})}function Xj({runs:e}){let t=Nn(),n=ys(),r=[...e].sort((e,t)=>e.status===`running`&&t.status!==`running`?-1:e.status!==`running`&&t.status===`running`?1:(t.started_at??0)-(e.started_at??0));return(0,G.jsx)(Tj,{accent:`terra`,eyebrow:`Agent runs`,title:`Recent`,actions:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n(`/agent`)),className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`All runs `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:r.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`No agent runs yet for this project.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none flex flex-col gap-2`,children:r.map(e=>(0,G.jsx)(Zj,{run:e,onClick:()=>t(n(`/agent?runId=${e.id}`))},e.id))})})}function Zj({run:e,onClick:t}){let n=Rj(e.status),r=e.task??`untitled task`,i=e.tokens_used??0;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:t,className:`w-full text-left rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 transition-colors hover:bg-surface-container focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(wk,{tone:n,pulse:e.status===`running`}),(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface truncate flex-1 min-w-0`,children:r}),e.dry_run&&(0,G.jsx)(`span`,{className:`font-mono text-[9px] uppercase tracking-wider text-ochre bg-ochre/10 px-1.5 rounded`,children:`dry`}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:e.status})]}),(0,G.jsxs)(`div`,{className:`mt-1 font-mono text-[10px] text-outline flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{children:e.id.slice(0,8)}),e.started_at&&(0,G.jsxs)(`span`,{children:[`· `,Q_(e.started_at)]}),i>0&&(0,G.jsxs)(`span`,{children:[`· `,i.toLocaleString(),` tok`]}),e.model&&(0,G.jsxs)(`span`,{children:[`· `,e.model]})]})]})})}function Qj({skills:e}){let t=Nn(),n=ys(),r=[...e].sort((e,t)=>t.updated_at-e.updated_at);return(0,G.jsx)(Tj,{accent:`sage`,eyebrow:`Skills`,title:`Recently evolved`,actions:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n(`/skills`)),className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Curate `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:r.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`No skills yet. The agent surfaces candidates as you work.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none grid grid-cols-1 sm:grid-cols-2 gap-2`,children:r.map(e=>(0,G.jsxs)(`li`,{className:`rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(co,{className:`h-3 w-3 text-sage shrink-0`}),(0,G.jsx)(`span`,{className:`font-sans text-xs font-medium text-on-surface truncate`,title:e.display_name,children:e.display_name||e.name}),(0,G.jsxs)(`span`,{className:`ml-auto font-mono text-[9px] uppercase tracking-wider text-ochre bg-ochre/10 px-1.5 rounded shrink-0`,children:[`gen `,e.generation]})]}),(0,G.jsx)(`div`,{className:`mt-1 font-mono text-[10px] text-outline`,children:Q_(e.updated_at)})]},e.id))})})}function $j({entries:e}){let t=Nn(),n=ys();return(0,G.jsx)(Tj,{accent:`ochre`,eyebrow:`Canopy`,title:`Recent entries`,actions:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n(`/cortex?tab=canopy`)),className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Open Cortex `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`Canopy hasn't summarized any files yet.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none flex flex-col gap-1.5`,children:e.map(e=>(0,G.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(xa,{className:`h-3 w-3 text-outline shrink-0`}),(0,G.jsx)(`span`,{className:`font-mono truncate flex-1 min-w-0 text-on-surface`,title:e.path,children:e.path}),e.language&&(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:e.language}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:e.llm_updated_at?Q_(e.llm_updated_at):Q_(e.mechanical_updated_at)})]},e.path))})})}function eM(e){let[t,n]=(0,W.useState)(()=>typeof window>`u`?!1:window.matchMedia(e).matches);return(0,W.useEffect)(()=>{if(typeof window>`u`)return;let t=window.matchMedia(e),r=e=>n(e.matches);return n(t.matches),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}var tM=`(min-width: 768px)`,nM=240,rM=360;function iM({master:e,detail:t,hasSelection:n,onCloseMobileDetail:r,railMinWidthPx:i=nM,railMaxWidthPx:a=rM,className:o,masterAriaLabel:s=`List`,detailAriaLabel:c=`Details`}){return eM(tM)?(0,G.jsxs)(`div`,{className:J(`flex h-full w-full`,o),children:[(0,G.jsx)(`aside`,{"aria-label":s,className:`flex-shrink-0 overflow-y-auto border-r border-outline-variant/20`,style:{minWidth:i,maxWidth:a,width:`clamp(${i}px, 30vw, ${a}px)`},children:e}),(0,G.jsx)(`section`,{"aria-label":c,className:`flex-1 overflow-y-auto p-6`,children:t})]}):n?(0,G.jsxs)(`section`,{role:`region`,"aria-label":c,className:J(`flex h-full w-full flex-col`,o),children:[r&&(0,G.jsxs)(`button`,{type:`button`,onClick:r,className:`sticky top-0 z-10 flex items-center gap-1 border-b border-outline-variant/20 bg-surface-container px-3 py-2 text-sm text-on-surface-variant hover:bg-surface-container-high`,children:[(0,G.jsx)(ea,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{children:`Back`})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto p-6`,children:t})]}):(0,G.jsx)(`section`,{role:`region`,"aria-label":s,className:J(`h-full w-full overflow-y-auto`,o),children:e})}function aM({message:e,className:t}){return(0,G.jsx)(`div`,{className:J(`flex h-full w-full items-center justify-center text-on-surface-variant`,t),children:(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:e})})}function oM({searchPlaceholder:e=`Search...`,searchValue:t,onSearchChange:n,filters:r=[],filterValues:i={},onFilterChange:a,inputRef:o,count:s,className:c}){return(0,G.jsxs)(`div`,{className:J(`flex items-center gap-3 px-4 py-2.5 rounded-md bg-surface-container-low border border-[var(--ghost-border)]`,c),children:[(0,G.jsx)(no,{className:`h-4 w-4 text-on-surface-variant shrink-0`}),(0,G.jsx)(Kf,{ref:o,placeholder:e,value:t,onChange:e=>n(e.target.value),className:`bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1 min-w-[200px]`,"aria-label":e}),r.map(e=>(0,G.jsx)(`div`,{className:`w-44 shrink-0`,children:(0,G.jsxs)(c_,{value:i[e.key]??`all`,onValueChange:t=>a?.(e.key,t),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:e.label})}),(0,G.jsx)(d_,{children:e.options.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})},e.key)),s!=null&&(0,G.jsx)(`span`,{className:`myco-eyebrow-sm shrink-0`,children:s})]})}var sM=Us(`rounded-md transition-colors`,{variants:{level:{lowest:`bg-surface-container-lowest`,low:`bg-surface-container-low`,default:`bg-surface-container`,high:`bg-surface-container-high`,highest:`bg-surface-container-highest`,bright:`bg-surface-bright`},interactive:{true:`cursor-pointer hover-lift hover:brightness-[1.08]`,false:``},ghostBorder:{true:`border border-[var(--ghost-border)]`,false:``},glass:{true:`backdrop-blur-xl bg-surface-variant/60`,false:``},glow:{true:`shadow-[inset_0_0_12px_rgba(171,207,184,0.2)]`,false:``},accent:{none:``,sage:`border-t-2 border-t-sage`,ochre:`border-t-2 border-t-ochre`,terra:`border-t-2 border-t-terracotta`,outline:`border-t-2 border-t-outline-variant`}},defaultVariants:{level:`low`,interactive:!1,ghostBorder:!1,glass:!1,glow:!1,accent:`none`}}),Q=(0,W.forwardRef)(({className:e,level:t,interactive:n,ghostBorder:r,glass:i,glow:a,accent:o,...s},c)=>(0,G.jsx)(`div`,{ref:c,className:J(sM({level:t,interactive:n,ghostBorder:r,glass:i,glow:a,accent:o}),e),...s}));Q.displayName=`Surface`;var cM={sage:`bg-sage/[0.08] shadow-[inset_2px_0_0_var(--sage)]`,ochre:`bg-ochre/[0.08] shadow-[inset_2px_0_0_var(--ochre)]`,terra:`bg-terracotta/[0.08] shadow-[inset_2px_0_0_var(--terracotta)]`},lM={sage:`bg-surface-container/60 ring-1 ring-inset ring-sage/30`,ochre:`bg-surface-container/60 ring-1 ring-inset ring-ochre/30`,terra:`bg-surface-container/60 ring-1 ring-inset ring-terracotta/30`},uM=(0,W.forwardRef)(({accent:e=`sage`,isActive:t=!1,isCursor:n=!1,interactive:r,onClick:i,className:a,children:o,onKeyDown:s,...c},l)=>{let u=r??typeof i==`function`;function d(e){u&&i&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i()),s?.(e)}return(0,G.jsx)(`div`,{ref:l,onClick:u?i:void 0,onKeyDown:u?d:s,tabIndex:u?0:void 0,role:u?`row`:void 0,"aria-selected":u?t:void 0,"data-active":t||void 0,"data-cursor":n||void 0,className:J(`relative border-b border-[var(--ghost-border)] last:border-b-0 px-4 py-3 transition-colors duration-100`,u&&`cursor-pointer hover:bg-surface-container focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sage/40`,t&&cM[e],n&&!t&&lM[e],a),...c,children:o})});uM.displayName=`Row`;function dM({open:e,onOpenChange:t,title:n,description:r,icon:i,meta:a,impact:o,confirmLabel:s=`Confirm`,variant:c=`destructive`,onConfirm:l,isPending:u=!1,errorMessage:d=null}){return(0,G.jsx)(Lf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Vf,{className:`sm:max-w-md border border-outline-variant/20 [&>button:last-child]:hidden`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i&&(0,G.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-tertiary/15`,children:i}),(0,G.jsx)(Wf,{children:n})]}),(0,G.jsx)(Gf,{children:r})]}),a&&a.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-outline-variant/20 px-4 py-3`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant bg-surface-container px-1.5 py-0.5 rounded shrink-0`,children:a[0]?.value}),a.length>1&&(0,G.jsx)(`span`,{className:`text-sm font-medium text-on-surface truncate`,children:a[1]?.value})]}),o&&o.length>0&&(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:o.map(e=>(0,G.jsxs)(`div`,{className:`rounded-md border border-outline-variant/20 px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`font-sans text-[10px] font-medium uppercase tracking-wider text-on-surface-variant`,children:e.label}),(0,G.jsx)(`div`,{className:`font-sans text-base font-medium text-on-surface`,children:e.value})]},e.label))}),d&&(0,G.jsx)(`p`,{className:`text-sm text-tertiary`,"data-testid":`confirm-dialog-error`,role:`alert`,children:d}),(0,G.jsxs)(Uf,{children:[(0,G.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:u,children:`Cancel`}),(0,G.jsxs)(Y,{variant:c,size:`sm`,onClick:l,disabled:u,className:`gap-2`,children:[u&&(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),s]})]})]})})}function fM({total:e,offset:t,limit:n,onPageChange:r}){if(Math.ceil(e/n)<=1)return null;let i=t>0,a=t+n<e,o=t+1,s=Math.min(t+n,e);return(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-3 pt-1`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!i,onClick:()=>r(Math.max(0,t-n)),className:`gap-1 text-on-surface-variant`,children:[(0,G.jsx)(ea,{className:`h-4 w-4`}),`Prev`]}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[o,`–`,s,` of `,e]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!a,onClick:()=>r(t+n),className:`gap-1 text-on-surface-variant`,children:[`Next`,(0,G.jsx)(ta,{className:`h-4 w-4`})]})]})}var pM=3e5;function mM(){return ot({queryKey:xs([`symbionts`]),queryFn:({signal:e})=>q(`/symbionts`,{signal:e}),staleTime:pM})}function hM(e,t,n){let r=e.find(e=>e.name===t);return r?.resumeCommand?r.resumeCommand.replace(`{sessionId}`,n):null}var gM={released:`released`,merged_unreleased:`merged`,not_on_release_line:`feature`,unknown:`unknown`,unreconciled:`unreconciled`},_M={released:`bg-primary/15 text-primary`,merged_unreleased:`bg-secondary/15 text-secondary`,not_on_release_line:`border border-[var(--ghost-border)] text-on-surface-variant`,unknown:`bg-surface-container-high text-on-surface-variant`,unreconciled:`border border-[var(--ghost-border)] text-on-surface-variant/70`},vM={released:`bg-primary`,merged_unreleased:`bg-secondary`,not_on_release_line:`bg-on-surface-variant/50`,unknown:`bg-on-surface-variant/40`,unreconciled:`bg-on-surface-variant/25`},yM={released:`border-primary`,merged_unreleased:`border-secondary`,not_on_release_line:`border-on-surface-variant/50`,unknown:`border-on-surface-variant/40`,unreconciled:`border-on-surface-variant/25`};function bM(e){let t=[gM[e.state]??e.state];return e.confidence&&t.push(`confidence: ${e.confidence}`),e.basis_kind&&t.push(`basis: ${e.basis_kind}`),e.basis_ref&&t.push(`ref: ${e.basis_ref}`),e.reason&&t.push(e.reason),t.join(` — `)}function xM({annotation:e,className:t}){if(!e)return null;let n=gM[e.state]??e.state;return(0,G.jsxs)(`span`,{className:J(`inline-flex items-center gap-1 rounded-xs px-1.5 py-0.5 font-sans text-[10px] font-medium uppercase tracking-wider`,_M[e.state]??_M.unknown,t),title:bM(e),children:[(0,G.jsx)(`span`,{children:n}),e.confidence?(0,G.jsx)(`span`,{className:`font-mono normal-case opacity-70`,children:e.confidence}):null]})}function SM({annotation:e,className:t}){if(!e)return null;let n=vM[e.state]??vM.unknown,r=yM[e.state]??yM.unknown,i=e.confidence??null,a;return a=i===`high`?n:i===`medium`?J(n,`opacity-60 border`,r):i===`low`?J(`bg-transparent border-2`,r):J(n,`opacity-50`),(0,G.jsx)(`span`,{className:J(`inline-block h-2.5 w-2.5 rounded-full shrink-0`,a,t),title:bM(e),"aria-label":`Release: ${bM(e)}`,role:`img`})}var CM=[`ACTIVE`,`TODAY`,`YESTERDAY`,`EARLIER`];function wM(e,t){let{isActive:n,startedAtEpochSec:r,nowEpochSec:i}=t,a=i??Math.floor(Date.now()/1e3),o=new Date(a*1e3),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime()/1e3,c=s-1440*60,l={ACTIVE:[],TODAY:[],YESTERDAY:[],EARLIER:[]};for(let t of e){if(n(t)){l.ACTIVE.push(t);continue}let e=r(t);if(e==null){l.EARLIER.push(t);continue}e>=s?l.TODAY.push(t):e>=c?l.YESTERDAY.push(t):l.EARLIER.push(t)}let u=[];for(let e of CM)l[e].length>0&&u.push({label:e,rows:l[e]});return u}function TM(e){return!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey}function EM({items:e,getId:t,selectedId:n,onActivate:r,filterInputRef:i,enabled:a=!0}){let o=(0,W.useRef)(t);o.current=t;let[s,c]=(0,W.useState)(()=>{if(!n)return 0;let r=e.findIndex(e=>t(e)===n);return r>=0?r:0}),l=(0,W.useRef)([]),u=(0,W.useRef)(n);return(0,W.useEffect)(()=>{if(u.current===n||(u.current=n,!n))return;let t=e.findIndex(e=>o.current(e)===n);t>=0&&c(t)},[n,e]),(0,W.useEffect)(()=>{s>=e.length&&c(Math.max(0,e.length-1)),l.current.length>e.length&&(l.current.length=e.length)},[e.length,s]),(0,W.useEffect)(()=>{let e=l.current[s];e&&typeof e.scrollIntoView==`function`&&e.scrollIntoView({block:`nearest`})},[s]),{cursorIndex:s,setRowRef:(0,W.useCallback)(e=>t=>{l.current[e]=t},[]),containerProps:{tabIndex:0,onKeyDown:(0,W.useCallback)(n=>{if(a){if(n.key===`/`&&TM(n)&&i?.current){n.preventDefault(),i.current.focus();return}if(TM(n)){if(n.key===`j`||n.key===`ArrowDown`){n.preventDefault(),c(t=>Math.min(e.length-1,t+1));return}if(n.key===`k`||n.key===`ArrowUp`){n.preventDefault(),c(e=>Math.max(0,e-1));return}if(n.key===`Enter`){n.preventDefault();let i=e[s];i&&r(t(i))}}}},[a,e,s,r,t,i])}}}var DM=5;function OM(e){return e===`active`?`sage`:e===`completed`?`outline`:`ochre`}var kM=(0,W.forwardRef)(function({session:e,symbiontDisplayName:t,isSelected:n,isCursor:r,onClick:i,onDelete:a},o){let s=e.title||tv(e.id);return(0,G.jsxs)(uM,{ref:o,isActive:n,isCursor:r,accent:`sage`,onClick:i,"aria-label":`Session: ${s}`,"data-selected":n||void 0,className:`group`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0 flex-1`,children:[(0,G.jsx)(wk,{tone:OM(e.status),pulse:e.status===`active`,className:`mt-1.5 shrink-0`}),(0,G.jsx)(`h3`,{className:`font-serif italic text-sm text-on-surface truncate leading-snug`,children:s})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,G.jsx)(SM,{annotation:e.release_state}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant whitespace-nowrap`,children:Q_(e.started_at)}),(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),a()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:`opacity-0 group-hover:opacity-100 focus-visible:opacity-100 p-1 rounded hover:bg-terracotta/10 hover:text-terracotta transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-terracotta/40`,"aria-label":`Delete session ${s}`,title:`Delete session`,children:(0,G.jsx)(ho,{className:`h-3.5 w-3.5`})})]})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 ml-5 flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 truncate font-mono text-[11px] text-on-surface-variant`,children:[e.agent,` · `,t,` · `,e.prompt_count,`p · `,e.tool_count,`t`]}),(0,G.jsx)(jj,{data:e.activity_buckets,kind:`session`,widthPx:48,heightPx:14,className:`shrink-0`})]}),e.branch&&(0,G.jsxs)(`div`,{className:`mt-0.5 ml-5 inline-flex items-center gap-1 font-mono text-[10px] italic text-on-surface-variant`,children:[(0,G.jsx)(ka,{className:`h-2.5 w-2.5`}),e.branch]})]})});function AM(){return(0,G.jsxs)(`div`,{className:`border-b border-[var(--ghost-border)] last:border-b-0 px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`mt-1.5 h-1.5 w-1.5 rounded-full bg-surface-container-high animate-pulse shrink-0`}),(0,G.jsx)(`div`,{className:`h-3 w-48 rounded bg-surface-container-high animate-pulse`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,G.jsx)(`div`,{className:`h-3 w-10 rounded bg-surface-container-high animate-pulse`}),(0,G.jsx)(`div`,{className:`h-3 w-12 rounded bg-surface-container-high animate-pulse`})]})]}),(0,G.jsx)(`div`,{className:`mt-1.5 ml-5 h-2.5 w-40 rounded bg-surface-container-high animate-pulse`})]})}function jM({selectedId:e,search:t,statusFilter:n,agentFilter:r,hasPlanFilter:i,offset:a,onOffsetChange:o,filterInputRef:s}){let c=Nn(),l=An(),[u,d]=(0,W.useState)(null),f=SA(),{data:p}=wA(u?.id??null),{data:m}=mM(),h=(0,W.useMemo)(()=>{let e=new Map;for(let t of m?.symbionts??[])e.set(t.name,t.displayName);return t=>t?e.get(t)??t:`unknown`},[m]),{data:g,isLoading:_,isError:v,error:y}=_A({limit:50,offset:a,status:n,agent:r,hasPlan:i,search:t});function b(){u&&f.mutate(u.id,{onSuccess:()=>d(null)})}let x=g?.sessions??[],S=g?.total??0,C=(0,W.useRef)(!1);(0,W.useEffect)(()=>{if(C.current)return;let t=new URLSearchParams(l.search);t.has(`status`)||t.has(`agent`)||t.has(`has_plan`)||!e&&!_&&x.length>0&&(C.current=!0,c(`/sessions/${x[0].id}`,{replace:!0}))},[e,_,x,c,l.search]);let w=EM({items:x,getId:e=>e.id,selectedId:e,onActivate:e=>c(`/sessions/${e}`),filterInputRef:s}),T=x.filter(e=>e.status===`active`).length,E=x.reduce((e,t)=>e+(t.prompt_count??0),0),D=(0,G.jsxs)(`div`,{className:`px-4 py-3 border-b border-[var(--ghost-border)]`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-2`,children:[(0,G.jsx)(`h2`,{className:`myco-eyebrow-sm`,children:`Sessions`}),(0,G.jsx)(`span`,{className:`myco-display-sm text-on-surface`,children:`Archive`})]}),(0,G.jsxs)(`div`,{className:`font-mono text-[11px] text-on-surface-variant inline-flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:S.toLocaleString()}),` TOTAL`]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:T.toLocaleString()}),` ACTIVE`]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:E.toLocaleString()}),` PROMPTS`]})]})]});return v?(0,G.jsxs)(`div`,{children:[D,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-terracotta mt-4`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load sessions`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:y instanceof Error?y.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{children:[D,_?(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsx)(`div`,{role:`list`,"aria-label":`Session archive loading`,children:Array.from({length:DM}).map((e,t)=>(0,G.jsx)(AM,{},t))})}):x.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant mt-4`,children:[(0,G.jsx)(Ha,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:S===0&&!t&&!n&&!r?`No sessions yet`:`No matching sessions`}),S===0&&!t&&!n&&!r&&(0,G.jsx)(`span`,{className:`font-sans text-xs`,children:`Sessions appear here as you work with your agent`})]}):(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsx)(`div`,{...w.containerProps,role:`list`,"aria-label":`Session archive`,className:`outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sage/40`,children:(()=>{let t=wM(x,{isActive:e=>e.status===`active`,startedAtEpochSec:e=>e.started_at}),n=0;return t.map(t=>(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{role:`separator`,className:`flex items-center justify-between px-4 py-2 border-b border-[var(--ghost-border)] bg-surface-container/40`,children:[(0,G.jsx)(`span`,{className:`myco-eyebrow-sm`,children:t.label}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline`,children:t.rows.length})]}),t.rows.map(t=>{let r=n++;return(0,G.jsx)(kM,{ref:w.setRowRef(r),session:t,symbiontDisplayName:h(t.agent),isSelected:e===t.id,isCursor:w.cursorIndex===r,onClick:()=>c(`/sessions/${t.id}`),onDelete:()=>d(t)},t.id)})]},t.label))})()})}),(0,G.jsx)(fM,{total:S,offset:a,limit:50,onPageChange:o}),(0,G.jsx)(dM,{open:u!==null,onOpenChange:e=>{e||d(null)},title:`Delete Session`,description:`This will permanently remove this session and all related data. This action cannot be undone.`,icon:(0,G.jsx)(ho,{className:`h-4 w-4 text-terracotta`}),meta:u?[{label:`ID`,value:tv(u.id)},{label:`Title`,value:u.title||tv(u.id)}]:[],impact:p?[{label:`Prompts`,value:p.promptCount},{label:`Spores`,value:p.sporeCount},{label:`Attachments`,value:p.attachmentCount},{label:`Graph Edges`,value:p.graphEdgeCount}]:[],confirmLabel:`Delete Session`,variant:`destructive`,onConfirm:b,isPending:f.isPending})]})}function MM({children:e,className:t}){return(0,G.jsx)(`div`,{className:J(`font-sans text-xs font-medium uppercase tracking-widest text-on-surface-variant`,t),children:e})}function NM({images:e,index:t,onClose:n,onNavigate:r}){let i=e[t],a=t>0,o=t<e.length-1;(0,W.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[]);let s=(0,W.useCallback)(e=>{e.key===`Escape`&&n(),e.key===`ArrowLeft`&&a&&r(t-1),e.key===`ArrowRight`&&o&&r(t+1)},[n,r,t,a,o]);return(0,W.useEffect)(()=>(document.addEventListener(`keydown`,s),()=>document.removeEventListener(`keydown`,s)),[s]),i?(0,G.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-surface-dim/90 backdrop-blur-xs`,onClick:n,children:[(0,G.jsx)(`button`,{onClick:n,className:`absolute top-4 right-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10`,children:(0,G.jsx)(So,{className:`h-5 w-5`})}),e.length>1&&(0,G.jsxs)(`span`,{className:`absolute top-4 left-1/2 -translate-x-1/2 font-mono text-xs text-on-surface/60 z-10`,children:[t+1,` / `,e.length]}),a&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r(t-1)},className:`absolute left-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10`,children:(0,G.jsx)(ea,{className:`h-6 w-6`})}),o&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r(t+1)},className:`absolute right-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10`,children:(0,G.jsx)(ta,{className:`h-6 w-6`})}),(0,G.jsx)(`img`,{src:i.src,alt:i.alt,className:`max-h-[90vh] max-w-[90vw] rounded-lg shadow-ambient object-contain`,onClick:e=>e.stopPropagation()})]}):null}var PM=new Set([`Read`,`read`]);function FM(e){return e.canopy_injection_tokens===null?!1:PM.has(e.tool_name)}function IM({sessionId:e,toolCallId:t}){let{data:n,isLoading:r,isError:i,error:a}=_j(e,t);return r?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`h-3 w-3/4 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-3 w-2/3 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-3 w-1/2 animate-pulse rounded bg-surface-container-high`})]}):i||n===null?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(wa,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:a instanceof Error?a.message:`No injection blob available for this tool call.`})]}):(0,G.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap break-words bg-surface-container-lowest rounded-md p-3 text-on-surface overflow-x-auto`,"data-testid":`canopy-blob-text`,children:n.blob})}function LM({sessionId:e,activity:t}){let[n,r]=(0,W.useState)(!1);if(!FM(t))return null;let i=t.canopy_injection_tokens;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r(!0)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:J(`inline-flex items-center gap-1 px-1.5 py-0.5 rounded`,`font-mono text-[10px] text-sage`,`bg-sage/10 hover:bg-sage/20 transition-colors cursor-pointer`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sage/40`),title:`Canopy injected ${i} tokens of file anatomy. Click to view the blob sent to the agent.`,"aria-label":`Canopy injection: ${i} tokens`,"data-testid":`canopy-tool-call-indicator`,children:[(0,G.jsx)(lo,{className:`h-3 w-3`,"aria-hidden":`true`}),(0,G.jsxs)(`span`,{children:[i,` tok`]}),(0,G.jsx)(qi,{className:`h-2.5 w-2.5 opacity-60`,"aria-hidden":`true`})]}),(0,G.jsx)(Lf,{open:n,onOpenChange:r,children:(0,G.jsxs)(Vf,{className:`max-w-2xl`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`Canopy injection blob`}),(0,G.jsx)(Gf,{children:`The verbatim file-anatomy snippet Cortex sent the agent before this Read. Transparency is the default — what you see here is exactly what the model saw.`})]}),(0,G.jsx)(IM,{sessionId:e,toolCallId:t.id})]})})]})}var RM=3;function zM({activity:e}){let[t,n]=(0,W.useState)(!1),r=e.success===1,i=!!(e.tool_input||e.tool_output_summary||e.error_message);return(0,G.jsxs)(`div`,{className:J(`border-l-2 transition-colors`,t?`border-l-primary/30`:`border-transparent hover:border-l-primary/20`),children:[(0,G.jsxs)(`div`,{role:`button`,tabIndex:0,className:`w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-surface-container/30 transition-all`,onClick:()=>n(e=>!e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(e=>!e))},"aria-expanded":t,children:[t?(0,G.jsx)($i,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}):(0,G.jsx)(ta,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),e.myco_tool?(0,G.jsxs)(`span`,{className:`font-mono text-xs font-medium text-primary`,children:[e.myco_tool,e.myco_op&&(0,G.jsxs)(`span`,{className:`text-primary/60`,children:[` · `,e.myco_op]})]}):(0,G.jsx)(`span`,{className:`font-mono text-xs font-medium text-on-surface`,children:e.tool_name}),e.file_path&&(0,G.jsx)(`span`,{className:`truncate font-sans text-xs text-on-surface-variant flex-1`,children:e.file_path}),(0,G.jsx)(`span`,{className:`shrink-0 ml-auto`}),(0,G.jsx)(LM,{sessionId:e.session_id,activity:e}),(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:av(e.duration_ms)}),r?(0,G.jsx)(oa,{className:`h-3.5 w-3.5 shrink-0 text-primary`}):(0,G.jsx)(ca,{className:`h-3.5 w-3.5 shrink-0 text-tertiary`})]}),(0,G.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-150 ease-out`,style:{gridTemplateRows:t?`1fr`:`0fr`},children:(0,G.jsx)(`div`,{className:`overflow-hidden`,children:(0,G.jsxs)(`div`,{className:`px-8 pb-3 space-y-2`,children:[!i&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant/60 italic py-1`,children:`No input/output details captured`}),e.tool_input&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-sans text-xs font-medium text-on-surface-variant mb-1`,children:`Input`}),(0,G.jsx)(`pre`,{className:`font-mono text-xs bg-surface-container-lowest rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all text-on-surface`,children:e.tool_input})]}),e.tool_output_summary&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-sans text-xs font-medium text-on-surface-variant mb-1`,children:`Output`}),(0,G.jsx)(`pre`,{className:`font-mono text-xs bg-surface-container-lowest rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all text-on-surface`,children:e.tool_output_summary})]}),e.error_message&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-sans text-xs font-medium text-tertiary mb-1`,children:`Error`}),(0,G.jsx)(`pre`,{className:`font-mono text-xs bg-tertiary/10 text-tertiary rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all`,children:e.error_message})]})]})})})]})}function BM({batchId:e,activityCount:t}){let[n,r]=(0,W.useState)(!1),{data:i,isLoading:a}=bA(n?e:void 0);if(t===0)return null;let o=i??[];return(0,G.jsxs)(`div`,{className:`border-t border-[var(--ghost-border)]`,children:[(0,G.jsxs)(`button`,{type:`button`,className:J(`w-full flex items-center gap-2 px-4 py-2 text-left transition-colors`,`hover:bg-surface-container/30`),onClick:()=>r(e=>!e),children:[n?(0,G.jsx)($i,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}):(0,G.jsx)(ta,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,children:`Tool Calls`}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant/60`,children:t})]}),(0,G.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-200 ease-out`,style:{gridTemplateRows:n?`1fr`:`0fr`},children:(0,G.jsxs)(`div`,{className:`overflow-hidden`,children:[a&&(0,G.jsx)(`div`,{className:`px-3 py-2 space-y-1`,children:Array.from({length:Math.min(t,RM)}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-3 animate-pulse rounded bg-surface-container-high w-full`},t))}),!a&&o.length>0&&(0,G.jsx)(`div`,{className:`space-y-0`,children:o.map(e=>(0,G.jsx)(zM,{activity:e},e.id))})]})})]})}var VM=`h-7 w-7`;function HM(e){return new Date(e*1e3).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function UM(e){return e?e.length>120?e.slice(0,120)+`…`:e:`(no prompt)`}function WM({child:e}){return(0,G.jsxs)(`div`,{className:`mt-3 border-l-2 border-primary/30 pl-4 pb-3 mx-4`,children:[(0,G.jsx)(`div`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-primary/70 mb-1`,children:e.kind===`interrupt`?`⚠ interrupt`:`↳ steering`}),(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-1`,children:[(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant shrink-0`,children:`Prompt`}),e.started_at&&(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:HM(e.started_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface whitespace-pre-wrap`,children:e.user_prompt??`(no prompt)`}),e.activity_count>0&&(0,G.jsx)(BM,{batchId:e.id,activityCount:e.activity_count}),e.response_summary&&(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5`,children:[(0,G.jsx)(Xi,{className:`h-3 w-3 text-primary/60`}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,children:`Response`})]}),(0,G.jsx)(fO,{content:e.response_summary})]})]})}function GM(){if(typeof window>`u`)return;let e=window.__MYCO_AUTH__;return typeof e==`string`&&e.length>0?e:void 0}async function KM(e){let t=new Headers,n=GM();n&&t.set(`x-myco-auth`,n);let r=await fetch(e,{headers:t});if(!r.ok)throw Error(`resource fetch failed: ${r.status}`);return URL.createObjectURL(await r.blob())}function qM(e,t){return Vo(t?`/api/g/${t.grove.id}/p/${t.project.project_id}/attachments/${e}`:`/api/attachments/${e}`)}function JM(e){let t=gs(),[n,r]=(0,W.useState)(()=>e.map(()=>null));return(0,W.useEffect)(()=>{let n=!1,i=[];return r(e.map(()=>null)),Promise.all(e.map(e=>KM(qM(e,t)).then(e=>(i.push(e),e)).catch(()=>null))).then(e=>{if(n){for(let e of i)URL.revokeObjectURL(e);return}r(e)}),()=>{n=!0;for(let e of i)URL.revokeObjectURL(e)}},[`${t?.grove.id??``}|${t?.project.project_id??``}|${e.join(`|`)}`]),n}function YM({filePath:e,alt:t,className:n,loading:r=`lazy`}){let[i]=JM([e]);return i?(0,G.jsx)(`img`,{src:i,alt:t??e,className:n,loading:r}):(0,G.jsx)(`div`,{className:n,"aria-busy":`true`})}function XM({batch:e,batchAttachments:t,steeringChildren:n,defaultOpen:r=!1,promptIndex:i,isLast:a}){let[o,s]=(0,W.useState)(r),[c,l]=(0,W.useState)(null),u=JM(t.map(e=>e.file_path));return(0,G.jsxs)(`div`,{className:`relative flex gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative flex flex-col items-center shrink-0`,style:{width:`28px`},children:[i>0&&(0,G.jsx)(`div`,{className:`absolute top-0 w-px bg-outline-variant/40`,style:{height:`14px`}}),(0,G.jsx)(`div`,{className:J(VM,`rounded-full flex items-center justify-center shrink-0 text-[10px] font-mono font-bold transition-colors z-10`,o?`bg-primary text-on-primary`:`bg-surface-container-high text-on-surface-variant border border-outline-variant/40`),children:i+1}),!a&&(0,G.jsx)(`div`,{className:`flex-1 w-px bg-outline-variant/40`})]}),(0,G.jsxs)(Q,{level:`low`,className:J(`flex-1 overflow-hidden rounded-md max-w-full border border-outline-variant/10 mb-2`,e.kind===`recovered`&&`opacity-60 border-dashed`),children:[(0,G.jsxs)(`button`,{type:`button`,className:J(`flex w-full items-start gap-3 px-4 py-3 text-left transition-colors overflow-hidden`,`hover:bg-surface-container/40`,o&&`bg-surface-container/20`),onClick:()=>s(e=>!e),"aria-expanded":o,children:[o?(0,G.jsx)($i,{className:`mt-0.5 h-4 w-4 shrink-0 text-on-surface-variant transition-transform`}):(0,G.jsx)(ta,{className:`mt-0.5 h-4 w-4 shrink-0 text-on-surface-variant transition-transform`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-0.5`,children:[(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant shrink-0`,children:e.kind===`recovered`?`Recovered`:`Prompt`}),e.activity_count>0&&(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant/70 shrink-0`,children:[e.activity_count,` tool call`,e.activity_count===1?``:`s`]}),e.started_at&&(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:HM(e.started_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface truncate`,children:o?e.user_prompt??`(no prompt)`:UM(e.user_prompt)})]})]}),(0,G.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-200 ease-out`,style:{gridTemplateRows:o?`1fr`:`0fr`},children:(0,G.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`px-4 pt-0 pb-3 overflow-hidden`,children:[e.user_prompt&&e.user_prompt.length>120&&(0,G.jsx)(fO,{content:e.user_prompt}),t.length>0&&(0,G.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-3`,children:t.map((e,t)=>(0,G.jsx)(`button`,{type:`button`,className:`rounded-md overflow-hidden hover:ring-2 hover:ring-primary/40 transition-all`,onClick:()=>l(t),children:(0,G.jsx)(YM,{filePath:e.file_path,alt:e.description??e.file_path??``,className:`max-w-[200px] max-h-[140px] object-cover rounded-md`})},e.id))}),c!==null&&(0,G.jsx)(NM,{images:t.map((e,t)=>({src:u[t]??``,alt:e.description??e.file_path??``})),index:c,onNavigate:l,onClose:()=>l(null)})]}),e.activity_count>0&&(0,G.jsx)(BM,{batchId:e.id,activityCount:e.activity_count}),n.map(e=>(0,G.jsx)(WM,{child:e},e.id)),e.response_summary&&(0,G.jsx)(`div`,{className:`border-t border-[var(--ghost-border)] overflow-hidden`,children:(0,G.jsxs)(`div`,{className:`flex gap-3 px-4 py-3`,children:[(0,G.jsx)(`div`,{className:`w-0.5 shrink-0 rounded-full bg-primary/30`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5`,children:[(0,G.jsx)(Xi,{className:`h-3 w-3 text-primary/60`}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,children:`Response`})]}),(0,G.jsx)(fO,{content:e.response_summary})]})]})})]})})]})]})}var ZM=3;function QM(e){let t=new Map,n=[];for(let r of e)if(r.parent_prompt_batch_id==null)n.push(r);else{let e=t.get(r.parent_prompt_batch_id)??[];e.push(r),t.set(r.parent_prompt_batch_id,e)}return n.map(e=>({parent:e,children:(t.get(e.id)??[]).sort((e,t)=>(e.started_at??0)-(t.started_at??0))}))}var $M=[`human`],eN=[`human`,`system`,`agent_dispatch`,`hook_injected`];function tN({sessionId:e}){let[t,n]=(0,W.useState)(!1),{data:r,isLoading:i}=yA(e,t?eN:$M),{data:a}=xA(e),o=a??[],{byBatchId:s,byTurnNumber:c}=(0,W.useMemo)(()=>{let e=new Map,t=new Map;for(let n of o){if(n.prompt_batch_id!=null){let t=e.get(n.prompt_batch_id)??[];t.push(n),e.set(n.prompt_batch_id,t)}if(n.turn_number!=null){let e=t.get(n.turn_number)??[];e.push(n),t.set(n.turn_number,e)}}return{byBatchId:e,byTurnNumber:t}},[o]),l=(0,W.useMemo)(()=>QM([...r??[]].sort((e,t)=>(e.started_at??0)-(t.started_at??0))),[r]);return i?(0,G.jsx)(`div`,{className:`space-y-3 pl-11`,children:Array.from({length:ZM}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-16 animate-pulse rounded-md bg-surface-container-low`},t))}):l.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ha,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No prompts recorded`})]}):(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-3 flex items-center justify-end pl-11 text-xs text-on-surface-variant`,children:(0,G.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-2 select-none`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`h-3 w-3 cursor-pointer accent-primary`,checked:t,onChange:e=>n(e.target.checked)}),(0,G.jsx)(`span`,{children:`Show system & sub-agent prompts`})]})}),l.map(({parent:e,children:t},n)=>(0,G.jsx)(XM,{batch:e,batchAttachments:s.get(e.id)??(e.prompt_number===null?[]:c.get(e.prompt_number)??[]),steeringChildren:t,defaultOpen:n===l.length-1,promptIndex:n,isLast:n===l.length-1},e.id))]})}var nN=`▲`,rN=`▼`;function iN(e){let t=(e.match(/- \[x\]/gi)??[]).length;return{total:t+(e.match(/- \[ \]/g)??[]).length,checked:t}}var aN={active:`bg-green-500/10 text-green-500`,completed:`bg-blue-500/10 text-blue-500`},oN=`bg-muted text-muted-foreground`;function sN({status:e}){return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide`,aN[e]??oN),children:e})}function cN({planId:e}){let[t,n]=(0,W.useState)(`idle`),r=(0,W.useRef)(null);(0,W.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let i=(0,W.useCallback)(()=>{navigator.clipboard?.writeText&&(r.current&&clearTimeout(r.current),navigator.clipboard.writeText(e).then(()=>{n(`copied`),r.current=setTimeout(()=>n(`idle`),1500)},()=>{n(`failed`),r.current=setTimeout(()=>n(`idle`),1500)}))},[e]);return(0,G.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),i()},title:t===`failed`?`Copy failed — check clipboard permissions`:`Copy plan ID: ${e}`,className:`inline-flex items-center gap-1 font-mono text-xs text-muted-foreground hover:text-primary transition-colors`,"aria-live":`polite`,children:[(0,G.jsx)(`span`,{children:ev(e,8)}),t===`copied`&&(0,G.jsx)(Qi,{className:`h-3 w-3 text-primary`}),t===`failed`&&(0,G.jsx)(So,{className:`h-3 w-3 text-error`}),t===`idle`&&(0,G.jsx)(pa,{className:`h-3 w-3`})]})}function lN({plan:e,initialExpanded:t=!1,isDeleting:n=!1,onDelete:r}){let[i,a]=(0,W.useState)(t),o=(0,W.useMemo)(()=>e.content?iN(e.content):null,[e.content]),s=o!==null&&o.total>0,c=s?Math.round(o.checked/o.total*100):0,l=!!e.content,u=()=>{l&&a(e=>!e)};return(0,G.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/50 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:J(`flex items-start gap-3 p-4`,l&&`cursor-pointer hover:bg-muted/70 transition-colors`),onClick:l?u:void 0,onKeyDown:l?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u())}:void 0,role:l?`button`:void 0,tabIndex:l?0:void 0,"aria-expanded":l?i:void 0,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(sN,{status:e.status}),e.title&&(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface truncate`,children:e.title})]}),e.source_path&&(0,G.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground truncate`,title:e.source_path,children:e.source_path}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 font-sans text-xs text-muted-foreground`,children:[(0,G.jsx)(cN,{planId:e.id}),(0,G.jsxs)(`span`,{children:[`Created `,Q_(e.created_at)]}),e.updated_at&&e.updated_at!==e.created_at&&(0,G.jsxs)(`span`,{title:$_(e.updated_at),children:[`Updated `,Q_(e.updated_at)]})]}),s&&(0,G.jsxs)(`div`,{className:`space-y-1 pt-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between font-sans text-xs text-muted-foreground`,children:[(0,G.jsxs)(`span`,{children:[o.checked,`/`,o.total,` items`]}),(0,G.jsxs)(`span`,{children:[c,`%`]})]}),(0,G.jsx)(`div`,{className:`h-1.5 rounded-full bg-border overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-all`,style:{width:`${c}%`}})})]})]}),(l||r)&&(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[r&&(0,G.jsx)(`button`,{onClick:t=>{t.stopPropagation(),r(e.id)},className:`text-xs text-muted-foreground hover:text-destructive transition-colors cursor-pointer disabled:opacity-50`,disabled:n,"aria-label":`Delete plan`,children:n?`Deleting...`:`Delete`}),l&&(0,G.jsx)(`span`,{className:`mt-0.5 text-xs text-muted-foreground`,"aria-hidden":`true`,children:i?nN:rN})]})]}),i&&e.content&&(0,G.jsx)(`div`,{className:`border-t border-border px-4 py-3`,children:(0,G.jsx)(fO,{content:e.content,className:`text-sm`})})]})}function uN({sessionId:e,expandedPlanId:t}){let{data:n,isLoading:r,isError:i}=TA(e),a=EA(e),[o,s]=(0,W.useState)(null);async function c(){if(o)try{await a.mutateAsync(o.id),s(null)}catch{s(null)}}return r?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-muted-foreground`,children:`Loading plans...`})}):i?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-muted-foreground`,children:`Failed to load plans.`})}):!n||n.length===0?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center rounded-lg border border-border bg-muted/30`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-muted-foreground`,children:`No plans captured for this session`})}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[a.isError&&(0,G.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 font-sans text-sm text-destructive`,children:`Failed to delete plan.`}),n.map(e=>(0,G.jsx)(lN,{plan:e,initialExpanded:e.status===`in_progress`||String(e.id)===t,isDeleting:a.isPending&&o?.id===e.id,onDelete:()=>s(e)},e.id)),(0,G.jsx)(dM,{open:o!==null,onOpenChange:e=>{e||s(null)},title:`Delete Plan`,description:`This will permanently remove this captured plan from the session.`,icon:(0,G.jsx)(ho,{className:`h-4 w-4 text-tertiary`}),meta:o?[{label:`Status`,value:o.status},{label:`Title`,value:o.title||o.source_path||o.id}]:[],confirmLabel:`Delete Plan`,variant:`destructive`,onConfirm:c,isPending:a.isPending})]})}var dN=15e3,fN=3e4,pN=3e4,mN=6e4;function hN(e){let t=new URLSearchParams;e?.type&&t.set(`type`,e.type),e?.status&&t.set(`status`,e.status),e?.search&&t.set(`search`,e.search),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset)),e?.session_id&&t.set(`session_id`,e.session_id);let n=t.toString(),r=n?`/spores?${n}`:`/spores`;return Ts({queryKey:[`spores`,e],queryFn:({signal:e})=>q(r,{signal:e}),staleTime:dN,pollCategory:`standard`,refetchInterval:Es.SPORES})}function gN(e){return ot({queryKey:xs([`spore`,e]),queryFn:({signal:t})=>q(`/spores/${e}`,{signal:t}),enabled:e!==void 0,staleTime:fN})}function _N(e,t=1,n=!0){return ot({queryKey:xs([`graph`,e,t]),queryFn:({signal:n})=>q(`/graph/${e}?depth=${t}`,{signal:n}),enabled:n&&e!==void 0,staleTime:pN})}function vN(e=!0){return ot({queryKey:xs([`full-graph`]),queryFn:({signal:e})=>q(`/graph`,{signal:e}),enabled:e,staleTime:pN})}function yN(){return ot({queryKey:xs([`graph-seeds`]),queryFn:({signal:e})=>q(`/graph/seeds`,{signal:e}),staleTime:pN})}function bN(e){let t=e?`/digest?agent_id=${encodeURIComponent(e)}`:`/digest`;return ot({queryKey:xs([`digest`,e]),queryFn:({signal:e})=>q(t,{signal:e}),staleTime:mN})}var xN=200,SN={decision:`default`,discovery:`default`,wisdom:`default`,architecture:`default`,trade_off:`secondary`,"cross-cutting":`secondary`,pattern:`secondary`,gotcha:`destructive`,bug_fix:`destructive`},CN={active:`default`,superseded:`outline`,consolidated:`outline`,obsolete:`outline`};function wN({spore:e}){let[t,n]=(0,W.useState)(!1),r=SN[e.observation_type]??`secondary`,i=CN[e.status]??`outline`,a=e.status!==`active`,o=e.content.split(`
|
|
84
|
-
`).find(e=>e.trim().length>0)?.replace(/^#+\s*/,``)??``;return(0,G.jsxs)(Q,{level:`low`,className:J(`rounded-md border border-outline-variant/20 transition-colors`,a&&`opacity-70`),role:`listitem`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-expanded":t,className:`w-full px-4 py-3 text-left hover:bg-surface-container-high/50 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t?(0,G.jsx)($i,{className:`h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant`}):(0,G.jsx)(ta,{className:`h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-1`,children:[(0,G.jsx)(X,{variant:r,children:e.observation_type}),(0,G.jsx)(X,{variant:i,children:e.status})]}),(0,G.jsx)(`p`,{className:J(`font-sans text-sm text-on-surface truncate`,a&&`line-through`),children:o})]})]})}),t&&(0,G.jsxs)(`div`,{className:`border-t border-outline-variant/20 px-4 py-3 space-y-3`,children:[(0,G.jsx)(fO,{content:e.content}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{title:$_(e.created_at),children:[`Created `,Q_(e.created_at)]}),(0,G.jsxs)(`span`,{title:$_(e.updated_at),children:[`Last updated `,Q_(e.updated_at)]})]})]})]})}function TN({sessionId:e,className:t}){let{data:n,isPending:r,isError:i}=hN({session_id:e,limit:xN});return r?(0,G.jsx)(`div`,{className:J(`space-y-3 p-4`,t),children:Array.from({length:3}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-20 animate-pulse rounded-md bg-surface-container-high`},t))}):i||!n?(0,G.jsx)(`div`,{className:J(`p-4 text-sm text-tertiary`,t),role:`alert`,children:`Failed to load spores for this session.`}):n.spores.length===0?(0,G.jsxs)(`div`,{className:J(`p-8 text-center text-on-surface-variant`,t),children:[(0,G.jsx)(`p`,{className:`font-sans text-sm italic`,children:`No spores derived from this session yet.`}),(0,G.jsx)(`p`,{className:`mt-2 font-mono text-xs`,children:`Spores get captured automatically as the agent learns from your prompts.`})]}):(0,G.jsx)(`div`,{className:J(`space-y-3 p-4`,t),role:`list`,children:n.spores.map(e=>(0,G.jsx)(wN,{spore:e},e.id))})}var EN=`/cortex?tab=canopy`,DN=1e3,ON=1e6;function kN(e){let t=e<0?`-`:``,n=Math.abs(e);return n>=ON?`${t}${(n/ON).toFixed(1)}M`:n>=DN*10?`${t}${Math.round(n/DN)}k`:n>=DN?`${t}${(n/DN).toFixed(1)}k`:`${t}${n.toLocaleString()}`}function AN(e){return e===null?`—`:e.toLocaleString()}function jN({label:e,value:t,hint:n}){return(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 py-1.5 border-b border-[var(--ghost-border)] last:border-0`,title:n,children:[(0,G.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-outline`,children:e}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:t})]})}function MN({sessionId:e,fixture:t,className:n}){let[r,i]=(0,W.useState)(!1),a=t!==void 0,{data:o,isLoading:s}=cj(a?void 0:e),c=a?t:o??null;if(!a&&s)return null;let l=c?.canopy_tokens_saved??0,u=c?.canopy_injections_offered??null,d=c?.canopy_skips_after_injection??null,f=c?.canopy_reads_after_injection??null,p=c?.canopy_redundant_reads??null,m=c?.canopy_injection_total_tokens??null,h=oj(c,`myco_cortex`,`canopy_map`),g=u!==null&&u>0&&d!==null?`${d}/${u} skipped`:null;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:J(`rounded-lg border border-outline-variant/10 bg-surface-container/60 p-4 border-t-2 border-t-sage`,`transition-[border-color,background-color] duration-200`,`hover:border-outline-variant/25 hover:bg-surface-container/80 cursor-pointer text-left`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sage/40`,n),"data-testid":`canopy-efficiency-tile`,"aria-label":`${kN(l)} tokens saved by Canopy. Click for breakdown.`,children:[(0,G.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-wider text-outline mb-2`,children:`Reads saved`}),(0,G.jsx)(`div`,{className:`flex items-end justify-between gap-2`,children:(0,G.jsx)(`p`,{className:J(`font-serif text-2xl font-bold`,l>=0?`text-sage`:`text-terracotta`),children:kN(l)})}),g&&(0,G.jsx)(`p`,{className:`font-mono text-[10px] text-outline mt-1`,children:g}),(0,G.jsxs)(`p`,{className:`font-mono text-[10px] text-outline mt-1`,"data-testid":`canopy-map-calls`,children:[`Map calls: `,h]})]}),(0,G.jsx)(Lf,{open:r,onOpenChange:i,children:(0,G.jsxs)(Vf,{className:`max-w-md`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`Canopy: Reads saved this session`}),(0,G.jsx)(Gf,{children:`Direct token savings from files the agent skipped Reading after Canopy injected file anatomy via PreToolUse.`})]}),(0,G.jsxs)(`div`,{className:`mb-4`,children:[(0,G.jsx)(`p`,{className:J(`font-serif text-3xl font-bold tracking-tight`,l>=0?`text-sage`:`text-terracotta`),"aria-label":`${kN(l)} net tokens saved on Reads`,children:kN(l)}),(0,G.jsxs)(`p`,{className:`font-mono text-[10px] uppercase tracking-wider text-outline mt-1`,children:[`net tokens `,l>=0?`saved on reads`:`spent on injections`]})]}),(0,G.jsxs)(`div`,{className:`space-y-0`,children:[(0,G.jsx)(jN,{label:`Injections offered`,value:AN(u),hint:`PreToolUse Read events where Canopy injected anatomy.`}),(0,G.jsx)(jN,{label:`Skipped after injection`,value:AN(d),hint:`Files the agent did not Read after seeing the injected blob.`}),(0,G.jsx)(jN,{label:`Read anyway`,value:AN(f),hint:`Files the agent Read in full after the injection.`}),(0,G.jsx)(jN,{label:`Injection cost`,value:m===null?`—`:`${kN(m)} tok`,hint:`Sum of tokens spent on Canopy injections this session.`}),p!==null&&p>0&&(0,G.jsx)(jN,{label:`Redundant reads`,value:AN(p),hint:`Files Read more than once in this session (informational).`}),(0,G.jsx)(jN,{label:`Map calls`,value:h.toLocaleString(),hint:`Times the agent called canopy_map() during this session.`})]}),(0,G.jsx)(ri,{to:EN,onClick:()=>i(!1),className:`inline-block mt-4 font-mono text-xs text-sage hover:underline`,children:`Learn more about Canopy →`})]})})]})}function NN(e){return e===`active`?`active`:e===`completed`?`completed`:`error`}var PN={active:`bg-primary`,completed:`bg-secondary`,error:`bg-tertiary`},FN={active:`bg-primary/15 text-primary`,completed:`bg-surface-container-high text-on-surface-variant`,error:`bg-tertiary/15 text-tertiary`};function IN({status:e}){return(0,G.jsx)(`span`,{className:J(`inline-block h-2 w-2 rounded-full shrink-0`,PN[NN(e)])})}function LN({status:e}){let t=NN(e),n=e.charAt(0).toUpperCase()+e.slice(1);return(0,G.jsxs)(`span`,{className:J(`inline-flex items-center gap-1.5 rounded-xs px-2 py-0.5 font-sans text-xs font-medium`,FN[t]),children:[(0,G.jsx)(IN,{status:e}),n]})}function RN(e){return e===null?`—`:Z_(new Date(e*1e3).toISOString())}var zN=1500;function BN({label:e,value:t,mono:n=!0,copyable:r=!1,code:i=!1}){let[a,o]=(0,W.useState)(!1),s=(0,W.useCallback)(()=>{navigator.clipboard.writeText(t),o(!0),setTimeout(()=>o(!1),zN)},[t]),c=i?(0,G.jsx)(`code`,{className:`text-xs font-mono text-primary bg-surface-container-lowest rounded px-1.5 py-0.5`,children:t}):(0,G.jsx)(`span`,{className:J(`text-xs text-on-surface`,n&&`font-mono`),children:t});return(0,G.jsxs)(`div`,{className:`flex items-baseline gap-3 py-1.5 border-b border-[var(--ghost-border)] last:border-0`,children:[(0,G.jsx)(`span`,{className:`shrink-0 w-20 font-sans text-xs font-medium text-on-surface-variant`,children:e}),r?(0,G.jsxs)(`button`,{onClick:s,title:`Click to copy`,className:`flex items-center gap-1.5 min-w-0 hover:text-primary transition-colors cursor-pointer`,children:[c,a&&(0,G.jsx)(Qi,{className:`h-3 w-3 text-primary shrink-0`})]}):(0,G.jsx)(`span`,{className:`min-w-0`,children:c})]})}function VN({label:e,value:t,activeTab:n,onClick:r}){return(0,G.jsx)(`button`,{onClick:()=>r(t),className:J(`px-4 py-2 font-sans text-sm font-medium transition-colors cursor-pointer`,n===t?`border-b-2 border-primary text-on-surface`:`text-muted-foreground hover:text-on-surface`),children:e})}function HN({id:e}){let t=Nn(),{data:n,isLoading:r,isError:i,error:a}=vA(e),{data:o}=mM(),s=WA(),c=CA(),[l,u]=(0,W.useState)(`idle`),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`tab`);return e===`plans`?`plans`:e===`spores`?`spores`:`conversation`}),[h]=(0,W.useState)(()=>new URLSearchParams(window.location.search).get(`plan`)),g=SA(),{data:_}=wA(d?e:null),{data:v}=TA(e);if(r)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(`/sessions`),className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Session Archive`})]}),(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Loading session...`})]})]});if(i||!n)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(`/sessions`),className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Session Archive`})]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Session not found`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:a instanceof Error?a.message:`Unknown error`})]})]});let y=o?hM(o.symbionts,n.agent,e):null;return(0,G.jsxs)(`div`,{className:`space-y-6 overflow-hidden`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(`/sessions`),className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Session Archive`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,G.jsx)(`h1`,{className:`myco-display-lg text-on-surface m-0`,children:n.title??tv(n.id)}),(0,G.jsx)(LN,{status:n.status}),(0,G.jsx)(xM,{annotation:n.release_state}),n.agent&&(0,G.jsx)(X,{variant:`outline`,className:`font-mono text-[10px] px-1.5 py-0`,children:n.agent}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,className:`ml-auto gap-2`,disabled:l===`running`,onClick:async()=>{u(`running`);try{await s.mutateAsync({task:`title-summary`,instruction:`Process session ${e} only`}),u(`done`)}catch{u(`error`)}},children:[l===`running`?(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}):(0,G.jsx)(co,{className:`h-4 w-4`}),l===`done`?`Summary Requested`:`Generate Summary`]}),(()=>{let t=n.status!==`active`,r=c.isSuccess?`Session Completed`:t?`Already Completed`:`Complete Session`;return(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,className:`gap-2`,disabled:c.isPending||t,title:t?`Session is already completed`:`Mark this session completed and regenerate its summary`,onClick:()=>c.mutate(e),children:[c.isPending?(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}):(0,G.jsx)(oa,{className:`h-4 w-4`}),r]})})(),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`gap-2 text-tertiary hover:text-tertiary hover:bg-tertiary/10`,onClick:()=>f(!0),children:[(0,G.jsx)(ho,{className:`h-4 w-4`}),`Delete`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 font-sans text-sm text-on-surface-variant`,children:[n.user&&(0,G.jsxs)(`span`,{children:[`User: `,(0,G.jsx)(`span`,{className:`text-on-surface`,children:n.user})]}),n.branch&&(0,G.jsxs)(`span`,{children:[`Branch: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:n.branch})]}),(0,G.jsxs)(`span`,{children:[`Started `,RN(n.started_at)]}),n.ended_at&&(0,G.jsxs)(`span`,{children:[`Duration: `,iv(n.started_at,n.ended_at)]})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,G.jsx)(Nj,{label:`Prompts`,value:String(n.prompt_count),tone:`sage`}),(0,G.jsx)(Nj,{label:`Tool Calls`,value:String(n.tool_count),tone:`sage`}),(0,G.jsx)(Nj,{label:`Plans`,value:String(v?.length??0)}),(0,G.jsx)(MN,{sessionId:e})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-4 overflow-hidden`,children:[(0,G.jsx)(MM,{className:`mb-3`,children:`Metadata`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-6`,children:[(0,G.jsx)(BN,{label:`Session ID`,value:e,copyable:!0}),y&&(0,G.jsx)(BN,{label:`Resume`,value:y,copyable:!0,code:!0}),n.parent_session_id&&(0,G.jsx)(BN,{label:`Parent`,value:n.parent_session_id}),n.parent_session_reason&&(0,G.jsx)(BN,{label:`Reason`,value:n.parent_session_reason,mono:!1}),n.project_root&&(0,G.jsx)(BN,{label:`Project`,value:n.project_root})]})]}),n.summary&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 overflow-hidden`,children:[(0,G.jsx)(MM,{className:`mb-2`,children:`Summary`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant whitespace-pre-wrap break-words`,children:n.summary})]}),(0,G.jsxs)(`div`,{className:`min-w-0 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex gap-0 border-b border-border mb-4`,children:[(0,G.jsx)(VN,{label:`Conversation`,value:`conversation`,activeTab:p,onClick:m}),(0,G.jsx)(VN,{label:`Plans`,value:`plans`,activeTab:p,onClick:m}),(0,G.jsx)(VN,{label:`Spores`,value:`spores`,activeTab:p,onClick:m})]}),p===`conversation`&&(0,G.jsx)(tN,{sessionId:e}),p===`plans`&&(0,G.jsx)(uN,{sessionId:e,expandedPlanId:h}),p===`spores`&&(0,G.jsx)(TN,{sessionId:e})]}),(0,G.jsx)(dM,{open:d,onOpenChange:f,title:`Delete Session`,description:`This will permanently remove this session and all related data. This action cannot be undone.`,icon:(0,G.jsx)(ho,{className:`h-4 w-4 text-tertiary`}),meta:n?[{label:`ID`,value:tv(n.id)},{label:`Title`,value:n.title||tv(n.id)}]:[],impact:_?[{label:`Prompts`,value:_.promptCount},{label:`Spores`,value:_.sporeCount},{label:`Attachments`,value:_.attachmentCount},{label:`Graph Edges`,value:_.graphEdgeCount}]:[],confirmLabel:`Delete Session`,variant:`destructive`,onConfirm:()=>{g.mutate(n.id,{onSuccess:()=>{f(!1),t(`/sessions`)}})},isPending:g.isPending})]})}var UN=300;function WN(e,t=UN){let[n,r]=(0,W.useState)(e);return(0,W.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function GN({initialFilters:e}){let[t,n]=(0,W.useState)(``),r=WN(t),[i,a]=(0,W.useState)(e),[o,s]=(0,W.useState)(0),c=(0,W.useCallback)((e,t)=>{a(n=>({...n,[e]:t})),s(0)},[]),l=(0,W.useCallback)(e=>{n(e),s(0)},[]),u=(0,W.useCallback)(e=>{let t=i[e];return t&&t!==`all`?t:void 0},[i]);return{searchInput:t,debouncedSearch:r.length>0?r:void 0,filterValues:i,offset:o,setOffset:s,handleSearchChange:l,handleFilterChange:c,activeFilter:u}}var KN={key:`status`,label:`Status`,options:[{value:`all`,label:`All statuses`},{value:`active`,label:`Active`},{value:`completed`,label:`Completed`}]},qN={key:`has_plan`,label:`Plans`,options:[{value:`all`,label:`All sessions`},{value:`true`,label:`With a plan`}]};function JN(){let{id:e}=Ln(),t=Nn(),[n]=di(),r=(0,W.useRef)(null),i=(0,W.useMemo)(()=>({status:n.get(`status`)??`all`,agent:n.get(`agent`)??`all`,has_plan:n.get(`has_plan`)===`true`?`true`:`all`}),[n]),{searchInput:a,debouncedSearch:o,filterValues:s,offset:c,setOffset:l,handleSearchChange:u,handleFilterChange:d,activeFilter:f}=GN({initialFilters:i});(0,W.useEffect)(()=>{for(let[e,t]of Object.entries(i))s[e]!==t&&d(e,t)},[i]);let{data:p}=mM(),m=(0,W.useMemo)(()=>[KN,{key:`agent`,label:`Symbiont`,options:[{value:`all`,label:`All symbionts`},...(p?.symbionts??[]).filter(e=>e.enabled).map(e=>({value:e.name,label:e.displayName}))]},qN],[p]),h=f(`status`),g=f(`agent`),_=f(`has_plan`)===`true`;return(0,G.jsxs)(`div`,{className:`flex flex-col h-full gap-4 p-4`,children:[(0,G.jsx)(oM,{searchPlaceholder:`Search sessions...`,searchValue:a,onSearchChange:u,filters:m,filterValues:s,onFilterChange:d,inputRef:r}),(0,G.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,G.jsx)(iM,{hasSelection:!!e,onCloseMobileDetail:()=>t(`..`),masterAriaLabel:`Sessions`,detailAriaLabel:`Session details`,master:(0,G.jsx)(jM,{selectedId:e,search:o,statusFilter:h,agentFilter:g,hasPlanFilter:_,offset:c,onOffsetChange:l,filterInputRef:r}),detail:e?(0,G.jsx)(HN,{id:e}):(0,G.jsx)(aM,{message:`Select a session to see its details.`})})})]})}function YN({title:e,subtitle:t,actions:n,className:r}){return(0,G.jsx)(`div`,{className:J(`pb-6`,r),children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`font-serif text-2xl font-normal text-on-surface tracking-wide`,children:e}),t&&(0,G.jsx)(`p`,{className:`mt-1 font-sans text-sm text-on-surface-variant`,children:t})]}),n&&(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:n})]})})}function XN({checked:e,onCheckedChange:t,disabled:n}){return(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,disabled:n,onClick:()=>t(!e),className:`relative inline-flex h-6 w-11 shrink-0 rounded-full transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 ${n?`cursor-not-allowed opacity-50`:`cursor-pointer`} ${e?`bg-primary`:`bg-surface-container-high`}`,children:(0,G.jsx)(`span`,{className:`pointer-events-none block h-5 w-5 rounded-full bg-on-surface shadow-lg ring-0 transition-transform ${e?`translate-x-5`:`translate-x-0`}`})})}var ZN=(0,W.createContext)(null);function QN({children:e}){let[t,n]=(0,W.useState)(()=>new Set),r=(0,W.useCallback)(e=>{n(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),i=(0,W.useCallback)(()=>n(new Set),[]),a=(0,W.useMemo)(()=>({dirty:t,markDirty:r,clear:i}),[t,r,i]);return(0,G.jsx)(ZN.Provider,{value:a,children:e})}function $N(){let e=(0,W.useContext)(ZN);if(!e)throw Error(`useRestartGate must be inside RestartGateProvider`);return e}function eP(){return(0,W.useContext)(ZN)?.markDirty??(()=>{})}function tP(){let{dirty:e,clear:t}=$N(),{restart:n,isRestarting:r}=Rs();if(e.size===0)return null;let i=async()=>{try{await n(),t()}catch{}};return(0,G.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-4 rounded-md border border-ochre/40 bg-ochre/5 p-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Restart required`}),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant truncate`,children:[`Changed: `,[...e].join(`, `)]})]}),(0,G.jsxs)(Y,{onClick:i,size:`sm`,disabled:r,children:[r?(0,G.jsx)(Ra,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):(0,G.jsx)(Qa,{className:`mr-1.5 h-3.5 w-3.5`}),`Restart daemon`]})]})}function nP({id:e,label:t,scope:n,scopeIndicator:r,hint:i,helper:a,error:o,children:s}){return(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:e,className:`font-sans text-sm font-medium text-on-surface`,children:t}),i&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant font-normal`,children:[`(`,i,`)`]}),r??(n?(0,G.jsx)(dk,{scope:n}):null)]}),s,a&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:a}),o&&(0,G.jsxs)(`p`,{className:`flex items-center gap-1 font-sans text-xs text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-3 w-3`}),`Save failed: `,o]})]})}var rP={machine:`machine`,grove:`grove`,project:`project`,local:`personal`};function iP({path:e,label:t,hint:n,requiresRestart:r,commitOn:i=`change`,parse:a,children:o}){let{effective:s,local:c,setField:l,resetField:u}=LO(),d=eP(),f=ak(e),p=f.overridableBy.includes(`local`),m=f.home,h=SO(s??{},e),g=p&&SO(c??{},e)!==void 0,_=(0,W.useRef)(h);_.current=h;let[v,y]=(0,W.useState)(h),b=(0,W.useRef)(!1);(0,W.useEffect)(()=>{b.current||y(h)},[h]);let[x,S]=(0,W.useState)(null),C=(0,W.useCallback)(t=>{let n=a?a(t):t;n!==_.current&&(S(null),l(e,n,m).then(()=>{r&&d(e)}).catch(t=>{y(_.current),S(t instanceof Error?t.message:String(t)),console.error(`[scoped-field] write failed for ${e}`,t)}))},[e,m,a,r,l,d]),w=(0,W.useCallback)(e=>{b.current=!0,y(e),i===`change`&&(C(e),b.current=!1)},[C,i]),T=(0,W.useCallback)(()=>{i===`blur`&&v!==void 0&&C(v),b.current=!1},[C,i,v]),E=p?(0,G.jsx)(pk,{path:e,hasLocalOverride:g,onSavePersonal:()=>l(e,_.current,`local`).catch(e=>console.error(`[scoped-field] save-personal failed`,e)),onReset:()=>u(e).catch(e=>console.error(`[scoped-field] reset failed`,e))}):void 0,D=rP[f.home]??`project`;return(0,G.jsx)(`div`,{id:Fi(e),"data-config-field":e,className:`rounded-md transition-all duration-300`,children:(0,G.jsx)(nP,{label:t,hint:n,scope:E?void 0:D,scopeIndicator:E,error:x??void 0,children:o({value:v,onChange:w,onBlur:T})})})}var aP=200,oP={1500:`T1500 — Compact`,5e3:`T5000 — Standard`,1e4:`T10000 — Full`};function sP(e){return oP[e]??`T${e}`}function cP({tier:e}){let[t,n]=(0,W.useState)(!1),r=e.content.length>aP,i=r&&!t?e.content.slice(0,aP)+`…`:e.content;return(0,G.jsxs)(Q,{level:`low`,className:`p-5 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface font-medium`,children:sP(e.tier)}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Generated `,Q_(e.generated_at)]})]}),(0,G.jsx)(fO,{content:i}),r&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:`h-7 gap-1 text-xs text-on-surface-variant`,onClick:()=>n(!t),children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(na,{className:`h-3 w-3`}),`Show less`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)($i,{className:`h-3 w-3`}),`Show more (`,e.content.length-aP,` more chars)`]})})]})}function lP(){return(0,G.jsxs)(Q,{level:`low`,className:`p-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`div`,{className:`h-4 w-24 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-20 animate-pulse rounded bg-surface-container`})]}),(0,G.jsxs)(`div`,{className:`space-y-2 mt-3`,children:[(0,G.jsx)(`div`,{className:`h-3 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-3/5 animate-pulse rounded bg-surface-container`})]})]})}function uP({agentId:e}){let{data:t,isLoading:n,isError:r,error:i}=bN(e),a=t?.tiers??[];return n?(0,G.jsx)(`div`,{className:`space-y-4`,children:[1,2,3].map(e=>(0,G.jsx)(lP,{},e))}):r?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-destructive`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load digest`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:i instanceof Error?i.message:`Unknown error`})]}):a.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ea,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No digest generated yet`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-center max-w-xs`,children:`Run the agent with the digest-only task to synthesize your vault knowledge into context extracts.`})]}):(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[a.length,` tier`,a.length===1?``:`s`,` — pre-computed context extracts at different token budgets.`]}),a.map(e=>(0,G.jsx)(cP,{tier:e},e.tier))]})}var dP=6,fP=[{value:`all`,label:`All`},{value:`yes`,label:`Yes`},{value:`no`,label:`No`}],pP=[{value:`all`,label:`All`},{value:`typescript`,label:`TypeScript`},{value:`javascript`,label:`JavaScript`},{value:`tsx`,label:`TSX`},{value:`jsx`,label:`JSX`},{value:`python`,label:`Python`},{value:`rust`,label:`Rust`},{value:`go`,label:`Go`},{value:`json`,label:`JSON`},{value:`yaml`,label:`YAML`},{value:`markdown`,label:`Markdown`},{value:`shell`,label:`Shell`},{value:`sql`,label:`SQL`}],mP=[{id:`path`,label:`Path`},{id:`language`,label:`Language`},{id:`embedded`,label:`Embedded`},{id:`llm_updated_at`,label:`Last Described`},{id:`token_estimate`,label:`Tokens`}];function hP(e){if(e===`yes`)return!0;if(e===`no`)return!1}function gP(e){return(0,G.jsx)(X,{variant:e?`default`:`secondary`,children:e?`Yes`:`No`})}function _P({label:e,value:t,options:n,onValueChange:r,triggerClassName:i=`w-32`}){return(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-sans text-xs uppercase tracking-wider`,children:e}),(0,G.jsx)(`div`,{className:`${i} shrink-0`,children:(0,G.jsxs)(c_,{value:t,onValueChange:r,children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{})}),(0,G.jsx)(d_,{children:n.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})})]})}function vP({children:e,className:t,sortKey:n,activeSort:r,activeDir:i,onSort:a}){let o=n!==void 0&&a!==void 0,s=o&&r===n;return o?(0,G.jsx)(`th`,{className:J(`px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,t),"aria-sort":s?i===`desc`?`descending`:`ascending`:`none`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>a(n),className:J(`flex items-center gap-1 uppercase tracking-widest text-[10px] font-medium transition-colors`,s?`text-on-surface`:`text-on-surface-variant hover:text-on-surface`),"aria-label":`Sort by ${String(e)}`,children:[(0,G.jsx)(`span`,{children:e}),s?i===`desc`?(0,G.jsx)($i,{className:`h-3 w-3`}):(0,G.jsx)(na,{className:`h-3 w-3`}):(0,G.jsx)($i,{className:`h-3 w-3 opacity-30`})]})}):(0,G.jsx)(`th`,{className:J(`px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,t),children:e})}function yP(){return(0,G.jsxs)(`tr`,{className:`border-b border-[var(--ghost-border)]`,children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-64 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-16 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-10 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-10 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-20 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-12 rounded bg-surface-container-high animate-pulse`})})]})}function bP({entry:e,selected:t,onClick:n}){return(0,G.jsxs)(`tr`,{className:J(`border-b border-[var(--ghost-border)] last:border-0 cursor-pointer transition-all duration-150`,`hover:bg-surface-container/60 hover:shadow-[inset_3px_0_0_var(--primary)]`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40`,t&&`bg-primary/5 shadow-[inset_3px_0_0_var(--primary)]`),onClick:n,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},tabIndex:0,role:`row`,"aria-selected":t,"aria-label":`Canopy entry: ${e.path}`,"data-testid":`canopy-entry-row-${e.path}`,children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface block truncate`,title:e.path,children:e.path})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:e.language??`—`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:gP(e.llm_description!==null)}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:gP(e.embedded===1)}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:ov(e.llm_updated_at)})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:e.token_estimate.toLocaleString()})})]})}function xP({selectedPath:e,onSelectPath:t}){let{searchInput:n,debouncedSearch:r,filterValues:i,offset:a,setOffset:o,handleSearchChange:s,handleFilterChange:c,activeFilter:l}=GN({initialFilters:{language:`all`,described:`all`}}),[u,d]=(0,W.useState)(`llm_updated_at`),[f,p]=(0,W.useState)(`desc`),m=e=>{e===u?p(e=>e===`asc`?`desc`:`asc`):(d(e),p(`asc`))},{data:h,isLoading:g,isError:_,error:v}=uj((0,W.useMemo)(()=>({limit:50,offset:a,language:l(`language`),described:hP(l(`described`)),q:r,sort_by:u,sort_dir:f}),[a,l,r,u,f])),y=h?.rows??[],b=h?.total??0,x=(0,G.jsxs)(Q,{level:`bright`,className:`flex flex-wrap items-center gap-3 px-4 py-2 rounded-md`,children:[(0,G.jsx)(no,{className:`h-3.5 w-3.5 text-on-surface-variant shrink-0`}),(0,G.jsx)(Kf,{placeholder:`Search files (path or description)…`,value:n,onChange:e=>s(e.target.value),className:`bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1 min-w-[180px]`,"aria-label":`Search files`}),(0,G.jsx)(_P,{label:`Language`,value:i.language??`all`,options:pP,onValueChange:e=>c(`language`,e)}),(0,G.jsx)(_P,{label:`Described`,value:i.described??`all`,options:fP,onValueChange:e=>c(`described`,e)})]}),S=(0,G.jsx)(`thead`,{children:(0,G.jsx)(`tr`,{className:`border-b border-[var(--ghost-border)] bg-surface-container/50`,children:mP.map((e,t)=>{let n=[(0,G.jsx)(vP,{sortKey:e.id,activeSort:u,activeDir:f,onSort:m,children:e.label},e.id)];return e.id===`language`&&n.push((0,G.jsx)(vP,{children:`Described`},`described`)),n})})});return _?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[x,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load canopy entries`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:v instanceof Error?v.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[x,g?(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden`,children:(0,G.jsxs)(`table`,{className:`w-full`,children:[S,(0,G.jsx)(`tbody`,{children:Array.from({length:dP}).map((e,t)=>(0,G.jsx)(yP,{},t))})]})}):y.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-3 text-on-surface-variant`,"data-testid":`canopy-entries-empty`,children:[(0,G.jsx)(Sa,{className:`h-10 w-10 opacity-20`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:b===0?`No canopy entries match the current filters.`:`No matching entries on this page.`})]}):(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden`,children:(0,G.jsxs)(`table`,{className:`w-full`,"aria-label":`Canopy entries`,children:[S,(0,G.jsx)(`tbody`,{children:y.map(n=>(0,G.jsx)(bP,{entry:n,selected:n.path===e,onClick:()=>t(n.path)},n.path))})]})}),(0,G.jsx)(fM,{total:b,offset:a,limit:50,onPageChange:o})]})}function SP({open:e,onClose:t,widthPx:n=480,children:r,ariaLabel:i=`Detail panel`,className:a,testIdRoot:o}){return(0,W.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]),e?(0,G.jsxs)(Q,{glass:!0,role:`dialog`,"aria-label":i,className:J(`fixed top-3 right-3 bottom-3 z-30 flex flex-col shadow-lg border border-outline-variant/15 rounded-md max-w-[calc(100vw-1.5rem)]`,a),style:{width:n},"data-testid":o?`${o}-panel`:void 0,children:[(0,G.jsx)(`div`,{className:`flex justify-end px-3 pt-3`,children:(0,G.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Close detail`,"data-testid":o?`${o}-close`:void 0,className:`shrink-0 rounded-md p-1 text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high transition-colors`,children:(0,G.jsx)(So,{className:`h-4 w-4`})})}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 pb-5 pt-2`,children:r})]}):null}function CP(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function wP(e){return e.length>12?`${e.slice(0,12)}…`:e}function TP({label:e,children:t}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-[140px_1fr] gap-3 items-baseline`,children:[(0,G.jsx)(`span`,{className:`font-sans text-xs uppercase tracking-wide text-on-surface-variant`,children:e}),(0,G.jsx)(`div`,{className:`font-mono text-xs text-on-surface min-w-0 break-all`,children:t})]})}function EP({text:e}){let[t,n]=(0,W.useState)(!1),r=(0,W.useCallback)(async()=>{navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(e),n(!0),window.setTimeout(()=>n(!1),1500))},[e]);return(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>void r(),className:`gap-1 px-2 h-6 text-xs text-on-surface-variant`,children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Qi,{className:`h-3 w-3`}),`Copied`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pa,{className:`h-3 w-3`}),`Copy`]})})}function DP(){return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`div`,{className:`h-7 w-48 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-20 animate-pulse rounded-md bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:6}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-4 w-full animate-pulse rounded bg-surface-container-high`},t))})]})}function OP({path:e,onBack:t,onClose:n}){let{data:r,isPending:i,isError:a,error:o}=dj(e),s=fj(),c=pj(),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(null),[h,g]=(0,W.useState)(!1),_=(0,W.useMemo)(()=>CP(r?.exports_json??null),[r?.exports_json]),v=(0,W.useMemo)(()=>CP(r?.imports_json??null),[r?.imports_json]),y=(0,W.useCallback)(()=>{u(null),f(!1),s.mutate(e,{onSuccess:()=>{f(!0),window.setTimeout(()=>f(!1),2500)},onError:e=>{u(e instanceof Error?e.message:`Re-embed failed`)}})},[e,s]),b=(0,W.useCallback)(()=>{m(null),g(!1),c.mutate(e,{onSuccess:()=>{g(!0),window.setTimeout(()=>g(!1),2500)},onError:e=>{m(e instanceof Error?e.message:`Re-describe failed`)}})},[e,c]);if(i)return(0,G.jsx)(SP,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsx)(DP,{})});if(a)return(0,G.jsx)(SP,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[t?(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Back to list`]}):null,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,"data-testid":`canopy-entry-detail-error`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load entry`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:o instanceof Error?o.message:`Unknown error`})]})]})});if(!r)return(0,G.jsx)(SP,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[t?(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Back to list`]}):null,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant`,"data-testid":`canopy-entry-detail-empty`,children:[(0,G.jsx)(ra,{className:`h-5 w-5 opacity-50`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No entry found at this path.`})]})]})});let x=r.embedded===1;return(0,G.jsx)(SP,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsxs)(`div`,{className:`space-y-4`,"data-testid":`canopy-entry-detail`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-2 min-w-0`,children:[t?(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant -ml-2`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Back to list`]}):null,(0,G.jsx)(`h2`,{className:`font-mono text-sm text-on-surface break-all`,title:r.path,children:r.path}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r.language?(0,G.jsx)(X,{variant:`outline`,children:r.language}):null,(0,G.jsx)(X,{variant:x?`default`:`secondary`,children:x?`Embedded`:`Not embedded`}),(0,G.jsx)(X,{variant:r.llm_description?`default`:`secondary`,children:r.llm_description?`Described`:`No description`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:b,disabled:c.isPending,className:`gap-2`,"data-testid":`canopy-entry-redescribe`,"aria-label":`Re-run the Myco agent's description for this file.`,title:`Re-run the Myco agent's description for this file.`,children:[(0,G.jsx)(co,{className:c.isPending?`h-3.5 w-3.5 animate-pulse`:`h-3.5 w-3.5`}),c.isPending?`Describing...`:`Re-describe`]}),(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:y,disabled:s.isPending,className:`gap-2`,"data-testid":`canopy-entry-reembed`,children:[(0,G.jsx)(Qa,{className:s.isPending?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),s.isPending?`Queuing...`:`Re-embed`]})]}),h?(0,G.jsx)(`span`,{className:`font-sans text-xs text-primary`,role:`status`,children:`Queued for re-describe`}):null,p?(0,G.jsx)(`span`,{className:`font-sans text-xs text-tertiary`,role:`alert`,children:p}):null,d?(0,G.jsx)(`span`,{className:`font-sans text-xs text-primary`,role:`status`,children:`Queued for re-embed`}):null,l?(0,G.jsx)(`span`,{className:`font-sans text-xs text-tertiary`,role:`alert`,children:l}):null]})]}),r.llm_description?(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-primary/15 p-4`,children:[(0,G.jsx)(MM,{children:`Description`}),(0,G.jsx)(`p`,{className:`mt-2 font-sans text-sm text-on-surface leading-relaxed`,children:r.llm_description})]}):(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4`,children:[(0,G.jsx)(MM,{children:`Description`}),(0,G.jsx)(`p`,{className:`mt-2 font-sans text-sm text-on-surface-variant`,children:`The Myco agent hasn't described this file yet.`})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4 space-y-2`,children:[(0,G.jsx)(MM,{children:`Exports`}),_.length===0?(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`No exports detected.`}):(0,G.jsx)(`ul`,{className:`space-y-1`,children:_.map(e=>(0,G.jsx)(`li`,{className:`font-mono text-xs text-on-surface break-all`,children:e},e))})]}),(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4 space-y-2`,children:[(0,G.jsx)(MM,{children:`Imports`}),v.length===0?(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`No imports detected.`}):(0,G.jsx)(`ul`,{className:`space-y-1`,children:v.map(e=>(0,G.jsx)(`li`,{className:`font-mono text-xs text-on-surface break-all`,children:e},e))})]})]}),r.top_comment?(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4 space-y-2`,children:[(0,G.jsx)(MM,{children:`Top Comment`}),(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs text-on-surface`,children:r.top_comment})]}):null,(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4 space-y-3`,children:[(0,G.jsx)(MM,{children:`Metadata`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(TP,{label:`Tokens`,children:r.token_estimate.toLocaleString()}),(0,G.jsx)(TP,{label:`Lines`,children:r.line_count.toLocaleString()}),(0,G.jsxs)(TP,{label:`Size`,children:[r.size_bytes.toLocaleString(),` B`]}),(0,G.jsx)(TP,{label:`Hash`,children:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(`code`,{title:r.content_hash,children:wP(r.content_hash)}),(0,G.jsx)(EP,{text:r.content_hash})]})}),(0,G.jsx)(TP,{label:`Indexed`,children:$_(r.mechanical_updated_at)}),(0,G.jsx)(TP,{label:`Described`,children:r.llm_updated_at===null?`—`:$_(r.llm_updated_at)})]})]})]})})}function kP({defaultPath:e}={}){let[t,n]=(0,W.useState)(e);return(0,G.jsxs)(`div`,{className:`relative space-y-6`,children:[(0,G.jsx)(xP,{selectedPath:t,onSelectPath:n}),t?(0,G.jsx)(OP,{path:t,onClose:()=>n(void 0)}):null]})}var AP={canopy_disabled:{title:`Canopy injection is turned off.`,detail:(0,G.jsxs)(G.Fragment,{children:[`Enable canopy injection on the`,` `,(0,G.jsx)(ri,{to:`/cortex?tab=canopy`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`Cortex → Canopy`}),` `,`page before regenerating the map.`]})},no_described_entries:{title:`No described files yet.`,detail:(0,G.jsxs)(G.Fragment,{children:[`The map is built from per-file descriptions written by the`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=canopy-describe`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`canopy-describe task`}),`, which is opt-in. Enable its schedule (or run it once) so files get described, then regenerate the map.`]})},inputs_unchanged:{title:`The map is already current.`,detail:(0,G.jsx)(G.Fragment,{children:`No described files have changed since the last run. Use Rebuild to regenerate from scratch.`})},no_project_root:{title:`Project root unavailable.`,detail:(0,G.jsx)(G.Fragment,{children:`The daemon can’t resolve a project directory for this vault.`})}};function jP(){let e=hj(),t=gj(),[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(null),c=(0,W.useCallback)(e=>{r(null),a(null),s(e),t.mutate({force_cold_start:e===`rebuild`},{onSettled:()=>s(null),onSuccess:e=>{`skipped`in e&&e.skipped&&a(e.reason)},onError:e=>{r(e instanceof Error?e.message:`Regenerate failed`)}})},[t]),l=i?AP[i]??null:null,u=t.isPending,d=e.data,f=d?.is_empty===!0||!d?.content,p=d?.generated_at!==void 0&&d.generated_at!==null?$_(d.generated_at):`—`,m=d?.token_estimate!==void 0&&d.token_estimate!==null?d.token_estimate.toLocaleString():`—`;return(0,G.jsxs)(`div`,{className:`space-y-6`,"data-testid":`project-map-panel`,children:[(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-primary/15 p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-primary/10 p-2 text-primary`,children:(0,G.jsx)(Ba,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`The Canopy Map is a guided tour of your project's architecture.`}),(0,G.jsxs)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:[`The Myco agent regenerates it as the codebase shifts, so connected agents can pull a current overview before exploring with Glob or Grep. Use `,(0,G.jsx)(`strong`,{children:`Rebuild`}),` to start over from scratch instead of refreshing the existing draft.`]})]})]})}),(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-2 min-w-0`,children:[(0,G.jsx)(MM,{children:`Canopy Map`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{"data-testid":`project-map-generated-at`,children:[`Last generated: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:p})]}),(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,G.jsxs)(`span`,{"data-testid":`project-map-tokens`,children:[`Tokens: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:m})]}),f?(0,G.jsx)(X,{variant:`secondary`,className:`ml-1`,children:`No map yet`}):null]})]}),f?null:(0,G.jsxs)(`div`,{className:`flex flex-col items-end gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`default`,size:`sm`,onClick:()=>c(`refresh`),disabled:u,className:`gap-2`,"data-testid":`canopy-map-refresh`,children:[(0,G.jsx)(Qa,{className:o===`refresh`?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),o===`refresh`?`Refreshing…`:`Refresh`]}),(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:()=>c(`rebuild`),disabled:u,className:`gap-2`,"data-testid":`canopy-map-rebuild`,children:[(0,G.jsx)($a,{className:o===`rebuild`?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),o===`rebuild`?`Rebuilding…`:`Rebuild`]})]}),n?(0,G.jsx)(`span`,{className:`font-sans text-xs text-tertiary`,role:`alert`,children:n}):null]})]}),i?(0,G.jsxs)(`div`,{className:`mt-4 flex items-start gap-2 rounded-md border border-primary/20 bg-primary/5 p-3 text-xs text-on-surface`,role:`status`,"data-testid":`canopy-map-skip-notice`,children:[(0,G.jsx)(Ma,{className:`mt-0.5 h-3.5 w-3.5 flex-shrink-0 text-primary`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`font-sans font-medium`,children:l?.title??`Regenerate skipped.`}),(0,G.jsx)(`p`,{className:`font-sans text-on-surface-variant`,children:l?.detail??(0,G.jsxs)(G.Fragment,{children:[`Reason: `,(0,G.jsx)(`code`,{className:`font-mono`,children:i})]})})]})]}):null]}),e.isPending?(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6`,children:(0,G.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,G.jsx)(`div`,{className:`h-5 w-1/3 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-full animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-5/6 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-2/3 animate-pulse rounded bg-surface-container-high`})]})}):e.isError?(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-tertiary/20 p-6`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 text-tertiary`,"data-testid":`project-map-error`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load Canopy Map.`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:e.error instanceof Error?e.error.message:`Unknown error`})]})}):f?(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-primary/20 p-8`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 text-center`,"data-testid":`project-map-empty`,children:[(0,G.jsx)(Ba,{className:`h-6 w-6 text-primary`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface`,children:d?.message??`No Canopy Map yet.`}),(0,G.jsxs)(`p`,{className:`max-w-md font-sans text-xs text-on-surface-variant`,children:[`Generate the first map to give connected agents a high-level tour of your codebase. Future runs refresh incrementally; use`,` `,(0,G.jsx)(`strong`,{children:`Rebuild`}),` to start over.`]}),(0,G.jsxs)(`p`,{className:`max-w-md font-sans text-xs text-on-surface-variant`,children:[`The map needs at least one described file to build from. Enable the`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=canopy-describe`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`canopy-describe task`}),` `,`(opt-in by default) so files get described in the background.`]}),(0,G.jsxs)(Y,{variant:`default`,size:`sm`,onClick:()=>c(`rebuild`),disabled:u,className:`gap-2 mt-1`,"data-testid":`canopy-map-generate`,children:[(0,G.jsx)(Qa,{className:u?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),u?`Generating…`:`Generate Map`]}),n?(0,G.jsx)(`span`,{className:`font-sans text-xs text-tertiary`,role:`alert`,children:n}):null,i?(0,G.jsxs)(`div`,{className:`max-w-md space-y-1 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`p`,{className:`font-sans font-medium text-on-surface`,children:l?.title??`Regenerate skipped.`}),(0,G.jsx)(`p`,{className:`font-sans`,children:l?.detail??(0,G.jsxs)(G.Fragment,{children:[`Reason: `,(0,G.jsx)(`code`,{className:`font-mono`,children:i})]})})]}):null]})}):(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6`,children:(0,G.jsx)(`div`,{"data-testid":`project-map-content`,children:(0,G.jsx)(fO,{content:d.content})})})]})}var MP={2:`grid-cols-1 md:grid-cols-2`,3:`grid-cols-1 md:grid-cols-3`,4:`grid-cols-1 md:grid-cols-2 lg:grid-cols-4`};function NP(e,t){return e||(t<=2?2:t===3?3:4)}function PP({tabs:e,activeTab:t,onTabChange:n,columns:r,className:i}){return(0,G.jsx)(`div`,{role:`tablist`,className:J(`grid divide-y md:divide-y-0 md:divide-x divide-[var(--ghost-border)] border border-[var(--ghost-border)] rounded-md overflow-hidden bg-surface-container-low`,MP[NP(r,e.length)],i),children:e.map(e=>{let r=e.id===t;return(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.id),className:J(`relative flex flex-col items-start gap-1 px-4 py-3 text-left transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,r?`bg-surface-container text-on-surface`:`text-on-surface-variant hover:bg-surface-container/60 hover:text-on-surface`),children:[r&&(0,G.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-[2px] bg-sage`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.Icon&&(0,G.jsx)(e.Icon,{size:14,className:r?`text-sage`:`text-outline`}),(0,G.jsx)(`span`,{className:`myco-display-xs`,children:e.label})]}),e.description&&(0,G.jsx)(`span`,{className:`myco-eyebrow-sm`,children:e.description})]},e.id)})})}function FP({tabs:e,activeTab:t,onTabChange:n,className:r}){return(0,G.jsx)(`div`,{role:`tablist`,className:J(`inline-flex items-center gap-1 p-1 rounded-md bg-surface-container-low border border-[var(--ghost-border)]`,r),children:e.map(e=>{let r=e.id===t;return(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.id),className:J(`inline-flex items-center gap-1.5 px-3 py-1 rounded text-sm font-sans transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,r?`bg-surface-container text-on-surface shadow-[inset_0_-2px_0_var(--sage)]`:`text-on-surface-variant hover:text-on-surface`),children:[(0,G.jsx)(`span`,{children:e.label}),e.count!=null&&(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline`,children:e.count})]},e.id)})})}var IP=[{id:`overview`,label:`Overview`},{id:`entries`,label:`Entries`},{id:`map`,label:`Map`}],LP=new Set(IP.map(e=>e.id)),RP=`section`,zP=[{id:`instructions`,label:`Instructions`,description:`session-start`},{id:`builder`,label:`Builder`,description:`prompt forge`},{id:`digest`,label:`Digest`,description:`context tiers`},{id:`canopy`,label:`Canopy`,description:`code index`}],BP=new Set(zP.map(e=>e.id)),VP=new Set([`completed`,`failed`,`skipped`]),HP=12,UP=140,WP=[{value:`1500`,label:`1.5K - Executive briefing`},{value:`5000`,label:`5K - Deep onboarding`},{value:`10000`,label:`10K - Full institutional`}];function GP(e){let t=new URLSearchParams(e).get(`tab`);return t&&BP.has(t)?t:`instructions`}function KP(e){let t=new URLSearchParams(e).get(RP);return t&&LP.has(t)?t:`overview`}function qP(e){return e?new Date(e*1e3).toLocaleString():`Not generated yet`}function JP(e){switch(e){case`event-tasks-disabled`:return`event-driven tasks are disabled`;case`provider-not-configured`:return`no provider is configured for Cortex instructions`;case`agent-module-unavailable`:return`the agent harness is unavailable`;default:return e??`unknown reason`}}function YP(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=e.match(RegExp(`## ${n}\\n([\\s\\S]*?)\\n\\n## `));if(!r?.[1])return null;try{return JSON.parse(r[1])}catch{return null}}function XP(e){if(!e)return{goal:``,targetSymbiontName:null,targetSymbiontDisplayName:null,inlineInstructions:null};let t=e.match(/^Goal:\n([\s\S]*?)\n\n## Target symbiont\n/),n=YP(e,`Target symbiont`),r=YP(e,`Delivery contract`);return{goal:t?.[1]?.trim()??``,targetSymbiontName:n?.name??null,targetSymbiontDisplayName:n?.displayName??null,inlineInstructions:typeof r?.inline_instructions==`boolean`?r.inline_instructions:null}}function ZP(e){switch(e){case`completed`:return`default`;case`failed`:return`destructive`;case`running`:return`warning`;default:return`secondary`}}function QP(e){return e===null?null:e?`Instructions included in prompt`:`Uses session-start instructions`}function $P(){return ot({queryKey:[`cortex-instructions`],queryFn:({signal:e})=>q(`/cortex/instructions`,{signal:e}),staleTime:6e4})}function eF(e){return Ts({queryKey:[`cortex-prompt-builder`,e],queryFn:({signal:t})=>q(`/cortex/prompt-builder/${e}`,{signal:t}),enabled:!!e,staleTime:0,pollCategory:`realtime`,refetchInterval:e=>{let t=e.state.data?.status;return t&&VP.has(t)?!1:Es.PROGRESS}})}function tF(){let e=An(),t=Nn(),n=GP(e.search),r=KP(e.search),i=(0,W.useCallback)(n=>{if(!BP.has(n))return;let r=new URLSearchParams(e.search);n===`instructions`?r.delete(`tab`):r.set(`tab`,n),n!==`canopy`&&r.delete(RP);let i=r.toString();t({pathname:e.pathname,search:i?`?${i}`:``},{replace:!0})},[e.pathname,e.search,t]),a=(0,W.useCallback)(n=>{if(!LP.has(n))return;let r=new URLSearchParams(e.search);r.set(`tab`,`canopy`),n===`overview`?r.delete(RP):r.set(RP,n);let i=r.toString();t({pathname:e.pathname,search:i?`?${i}`:``},{replace:!0})},[e.pathname,e.search,t]);return(0,G.jsxs)(bj,{children:[(0,G.jsx)(YN,{title:`Cortex`,subtitle:`Manage session-start context, prompt building, and digest access for connected symbionts.`}),(0,G.jsx)(PP,{tabs:zP.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:n,onTabChange:i,columns:4}),n===`digest`?(0,G.jsx)(oF,{}):n===`builder`?(0,G.jsx)(iF,{}):n===`canopy`?(0,G.jsx)(nF,{section:r,onSectionChange:a,searchParams:e.search}):(0,G.jsx)(rF,{})]})}function nF({section:e,onSectionChange:t,searchParams:n}){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(FP,{tabs:IP.map(e=>({id:e.id,label:e.label})),activeTab:e,onTabChange:t}),e===`entries`?(()=>{let e=new URLSearchParams(n).get(`path`)??void 0;return(0,G.jsx)(kP,{defaultPath:e},e??`no-path`)})():e===`map`?(0,G.jsx)(jP,{}):(0,G.jsx)(cF,{})]})}function rF(){let{effective:e,isLoading:t}=LO(),n=$P(),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(!0),[s,c]=(0,W.useState)(null),l=(0,W.useCallback)(async()=>{i(!0);try{c(await ts(`/cortex/instructions/refresh`,{})),await n.refetch()}finally{i(!1)}},[n]);if(t||!e)return(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading...`});let u=n.data;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(Q,{level:`low`,accent:`sage`,className:`rounded-lg border border-outline-variant p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-sage/10 p-2 text-sage`,children:(0,G.jsx)(Zi,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(wj,{tone:`sage`,children:`Cortex · instructions`}),(0,G.jsx)(`h3`,{className:`myco-display-sm text-on-surface m-0`,children:`Session-start instructions for Myco-enabled symbionts`}),(0,G.jsx)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:`Review the stored instructions, control whether they inject alongside the digest, and refresh the stored guidance when project context changes.`})]})]})}),(0,G.jsxs)(Q,{id:Pi.cortexInstructions,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(wj,{children:`Settings`}),(0,G.jsx)(`h3`,{className:`myco-display-sm text-on-surface m-0`,children:`Injection lifecycle`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Choose which Cortex context is added as symbionts move through session start, subagent start, and prompt submit events.`})]}),(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`grid gap-4 border-t border-outline-variant/20 pt-5 lg:grid-cols-[minmax(14rem,18rem)_minmax(0,1fr)]`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h4`,{className:`font-sans text-sm font-semibold text-on-surface m-0`,children:`Session start`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Context added when a new symbiont session begins.`})]}),(0,G.jsxs)(`div`,{className:`grid max-w-3xl gap-4 md:grid-cols-[minmax(12rem,16rem)_minmax(14rem,24rem)]`,children:[(0,G.jsx)(iP,{path:ji.instructions.injectOnSessionStart,label:`Managed instructions`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(iP,{path:ji.digest.injectOnSessionStart,label:`Preferred digest`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!1,onCheckedChange:t})}),(0,G.jsxs)(`p`,{className:`max-w-md font-sans text-xs text-on-surface-variant`,children:[`Optional session-start context from the selected digest tier. Review the saved tiers on the`,` `,(0,G.jsx)(ri,{to:`?tab=digest`,className:`text-primary underline-offset-4 hover:underline`,children:`Digest tab`}),`.`]})]})]})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 border-t border-outline-variant/20 pt-5 lg:grid-cols-[minmax(14rem,18rem)_minmax(0,1fr)]`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h4`,{className:`font-sans text-sm font-semibold text-on-surface m-0`,children:`Subagent start`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Managed instructions passed into supported spawned child agents.`})]}),(0,G.jsx)(`div`,{className:`max-w-3xl`,children:(0,G.jsx)(iP,{path:ji.instructions.injectOnSubagentStart,label:`Subagent instructions`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})})})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 border-t border-outline-variant/20 pt-5 lg:grid-cols-[minmax(14rem,18rem)_minmax(0,1fr)]`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h4`,{className:`font-sans text-sm font-semibold text-on-surface m-0`,children:`Prompt submit`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Spore retrieval runs after the user prompt and attaches the most relevant memories.`})]}),(0,G.jsxs)(`div`,{className:`grid max-w-xl gap-4 md:grid-cols-[minmax(12rem,16rem)_minmax(8rem,12rem)]`,children:[(0,G.jsx)(iP,{path:ji.spores.injectOnPromptSubmit,label:`Spore retrieval`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(iP,{path:ji.spores.maxPerPrompt,label:`Max spores`,children:({value:e,onChange:t})=>(0,G.jsx)(Kf,{type:`number`,min:0,max:10,className:`max-w-32`,value:String(e??3),onChange:e=>t(Number(e.target.value))})})]})]})]})]}),(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(wj,{children:`Artifact`}),(0,G.jsx)(`h3`,{className:`myco-display-sm text-on-surface m-0`,children:`Current Instructions`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Stored Markdown generated by the Myco agent for session-start injection.`}),s?(0,G.jsx)(`p`,{className:`mt-2 font-sans text-sm text-on-surface-variant`,children:s.started?`Refresh started${s.runId?` — run ${s.runId}`:``}. The stored artifact updates when that run completes.`:`Refresh did not start${s.reason?` — ${JP(s.reason)}`:``}.`}):null]}),(0,G.jsx)(Y,{onClick:()=>void l(),disabled:r,children:r?`Starting...`:`Refresh`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(X,{variant:u?.enabled?`default`:`secondary`,children:u?.enabled?`Session start enabled`:`Session start disabled`}),(0,G.jsx)(X,{variant:`secondary`,children:u?.stored?`Stored artifact`:`No stored artifact`}),(0,G.jsxs)(X,{variant:`secondary`,children:[`Generated: `,qP(u?.generatedAt??null)]})]}),(0,G.jsx)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5`,children:n.isLoading?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading instructions...`}):u?.content?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?`Collapse`:`Expand`})}),(0,G.jsx)(`div`,{className:a?`max-h-[70vh] overflow-auto pr-2`:`max-h-[28rem] overflow-auto pr-2`,children:(0,G.jsx)(fO,{content:u.content})})]}):(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No Cortex instructions are stored yet. Refresh to generate them.`})})]})]})}function iF(){let e=PA({task:`cortex-prompt-builder`,limit:HP}),{data:t}=mM(),n=(0,W.useMemo)(()=>(t?.symbionts??[]).filter(e=>e.enabled),[t]),[r,i]=(0,W.useState)(``),[a,o]=(0,W.useState)(n[0]?.name??``),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1),p=eF(s?.runId??null),m=eF(l),h=(0,W.useMemo)(()=>(e.data?.runs??[]).map(e=>({run:e,parsed:XP(e.instruction)})),[e.data?.runs]),g=(0,W.useMemo)(()=>h.find(({run:e})=>e.id===l)??null,[h,l]);(0,W.useEffect)(()=>{if(n.length===0){a&&o(``);return}n.some(e=>e.name===a)||o(n[0]?.name??``)},[n,a]);let _=(0,W.useCallback)(async()=>{f(!0);try{c(await ts(`/cortex/prompt-builder`,{goal:r,...a?{symbiont:a}:{}})),e.refetch()}finally{f(!1)}},[e,r,a]),v=r.trim().length>0;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Q,{id:Pi.cortexBuilder,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-primary/10 p-2 text-primary`,children:(0,G.jsx)(co,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(MM,{children:`Prompt Builder`}),(0,G.jsx)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:`Tell Myco what you want to build and which enabled symbiont you are targeting. Cortex runs a task through the Myco agent harness and returns a high-signal prompt you can paste into that agent.`})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`label`,{className:`block space-y-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:`What do you want to build?`}),(0,G.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),placeholder:`Build a migration workflow for ...`,rows:5,className:`w-full rounded-md bg-surface-container-lowest px-3 py-2 font-sans text-sm text-on-surface placeholder:text-on-surface-variant/50 focus:outline-hidden focus:ring-2 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 resize-y`})]}),(0,G.jsxs)(`label`,{className:`block space-y-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Target symbiont`}),(0,G.jsxs)(c_,{value:a,onValueChange:o,children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:`Choose a symbiont`})}),(0,G.jsx)(d_,{children:n.map(e=>(0,G.jsx)(f_,{value:e.name,children:e.displayName},e.name))})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`This list comes from the symbionts enabled for this project.`})]}),(0,G.jsx)(Y,{onClick:()=>void _(),disabled:!v||d,children:d?`Starting...`:`Build Prompt`})]})]}),s?(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(X,{variant:ZP(p.data?.status??`running`),children:p.data?.status??`running`}),QP(s.inlineInstructions)?(0,G.jsx)(X,{variant:`secondary`,children:QP(s.inlineInstructions)}):null,s.targetSymbiont?(0,G.jsx)(X,{variant:`secondary`,children:s.targetSymbiont.displayName}):null]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:p.data?.status&&VP.has(p.data.status)?`Run ${s.runId??`pending`} finished.`:`Run ${s.runId??`pending`} is in progress. Cortex checks for the prompt automatically.`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s.runId?(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>u(s.runId),children:`View Details`}):null,(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{p.refetch(),e.refetch()},disabled:p.isFetching||e.isFetching,children:p.isFetching||e.isFetching?`Refreshing...`:`Refresh`})]})]})]}):null,(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(MM,{children:`Recent Builds`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Each run captures the original build request, the generated prompt, and a direct link to the underlying agent run.`})]}),(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void e.refetch(),disabled:e.isFetching,children:e.isFetching?`Refreshing...`:`Refresh`})]}),e.isLoading?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading recent builds...`}):h.length===0?(0,G.jsx)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5`,children:(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No builder runs yet. Start one above and Cortex will keep the prompt artifact here.`})}):(0,G.jsx)(`div`,{className:`space-y-3`,children:h.map(({run:e,parsed:t})=>(0,G.jsx)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-4 space-y-3`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(X,{variant:ZP(e.status),children:e.status}),QP(t.inlineInstructions)?(0,G.jsx)(X,{variant:`secondary`,children:QP(t.inlineInstructions)}):null,t.targetSymbiontDisplayName?(0,G.jsx)(X,{variant:`secondary`,children:t.targetSymbiontDisplayName}):null]}),(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:ev(t.goal||`Untitled build request`,UP)}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{children:[`Started `,ov(e.started_at)]}),(0,G.jsxs)(`span`,{children:[`Run `,tv(e.id)]}),e.completed_at?(0,G.jsxs)(`span`,{children:[`Duration `,iv(e.started_at,e.completed_at)]}):null]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>u(e.id),children:`View Details`}),(0,G.jsx)(`a`,{href:`/agent?run=${e.id}`,className:`inline-flex h-8 items-center justify-center rounded-md border border-[var(--ghost-border)] px-3 font-sans text-xs font-medium text-on-surface transition-all hover:bg-surface-container-high`,children:`Open Run`})]})]})},e.id))})]}),(0,G.jsx)(Lf,{open:l!==null,onOpenChange:e=>{e||u(null)},children:(0,G.jsxs)(Vf,{className:`max-w-4xl max-h-[90vh] overflow-y-auto`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`Prompt Build Details`}),(0,G.jsx)(Gf,{children:`Review the generated prompt, task reports, and jump to the full agent run when you need deeper diagnostics.`})]}),l?(0,G.jsx)(aF,{runId:l,runInstruction:g?.run.instruction??null,result:m.data,isLoading:m.isLoading,isFetching:m.isFetching,onRefresh:()=>void m.refetch()}):null]})})]})}function aF({runId:e,runInstruction:t,result:n,isLoading:r,isFetching:i,onRefresh:a}){let o=(0,W.useMemo)(()=>XP(t),[t]),[s,c]=(0,W.useState)(!1),l=(0,W.useCallback)(async()=>{n?.prompt&&navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(n.prompt),c(!0),window.setTimeout(()=>c(!1),1500))},[n?.prompt]);return r&&!n?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading build details...`}):(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(X,{variant:ZP(n?.status),children:n?.status??`loading`}),(0,G.jsxs)(X,{variant:`secondary`,children:[`Run `,tv(e)]}),o.targetSymbiontDisplayName?(0,G.jsx)(X,{variant:`secondary`,children:o.targetSymbiontDisplayName}):null]}),o.goal?(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:o.goal}):null,QP(o.inlineInstructions)?(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:o.inlineInstructions?`This build embeds the current Cortex instructions directly into the generated prompt.`:`This build expects the target symbiont to receive Cortex instructions at session start.`}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n?.prompt?(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void l(),children:s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Qi,{className:`mr-1.5 h-3.5 w-3.5`}),`Copied`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pa,{className:`mr-1.5 h-3.5 w-3.5`}),`Copy Prompt`]})}):null,(0,G.jsx)(`a`,{href:`/agent?run=${e}`,className:`inline-flex h-8 items-center justify-center rounded-md border border-[var(--ghost-border)] px-3 font-sans text-xs font-medium text-on-surface transition-all hover:bg-surface-container-high`,children:`Open Full Run`}),(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:a,disabled:i,children:i?`Refreshing...`:`Refresh`})]})]}),(0,G.jsxs)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5 space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Generated Prompt`}),n?.prompt?(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-sm text-on-surface`,children:n.prompt}):(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:n?.status===`failed`?n.error||`The prompt builder run failed before producing a prompt.`:`Waiting for the Myco agent to produce the prompt...`})]}),n?.reports?.length?(0,G.jsxs)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5 space-y-3`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Task Reports`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:n.reports.map(e=>(0,G.jsxs)(`div`,{className:`rounded-md border border-outline-variant/20 px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:e.action}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:$_(e.created_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:e.summary})]},e.id))})]}):null]})}function oF(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Q,{id:Pi.cortexDigest,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-primary/10 p-2 text-primary`,children:(0,G.jsx)(ha,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(MM,{children:`Digest`}),(0,G.jsx)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:`Choose which digest tier Cortex should use when digest injection is enabled, and review the maintained extracts below for on-demand retrieval.`})]})]}),(0,G.jsx)(iP,{path:ji.digest.tier,label:`Preferred digest tier`,children:({value:e,onChange:t})=>(0,G.jsxs)(c_,{value:String(e??5e3),onValueChange:e=>t(Number(e)),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{})}),(0,G.jsx)(d_,{children:WP.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})})]}),(0,G.jsx)(uP,{})]})}function sF({patterns:e,onChange:t}){let[n,r]=(0,W.useState)(``),i=(0,W.useCallback)(()=>{let i=n.trim();if(!(!i||i.startsWith(`#`))){if(e.includes(i)){r(``);return}t([...e,i]),r(``)}},[n,e,t]),a=(0,W.useCallback)(n=>{t(e.filter((e,t)=>t!==n))},[e,t]);return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`rounded-md border border-outline-variant/30 bg-surface-container-low px-3 py-2 min-h-[44px]`,children:e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-xs italic text-on-surface-variant`,children:`No custom patterns yet — the Myco baseline above already covers common noise.`}):(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map((e,t)=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-surface-container px-2 py-0.5 font-mono text-xs text-on-surface`,children:[e,(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(t),"aria-label":`Remove pattern ${e}`,className:`rounded text-on-surface-variant hover:text-on-surface focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-primary/40`,children:`×`})]},`${e}-${t}`))})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(Kf,{value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())},placeholder:`e.g. fixtures/large/** or **/*.snap`,className:`font-mono text-xs`}),(0,G.jsx)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:i,disabled:n.trim().length===0,children:`Add`})]}),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Press Enter or click Add. Glob syntax: `,(0,G.jsx)(`code`,{className:`font-mono`,children:`**`}),` `,`any depth, `,(0,G.jsx)(`code`,{className:`font-mono`,children:`*`}),` any chars in one segment.`]})]})}function cF(){let{effective:e,isLoading:t}=LO(),{data:n}=RA(),r=n?.tasks.find(e=>e.name===`canopy-describe`),i=(e?.agent?.tasks?.[`canopy-describe`])?.schedule?.enabled??r?.schedule?.enabled??!1;return t||!e?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading...`}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-primary/15 p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-primary/10 p-2 text-primary`,children:(0,G.jsx)(go,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Canopy is your project's live code index.`}),(0,G.jsx)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:`It tracks what every file does so connected agents can answer codebase questions and skip redundant Reads. The Myco agent describes files in the background — opt-in, configurable below.`})]})]})}),(0,G.jsxs)(Q,{id:`config-section-cortex-canopy-collection`,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(MM,{children:`Collection`}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`The scanner automatically skips anything matched by this project's`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.gitignore`}),` `,`files (root and nested), the Myco baseline below, and directories that Myco and your installed symbionts manage (`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.myco/`}),`,`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.agents/`}),`,`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.claude/`}),`,`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.cursor/`}),`, etc.). Add your own patterns at the bottom to exclude additional paths.`]})]}),(0,G.jsx)(iP,{path:ji.canopy.exclude.defaultPatterns,label:`Myco baseline (read-only)`,children:({value:e})=>(0,G.jsxs)(`div`,{className:`rounded-md border border-outline-variant/20 bg-surface-container-low/50 px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(e??[]).map(e=>(0,G.jsx)(`code`,{className:`inline-block rounded bg-surface-container px-2 py-0.5 font-mono text-xs text-on-surface-variant`,children:e},e))}),(0,G.jsx)(`p`,{className:`pt-2 font-sans text-xs text-on-surface-variant`,children:`Maintained by Myco. Filesystem and toolchain noise that shouldn't be indexed regardless of project setup.`})]})}),(0,G.jsx)(iP,{path:ji.canopy.exclude.patterns,label:`Your patterns`,children:({value:e,onChange:t})=>(0,G.jsx)(sF,{patterns:e??[],onChange:t})}),(0,G.jsxs)(`div`,{className:`space-y-1 pt-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-xs uppercase tracking-wide text-on-surface-variant`,children:`Background refresh`}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Session start and the Write/Edit tool already keep the index fresh during sessions. The background sweep is the safety net for changes made outside sessions (`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`git pull`}),`, edits via non-Myco tools).`]})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(iP,{path:ji.canopy.refresh.backgroundEnabled,label:`Periodic background scan`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(iP,{path:ji.canopy.refresh.backgroundPeriodMinutes,label:`Period (minutes)`,children:({value:e,onChange:t})=>(0,G.jsx)(Kf,{type:`number`,min:1,value:String(e??60),onChange:e=>t(Number(e.target.value))})})]})]}),(0,G.jsxs)(Q,{id:`config-section-cortex-canopy-injection`,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsx)(MM,{children:`Injection`}),(0,G.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(iP,{path:ji.canopy.injectOnPreToolUse,label:`Inject canopy on Read`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(iP,{path:ji.canopy.minFileBytes,label:`Minimum file size (bytes)`,children:({value:e,onChange:t})=>(0,G.jsx)(Kf,{type:`number`,min:0,value:String(e??800),onChange:e=>t(Number(e.target.value))})})]})]}),(0,G.jsxs)(Q,{id:`config-section-cortex-canopy-llm`,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsx)(MM,{children:`Intelligence`}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 font-sans text-xs font-medium `+(i?`border-primary/30 bg-primary/10 text-primary`:`border-outline-variant/40 bg-surface-container text-on-surface-variant`),children:[(0,G.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full `+(i?`bg-primary`:`bg-on-surface-variant/60`),"aria-hidden":!0}),i?`Descriptions on`:`Descriptions off`]})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`One-sentence summaries the Myco agent writes for each file. They power semantic search across your codebase, ride along with Canopy injection on Read, and feed the Canopy Map — the highest-leverage piece of Canopy once it’s on.`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:i?(0,G.jsxs)(G.Fragment,{children:[`The`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=canopy-describe`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`canopy-describe task`}),` `,`is enabled and filling in descriptions on schedule. Visit the task page to change the model, schedule, or token budget.`]}):(0,G.jsxs)(G.Fragment,{children:[`The`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=canopy-describe`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`canopy-describe task`}),` `,`ships `,(0,G.jsx)(`strong`,{children:`opt-in`}),` — its schedule is off by default so new projects don’t spend tokens unprompted. Enable it on the task page (where you can also pick a model and schedule) to start filling in descriptions; the Canopy Map needs at least one described file before it can build.`]})})]})]})}function lF(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function uF(e){if(Array.isArray(e))return e}function dF(e){if(Array.isArray(e))return lF(e)}function fF(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function pF(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,wF(r.key),r)}}function mF(e,t,n){return t&&pF(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function hF(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=EF(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
85
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function gF(e,t,n){return(t=wF(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _F(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function vF(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function yF(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
86
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bF(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
87
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xF(e,t){return uF(e)||vF(e,t)||EF(e,t)||yF()}function SF(e){return dF(e)||_F(e)||EF(e)||bF()}function CF(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}function wF(e){var t=CF(e,`string`);return typeof t==`symbol`?t:t+``}function TF(e){"@babel/helpers - typeof";return TF=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},TF(e)}function EF(e,t){if(e){if(typeof e==`string`)return lF(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lF(e,t):void 0}}var DF=typeof window>`u`?null:window,OF=DF?DF.navigator:null;DF&&DF.document;var kF=TF(``),AF=TF({}),jF=TF(function(){}),MF=typeof HTMLElement>`u`?`undefined`:TF(HTMLElement),NF=function(e){return e&&e.instanceString&&FF(e.instanceString)?e.instanceString():null},PF=function(e){return e!=null&&TF(e)==kF},FF=function(e){return e!=null&&TF(e)===jF},IF=function(e){return!VF(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},LF=function(e){return e!=null&&TF(e)===AF&&!IF(e)&&e.constructor===Object},RF=function(e){return e!=null&&TF(e)===AF},$=function(e){return e!=null&&TF(e)===TF(1)&&!isNaN(e)},zF=function(e){return $(e)&&Math.floor(e)===e},BF=function(e){if(MF!==`undefined`)return e!=null&&e instanceof HTMLElement},VF=function(e){return HF(e)||UF(e)},HF=function(e){return NF(e)===`collection`&&e._private.single},UF=function(e){return NF(e)===`collection`&&!e._private.single},WF=function(e){return NF(e)===`core`},GF=function(e){return NF(e)===`stylesheet`},KF=function(e){return NF(e)===`event`},qF=function(e){return e==null?!0:!!(e===``||e.match(/^\s+$/))},JF=function(e){return typeof HTMLElement>`u`?!1:e instanceof HTMLElement},YF=function(e){return LF(e)&&$(e.x1)&&$(e.x2)&&$(e.y1)&&$(e.y2)},XF=function(e){return RF(e)&&FF(e.then)},ZF=function(){return OF&&OF.userAgent.match(/msie|trident|edge/i)},QF=function(e,t){t||=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return`undefined`;for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join(`$`)};var n=function(){var r=this,i=arguments,a,o=t.apply(r,i),s=n.cache;return(a=s[o])||(a=s[o]=e.apply(r,i)),a};return n.cache={},n},$F=QF(function(e){return e.replace(/([A-Z])/g,function(e){return`-`+e.toLowerCase()})}),eI=QF(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),tI=QF(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+`$`+t}),nI=function(e){return qF(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},rI=function(e,t){return e.slice(-1*t.length)===t},iI=`(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))`,aI=`rgb[a]?\\((`+iI+`[%]?)\\s*,\\s*(`+iI+`[%]?)\\s*,\\s*(`+iI+`[%]?)(?:\\s*,\\s*(`+iI+`))?\\)`,oI=`rgb[a]?\\((?:`+iI+`[%]?)\\s*,\\s*(?:`+iI+`[%]?)\\s*,\\s*(?:`+iI+`[%]?)(?:\\s*,\\s*(?:`+iI+`))?\\)`,sI=`hsl[a]?\\((`+iI+`)\\s*,\\s*(`+iI+`[%])\\s*,\\s*(`+iI+`[%])(?:\\s*,\\s*(`+iI+`))?\\)`,cI=`hsl[a]?\\((?:`+iI+`)\\s*,\\s*(?:`+iI+`[%])\\s*,\\s*(?:`+iI+`[%])(?:\\s*,\\s*(?:`+iI+`))?\\)`,lI=`\\#[0-9a-fA-F]{3}`,uI=`\\#[0-9a-fA-F]{6}`,dI=function(e,t){return e<t?-1:+(e>t)},fI=function(e,t){return-1*dI(e,t)},pI=Object.assign==null?function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(r!=null)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e}:Object.assign.bind(Object),mI=function(e){if(!(!(e.length===4||e.length===7)||e[0]!==`#`)){var t=e.length===4,n,r,i,a=16;return t?(n=parseInt(e[1]+e[1],a),r=parseInt(e[2]+e[2],a),i=parseInt(e[3]+e[3],a)):(n=parseInt(e[1]+e[2],a),r=parseInt(e[3]+e[4],a),i=parseInt(e[5]+e[6],a)),[n,r,i]}},hI=function(e){var t,n,r,i,a,o,s,c;function l(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var u=RegExp(`^`+sI+`$`).exec(e);if(u){if(n=parseInt(u[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,r=parseFloat(u[2]),r<0||r>100||(r/=100,i=parseFloat(u[3]),i<0||i>100)||(i/=100,a=u[4],a!==void 0&&(a=parseFloat(a),a<0||a>1)))return;if(r===0)o=s=c=Math.round(i*255);else{var d=i<.5?i*(1+r):i+r-i*r,f=2*i-d;o=Math.round(255*l(f,d,n+1/3)),s=Math.round(255*l(f,d,n)),c=Math.round(255*l(f,d,n-1/3))}t=[o,s,c,a]}return t},gI=function(e){var t,n=RegExp(`^`+aI+`$`).exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if(a[a.length-1]===`%`&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var c=n[4];if(c!==void 0){if(c=parseFloat(c),c<0||c>1)return;t.push(c)}}return t},_I=function(e){return yI[e.toLowerCase()]},vI=function(e){return(IF(e)?e:null)||_I(e)||mI(e)||gI(e)||hI(e)},yI={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},bI=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(LF(a))throw Error(`Tried to set map with object key`);i<n.length-1?(t[a]??(t[a]={}),t=t[a]):t[a]=e.value}},xI=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(LF(a))throw Error(`Tried to get map with object key`);if(t=t[a],t==null)return t}return t},SI=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function CI(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var wI,TI;function EI(){if(TI)return wI;TI=1;function e(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}return wI=e,wI}var DI,OI;function kI(){return OI?DI:(OI=1,DI=typeof SI==`object`&&SI&&SI.Object===Object&&SI,DI)}var AI,jI;function MI(){if(jI)return AI;jI=1;var e=kI(),t=typeof self==`object`&&self&&self.Object===Object&&self;return AI=e||t||Function(`return this`)(),AI}var NI,PI;function FI(){if(PI)return NI;PI=1;var e=MI();return NI=function(){return e.Date.now()},NI}var II,LI;function RI(){if(LI)return II;LI=1;var e=/\s/;function t(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}return II=t,II}var zI,BI;function VI(){if(BI)return zI;BI=1;var e=RI(),t=/^\s+/;function n(n){return n&&n.slice(0,e(n)+1).replace(t,``)}return zI=n,zI}var HI,UI;function WI(){return UI?HI:(UI=1,HI=MI().Symbol,HI)}var GI,KI;function qI(){if(KI)return GI;KI=1;var e=WI(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch{}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}return GI=a,GI}var JI,YI;function XI(){if(YI)return JI;YI=1;var e=Object.prototype.toString;function t(t){return e.call(t)}return JI=t,JI}var ZI,QI;function $I(){if(QI)return ZI;QI=1;var e=WI(),t=qI(),n=XI(),r=`[object Null]`,i=`[object Undefined]`,a=e?e.toStringTag:void 0;function o(e){return e==null?e===void 0?i:r:a&&a in Object(e)?t(e):n(e)}return ZI=o,ZI}var eL,tL;function nL(){if(tL)return eL;tL=1;function e(e){return typeof e==`object`&&!!e}return eL=e,eL}var rL,iL;function aL(){if(iL)return rL;iL=1;var e=$I(),t=nL(),n=`[object Symbol]`;function r(r){return typeof r==`symbol`||t(r)&&e(r)==n}return rL=r,rL}var oL,sL;function cL(){if(sL)return oL;sL=1;var e=VI(),t=EI(),n=aL(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function c(c){if(typeof c==`number`)return c;if(n(c))return r;if(t(c)){var l=typeof c.valueOf==`function`?c.valueOf():c;c=t(l)?l+``:l}if(typeof c!=`string`)return c===0?c:+c;c=e(c);var u=a.test(c);return u||o.test(c)?s(c.slice(2),u?2:8):i.test(c)?r:+c}return oL=c,oL}var lL,uL;function dL(){if(uL)return lL;uL=1;var e=EI(),t=FI(),n=cL(),r=`Expected a function`,i=Math.max,a=Math.min;function o(o,s,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof o!=`function`)throw TypeError(r);s=n(s)||0,e(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?i(n(c.maxWait)||0,s):d,v=`trailing`in c?!!c.trailing:v);function y(e){var t=l,n=u;return l=u=void 0,h=e,f=o.apply(n,t),f}function b(e){return h=e,p=setTimeout(C,s),g?y(e):f}function x(e){var t=e-m,n=e-h,r=s-t;return _?a(r,d-n):r}function S(e){var t=e-m,n=e-h;return m===void 0||t>=s||t<0||_&&n>=d}function C(){var e=t();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(t())}function D(){var e=t(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,s),y(m)}return p===void 0&&(p=setTimeout(C,s)),f}return D.cancel=T,D.flush=E,D}return lL=o,lL}var fL=CI(dL()),pL=DF?DF.performance:null,mL=pL&&pL.now?function(){return pL.now()}:function(){return Date.now()},hL=function(){if(DF){if(DF.requestAnimationFrame)return function(e){DF.requestAnimationFrame(e)};if(DF.mozRequestAnimationFrame)return function(e){DF.mozRequestAnimationFrame(e)};if(DF.webkitRequestAnimationFrame)return function(e){DF.webkitRequestAnimationFrame(e)};if(DF.msRequestAnimationFrame)return function(e){DF.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(mL())},1e3/60)}}(),gL=function(e){return hL(e)},_L=mL,vL=9261,yL=65599,bL=5381,xL=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:vL,n;n=e.next(),!n.done;)t=t*yL+n.value|0;return t},SL=function(e){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:vL)*yL+e|0},CL=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:bL;return(t<<5)+t+e|0},wL=function(e,t){return e*2097152+t},TL=function(e){return e[0]*2097152+e[1]},EL=function(e,t){return[SL(e[0],t[0]),CL(e[1],t[1])]},DL=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return xL({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)},OL=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return xL({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},kL=function(){return AL(arguments)},AL=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=n===0?OL(r):OL(r,t)}return t};function jL(e,t,n,r,i){var a=i*Math.PI/180;return{x:Math.cos(a)*(e-n)-Math.sin(a)*(t-r)+n,y:Math.sin(a)*(e-n)+Math.cos(a)*(t-r)+r}}var ML=function(e,t,n,r,i,a){return{x:(e-n)*i+n,y:(t-r)*a+r}};function NL(e,t,n){if(n===0)return e;var r=(t.x1+t.x2)/2,i=(t.y1+t.y2)/2,a=t.w/t.h,o=1/a,s=jL(e.x,e.y,r,i,n),c=ML(s.x,s.y,r,i,a,o);return{x:c.x,y:c.y}}var PL=!0,FL=console.warn!=null,IL=console.trace!=null,LL=2**53-1||9007199254740991,RL=function(){return!0},zL=function(){return!1},BL=function(){return 0},VL=function(){},HL=function(e){throw Error(e)},UL=function(e){if(e!==void 0)PL=!!e;else return PL},WL=function(e){UL()&&(FL?console.warn(e):(console.log(e),IL&&console.trace()))},GL=function(e){return pI({},e)},KL=function(e){return e==null?e:IF(e)?e.slice():LF(e)?GL(e):e},qL=function(e){return e.slice()},JL=function(e,t){for(t=e=``;e++<36;t+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):`-`);return t},YL={},XL=function(){return YL},ZL=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=n?.[a];r[a]=o===void 0?e[a]:o}return r}},QL=function(e,t,n){for(var r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},$L=function(e){e.splice(0,e.length)},eR=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},tR=function(e,t,n){return n&&(t=tI(n,t)),e[t]},nR=function(e,t,n,r){n&&(t=tI(n,t)),e[t]=r},rR=typeof Map<`u`?Map:function(){function e(){fF(this,e),this._obj={}}return mF(e,[{key:`set`,value:function(e,t){return this._obj[e]=t,this}},{key:`delete`,value:function(e){return this._obj[e]=void 0,this}},{key:`clear`,value:function(){this._obj={}}},{key:`has`,value:function(e){return this._obj[e]!==void 0}},{key:`get`,value:function(e){return this._obj[e]}}])}(),iR=`undefined`,aR=function(){function e(t){if(fF(this,e),this._obj=Object.create(null),this.size=0,t!=null)for(var n=t.instanceString!=null&&t.instanceString()===this.instanceString()?t.toArray():t,r=0;r<n.length;r++)this.add(n[r])}return mF(e,[{key:`instanceString`,value:function(){return`set`}},{key:`add`,value:function(e){var t=this._obj;t[e]!==1&&(t[e]=1,this.size++)}},{key:`delete`,value:function(e){var t=this._obj;t[e]===1&&(t[e]=0,this.size--)}},{key:`clear`,value:function(){this._obj=Object.create(null)}},{key:`has`,value:function(e){return this._obj[e]===1}},{key:`toArray`,value:function(){var e=this;return Object.keys(this._obj).filter(function(t){return e.has(t)})}},{key:`forEach`,value:function(e,t){return this.toArray().forEach(e,t)}}])}(),oR=(typeof Set>`u`?`undefined`:TF(Set))===iR?aR:Set,sR=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!WF(e)){HL(`An element must have a core reference and parameters set`);return}var r=t.group;if(r??=t.data&&t.data.source!=null&&t.data.target!=null?`edges`:`nodes`,r!==`nodes`&&r!==`edges`){HL("An element must be of type `nodes` or `edges`; you specified `"+r+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?r===`edges`:!!t.pannable,active:!1,classes:new oR,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x??(i.position.x=0),i.position.y??(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var c=[];IF(t.classes)?c=t.classes:PF(t.classes)&&(c=t.classes.split(/\s+/));for(var l=0,u=c.length;l<u;l++){var d=c[l];!d||d===``||i.classes.add(d)}this.createEmitter(),(n===void 0||n)&&this.restore();var f=t.style||t.css;f&&(WL("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(f))},cR=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var i;LF(t)&&!VF(t)&&(i=t,t=i.roots||i.root,n=i.visit,r=i.directed),r=arguments.length===2&&!FF(n)?n:r,n=FF(n)?n:function(){};for(var a=this._private.cy,o=t=PF(t)?this.filter(t):t,s=[],c=[],l={},u={},d={},f=0,p,m=this.byGroup(),h=m.nodes,g=m.edges,_=0;_<o.length;_++){var v=o[_],y=v.id();v.isNode()&&(s.unshift(v),e.bfs&&(d[y]=!0,c.push(v)),u[y]=0)}for(var b=function(){var t=e.bfs?s.shift():s.pop(),i=t.id();if(e.dfs){if(d[i])return 0;d[i]=!0,c.push(t)}var a=u[i],o=l[i],m=o==null?null:o.source(),_=o==null?null:o.target(),v=o==null?void 0:t.same(m)?_[0]:m[0],y=n(t,o,v,f++,a);if(y===!0)return p=t,1;if(y===!1)return 1;for(var b=t.connectedEdges().filter(function(e){return(!r||e.source().same(t))&&g.has(e)}),x=0;x<b.length;x++){var S=b[x],C=S.connectedNodes().filter(function(e){return!e.same(t)&&h.has(e)}),w=C.id();C.length!==0&&!d[w]&&(C=C[0],s.push(C),e.bfs&&(d[w]=!0,c.push(C)),l[w]=S,u[w]=u[i]+1)}},x;s.length!==0&&(x=b(),!(x!==0&&x===1)););for(var S=a.collection(),C=0;C<c.length;C++){var w=c[C],T=l[w.id()];T!=null&&S.push(T),S.push(w)}return{path:a.collection(S),found:a.collection(p)}}},lR={breadthFirstSearch:cR({bfs:!0}),depthFirstSearch:cR({dfs:!0})};lR.bfs=lR.breadthFirstSearch,lR.dfs=lR.depthFirstSearch;var uR={exports:{}},dR=uR.exports,fR;function pR(){return fR?uR.exports:(fR=1,(function(e,t){(function(){var t,n,r=Math.floor,i,a,o,s,c,l,u=Math.min,d,f,p,m,h;n=function(e,t){return e<t?-1:+(e>t)},l=function(e,t,i,a,o){var s;if(i??=0,o??=n,i<0)throw Error(`lo must be non-negative`);for(a??=e.length;i<a;)s=r((i+a)/2),o(t,e[s])<0?a=s:i=s+1;return[].splice.apply(e,[i,i-i].concat(t)),t},o=function(e,t,r){return r??=n,e.push(t),m(e,0,e.length-1,r)},a=function(e,t){var r,i;return t??=n,r=e.pop(),e.length?(i=e[0],e[0]=r,h(e,0,t)):i=r,i},c=function(e,t,r){var i;return r??=n,i=e[0],e[0]=t,h(e,0,r),i},s=function(e,t,r){var i;return r??=n,e.length&&r(e[0],t)<0&&(i=[e[0],t],t=i[0],e[0]=i[1],h(e,0,r)),t},i=function(e,t){var i,a,o,s,c,l;for(t??=n,s=(function(){l=[];for(var t=0,n=r(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)l.push(t);return l}).apply(this).reverse(),c=[],a=0,o=s.length;a<o;a++)i=s[a],c.push(h(e,i,t));return c},p=function(e,t,r){var i;if(r??=n,i=e.indexOf(t),i!==-1)return m(e,0,i,r),h(e,i,r)},d=function(e,t,r){var a,o,c,l,u;if(r??=n,o=e.slice(0,t),!o.length)return o;for(i(o,r),u=e.slice(t),c=0,l=u.length;c<l;c++)a=u[c],s(o,a,r);return o.sort(r).reverse()},f=function(e,t,r){var o,s,c,d,f,p,m,h,g;if(r??=n,t*10<=e.length){if(c=e.slice(0,t).sort(r),!c.length)return c;for(s=c[c.length-1],m=e.slice(t),d=0,p=m.length;d<p;d++)o=m[d],r(o,s)<0&&(l(c,o,0,null,r),c.pop(),s=c[c.length-1]);return c}for(i(e,r),g=[],f=0,h=u(t,e.length);0<=h?f<h:f>h;0<=h?++f:--f)g.push(a(e,r));return g},m=function(e,t,r,i){var a,o,s;for(i??=n,a=e[r];r>t;){if(s=r-1>>1,o=e[s],i(a,o)<0){e[r]=o,r=s;continue}break}return e[r]=a},h=function(e,t,r){var i,a,o,s,c;for(r??=n,a=e.length,c=t,o=e[t],i=2*t+1;i<a;)s=i+1,s<a&&!(r(e[i],e[s])<0)&&(i=s),e[t]=e[i],t=i,i=2*t+1;return e[t]=o,m(e,c,t,r)},t=(function(){e.push=o,e.pop=a,e.replace=c,e.pushpop=s,e.heapify=i,e.updateItem=p,e.nlargest=d,e.nsmallest=f;function e(e){this.cmp=e??n,this.nodes=[]}return e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return a(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return this.nodes.indexOf(e)!==-1},e.prototype.replace=function(e){return c(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return i(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return this.nodes.length===0},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t=new e;return t.nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e})(),(function(t,n){return e.exports=n()})(this,function(){return t})}).call(dR)})(uR),uR.exports)}var mR,hR;function gR(){return hR?mR:(hR=1,mR=pR(),mR)}var _R=CI(gR()),vR=ZL({root:null,weight:function(e){return 1},directed:!1}),yR={dijkstra:function(e){if(!LF(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=vR(e),r=n.root,i=n.weight,a=n.directed,o=this,s=i,c=PF(r)?this.filter(r)[0]:r[0],l={},u={},d={},f=this.byGroup(),p=f.nodes,m=f.edges;m.unmergeBy(function(e){return e.isLoop()});for(var h=function(e){return l[e.id()]},g=function(e,t){l[e.id()]=t,_.updateItem(e)},_=new _R(function(e,t){return h(e)-h(t)}),v=0;v<p.length;v++){var y=p[v];l[y.id()]=y.same(c)?0:1/0,_.push(y)}for(var b=function(e,t){for(var n=(a?e.edgesTo(t):e.edgesWith(t)).intersect(m),r=1/0,i,o=0;o<n.length;o++){var c=n[o],l=s(c);(l<r||!i)&&(r=l,i=c)}return{edge:i,dist:r}};_.size()>0;){var x=_.pop(),S=h(x),C=x.id();if(d[C]=S,S!==1/0)for(var w=x.neighborhood().intersect(p),T=0;T<w.length;T++){var E=w[T],D=E.id(),O=b(x,E),k=S+O.dist;k<h(E)&&(g(E,k),u[D]={node:x,edge:O.edge})}}return{distanceTo:function(e){return d[(PF(e)?p.filter(e)[0]:e[0]).id()]},pathTo:function(e){var t=PF(e)?p.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0)for(n.unshift(t);u[i];){var a=u[i];n.unshift(a.edge),n.unshift(a.node),r=a.node,i=r.id()}return o.spawn(n)}}}},bR={kruskal:function(e){e||=function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=Array(i),o=n,s=function(e){for(var t=0;t<a.length;t++)if(a[t].has(e))return t},c=0;c<i;c++)a[c]=this.spawn(n[c]);for(var l=r.sort(function(t,n){return e(t)-e(n)}),u=0;u<l.length;u++){var d=l[u],f=d.source()[0],p=d.target()[0],m=s(f),h=s(p),g=a[m],_=a[h];m!==h&&(o.merge(d),g.merge(_),a.splice(h,1))}return o}},xR=ZL({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),SR={aStar:function(e){var t=this.cy(),n=xR(e),r=n.root,i=n.goal,a=n.heuristic,o=n.directed,s=n.weight;r=t.collection(r)[0],i=t.collection(i)[0];var c=r.id(),l=i.id(),u={},d={},f={},p=new _R(function(e,t){return d[e.id()]-d[t.id()]}),m=new oR,h={},g={},_=function(e,t){p.push(e),m.add(t)},v,y,b=function(){v=p.pop(),y=v.id(),m.delete(y)},x=function(e){return m.has(e)};_(r,c),u[c]=0,d[c]=a(r);for(var S=0;p.size()>0;){if(b(),S++,y===l){for(var C=[],w=i,T=l,E=g[T];C.unshift(w),E!=null&&C.unshift(E),w=h[T],w!=null;)T=w.id(),E=g[T];return{found:!0,distance:u[y],path:this.spawn(C),steps:S}}f[y]=!0;for(var D=v._private.edges,O=0;O<D.length;O++){var k=D[O];if(this.hasElementWithId(k.id())&&!(o&&k.data(`source`)!==y)){var A=k.source(),j=k.target(),M=A.id()===y?j:A,N=M.id();if(this.hasElementWithId(N)&&!f[N]){var P=u[y]+s(k);if(!x(N)){u[N]=P,d[N]=P+a(M),_(M,N),h[N]=v,g[N]=k;continue}P<u[N]&&(u[N]=P,d[N]=P+a(M),h[N]=v,g[N]=k)}}}}return{found:!1,distance:void 0,path:void 0,steps:S}}},CR=ZL({weight:function(e){return 1},directed:!1}),wR={floydWarshall:function(e){for(var t=this.cy(),n=CR(e),r=n.weight,i=n.directed,a=r,o=this.byGroup(),s=o.nodes,c=o.edges,l=s.length,u=l*l,d=function(e){return s.indexOf(e)},f=function(e){return s[e]},p=Array(u),m=0;m<u;m++){var h=m%l;(m-h)/l===h?p[m]=0:p[m]=1/0}for(var g=Array(u),_=Array(u),v=0;v<c.length;v++){var y=c[v],b=y.source()[0],x=y.target()[0];if(b!==x){var S=d(b),C=d(x),w=S*l+C,T=a(y);if(p[w]>T&&(p[w]=T,g[w]=C,_[w]=y),!i){var E=C*l+S;!i&&p[E]>T&&(p[E]=T,g[E]=S,_[E]=y)}}}for(var D=0;D<l;D++)for(var O=0;O<l;O++)for(var k=O*l+D,A=0;A<l;A++){var j=O*l+A,M=D*l+A;p[k]+p[M]<p[j]&&(p[j]=p[k]+p[M],g[j]=g[k])}var N=function(e){return(PF(e)?t.filter(e):e)[0]},P=function(e){return d(N(e))};return{distance:function(e,t){var n=P(e),r=P(t);return p[n*l+r]},path:function(e,n){var r=P(e),i=P(n),a=f(r);if(r===i)return a.collection();if(g[r*l+i]==null)return t.collection();var o=t.collection(),s=r,c;for(o.merge(a);r!==i;)s=r,r=g[r*l+i],c=_[s*l+r],o.merge(c),o.merge(f(r));return o}}}},TR=ZL({weight:function(e){return 1},directed:!1,root:null}),ER={bellmanFord:function(e){var t=this,n=TR(e),r=n.weight,i=n.directed,a=n.root,o=r,s=this,c=this.cy(),l=this.byGroup(),u=l.edges,d=l.nodes,f=d.length,p=new rR,m=!1,h=[];a=c.collection(a)[0],u.unmergeBy(function(e){return e.isLoop()});for(var g=u.length,_=function(e){var t=p.get(e.id());return t||(t={},p.set(e.id(),t)),t},v=function(e){return(PF(e)?c.$(e):e)[0]},y=function(e){return _(v(e)).dist},b=function(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:a,r=v(e),i=[],o=r;;){if(o==null)return t.spawn();var c=_(o),l=c.edge,u=c.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;l!=null&&i.unshift(l),o=u}return s.spawn(i)},x=0;x<f;x++){var S=d[x],C=_(S);S.same(a)?C.dist=0:C.dist=1/0,C.pred=null,C.edge=null}for(var w=!1,T=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,w=!0)},E=1;E<f;E++){w=!1;for(var D=0;D<g;D++){var O=u[D],k=O.source(),A=O.target(),j=o(O),M=_(k),N=_(A);T(k,A,O,M,N,j),i||T(A,k,O,N,M,j)}if(!w)break}if(w)for(var P=[],F=0;F<g;F++){var I=u[F],L=I.source(),R=I.target(),ee=o(I),z=_(L).dist,B=_(R).dist;if(z+ee<B||!i&&B+ee<z)if(m||=(WL(`Graph contains a negative weight cycle for Bellman-Ford`),!0),e.findNegativeWeightCycles!==!1){var V=[];z+ee<B&&V.push(L),!i&&B+ee<z&&V.push(R);for(var H=V.length,te=0;te<H;te++){var ne=V[te],U=[ne];U.push(_(ne).edge);for(var re=_(ne).pred;U.indexOf(re)===-1;)U.push(re),U.push(_(re).edge),re=_(re).pred;U=U.slice(U.indexOf(re));for(var ie=U[0].id(),ae=0,oe=2;oe<U.length;oe+=2)U[oe].id()<ie&&(ie=U[oe].id(),ae=oe);U=U.slice(ae).concat(U.slice(0,ae)),U.push(U[0]);var se=U.map(function(e){return e.id()}).join(`,`);P.indexOf(se)===-1&&(h.push(s.spawn(U)),P.push(se))}}else break}return{distanceTo:y,pathTo:b,hasNegativeWeightCycle:m,negativeWeightCycles:h}}},DR=Math.sqrt(2),OR=function(e,t,n){n.length===0&&HL(`Karger-Stein must be run on a connected (sub)graph`);for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],c=n,l=c.length-1;l>=0;l--){var u=c[l],d=u[1],f=u[2];(t[d]===o&&t[f]===s||t[d]===s&&t[f]===o)&&c.splice(l,1)}for(var p=0;p<c.length;p++){var m=c[p];m[1]===s?(c[p]=m.slice(),c[p][1]=o):m[2]===s&&(c[p]=m.slice(),c[p][2]=o)}for(var h=0;h<t.length;h++)t[h]===s&&(t[h]=o);return c},kR=function(e,t,n,r){for(;n>r;)t=OR(Math.floor(Math.random()*t.length),e,t),n--;return t},AR={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(e){return e.isLoop()});var i=n.length,a=r.length,o=Math.ceil((Math.log(i)/Math.LN2)**2),s=Math.floor(i/DR);if(i<2){HL(`At least 2 nodes are required for Karger-Stein algorithm`);return}for(var c=[],l=0;l<a;l++){var u=r[l];c.push([l,n.indexOf(u.source()),n.indexOf(u.target())])}for(var d=1/0,f=[],p=Array(i),m=Array(i),h=Array(i),g=function(e,t){for(var n=0;n<i;n++)t[n]=e[n]},_=0;_<=o;_++){for(var v=0;v<i;v++)m[v]=v;var y=kR(m,c.slice(),i,s),b=y.slice();g(m,h);var x=kR(m,y,s,2),S=kR(h,b,s,2);x.length<=S.length&&x.length<d?(d=x.length,f=x,g(m,p)):S.length<=x.length&&S.length<d&&(d=S.length,f=S,g(h,p))}for(var C=this.spawn(f.map(function(e){return r[e[0]]})),w=this.spawn(),T=this.spawn(),E=p[0],D=0;D<p.length;D++){var O=p[D],k=n[D];O===E?w.merge(k):T.merge(k)}var A=function(t){var n=e.spawn();return t.forEach(function(t){n.merge(t),t.connectedEdges().forEach(function(t){e.contains(t)&&!C.contains(t)&&n.merge(t)})}),n};return{cut:C,components:[A(w),A(T)],partition1:w,partition2:T}}},jR=function(e){return{x:e.x,y:e.y}},MR=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},NR=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},PR=function(e){return{x:e[0],y:e[1]}},FR=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r},IR=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r},LR=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i},RR=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var c=e[s];a?isFinite(c)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(e,t){return e-t});var l=e.length,u=Math.floor(l/2);return l%2==0?(e[u-1+o]+e[u+o])/2:e[u+1+o]},zR=function(e){return Math.PI*e/180},BR=function(e,t){return Math.atan2(t,e)-Math.PI/2},VR=Math.log2||function(e){return Math.log(e)/Math.log(2)},HR=function(e){return e>0?1:e<0?-1:0},UR=function(e,t){return Math.sqrt(WR(e,t))},WR=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},GR=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},KR=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},qR=function(e,t,n,r){return{x:KR(e.x,t.x,n.x,r),y:KR(e.y,t.y,n.y,r)}},JR=function(e,t,n,r){var i={x:t.x-e.x,y:t.y-e.y},a=UR(e,t),o={x:i.x/a,y:i.y/a};return n??=0,r??=n*a,{x:e.x+o.x*r,y:e.y+o.y*r}},YR=function(e,t,n){return Math.max(e,Math.min(n,t))},XR=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},ZR=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},QR=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},$R=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},ez=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},tz=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},nz=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,r,i,a;if(t.length===1)n=r=i=a=t[0];else if(t.length===2)n=i=t[0],a=r=t[1];else if(t.length===4){var o=xF(t,4);n=o[0],r=o[1],i=o[2],a=o[3]}return e.x1-=a,e.x2+=r,e.y1-=n,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},rz=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},iz=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},az=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},oz=function(e,t){return az(e,t.x,t.y)},sz=function(e,t){return az(e,t.x1,t.y1)&&az(e,t.x2,t.y2)},cz=Math.hypot??function(e,t){return Math.sqrt(e*e+t*t)};function lz(e,t){if(e.length<3)throw Error(`Need at least 3 vertices`);var n=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},r=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},i=function(e,t){return{x:e.x*t,y:e.y*t}},a=function(e,t){return e.x*t.y-e.y*t.x},o=function(e){var t=cz(e.x,e.y);return t===0?{x:0,y:0}:{x:e.x/t,y:e.y/t}},s=function(e){for(var t=0,n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length];t+=r.x*i.y-i.x*r.y}return t/2},c=function(e,t,o,s){var c=r(t,e),l=r(s,o),u=a(c,l);return Math.abs(u)<1e-9?n(e,i(c,.5)):n(e,i(c,a(r(o,e),l)/u))},l=e.map(function(e){return{x:e.x,y:e.y}});s(l)<0&&l.reverse();for(var u=l.length,d=[],f=0;f<u;f++){var p=l[f],m=l[(f+1)%u],h=r(m,p),g=o({x:h.y,y:-h.x});d.push(g)}for(var _=d.map(function(e,r){return{p1:n(l[r],i(e,t)),p2:n(l[(r+1)%u],i(e,t))}}),v=[],y=0;y<u;y++){var b=_[(y-1+u)%u],x=_[y],S=c(b.p1,b.p2,x.p1,x.p2);v.push(S)}return v}function uz(e,t,n,r,i,a){var o=lz(Oz(e,t,n,r,i),a),s=XR();return o.forEach(function(e){return ez(s,e.x,e.y)}),s}var dz=function(e,t,n,r,i,a,o){var s=arguments.length>7&&arguments[7]!==void 0?arguments[7]:`auto`,c=s===`auto`?Fz(i,a):s,l=i/2,u=a/2;c=Math.min(c,l,u);var d=c!==l,f=c!==u,p;if(d){var m=n-l+c-o,h=r-u-o;if(p=Dz(e,t,n,r,m,h,n+l-c+o,h,!1),p.length>0)return p}if(f){var g=n+l+o;if(p=Dz(e,t,n,r,g,r-u+c-o,g,r+u-c+o,!1),p.length>0)return p}if(d){var _=n-l+c-o,v=r+u+o;if(p=Dz(e,t,n,r,_,v,n+l-c+o,v,!1),p.length>0)return p}if(f){var y=n-l-o;if(p=Dz(e,t,n,r,y,r-u+c-o,y,r+u-c+o,!1),p.length>0)return p}var b,x=n-l+c,S=r-u+c;if(b=Tz(e,t,n,r,x,S,c+o),b.length>0&&b[0]<=x&&b[1]<=S)return[b[0],b[1]];var C=n+l-c,w=r-u+c;if(b=Tz(e,t,n,r,C,w,c+o),b.length>0&&b[0]>=C&&b[1]<=w)return[b[0],b[1]];var T=n+l-c,E=r+u-c;if(b=Tz(e,t,n,r,T,E,c+o),b.length>0&&b[0]>=T&&b[1]>=E)return[b[0],b[1]];var D=n-l+c,O=r+u-c;return b=Tz(e,t,n,r,D,O,c+o),b.length>0&&b[0]<=D&&b[1]>=O?[b[0],b[1]]:[]},fz=function(e,t,n,r,i,a,o){var s=o,c=Math.min(n,i),l=Math.max(n,i),u=Math.min(r,a),d=Math.max(r,a);return c-s<=e&&e<=l+s&&u-s<=t&&t<=d+s},pz=function(e,t,n,r,i,a,o,s,c){var l={x1:Math.min(n,o,i)-c,x2:Math.max(n,o,i)+c,y1:Math.min(r,s,a)-c,y2:Math.max(r,s,a)+c};return!(e<l.x1||e>l.x2||t<l.y1||t>l.y2)},mz=function(e,t,n,r){n-=r;var i=t*t-4*e*n;if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},hz=function(e,t,n,r,i){e===0&&(e=1e-5),t/=e,n/=e,r/=e;var a,o=(3*n-t*t)/9,s=-(27*r)+t*(9*n-t*t*2),c,l,u,d,f;if(s/=54,a=o*o*o+s*s,i[1]=0,d=t/3,a>0){l=s+Math.sqrt(a),l=l<0?-((-l)**(1/3)):l**(1/3),u=s-Math.sqrt(a),u=u<0?-((-u)**(1/3)):u**(1/3),i[0]=-d+l+u,d+=(l+u)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-u+l)/2,i[3]=d,i[5]=-d;return}if(i[5]=i[3]=0,a===0){f=s<0?-((-s)**(1/3)):s**(1/3),i[0]=-d+2*f,i[4]=i[2]=-(f+d);return}o=-o,c=o*o*o,c=Math.acos(s/Math.sqrt(c)),f=2*Math.sqrt(o),i[0]=-d+f*Math.cos(c/3),i[2]=-d+f*Math.cos((c+2*Math.PI)/3),i[4]=-d+f*Math.cos((c+4*Math.PI)/3)},gz=function(e,t,n,r,i,a,o,s){var c=1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,l=9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,u=3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,d=1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,f=[];hz(c,l,u,d,f);for(var p=1e-7,m=[],h=0;h<6;h+=2)Math.abs(f[h+1])<p&&f[h]>=0&&f[h]<=1&&m.push(f[h]);m.push(1),m.push(0);for(var g=-1,_,v,y,b=0;b<m.length;b++)_=(1-m[b])**2*n+2*(1-m[b])*m[b]*i+m[b]*m[b]*o,v=(1-m[b])**2*r+2*(1-m[b])*m[b]*a+m[b]*m[b]*s,y=(_-e)**2+(v-t)**2,g>=0?y<g&&(g=y):g=y;return g},_z=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-r],c=s[0]*s[0]+s[1]*s[1],l=o[0]*o[0]+o[1]*o[1],u=o[0]*s[0]+o[1]*s[1],d=u*u/c;return u<0?l:d>c?(e-i)*(e-i)+(t-a)*(t-a):l-d},vz=function(e,t,n){for(var r,i,a,o,s,c=0,l=0;l<n.length/2;l++)if(r=n[l*2],i=n[l*2+1],l+1<n.length/2?(a=n[(l+1)*2],o=n[(l+1)*2+1]):(a=n[(l+1-n.length/2)*2],o=n[(l+1-n.length/2)*2+1]),!(r==e&&a==e))if(r>=e&&e>=a||r<=e&&e<=a)s=(e-r)/(a-r)*(o-i)+i,s>t&&c++;else continue;return c%2!=0},yz=function(e,t,n,r,i,a,o,s,c){var l=Array(n.length),u;s[0]==null?u=s:(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2);for(var d=Math.cos(-u),f=Math.sin(-u),p=0;p<l.length/2;p++)l[p*2]=a/2*(n[p*2]*d-n[p*2+1]*f),l[p*2+1]=o/2*(n[p*2+1]*d+n[p*2]*f),l[p*2]+=r,l[p*2+1]+=i;return vz(e,t,c>0?xz(Sz(l,-c)):l)},bz=function(e,t,n,r,i,a,o,s){for(var c=Array(n.length*2),l=0;l<s.length;l++){var u=s[l];if(c[l*4+0]=u.startX,c[l*4+1]=u.startY,c[l*4+2]=u.stopX,c[l*4+3]=u.stopY,(u.cx-e)**2+(u.cy-t)**2<=u.radius**2)return!0}return vz(e,t,c)},xz=function(e){for(var t=Array(e.length/2),n,r,i,a,o,s,c,l,u=0;u<e.length/4;u++){n=e[u*4],r=e[u*4+1],i=e[u*4+2],a=e[u*4+3],u<e.length/4-1?(o=e[(u+1)*4],s=e[(u+1)*4+1],c=e[(u+1)*4+2],l=e[(u+1)*4+3]):(o=e[0],s=e[1],c=e[2],l=e[3]);var d=Dz(n,r,i,a,o,s,c,l,!0);t[u*2]=d[0],t[u*2+1]=d[1]}return t},Sz=function(e,t){for(var n=Array(e.length*2),r,i,a,o,s=0;s<e.length/2;s++){r=e[s*2],i=e[s*2+1],s<e.length/2-1?(a=e[(s+1)*2],o=e[(s+1)*2+1]):(a=e[0],o=e[1]);var c=o-i,l=-(a-r),u=Math.sqrt(c*c+l*l),d=c/u,f=l/u;n[s*4]=r+d*t,n[s*4+1]=i+f*t,n[s*4+2]=a+d*t,n[s*4+3]=o+f*t}return n},Cz=function(e,t,n,r,i,a){var o=n-e,s=r-t;o/=i,s/=a;var c=Math.sqrt(o*o+s*s),l=c-1;if(l<0)return[];var u=l/c;return[(n-e)*u+e,(r-t)*u+t]},wz=function(e,t,n,r,i,a,o){return e-=i,t-=a,e/=n/2+o,t/=r/2+o,e*e+t*t<=1},Tz=function(e,t,n,r,i,a,o){var s=[n-e,r-t],c=[e-i,t-a],l=s[0]*s[0]+s[1]*s[1],u=2*(c[0]*s[0]+c[1]*s[1]),d=c[0]*c[0]+c[1]*c[1]-o*o,f=u*u-4*l*d;if(f<0)return[];var p=(-u+Math.sqrt(f))/(2*l),m=(-u-Math.sqrt(f))/(2*l),h=Math.min(p,m),g=Math.max(p,m),_=[];if(h>=0&&h<=1&&_.push(h),g>=0&&g<=1&&_.push(g),_.length===0)return[];var v=_[0]*s[0]+e,y=_[0]*s[1]+t;return _.length>1?_[0]==_[1]?[v,y]:[v,y,_[1]*s[0]+e,_[1]*s[1]+t]:[v,y]},Ez=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Dz=function(e,t,n,r,i,a,o,s,c){var l=e-i,u=n-e,d=o-i,f=t-a,p=r-t,m=s-a,h=d*f-m*l,g=u*f-p*l,_=m*u-d*p;if(_!==0){var v=h/_,y=g/_,b=.001,x=0-b,S=1+b;return x<=v&&v<=S&&x<=y&&y<=S||c?[e+v*u,t+v*p]:[]}else if(h===0||g===0)return Ez(e,n,o)===o?[o,s]:Ez(e,n,i)===i?[i,a]:Ez(i,o,n)===n?[n,r]:[];else return[]},Oz=function(e,t,n,r,i){var a=[],o=r/2,s=i/2,c=t,l=n;a.push({x:c+o*e[0],y:l+s*e[1]});for(var u=1;u<e.length/2;u++)a.push({x:c+o*e[u*2],y:l+s*e[u*2+1]});return a},kz=function(e,t,n,r,i,a,o,s){var c=[],l,u=Array(n.length),d=!0;a??(d=!1);var f;if(d){for(var p=0;p<u.length/2;p++)u[p*2]=n[p*2]*a+r,u[p*2+1]=n[p*2+1]*o+i;f=s>0?xz(Sz(u,-s)):u}else f=n;for(var m,h,g,_,v=0;v<f.length/2;v++)m=f[v*2],h=f[v*2+1],v<f.length/2-1?(g=f[(v+1)*2],_=f[(v+1)*2+1]):(g=f[0],_=f[1]),l=Dz(e,t,r,i,m,h,g,_),l.length!==0&&c.push(l[0],l[1]);return c},Az=function(e,t,n,r,i,a,o,s,c){var l=[],u,d=Array(n.length*2);c.forEach(function(n,a){a===0?(d[d.length-2]=n.startX,d[d.length-1]=n.startY):(d[a*4-2]=n.startX,d[a*4-1]=n.startY),d[a*4]=n.stopX,d[a*4+1]=n.stopY,u=Tz(e,t,r,i,n.cx,n.cy,n.radius),u.length!==0&&l.push(u[0],u[1])});for(var f=0;f<d.length/4;f++)u=Dz(e,t,r,i,d[f*4],d[f*4+1],d[f*4+2],d[f*4+3],!1),u.length!==0&&l.push(u[0],u[1]);if(l.length>2){for(var p=[l[0],l[1]],m=(p[0]-e)**2+(p[1]-t)**2,h=1;h<l.length/2;h++){var g=(l[h*2]-e)**2+(l[h*2+1]-t)**2;g<=m&&(p[0]=l[h*2],p[1]=l[h*2+1],m=g)}return p}return l},jz=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},Mz=function(e,t){var n=Pz(e,t);return n=Nz(n),n},Nz=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,c=0;c<r;c++)t=e[2*c],n=e[2*c+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var l=2/(o-i),u=2/(s-a),d=0;d<r;d++)t=e[2*d]=e[2*d]*l,n=e[2*d+1]=e[2*d+1]*u,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var f=0;f<r;f++)n=e[2*f+1]=e[2*f+1]+(-1-a);return e},Pz=function(e,t){var n=1/e*2*Math.PI,r=e%2==0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var i=Array(e*2),a,o=0;o<e;o++)a=o*n+r,i[2*o]=Math.cos(a),i[2*o+1]=Math.sin(-a);return i},Fz=function(e,t){return Math.min(e/4,t/4,8)},Iz=function(e,t){return Math.min(e/10,t/10,8)},Lz=function(){return 8},Rz=function(e,t,n){return[e-2*t+n,2*(t-e),e]},zz=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Bz(e,t){function n(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length],a={x:i.x-r.x,y:i.y-r.y},o={x:-a.y,y:a.x},s=Math.sqrt(o.x*o.x+o.y*o.y);t.push({x:o.x/s,y:o.y/s})}return t}function r(e,t){var n=1/0,r=-1/0,i=hF(e),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,s=o.x*t.x+o.y*t.y;n=Math.min(n,s),r=Math.max(r,s)}}catch(e){i.e(e)}finally{i.f()}return{min:n,max:r}}function i(e,t){return!(e.max<t.min||t.max<e.min)}var a=hF([].concat(SF(n(e)),SF(n(t)))),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;if(!i(r(e,s),r(t,s)))return!1}}catch(e){a.e(e)}finally{a.f()}return!0}var Vz=ZL({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Hz={pageRank:function(e){for(var t=Vz(e),n=t.dampingFactor,r=t.precision,i=t.iterations,a=t.weight,o=this._private.cy,s=this.byGroup(),c=s.nodes,l=s.edges,u=c.length,d=u*u,f=l.length,p=Array(d),m=Array(u),h=(1-n)/u,g=0;g<u;g++){for(var _=0;_<u;_++){var v=g*u+_;p[v]=0}m[g]=0}for(var y=0;y<f;y++){var b=l[y],x=b.data(`source`),S=b.data(`target`);if(x!==S){var C=c.indexOfId(x),w=c.indexOfId(S),T=a(b),E=w*u+C;p[E]+=T,m[C]+=T}}for(var D=1/u+h,O=0;O<u;O++)if(m[O]===0)for(var k=0;k<u;k++){var A=k*u+O;p[A]=D}else for(var j=0;j<u;j++){var M=j*u+O;p[M]=p[M]/m[O]+h}for(var N=Array(u),P=Array(u),F,I=0;I<u;I++)N[I]=1;for(var L=0;L<i;L++){for(var R=0;R<u;R++)P[R]=0;for(var ee=0;ee<u;ee++)for(var z=0;z<u;z++){var B=ee*u+z;P[ee]+=p[B]*N[z]}GR(P),F=N,N=P,P=F;for(var V=0,H=0;H<u;H++){var te=F[H]-N[H];V+=te*te}if(V<r)break}return{rank:function(e){return e=o.collection(e)[0],N[c.indexOf(e)]}}}},Uz=ZL({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Wz={degreeCentralityNormalized:function(e){e=Uz(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,c=0;c<r;c++){var l=n[c],u=l.id();e.root=l;var d=this.degreeCentrality(e);o<d.indegree&&(o=d.indegree),s<d.outdegree&&(s=d.outdegree),i[u]=d.indegree,a[u]=d.outdegree}return{indegree:function(e){return o==0?0:(PF(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return s===0?0:(PF(e)&&(e=t.filter(e)),a[e.id()]/s)}}}else{for(var f={},p=0,m=0;m<r;m++){var h=n[m];e.root=h;var g=this.degreeCentrality(e);p<g.degree&&(p=g.degree),f[h.id()]=g.degree}return{degree:function(e){return p===0?0:(PF(e)&&(e=t.filter(e)),f[e.id()]/p)}}}},degreeCentrality:function(e){e=Uz(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var c=i.connectedEdges(),l=c.filter(function(e){return e.target().same(i)&&n.has(e)}),u=c.filter(function(e){return e.source().same(i)&&n.has(e)}),d=l.length,f=u.length,p=0,m=0,h=0;h<l.length;h++)p+=a(l[h]);for(var g=0;g<u.length;g++)m+=a(u[g]);return{indegree:d**(1-s)*p**+s,outdegree:f**(1-s)*m**+s}}else{for(var _=i.connectedEdges().intersection(n),v=_.length,y=0,b=0;b<_.length;b++)y+=a(_[b]);return{degree:v**(1-s)*y**+s}}}};Wz.dc=Wz.degreeCentrality,Wz.dcn=Wz.degreeCentralityNormalised=Wz.degreeCentralityNormalized;var Gz=ZL({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Kz={closenessCentralityNormalized:function(e){for(var t=Gz(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,c=this.nodes(),l=this.floydWarshall({weight:r,directed:i}),u=0;u<c.length;u++){for(var d=0,f=c[u],p=0;p<c.length;p++)if(u!==p){var m=l.distance(f,c[p]);n?d+=1/m:d+=m}n||(d=1/d),s<d&&(s=d),o[f.id()]=d}return{closeness:function(e){return s==0?0:(e=PF(e)?a.filter(e)[0].id():e.id(),o[e]/s)}}},closenessCentrality:function(e){var t=Gz(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,c=this.nodes(),l=0;l<c.length;l++){var u=c[l];if(!u.same(n)){var d=o.distanceTo(u);a?s+=1/d:s+=d}}return a?s:1/s}};Kz.cc=Kz.closenessCentrality,Kz.ccn=Kz.closenessCentralityNormalised=Kz.closenessCentralityNormalized;var qz=ZL({weight:null,directed:!1}),Jz={betweennessCentrality:function(e){for(var t=qz(e),n=t.directed,r=t.weight,i=r!=null,a=this.cy(),o=this.nodes(),s={},c={},l=0,u={set:function(e,t){c[e]=t,t>l&&(l=t)},get:function(e){return c[e]}},d=0;d<o.length;d++){var f=o[d],p=f.id();n?s[p]=f.outgoers().nodes():s[p]=f.openNeighborhood().nodes(),u.set(p,0)}for(var m=function(){for(var e=o[h].id(),t=[],n={},c={},l={},d=new _R(function(e,t){return l[e]-l[t]}),f=0;f<o.length;f++){var p=o[f].id();n[p]=[],c[p]=0,l[p]=1/0}for(c[e]=1,l[e]=0,d.push(e);!d.empty();){var m=d.pop();if(t.push(m),i)for(var g=0;g<s[m].length;g++){var _=s[m][g],v=a.getElementById(m),y=void 0;y=v.edgesTo(_).length>0?v.edgesTo(_)[0]:_.edgesTo(v)[0];var b=r(y);_=_.id(),l[_]>l[m]+b&&(l[_]=l[m]+b,d.nodes.indexOf(_)<0?d.push(_):d.updateItem(_),c[_]=0,n[_]=[]),l[_]==l[m]+b&&(c[_]=c[_]+c[m],n[_].push(m))}else for(var x=0;x<s[m].length;x++){var S=s[m][x].id();l[S]==1/0&&(d.push(S),l[S]=l[m]+1),l[S]==l[m]+1&&(c[S]=c[S]+c[m],n[S].push(m))}}for(var C={},w=0;w<o.length;w++)C[o[w].id()]=0;for(;t.length>0;){for(var T=t.pop(),E=0;E<n[T].length;E++){var D=n[T][E];C[D]=C[D]+c[D]/c[T]*(1+C[T])}T!=o[h].id()&&u.set(T,u.get(T)+C[T])}},h=0;h<o.length;h++)m();var g={betweenness:function(e){var t=a.collection(e).id();return u.get(t)},betweennessNormalized:function(e){if(l==0)return 0;var t=a.collection(e).id();return u.get(t)/l}};return g.betweennessNormalised=g.betweennessNormalized,g}};Jz.bc=Jz.betweennessCentrality;var Yz=ZL({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),Xz=function(e){return Yz(e)},Zz=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},Qz=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},$z=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},eB=function(e,t,n){for(var r=Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},tB=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=eB(e,r,t);return e},nB=function(e,t,n){for(var r=Array(t*t),i=0;i<t*t;i++)r[i]=e[i]**+n;return $z(r,t),r},rB=function(e,t,n,r){for(var i=0;i<n;i++)if(Math.round(e[i]*10**r)/10**r!=Math.round(t[i]*10**r)/10**r)return!1;return!0},iB=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(e[a*t+s]*1e3)/1e3>0&&o.push(n[s]);o.length!==0&&i.push(r.collection(o))}return i},aB=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},oB=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&aB(e[t],e[n])&&e.splice(n,1);return e},sB=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=Xz(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s=t.length,c=s*s,l=Array(c),u,d=0;d<c;d++)l[d]=0;for(var f=0;f<n.length;f++){var p=n[f],m=a[p.source().id()],h=a[p.target().id()],g=Zz(p,i.attributes);l[m*s+h]+=g,l[h*s+m]+=g}Qz(l,s,i.multFactor),$z(l,s);for(var _=!0,v=0;_&&v<i.maxIterations;)_=!1,u=tB(l,s,i.expandFactor),l=nB(u,s,i.inflateFactor),rB(l,u,c,4)||(_=!0),v++;var y=iB(l,s,t,r);return y=oB(y),y},cB={markovClustering:sB,mcl:sB},lB=function(e){return e},uB=function(e,t){return Math.abs(t-e)},dB=function(e,t,n){return e+uB(t,n)},fB=function(e,t,n){return e+(n-t)**2},pB=function(e){return Math.sqrt(e)},mB=function(e,t,n){return Math.max(e,uB(t,n))},hB=function(e,t,n,r,i){for(var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:lB,o=r,s,c,l=0;l<e;l++)s=t(l),c=n(l),o=i(o,s,c);return a(o)},gB={euclidean:function(e,t,n){return e>=2?hB(e,t,n,0,fB,pB):hB(e,t,n,0,dB)},squaredEuclidean:function(e,t,n){return hB(e,t,n,0,fB)},manhattan:function(e,t,n){return hB(e,t,n,0,dB)},max:function(e,t,n){return hB(e,t,n,-1/0,mB)}};gB[`squared-euclidean`]=gB.squaredEuclidean,gB.squaredeuclidean=gB.squaredEuclidean;function _B(e,t,n,r,i,a){var o=FF(e)?e:gB[e]||gB.euclidean;return t===0&&FF(e)?o(i,a):o(t,n,r,i,a)}var vB=ZL({k:2,m:2,sensitivityThreshold:1e-4,distance:`euclidean`,maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),yB=function(e){return vB(e)},bB=function(e,t,n,r,i){var a=i===`kMedoids`?function(e){return r[e](n)}:function(e){return n[e]},o=function(e){return r[e](t)},s=n,c=t;return _B(e,r.length,a,o,s,c)},xB=function(e,t,n){for(var r=n.length,i=Array(r),a=Array(r),o=Array(t),s=null,c=0;c<r;c++)i[c]=e.min(n[c]).value,a[c]=e.max(n[c]).value;for(var l=0;l<t;l++){s=[];for(var u=0;u<r;u++)s[u]=Math.random()*(a[u]-i[u])+i[u];o[l]=s}return o},SB=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var c=bB(n,e,t[s],r,i);c<a&&(a=c,o=s)}return o},CB=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)i=t[a],n[i.id()]===e&&r.push(i);return r},wB=function(e,t,n){return Math.abs(t-e)<=n},TB=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++)if(Math.abs(e[r][i]-t[r][i])>n)return!1;return!0},EB=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},DB=function(e,t){var n=Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];EB(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},OB=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=bB(`manhattan`,t[i],e,n,`kMedoids`);return r},kB=function(e){var t=this.cy(),n=this.nodes(),r=null,i=yB(e),a=Array(i.k),o={},s;i.testMode?typeof i.testCentroids==`number`?(i.testCentroids,s=xB(n,i.k,i.attributes)):s=TF(i.testCentroids)===`object`?i.testCentroids:xB(n,i.k,i.attributes):s=xB(n,i.k,i.attributes);for(var c=!0,l=0;c&&l<i.maxIterations;){for(var u=0;u<n.length;u++)r=n[u],o[r.id()]=SB(r,s,i.distance,i.attributes,`kMeans`);c=!1;for(var d=0;d<i.k;d++){var f=CB(d,n,o);if(f.length!==0){for(var p=i.attributes.length,m=s[d],h=Array(p),g=Array(p),_=0;_<p;_++){g[_]=0;for(var v=0;v<f.length;v++)r=f[v],g[_]+=i.attributes[_](r);h[_]=g[_]/f.length,wB(h[_],m[_],i.sensitivityThreshold)||(c=!0)}s[d]=h,a[d]=t.collection(f)}}l++}return a},AB=function(e){var t=this.cy(),n=this.nodes(),r=null,i=yB(e),a=Array(i.k),o,s={},c,l=Array(i.k);i.testMode?typeof i.testCentroids==`number`||(o=TF(i.testCentroids)===`object`?i.testCentroids:DB(n,i.k)):o=DB(n,i.k);for(var u=!0,d=0;u&&d<i.maxIterations;){for(var f=0;f<n.length;f++)r=n[f],s[r.id()]=SB(r,o,i.distance,i.attributes,`kMedoids`);u=!1;for(var p=0;p<o.length;p++){var m=CB(p,n,s);if(m.length!==0){l[p]=OB(o[p],m,i.attributes);for(var h=0;h<m.length;h++)c=OB(m[h],m,i.attributes),c<l[p]&&(l[p]=c,o[p]=m[h],u=!0);a[p]=t.collection(m)}}d++}return a},jB=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var c=0;c<e.length;c++)r[s][c]=n[s][c]**+i.m;for(var l=0;l<e.length;l++)for(var u=0;u<i.attributes.length;u++){a=0,o=0;for(var d=0;d<t.length;d++)a+=r[d][l]*i.attributes[u](t[d]),o+=r[d][l];e[l][u]=a/o}},MB=function(e,t,n,r,i){for(var a=0;a<e.length;a++)t[a]=e[a].slice();for(var o,s,c,l=2/(i.m-1),u=0;u<n.length;u++)for(var d=0;d<r.length;d++){o=0;for(var f=0;f<n.length;f++)s=bB(i.distance,r[d],n[u],i.attributes,`cmeans`),c=bB(i.distance,r[d],n[f],i.attributes,`cmeans`),o+=(s/c)**+l;e[d][u]=1/o}},NB=function(e,t,n,r){for(var i=Array(n.k),a=0;a<i.length;a++)i[a]=[];for(var o,s,c=0;c<t.length;c++){o=-1/0,s=-1;for(var l=0;l<t[0].length;l++)t[c][l]>o&&(o=t[c][l],s=l);i[s].push(e[c])}for(var u=0;u<i.length;u++)i[u]=r.collection(i[u]);return i},PB=function(e){for(var t=this.cy(),n=this.nodes(),r=yB(e),i,a,o,s=Array(n.length),c,l=0;l<n.length;l++)s[l]=Array(r.k);o=Array(n.length);for(var u=0;u<n.length;u++)o[u]=Array(r.k);for(var d=0;d<n.length;d++){for(var f=0,p=0;p<r.k;p++)o[d][p]=Math.random(),f+=o[d][p];for(var m=0;m<r.k;m++)o[d][m]=o[d][m]/f}a=Array(r.k);for(var h=0;h<r.k;h++)a[h]=Array(r.attributes.length);c=Array(n.length);for(var g=0;g<n.length;g++)c[g]=Array(r.k);for(var _=!0,v=0;_&&v<r.maxIterations;)_=!1,jB(a,n,o,c,r),MB(o,s,a,n,r),TB(o,s,r.sensitivityThreshold)||(_=!0),v++;return i=NB(n,o,r,t),{clusters:i,degreeOfMembership:o}},FB={kMeans:kB,kMedoids:AB,fuzzyCMeans:PB,fcm:PB},IB=ZL({distance:`euclidean`,linkage:`min`,mode:`threshold`,threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),LB={single:`min`,complete:`max`},RB=function(e){var t=IB(e),n=LB[t.linkage];return n!=null&&(t.linkage=n),t},zB=function(e,t,n,r,i){for(var a=0,o=1/0,s,c=i.attributes,l=function(e,t){return _B(i.distance,c.length,function(t){return c[t](e)},function(e){return c[e](t)},e,t)},u=0;u<e.length;u++){var d=e[u].key,f=n[d][r[d]];f<o&&(a=d,o=f)}if(i.mode===`threshold`&&o>=i.threshold||i.mode===`dendrogram`&&e.length===1)return!1;var p=t[a],m=t[r[a]],h=i.mode===`dendrogram`?{left:p,right:m,key:p.key}:{value:p.value.concat(m.value),key:p.key};e[p.index]=h,e.splice(m.index,1),t[p.key]=h;for(var g=0;g<e.length;g++){var _=e[g];p.key===_.key?s=1/0:i.linkage===`min`?(s=n[p.key][_.key],n[p.key][_.key]>n[m.key][_.key]&&(s=n[m.key][_.key])):i.linkage===`max`?(s=n[p.key][_.key],n[p.key][_.key]<n[m.key][_.key]&&(s=n[m.key][_.key])):s=i.linkage===`mean`?(n[p.key][_.key]*p.size+n[m.key][_.key]*m.size)/(p.size+m.size):i.mode===`dendrogram`?l(_.value,p.value):l(_.value[0],p.value[0]),n[p.key][_.key]=n[_.key][p.key]=s}for(var v=0;v<e.length;v++){var y=e[v].key;if(r[y]===p.key||r[y]===m.key){for(var b=y,x=0;x<e.length;x++){var S=e[x].key;n[y][S]<n[y][b]&&(b=S)}r[y]=b}e[v].index=v}return p.key=m.key=p.index=m.index=null,!0},BB=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&BB(e.left,t),e.right&&BB(e.right,t)))},VB=function(e,t){if(!e)return``;if(e.left&&e.right){var n=VB(e.left,t),r=VB(e.right,t),i=t.add({group:`nodes`,data:{id:n+`,`+r}});return t.add({group:`edges`,data:{source:n,target:i.id()}}),t.add({group:`edges`,data:{source:r,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},HB=function(e,t,n){if(!e)return[];var r=[],i=[],a=[];return t===0?(e.left&&BB(e.left,r),e.right&&BB(e.right,i),a=r.concat(i),[n.collection(a)]):t===1?e.value?[n.collection(e.value)]:(e.left&&BB(e.left,r),e.right&&BB(e.right,i),[n.collection(r),n.collection(i)]):e.value?[n.collection(e.value)]:(e.left&&(r=HB(e.left,t-1,n)),e.right&&(i=HB(e.right,t-1,n)),r.concat(i))},UB=function(e){for(var t=this.cy(),n=this.nodes(),r=RB(e),i=r.attributes,a=function(e,t){return _B(r.distance,i.length,function(t){return i[t](e)},function(e){return i[e](t)},e,t)},o=[],s=[],c=[],l=[],u=0;u<n.length;u++){var d={value:r.mode===`dendrogram`?n[u]:[n[u]],key:u,index:u};o[u]=d,l[u]=d,s[u]=[],c[u]=0}for(var f=0;f<o.length;f++)for(var p=0;p<=f;p++){var m=void 0;m=r.mode===`dendrogram`?f===p?1/0:a(o[f].value,o[p].value):f===p?1/0:a(o[f].value[0],o[p].value[0]),s[f][p]=m,s[p][f]=m,m<s[f][c[f]]&&(c[f]=p)}for(var h=zB(o,l,s,c,r);h;)h=zB(o,l,s,c,r);var g;return r.mode===`dendrogram`?(g=HB(o[0],r.dendrogramDepth,t),r.addDendrogram&&VB(o[0],t)):(g=Array(o.length),o.forEach(function(e,n){e.key=e.index=null,g[n]=t.collection(e.value)})),g},WB={hierarchicalClustering:UB,hca:UB},GB=ZL({distance:`euclidean`,preference:`median`,damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),KB=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||HL(`Damping must range on [0.5, 1). Got: ${t}`);var r=[`median`,`mean`,`min`,`max`];return r.some(function(e){return e===n})||$(n)||HL(`Preference must be one of [${r.map(function(e){return`'${e}'`}).join(`, `)}] or a number. Got: ${n}`),GB(e)},qB=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-_B(e,r.length,function(e){return i(t,e)},function(e){return i(n,e)},t,n)},JB=function(e,t){var n=null;return n=t===`median`?RR(e):t===`mean`?LR(e):t===`min`?FR(e):t===`max`?IR(e):t,n},YB=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r},XB=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var c=n[s];t[i*e+c]>o&&(a=c,o=t[i*e+c])}a>0&&r.push(a)}for(var l=0;l<n.length;l++)r[n[l]]=n[l];return r},ZB=function(e,t,n){for(var r=XB(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,c=-1/0,l=0;l<a.length;l++){for(var u=0,d=0;d<a.length;d++)u+=t[a[d]*e+a[l]];u>c&&(s=l,c=u)}n[i]=a[s]}return r=XB(e,t,n),r},QB=function(e){for(var t=this.cy(),n=this.nodes(),r=KB(e),i={},a=0;a<n.length;a++)i[n[a].id()]=a;for(var o=n.length,s=o*o,c=Array(s),l,u,d,f=0;f<s;f++)c[f]=-1/0;for(var p=0;p<o;p++)for(var m=0;m<o;m++)p!==m&&(c[p*o+m]=qB(r.distance,n[p],n[m],r.attributes));l=JB(c,r.preference);for(var h=0;h<o;h++)c[h*o+h]=l;u=Array(s);for(var g=0;g<s;g++)u[g]=0;d=Array(s);for(var _=0;_<s;_++)d[_]=0;for(var v=Array(o),y=Array(o),b=Array(o),x=0;x<o;x++)v[x]=0,y[x]=0,b[x]=0;for(var S=Array(o*r.minIterations),C=0;C<S.length;C++)S[C]=0;var w;for(w=0;w<r.maxIterations;w++){for(var T=0;T<o;T++){for(var E=-1/0,D=-1/0,O=-1,k=0,A=0;A<o;A++)v[A]=u[T*o+A],k=d[T*o+A]+c[T*o+A],k>=E?(D=E,E=k,O=A):k>D&&(D=k);for(var j=0;j<o;j++)u[T*o+j]=(1-r.damping)*(c[T*o+j]-E)+r.damping*v[j];u[T*o+O]=(1-r.damping)*(c[T*o+O]-D)+r.damping*v[O]}for(var M=0;M<o;M++){for(var N=0,P=0;P<o;P++)v[P]=d[P*o+M],y[P]=Math.max(0,u[P*o+M]),N+=y[P];N-=y[M],y[M]=u[M*o+M],N+=y[M];for(var F=0;F<o;F++)d[F*o+M]=(1-r.damping)*Math.min(0,N-y[F])+r.damping*v[F];d[M*o+M]=(1-r.damping)*(N-y[M])+r.damping*v[M]}for(var I=0,L=0;L<o;L++){var R=+(d[L*o+L]+u[L*o+L]>0);S[w%r.minIterations*o+L]=R,I+=R}if(I>0&&(w>=r.minIterations-1||w==r.maxIterations-1)){for(var ee=0,z=0;z<o;z++){b[z]=0;for(var B=0;B<r.minIterations;B++)b[z]+=S[B*o+z];(b[z]===0||b[z]===r.minIterations)&&ee++}if(ee===o)break}}for(var V=YB(o,u,d),H=ZB(o,c,V),te={},ne=0;ne<V.length;ne++)te[V[ne]]=[];for(var U=0;U<n.length;U++){var re=H[i[n[U].id()]];re!=null&&te[re].push(n[U])}for(var ie=Array(V.length),ae=0;ae<V.length;ae++)ie[ae]=t.collection(te[V[ae]]);return ie},$B={affinityPropagation:QB,ap:QB},eV=ZL({root:void 0,directed:!1}),tV={hierholzer:function(e){if(!LF(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n=eV(e),r=n.root,i=n.directed,a=this,o=!1,s,c,l;r&&(l=PF(r)?this.filter(r)[0].id():r[0].id());var u={},d={};i?a.forEach(function(e){var t=e.id();if(e.isNode()){var n=e.indegree(!0),r=e.outdegree(!0),i=n-r,a=r-n;i==1?s?o=!0:s=t:a==1?c?o=!0:c=t:(a>1||i>1)&&(o=!0),u[t]=[],e.outgoers().forEach(function(e){e.isEdge()&&u[t].push(e.id())})}else d[t]=[void 0,e.target().id()]}):a.forEach(function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(s?c?o=!0:c=t:s=t),u[t]=[],e.connectedEdges().forEach(function(e){return u[t].push(e.id())})):d[t]=[e.source().id(),e.target().id()]});var f={found:!1,trail:void 0};if(o)return f;if(c&&s)if(i){if(l&&c!=l)return f;l=c}else if(l&&c!=l&&s!=l)return f;else l||=c;else l||=a[0].id();var p=function(e){for(var t=e,n=[e],r,a,o;u[t].length;)r=u[t].shift(),a=d[r][0],o=d[r][1],t==o?!i&&t!=a&&(u[a]=u[a].filter(function(e){return e!=r}),t=a):(u[o]=u[o].filter(function(e){return e!=r}),t=o),n.unshift(r),n.unshift(t);return n},m=[],h=[];for(h=p(l);h.length!=1;)u[h[0]].length==0?(m.unshift(a.getElementById(h.shift())),m.unshift(a.getElementById(h.shift()))):h=p(h.shift()).concat(h);for(var g in m.unshift(a.getElementById(h.shift())),u)if(u[g].length)return f;return f.found=!0,f.trail=this.spawn(m,!0),f}},nV=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function(n,r){for(var o=a.length-1,s=[],c=e.spawn();a[o].x!=n||a[o].y!=r;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach(function(n){var r=n.connectedNodes().intersection(e);c.merge(n),r.forEach(function(n){var r=n.id(),i=n.connectedEdges().intersection(e);c.merge(n),t[r].cutVertex?c.merge(i.filter(function(e){return e.isLoop()})):c.merge(i)})}),i.push(c)},c=function(l,u,d){l===d&&(r+=1),t[u]={id:n,low:n++,cutVertex:!1};var f=e.getElementById(u).connectedEdges().intersection(e);if(f.size()===0)i.push(e.spawn(e.getElementById(u)));else{var p,m,h,g;f.forEach(function(e){p=e.source().id(),m=e.target().id(),h=p===u?m:p,h!==d&&(g=e.id(),o[g]||(o[g]=!0,a.push({x:u,y:h,edge:e})),h in t?t[u].low=Math.min(t[u].low,t[h].id):(c(l,h,u),t[u].low=Math.min(t[u].low,t[h].low),t[u].id<=t[h].low&&(t[u].cutVertex=!0,s(u,h))))})}};e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||(r=0,c(n,n),t[n].cutVertex=r>1)}});var l=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(l),components:i}},rV={hopcroftTarjanBiconnected:nV,htbc:nV,htb:nV,hopcroftTarjanBiconnectedComponents:nV},iV=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var c=e.spawn();;){var l=i.pop();if(c.merge(e.getElementById(l)),t[l].low=t[s].index,t[l].explored=!0,l===s)break}var u=c.edgesWith(c),d=c.merge(u);r.push(d),a=a.difference(d)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:a,components:r}},aV={tarjanStronglyConnected:iV,tsc:iV,tscc:iV,tarjanStronglyConnectedComponents:iV},oV={};[lR,yR,bR,SR,wR,ER,AR,Hz,Wz,Kz,Jz,cB,FB,WB,$B,tV,rV,aV].forEach(function(e){pI(oV,e)});var sV=0,cV=1,lV=2,uV=function(e){if(!(this instanceof uV))return new uV(e);this.id=`Thenable/1.0.7`,this.state=sV,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e==`function`&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};uV.prototype={fulfill:function(e){return dV(this,cV,`fulfillValue`,e)},reject:function(e){return dV(this,lV,`rejectReason`,e)},then:function(e,t){var n=this,r=new uV;return n.onFulfilled.push(mV(e,r,`fulfill`)),n.onRejected.push(mV(t,r,`reject`)),fV(n),r.proxy}};var dV=function(e,t,n,r){return e.state===sV&&(e.state=t,e[n]=r,fV(e)),e},fV=function(e){e.state===cV?pV(e,`onFulfilled`,e.fulfillValue):e.state===lV&&pV(e,`onRejected`,e.rejectReason)},pV=function(e,t,n){if(e[t].length!==0){var r=e[t];e[t]=[];var i=function(){for(var e=0;e<r.length;e++)r[e](n)};typeof setImmediate==`function`?setImmediate(i):setTimeout(i,0)}},mV=function(e,t,n){return function(r){if(typeof e!=`function`)t[n].call(t,r);else{var i;try{i=e(r)}catch(e){t.reject(e);return}hV(t,i)}}},hV=function(e,t){if(e===t||e.proxy===t){e.reject(TypeError(`cannot resolve promise with itself`));return}var n;if(TF(t)===`object`&&t!==null||typeof t==`function`)try{n=t.then}catch(t){e.reject(t);return}if(typeof n==`function`){var r=!1;try{n.call(t,function(n){r||(r=!0,n===t?e.reject(TypeError(`circular thenable chain`)):hV(e,n))},function(t){r||(r=!0,e.reject(t))})}catch(t){r||e.reject(t)}return}e.fulfill(t)};uV.all=function(e){return new uV(function(t,n){for(var r=Array(e.length),i=0,a=function(n,a){r[n]=a,i++,i===e.length&&t(r)},o=0;o<e.length;o++)(function(t){var r=e[t];r!=null&&r.then!=null?r.then(function(e){a(t,e)},function(e){n(e)}):a(t,r)})(o)})},uV.resolve=function(e){return new uV(function(t,n){t(e)})},uV.reject=function(e){return new uV(function(t,n){n(e)})};var gV=typeof Promise<`u`?Promise:uV,_V=function(e,t,n){var r=WF(e),i=!r,a=this._private=pI({duration:1e3},t,n);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&FF(a.complete)&&a.completes.push(a.complete),i){var o=e.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(r){var s=e.pan();a.startPan={x:s.x,y:s.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},vV=_V.prototype;pI(vV,{instanceString:function(){return`animation`},hook:function(){var e=this._private;if(!e.hooked){var t,n=e.target._private.animation;t=e.queue?n.queue:n.current,t.push(this),VF(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return e===void 0?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return e===void 0?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];r!=null&&(e[t]=e[n],e[n]=r)};if(n(`zoom`,`startZoom`),n(`pan`,`startPan`),n(`position`,`startPosition`),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t=this._private,n;switch(e){case`frame`:n=t.frames;break;default:case`complete`:case`completed`:n=t.completes}return new gV(function(e,t){n.push(function(){e()})})}}),vV.complete=vV.completed,vV.run=vV.play,vV.running=vV.playing;var yV={animated:function(){return function(){var e=this,t=e.length===void 0?[e]:e;if(!(this._private.cy||this).styleEnabled())return!1;var n=t[0];if(n)return n._private.animation.current.length>0}},clearQueue:function(){return function(){var e=this,t=e.length===void 0?[e]:e;if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n<t.length;n++){var r=t[n];r._private.animation.queue=[]}return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=this,r=n.length!==void 0,i=r?n:[n],a=this._private.cy||this,o=!r,s=!o;if(!a.styleEnabled())return this;var c=a.style();if(e=pI({},e,t),Object.keys(e).length===0)return new _V(i[0],e);switch(e.duration===void 0&&(e.duration=400),e.duration){case`slow`:e.duration=600;break;case`fast`:e.duration=200;break}if(s&&(e.style=c.getPropsList(e.style||e.css),e.css=void 0),s&&e.renderedPosition!=null){var l=e.renderedPosition,u=a.pan(),d=a.zoom();e.position=NR(l,d,u)}if(o&&e.panBy!=null){var f=e.panBy,p=a.pan();e.pan={x:p.x+f.x,y:p.y+f.y}}var m=e.center||e.centre;if(o&&m!=null){var h=a.getCenterPan(m.eles,e.zoom);h!=null&&(e.pan=h)}if(o&&e.fit!=null){var g=e.fit,_=a.getFitViewport(g.eles||g.boundingBox,g.padding);_!=null&&(e.pan=_.pan,e.zoom=_.zoom)}if(o&&LF(e.zoom)){var v=a.getZoomedViewport(e.zoom);v==null?e.zoom=null:(v.zoomed&&(e.zoom=v.zoom),v.panned&&(e.pan=v.pan))}return new _V(i[0],e)}},animate:function(){return function(e,t){var n=this,r=n.length===void 0?[n]:n;if(!(this._private.cy||this).styleEnabled())return this;t&&(e=pI({},e,t));for(var i=0;i<r.length;i++){var a=r[i],o=a.animated()&&(e.queue===void 0||e.queue);a.animation(e,o?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=this,r=n.length===void 0?[n]:n,i=this._private.cy||this;if(!i.styleEnabled())return this;for(var a=0;a<r.length;a++){for(var o=r[a]._private,s=o.animation.current,c=0;c<s.length;c++){var l=s[c]._private;t&&(l.duration=0)}e&&(o.animation.queue=[]),t||(o.animation.current=[])}return i.notify(`draw`),this}}},bV,xV;function SV(){return xV?bV:(xV=1,bV=Array.isArray,bV)}var CV,wV;function TV(){if(wV)return CV;wV=1;var e=SV(),t=aL(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(i,a){if(e(i))return!1;var o=typeof i;return o==`number`||o==`symbol`||o==`boolean`||i==null||t(i)?!0:r.test(i)||!n.test(i)||a!=null&&i in Object(a)}return CV=i,CV}var EV,DV;function OV(){if(DV)return EV;DV=1;var e=$I(),t=EI(),n=`[object AsyncFunction]`,r=`[object Function]`,i=`[object GeneratorFunction]`,a=`[object Proxy]`;function o(o){if(!t(o))return!1;var s=e(o);return s==r||s==i||s==n||s==a}return EV=o,EV}var kV,AV;function jV(){return AV?kV:(AV=1,kV=MI()[`__core-js_shared__`],kV)}var MV,NV;function PV(){if(NV)return MV;NV=1;var e=jV(),t=function(){var t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||``);return t?`Symbol(src)_1.`+t:``}();function n(e){return!!t&&t in e}return MV=n,MV}var FV,IV;function LV(){if(IV)return FV;IV=1;var e=Function.prototype.toString;function t(t){if(t!=null){try{return e.call(t)}catch{}try{return t+``}catch{}}return``}return FV=t,FV}var RV,zV;function BV(){if(zV)return RV;zV=1;var e=OV(),t=PV(),n=EI(),r=LV(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=RegExp(`^`+c.call(l).replace(i,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function d(i){return!n(i)||t(i)?!1:(e(i)?u:a).test(r(i))}return RV=d,RV}var VV,HV;function UV(){if(HV)return VV;HV=1;function e(e,t){return e?.[t]}return VV=e,VV}var WV,GV;function KV(){if(GV)return WV;GV=1;var e=BV(),t=UV();function n(n,r){var i=t(n,r);return e(i)?i:void 0}return WV=n,WV}var qV,JV;function YV(){return JV?qV:(JV=1,qV=KV()(Object,`create`),qV)}var XV,ZV;function QV(){if(ZV)return XV;ZV=1;var e=YV();function t(){this.__data__=e?e(null):{},this.size=0}return XV=t,XV}var $V,eH;function tH(){if(eH)return $V;eH=1;function e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}return $V=e,$V}var nH,rH;function iH(){if(rH)return nH;rH=1;var e=YV(),t=`__lodash_hash_undefined__`,n=Object.prototype.hasOwnProperty;function r(r){var i=this.__data__;if(e){var a=i[r];return a===t?void 0:a}return n.call(i,r)?i[r]:void 0}return nH=r,nH}var aH,oH;function sH(){if(oH)return aH;oH=1;var e=YV(),t=Object.prototype.hasOwnProperty;function n(n){var r=this.__data__;return e?r[n]!==void 0:t.call(r,n)}return aH=n,aH}var cH,lH;function uH(){if(lH)return cH;lH=1;var e=YV(),t=`__lodash_hash_undefined__`;function n(n,r){var i=this.__data__;return this.size+=+!this.has(n),i[n]=e&&r===void 0?t:r,this}return cH=n,cH}var dH,fH;function pH(){if(fH)return dH;fH=1;var e=QV(),t=tH(),n=iH(),r=sH(),i=uH();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,dH=a,dH}var mH,hH;function gH(){if(hH)return mH;hH=1;function e(){this.__data__=[],this.size=0}return mH=e,mH}var _H,vH;function yH(){if(vH)return _H;vH=1;function e(e,t){return e===t||e!==e&&t!==t}return _H=e,_H}var bH,xH;function SH(){if(xH)return bH;xH=1;var e=yH();function t(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1}return bH=t,bH}var CH,wH;function TH(){if(wH)return CH;wH=1;var e=SH(),t=Array.prototype.splice;function n(n){var r=this.__data__,i=e(r,n);return i<0?!1:(i==r.length-1?r.pop():t.call(r,i,1),--this.size,!0)}return CH=n,CH}var EH,DH;function OH(){if(DH)return EH;DH=1;var e=SH();function t(t){var n=this.__data__,r=e(n,t);return r<0?void 0:n[r][1]}return EH=t,EH}var kH,AH;function jH(){if(AH)return kH;AH=1;var e=SH();function t(t){return e(this.__data__,t)>-1}return kH=t,kH}var MH,NH;function PH(){if(NH)return MH;NH=1;var e=SH();function t(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}return MH=t,MH}var FH,IH;function LH(){if(IH)return FH;IH=1;var e=gH(),t=TH(),n=OH(),r=jH(),i=PH();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,FH=a,FH}var RH,zH;function BH(){return zH?RH:(zH=1,RH=KV()(MI(),`Map`),RH)}var VH,HH;function UH(){if(HH)return VH;HH=1;var e=pH(),t=LH(),n=BH();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return VH=r,VH}var WH,GH;function KH(){if(GH)return WH;GH=1;function e(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}return WH=e,WH}var qH,JH;function YH(){if(JH)return qH;JH=1;var e=KH();function t(t,n){var r=t.__data__;return e(n)?r[typeof n==`string`?`string`:`hash`]:r.map}return qH=t,qH}var XH,ZH;function QH(){if(ZH)return XH;ZH=1;var e=YH();function t(t){var n=e(this,t).delete(t);return this.size-=+!!n,n}return XH=t,XH}var $H,eU;function tU(){if(eU)return $H;eU=1;var e=YH();function t(t){return e(this,t).get(t)}return $H=t,$H}var nU,rU;function iU(){if(rU)return nU;rU=1;var e=YH();function t(t){return e(this,t).has(t)}return nU=t,nU}var aU,oU;function sU(){if(oU)return aU;oU=1;var e=YH();function t(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=r.size==i?0:1,this}return aU=t,aU}var cU,lU;function uU(){if(lU)return cU;lU=1;var e=UH(),t=QH(),n=tU(),r=iU(),i=sU();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,cU=a,cU}var dU,fU;function pU(){if(fU)return dU;fU=1;var e=uU(),t=`Expected a function`;function n(r,i){if(typeof r!=`function`||i!=null&&typeof i!=`function`)throw TypeError(t);var a=function(){var e=arguments,t=i?i.apply(this,e):e[0],n=a.cache;if(n.has(t))return n.get(t);var o=r.apply(this,e);return a.cache=n.set(t,o)||n,o};return a.cache=new(n.Cache||e),a}return n.Cache=e,dU=n,dU}var mU,hU;function gU(){if(hU)return mU;hU=1;var e=pU(),t=500;function n(n){var r=e(n,function(e){return i.size===t&&i.clear(),e}),i=r.cache;return r}return mU=n,mU}var _U,vU;function yU(){if(vU)return _U;vU=1;var e=gU(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g;return _U=e(function(e){var r=[];return e.charCodeAt(0)===46&&r.push(``),e.replace(t,function(e,t,i,a){r.push(i?a.replace(n,`$1`):t||e)}),r}),_U}var bU,xU;function SU(){if(xU)return bU;xU=1;function e(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}return bU=e,bU}var CU,wU;function TU(){if(wU)return CU;wU=1;var e=WI(),t=SU(),n=SV(),r=aL(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(e){if(typeof e==`string`)return e;if(n(e))return t(e,o)+``;if(r(e))return a?a.call(e):``;var i=e+``;return i==`0`&&1/e==-1/0?`-0`:i}return CU=o,CU}var EU,DU;function OU(){if(DU)return EU;DU=1;var e=TU();function t(t){return t==null?``:e(t)}return EU=t,EU}var kU,AU;function jU(){if(AU)return kU;AU=1;var e=SV(),t=TV(),n=yU(),r=OU();function i(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))}return kU=i,kU}var MU,NU;function PU(){if(NU)return MU;NU=1;var e=aL();function t(t){if(typeof t==`string`||e(t))return t;var n=t+``;return n==`0`&&1/t==-1/0?`-0`:n}return MU=t,MU}var FU,IU;function LU(){if(IU)return FU;IU=1;var e=jU(),t=PU();function n(n,r){r=e(r,n);for(var i=0,a=r.length;n!=null&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0}return FU=n,FU}var RU,zU;function BU(){if(zU)return RU;zU=1;var e=LU();function t(t,n,r){var i=t==null?void 0:e(t,n);return i===void 0?r:i}return RU=t,RU}var VU=CI(BU()),HU,UU;function WU(){if(UU)return HU;UU=1;var e=KV();return HU=function(){try{var t=e(Object,`defineProperty`);return t({},``,{}),t}catch{}}(),HU}var GU,KU;function qU(){if(KU)return GU;KU=1;var e=WU();function t(t,n,r){n==`__proto__`&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r}return GU=t,GU}var JU,YU;function XU(){if(YU)return JU;YU=1;var e=qU(),t=yH(),n=Object.prototype.hasOwnProperty;function r(r,i,a){var o=r[i];(!(n.call(r,i)&&t(o,a))||a===void 0&&!(i in r))&&e(r,i,a)}return JU=r,JU}var ZU,QU;function $U(){if(QU)return ZU;QU=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(n,r){var i=typeof n;return r??=e,!!r&&(i==`number`||i!=`symbol`&&t.test(n))&&n>-1&&n%1==0&&n<r}return ZU=n,ZU}var eW,tW;function nW(){if(tW)return eW;tW=1;var e=XU(),t=jU(),n=$U(),r=EI(),i=PU();function a(a,o,s,c){if(!r(a))return a;o=t(o,a);for(var l=-1,u=o.length,d=u-1,f=a;f!=null&&++l<u;){var p=i(o[l]),m=s;if(p===`__proto__`||p===`constructor`||p===`prototype`)return a;if(l!=d){var h=f[p];m=c?c(h,p,f):void 0,m===void 0&&(m=r(h)?h:n(o[l+1])?[]:{})}e(f,p,m),f=f[p]}return a}return eW=a,eW}var rW,iW;function aW(){if(iW)return rW;iW=1;var e=nW();function t(t,n,r){return t==null?t:e(t,n,r)}return rW=t,rW}var oW=CI(aW()),sW,cW;function lW(){if(cW)return sW;cW=1;function e(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}return sW=e,sW}var uW,dW;function fW(){if(dW)return uW;dW=1;var e=SU(),t=lW(),n=SV(),r=aL(),i=yU(),a=PU(),o=OU();function s(s){return n(s)?e(s,a):r(s)?[s]:t(i(o(s)))}return uW=s,uW}var pW=CI(fW()),mW={data:function(e){return e=pI({},{field:`data`,bindingEvent:`data`,allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:`data`,settingTriggersEvent:!1,triggerFnName:`trigger`,immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r=e,i=this,a=i.length!==void 0,o=a?i:[i],s=a?i[0]:i;if(PF(t)){var c=t.indexOf(`.`)!==-1&&pW(t);if(r.allowGetting&&n===void 0){var l;return s&&(r.beforeGet(s),l=c&&s._private[r.field][t]===void 0?VU(s._private[r.field],c):s._private[r.field][t]),l}else if(r.allowSetting&&n!==void 0&&!r.immutableKeys[t]){var u=gF({},t,n);r.beforeSet(i,u);for(var d=0,f=o.length;d<f;d++){var p=o[d];r.canSet(p)&&(c&&s._private[r.field][t]===void 0?oW(p._private[r.field],c,n):p._private[r.field][t]=n)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}}else if(r.allowSetting&&LF(t)){var m=t,h,g,_=Object.keys(m);r.beforeSet(i,m);for(var v=0;v<_.length;v++)if(h=_[v],g=m[h],!r.immutableKeys[h])for(var y=0;y<o.length;y++){var b=o[y];r.canSet(b)&&(b._private[r.field][h]=g)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&FF(t)){var x=t;i.on(r.bindingEvent,x)}else if(r.allowGetting&&t===void 0){var S;return s&&(r.beforeGet(s),S=s._private[r.field]),S}return i}},removeData:function(e){return e=pI({},{field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=this,i=r.length===void 0?[r]:r;if(PF(t)){for(var a=t.split(/\s+/),o=a.length,s=0;s<o;s++){var c=a[s];if(!qF(c)&&!n.immutableKeys[c])for(var l=0,u=i.length;l<u;l++)i[l]._private[n.field][c]=void 0}n.triggerEvent&&r[n.triggerFnName](n.event)}else if(t===void 0){for(var d=0,f=i.length;d<f;d++)for(var p=i[d]._private[n.field],m=Object.keys(p),h=0;h<m.length;h++){var g=m[h];n.immutableKeys[g]||(p[g]=void 0)}n.triggerEvent&&r[n.triggerFnName](n.event)}return r}}},hW={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new gV(function(e,t){var i=r.concat([function(t){n.off.apply(n,a),e(t)}]),a=i.concat([]);n.on.apply(n,i)})}}},gW={};[yV,mW,hW].forEach(function(e){pI(gW,e)});var _W={animate:gW.animate(),animation:gW.animation(),animated:gW.animated(),clearQueue:gW.clearQueue(),delay:gW.delay(),delayAnimation:gW.delayAnimation(),stop:gW.stop()},vW={classes:function(e){var t=this;if(e===void 0){var n=[];return t[0]._private.classes.forEach(function(e){return n.push(e)}),n}else IF(e)||(e=(e||``).match(/\S+/g)||[]);for(var r=[],i=new oR(e),a=0;a<t.length;a++){for(var o=t[a],s=o._private,c=s.classes,l=!1,u=0;u<e.length;u++){var d=e[u];if(!c.has(d)){l=!0;break}}l||=c.size!==e.length,l&&(s.classes=i,r.push(o))}return r.length>0&&this.spawn(r).updateStyle().emit(`class`),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){IF(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=t===void 0,i=[],a=0,o=n.length;a<o;a++)for(var s=n[a],c=s._private.classes,l=!1,u=0;u<e.length;u++){var d=e[u],f=c.has(d),p=!1;t||r&&!f?(c.add(d),p=!0):(!t||r&&f)&&(c.delete(d),p=!0),!l&&p&&(i.push(s),l=!0)}return i.length>0&&this.spawn(i).updateStyle().emit(`class`),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};vW.className=vW.classNames=vW.classes;var yW={metaChar:`[\\!\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\\`\\{\\|\\}\\~]`,comparatorOp:`=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=`,boolOp:`\\?|\\!|\\^`,string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:iI,meta:`degree|indegree|outdegree`,separator:`\\s*,\\s*`,descendant:`\\s+`,child:`\\s+>\\s+`,subject:`\\$`,group:`node|edge|\\*`,directedEdge:`\\s+->\\s+`,undirectedEdge:`\\s+<->\\s+`};yW.variable=`(?:[\\w-.]|(?:\\\\`+yW.metaChar+`))+`,yW.className=`(?:[\\w-]|(?:\\\\`+yW.metaChar+`))+`,yW.value=yW.string+`|`+yW.number,yW.id=yW.variable,(function(){var e=yW.comparatorOp.split(`|`),t,n;for(n=0;n<e.length;n++)t=e[n],yW.comparatorOp+=`|@`+t;for(e=yW.comparatorOp.split(`|`),n=0;n<e.length;n++)t=e[n],!(t.indexOf(`!`)>=0)&&t!==`=`&&(yW.comparatorOp+=`|\\!`+t)})();var bW=function(){return{checks:[]}},xW={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},SW=[{selector:`:selected`,matches:function(e){return e.selected()}},{selector:`:unselected`,matches:function(e){return!e.selected()}},{selector:`:selectable`,matches:function(e){return e.selectable()}},{selector:`:unselectable`,matches:function(e){return!e.selectable()}},{selector:`:locked`,matches:function(e){return e.locked()}},{selector:`:unlocked`,matches:function(e){return!e.locked()}},{selector:`:visible`,matches:function(e){return e.visible()}},{selector:`:hidden`,matches:function(e){return!e.visible()}},{selector:`:transparent`,matches:function(e){return e.transparent()}},{selector:`:grabbed`,matches:function(e){return e.grabbed()}},{selector:`:free`,matches:function(e){return!e.grabbed()}},{selector:`:removed`,matches:function(e){return e.removed()}},{selector:`:inside`,matches:function(e){return!e.removed()}},{selector:`:grabbable`,matches:function(e){return e.grabbable()}},{selector:`:ungrabbable`,matches:function(e){return!e.grabbable()}},{selector:`:animated`,matches:function(e){return e.animated()}},{selector:`:unanimated`,matches:function(e){return!e.animated()}},{selector:`:parent`,matches:function(e){return e.isParent()}},{selector:`:childless`,matches:function(e){return e.isChildless()}},{selector:`:child`,matches:function(e){return e.isChild()}},{selector:`:orphan`,matches:function(e){return e.isOrphan()}},{selector:`:nonorphan`,matches:function(e){return e.isChild()}},{selector:`:compound`,matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:`:loop`,matches:function(e){return e.isLoop()}},{selector:`:simple`,matches:function(e){return e.isSimple()}},{selector:`:active`,matches:function(e){return e.active()}},{selector:`:inactive`,matches:function(e){return!e.active()}},{selector:`:backgrounding`,matches:function(e){return e.backgrounding()}},{selector:`:nonbackgrounding`,matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return fI(e.selector,t.selector)}),CW=function(){for(var e={},t,n=0;n<SW.length;n++)t=SW[n],e[t.selector]=t.matches;return e}(),wW=function(e,t){return CW[e](t)},TW=`(`+SW.map(function(e){return e.selector}).join(`|`)+`)`,EW=function(e){return e.replace(RegExp(`\\\\(`+yW.metaChar+`)`,`g`),function(e,t){return t})},DW=function(e,t,n){e[e.length-1]=n},OW=[{name:`group`,query:!0,regex:`(`+yW.group+`)`,populate:function(e,t,n){var r=xF(n,1)[0];t.checks.push({type:xW.GROUP,value:r===`*`?r:r+`s`})}},{name:`state`,query:!0,regex:TW,populate:function(e,t,n){var r=xF(n,1)[0];t.checks.push({type:xW.STATE,value:r})}},{name:`id`,query:!0,regex:`\\#(`+yW.id+`)`,populate:function(e,t,n){var r=xF(n,1)[0];t.checks.push({type:xW.ID,value:EW(r)})}},{name:`className`,query:!0,regex:`\\.(`+yW.className+`)`,populate:function(e,t,n){var r=xF(n,1)[0];t.checks.push({type:xW.CLASS,value:EW(r)})}},{name:`dataExists`,query:!0,regex:`\\[\\s*(`+yW.variable+`)\\s*\\]`,populate:function(e,t,n){var r=xF(n,1)[0];t.checks.push({type:xW.DATA_EXIST,field:EW(r)})}},{name:`dataCompare`,query:!0,regex:`\\[\\s*(`+yW.variable+`)\\s*(`+yW.comparatorOp+`)\\s*(`+yW.value+`)\\s*\\]`,populate:function(e,t,n){var r=xF(n,3),i=r[0],a=r[1],o=r[2];o=RegExp(`^`+yW.string+`$`).exec(o)==null?parseFloat(o):o.substring(1,o.length-1),t.checks.push({type:xW.DATA_COMPARE,field:EW(i),operator:a,value:o})}},{name:`dataBool`,query:!0,regex:`\\[\\s*(`+yW.boolOp+`)\\s*(`+yW.variable+`)\\s*\\]`,populate:function(e,t,n){var r=xF(n,2),i=r[0],a=r[1];t.checks.push({type:xW.DATA_BOOL,field:EW(a),operator:i})}},{name:`metaCompare`,query:!0,regex:`\\[\\[\\s*(`+yW.meta+`)\\s*(`+yW.comparatorOp+`)\\s*(`+yW.number+`)\\s*\\]\\]`,populate:function(e,t,n){var r=xF(n,3),i=r[0],a=r[1],o=r[2];t.checks.push({type:xW.META_COMPARE,field:EW(i),operator:a,value:parseFloat(o)})}},{name:`nextQuery`,separator:!0,regex:yW.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return n!=null&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]=bW()}},{name:`directedEdge`,separator:!0,regex:yW.directedEdge,populate:function(e,t){if(e.currentSubject==null){var n=bW(),r=t,i=bW();return n.checks.push({type:xW.DIRECTED_EDGE,source:r,target:i}),DW(e,t,n),e.edgeCount++,i}else{var a=bW(),o=t,s=bW();return a.checks.push({type:xW.NODE_SOURCE,source:o,target:s}),DW(e,t,a),e.edgeCount++,s}}},{name:`undirectedEdge`,separator:!0,regex:yW.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var n=bW(),r=t,i=bW();return n.checks.push({type:xW.UNDIRECTED_EDGE,nodes:[r,i]}),DW(e,t,n),e.edgeCount++,i}else{var a=bW(),o=t,s=bW();return a.checks.push({type:xW.NODE_NEIGHBOR,node:o,neighbor:s}),DW(e,t,a),s}}},{name:`child`,separator:!0,regex:yW.child,populate:function(e,t){if(e.currentSubject==null){var n=bW(),r=bW(),i=e[e.length-1];return n.checks.push({type:xW.CHILD,parent:i,child:r}),DW(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var a=bW(),o=e[e.length-1],s=bW(),c=bW(),l=bW(),u=bW();return a.checks.push({type:xW.COMPOUND_SPLIT,left:o,right:s,subject:c}),c.checks=t.checks,t.checks=[{type:xW.TRUE}],u.checks.push({type:xW.TRUE}),s.checks.push({type:xW.PARENT,parent:u,child:l}),DW(e,o,a),e.currentSubject=c,e.compoundCount++,l}else{var d=bW(),f=bW(),p=[{type:xW.PARENT,parent:d,child:f}];return d.checks=t.checks,t.checks=p,e.compoundCount++,f}}},{name:`descendant`,separator:!0,regex:yW.descendant,populate:function(e,t){if(e.currentSubject==null){var n=bW(),r=bW(),i=e[e.length-1];return n.checks.push({type:xW.DESCENDANT,ancestor:i,descendant:r}),DW(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var a=bW(),o=e[e.length-1],s=bW(),c=bW(),l=bW(),u=bW();return a.checks.push({type:xW.COMPOUND_SPLIT,left:o,right:s,subject:c}),c.checks=t.checks,t.checks=[{type:xW.TRUE}],u.checks.push({type:xW.TRUE}),s.checks.push({type:xW.ANCESTOR,ancestor:u,descendant:l}),DW(e,o,a),e.currentSubject=c,e.compoundCount++,l}else{var d=bW(),f=bW(),p=[{type:xW.ANCESTOR,ancestor:d,descendant:f}];return d.checks=t.checks,t.checks=p,e.compoundCount++,f}}},{name:`subject`,modifier:!0,regex:yW.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return WL("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=n==null?null:n.type;r===xW.DIRECTED_EDGE?n.type=xW.NODE_TARGET:r===xW.UNDIRECTED_EDGE&&(n.type=xW.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];OW.forEach(function(e){return e.regexObj=RegExp(`^`+e.regex)});var kW=function(e){for(var t,n,r,i=0;i<OW.length;i++){var a=OW[i],o=a.name,s=e.match(a.regexObj);if(s!=null){n=s,t=a,r=o;var c=s[0];e=e.substring(c.length);break}}return{expr:t,match:n,name:r,remaining:e}},AW=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},jW={parse:function(e){var t=this,n=t.inputText=e,r=t[0]=bW();for(t.length=1,n=AW(n);;){var i=kW(n);if(i.expr==null)return WL("The selector `"+e+"`is invalid"),!1;var a=i.match.slice(1),o=i.expr.populate(t,r,a);if(o===!1)return!1;if(o!=null&&(r=o),n=i.remaining,n.match(/^\s*$/))break}var s=t[t.length-1];t.currentSubject!=null&&(s.subject=t.currentSubject),s.edgeCount=t.edgeCount,s.compoundCount=t.compoundCount;for(var c=0;c<t.length;c++){var l=t[c];if(l.compoundCount>0&&l.edgeCount>0)return WL("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return WL("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;l.edgeCount===1&&WL("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(e){return e??``},t=function(t){return PF(t)?`"`+t+`"`:e(t)},n=function(e){return` `+e+` `},r=function(r,a){var o=r.type,s=r.value;switch(o){case xW.GROUP:var c=e(s);return c.substring(0,c.length-1);case xW.DATA_COMPARE:var l=r.field,u=r.operator;return`[`+l+n(e(u))+t(s)+`]`;case xW.DATA_BOOL:var d=r.operator,f=r.field;return`[`+e(d)+f+`]`;case xW.DATA_EXIST:return`[`+r.field+`]`;case xW.META_COMPARE:var p=r.operator;return`[[`+r.field+n(e(p))+t(s)+`]]`;case xW.STATE:return s;case xW.ID:return`#`+s;case xW.CLASS:return`.`+s;case xW.PARENT:case xW.CHILD:return i(r.parent,a)+n(`>`)+i(r.child,a);case xW.ANCESTOR:case xW.DESCENDANT:return i(r.ancestor,a)+` `+i(r.descendant,a);case xW.COMPOUND_SPLIT:var m=i(r.left,a),h=i(r.subject,a),g=i(r.right,a);return m+(m.length>0?` `:``)+h+g;case xW.TRUE:return``}},i=function(e,t){return e.checks.reduce(function(n,i,a){return n+(t===e&&a===0?`$`:``)+r(i,t)},``)},a=``,o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=`, `)}return this.toStringCache=a,a}},MW=function(e,t,n){var r,i=PF(e),a=$(e),o=PF(n),s,c,l=!1,u=!1,d=!1;switch(t.indexOf(`!`)>=0&&(t=t.replace(`!`,``),u=!0),t.indexOf(`@`)>=0&&(t=t.replace(`@`,``),l=!0),(i||o||l)&&(s=!i&&!a?``:``+e,c=``+n),l&&(e=s=s.toLowerCase(),n=c=c.toLowerCase()),t){case`*=`:r=s.indexOf(c)>=0;break;case`$=`:r=s.indexOf(c,s.length-c.length)>=0;break;case`^=`:r=s.indexOf(c)===0;break;case`=`:r=e===n;break;case`>`:d=!0,r=e>n;break;case`>=`:d=!0,r=e>=n;break;case`<`:d=!0,r=e<n;break;case`<=`:d=!0,r=e<=n;break;default:r=!1;break}return u&&(e!=null||!d)&&(r=!r),r},NW=function(e,t){switch(t){case`?`:return!!e;case`!`:return!e;case`^`:return e===void 0}},PW=function(e){return e!==void 0},FW=function(e,t){return e.data(t)},IW=function(e,t){return e[t]()},LW=[],RW=function(e,t){return e.checks.every(function(e){return LW[e.type](e,t)})};LW[xW.GROUP]=function(e,t){var n=e.value;return n===`*`||n===t.group()},LW[xW.STATE]=function(e,t){var n=e.value;return wW(n,t)},LW[xW.ID]=function(e,t){var n=e.value;return t.id()===n},LW[xW.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)},LW[xW.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return MW(IW(t,n),r,i)},LW[xW.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return MW(FW(t,n),r,i)},LW[xW.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return NW(FW(t,n),r)},LW[xW.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,PW(FW(t,n))},LW[xW.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return RW(n,i)&&RW(r,a)||RW(r,i)&&RW(n,a)},LW[xW.NODE_NEIGHBOR]=function(e,t){return RW(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&RW(e.neighbor,t)})},LW[xW.DIRECTED_EDGE]=function(e,t){return RW(e.source,t.source())&&RW(e.target,t.target())},LW[xW.NODE_SOURCE]=function(e,t){return RW(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&RW(e.target,t)})},LW[xW.NODE_TARGET]=function(e,t){return RW(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&RW(e.source,t)})},LW[xW.CHILD]=function(e,t){return RW(e.child,t)&&RW(e.parent,t.parent())},LW[xW.PARENT]=function(e,t){return RW(e.parent,t)&&t.children().some(function(t){return RW(e.child,t)})},LW[xW.DESCENDANT]=function(e,t){return RW(e.descendant,t)&&t.ancestors().some(function(t){return RW(e.ancestor,t)})},LW[xW.ANCESTOR]=function(e,t){return RW(e.ancestor,t)&&t.descendants().some(function(t){return RW(e.descendant,t)})},LW[xW.COMPOUND_SPLIT]=function(e,t){return RW(e.subject,t)&&RW(e.left,t)&&RW(e.right,t)},LW[xW.TRUE]=function(){return!0},LW[xW.COLLECTION]=function(e,t){return e.value.has(t)},LW[xW.FILTER]=function(e,t){var n=e.value;return n(t)};var zW={matches:function(e){for(var t=this,n=0;n<t.length;n++){var r=t[n];if(RW(r,e))return!0}return!1},filter:function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===xW.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++){var r=t[n];if(RW(r,e))return!0}return!1};return t.text()??(n=function(){return!0}),e.filter(n)}},BW=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||PF(e)&&e.match(/^\s*$/)||(VF(e)?this.addQuery({checks:[{type:xW.COLLECTION,value:e.collection()}]}):FF(e)?this.addQuery({checks:[{type:xW.FILTER,value:e}]}):PF(e)?this.parse(e)||(this.invalid=!0):HL(`A selector must be created from a string; found `))},VW=BW.prototype;[jW,zW].forEach(function(e){return pI(VW,e)}),VW.text=function(){return this.inputText},VW.size=function(){return this.length},VW.eq=function(e){return this[e]},VW.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},VW.addQuery=function(e){this[this.length++]=e},VW.selector=VW.toString;var HW={allAre:function(e){var t=new BW(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new BW(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length?t===1?this[0]===e[0]:this.every(function(t){return e.hasElementWithId(t.id())}):!1},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(e){return t.hasElementWithId(e.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(e){return t.hasElementWithId(e.id())})}};HW.allAreNeighbours=HW.allAreNeighbors,HW.has=HW.contains,HW.equal=HW.equals=HW.same;var UW=function(e,t){return function(n,r,i,a){var o=n,s=this,c;if(o==null?c=``:VF(o)&&o.length===1&&(c=o.id()),s.length===1&&c){var l=s[0]._private,u=l.traversalCache=l.traversalCache||{},d=u[t]=u[t]||[],f=OL(c);return d[f]||(d[f]=e.call(s,n,r,i,a))}else return e.call(s,n,r,i,a)}},WW={parent:function(e){var t=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r]._private.parent;i&&t.push(i)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t||=r,t=t.intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(e){return e.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(e){return e.isChild()}).filter(e)},children:UW(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[i]);return this.spawn(t,!0).filter(e)},`children`),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var t=[];function n(e){for(var r=0;r<e.length;r++){var i=e[r];t.push(i),i.children().nonempty()&&n(i.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function GW(e,t,n,r){for(var i=[],a=new oR,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var c=e[s];n?i.push(c):o&&r(i,a,c)}for(;i.length>0;){var l=i.shift();t(l),a.add(l.id()),o&&r(i,a,l)}return e}function KW(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}WW.forEachDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return GW(this,e,t,KW)};function qW(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}WW.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return GW(this,e,t,qW)};function JW(e,t,n){qW(e,t,n),KW(e,t,n)}WW.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return GW(this,e,t,JW)},WW.ancestors=WW.parents;var YW=XW={data:gW.data({field:`data`,bindingEvent:`data`,allowBinding:!0,allowSetting:!0,settingEvent:`data`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:gW.removeData({field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:gW.data({field:`scratch`,bindingEvent:`scratch`,allowBinding:!0,allowSetting:!0,settingEvent:`scratch`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeScratch:gW.removeData({field:`scratch`,event:`scratch`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0}),rscratch:gW.data({field:`rscratch`,allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:gW.removeData({field:`rscratch`,triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},XW;YW.attr=YW.data,YW.removeAttr=YW.removeData;var ZW=XW,QW={};function $W(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0)if(n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,o=0;o<a.length;o++){var s=a[o];!t&&s.isLoop()||(r+=e(i,s))}return r}else return}}pI(QW,{degree:$W(function(e,t){return t.source().same(t.target())?2:1}),indegree:$W(function(e,t){return+!!t.target().same(e)}),outdegree:$W(function(e,t){return+!!t.source().same(e)})});function eG(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);o!==void 0&&(r===void 0||t(o,r))&&(r=o)}return r}}pI(QW,{minDegree:eG(`degree`,function(e,t){return e<t}),maxDegree:eG(`degree`,function(e,t){return e>t}),minIndegree:eG(`indegree`,function(e,t){return e<t}),maxIndegree:eG(`indegree`,function(e,t){return e>t}),minOutdegree:eG(`outdegree`,function(e,t){return e<t}),maxOutdegree:eG(`outdegree`,function(e,t){return e>t})}),pI(QW,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var tG,nG,rG=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:t.x==null?0:t.x-a.x,y:t.y==null?0:t.y-a.y};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,n),i.dirtyBoundingBoxCache()}}},iG={field:`position`,bindingEvent:`position`,allowBinding:!0,allowSetting:!0,settingEvent:`position`,settingTriggersEvent:!0,triggerFnName:`emitAndNotify`,allowGetting:!0,validKeys:[`x`,`y`],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){rG(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};tG=nG={position:gW.data(iG),silentPosition:gW.data(pI({},iG,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){rG(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(LF(e))t?this.silentPosition(e):this.position(e);else if(FF(e)){var n=e,r=this.cy();r.startBatch();for(var i=0;i<this.length;i++){var a=this[i],o=void 0;(o=n(a,i))&&(t?a.silentPosition(o):a.position(o))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(LF(e)?(r={x:$(e.x)?e.x:0,y:$(e.y)?e.y:0},n=t):PF(e)&&$(t)&&(r={x:0,y:0},r[e]=t),r!=null){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),c={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(c):o.position(c)}}i.endBatch()}return this},silentShift:function(e,t){return LF(e)?this.shift(e,!0):PF(e)&&$(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=LF(e)?e:void 0,s=o!==void 0||t!==void 0&&PF(e);if(n&&n.isNode())if(s)for(var c=0;c<this.length;c++){var l=this[c];t===void 0?o!==void 0&&l.position(NR(o,i,a)):l.position(e,(t-a[e])/i)}else return o=MR(n.position(),i,a),e===void 0?o:o[e];else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=LF(e)?e:void 0,a=i!==void 0||t!==void 0&&PF(e),o=r.hasCompoundNodes();if(n&&n.isNode())if(a)for(var s=0;s<this.length;s++){var c=this[s],l=o?c.parent():null,u=l&&l.length>0,d=u;u&&(l=l[0]);var f=d?l.position():{x:0,y:0};t===void 0?i!==void 0&&c.position({x:i.x+f.x,y:i.y+f.y}):c.position(e,t+f[e])}else{var p=n.position(),m=o?n.parent():null,h=m&&m.length>0,g=h;h&&(m=m[0]);var _=g?m.position():{x:0,y:0};return i={x:p.x-_.x,y:p.y-_.y},e===void 0?i:i[e]}else if(!a)return;return this}},tG.modelPosition=tG.point=tG.position,tG.modelPositions=tG.points=tG.positions,tG.renderedPoint=tG.renderedPosition,tG.relativePoint=tG.relativePosition;var aG=nG,oG=sG={},sG;sG.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,c=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:c,w:o-a,h:c-s}},sG.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()||this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify(`bounds`)}}),this},sG.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()||!e&&t.batching())return this;function n(e){if(!e.isParent())return;var t=e._private,n=e.children(),r=e.pstyle(`compound-sizing-wrt-labels`).value===`include`,i={width:{val:e.pstyle(`min-width`).pfValue,left:e.pstyle(`min-width-bias-left`),right:e.pstyle(`min-width-bias-right`)},height:{val:e.pstyle(`min-height`).pfValue,top:e.pstyle(`min-height-bias-top`),bottom:e.pstyle(`min-height-bias-bottom`)}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;(a.w===0||a.h===0)&&(a={w:e.pstyle(`width`).pfValue,h:e.pstyle(`height`).pfValue},a.x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);function s(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}function c(e,t,n,r){if(n.units===`%`)switch(r){case`width`:return e>0?n.pfValue*e:0;case`height`:return t>0?n.pfValue*t:0;case`average`:return e>0&&t>0?n.pfValue*(e+t)/2:0;case`min`:return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case`max`:return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}else if(n.units===`px`)return n.pfValue;else return 0}var l=i.width.left.value;i.width.left.units===`px`&&i.width.val>0&&(l=l*100/i.width.val);var u=i.width.right.value;i.width.right.units===`px`&&i.width.val>0&&(u=u*100/i.width.val);var d=i.height.top.value;i.height.top.units===`px`&&i.height.val>0&&(d=d*100/i.height.val);var f=i.height.bottom.value;i.height.bottom.units===`px`&&i.height.val>0&&(f=f*100/i.height.val);var p=s(i.width.val-a.w,l,u),m=p.biasDiff,h=p.biasComplementDiff,g=s(i.height.val-a.h,d,f),_=g.biasDiff,v=g.biasComplementDiff;t.autoPadding=c(a.w,a.h,e.pstyle(`padding`),e.pstyle(`padding-relative-to`).value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-m+a.x1+a.x2+h)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-_+a.y1+a.y2+v)/2}for(var r=0;r<this.length;r++){var i=this[r],a=i._private;(!a.compoundBoundsClean||e)&&(n(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var cG=function(e){return e===1/0||e===-1/0?0:e},lG=function(e,t,n,r,i){r-t===0||i-n===0||t==null||n==null||r==null||i==null||(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},uG=function(e,t){return t==null?e:lG(e,t.x1,t.y1,t.x2,t.y2)},dG=function(e,t,n){return tR(e,t,n)},fG=function(e,t,n){if(!t.cy().headless()){var r=t._private,i=r.rstyle,a=i.arrowWidth/2,o=t.pstyle(n+`-arrow-shape`).value,s,c;if(o!==`none`){n===`source`?(s=i.srcX,c=i.srcY):n===`target`?(s=i.tgtX,c=i.tgtY):(s=i.midX,c=i.midY);var l=r.arrowBounds=r.arrowBounds||{},u=l[n]=l[n]||{};u.x1=s-a,u.y1=c-a,u.x2=s+a,u.y2=c+a,u.w=u.x2-u.x1,u.h=u.y2-u.y1,tz(u,1),lG(e,u.x1,u.y1,u.x2,u.y2)}}},pG=function(e,t,n){if(!t.cy().headless()){var r=n?n+`-`:``,i=t._private,a=i.rstyle;if(t.pstyle(r+`label`).strValue){var o=t.pstyle(`text-halign`),s=t.pstyle(`text-valign`),c=dG(a,`labelWidth`,n),l=dG(a,`labelHeight`,n),u=dG(a,`labelX`,n),d=dG(a,`labelY`,n),f=t.pstyle(r+`text-margin-x`).pfValue,p=t.pstyle(r+`text-margin-y`).pfValue,m=t.isEdge(),h=t.pstyle(r+`text-rotation`),g=t.pstyle(`text-outline-width`).pfValue,_=t.pstyle(`text-border-width`).pfValue/2,v=t.pstyle(`text-background-padding`).pfValue,y=2,b=l,x=c,S=x/2,C=b/2,w,T,E,D;if(m)w=u-S,T=u+S,E=d-C,D=d+C;else{switch(o.value){case`left`:w=u-x,T=u;break;case`center`:w=u-S,T=u+S;break;case`right`:w=u,T=u+x;break}switch(s.value){case`top`:E=d-b,D=d;break;case`center`:E=d-C,D=d+C;break;case`bottom`:E=d,D=d+b;break}}var O=f-Math.max(g,_)-v-y,k=f+Math.max(g,_)+v+y,A=p-Math.max(g,_)-v-y,j=p+Math.max(g,_)+v+y;w+=O,T+=k,E+=A,D+=j;var M=n||`main`,N=i.labelBounds,P=N[M]=N[M]||{};P.x1=w,P.y1=E,P.x2=T,P.y2=D,P.w=T-w,P.h=D-E,P.leftPad=O,P.rightPad=k,P.topPad=A,P.botPad=j;var F=m&&h.strValue===`autorotate`,I=h.pfValue!=null&&h.pfValue!==0;if(F||I){var L=F?dG(i.rstyle,`labelAngle`,n):h.pfValue,R=Math.cos(L),ee=Math.sin(L),z=(w+T)/2,B=(E+D)/2;if(!m){switch(o.value){case`left`:z=T;break;case`right`:z=w;break}switch(s.value){case`top`:B=D;break;case`bottom`:B=E;break}}var V=function(e,t){return e-=z,t-=B,{x:e*R-t*ee+z,y:e*ee+t*R+B}},H=V(w,E),te=V(w,D),ne=V(T,E),U=V(T,D);w=Math.min(H.x,te.x,ne.x,U.x),T=Math.max(H.x,te.x,ne.x,U.x),E=Math.min(H.y,te.y,ne.y,U.y),D=Math.max(H.y,te.y,ne.y,U.y)}var re=M+`Rot`,ie=N[re]=N[re]||{};ie.x1=w,ie.y1=E,ie.x2=T,ie.y2=D,ie.w=T-w,ie.h=D-E,lG(e,w,E,T,D),lG(i.labelBounds.all,w,E,T,D)}return e}},mG=function(e,t){if(!t.cy().headless()){var n=t.pstyle(`outline-opacity`).value,r=t.pstyle(`outline-width`).value+t.pstyle(`outline-offset`).value;hG(e,t,n,r,`outside`,r/2)}},hG=function(e,t,n,r,i,a){if(!(n===0||r<=0||i===`inside`)){var o=t.cy().renderer(),s=o.nodeShapes[o.getNodeShape(t)];if(s){var c=t.position(),l=c.x,u=c.y,d=t.width(),f=t.height();s.hasMiterBounds?(i===`center`&&(r/=2),uG(e,s.miterBounds(l,u,d,f,r))):a!=null&&a>0&&nz(e,[a,a,a,a])}}},gG=function(e,t){if(!t.cy().headless()){var n=t.pstyle(`border-opacity`).value,r=t.pstyle(`border-width`).pfValue,i=t.pstyle(`border-position`).value;hG(e,t,n,r,i)}},_G=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a=XR(),o=e._private,s=e.isNode(),c=e.isEdge(),l,u,d,f,p,m,h=o.rstyle,g=s&&r?e.pstyle(`bounds-expansion`).pfValue:[0],_=function(e){return e.pstyle(`display`).value!==`none`},v=!r||_(e)&&(!c||_(e.source())&&_(e.target()));if(v){var y=0,b=0;r&&t.includeOverlays&&(y=e.pstyle(`overlay-opacity`).value,y!==0&&(b=e.pstyle(`overlay-padding`).value));var x=0,S=0;r&&t.includeUnderlays&&(x=e.pstyle(`underlay-opacity`).value,x!==0&&(S=e.pstyle(`underlay-padding`).value));var C=Math.max(b,S),w=0,T=0;if(r&&(w=e.pstyle(`width`).pfValue,T=w/2),s&&t.includeNodes){var E=e.position();p=E.x,m=E.y;var D=e.outerWidth()/2,O=e.outerHeight()/2;l=p-D,u=p+D,d=m-O,f=m+O,lG(a,l,d,u,f),r&&mG(a,e),r&&t.includeOutlines&&!i&&mG(a,e),r&&gG(a,e)}else if(c&&t.includeEdges)if(r&&!i){var k=e.pstyle(`curve-style`).strValue;if(l=Math.min(h.srcX,h.midX,h.tgtX),u=Math.max(h.srcX,h.midX,h.tgtX),d=Math.min(h.srcY,h.midY,h.tgtY),f=Math.max(h.srcY,h.midY,h.tgtY),l-=T,u+=T,d-=T,f+=T,lG(a,l,d,u,f),k===`haystack`){var A=h.haystackPts;if(A&&A.length===2){if(l=A[0].x,d=A[0].y,u=A[1].x,f=A[1].y,l>u){var j=l;l=u,u=j}if(d>f){var M=d;d=f,f=M}lG(a,l-T,d-T,u+T,f+T)}}else if(k===`bezier`||k===`unbundled-bezier`||rI(k,`segments`)||rI(k,`taxi`)){var N;switch(k){case`bezier`:case`unbundled-bezier`:N=h.bezierPts;break;case`segments`:case`taxi`:case`round-segments`:case`round-taxi`:N=h.linePts;break}if(N!=null)for(var P=0;P<N.length;P++){var F=N[P];l=F.x-T,u=F.x+T,d=F.y-T,f=F.y+T,lG(a,l,d,u,f)}}}else{var I=e.source().position(),L=e.target().position();if(l=I.x,u=L.x,d=I.y,f=L.y,l>u){var R=l;l=u,u=R}if(d>f){var ee=d;d=f,f=ee}l-=T,u+=T,d-=T,f+=T,lG(a,l,d,u,f)}if(r&&t.includeEdges&&c&&(fG(a,e,`mid-source`),fG(a,e,`mid-target`),fG(a,e,`source`),fG(a,e,`target`)),r&&e.pstyle(`ghost`).value===`yes`){var z=e.pstyle(`ghost-offset-x`).pfValue,B=e.pstyle(`ghost-offset-y`).pfValue;lG(a,a.x1+z,a.y1+B,a.x2+z,a.y2+B)}var V=o.bodyBounds=o.bodyBounds||{};rz(V,a),nz(V,g),tz(V,1),r&&(l=a.x1,u=a.x2,d=a.y1,f=a.y2,lG(a,l-C,d-C,u+C,f+C));var H=o.overlayBounds=o.overlayBounds||{};rz(H,a),nz(H,g),tz(H,1);var te=o.labelBounds=o.labelBounds||{};te.all==null?te.all=XR():QR(te.all),r&&t.includeLabels&&(t.includeMainLabels&&pG(a,e,null),c&&(t.includeSourceLabels&&pG(a,e,`source`),t.includeTargetLabels&&pG(a,e,`target`)))}return a.x1=cG(a.x1),a.y1=cG(a.y1),a.x2=cG(a.x2),a.y2=cG(a.y2),a.w=cG(a.x2-a.x1),a.h=cG(a.y2-a.y1),a.w>0&&a.h>0&&v&&(nz(a,g),tz(a,1)),a},vG=function(e){var t=0,n=function(e){return+!!e<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays),r+=n(e.includeOutlines),r},yG=function(e){var t=function(e){return Math.round(e)};if(e.isEdge()){var n=e.source().position(),r=e.target().position();return DL([t(n.x),t(n.y),t(r.x),t(r.y)])}else{var i=e.position();return DL([t(i.x),t(i.y)])}},bG=function(e,t){var n=e._private,r,i=e.isEdge(),a=(t==null?SG:vG(t))===SG;if(n.bbCache==null?(r=_G(e,xG),n.bbCache=r,n.bbCachePosKey=yG(e)):r=n.bbCache,!a){var o=e.isNode();r=XR(),(t.includeNodes&&o||t.includeEdges&&!o)&&(t.includeOverlays?uG(r,n.overlayBounds):uG(r,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?uG(r,n.labelBounds.all):(t.includeMainLabels&&uG(r,n.labelBounds.mainRot),t.includeSourceLabels&&uG(r,n.labelBounds.sourceRot),t.includeTargetLabels&&uG(r,n.labelBounds.targetRot))),r.w=r.x2-r.x1,r.h=r.y2-r.y1}return r},xG={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},SG=vG(xG),CG=ZL(xG);sG.boundingBox=function(e){var t,n=e===void 0||e.useCache===void 0||e.useCache===!0,r=QF(function(e){var t=e._private;return t.bbCache==null||t.styleDirty||t.bbCachePosKey!==yG(e)},function(e){return e.id()});if(n&&this.length===1&&!r(this[0]))e=e===void 0?xG:CG(e),t=bG(this[0],e);else{t=XR(),e||=xG;var i=CG(e),a=this,o=a.cy().styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),o&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var s=0;s<a.length;s++){var c=a[s];r(c)&&c.dirtyBoundingBoxCache(),uG(t,bG(c,i))}}return t.x1=cG(t.x1),t.y1=cG(t.y1),t.x2=cG(t.x2),t.y2=cG(t.y2),t.w=cG(t.x2-t.x1),t.h=cG(t.y2-t.y1),t},sG.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds[`mid-source`]=null,t.arrowBounds[`mid-target`]=null}return this.emitAndNotify(`bounds`),this},sG.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),i=n.collection();if(r&&(i=t.filter(function(e){return e.isParent()}),t=t.not(i)),LF(e)){var a=e;e=function(){return a}}var o=function(t,n){return t._private.bbAtOldPos=e(t,n)},s=function(e){return e._private.bbAtOldPos};n.startBatch(),t.forEach(o).silentPositions(e),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var c=ZR(this.boundingBox({useCache:!1}));return t.silentPositions(s),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),n.endBatch(),c},oG.boundingbox=oG.bb=oG.boundingBox,oG.renderedBoundingbox=oG.renderedBoundingBox;var wG=sG,TG=EG={},EG,DG=function(e){e.uppercaseName=nI(e.name),e.autoName=`auto`+e.uppercaseName,e.labelName=`label`+e.uppercaseName,e.outerName=`outer`+e.uppercaseName,e.uppercaseOuterName=nI(e.outerName),TG[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t)if(r){if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var i=t.pstyle(e.name);switch(i.strValue){case`label`:return t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return i.pfValue}}else return 1},TG[`outer`+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)if(n){var r=t[e.name](),i=t.pstyle(`border-position`).value,a=i===`center`?t.pstyle(`border-width`).pfValue:i===`outside`?2*t.pstyle(`border-width`).pfValue:0,o=2*t.padding();return r+a+o}else return 1},TG[`rendered`+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},TG[`rendered`+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};DG({name:`width`}),DG({name:`height`}),EG.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),t.autoPadding===void 0?e.pstyle(`padding`).pfValue:t.autoPadding):e.pstyle(`padding`).pfValue},EG.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},EG.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var OG=EG,kG=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},AG=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return MR(t(e),n.zoom(),n.pan())}},jG=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map(function(e){return MR(e,i,r)})}},MG={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},NG=function(e){return`rendered`+e[0].toUpperCase()+e.substr(1)},PG=pI({},aG,wG,OG,Object.keys(MG).reduce(function(e,t){var n=MG[t],r=NG(t);return e[t]=function(){return kG(this,n.get)},n.mult?e[r]=function(){return jG(this,n.get)}:e[r]=function(){return AG(this,n.get)},e},{})),FG=function(e,t){this.recycle(e,t)};function IG(){return!1}function LG(){return!0}FG.prototype={instanceString:function(){return`event`},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=IG,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?LG:IG):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type==null?this.type:t.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=LG;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=LG;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=LG,this.stopPropagation()},isDefaultPrevented:IG,isPropagationStopped:IG,isImmediatePropagationStopped:IG};var RG=/^([^.]+)(\.(?:[^.]+))?$/,zG=`.*`,BG={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},VG=Object.keys(BG),HG={};function UG(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:HG,t=arguments.length>1?arguments[1]:void 0,n=0;n<VG.length;n++){var r=VG[n];this[r]=e[r]||BG[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var WG=UG.prototype,GG=function(e,t,n,r,i,a,o){FF(r)&&(i=r,r=null),o&&(a=a==null?o:pI({},a,o));for(var s=IF(n)?n:n.split(/\s+/),c=0;c<s.length;c++){var l=s[c];if(!qF(l)){var u=l.match(RG);if(u){var d=u[1];if(t(e,l,d,u[2]?u[2]:null,r,i,a)===!1)break}}}},KG=function(e,t){return e.addEventFields(e.context,t),new FG(t.type,t)},qG=function(e,t,n){if(KF(n)){t(e,n);return}else if(LF(n)){t(e,KG(e,n));return}for(var r=IF(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!qF(a)){var o=a.match(RG);if(o){var s=o[1];t(e,KG(e,{type:s,namespace:o[2]?o[2]:null,target:e.context}))}}}};WG.on=WG.addListener=function(e,t,n,r,i){return GG(this,function(e,t,n,r,i,a,o){FF(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})},e,t,n,r,i),this},WG.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},WG.removeListener=WG.off=function(e,t,n,r){var i=this;this.emitting!==0&&(this.listeners=qL(this.listeners));for(var a=this.listeners,o=function(o){var s=a[o];GG(i,function(t,n,r,i,c,l){if((s.type===r||e===`*`)&&(!i&&s.namespace!==`.*`||s.namespace===i)&&(!c||t.qualifierCompare(s.qualifier,c))&&(!l||s.callback===l))return a.splice(o,1),!1},e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},WG.removeAllListeners=function(){return this.removeListener(`*`)},WG.emit=WG.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,IF(t)||(t=[t]),qG(this,function(e,a){n!=null&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(){var n=r[s];if(n.type===a.type&&(!n.namespace||n.namespace===a.namespace||n.namespace===zG)&&e.eventMatches(e.context,n,a)){var i=[a];t!=null&&eR(i,t),e.beforeEmit(e.context,n,a),n.conf&&n.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==n}));var o=e.callbackContext(e.context,n,a),c=n.callback.apply(o,i);e.afterEmit(e.context,n,a),c===!1&&(a.stopPropagation(),a.preventDefault())}},s=0;s<i;s++)o();e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)},e),this.emitting--,this};var JG={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null?!0:e!==n.target&&HF(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return t.qualifier==null?e:n.target},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},YG=function(e){return PF(e)?new BW(e):e},XG={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||=new UG(JG,t)}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=YG(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n);return this},removeListener:function(e,t,n){for(var r=YG(t),i=0;i<this.length;i++)this[i].emitter().removeListener(e,r,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var r=YG(t),i=0;i<this.length;i++)this[i].emitter().one(e,r,n);return this},once:function(e,t,n){for(var r=YG(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this}};gW.eventAliasesOn(XG);var ZG={nodes:function(e){return this.filter(function(e){return e.isNode()}).filter(e)},edges:function(e){return this.filter(function(e){return e.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(PF(e)||VF(e))return new BW(e).filter(this);if(FF(e)){for(var n=this.spawn(),r=this,i=0;i<r.length;i++){var a=r[i];(t?e.apply(t,[a,i,r]):e(a,i,r))&&n.push(a)}return n}return this.spawn()},not:function(e){if(e){PF(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n];e.has(r)||t.push(r)}return t}else return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(PF(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=this,i=e,a=this.length<e.length,o=a?r:i,s=a?i:r,c=0;c<o.length;c++){var l=o[c];s.has(l)&&n.push(l)}return n},xor:function(e){var t=this._private.cy;PF(e)&&(e=t.$(e));var n=this.spawn(),r=this,i=e,a=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id;t.hasElementWithId(a)||n.push(i)}};return a(r,i),a(i,r),n},diff:function(e){var t=this._private.cy;PF(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),i=this.spawn(),a=this,o=e,s=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.merge(a):n.push(a)}};return s(a,o,n),s(o,a,r),{left:n,right:r,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(PF(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i];this.has(a)||r.push(a)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&PF(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var c=this.length++;this[c]=o,i.set(s,{ele:o,index:c})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&PF(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,i=0;i<r.length;i++){var a=r[i],o=t?e.apply(t,[a,i,r]):e(a,i,r);n.push(o)}return n},reduce:function(e,t){for(var n=t,r=this,i=0;i<r.length;i++)n=e(n,r[i],i,r);return n},max:function(e,t){for(var n=-1/0,r,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s>n&&(n=s,r=o)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s<n&&(n=s,r=o)}return{value:n,ele:r}}},QG=ZG;QG.u=QG[`|`]=QG[`+`]=QG.union=QG.or=QG.add,QG[`\\`]=QG[`!`]=QG[`-`]=QG.difference=QG.relativeComplement=QG.subtract=QG.not,QG.n=QG[`&`]=QG[`.`]=QG.and=QG.intersection=QG.intersect,QG[`^`]=QG[`(+)`]=QG[`(-)`]=QG.symmetricDifference=QG.symdiff=QG.xor,QG.fnFilter=QG.filterFn=QG.stdFilter=QG.filter,QG.complement=QG.abscomp=QG.absoluteComplement;var $G={isNode:function(){return this.group()===`nodes`},isEdge:function(){return this.group()===`edges`},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},eK=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle(`z-compound-depth`);return t.value===`auto`?n?e.zDepth():0:t.value===`bottom`?-1:t.value===`top`?LL:0}var i=r(e)-r(t);if(i!==0)return i;function a(e){return e.pstyle(`z-index-compare`).value===`auto`?+!!e.isNode():0}var o=a(e)-a(t);if(o!==0)return o;var s=e.pstyle(`z-index`).value-t.pstyle(`z-index`).value;return s===0?e.poolIndex()-t.poolIndex():s},tK={forEach:function(e,t){if(FF(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if((t?e.apply(t,[i,r,this]):e(i,r,this))===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;t??=r,e??=0,e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!FF(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(eK)},zDepth:function(){var e=this[0];if(e){var t=e._private;if(t.group===`nodes`){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:LL-1}else{var r=t.source,i=t.target,a=r.zDepth(),o=i.zDepth();return Math.max(a,o,0)}}}};tK.each=tK.forEach,(function(){var e=`undefined`;(typeof Symbol>`u`?`undefined`:TF(Symbol))!=e&&TF(Symbol.iterator)!=e&&(tK[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return gF({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})})})();var nK=ZL({nodeDimensionsIncludeLabels:!1}),rK={layoutDimensions:function(e){e=nK(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter(function(e){return!e.isParent()}),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=QF(n,o);e.emit({type:`layoutstart`,layout:e}),e.animations=[];var c=function(e,t,n){var r={x:t.x1+t.w/2,y:t.y1+t.h/2},i={x:(n.x-r.x)*e,y:(n.y-r.y)*e};return{x:r.x+i.x,y:r.y+i.y}},l=t.spacingFactor&&t.spacingFactor!==1,u=function(){if(!l)return null;for(var e=XR(),t=0;t<r.length;t++){var n=r[t],i=s(n,t);ez(e,i.x,i.y)}return e}(),d=QF(function(e,n){var r=s(e,n);return l&&(r=c(Math.abs(t.spacingFactor),u,r)),t.transform!=null&&(r=t.transform(e,r)),r},o);if(t.animate){for(var f=0;f<r.length;f++){var p=r[f],m=d(p,f);if(t.animateFilter==null||t.animateFilter(p,f)){var h=p.animation({position:m,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(h)}else p.position(m)}if(t.fit){var g=i.animation({fit:{boundingBox:a.boundingBoxAt(d),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else if(t.zoom!==void 0&&t.pan!==void 0){var _=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(_)}e.animations.forEach(function(e){return e.play()}),e.one(`layoutready`,t.ready),e.emit({type:`layoutready`,layout:e}),gV.all(e.animations.map(function(e){return e.promise()})).then(function(){e.one(`layoutstop`,t.stop),e.emit({type:`layoutstop`,layout:e})})}else r.positions(d),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one(`layoutready`,t.ready),e.emit({type:`layoutready`,layout:e}),e.one(`layoutstop`,t.stop),e.emit({type:`layoutstop`,layout:e});return this},layout:function(e){return this.cy().makeLayout(pI({},e,{eles:this}))}};rK.createLayout=rK.makeLayout=rK.layout;function iK(e,t,n){var r=n._private,i=r.styleCache=r.styleCache||[],a;return(a=i[e])??(a=i[e]=t(n)),a}function aK(e,t){return e=OL(e),function(n){return iK(e,t,n)}}function oK(e,t){e=OL(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return iK(e,n,t)}}var sK={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(e){return e._private.styleCache=null};if(e.hasCompoundNodes()){var n=this.spawnSelf().merge(this.descendants()).merge(this.parents());n.merge(n.connectedEdges()),n.forEach(t)}else this.forEach(function(e){t(e),e.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=t.hasCompoundNodes(),r=this;e=!!(e||e===void 0),n&&(r=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var i=r;return e?i.emitAndNotify(`style`):i.emit(`style`),r.forEach(function(e){return e._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],r=n.cy();if(r.styleEnabled()&&n)return n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n)),n._private.style[e]??(t?r.style().getDefaultProperty(e):null)},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue===void 0?n.value:n.pfValue}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,i=n.style();if(LF(e)){var a=e;i.applyBypass(this,a,r),this.emitAndNotify(`style`)}else if(PF(e))if(t===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,t,r),this.emitAndNotify(`style`);else if(e===void 0){var s=this[0];return s?i.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),i=this;if(e===void 0)for(var a=0;a<i.length;a++){var o=i[a];r.removeAllBypasses(o,n)}else{e=e.split(/\s+/);for(var s=0;s<i.length;s++){var c=i[s];r.removeBypasses(c,e,n)}}return this.emitAndNotify(`style`),this},show:function(){return this.css(`display`,`element`),this},hide:function(){return this.css(`display`,`none`),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle(`opacity`).value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++)i=a[o].pstyle(`opacity`).value*i;return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();if(e)return t?e.effectiveOpacity()===0:e.pstyle(`opacity`).value===0},backgrounding:function(){return this.cy().styleEnabled()?!!this[0]._private.backgrounding:!1}};function cK(e,t){var n=e._private.data.parent?e.parents():null;if(n)for(var r=0;r<n.length;r++){var i=n[r];if(!t(i))return!1}return!0}function lK(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||cK(i,r);var s=o.source,c=o.target;return n(s)&&(!a||cK(s,n))&&(s===c||n(c)&&(!a||cK(c,n)))}}}var uK=aK(`eleTakesUpSpace`,function(e){return e.pstyle(`display`).value===`element`&&e.width()!==0&&(e.isNode()?e.height()!==0:!0)});sK.takesUpSpace=oK(`takesUpSpace`,lK({ok:uK})),sK.interactive=oK(`interactive`,lK({ok:aK(`eleInteractive`,function(e){return e.pstyle(`events`).value===`yes`&&e.pstyle(`visibility`).value===`visible`&&uK(e)}),parentOk:aK(`parentInteractive`,function(e){return e.pstyle(`visibility`).value===`visible`&&uK(e)}),edgeOkViaNode:uK})),sK.noninteractive=function(){var e=this[0];if(e)return!e.interactive()},sK.visible=oK(`visible`,lK({ok:aK(`eleVisible`,function(e){return e.pstyle(`visibility`).value===`visible`&&e.pstyle(`opacity`).pfValue!==0&&uK(e)}),edgeOkViaNode:uK})),sK.hidden=function(){var e=this[0];if(e)return!e.visible()},sK.isBundledBezier=oK(`isBundledBezier`,function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle(`curve-style`).value===`bezier`&&this.takesUpSpace():!1}),sK.bypass=sK.css=sK.style,sK.renderedCss=sK.renderedStyle,sK.removeBypass=sK.removeCss=sK.removeStyle,sK.pstyle=sK.parsedStyle;var dK={};function fK(e){return function(){var t=arguments,n=[];if(t.length===2){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(t.length===1&&FF(t[0])){var a=t[0];this.on(e.event,a)}else if(t.length===0||t.length===1&&IF(t[0])){for(var o=t.length===1?t[0]:null,s=0;s<this.length;s++){var c=this[s],l=!e.ableField||c._private[e.ableField],u=c._private[e.field]!=e.value;if(e.overrideAble){var d=e.overrideAble(c);if(d!==void 0&&(l=d,!d))return this}l&&(c._private[e.field]=e.value,u&&n.push(c))}var f=this.spawn(n);f.updateStyle(),f.emit(e.event),o&&f.emit(o)}return this}}function pK(e){dK[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(n!==void 0)return n}return t._private[e.field]}},dK[e.on]=fK({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),dK[e.off]=fK({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}pK({field:`locked`,overrideField:function(e){return e.cy().autolock()?!0:void 0},on:`lock`,off:`unlock`}),pK({field:`grabbable`,overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:`grabify`,off:`ungrabify`}),pK({field:`selected`,ableField:`selectable`,overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:`select`,off:`unselect`}),pK({field:`selectable`,overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:`selectify`,off:`unselectify`}),dK.deselect=dK.unselect,dK.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},pK({field:`active`,on:`activate`,off:`unactivate`}),pK({field:`pannable`,on:`panify`,off:`unpanify`}),dK.inactive=function(){var e=this[0];if(e)return!e._private.active};var mK={},hK=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode()){for(var o=!1,s=a.connectedEdges(),c=0;c<s.length;c++){var l=s[c],u=l.source(),d=l.target();if(e.noIncomingEdges&&d===a&&u!==a||e.noOutgoingEdges&&u===a&&d!==a){o=!0;break}}o||r.push(a)}}return this.spawn(r,!0).filter(t)}},gK=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode())for(var o=a.connectedEdges(),s=0;s<o.length;s++){var c=o[s],l=c.source(),u=c.target();e.outgoing&&l===a?(r.push(c),r.push(u)):e.incoming&&u===a&&(r.push(c),r.push(l))}}return this.spawn(r,!0).filter(t)}},_K=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(a.length===0)break;for(var o=!1,s=0;s<a.length;s++){var c=a[s],l=c.id();i[l]||(i[l]=!0,r.push(c),o=!0)}if(!o)break;n=a}return this.spawn(r,!0).filter(t)}};mK.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},pI(mK,{roots:hK({noIncomingEdges:!0}),leaves:hK({noOutgoingEdges:!0}),outgoers:UW(gK({outgoing:!0}),`outgoers`),successors:_K({outgoing:!0}),incomers:UW(gK({incoming:!0}),`incomers`),predecessors:_K({})}),pI(mK,{neighborhood:UW(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],c=s.source(),l=s.target(),u=i===c?l:c;u.length>0&&t.push(u[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},`neighborhood`),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),mK.neighbourhood=mK.neighborhood,mK.closedNeighbourhood=mK.closedNeighborhood,mK.openNeighbourhood=mK.openNeighborhood,pI(mK,{source:UW(function(e){var t=this[0],n;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},`source`),target:UW(function(e){var t=this[0],n;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},`target`),sources:vK({attr:`source`}),targets:vK({attr:`target`})});function vK(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,!0).filter(t)}}pI(mK,{edgesWith:UW(yK(),`edgesWith`),edgesTo:UW(yK({thisIsSrc:!0}),`edgesTo`)});function yK(e){return function(t){var n=[],r=this._private.cy,i=e||{};PF(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var c=o[s],l=c._private.data,u=this.hasElementWithId(l.source)&&t.hasElementWithId(l.target),d=t.hasElementWithId(l.source)&&this.hasElementWithId(l.target);(u||d)&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!u||i.thisIsTgt&&!d)||n.push(c))}return this.spawn(n,!0)}}pI(mK,{connectedEdges:UW(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];if(i.isNode())for(var a=i._private.edges,o=0;o<a.length;o++){var s=a[o];t.push(s)}}return this.spawn(t,!0).filter(e)},`connectedEdges`),connectedNodes:UW(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];i.isEdge()&&(t.push(i.source()[0]),t.push(i.target()[0]))}return this.spawn(t,!0).filter(e)},`connectedNodes`),parallelEdges:UW(bK(),`parallelEdges`),codirectedEdges:UW(bK({codirected:!0}),`codirectedEdges`)});function bK(e){return e=pI({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,c=s._private.data.id,l=o.data.target,u=s._private.edges,d=0;d<u.length;d++){var f=u[d],p=f._private.data,m=p.target,h=p.source,g=m===l&&h===c,_=c===m&&l===h;(i.codirected&&g||!i.codirected&&(g||_))&&n.push(f)}return this.spawn(n,!0).filter(t)}}pI(mK,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=e==null?t.nodes():e.nodes(),a=[];e!=null&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();var s=function(){var e=n.collection();a.push(e);var r=i[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach(function(n){n.connectedEdges().forEach(function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)})})};do s();while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),mK.componentsOf=mK.components;var xK=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){HL(`A collection must have a reference to the core`);return}var i=new rR,a=!1;if(!t)t=[];else if(t.length>0&&LF(t[0])&&!HF(t[0])){a=!0;for(var o=[],s=new oR,c=0,l=t.length;c<l;c++){var u=t[c];u.data??={};var d=u.data;if(d.id==null)d.id=JL();else if(e.hasElementWithId(d.id)||s.has(d.id))continue;var f=new sR(e,u,!1);o.push(f),s.add(d.id)}t=o}this.length=0;for(var p=0,m=t.length;p<m;p++){var h=t[p][0];if(h!=null){var g=h._private.data.id;(!n||!i.has(g))&&(n&&i.set(g,{index:this.length,ele:h}),this[this.length]=h,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap??this.rebuildMap(),this.lazyMap},set map(e){this.lazyMap=e},rebuildMap:function(){for(var e=this.lazyMap=new rR,t=this.eles,n=0;n<t.length;n++){var r=t[n];e.set(r.id(),{index:n,ele:r})}}},n&&(this._private.map=i),a&&!r&&this.restore()},SK=sR.prototype=xK.prototype=Object.create(Array.prototype);SK.instanceString=function(){return`collection`},SK.spawn=function(e,t){return new xK(this.cy(),e,t)},SK.spawnSelf=function(){return this.spawn(this)},SK.cy=function(){return this._private.cy},SK.renderer=function(){return this._private.cy.renderer()},SK.element=function(){return this[0]},SK.collection=function(){return UF(this)?this:new xK(this._private.cy,[this])},SK.unique=function(){return new xK(this._private.cy,this,!0)},SK.hasElementWithId=function(e){return e=``+e,this._private.map.has(e)},SK.getElementById=function(e){e=``+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new xK(t)},SK.$id=SK.getElementById,SK.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},SK.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},SK.indexOfId=function(e){return e=``+e,this._private.map.get(e).index},SK.json=function(e){var t=this.element(),n=this.cy();if(t==null&&e)return this;if(t!=null){var r=t._private;if(LF(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,c=e.data.target;s!=null&&s!=i.source&&(o.source=``+s,a=!0),c!=null&&c!=i.target&&(o.target=``+c,a=!0),a&&(t=t.move(o))}else{var l=`parent`in e.data,u=e.data.parent;l&&(u!=null||i.parent!=null)&&u!=i.parent&&(u===void 0&&(u=null),u!=null&&(u=``+u),t=t.move({parent:u}))}}e.position&&t.position(e.position);var d=function(n,i,a){var o=e[n];o!=null&&o!==r[n]&&(o?t[i]():t[a]())};return d(`removed`,`remove`,`restore`),d(`selected`,`select`,`unselect`),d(`selectable`,`selectify`,`unselectify`),d(`locked`,`lock`,`unlock`),d(`grabbable`,`grabify`,`ungrabify`),d(`pannable`,`panify`,`unpanify`),e.classes!=null&&t.classes(e.classes),n.endBatch(),this}else if(e===void 0){var f={data:KL(r.data),position:KL(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};f.classes=``;var p=0;return r.classes.forEach(function(e){return f.classes+=p++===0?e:` `+e}),f}}},SK.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},SK.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=new sR(e,this[n].json(),!1);t.push(r)}return new xK(e,t)},SK.copy=SK.clone,SK.restore=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=n.cy(),i=r._private,a=[],o=[],s,c=0,l=n.length;c<l;c++){var u=n[c];t&&!u.removed()||(u.isNode()?a.push(u):o.push(u))}s=a.concat(o);var d,f=function(){s.splice(d,1),d--};for(d=0;d<s.length;d++){var p=s[d],m=p._private,h=m.data;if(p.clearTraversalCache(),!(!t&&!m.removed)){if(h.id===void 0)h.id=JL();else if($(h.id))h.id=``+h.id;else if(qF(h.id)||!PF(h.id)){HL("Can not create element with invalid string ID `"+h.id+"`"),f();continue}else if(r.hasElementWithId(h.id)){HL("Can not create second element with ID `"+h.id+"`"),f();continue}}var g=h.id;if(p.isNode()){var _=m.position;_.x??=0,_.y??=0}if(p.isEdge()){for(var v=p,y=[`source`,`target`],b=y.length,x=!1,S=0;S<b;S++){var C=y[S],w=h[C];$(w)&&(w=h[C]=``+h[C]),w==null||w===``?(HL("Can not create edge `"+g+"` with unspecified "+C),x=!0):r.hasElementWithId(w)||(HL("Can not create edge `"+g+"` with nonexistent "+C+" `"+w+"`"),x=!0)}if(x){f();continue}var T=r.getElementById(h.source),E=r.getElementById(h.target);T.same(E)?T._private.edges.push(v):(T._private.edges.push(v),E._private.edges.push(v)),v._private.source=T,v._private.target=E}m.map=new rR,m.map.set(g,{ele:p,index:0}),m.removed=!1,t&&r.addToPool(p)}for(var D=0;D<a.length;D++){var O=a[D],k=O._private.data;$(k.parent)&&(k.parent=``+k.parent);var A=k.parent;if(A!=null||O._private.parent){var j=O._private.parent?r.collection().merge(O._private.parent):r.getElementById(A);if(j.empty())k.parent=void 0;else if(j[0].removed())WL(`Node added with missing parent, reference to parent removed`),k.parent=void 0,O._private.parent=null;else{for(var M=!1,N=j;!N.empty();){if(O.same(N)){M=!0,k.parent=void 0;break}N=N.parent()}M||(j[0]._private.children.push(O),O._private.parent=j[0],i.hasCompoundNodes=!0)}}}if(s.length>0){for(var P=s.length===n.length?n:new xK(r,s),F=0;F<P.length;F++){var I=P[F];I.isNode()||(I.parallelEdges().clearTraversalCache(),I.source().clearTraversalCache(),I.target().clearTraversalCache())}(i.hasCompoundNodes?r.collection().merge(P).merge(P.connectedNodes()).merge(P.parent()):P).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?P.emitAndNotify(`add`):t&&P.emit(`add`)}return n},SK.removed=function(){var e=this[0];return e&&e._private.removed},SK.inside=function(){var e=this[0];return e&&!e._private.removed},SK.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n<t.length;n++)c(t[n])}function s(e){for(var t=e._private.children,n=0;n<t.length;n++)c(t[n])}function c(e){var n=i[e.id()];t&&e.removed()||n||(i[e.id()]=!0,e.isNode()?(r.push(e),o(e),s(e)):r.unshift(e))}for(var l=0,u=n.length;l<u;l++){var d=n[l];c(d)}function f(e,t){var n=e._private.edges;QL(n,t),e.clearTraversalCache()}function p(e){e.clearTraversalCache()}var m=[];m.ids={};function h(e,t){t=t[0],e=e[0];var n=e._private.children,r=e.id();QL(n,t),t._private.parent=null,m.ids[r]||(m.ids[r]=!0,m.push(e))}n.dirtyCompoundBoundsCache(),t&&a.removeFromPool(r);for(var g=0;g<r.length;g++){var _=r[g];if(_.isEdge()){var v=_.source()[0],y=_.target()[0];f(v,_),f(y,_);for(var b=_.parallelEdges(),x=0;x<b.length;x++){var S=b[x];p(S),S.isBundledBezier()&&S.dirtyBoundingBoxCache()}}else{var C=_.parent();C.length!==0&&h(C,_)}t&&(_._private.removed=!0)}var w=a._private.elements;a._private.hasCompoundNodes=!1;for(var T=0;T<w.length;T++)if(w[T].isParent()){a._private.hasCompoundNodes=!0;break}var E=new xK(this.cy(),r);E.size()>0&&(e?E.emitAndNotify(`remove`):t&&E.emit(`remove`));for(var D=0;D<m.length;D++){var O=m[D];(!t||!O.removed())&&O.updateStyle()}return E},SK.move=function(e){var t=this._private.cy,n=this,r=!1,i=!1,a=function(e){return e==null?e:``+e};if(e.source!==void 0||e.target!==void 0){var o=a(e.source),s=a(e.target),c=o!=null&&t.hasElementWithId(o),l=s!=null&&t.hasElementWithId(s);(c||l)&&(t.batch(function(){n.remove(r,i),n.emitAndNotify(`moveout`);for(var e=0;e<n.length;e++){var t=n[e],a=t._private.data;t.isEdge()&&(c&&(a.source=o),l&&(a.target=s))}n.restore(r,i)}),n.emitAndNotify(`move`))}else if(e.parent!==void 0){var u=a(e.parent);if(u===null||t.hasElementWithId(u)){var d=u===null?void 0:u;t.batch(function(){var e=n.remove(r,i);e.emitAndNotify(`moveout`);for(var t=0;t<n.length;t++){var a=n[t],o=a._private.data;a.isNode()&&(o.parent=d)}e.restore(r,i)}),n.emitAndNotify(`move`)}}return this},[oV,_W,vW,HW,WW,ZW,QW,PG,XG,ZG,$G,tK,rK,sK,dK,mK].forEach(function(e){pI(SK,e)});var CK={add:function(e){var t,n=this;if(VF(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var i=[],a=0;a<r.length;a++){var o=r[a];i.push(o.json())}t=new xK(n,i)}}else if(IF(e))t=new xK(n,e);else if(LF(e)&&(IF(e.nodes)||IF(e.edges))){for(var s=e,c=[],l=[`nodes`,`edges`],u=0,d=l.length;u<d;u++){var f=l[u],p=s[f];if(IF(p))for(var m=0,h=p.length;m<h;m++){var g=pI({group:f},p[m]);c.push(g)}}t=new xK(n,c)}else t=new sR(n,e).collection();return t},remove:function(e){if(!VF(e)&&PF(e)){var t=e;e=this.$(t)}return e.remove()}};function wK(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,c=11,l=1/(c-1),u=typeof Float32Array<`u`;if(arguments.length!==4)return!1;for(var d=0;d<4;++d)if(typeof arguments[d]!=`number`||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var f=u?new Float32Array(c):Array(c);function p(e,t){return 1-3*t+3*e}function m(e,t){return 3*t-6*e}function h(e){return 3*e}function g(e,t,n){return((p(t,n)*e+m(t,n))*e+h(t))*e}function _(e,t,n){return 3*p(t,n)*e*e+2*m(t,n)*e+h(t)}function v(t,r){for(var a=0;a<i;++a){var o=_(r,e,n);if(o===0)return r;var s=g(r,e,n)-t;r-=s/o}return r}function y(){for(var t=0;t<c;++t)f[t]=g(t*l,e,n)}function b(t,r,i){var a,c,l=0;do c=r+(i-r)/2,a=g(c,e,n)-t,a>0?i=c:r=c;while(Math.abs(a)>o&&++l<s);return c}function x(t){for(var r=0,i=1,o=c-1;i!==o&&f[i]<=t;++i)r+=l;--i;var s=(t-f[i])/(f[i+1]-f[i]),u=r+s*l,d=_(u,e,n);return d>=a?v(t,u):d===0?u:b(t,r,r+l)}var S=!1;function C(){S=!0,(e!==t||n!==r)&&y()}var w=function(i){return S||C(),e===t&&n===r?i:i===0?0:i===1?1:g(x(i),t,r)};w.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var T=`generateBezier(`+[e,t,n,r]+`)`;return w.toString=function(){return T},w}var TK=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,r*.5,i),o=t(n,r*.5,a),s=t(n,r,o),c=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),l=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x+=c*r,n.v+=l*r,n}return function e(t,r,i){var a={x:-1,v:0,tension:null,friction:null},o=[0],s=0,c=1/1e4,l=16/1e3,u,d,f;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i||=null,a.tension=t,a.friction=r,u=i!==null,u?(s=e(t,r),d=s/i*l):d=l;f=n(f||a,d),o.push(1+f.x),s+=16,Math.abs(f.x)>c&&Math.abs(f.v)>c;);return u?function(e){return o[e*(o.length-1)|0]}:s}}(),EK=function(e,t,n,r){var i=wK(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},DK={linear:function(e,t,n){return e+(t-e)*n},ease:EK(.25,.1,.25,1),"ease-in":EK(.42,0,1,1),"ease-out":EK(0,0,.58,1),"ease-in-out":EK(.42,0,.58,1),"ease-in-sine":EK(.47,0,.745,.715),"ease-out-sine":EK(.39,.575,.565,1),"ease-in-out-sine":EK(.445,.05,.55,.95),"ease-in-quad":EK(.55,.085,.68,.53),"ease-out-quad":EK(.25,.46,.45,.94),"ease-in-out-quad":EK(.455,.03,.515,.955),"ease-in-cubic":EK(.55,.055,.675,.19),"ease-out-cubic":EK(.215,.61,.355,1),"ease-in-out-cubic":EK(.645,.045,.355,1),"ease-in-quart":EK(.895,.03,.685,.22),"ease-out-quart":EK(.165,.84,.44,1),"ease-in-out-quart":EK(.77,0,.175,1),"ease-in-quint":EK(.755,.05,.855,.06),"ease-out-quint":EK(.23,1,.32,1),"ease-in-out-quint":EK(.86,0,.07,1),"ease-in-expo":EK(.95,.05,.795,.035),"ease-out-expo":EK(.19,1,.22,1),"ease-in-out-expo":EK(1,0,0,1),"ease-in-circ":EK(.6,.04,.98,.335),"ease-out-circ":EK(.075,.82,.165,1),"ease-in-out-circ":EK(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return DK.linear;var r=TK(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":EK};function OK(e,t,n,r,i){if(r===1||t===n)return n;var a=i(t,n,r);return e==null?a:((e.roundValue||e.color)&&(a=Math.round(a)),e.min!==void 0&&(a=Math.max(a,e.min)),e.max!==void 0&&(a=Math.min(a,e.max)),a)}function kK(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!==`%`)?e.pfValue:e.value:e}function AK(e,t,n,r,i){var a=i==null?null:i.type;n<0?n=0:n>1&&(n=1);var o=kK(e,i),s=kK(t,i);if($(o)&&$(s))return OK(a,o,s,n,r);if(IF(o)&&IF(s)){for(var c=[],l=0;l<s.length;l++){var u=o[l],d=s[l];if(u!=null&&d!=null){var f=OK(a,u,d,n,r);c.push(f)}else c.push(d)}return c}}function jK(e,t,n,r){var i=!r,a=e._private,o=t._private,s=o.easing,c=o.startTime,l=(r?e:e.cy()).style();if(!o.easingImpl)if(s==null)o.easingImpl=DK.linear;else{var u=PF(s)?l.parse(`transition-timing-function`,s).value:s,d,f;PF(u)?(d=u,f=[]):(d=u[1],f=u.slice(2).map(function(e){return+e})),f.length>0?(d===`spring`&&f.push(o.duration),o.easingImpl=DK[d].apply(null,f)):o.easingImpl=DK[d]}var p=o.easingImpl,m=o.duration===0?1:(n-c)/o.duration;if(o.applying&&(m=o.progress),m<0?m=0:m>1&&(m=1),o.delay==null){var h=o.startPosition,g=o.position;if(g&&i&&!e.locked()){var _={};MK(h.x,g.x)&&(_.x=AK(h.x,g.x,m,p)),MK(h.y,g.y)&&(_.y=AK(h.y,g.y,m,p)),e.position(_)}var v=o.startPan,y=o.pan,b=a.pan,x=y!=null&&r;x&&(MK(v.x,y.x)&&(b.x=AK(v.x,y.x,m,p)),MK(v.y,y.y)&&(b.y=AK(v.y,y.y,m,p)),e.emit(`pan`));var S=o.startZoom,C=o.zoom,w=C!=null&&r;w&&(MK(S,C)&&(a.zoom=YR(a.minZoom,AK(S,C,m,p),a.maxZoom)),e.emit(`zoom`)),(x||w)&&e.emit(`viewport`);var T=o.style;if(T&&T.length>0&&i){for(var E=0;E<T.length;E++){var D=T[E],O=D.name,k=D,A=o.startStyle[O],j=l.properties[A.name],M=AK(A,k,m,p,j);l.overrideBypass(e,O,M)}e.emit(`style`)}}return o.progress=m,m}function MK(e,t){return e==null||t==null?!1:$(e)&&$(t)?!0:!!(e&&t)}function NK(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function PK(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(a.length===0){var c=o.shift();c&&a.push(c)}for(var l=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t];n()}e.splice(0,e.length)},u=a.length-1;u>=0;u--){var d=a[u],f=d._private;if(f.stopped){a.splice(u,1),f.hooked=!1,f.playing=!1,f.started=!1,l(f.frames);continue}!f.playing&&!f.applying||(f.playing&&f.applying&&(f.applying=!1),f.started||NK(t,d,e),jK(t,d,e,n),f.applying&&=!1,l(f.frames),f.step!=null&&f.step(e),d.completed()&&(a.splice(u,1),f.hooked=!1,f.playing=!1,f.started=!1,l(f.completes)),s=!0)}return!n&&a.length===0&&o.length===0&&r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=n[o],c=i(s);a||=c}var l=i(t,!0);(a||l)&&(n.length>0?t.notify(`draw`,n):t.notify(`draw`)),n.unmerge(r),t.emit(`step`)}var FK={animate:gW.animate(),animation:gW.animation(),animated:gW.animated(),clearQueue:gW.clearQueue(),delay:gW.delay(),delayAnimation:gW.delayAnimation(),stop:gW.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&gL(function(n){PK(n,e),t()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(t,n){PK(n,e)},n.beforeRenderPriorities.animations):t()}},IK={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null?!0:e!==n.target&&HF(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier==null?e:n.target}},LK=function(e){return PF(e)?new BW(e):e},RK={createEmitter:function(){var e=this._private;return e.emitter||=new UG(IK,this),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,LK(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,LK(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,LK(t),n),this},once:function(e,t,n){return this.emitter().one(e,LK(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};gW.eventAliasesOn(RK);var zK={png:function(e){var t=this._private.renderer;return e||={},t.png(e)},jpg:function(e){var t=this._private.renderer;return e||={},e.bg=e.bg||`#fff`,t.jpg(e)}};zK.jpeg=zK.jpg;var BK={layout:function(e){var t=this;if(e==null){HL(`Layout options must be specified to make a layout`);return}if(e.name==null){HL("A `name` must be specified to make a layout");return}var n=e.name,r=t.extension(`layout`,n);if(r==null){HL("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}return new r(pI({},e,{cy:t,eles:PF(e.eles)?t.$(e.eles):e.eles==null?t.$():e.eles}))}};BK.createLayout=BK.makeLayout=BK.layout;var VK={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&r.merge(t);return}if(n.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount??=0,e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a=e[i];t.getElementById(i).data(a)}})}},HK=ZL({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),UK={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify(`draw`),this},resize:function(){return this.invalidateSize(),this.emitAndNotify(`resize`),this},initRenderer:function(e){var t=this,n=t.extension(`renderer`,e.name);if(n==null){HL(`Can not initialise: No such renderer \`${e.name}\` found. Did you forget to import it and \`cytoscape.use()\` it?`);return}e.wheelSensitivity!==void 0&&WL(`You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.`);var r=HK(e);r.cy=t,t._private.renderer=new n(r),this.notify(`init`)},destroyRenderer:function(){var e=this;e.notify(`destroy`);var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on(`render`,e)},offRender:function(e){return this.off(`render`,e)}};UK.invalidateDimensions=UK.resize;var WK={collection:function(e,t){return PF(e)?this.$(e):VF(e)?e.collection():IF(e)?(t||={},new xK(this,e,t.unique,t.removed)):new xK(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};WK.elements=WK.filter=WK.$;var GK={},KK=`t`,qK=`f`;GK.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r<e.length;r++){var i=e[r],a=t.getContextMeta(i);if(!a.empty){var o=t.getContextStyle(a),s=t.applyContextStyle(a,o,i);i._private.appliedInitStyle?t.updateTransitions(i,s.diffProps):i._private.appliedInitStyle=!0,t.updateStyleHints(i)&&n.push(i)}}return n},GK.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},i=e+`-`+t,a=r[i];if(a)return a;for(var o=[],s={},c=0;c<n.length;c++){var l=n[c],u=e[c]===KK,d=t[c]===KK,f=u!==d,p=l.mappedProperties.length>0;if(f||d&&p){var m=void 0;f&&p||f?m=l.properties:p&&(m=l.mappedProperties);for(var h=0;h<m.length;h++){for(var g=m[h],_=g.name,v=!1,y=c+1;y<n.length;y++){var b=n[y];if(t[y]===KK&&(v=b.properties[g.name]!=null,v))break}!s[_]&&!v&&(s[_]=!0,o.push(_))}}}return r[i]=o,o},GK.getContextMeta=function(e){for(var t=this,n=``,r,i=e._private.styleCxtKey||``,a=0;a<t.length;a++){var o=t[a];o.selector&&o.selector.matches(e)?n+=KK:n+=qK}return r=t.getPropertiesDiff(i,n),e._private.styleCxtKey=n,{key:n,diffPropNames:r,empty:r.length===0}},GK.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var i={_private:{key:t}},a=0;a<n.length;a++){var o=n[a];if(t[a]===KK)for(var s=0;s<o.properties.length;s++){var c=o.properties[s];i[c.name]=c}}return r[t]=i,i},GK.applyContextStyle=function(e,t,n){for(var r=this,i=e.diffPropNames,a={},o=r.types,s=0;s<i.length;s++){var c=i[s],l=t[c],u=n.pstyle(c);if(!l)if(u)l=u.bypass?{name:c,deleteBypassed:!0}:{name:c,delete:!0};else continue;if(u!==l){if(l.mapped===o.fn&&u!=null&&u.mapping!=null&&u.mapping.value===l.value){var d=u.mapping;if((d.fnValue=l.value(n))===d.prevFnValue)continue}var f=a[c]={prev:u};r.applyParsedProperty(n,l),f.next=n.pstyle(c),f.next&&f.next.bypass&&(f.next=f.next.bypassed)}}return{diffProps:a}},GK.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s=t.group===`nodes`,c=e._private.style;r=Object.keys(c);for(var l=0;l<i.length;l++){var u=i[l];t.styleKeys[u]=[vL,bL]}for(var d=function(e,n){return t.styleKeys[n][0]=SL(e,t.styleKeys[n][0])},f=function(e,n){return t.styleKeys[n][1]=CL(e,t.styleKeys[n][1])},p=function(e,t){d(e,t),f(e,t)},m=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);d(r,t),f(r,t)}},h=2e9,g=function(e){return-128<e&&e<128&&Math.floor(e)!==e?h-(e*1024|0):e},_=0;_<r.length;_++){var v=r[_],y=c[v];if(y!=null){var b=this.properties[v],x=b.type,S=b.groupKey,C=void 0;b.hashOverride==null?y.pfValue!=null&&(C=y.pfValue):C=b.hashOverride(e,y);var w=b.enums==null?y.value:null,T=C!=null,E=T||w!=null,D=y.units;x.number&&E&&!x.multiple?(p(g(T?C:w),S),!T&&D!=null&&m(D,S)):m(y.strValue,S)}}for(var O=[vL,bL],k=0;k<i.length;k++){var A=i[k],j=t.styleKeys[A];O[0]=SL(j[0],O[0]),O[1]=CL(j[1],O[1])}t.styleKey=wL(O[0],O[1]);var M=t.styleKeys;t.labelDimsKey=TL(M.labelDimensions);var N=a(e,[`label`],M.labelDimensions);if(t.labelKey=TL(N),t.labelStyleKey=TL(EL(M.commonLabel,N)),!s){var P=a(e,[`source-label`],M.labelDimensions);t.sourceLabelKey=TL(P),t.sourceLabelStyleKey=TL(EL(M.commonLabel,P));var F=a(e,[`target-label`],M.labelDimensions);t.targetLabelKey=TL(F),t.targetLabelStyleKey=TL(EL(M.commonLabel,F))}if(s){var I=t.styleKeys,L=I.nodeBody,R=I.nodeBorder,ee=I.nodeOutline,z=I.backgroundImage,B=I.compound,V=I.pie,H=I.stripe;t.nodeKey=TL([L,R,ee,z,B,V,H].filter(function(e){return e!=null}).reduce(EL,[vL,bL])),t.hasPie=V!=null&&V[0]!==vL&&V[1]!==bL,t.hasStripe=H!=null&&H[0]!==vL&&H[1]!==bL}return o!==t.styleKey},GK.clearStyleHints=function(e){var t=e._private;t.styleCxtKey=``,t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null,t.hasStripe=null},GK.applyParsedProperty=function(e,t){var n=this,r=t,i=e._private.style,a,o=n.types,s=n.properties[r.name].type,c=r.bypass,l=i[r.name],u=l&&l.bypass,d=e._private,f=`mapping`,p=function(e){return e==null?null:e.pfValue==null?e.value:e.pfValue},m=function(){var t=p(l),i=p(r);n.checkTriggers(e,r.name,t,i)};if(t.name===`curve-style`&&e.isEdge()&&(t.value!==`bezier`&&e.isLoop()||t.value===`haystack`&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,`bezier`,c)),r.delete)return i[r.name]=void 0,m(),!0;if(r.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,m(),!0):!1:(m(),!0);if(r.deleteBypass)return l?l.bypass?(i[r.name]=l.bypassed,m(),!0):!1:(m(),!0);var h=function(){WL("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case o.mapData:for(var g=r.field.split(`.`),_=d.data,v=0;v<g.length&&_;v++){var y=g[v];_=_[y]}if(_==null)return h(),!1;var b;if($(_)){var x=r.fieldMax-r.fieldMin;b=x===0?0:(_-r.fieldMin)/x}else return WL("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+`: `+_+"` for `"+e.id()+"` is non-numeric)"),!1;if(b<0?b=0:b>1&&(b=1),s.color){var S=r.valueMin[0],C=r.valueMax[0],w=r.valueMin[1],T=r.valueMax[1],E=r.valueMin[2],D=r.valueMax[2],O=r.valueMin[3]==null?1:r.valueMin[3],k=r.valueMax[3]==null?1:r.valueMax[3],A=[Math.round(S+(C-S)*b),Math.round(w+(T-w)*b),Math.round(E+(D-E)*b),Math.round(O+(k-O)*b)];a={bypass:r.bypass,name:r.name,value:A,strValue:`rgb(`+A[0]+`, `+A[1]+`, `+A[2]+`)`}}else if(s.number){var j=r.valueMin+(r.valueMax-r.valueMin)*b;a=this.parse(r.name,j,r.bypass,f)}else return!1;if(!a)return h(),!1;a.mapping=r,r=a;break;case o.data:for(var M=r.field.split(`.`),N=d.data,P=0;P<M.length&&N;P++){var F=M[P];N=N[F]}if(N!=null&&(a=this.parse(r.name,N,r.bypass,f)),!a)return h(),!1;a.mapping=r,r=a;break;case o.fn:var I=r.value,L=r.fnValue==null?I(e):r.fnValue;if(r.prevFnValue=L,L==null)return WL("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(a=this.parse(r.name,L,r.bypass,f),!a)return WL("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;a.mapping=KL(r),r=a;break;case void 0:break;default:return!1}return c?(u?r.bypassed=l.bypassed:r.bypassed=l,i[r.name]=r):u?l.bypassed=r:i[r.name]=r,m(),!0},GK.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!t)r._private.style={};else for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],c=i[s];c!=null&&(c.bypass?c.bypassed=null:i[s]=null)}}},GK.update=function(){this._private.cy.mutableElements().updateStyle()},GK.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle(`transition-property`).value,a=e.pstyle(`transition-duration`).pfValue,o=e.pstyle(`transition-delay`).pfValue;if(i.length>0&&a>0){for(var s={},c=!1,l=0;l<i.length;l++){var u=i[l],d=e.pstyle(u),f=t[u];if(f){var p=f.prev,m=f.next==null?d:f.next,h=!1,g=void 0,_=1e-6;p&&($(p.pfValue)&&$(m.pfValue)?(h=m.pfValue-p.pfValue,g=p.pfValue+_*h):$(p.value)&&$(m.value)?(h=m.value-p.value,g=p.value+_*h):IF(p.value)&&IF(m.value)&&(h=p.value[0]!==m.value[0]||p.value[1]!==m.value[1]||p.value[2]!==m.value[2],g=p.strValue),h&&(s[u]=m.strValue,this.applyBypass(e,u,g),c=!0))}}if(!c)return;r.transitioning=!0,new gV(function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle(`transition-timing-function`).value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify(`style`),r.transitioning=!1})}else r.transitioning&&=(this.removeBypasses(e,i),e.emitAndNotify(`style`),!1)},GK.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);e.removed()||s!=null&&s(n,r,e)&&a(o)},GK.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){i._private.cy.notify(`zorder`,e)})},GK.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},GK.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},GK.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},GK.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var JK={};JK.applyBypass=function(e,t,n,r){var i=this,a=[],o=!0;if(t===`*`||t===`**`){if(n!==void 0)for(var s=0;s<i.properties.length;s++){var c=i.properties[s].name,l=this.parse(c,n,!0);l&&a.push(l)}}else if(PF(t)){var u=this.parse(t,n,!0);u&&a.push(u)}else if(LF(t)){var d=t;r=n;for(var f=Object.keys(d),p=0;p<f.length;p++){var m=f[p],h=d[m];if(h===void 0&&(h=d[eI(m)]),h!==void 0){var g=this.parse(m,h,!0);g&&a.push(g)}}}else return!1;if(a.length===0)return!1;for(var _=!1,v=0;v<e.length;v++){for(var y=e[v],b={},x=void 0,S=0;S<a.length;S++){var C=a[S];if(r){var w=y.pstyle(C.name);x=b[C.name]={prev:w}}_=this.applyParsedProperty(y,KL(C))||_,r&&(x.next=y.pstyle(C.name))}_&&this.updateStyleHints(y),r&&this.updateTransitions(y,b,o)}return _},JK.overrideBypass=function(e,t,n){t=$F(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,c=o.mutiple,l=a?a.pfValue==null?a.value:a.pfValue:null;!a||!a.bypass?this.applyBypass(i,t,n):(a.value=n,a.pfValue!=null&&(a.pfValue=n),s?a.strValue=`rgb(`+n.join(`,`)+`)`:c?a.strValue=n.join(` `):a.strValue=``+n,this.updateStyleHints(i)),this.checkTriggers(i,t,l,n)}},JK.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},JK.removeBypasses=function(e,t,n){for(var r=!0,i=0;i<e.length;i++){for(var a=e[i],o={},s=0;s<t.length;s++){var c=t[s],l=this.properties[c],u=a.pstyle(l.name);if(!(!u||!u.bypass)){var d=this.parse(c,``,!0),f=o[l.name]={prev:u};this.applyParsedProperty(a,d),f.next=a.pstyle(l.name)}}this.updateStyleHints(a),n&&this.updateTransitions(a,o,r)}};var YK={};YK.getEmSizeInPixels=function(){var e=this.containerCss(`font-size`);return e==null?1:parseFloat(e)},YK.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var XK={};XK.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},XK.getRawStyle=function(e,t){var n=this;if(e=e[0],e){for(var r={},i=0;i<n.properties.length;i++){var a=n.properties[i],o=n.getStylePropertyValue(e,a.name,t);o!=null&&(r[a.name]=o,r[eI(a.name)]=o)}return r}},XK.getIndexedStyle=function(e,t,n,r){return e.pstyle(t)[n][r]??e.cy().style().getDefaultProperty(t)[n][0]},XK.getStylePropertyValue=function(e,t,n){var r=this;if(e=e[0],e){var i=r.properties[t];i.alias&&(i=i.pointsTo);var a=i.type,o=e.pstyle(i.name);if(o){var s=o.value,c=o.units,l=o.strValue;if(n&&a.number&&s!=null&&$(s)){var u=e.cy().zoom(),d=function(e){return e*u},f=function(e,t){return d(e)+t},p=IF(s);return(p?c.every(function(e){return e!=null}):c!=null)?p?s.map(function(e,t){return f(e,c[t])}).join(` `):f(s,c):p?s.map(function(e){return PF(e)?e:``+d(e)}).join(` `):``+d(s)}else if(l!=null)return l}return null}},XK.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r].name,a=e.pstyle(i);a!==void 0&&(a=LF(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(n[i]=a)}return n},XK.getPropsList=function(e){var t=this,n=[],r=e,i=t.properties;if(r)for(var a=Object.keys(r),o=0;o<a.length;o++){var s=a[o],c=r[s],l=i[s]||i[$F(s)],u=this.parse(l.name,c);u&&n.push(u)}return n},XK.getNonDefaultPropertiesHash=function(e,t,n){var r=n.slice(),i,a,o,s,c,l;for(c=0;c<t.length;c++)if(i=t[c],a=e.pstyle(i,!1),a!=null)if(a.pfValue!=null)r[0]=SL(s,r[0]),r[1]=CL(s,r[1]);else for(o=a.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),r[0]=SL(s,r[0]),r[1]=CL(s,r[1]);return r},XK.getPropertiesHash=XK.getNonDefaultPropertiesHash;var ZK={};ZK.appendFromJson=function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],i=r.selector,a=r.style||r.css,o=Object.keys(a);t.selector(i);for(var s=0;s<o.length;s++){var c=o[s],l=a[c];t.css(c,l)}}return t},ZK.fromJson=function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},ZK.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():`core`,style:a})}return e};var QK={};QK.appendFromString=function(e){var t=this,n=this,r=``+e,i,a,o;r=r.replace(/[/][*](\s|.)+?[*][/]/g,``);function s(){r=r.length>i.length?r.substr(i.length):``}function c(){a=a.length>o.length?a.substr(o.length):``}for(;!r.match(/^\s*$/);){var l=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){WL(`Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: `+r);break}i=l[0];var u=l[1];if(u!==`core`&&new BW(u).invalid){WL(`Skipping parsing of block: Invalid selector found in string stylesheet: `+u),s();continue}var d=l[2],f=!1;a=d;for(var p=[];!a.match(/^\s*$/);){var m=a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!m){WL(`Skipping parsing of block: Invalid formatting of style property and value definitions found in:`+d),f=!0;break}o=m[0];var h=m[1],g=m[2];if(!t.properties[h]){WL(`Skipping property: Invalid property name in: `+o),c();continue}if(!n.parse(h,g)){WL(`Skipping property: Invalid property definition in: `+o),c();continue}p.push({name:h,val:g}),c()}if(f){s();break}n.selector(u);for(var _=0;_<p.length;_++){var v=p[_];n.css(v.name,v.val)}s()}return n},QK.fromString=function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t};var $K={};(function(){var e=iI,t=oI,n=cI,r=lI,i=uI,a=function(e){return`^`+e+`\\s*\\(\\s*([\\w\\.]+)\\s*\\)$`},o=function(a){var o=e+`|\\w+|`+t+`|`+n+`|`+r+`|`+i;return`^`+a+`\\s*\\(([\\w\\.]+)\\s*\\,\\s*(`+e+`)\\s*\\,\\s*(`+e+`)\\s*,\\s*(`+o+`)\\s*\\,\\s*(`+o+`)\\)$`},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,`^(none)$`,`^(.+)$`];$K.types={time:{number:!0,min:0,units:`s|ms`,implicitUnits:`ms`},percent:{number:!0,min:0,max:100,units:`%`,implicitUnits:`%`},percentages:{number:!0,min:0,max:100,units:`%`,implicitUnits:`%`,multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:[`parent`,`origin`]},nodeSize:{number:!0,min:0,enums:[`label`]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:[`horizontal`,`leftward`,`rightward`,`vertical`,`upward`,`downward`,`auto`]},axisDirectionExplicit:{enums:[`leftward`,`rightward`,`upward`,`downward`]},axisDirectionPrimary:{enums:[`horizontal`,`vertical`]},paddingRelativeTo:{enums:[`width`,`height`,`average`,`min`,`max`]},bgWH:{number:!0,min:0,allowPercent:!0,enums:[`auto`],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:[`inner`,`include-padding`],multiple:!0},bgRepeat:{enums:[`repeat`,`repeat-x`,`repeat-y`,`no-repeat`],multiple:!0},bgFit:{enums:[`none`,`contain`,`cover`],multiple:!0},bgCrossOrigin:{enums:[`anonymous`,`use-credentials`,`null`],multiple:!0},bgClip:{enums:[`none`,`node`],multiple:!0},bgContainment:{enums:[`inside`,`over`],multiple:!0},boxSelection:{enums:[`contain`,`overlap`,`none`]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:[`solid`,`linear-gradient`,`radial-gradient`]},bool:{enums:[`yes`,`no`]},bools:{enums:[`yes`,`no`],multiple:!0},lineStyle:{enums:[`solid`,`dotted`,`dashed`]},lineCap:{enums:[`butt`,`round`,`square`]},linePosition:{enums:[`center`,`inside`,`outside`]},lineJoin:{enums:[`round`,`bevel`,`miter`]},borderStyle:{enums:[`solid`,`dotted`,`dashed`,`double`]},curveStyle:{enums:[`bezier`,`unbundled-bezier`,`haystack`,`segments`,`straight`,`straight-triangle`,`taxi`,`round-segments`,`round-taxi`]},radiusType:{enums:[`arc-radius`,`influence-radius`],multiple:!0},fontFamily:{regex:`^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$`},fontStyle:{enums:[`italic`,`normal`,`oblique`]},fontWeight:{enums:[`normal`,`bold`,`bolder`,`lighter`,`100`,`200`,`300`,`400`,`500`,`600`,`800`,`900`,100,200,300,400,500,600,700,800,900]},textDecoration:{enums:[`none`,`underline`,`overline`,`line-through`]},textTransform:{enums:[`none`,`uppercase`,`lowercase`]},textWrap:{enums:[`none`,`wrap`,`ellipsis`]},textOverflowWrap:{enums:[`whitespace`,`anywhere`]},textBackgroundShape:{enums:[`rectangle`,`roundrectangle`,`round-rectangle`,`circle`]},nodeShape:{enums:`rectangle.roundrectangle.round-rectangle.cutrectangle.cut-rectangle.bottomroundrectangle.bottom-round-rectangle.barrel.ellipse.triangle.round-triangle.square.pentagon.round-pentagon.hexagon.round-hexagon.concavehexagon.concave-hexagon.heptagon.round-heptagon.octagon.round-octagon.tag.round-tag.star.diamond.round-diamond.vee.rhomboid.right-rhomboid.polygon`.split(`.`)},overlayShape:{enums:[`roundrectangle`,`round-rectangle`,`ellipse`]},cornerRadius:{number:!0,min:0,units:`px|em`,implicitUnits:`px`,enums:[`auto`]},compoundIncludeLabels:{enums:[`include`,`exclude`]},arrowShape:{enums:[`tee`,`triangle`,`triangle-tee`,`circle-triangle`,`triangle-cross`,`triangle-backcurve`,`vee`,`square`,`circle`,`diamond`,`chevron`,`none`]},arrowFill:{enums:[`filled`,`hollow`]},arrowWidth:{number:!0,units:`%|px|em`,implicitUnits:`px`,enums:[`match-line`]},display:{enums:[`element`,`none`]},visibility:{enums:[`hidden`,`visible`]},zCompoundDepth:{enums:[`bottom`,`orphan`,`auto`,`top`]},zIndexCompare:{enums:[`auto`,`manual`]},valign:{enums:[`top`,`center`,`bottom`]},halign:{enums:[`left`,`center`,`right`]},justification:{enums:[`left`,`center`,`right`,`auto`]},text:{string:!0},data:{mapping:!0,regex:a(`data`)},layoutData:{mapping:!0,regex:a(`layoutData`)},scratch:{mapping:!0,regex:a(`scratch`)},mapData:{mapping:!0,regex:o(`mapData`)},mapLayoutData:{mapping:!0,regex:o(`mapLayoutData`)},mapScratch:{mapping:!0,regex:o(`mapScratch`)},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:`deg|rad`,implicitUnits:`rad`},textRotation:{number:!0,units:`deg|rad`,implicitUnits:`rad`,enums:[`none`,`autorotate`]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:[`intersection`,`node-position`,`endpoints`]},edgeEndpoint:{number:!0,multiple:!0,units:`%|px|em|deg|rad`,implicitUnits:`px`,enums:[`inside-to-node`,`outside-to-node`,`outside-to-node-or-label`,`outside-to-line`,`outside-to-line-or-label`],singleEnum:!0,validate:function(e,t){switch(e.length){case 2:return t[0]!==`deg`&&t[0]!==`rad`&&t[1]!==`deg`&&t[1]!==`rad`;case 1:return PF(e[0])||t[0]===`deg`||t[0]===`rad`;default:return!1}}},easing:{regexes:[`^(spring)\\s*\\(\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*\\)$`,`^(cubic-bezier)\\s*\\(\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*\\)$`],enums:`linear.ease.ease-in.ease-out.ease-in-out.ease-in-sine.ease-out-sine.ease-in-out-sine.ease-in-quad.ease-out-quad.ease-in-out-quad.ease-in-cubic.ease-out-cubic.ease-in-out-cubic.ease-in-quart.ease-out-quart.ease-in-out-quart.ease-in-quint.ease-out-quint.ease-in-out-quint.ease-in-expo.ease-out-expo.ease-in-out-expo.ease-in-circ.ease-out-circ.ease-in-out-circ`.split(`.`)},gradientDirection:{enums:[`to-bottom`,`to-top`,`to-left`,`to-right`,`to-bottom-right`,`to-bottom-left`,`to-top-right`,`to-top-left`,`to-right-bottom`,`to-left-bottom`,`to-right-top`,`to-left-top`]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(e){var t=e.length;return t===1||t===2||t===4}}};var c={zeroNonZero:function(e,t){return(e==null||t==null)&&e!==t||e==0&&t!=0?!0:e!=0&&t==0},any:function(e,t){return e!=t},emptyNonEmpty:function(e,t){var n=qF(e),r=qF(t);return n&&!r||!n&&r}},l=$K.types,u=[{name:`label`,type:l.text,triggersBounds:c.any,triggersZOrder:c.emptyNonEmpty},{name:`text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any}],d=[{name:`source-label`,type:l.text,triggersBounds:c.any},{name:`source-text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`source-text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`source-text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`source-text-offset`,type:l.size,triggersBounds:c.any}],f=[{name:`target-label`,type:l.text,triggersBounds:c.any},{name:`target-text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`target-text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`target-text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`target-text-offset`,type:l.size,triggersBounds:c.any}],p=[{name:`font-family`,type:l.fontFamily,triggersBounds:c.any},{name:`font-style`,type:l.fontStyle,triggersBounds:c.any},{name:`font-weight`,type:l.fontWeight,triggersBounds:c.any},{name:`font-size`,type:l.size,triggersBounds:c.any},{name:`text-transform`,type:l.textTransform,triggersBounds:c.any},{name:`text-wrap`,type:l.textWrap,triggersBounds:c.any},{name:`text-overflow-wrap`,type:l.textOverflowWrap,triggersBounds:c.any},{name:`text-max-width`,type:l.size,triggersBounds:c.any},{name:`text-outline-width`,type:l.size,triggersBounds:c.any},{name:`line-height`,type:l.positiveNumber,triggersBounds:c.any}],m=[{name:`text-valign`,type:l.valign,triggersBounds:c.any},{name:`text-halign`,type:l.halign,triggersBounds:c.any},{name:`color`,type:l.color},{name:`text-outline-color`,type:l.color},{name:`text-outline-opacity`,type:l.zeroOneNumber},{name:`text-background-color`,type:l.color},{name:`text-background-opacity`,type:l.zeroOneNumber},{name:`text-background-padding`,type:l.size,triggersBounds:c.any},{name:`text-border-opacity`,type:l.zeroOneNumber},{name:`text-border-color`,type:l.color},{name:`text-border-width`,type:l.size,triggersBounds:c.any},{name:`text-border-style`,type:l.borderStyle,triggersBounds:c.any},{name:`text-background-shape`,type:l.textBackgroundShape,triggersBounds:c.any},{name:`text-justification`,type:l.justification},{name:`box-select-labels`,type:l.bool,triggersBounds:c.any}],h=[{name:`events`,type:l.bool,triggersZOrder:c.any},{name:`text-events`,type:l.bool,triggersZOrder:c.any},{name:`box-selection`,type:l.boxSelection,triggersZOrder:c.any}],g=[{name:`display`,type:l.display,triggersZOrder:c.any,triggersBounds:c.any,triggersBoundsOfConnectedEdges:c.any,triggersBoundsOfParallelEdges:function(e,t,n){return e===t?!1:n.pstyle(`curve-style`).value===`bezier`}},{name:`visibility`,type:l.visibility,triggersZOrder:c.any},{name:`opacity`,type:l.zeroOneNumber,triggersZOrder:c.zeroNonZero},{name:`text-opacity`,type:l.zeroOneNumber},{name:`min-zoomed-font-size`,type:l.size},{name:`z-compound-depth`,type:l.zCompoundDepth,triggersZOrder:c.any},{name:`z-index-compare`,type:l.zIndexCompare,triggersZOrder:c.any},{name:`z-index`,type:l.number,triggersZOrder:c.any}],_=[{name:`overlay-padding`,type:l.size,triggersBounds:c.any},{name:`overlay-color`,type:l.color},{name:`overlay-opacity`,type:l.zeroOneNumber,triggersBounds:c.zeroNonZero},{name:`overlay-shape`,type:l.overlayShape,triggersBounds:c.any},{name:`overlay-corner-radius`,type:l.cornerRadius}],v=[{name:`underlay-padding`,type:l.size,triggersBounds:c.any},{name:`underlay-color`,type:l.color},{name:`underlay-opacity`,type:l.zeroOneNumber,triggersBounds:c.zeroNonZero},{name:`underlay-shape`,type:l.overlayShape,triggersBounds:c.any},{name:`underlay-corner-radius`,type:l.cornerRadius}],y=[{name:`transition-property`,type:l.propList},{name:`transition-duration`,type:l.time},{name:`transition-delay`,type:l.time},{name:`transition-timing-function`,type:l.easing}],b=function(e,t){return t.value===`label`?-e.poolIndex():t.pfValue},x=[{name:`height`,type:l.nodeSize,triggersBounds:c.any,hashOverride:b},{name:`width`,type:l.nodeSize,triggersBounds:c.any,hashOverride:b},{name:`shape`,type:l.nodeShape,triggersBounds:c.any},{name:`shape-polygon-points`,type:l.polygonPointList,triggersBounds:c.any},{name:`corner-radius`,type:l.cornerRadius},{name:`background-color`,type:l.color},{name:`background-fill`,type:l.fill},{name:`background-opacity`,type:l.zeroOneNumber},{name:`background-blacken`,type:l.nOneOneNumber},{name:`background-gradient-stop-colors`,type:l.colors},{name:`background-gradient-stop-positions`,type:l.percentages},{name:`background-gradient-direction`,type:l.gradientDirection},{name:`padding`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`padding-relative-to`,type:l.paddingRelativeTo,triggersBounds:c.any},{name:`bounds-expansion`,type:l.boundsExpansion,triggersBounds:c.any}],S=[{name:`border-color`,type:l.color},{name:`border-opacity`,type:l.zeroOneNumber},{name:`border-width`,type:l.size,triggersBounds:c.any},{name:`border-style`,type:l.borderStyle},{name:`border-cap`,type:l.lineCap},{name:`border-join`,type:l.lineJoin},{name:`border-dash-pattern`,type:l.numbers},{name:`border-dash-offset`,type:l.number},{name:`border-position`,type:l.linePosition}],C=[{name:`outline-color`,type:l.color},{name:`outline-opacity`,type:l.zeroOneNumber},{name:`outline-width`,type:l.size,triggersBounds:c.any},{name:`outline-style`,type:l.borderStyle},{name:`outline-offset`,type:l.size,triggersBounds:c.any}],w=[{name:`background-image`,type:l.urls},{name:`background-image-crossorigin`,type:l.bgCrossOrigin},{name:`background-image-opacity`,type:l.zeroOneNumbers},{name:`background-image-containment`,type:l.bgContainment},{name:`background-image-smoothing`,type:l.bools},{name:`background-position-x`,type:l.bgPos},{name:`background-position-y`,type:l.bgPos},{name:`background-width-relative-to`,type:l.bgRelativeTo},{name:`background-height-relative-to`,type:l.bgRelativeTo},{name:`background-repeat`,type:l.bgRepeat},{name:`background-fit`,type:l.bgFit},{name:`background-clip`,type:l.bgClip},{name:`background-width`,type:l.bgWH},{name:`background-height`,type:l.bgWH},{name:`background-offset-x`,type:l.bgPos},{name:`background-offset-y`,type:l.bgPos}],T=[{name:`position`,type:l.position,triggersBounds:c.any},{name:`compound-sizing-wrt-labels`,type:l.compoundIncludeLabels,triggersBounds:c.any},{name:`min-width`,type:l.size,triggersBounds:c.any},{name:`min-width-bias-left`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-width-bias-right`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-height`,type:l.size,triggersBounds:c.any},{name:`min-height-bias-top`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-height-bias-bottom`,type:l.sizeMaybePercent,triggersBounds:c.any}],E=[{name:`line-style`,type:l.lineStyle},{name:`line-color`,type:l.color},{name:`line-fill`,type:l.fill},{name:`line-cap`,type:l.lineCap},{name:`line-opacity`,type:l.zeroOneNumber},{name:`line-dash-pattern`,type:l.numbers},{name:`line-dash-offset`,type:l.number},{name:`line-outline-width`,type:l.size},{name:`line-outline-color`,type:l.color},{name:`line-gradient-stop-colors`,type:l.colors},{name:`line-gradient-stop-positions`,type:l.percentages},{name:`curve-style`,type:l.curveStyle,triggersBounds:c.any,triggersBoundsOfParallelEdges:function(e,t){return e===t?!1:e===`bezier`||t===`bezier`}},{name:`haystack-radius`,type:l.zeroOneNumber,triggersBounds:c.any},{name:`source-endpoint`,type:l.edgeEndpoint,triggersBounds:c.any},{name:`target-endpoint`,type:l.edgeEndpoint,triggersBounds:c.any},{name:`control-point-step-size`,type:l.size,triggersBounds:c.any},{name:`control-point-distances`,type:l.bidirectionalSizes,triggersBounds:c.any},{name:`control-point-weights`,type:l.numbers,triggersBounds:c.any},{name:`segment-distances`,type:l.bidirectionalSizes,triggersBounds:c.any},{name:`segment-weights`,type:l.numbers,triggersBounds:c.any},{name:`segment-radii`,type:l.numbers,triggersBounds:c.any},{name:`radius-type`,type:l.radiusType,triggersBounds:c.any},{name:`taxi-turn`,type:l.bidirectionalSizeMaybePercent,triggersBounds:c.any},{name:`taxi-turn-min-distance`,type:l.size,triggersBounds:c.any},{name:`taxi-direction`,type:l.axisDirection,triggersBounds:c.any},{name:`taxi-radius`,type:l.number,triggersBounds:c.any},{name:`edge-distances`,type:l.edgeDistances,triggersBounds:c.any},{name:`arrow-scale`,type:l.positiveNumber,triggersBounds:c.any},{name:`loop-direction`,type:l.angle,triggersBounds:c.any},{name:`loop-sweep`,type:l.angle,triggersBounds:c.any},{name:`source-distance-from-node`,type:l.size,triggersBounds:c.any},{name:`target-distance-from-node`,type:l.size,triggersBounds:c.any}],D=[{name:`ghost`,type:l.bool,triggersBounds:c.any},{name:`ghost-offset-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`ghost-offset-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`ghost-opacity`,type:l.zeroOneNumber}],O=[{name:`selection-box-color`,type:l.color},{name:`selection-box-opacity`,type:l.zeroOneNumber},{name:`selection-box-border-color`,type:l.color},{name:`selection-box-border-width`,type:l.size},{name:`active-bg-color`,type:l.color},{name:`active-bg-opacity`,type:l.zeroOneNumber},{name:`active-bg-size`,type:l.size},{name:`outside-texture-bg-color`,type:l.color},{name:`outside-texture-bg-opacity`,type:l.zeroOneNumber}],k=[];$K.pieBackgroundN=16,k.push({name:`pie-size`,type:l.sizeMaybePercent}),k.push({name:`pie-hole`,type:l.sizeMaybePercent}),k.push({name:`pie-start-angle`,type:l.angle});for(var A=1;A<=$K.pieBackgroundN;A++)k.push({name:`pie-`+A+`-background-color`,type:l.color}),k.push({name:`pie-`+A+`-background-size`,type:l.percent}),k.push({name:`pie-`+A+`-background-opacity`,type:l.zeroOneNumber});var j=[];$K.stripeBackgroundN=16,j.push({name:`stripe-size`,type:l.sizeMaybePercent}),j.push({name:`stripe-direction`,type:l.axisDirectionPrimary});for(var M=1;M<=$K.stripeBackgroundN;M++)j.push({name:`stripe-`+M+`-background-color`,type:l.color}),j.push({name:`stripe-`+M+`-background-size`,type:l.percent}),j.push({name:`stripe-`+M+`-background-opacity`,type:l.zeroOneNumber});var N=[],P=$K.arrowPrefixes=[`source`,`mid-source`,`target`,`mid-target`];[{name:`arrow-shape`,type:l.arrowShape,triggersBounds:c.any},{name:`arrow-color`,type:l.color},{name:`arrow-fill`,type:l.arrowFill},{name:`arrow-width`,type:l.arrowWidth}].forEach(function(e){P.forEach(function(t){var n=t+`-`+e.name,r=e.type,i=e.triggersBounds;N.push({name:n,type:r,triggersBounds:i})})},{});var F=$K.properties=[].concat(h,y,g,_,v,D,m,p,u,d,f,x,S,C,w,k,j,T,E,N,O),I=$K.propertyGroups={behavior:h,transition:y,visibility:g,overlay:_,underlay:v,ghost:D,commonLabel:m,labelDimensions:p,mainLabel:u,sourceLabel:d,targetLabel:f,nodeBody:x,nodeBorder:S,nodeOutline:C,backgroundImage:w,pie:k,stripe:j,compound:T,edgeLine:E,edgeArrow:N,core:O},L=$K.propertyGroupNames={};($K.propertyGroupKeys=Object.keys(I)).forEach(function(e){L[e]=I[e].map(function(e){return e.name}),I[e].forEach(function(t){return t.groupKey=e})});var R=$K.aliases=[{name:`content`,pointsTo:`label`},{name:`control-point-distance`,pointsTo:`control-point-distances`},{name:`control-point-weight`,pointsTo:`control-point-weights`},{name:`segment-distance`,pointsTo:`segment-distances`},{name:`segment-weight`,pointsTo:`segment-weights`},{name:`segment-radius`,pointsTo:`segment-radii`},{name:`edge-text-rotation`,pointsTo:`text-rotation`},{name:`padding-left`,pointsTo:`padding`},{name:`padding-right`,pointsTo:`padding`},{name:`padding-top`,pointsTo:`padding`},{name:`padding-bottom`,pointsTo:`padding`}];$K.propertyNames=F.map(function(e){return e.name});for(var ee=0;ee<F.length;ee++){var z=F[ee];F[z.name]=z}for(var B=0;B<R.length;B++){var V=R[B],H=F[V.pointsTo],te={name:V.name,alias:!0,pointsTo:H};F.push(te),F[V.name]=te}})(),$K.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},$K.getDefaultProperties=function(){var e=this._private;if(e.defaultProperties!=null)return e.defaultProperties;for(var t=pI({"selection-box-color":`#ddd`,"selection-box-opacity":.65,"selection-box-border-color":`#aaa`,"selection-box-border-width":1,"active-bg-color":`black`,"active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":`#000`,"outside-texture-bg-opacity":.125,events:`yes`,"text-events":`no`,"text-valign":`top`,"text-halign":`center`,"text-justification":`auto`,"line-height":1,color:`#000`,"box-selection":`contain`,"text-outline-color":`#000`,"text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":`none`,"text-transform":`none`,"text-wrap":`none`,"text-overflow-wrap":`whitespace`,"text-max-width":9999,"text-background-color":`#000`,"text-background-opacity":0,"text-background-shape":`rectangle`,"text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":`solid`,"text-border-color":`#000`,"font-family":`Helvetica Neue, Helvetica, sans-serif`,"font-style":`normal`,"font-weight":`normal`,"font-size":16,"min-zoomed-font-size":0,"text-rotation":`none`,"source-text-rotation":`none`,"target-text-rotation":`none`,visibility:`visible`,display:`element`,opacity:1,"z-compound-depth":`auto`,"z-index-compare":`auto`,"z-index":0,label:``,"text-margin-x":0,"text-margin-y":0,"source-label":``,"source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":``,"target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":`#000`,"overlay-padding":10,"overlay-shape":`round-rectangle`,"overlay-corner-radius":`auto`,"underlay-opacity":0,"underlay-color":`#000`,"underlay-padding":10,"underlay-shape":`round-rectangle`,"underlay-corner-radius":`auto`,"transition-property":`none`,"transition-duration":0,"transition-delay":0,"transition-timing-function":`linear`,"box-select-labels":`no`,"background-blacken":0,"background-color":`#999`,"background-fill":`solid`,"background-opacity":1,"background-image":`none`,"background-image-crossorigin":`anonymous`,"background-image-opacity":1,"background-image-containment":`inside`,"background-image-smoothing":`yes`,"background-position-x":`50%`,"background-position-y":`50%`,"background-offset-x":0,"background-offset-y":0,"background-width-relative-to":`include-padding`,"background-height-relative-to":`include-padding`,"background-repeat":`no-repeat`,"background-fit":`none`,"background-clip":`node`,"background-width":`auto`,"background-height":`auto`,"border-color":`#000`,"border-opacity":1,"border-width":0,"border-style":`solid`,"border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":`butt`,"border-join":`miter`,"border-position":`center`,"outline-color":`#999`,"outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":`solid`,height:30,width:30,shape:`ellipse`,"shape-polygon-points":`-1, -1, 1, -1, 1, 1, -1, 1`,"corner-radius":`auto`,"bounds-expansion":0,"background-gradient-direction":`to-bottom`,"background-gradient-stop-colors":`#999`,"background-gradient-stop-positions":`0%`,ghost:`no`,"ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":`width`,position:`origin`,"compound-sizing-wrt-labels":`include`,"min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":`100%`,"pie-hole":0,"pie-start-angle":`0deg`},[{name:`pie-{{i}}-background-color`,value:`black`},{name:`pie-{{i}}-background-size`,value:`0%`},{name:`pie-{{i}}-background-opacity`,value:1}].reduce(function(e,t){for(var n=1;n<=$K.pieBackgroundN;n++){var r=t.name.replace(`{{i}}`,n);e[r]=t.value}return e},{}),{"stripe-size":`100%`,"stripe-direction":`horizontal`},[{name:`stripe-{{i}}-background-color`,value:`black`},{name:`stripe-{{i}}-background-size`,value:`0%`},{name:`stripe-{{i}}-background-opacity`,value:1}].reduce(function(e,t){for(var n=1;n<=$K.stripeBackgroundN;n++){var r=t.name.replace(`{{i}}`,n);e[r]=t.value}return e},{}),{"line-style":`solid`,"line-color":`#999`,"line-fill":`solid`,"line-cap":`butt`,"line-opacity":1,"line-outline-width":0,"line-outline-color":`#000`,"line-gradient-stop-colors":`#999`,"line-gradient-stop-positions":`0%`,"control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":`arc-radius`,"taxi-turn":`50%`,"taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":`auto`,"edge-distances":`intersection`,"curve-style":`haystack`,"haystack-radius":0,"arrow-scale":1,"loop-direction":`-45deg`,"loop-sweep":`-90deg`,"source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":`outside-to-node`,"target-endpoint":`outside-to-node`,"line-dash-pattern":[6,3],"line-dash-offset":0},[{name:`arrow-shape`,value:`none`},{name:`arrow-color`,value:`#999`},{name:`arrow-fill`,value:`filled`},{name:`arrow-width`,value:1}].reduce(function(e,t){return $K.arrowPrefixes.forEach(function(n){var r=n+`-`+t.name;e[r]=t.value}),e},{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a];n[a]=this.parse(a,o)}}return e.defaultProperties=n,e.defaultProperties},$K.addDefaultStylesheet=function(){this.selector(`:parent`).css({shape:`rectangle`,padding:10,"background-color":`#eee`,"border-color":`#ccc`,"border-width":1}).selector(`edge`).css({width:3}).selector(`:loop`).css({"curve-style":`bezier`}).selector(`edge:compound`).css({"curve-style":`bezier`,"source-endpoint":`outside-to-line`,"target-endpoint":`outside-to-line`}).selector(`:selected`).css({"background-color":`#0169D9`,"line-color":`#0169D9`,"source-arrow-color":`#0169D9`,"target-arrow-color":`#0169D9`,"mid-source-arrow-color":`#0169D9`,"mid-target-arrow-color":`#0169D9`}).selector(`:parent:selected`).css({"background-color":`#CCE1F9`,"border-color":`#aec8e5`}).selector(`:active`).css({"overlay-color":`black`,"overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var eq={};eq.parse=function(e,t,n,r){var i=this;if(FF(t))return i.parseImplWarn(e,t,n,r);var a=r===`mapping`||r===!0||r===!1||r==null?`dontcare`:r,o=n?`t`:`f`,s=kL(e,``+t,o,a),c=i.propCache=i.propCache||[],l;return(l=c[s])||(l=c[s]=i.parseImplWarn(e,t,n,r)),(n||r===`mapping`)&&(l=KL(l),l&&(l.value=KL(l.value))),l},eq.parseImplWarn=function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return!i&&t!=null&&WL(`The style property \`${e}: ${t}\` is invalid`),i&&(i.name===`width`||i.name===`height`)&&t===`label`&&WL("The style value of `label` is deprecated for `"+i.name+"`"),i},eq.parseImpl=function(e,t,n,r){var i=this;e=$F(e);var a=i.properties[e],o=t,s=i.types;if(!a||t===void 0)return null;a.alias&&(a=a.pointsTo,e=a.name);var c=PF(t);c&&(t=t.trim());var l=a.type;if(!l)return null;if(n&&(t===``||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(FF(t))return{name:e,value:t,strValue:`fn`,mapped:s.fn,bypass:n};var u,d;if(!(!c||r||t.length<7||t[1]!==`a`)){if(t.length>=7&&t[0]===`d`&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var f=s.data;return{name:e,value:u,strValue:``+t,mapped:f,field:u[1],bypass:n}}else if(t.length>=10&&t[0]===`m`&&(d=new RegExp(s.mapData.regex).exec(t))){if(n||l.multiple)return!1;var p=s.mapData;if(!(l.color||l.number))return!1;var m=this.parse(e,d[4]);if(!m||m.mapped)return!1;var h=this.parse(e,d[5]);if(!h||h.mapped)return!1;if(m.pfValue===h.pfValue||m.strValue===h.strValue)return WL("`"+e+`: `+t+"` is not a valid mapper because the output range is zero; converting to `"+e+`: `+m.strValue+"`"),this.parse(e,m.strValue);if(l.color){var g=m.value,_=h.value;if(g[0]===_[0]&&g[1]===_[1]&&g[2]===_[2]&&(g[3]===_[3]||(g[3]==null||g[3]===1)&&(_[3]==null||_[3]===1)))return!1}return{name:e,value:d,strValue:``+t,mapped:p,field:d[1],fieldMin:parseFloat(d[2]),fieldMax:parseFloat(d[3]),valueMin:m.value,valueMax:h.value,bypass:n}}}if(l.multiple&&r!==`multiple`){var v=c?t.split(/\s+/):IF(t)?t:[t];if(l.evenMultiple&&v.length%2!=0)return null;for(var y=[],b=[],x=[],S=``,C=!1,w=0;w<v.length;w++){var T=i.parse(e,v[w],n,`multiple`);C||=PF(T.value),y.push(T.value),x.push(T.pfValue==null?T.value:T.pfValue),b.push(T.units),S+=(w>0?` `:``)+T.strValue}return l.validate&&!l.validate(y,b)?null:l.singleEnum&&C?y.length===1&&PF(y[0])?{name:e,value:y[0],strValue:y[0],bypass:n}:null:{name:e,value:y,pfValue:x,strValue:S,bypass:n,units:b}}var E=function(){for(var r=0;r<l.enums.length;r++)if(l.enums[r]===t)return{name:e,value:t,strValue:``+t,bypass:n};return null};if(l.number){var D,O=`px`;if(l.units&&(D=l.units),l.implicitUnits&&(O=l.implicitUnits),!l.unitless)if(c){var k=`px|em`+(l.allowPercent?`|\\%`:``);D&&(k=D);var A=t.match(`^(`+iI+`)(`+k+`)?$`);A&&(t=A[1],D=A[2]||O)}else (!D||l.implicitUnits)&&(D=O);if(t=parseFloat(t),isNaN(t)&&l.enums===void 0)return null;if(isNaN(t)&&l.enums!==void 0)return t=o,E();if(l.integer&&!zF(t)||l.min!==void 0&&(t<l.min||l.strictMin&&t===l.min)||l.max!==void 0&&(t>l.max||l.strictMax&&t===l.max))return null;var j={name:e,value:t,strValue:``+t+(D||``),units:D,bypass:n};return l.unitless||D!==`px`&&D!==`em`?j.pfValue=t:j.pfValue=D===`px`||!D?t:this.getEmSizeInPixels()*t,(D===`ms`||D===`s`)&&(j.pfValue=D===`ms`?t:1e3*t),(D===`deg`||D===`rad`)&&(j.pfValue=D===`rad`?t:zR(t)),D===`%`&&(j.pfValue=t/100),j}else if(l.propList){var M=[],N=``+t;if(N!==`none`){for(var P=N.split(/\s*,\s*|\s+/),F=0;F<P.length;F++){var I=P[F].trim();i.properties[I]?M.push(I):WL("`"+I+"` is not a valid property name")}if(M.length===0)return null}return{name:e,value:M,strValue:M.length===0?`none`:M.join(` `),bypass:n}}else if(l.color){var L=vI(t);return L?{name:e,value:L,pfValue:L,strValue:`rgb(`+L[0]+`,`+L[1]+`,`+L[2]+`)`,bypass:n}:null}else if(l.regex||l.regexes){if(l.enums){var R=E();if(R)return R}for(var ee=l.regexes?l.regexes:[l.regex],z=0;z<ee.length;z++){var B=new RegExp(ee[z]).exec(t);if(B)return{name:e,value:l.singleRegexMatchValue?B[1]:B,strValue:``+t,bypass:n}}return null}else if(l.string)return{name:e,value:``+t,strValue:``+t,bypass:n};else if(l.enums)return E();else return null};var tq=function(e){if(!(this instanceof tq))return new tq(e);if(!WF(e)){HL(`A style must have a core reference`);return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},nq=tq.prototype;nq.instanceString=function(){return`style`},nq.clear=function(){for(var e=this._private,t=e.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach(function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1}),this},nq.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},nq.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},nq.selector=function(e){var t=e===`core`?null:new BW(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},nq.css=function(){var e=this,t=arguments;if(t.length===1)for(var n=t[0],r=0;r<e.properties.length;r++){var i=e.properties[r],a=n[i.name];a===void 0&&(a=n[eI(i.name)]),a!==void 0&&this.cssRule(i.name,a)}else t.length===2&&this.cssRule(t[0],t[1]);return this},nq.style=nq.css,nq.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.name.match(/stripe-(\d+)-background-size/)&&n.value&&(this._private.hasStripe=!0),n.mapped&&this[r].mappedProperties.push(n),this[r].selector||(this._private.coreStyle[n.name]=n)}return this},nq.append=function(e){return GF(e)?e.appendToStyle(this):IF(e)?this.appendFromJson(e):PF(e)&&this.appendFromString(e),this},tq.fromJson=function(e,t){var n=new tq(e);return n.fromJson(t),n},tq.fromString=function(e,t){return new tq(e).fromString(t)},[GK,JK,YK,XK,ZK,QK,$K,eq].forEach(function(e){pI(nq,e)}),tq.types=nq.types,tq.properties=nq.properties,tq.propertyGroups=nq.propertyGroups,tq.propertyGroupNames=nq.propertyGroupNames,tq.propertyGroupKeys=nq.propertyGroupKeys;var rq={style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return GF(e)?t.style=e.generateStyle(this):IF(e)?t.style=tq.fromJson(this,e):PF(e)?t.style=tq.fromString(this,e):t.style=tq(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},iq=`single`,aq={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var t=this._private;if(t.selectionType??=iq,e!==void 0)(e===`additive`||e===`single`)&&(t.selectionType=e);else return t.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,t=this._private.pan,n,r,i,a,o;switch(e.length){case 0:return t;case 1:if(PF(e[0]))return n=e[0],t[n];if(LF(e[0])){if(!this._private.panningEnabled)return this;i=e[0],a=i.x,o=i.y,$(a)&&(t.x=a),$(o)&&(t.y=o),this.emit(`pan viewport`)}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],r=e[1],(n===`x`||n===`y`)&&$(r)&&(t[n]=r),this.emit(`pan viewport`);break}return this.notify(`viewport`),this},panBy:function(e,t){var n=arguments,r=this._private.pan,i,a,o,s,c;if(!this._private.panningEnabled)return this;switch(n.length){case 1:LF(e)&&(o=n[0],s=o.x,c=o.y,$(s)&&(r.x+=s),$(c)&&(r.y+=c),this.emit(`pan viewport`));break;case 2:i=e,a=t,(i===`x`||i===`y`)&&$(a)&&(r[i]+=a),this.emit(`pan viewport`);break}return this.notify(`viewport`),this},gc:function(){this.notify(`gc`)},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit(`pan zoom viewport`),this.notify(`viewport`)}return this},getFitViewport:function(e,t){if($(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(PF(e)){var r=e;e=this.$(r)}else if(YF(e)){var i=e;n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else VF(e)||(e=this.mutableElements());if(!(VF(e)&&e.empty())){n||=e.boundingBox();var a=this.width(),o=this.height(),s;if(t=$(t)?t:0,!isNaN(a)&&!isNaN(o)&&a>0&&o>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){s=Math.min((a-2*t)/n.w,(o-2*t)/n.h),s=s>this._private.maxZoom?this._private.maxZoom:s,s=s<this._private.minZoom?this._private.minZoom:s;var c={x:(a-s*(n.x1+n.x2))/2,y:(o-s*(n.y1+n.y2))/2};return{zoom:s,pan:c}}}}},zoomRange:function(e,t){var n=this._private;if(t==null){var r=e;e=r.min,t=r.max}return $(e)&&$(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):$(e)&&t===void 0&&e<=n.maxZoom?n.minZoom=e:$(t)&&e===void 0&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,n=t.pan,r=t.zoom,i,a,o=!1;if(t.zoomingEnabled||(o=!0),$(e)?a=e:LF(e)&&(a=e.level,e.position==null?e.renderedPosition!=null&&(i=e.renderedPosition):i=MR(e.position,r,n),i!=null&&!t.panningEnabled&&(o=!0)),a=a>t.maxZoom?t.maxZoom:a,a=a<t.minZoom?t.minZoom:a,o||!$(a)||a===r||i!=null&&(!$(i.x)||!$(i.y)))return null;if(i!=null){var s=n,c=r,l=a;return{zoomed:!0,panned:!0,zoom:l,pan:{x:-l/c*(i.x-s.x)+i.x,y:-l/c*(i.y-s.y)+i.y}}}else return{zoomed:!0,panned:!1,zoom:a,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return t==null||!t.zoomed?this:(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit(`zoom`+(t.panned?` pan`:``)+` viewport`),this.notify(`viewport`),this)},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1,o=!1;if(!e||($(e.zoom)||(n=!1),LF(e.pan)||(r=!1),!n&&!r))return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push(`zoom`))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var c=e.pan;$(c.x)&&(t.pan.x=c.x,o=!1),$(c.y)&&(t.pan.y=c.y,o=!1),o||i.push(`pan`)}return i.length>0&&(i.push(`viewport`),this.emit(i.join(` `)),this.notify(`viewport`)),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit(`pan viewport`),this.notify(`viewport`)),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(PF(e)){var n=e;e=this.mutableElements().filter(n)}else VF(e)||(e=this.mutableElements());if(e.length!==0){var r=e.boundingBox(),i=this.width(),a=this.height();return t=t===void 0?this._private.zoom:t,{x:(i-t*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled||this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?function(){var e=n.window().getComputedStyle(t),r=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-r(`padding-left`)-r(`padding-right`),height:t.clientHeight-r(`padding-top`)-r(`padding-bottom`)}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};aq.centre=aq.center,aq.autolockNodes=aq.autolock,aq.autoungrabifyNodes=aq.autoungrabify;var oq={data:gW.data({field:`data`,bindingEvent:`data`,allowBinding:!0,allowSetting:!0,settingEvent:`data`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeData:gW.removeData({field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0}),scratch:gW.data({field:`scratch`,bindingEvent:`scratch`,allowBinding:!0,allowSetting:!0,settingEvent:`scratch`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeScratch:gW.removeData({field:`scratch`,event:`scratch`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0})};oq.attr=oq.data,oq.removeAttr=oq.removeData;var sq=function(e){var t=this;e=pI({},e);var n=e.container;n&&!BF(n)&&BF(n[0])&&(n=n[0]);var r=n?n._cyreg:null;r||={},r&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=DF!==void 0&&n!==void 0&&!e.headless,o=e;o.layout=pI({name:a?`grid`:`null`},o.layout),o.renderer=pI({name:a?`canvas`:`null`},o.renderer);var s=function(e,t,n){return t===void 0?n===void 0?e:n:t},c=this._private={container:n,ready:!1,options:o,elements:new xK(this),listeners:[],aniEles:new xK(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?a:o.styleEnabled,zoom:$(o.zoom)?o.zoom:1,pan:{x:LF(o.pan)&&$(o.pan.x)?o.pan.x:0,y:LF(o.pan)&&$(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var l=function(e,t){if(e.some(XF))return gV.all(e).then(t);t(e)};c.styleEnabled&&t.setStyle([]);var u=pI({},o,o.renderer);t.initRenderer(u);var d=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),e!=null&&(LF(e)||IF(e))&&t.add(e),t.one(`layoutready`,function(e){t.notifications(!0),t.emit(e),t.one(`load`,n),t.emitAndNotify(`load`)}).one(`layoutstop`,function(){t.one(`done`,r),t.emit(`done`)});var a=pI({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};l([o.style,o.elements],function(e){var n=e[0],a=e[1];c.styleEnabled&&t.style().append(n),d(a,function(){t.startAnimationLoop(),c.ready=!0,FF(o.ready)&&t.on(`ready`,o.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on(`ready`,n)}r&&(r.readies=[]),t.emit(`ready`)},o.done)})},cq=sq.prototype;pI(cq,{instanceString:function(){return`core`},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit(`ready`,[],e):this.on(`ready`,e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit(`destroy`),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){if(this._private.container==null)return DF;var e=this._private.container.ownerDocument;return e===void 0||e==null?DF:e.defaultView||DF},mount:function(e){if(e!=null){var t=this,n=t._private,r=n.options;return!BF(e)&&BF(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(pI({},r,r.renderer,{name:r.renderer.name===`null`?`canvas`:r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit(`mount`),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:`null`}),e.emit(`unmount`),e},options:function(){return KL(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements(),i=function(e){return t.getElementById(e.id())};if(LF(e)){if(t.startBatch(),e.elements){var a={},o=function(e,n){for(var r=[],i=[],o=0;o<e.length;o++){var s=e[o];if(!s.data.id){WL(`cy.json() cannot handle elements without an ID attribute`);continue}var c=``+s.data.id,l=t.getElementById(c);a[c]=!0,l.length===0?(n&&(s.group=n),r.push(s)):i.push({ele:l,json:s})}t.add(r);for(var u=0;u<i.length;u++){var d=i[u],f=d.ele,p=d.json;f.json(p)}};if(IF(e.elements))o(e.elements);else for(var s=[`nodes`,`edges`],c=0;c<s.length;c++){var l=s[c],u=e.elements[l];IF(u)&&o(u,l)}var d=t.collection();r.filter(function(e){return!a[e.id()]}).forEach(function(e){e.isParent()?d.merge(e):e.remove()}),d.forEach(function(e){return e.children().move({parent:null})}),d.forEach(function(e){return i(e).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var f=[`minZoom`,`maxZoom`,`zoomingEnabled`,`userZoomingEnabled`,`panningEnabled`,`userPanningEnabled`,`boxSelectionEnabled`,`autolock`,`autoungrabify`,`autounselectify`,`multiClickDebounceTime`],p=0;p<f.length;p++){var m=f[p];e[m]!=null&&t[m](e[m])}return t.endBatch(),this}else{var h=!!e,g={};h?g.elements=this.elements().map(function(e){return e.json()}):(g.elements={},r.forEach(function(e){var t=e.group();g.elements[t]||(g.elements[t]=[]),g.elements[t].push(e.json())})),this._private.styleEnabled&&(g.style=t.style().json()),g.data=KL(t.data());var _=n.options;return g.zoomingEnabled=n.zoomingEnabled,g.userZoomingEnabled=n.userZoomingEnabled,g.zoom=n.zoom,g.minZoom=n.minZoom,g.maxZoom=n.maxZoom,g.panningEnabled=n.panningEnabled,g.userPanningEnabled=n.userPanningEnabled,g.pan=KL(n.pan),g.boxSelectionEnabled=n.boxSelectionEnabled,g.renderer=KL(_.renderer),g.hideEdgesOnViewport=_.hideEdgesOnViewport,g.textureOnViewport=_.textureOnViewport,g.wheelSensitivity=_.wheelSensitivity,g.motionBlur=_.motionBlur,g.multiClickDebounceTime=_.multiClickDebounceTime,g}}}),cq.$id=cq.getElementById,[CK,FK,RK,zK,BK,VK,UK,WK,rq,aq,oq].forEach(function(e){pI(cq,e)});var lq={fit:!0,directed:!1,direction:`downward`,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},uq={maximal:!1,acyclic:!1},dq=function(e){return e.scratch(`breadthfirst`)},fq=function(e,t){return e.scratch(`breadthfirst`,t)};function pq(e){this.options=pI({},lq,uq,e)}pq.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().filter(function(e){return e.isChildless()}),i=n,a=e.directed,o=e.acyclic||e.maximal||e.maximalAdjustments>0,s=!!e.boundingBox,c=XR(s?e.boundingBox:structuredClone(t.extent())),l;if(VF(e.roots))l=e.roots;else if(IF(e.roots)){for(var u=[],d=0;d<e.roots.length;d++){var f=e.roots[d],p=t.getElementById(f);u.push(p)}l=t.collection(u)}else if(PF(e.roots))l=t.$(e.roots);else if(a)l=r.roots();else{var m=n.components();l=t.collection();for(var h=function(){var e=m[g],t=e.maxDegree(!1),n=e.filter(function(e){return e.degree(!1)===t});l=l.add(n)},g=0;g<m.length;g++)h()}var _=[],v={},y=function(e,t){_[t]??(_[t]=[]);var n=_[t].length;_[t].push(e),fq(e,{index:n,depth:t})},b=function(e,t){var n=dq(e),r=n.depth,i=n.index;_[r][i]=null,e.isChildless()&&y(e,t)};i.bfs({roots:l,directed:e.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();a.isChildless()&&y(a,i),v[o]=!0}});for(var x=[],S=0;S<r.length;S++){var C=r[S];v[C.id()]||x.push(C)}var w=function(e){for(var t=_[e],n=0;n<t.length;n++){var r=t[n];if(r==null){t.splice(n,1),n--;continue}fq(r,{depth:e,index:n})}},T=function(t,r){for(var i=dq(t),a=t.incomers().filter(function(e){return e.isNode()&&n.has(e)}),o=-1,s=t.id(),c=0;c<a.length;c++){var l=a[c],u=dq(l);o=Math.max(o,u.depth)}if(i.depth<=o){if(!e.acyclic&&r[s])return null;var d=o+1;return b(t,d),r[s]=d,!0}return!1};if(a&&o){var E=[],D={},O=function(e){return E.push(e)},k=function(){return E.shift()};for(r.forEach(function(e){return E.push(e)});E.length>0;){var A=k(),j=T(A,D);if(j)A.outgoers().filter(function(e){return e.isNode()&&n.has(e)}).forEach(O);else if(j===null){WL("Detected double maximal shift for node `"+A.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var M=0;if(e.avoidOverlap)for(var N=0;N<r.length;N++){var P=r[N].layoutDimensions(e),F=P.w,I=P.h;M=Math.max(M,F,I)}var L={},R=function(e){if(L[e.id()])return L[e.id()];for(var t=dq(e).depth,n=e.neighborhood(),i=0,a=0,o=0;o<n.length;o++){var s=n[o];if(!(s.isEdge()||s.isParent()||!r.has(s))){var c=dq(s);if(c!=null){var l=c.index,u=c.depth;if(!(l==null||u==null)){var d=_[u].length;u<t&&(i+=l/d,a++)}}}}return a=Math.max(1,a),i/=a,a===0&&(i=0),L[e.id()]=i,i},ee=function(e,t){var n=R(e)-R(t);return n===0?dI(e.id(),t.id()):n};e.depthSort!==void 0&&(ee=e.depthSort);for(var z=_.length,B=0;B<z;B++)_[B].sort(ee),w(B);for(var V=[],H=0;H<x.length;H++)V.push(x[H]);V.length&&(_.unshift(V),z=_.length,function(){for(var e=0;e<z;e++)w(e)}());for(var te=0,ne=0;ne<z;ne++)te=Math.max(_[ne].length,te);var U={x:c.x1+c.w/2,y:c.y1+c.h/2},re=r.reduce(function(t,n){return function(e){return{w:t.w===-1?e.w:(t.w+e.w)/2,h:t.h===-1?e.h:(t.h+e.h)/2}}(n.boundingBox({includeLabels:e.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),ie=Math.max(z===1?0:s?(c.h-e.padding*2-re.h)/(z-1):(c.h-e.padding*2-re.h)/(z+1),M),ae=_.reduce(function(e,t){return Math.max(e,t.length)},0),oe=function(t){var n=dq(t),r=n.depth,i=n.index;if(e.circle){var a=Math.min(c.w/2/z,c.h/2/z);a=Math.max(a,M);var o=a*r+a-(z>0&&_[0].length<=3?a/2:0),l=2*Math.PI/_[r].length*i;return r===0&&_[0].length===1&&(o=1),{x:U.x+o*Math.cos(l),y:U.y+o*Math.sin(l)}}else{var u=_[r].length,d=Math.max(u===1?0:s?(c.w-e.padding*2-re.w)/((e.grid?ae:u)-1):(c.w-e.padding*2-re.w)/((e.grid?ae:u)+1),M);return{x:U.x+(i+1-(u+1)/2)*d,y:U.y+(r+1-(z+1)/2)*ie}}},se={downward:0,leftward:90,upward:180,rightward:-90};return Object.keys(se).indexOf(e.direction)===-1&&HL(`Invalid direction '${e.direction}' specified for breadthfirst layout. Valid values are: ${Object.keys(se).join(`, `)}`),n.nodes().layoutPositions(this,e,function(t){return NL(oe(t),c,se[e.direction])}),this};var mq={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function hq(e){this.options=pI({},mq,e)}hq.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=t.counterclockwise===void 0?t.clockwise:!t.counterclockwise,a=r.nodes().not(`:parent`);t.sort&&(a=a.sort(t.sort));for(var o=XR(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},c=(t.sweep===void 0?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),l,u=0,d=0;d<a.length;d++){var f=a[d].layoutDimensions(t),p=f.w,m=f.h;u=Math.max(u,p,m)}if(l=$(t.radius)?t.radius:a.length<=1?0:Math.min(o.h,o.w)/2-u,a.length>1&&t.avoidOverlap){u*=1.75;var h=Math.cos(c)-Math.cos(0),g=Math.sin(c)-Math.sin(0),_=Math.sqrt(u*u/(h*h+g*g));l=Math.max(_,l)}return r.nodes().layoutPositions(this,t,function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=l*Math.cos(r),o=l*Math.sin(r);return{x:s.x+a,y:s.y+o}}),this};var gq={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function _q(e){this.options=pI({},gq,e)}_q.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise===void 0?t.clockwise:!t.counterclockwise,r=e.cy,i=t.eles,a=i.nodes().not(`:parent`),o=XR(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},c=[],l=0,u=0;u<a.length;u++){var d=a[u],f=void 0;f=t.concentric(d),c.push({value:f,node:d}),d._private.scratch.concentric=f}a.updateStyle();for(var p=0;p<a.length;p++){var m=a[p].layoutDimensions(t);l=Math.max(l,m.w,m.h)}c.sort(function(e,t){return t.value-e.value});for(var h=t.levelWidth(a),g=[[]],_=g[0],v=0;v<c.length;v++){var y=c[v];_.length>0&&Math.abs(_[0].value-y.value)>=h&&(_=[],g.push(_)),_.push(y)}var b=l+t.minNodeSpacing;if(!t.avoidOverlap){var x=g.length>0&&g[0].length>1,S=(Math.min(o.w,o.h)/2-b)/(g.length+x?1:0);b=Math.min(b,S)}for(var C=0,w=0;w<g.length;w++){var T=g[w],E=T.dTheta=(t.sweep===void 0?2*Math.PI-2*Math.PI/T.length:t.sweep)/Math.max(1,T.length-1);if(T.length>1&&t.avoidOverlap){var D=Math.cos(E)-Math.cos(0),O=Math.sin(E)-Math.sin(0),k=Math.sqrt(b*b/(D*D+O*O));C=Math.max(k,C)}T.r=C,C+=b}if(t.equidistant){for(var A=0,j=0,M=0;M<g.length;M++){var N=g[M].r-j;A=Math.max(A,N)}j=0;for(var P=0;P<g.length;P++){var F=g[P];P===0&&(j=F.r),F.r=j,j+=A}}for(var I={},L=0;L<g.length;L++)for(var R=g[L],ee=R.dTheta,z=R.r,B=0;B<R.length;B++){var V=R[B],H=t.startAngle+(n?1:-1)*ee*B,te={x:s.x+z*Math.cos(H),y:s.y+z*Math.sin(H)};I[V.node.id()]=te}return i.nodes().layoutPositions(this,t,function(e){return I[e.id()]}),this};var vq,yq={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function bq(e){this.options=pI({},yq,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges().filter(function(e){var n=e.source().data(`id`),r=e.target().data(`id`),i=t.some(function(e){return e.data(`id`)===n}),a=t.some(function(e){return e.data(`id`)===r});return!i||!a});this.options.eles=this.options.eles.not(n)}bq.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(e.animate===!0||e.animate===!1)&&n.emit({type:`layoutstart`,layout:n}),vq=!0===e.debug;var r=xq(t,n,e);vq&&wq(r),e.randomize&&Tq(r);var i=_L(),a=function(){Dq(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter||(Oq(r,e),r.temperature*=e.coolingFactor,r.temperature<e.minTemp))},s=function(){if(e.animate===!0||e.animate===!1)a(),n.one(`layoutstop`,e.stop),n.emit({type:`layoutstop`,layout:n});else{var t=e.eles.nodes(),i=Eq(r,e,t);t.layoutPositions(n,e,i)}},c=0,l=!0;if(e.animate===!0){var u=function(){for(var t=0;l&&t<e.refresh;)l=o(c),c++,t++;l?(_L()-i>=e.animationThreshold&&a(),gL(u)):(Bq(r,e),s())};u()}else{for(;l;)l=o(c),c++;Bq(r,e),s()}return this},bq.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit(`layoutstop`),this},bq.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var xq=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=XR(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),c={},l=0;l<s.length;l++)for(var u=s[l],d=0;d<u.length;d++){var f=u[d];c[f.id()]=l}for(var l=0;l<o.nodeSize;l++){var p=i[l],m=p.layoutDimensions(n),h={};h.isLocked=p.locked(),h.id=p.data(`id`),h.parentId=p.data(`parent`),h.cmptId=c[p.id()],h.children=[],h.positionX=p.position(`x`),h.positionY=p.position(`y`),h.offsetX=0,h.offsetY=0,h.height=m.w,h.width=m.h,h.maxX=h.positionX+h.width/2,h.minX=h.positionX-h.width/2,h.maxY=h.positionY+h.height/2,h.minY=h.positionY-h.height/2,h.padLeft=parseFloat(p.style(`padding`)),h.padRight=parseFloat(p.style(`padding`)),h.padTop=parseFloat(p.style(`padding`)),h.padBottom=parseFloat(p.style(`padding`)),h.nodeRepulsion=FF(n.nodeRepulsion)?n.nodeRepulsion(p):n.nodeRepulsion,o.layoutNodes.push(h),o.idToIndex[h.id]=l}for(var g=[],_=0,v=-1,y=[],l=0;l<o.nodeSize;l++){var p=o.layoutNodes[l],b=p.parentId;b==null?(g[++v]=p.id,y.push(p.id)):o.layoutNodes[o.idToIndex[b]].children.push(p.id)}for(o.graphSet.push(y);_<=v;){var x=g[_++],S=o.idToIndex[x],f=o.layoutNodes[S],C=f.children;if(C.length>0){o.graphSet.push(C);for(var l=0;l<C.length;l++)g[++v]=C[l]}}for(var l=0;l<o.graphSet.length;l++)for(var w=o.graphSet[l],d=0;d<w.length;d++){var T=o.idToIndex[w[d]];o.indexToGraph[T]=l}for(var l=0;l<o.edgeSize;l++){var E=r[l],D={};D.id=E.data(`id`),D.sourceId=E.data(`source`),D.targetId=E.data(`target`);var O=FF(n.idealEdgeLength)?n.idealEdgeLength(E):n.idealEdgeLength,k=FF(n.edgeElasticity)?n.edgeElasticity(E):n.edgeElasticity,A=o.idToIndex[D.sourceId],j=o.idToIndex[D.targetId];if(o.indexToGraph[A]!=o.indexToGraph[j]){for(var M=Sq(D.sourceId,D.targetId,o),N=o.graphSet[M],P=0,h=o.layoutNodes[A];N.indexOf(h.id)===-1;)h=o.layoutNodes[o.idToIndex[h.parentId]],P++;for(h=o.layoutNodes[j];N.indexOf(h.id)===-1;)h=o.layoutNodes[o.idToIndex[h.parentId]],P++;O*=P*n.nestingFactor}D.idealLength=O,D.elasticity=k,o.layoutEdges.push(D)}return o},Sq=function(e,t,n){var r=Cq(e,t,0,n);return 2>r.count?0:r.graph},Cq=function(e,t,n,r){var i=r.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var a=0,o=0;o<i.length;o++){var s=i[o],c=r.idToIndex[s],l=r.layoutNodes[c].children;if(l.length!==0){var u=r.indexToGraph[r.idToIndex[l[0]]],d=Cq(e,t,u,r);if(d.count!==0)if(d.count===1){if(a++,a===2)break}else return d}}return{count:a,graph:n}},wq,Tq=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];a.children.length===0&&!a.isLocked&&(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},Eq=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(t){var n=e.layoutNodes[e.idToIndex[t.data(`id`)]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data(`id`)]];if(t.boundingBox){var s=i.w===0?.5:(o.positionX-i.x1)/i.w,c=i.h===0?.5:(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+c*r.h}}else return{x:o.positionX,y:o.positionY}}},Dq=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=Eq(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one(`layoutready`,n.ready),r.emit({type:`layoutready`,layout:this}))},Oq=function(e,t,n){kq(e,t),Pq(e),Fq(e,t),Iq(e),Lq(e)},kq=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++){var c=e.layoutNodes[e.idToIndex[r[s]]];jq(o,c,e,t)}},Aq=function(e){return-1+2*e*Math.random()},jq=function(e,t,n,r){if(!(e.cmptId!==t.cmptId&&!n.isCompound)){var i=t.positionX-e.positionX,a=t.positionY-e.positionY,o=1;i===0&&a===0&&(i=Aq(o),a=Aq(o));var s=Mq(e,t,i,a);if(s>0)var c=r.nodeOverlap*s,l=Math.sqrt(i*i+a*a),u=c*i/l,d=c*a/l;else var f=Nq(e,i,a),p=Nq(t,-1*i,-1*a),m=p.x-f.x,h=p.y-f.y,g=m*m+h*h,l=Math.sqrt(g),c=(e.nodeRepulsion+t.nodeRepulsion)/g,u=c*m/l,d=c*h/l;e.isLocked||(e.offsetX-=u,e.offsetY-=d),t.isLocked||(t.offsetX+=u,t.offsetY+=d)}},Mq=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},Nq=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,c=a/o,l={};return t===0&&0<n||t===0&&0>n?(l.x=r,l.y=i+a/2,l):0<t&&-1*c<=s&&s<=c?(l.x=r+o/2,l.y=i+o*n/2/t,l):0>t&&-1*c<=s&&s<=c?(l.x=r-o/2,l.y=i-o*n/2/t,l):0<n&&(s<=-1*c||s>=c)?(l.x=r+a*t/2/n,l.y=i+a/2,l):0>n&&(s<=-1*c||s>=c)?(l.x=r-a*t/2/n,l.y=i-a/2,l):l},Pq=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],c=s.positionX-a.positionX,l=s.positionY-a.positionY;if(!(c===0&&l===0)){var u=Nq(a,c,l),d=Nq(s,-1*c,-1*l),f=d.x-u.x,p=d.y-u.y,m=Math.sqrt(f*f+p*p),h=(r.idealLength-m)**2/r.elasticity;if(m!==0)var g=h*f/m,_=h*p/m;else var g=0,_=0;a.isLocked||(a.offsetX+=g,a.offsetY+=_),s.isLocked||(s.offsetX-=g,s.offsetY-=_)}}},Fq=function(e,t){if(t.gravity!==0)for(var n=1,r=0;r<e.graphSet.length;r++){var i=e.graphSet[r],a=i.length;if(r===0)var o=e.clientHeight/2,s=e.clientWidth/2;else var c=e.layoutNodes[e.idToIndex[i[0]]],l=e.layoutNodes[e.idToIndex[c.parentId]],o=l.positionX,s=l.positionY;for(var u=0;u<a;u++){var d=e.layoutNodes[e.idToIndex[i[u]]];if(!d.isLocked){var f=o-d.positionX,p=s-d.positionY,m=Math.sqrt(f*f+p*p);if(m>n){var h=t.gravity*f/m,g=t.gravity*p/m;d.offsetX+=h,d.offsetY+=g}}}}},Iq=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],c=s.children;if(0<c.length&&!s.isLocked){for(var l=s.offsetX,u=s.offsetY,d=0;d<c.length;d++){var f=e.layoutNodes[e.idToIndex[c[d]]];f.offsetX+=l,f.offsetY+=u,n[++i]=c[d]}s.offsetX=0,s.offsetY=0}}},Lq=function(e,t){for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&(r.maxX=void 0,r.minX=void 0,r.maxY=void 0,r.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];if(!(0<r.children.length||r.isLocked)){var i=Rq(r.offsetX,r.offsetY,e.temperature);r.positionX+=i.x,r.positionY+=i.y,r.offsetX=0,r.offsetY=0,r.minX=r.positionX-r.width,r.maxX=r.positionX+r.width,r.minY=r.positionY-r.height,r.maxY=r.positionY+r.height,zq(r,e)}}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&!r.isLocked&&(r.positionX=(r.maxX+r.minX)/2,r.positionY=(r.maxY+r.minY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY)}},Rq=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},zq=function(e,t){var n=e.parentId;if(n!=null){var r=t.layoutNodes[t.idToIndex[n]],i=!1;if((r.maxX==null||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,i=!0),(r.minX==null||e.minX-r.padLeft<r.minX)&&(r.minX=e.minX-r.padLeft,i=!0),(r.maxY==null||e.maxY+r.padBottom>r.maxY)&&(r.maxY=e.maxY+r.padBottom,i=!0),(r.minY==null||e.minY-r.padTop<r.minY)&&(r.minY=e.minY-r.padTop,i=!0),i)return zq(r,t)}},Bq=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}for(var s=0,i=0;i<r.length;i++){var c=r[i];if(c){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var l=0;l<c.length;l++){var u=c[l];c.x1=Math.min(c.x1,u.positionX-u.width/2),c.x2=Math.max(c.x2,u.positionX+u.width/2),c.y1=Math.min(c.y1,u.positionY-u.height/2),c.y2=Math.max(c.y2,u.positionY+u.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,s+=c.w*c.h}}r.sort(function(e,t){return t.w*t.h-e.w*e.h});for(var d=0,f=0,p=0,m=0,h=Math.sqrt(s)*e.clientWidth/e.clientHeight,i=0;i<r.length;i++){var c=r[i];if(c){for(var l=0;l<c.length;l++){var u=c[l];u.isLocked||(u.positionX+=d-c.x1,u.positionY+=f-c.y1)}d+=c.w+t.componentSpacing,p+=c.w+t.componentSpacing,m=Math.max(m,c.h),p>h&&(f+=m+t.componentSpacing,d=0,p=0,m=0)}}},Vq={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Hq(e){this.options=pI({},Vq,e)}Hq.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(`:parent`);t.sort&&(i=i.sort(t.sort));var a=XR(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(a.h===0||a.w===0)r.nodes().layoutPositions(this,t,function(e){return{x:a.x1,y:a.y1}});else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),c=Math.round(s),l=Math.round(a.w/a.h*s),u=function(e){if(e==null)return Math.min(c,l);Math.min(c,l)==c?c=e:l=e},d=function(e){if(e==null)return Math.max(c,l);Math.max(c,l)==c?c=e:l=e},f=t.rows,p=t.cols==null?t.columns:t.cols;if(f!=null&&p!=null)c=f,l=p;else if(f!=null&&p==null)c=f,l=Math.ceil(o/c);else if(f==null&&p!=null)l=p,c=Math.ceil(o/l);else if(l*c>o){var m=u(),h=d();(m-1)*h>=o?u(m-1):(h-1)*m>=o&&d(h-1)}else for(;l*c<o;){var g=u(),_=d();(_+1)*g>=o?d(_+1):u(g+1)}var v=a.w/l,y=a.h/c;if(t.condense&&(v=0,y=0),t.avoidOverlap)for(var b=0;b<i.length;b++){var x=i[b],S=x._private.position;(S.x==null||S.y==null)&&(S.x=0,S.y=0);var C=x.layoutDimensions(t),w=t.avoidOverlapPadding,T=C.w+w,E=C.h+w;v=Math.max(v,T),y=Math.max(y,E)}for(var D={},O=function(e,t){return!!D[`c-`+e+`-`+t]},k=function(e,t){D[`c-`+e+`-`+t]=!0},A=0,j=0,M=function(){j++,j>=l&&(j=0,A++)},N={},P=0;P<i.length;P++){var F=i[P],I=t.position(F);if(I&&(I.row!==void 0||I.col!==void 0)){var L={row:I.row,col:I.col};if(L.col===void 0)for(L.col=0;O(L.row,L.col);)L.col++;else if(L.row===void 0)for(L.row=0;O(L.row,L.col);)L.row++;N[F.id()]=L,k(L.row,L.col)}}i.layoutPositions(this,t,function(e,t){var n,r;if(e.locked()||e.isParent())return!1;var i=N[e.id()];if(i)n=i.col*v+v/2+a.x1,r=i.row*y+y/2+a.y1;else{for(;O(A,j);)M();n=j*v+v/2+a.x1,r=A*y+y/2+a.y1,k(A,j),M()}return{x:n,y:r}})}return this};var Uq={ready:function(){},stop:function(){}};function Wq(e){this.options=pI({},Uq,e)}Wq.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit(`layoutstart`),t.nodes().positions(function(){return{x:0,y:0}}),n.one(`layoutready`,e.ready),n.emit(`layoutready`),n.one(`layoutstop`,e.stop),n.emit(`layoutstop`),this},Wq.prototype.stop=function(){return this};var Gq={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Kq(e){this.options=pI({},Gq,e)}Kq.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=FF(e.positions);function r(t){return e.positions==null?jR(t.position()):n?e.positions(t):e.positions[t._private.data.id]??null}return t.layoutPositions(this,e,function(e,t){var n=r(e);return e.locked()||n==null?!1:n}),this};var qq={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Jq(e){this.options=pI({},qq,e)}Jq.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=XR(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.nodes().layoutPositions(this,e,function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}}),this};var Yq=[{name:`breadthfirst`,impl:pq},{name:`circle`,impl:hq},{name:`concentric`,impl:_q},{name:`cose`,impl:bq},{name:`grid`,impl:Hq},{name:`null`,impl:Wq},{name:`preset`,impl:Kq},{name:`random`,impl:Jq}];function Xq(e){this.options=e,this.notifications=0}var Zq=function(){},Qq=function(){throw Error(`A headless instance can not render images`)};Xq.prototype={recalculateRenderedStyle:Zq,notify:function(){this.notifications++},init:Zq,isHeadless:function(){return!0},png:Qq,jpg:Qq};var $q={};$q.arrowShapeWidth=.3,$q.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,c=i.x+n/2+o,l=i.y-n/2-o,u=i.y+n/2+o;return s<=e&&e<=c&&l<=t&&t<=u},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=e*Math.sin(r)+t*Math.cos(r),s=a*n,c=o*n;return{x:s+i.x,y:c+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],c=e[o+1];a.push(r(s,c,t,n,i))}return a},a=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).pfValue*2},s=function(r,s){PF(s)&&(s=e[s]),e[r]=pI({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){return vz(e,t,a(i(this.points,n+2*s,r,o)))},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl(`polygon`)(e,o)},spacing:function(e){return 0},gap:o},s)};s(`none`,{collide:zL,roughCollide:zL,draw:VL,spacing:BL,gap:BL}),s(`triangle`,{points:[-.15,-.3,0,0,.15,-.3]}),s(`arrow`,`triangle`),s(`triangle-backcurve`,{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,a,o,s){var c=i(this.points,n,a,o),l=this.controlPoint,u=r(l[0],l[1],n,a,o);t.arrowShapeImpl(this.name)(e,c,u)},gap:function(e){return o(e)*.8}}),s(`triangle-tee`,{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,c){var l=a(i(this.points,n+2*c,r,o)),u=a(i(this.pointsTee,n+2*c,r,o));return vz(e,t,l)||vz(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),c=i(this.pointsTee,n,r,a);t.arrowShapeImpl(this.name)(e,s,c)}}),s(`circle-triangle`,{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,n,r,o,s,c){var l=o,u=(l.x-e)**2+(l.y-t)**2<=((n+2*c)*this.radius)**2;return vz(e,t,a(i(this.points,n+2*c,r,o)))||u},draw:function(e,n,r,a,o){var s=i(this.pointsTr,n,r,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.radius}}),s(`triangle-cross`,{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),r=t/e,i=3,a=5;return n[i]=n[i]-r,n[a]=n[a]-r,n},collide:function(e,t,n,r,o,s,c){var l=a(i(this.points,n+2*c,r,o)),u=a(i(this.crossLinePts(n,s),n+2*c,r,o));return vz(e,t,l)||vz(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),c=i(this.crossLinePts(n,o),n,r,a);t.arrowShapeImpl(this.name)(e,s,c)}}),s(`vee`,{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return o(e)*.525}}),s(`circle`,{radius:.15,collide:function(e,t,n,r,i,a,o){var s=i;return(s.x-e)**2+(s.y-t)**2<=((n+2*o)*this.radius)**2},draw:function(e,n,r,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.radius}}),s(`tee`,{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s(`square`,{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s(`diamond`,{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).value}}),s(`chevron`,{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return .95*e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).value}})};var eJ={};eJ.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),c=n.zoom();return[((e-i)/o-s.x)/c,((t-a)/o-s.y)/c]},eJ.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},i={left:r(`padding-left`),right:r(`padding-right`),top:r(`padding-top`),bottom:r(`padding-bottom`)},a={left:r(`border-left-width`),right:r(`border-right-width`),top:r(`border-top-width`),bottom:r(`border-bottom-width`)},o=e.clientWidth,s=e.clientHeight,c=i.left+i.right,l=i.top+i.bottom,u=a.left+a.right,d=t.width/(o+u),f=o-c,p=s-l,m=t.left+i.left+a.left,h=t.top+i.top+a.top;return this.containerBB=[m,h,f,p,d]},eJ.invalidateContainerClientCoordsCache=function(){this.containerBB=null},eJ.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},eJ.findNearestElements=function(e,t,n,r){var i=this,a=this,o=a.getCachedZSortedEles(),s=[],c=a.cy.zoom(),l=a.cy.hasCompoundNodes(),u=(r?24:8)/c,d=(r?8:2)/c,f=(r?8:2)/c,p=1/0,m,h;n&&(o=o.interactive);function g(e,t){if(e.isNode()){if(h)return;h=e,s.push(e)}if(e.isEdge()&&(t==null||t<p))if(m){if(m.pstyle(`z-compound-depth`).value===e.pstyle(`z-compound-depth`).value&&m.pstyle(`z-compound-depth`).value===e.pstyle(`z-compound-depth`).value){for(var n=0;n<s.length;n++)if(s[n].isEdge()){s[n]=e,m=e,p=t??p;break}}}else s.push(e),m=e,p=t??p}function _(n){var r=n.outerWidth()+2*d,o=n.outerHeight()+2*d,s=r/2,c=o/2,l=n.position(),u=n.pstyle(`corner-radius`).value===`auto`?`auto`:n.pstyle(`corner-radius`).pfValue,f=n._private.rscratch;if(l.x-s<=e&&e<=l.x+s&&l.y-c<=t&&t<=l.y+c&&a.nodeShapes[i.getNodeShape(n)].checkPoint(e,t,0,r,o,l.x,l.y,u,f))return g(n,0),!0}function v(n){var r=n._private,o=r.rscratch,c=n.pstyle(`width`).pfValue,d=n.pstyle(`arrow-scale`).value,f=c/2+u,p=f*f,m=f*2,h=r.source,v=r.target,y;if(o.edgeType===`segments`||o.edgeType===`straight`||o.edgeType===`haystack`){for(var b=o.allpts,x=0;x+3<b.length;x+=2)if(fz(e,t,b[x],b[x+1],b[x+2],b[x+3],m)&&p>(y=_z(e,t,b[x],b[x+1],b[x+2],b[x+3])))return g(n,y),!0}else if(o.edgeType===`bezier`||o.edgeType===`multibezier`||o.edgeType===`self`||o.edgeType===`compound`){for(var b=o.allpts,x=0;x+5<o.allpts.length;x+=4)if(pz(e,t,b[x],b[x+1],b[x+2],b[x+3],b[x+4],b[x+5],m)&&p>(y=gz(e,t,b[x],b[x+1],b[x+2],b[x+3],b[x+4],b[x+5])))return g(n,y),!0}for(var h=h||r.source,v=v||r.target,S=i.getArrowWidth(c,d),C=[{name:`source`,x:o.arrowStartX,y:o.arrowStartY,angle:o.srcArrowAngle},{name:`target`,x:o.arrowEndX,y:o.arrowEndY,angle:o.tgtArrowAngle},{name:`mid-source`,x:o.midX,y:o.midY,angle:o.midsrcArrowAngle},{name:`mid-target`,x:o.midX,y:o.midY,angle:o.midtgtArrowAngle}],x=0;x<C.length;x++){var w=C[x],T=a.arrowShapes[n.pstyle(w.name+`-arrow-shape`).value],E=n.pstyle(`width`).pfValue;if(T.roughCollide(e,t,S,w.angle,{x:w.x,y:w.y},E,u)&&T.collide(e,t,S,w.angle,{x:w.x,y:w.y},E,u))return g(n),!0}l&&s.length>0&&(_(h),_(v))}function y(e,t,n){return tR(e,t,n)}function b(n,r){var i=n._private,a=f,o=r?r+`-`:``;n.boundingBox();var s=i.labelBounds[r||`main`],c=n.pstyle(o+`label`).value;if(!(n.pstyle(`text-events`).strValue!==`yes`||!c)){var l=y(i.rscratch,`labelX`,r),u=y(i.rscratch,`labelY`,r),d=y(i.rscratch,`labelAngle`,r),p=n.pstyle(o+`text-margin-x`).pfValue,m=n.pstyle(o+`text-margin-y`).pfValue,h=s.x1-a-p,_=s.x2+a-p,v=s.y1-a-m,b=s.y2+a-m;if(d){var x=Math.cos(d),S=Math.sin(d),C=function(e,t){return e-=l,t-=u,{x:e*x-t*S+l,y:e*S+t*x+u}},w=C(h,v),T=C(h,b),E=C(_,v),D=C(_,b);if(vz(e,t,[w.x+p,w.y+m,E.x+p,E.y+m,D.x+p,D.y+m,T.x+p,T.y+m]))return g(n),!0}else if(az(s,e,t))return g(n),!0}}for(var x=o.length-1;x>=0;x--){var S=o[x];S.isNode()?_(S)||b(S):v(S)||b(S)||b(S,`source`)||b(S,`target`)}return s},eJ.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=2/this.cy.zoom(),o=[],s=Math.min(e,n),c=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r);e=s,n=c,t=l,r=u;var d=XR({x1:e,y1:t,x2:n,y2:r}),f=[{x:d.x1,y:d.y1},{x:d.x2,y:d.y1},{x:d.x2,y:d.y2},{x:d.x1,y:d.y2}],p=[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]],[f[3],f[0]]];function m(e,t,n){return tR(e,t,n)}function h(e,t){var n=e._private,r=a,i=``;e.boundingBox();var o=n.labelBounds.main;if(!o)return null;var s=m(n.rscratch,`labelX`,t),c=m(n.rscratch,`labelY`,t),l=m(n.rscratch,`labelAngle`,t),u=e.pstyle(i+`text-margin-x`).pfValue,d=e.pstyle(i+`text-margin-y`).pfValue,f=o.x1-r-u,p=o.x2+r-u,h=o.y1-r-d,g=o.y2+r-d;if(l){var _=Math.cos(l),v=Math.sin(l),y=function(e,t){return e-=s,t-=c,{x:e*_-t*v+s,y:e*v+t*_+c}};return[y(f,h),y(p,h),y(p,g),y(f,g)]}else return[{x:f,y:h},{x:p,y:h},{x:p,y:g},{x:f,y:g}]}function g(e,t,n,r){function i(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}return i(e,n,r)!==i(t,n,r)&&i(e,t,n)!==i(e,t,r)}for(var _=0;_<i.length;_++){var v=i[_];if(v.isNode()){var y=v,b=y.pstyle(`text-events`).strValue===`yes`,x=y.pstyle(`box-selection`).strValue,S=y.pstyle(`box-select-labels`).strValue===`yes`;if(x===`none`)continue;var C=(x===`overlap`||S)&&b,w=y.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:C});if(x===`contain`){var T=!1;if(S&&b){var E=h(y);E&&Bz(E,f)&&(o.push(y),T=!0)}!T&&sz(d,w)&&o.push(y)}else if(x===`overlap`&&iz(d,w)){var D=y.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1});if(Bz([{x:D.x1,y:D.y1},{x:D.x2,y:D.y1},{x:D.x2,y:D.y2},{x:D.x1,y:D.y2}],f))o.push(y);else{var O=h(y);O&&Bz(O,f)&&o.push(y)}}}else{var k=v,A=k._private,j=A.rscratch,M=k.pstyle(`box-selection`).strValue;if(M===`none`)continue;if(M===`contain`){if(j.startX!=null&&j.startY!=null&&!az(d,j.startX,j.startY)||j.endX!=null&&j.endY!=null&&!az(d,j.endX,j.endY))continue;if(j.edgeType===`bezier`||j.edgeType===`multibezier`||j.edgeType===`self`||j.edgeType===`compound`||j.edgeType===`segments`||j.edgeType===`haystack`){for(var N=A.rstyle.bezierPts||A.rstyle.linePts||A.rstyle.haystackPts,P=!0,F=0;F<N.length;F++)if(!oz(d,N[F])){P=!1;break}P&&o.push(k)}else j.edgeType===`straight`&&o.push(k)}else if(M===`overlap`){var I=!1;if(j.startX!=null&&j.startY!=null&&j.endX!=null&&j.endY!=null&&(az(d,j.startX,j.startY)||az(d,j.endX,j.endY)))o.push(k),I=!0;else if(!I&&j.edgeType===`haystack`){for(var L=A.rstyle.haystackPts,R=0;R<L.length;R++)if(oz(d,L[R])){o.push(k),I=!0;break}}if(!I){var ee=A.rstyle.bezierPts||A.rstyle.linePts||A.rstyle.haystackPts;if((!ee||ee.length<2)&&j.edgeType===`straight`&&j.startX!=null&&j.startY!=null&&j.endX!=null&&j.endY!=null&&(ee=[{x:j.startX,y:j.startY},{x:j.endX,y:j.endY}]),!ee||ee.length<2)continue;for(var z=0;z<ee.length-1;z++){for(var B=ee[z],V=ee[z+1],H=0;H<p.length;H++){var te=xF(p[H],2),ne=te[0],U=te[1];if(g(B,V,ne,U)){o.push(k),I=!0;break}}if(I)break}}}}}return o};var tJ={};tJ.calculateArrowAngles=function(e){var t=e._private.rscratch,n=t.edgeType===`haystack`,r=t.edgeType===`bezier`,i=t.edgeType===`multibezier`,a=t.edgeType===`segments`,o=t.edgeType===`compound`,s=t.edgeType===`self`,c,l,u,d,f,p,m,h;if(n?(u=t.haystackPts[0],d=t.haystackPts[1],f=t.haystackPts[2],p=t.haystackPts[3]):(u=t.arrowStartX,d=t.arrowStartY,f=t.arrowEndX,p=t.arrowEndY),m=t.midX,h=t.midY,a)c=u-t.segpts[0],l=d-t.segpts[1];else if(i||o||s||r){var g=t.allpts,_=KR(g[0],g[2],g[4],.1),v=KR(g[1],g[3],g[5],.1);c=u-_,l=d-v}else c=u-m,l=d-h;t.srcArrowAngle=BR(c,l);var m=t.midX,h=t.midY;if(n&&(m=(u+f)/2,h=(d+p)/2),c=f-u,l=p-d,a){var g=t.allpts;if(g.length/2%2==0){var y=g.length/2,b=y-2;c=g[y]-g[b],l=g[y+1]-g[b+1]}else if(t.isRound)c=t.midVector[1],l=-t.midVector[0];else{var y=g.length/2-1,b=y-2;c=g[y]-g[b],l=g[y+1]-g[b+1]}}else if(i||o||s){var g=t.allpts,x=t.ctrlpts,S,C,w,T;if(x.length/2%2==0){var E=g.length/2-1,D=E+2,O=D+2;S=KR(g[E],g[D],g[O],0),C=KR(g[E+1],g[D+1],g[O+1],0),w=KR(g[E],g[D],g[O],1e-4),T=KR(g[E+1],g[D+1],g[O+1],1e-4)}else{var D=g.length/2-1,E=D-2,O=D+2;S=KR(g[E],g[D],g[O],.4999),C=KR(g[E+1],g[D+1],g[O+1],.4999),w=KR(g[E],g[D],g[O],.5),T=KR(g[E+1],g[D+1],g[O+1],.5)}c=w-S,l=T-C}if(t.midtgtArrowAngle=BR(c,l),t.midDispX=c,t.midDispY=l,c*=-1,l*=-1,a){var g=t.allpts;if(g.length/2%2!=0&&!t.isRound){var y=g.length/2-1,k=y+2;c=-(g[k]-g[y]),l=-(g[k+1]-g[y+1])}}if(t.midsrcArrowAngle=BR(c,l),a)c=f-t.segpts[t.segpts.length-2],l=p-t.segpts[t.segpts.length-1];else if(i||o||s||r){var g=t.allpts,A=g.length,_=KR(g[A-6],g[A-4],g[A-2],.9),v=KR(g[A-5],g[A-3],g[A-1],.9);c=f-_,l=p-v}else c=f-m,l=p-h;t.tgtArrowAngle=BR(c,l)},tJ.getArrowWidth=tJ.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+`, `+t];return r||(r=Math.max((e*13.37)**.9,29)*t,n[e+`, `+t]=r,r)};var nJ,rJ,iJ={},aJ={},oJ,sJ,cJ,lJ,uJ,dJ,fJ,pJ,mJ,hJ,gJ,_J,vJ,yJ,bJ,xJ=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},SJ=function(e,t){t.x=e.x*-1,t.y=e.y*-1,t.nx=e.nx*-1,t.ny=e.ny*-1,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},CJ=function(e,t,n,r,i){if(e===bJ?SJ(aJ,iJ):xJ(t,e,iJ),xJ(t,n,aJ),oJ=iJ.nx*aJ.ny-iJ.ny*aJ.nx,sJ=iJ.nx*aJ.nx-iJ.ny*-aJ.ny,uJ=Math.asin(Math.max(-1,Math.min(1,oJ))),Math.abs(uJ)<1e-6){nJ=t.x,rJ=t.y,fJ=mJ=0;return}cJ=1,lJ=!1,sJ<0?uJ<0?uJ=Math.PI+uJ:(uJ=Math.PI-uJ,cJ=-1,lJ=!0):uJ>0&&(cJ=-1,lJ=!0),mJ=t.radius===void 0?r:t.radius,dJ=uJ/2,hJ=Math.min(iJ.len/2,aJ.len/2),i?(pJ=Math.abs(Math.cos(dJ)*mJ/Math.sin(dJ)),pJ>hJ?(pJ=hJ,fJ=Math.abs(pJ*Math.sin(dJ)/Math.cos(dJ))):fJ=mJ):(pJ=Math.min(hJ,mJ),fJ=Math.abs(pJ*Math.sin(dJ)/Math.cos(dJ))),vJ=t.x+aJ.nx*pJ,yJ=t.y+aJ.ny*pJ,nJ=vJ-aJ.ny*fJ*cJ,rJ=yJ+aJ.nx*fJ*cJ,gJ=t.x+iJ.nx*pJ,_J=t.y+iJ.ny*pJ,bJ=t};function wJ(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function TJ(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(CJ(e,t,n,r,i),{cx:nJ,cy:rJ,radius:fJ,startX:gJ,startY:_J,stopX:vJ,stopY:yJ,startAngle:iJ.ang+Math.PI/2*cJ,endAngle:aJ.ang-Math.PI/2*cJ,counterClockwise:lJ})}var EJ=.01,DJ=Math.sqrt(2*EJ),OJ={};OJ.findMidptPtsEtc=function(e,t){var n=t.posPts,r=t.intersectionPts,i=t.vectorNormInverse,a,o=e.pstyle(`source-endpoint`),s=e.pstyle(`target-endpoint`),c=o.units!=null&&s.units!=null,l=function(e,t,n,r){var i=r-t,a=n-e,o=Math.sqrt(a*a+i*i);return{x:-i/o,y:a/o}};switch(e.pstyle(`edge-distances`).value){case`node-position`:a=n;break;case`intersection`:a=r;break;case`endpoints`:if(c){var u=xF(this.manualEndptToPx(e.source()[0],o),2),d=u[0],f=u[1],p=xF(this.manualEndptToPx(e.target()[0],s),2),m=p[0],h=p[1],g={x1:d,y1:f,x2:m,y2:h};i=l(d,f,m,h),a=g}else WL(`Edge ${e.id()} has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).`),a=r;break}return{midptPts:a,vectorNormInverse:i}},OJ.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=Math.random()*2*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=Math.random()*2*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var o=r.source,s=r.target,c=o.position(),l=s.position(),u=o.width(),d=s.width(),f=o.height(),p=s.height(),m=n.pstyle(`haystack-radius`).value/2;i.haystackPts=i.allpts=[i.source.x*u*m+c.x,i.source.y*f*m+c.y,i.target.x*d*m+l.x,i.target.y*p*m+l.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType=`haystack`,i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},OJ.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle(`segment-weights`),i=e.pstyle(`segment-distances`),a=e.pstyle(`segment-radii`),o=e.pstyle(`radius-type`),s=Math.min(r.pfValue.length,i.pfValue.length),c=a.pfValue[a.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];n.edgeType=`segments`,n.segpts=[],n.radii=[],n.isArcRadius=[];for(var u=0;u<s;u++){var d=r.pfValue[u],f=i.pfValue[u],p=1-d,m=d,h=this.findMidptPtsEtc(e,t),g=h.midptPts,_=h.vectorNormInverse,v={x:g.x1*p+g.x2*m,y:g.y1*p+g.y2*m};n.segpts.push(v.x+_.x*f,v.y+_.y*f),n.radii.push(a.pfValue[u]===void 0?c:a.pfValue[u]),n.isArcRadius.push((o.pfValue[u]===void 0?l:o.pfValue[u])===`arc-radius`)}},OJ.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle(`control-point-distances`),c=s?s.pfValue[0]:void 0,l=e.pstyle(`loop-direction`).pfValue,u=e.pstyle(`loop-sweep`).pfValue,d=e.pstyle(`control-point-step-size`).pfValue;i.edgeType=`self`;var f=n,p=d;r&&(f=0,p=c);var m=l-Math.PI/2,h=m-u/2,g=m+u/2,_=String(l+`_`+u);f=a[_]===void 0?a[_]=0:++a[_],i.ctrlpts=[o.x+Math.cos(h)*1.4*p*(f/3+1),o.y+Math.sin(h)*1.4*p*(f/3+1),o.x+Math.cos(g)*1.4*p*(f/3+1),o.y+Math.sin(g)*1.4*p*(f/3+1)]},OJ.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType=`compound`;var a=t.srcPos,o=t.tgtPos,s=t.srcW,c=t.srcH,l=t.tgtW,u=t.tgtH,d=e.pstyle(`control-point-step-size`).pfValue,f=e.pstyle(`control-point-distances`),p=f?f.pfValue[0]:void 0,m=n,h=d;r&&(m=0,h=p);var g=50,_={x:a.x-s/2,y:a.y-c/2},v={x:o.x-l/2,y:o.y-u/2},y={x:Math.min(_.x,v.x),y:Math.min(_.y,v.y)},b=.5,x=Math.max(b,Math.log(s*EJ)),S=Math.max(b,Math.log(l*EJ));i.ctrlpts=[y.x,y.y-(1+g**1.12/100)*h*(m/3+1)*x,y.x-(1+g**1.12/100)*h*(m/3+1)*S,y.y]},OJ.findStraightEdgePoints=function(e){e._private.rscratch.edgeType=`straight`},OJ.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=e.pstyle(`control-point-step-size`).pfValue,s=e.pstyle(`control-point-distances`),c=e.pstyle(`control-point-weights`),l=s&&c?Math.min(s.value.length,c.value.length):1,u=s?s.pfValue[0]:void 0,d=c.value[0],f=r;a.edgeType=f?`multibezier`:`bezier`,a.ctrlpts=[];for(var p=0;p<l;p++){var m=(.5-t.eles.length/2+n)*o*(i?-1:1),h=void 0,g=HR(m);f&&(u=s?s.pfValue[p]:o,d=c.value[p]),h=r?u:u===void 0?void 0:g*u;var _=h===void 0?m:h,v=1-d,y=d,b=this.findMidptPtsEtc(e,t),x=b.midptPts,S=b.vectorNormInverse,C={x:x.x1*v+x.x2*y,y:x.y1*v+x.y2*y};a.ctrlpts.push(C.x+S.x*_,C.y+S.y*_)}},OJ.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType=`segments`;var r=`vertical`,i=`horizontal`,a=`leftward`,o=`rightward`,s=`downward`,c=`upward`,l=`auto`,u=t.posPts,d=t.srcW,f=t.srcH,p=t.tgtW,m=t.tgtH,h=e.pstyle(`edge-distances`).value!==`node-position`,g=e.pstyle(`taxi-direction`).value,_=g,v=e.pstyle(`taxi-turn`),y=v.units===`%`,b=v.pfValue,x=b<0,S=e.pstyle(`taxi-turn-min-distance`).pfValue,C=h?(d+p)/2:0,w=h?(f+m)/2:0,T=u.x2-u.x1,E=u.y2-u.y1,D=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},O=D(T,C),k=D(E,w),A=!1;_===l?g=Math.abs(O)>Math.abs(k)?i:r:_===c||_===s?(g=r,A=!0):(_===a||_===o)&&(g=i,A=!0);var j=g===r,M=j?k:O,N=j?E:T,P=HR(N),F=!1;!(A&&(y||x))&&(_===s&&N<0||_===c&&N>0||_===a&&N>0||_===o&&N<0)&&(P*=-1,M=P*Math.abs(M),F=!0);var I=y?(b<0?1+b:b)*M:(b<0?M:0)+b*P,L=function(e){return Math.abs(e)<S||Math.abs(e)>=Math.abs(M)},R=L(I),ee=L(Math.abs(M)-Math.abs(I));if((R||ee)&&!F)if(j){var z=Math.abs(N)<=f/2,B=Math.abs(T)<=p/2;if(z){var V=(u.x1+u.x2)/2;n.segpts=[V,u.y1,V,u.y2]}else if(B){var H=(u.y1+u.y2)/2;n.segpts=[u.x1,H,u.x2,H]}else n.segpts=[u.x1,u.y2]}else{var te=Math.abs(N)<=d/2,ne=Math.abs(E)<=m/2;if(te){var U=(u.y1+u.y2)/2;n.segpts=[u.x1,U,u.x2,U]}else if(ne){var re=(u.x1+u.x2)/2;n.segpts=[re,u.y1,re,u.y2]}else n.segpts=[u.x2,u.y1]}else if(j){var ie=u.y1+I+(h?f/2*P:0);n.segpts=[u.x1,ie,u.x2,ie]}else{var ae=u.x1+I+(h?d/2*P:0);n.segpts=[ae,u.y1,ae,u.y2]}if(n.isRound){var oe=e.pstyle(`taxi-radius`).value,se=e.pstyle(`radius-type`).value[0]===`arc-radius`;n.radii=Array(n.segpts.length/2).fill(oe),n.isArcRadius=Array(n.segpts.length/2).fill(se)}},OJ.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType===`bezier`){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,c=t.tgtH,l=t.srcShape,u=t.tgtShape,d=t.srcCornerRadius,f=t.tgtCornerRadius,p=t.srcRs,m=t.tgtRs,h=!$(n.startX)||!$(n.startY),g=!$(n.arrowStartX)||!$(n.arrowStartY),_=!$(n.endX)||!$(n.endY),v=!$(n.arrowEndX)||!$(n.arrowEndY),y=3*(this.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.arrowShapeWidth),b=UR({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),x=b<y,S=UR({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),C=S<y,w=!1;if(h||g||x){w=!0;var T={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},E=Math.sqrt(T.x*T.x+T.y*T.y),D={x:T.x/E,y:T.y/E},O=Math.max(a,o),k={x:n.ctrlpts[0]+D.x*2*O,y:n.ctrlpts[1]+D.y*2*O},A=l.intersectLine(r.x,r.y,a,o,k.x,k.y,0,d,p);x?(n.ctrlpts[0]=n.ctrlpts[0]+D.x*(y-b),n.ctrlpts[1]=n.ctrlpts[1]+D.y*(y-b)):(n.ctrlpts[0]=A[0]+D.x*y,n.ctrlpts[1]=A[1]+D.y*y)}if(_||v||C){w=!0;var j={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},M=Math.sqrt(j.x*j.x+j.y*j.y),N={x:j.x/M,y:j.y/M},P=Math.max(a,o),F={x:n.ctrlpts[0]+N.x*2*P,y:n.ctrlpts[1]+N.y*2*P},I=u.intersectLine(i.x,i.y,s,c,F.x,F.y,0,f,m);C?(n.ctrlpts[0]=n.ctrlpts[0]+N.x*(y-S),n.ctrlpts[1]=n.ctrlpts[1]+N.y*(y-S)):(n.ctrlpts[0]=I[0]+N.x*y,n.ctrlpts[1]=I[1]+N.y*y)}w&&this.findEndpoints(e)}},OJ.storeAllpts=function(e){var t=e._private.rscratch;if(t.edgeType===`multibezier`||t.edgeType===`bezier`||t.edgeType===`self`||t.edgeType===`compound`){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);t.allpts.push(t.endX,t.endY);var r,i;t.ctrlpts.length/2%2==0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,i=.5,t.midX=KR(t.allpts[r],t.allpts[r+2],t.allpts[r+4],i),t.midY=KR(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],i))}else if(t.edgeType===`straight`)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if(t.edgeType===`segments`){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var a=2;a+3<t.allpts.length;a+=2){var o=t.radii[a/2-1],s=t.isArcRadius[a/2-1];t.roundCorners.push(TJ({x:t.allpts[a-2],y:t.allpts[a-1]},{x:t.allpts[a],y:t.allpts[a+1],radius:o},{x:t.allpts[a+2],y:t.allpts[a+3]},o,s))}}if(t.segpts.length%4==0){var c=t.segpts.length/2,l=c-2;t.midX=(t.segpts[l]+t.segpts[c])/2,t.midY=(t.segpts[l+1]+t.segpts[c+1])/2}else{var u=t.segpts.length/2-1;if(!t.isRound)t.midX=t.segpts[u],t.midY=t.segpts[u+1];else{var d={x:t.segpts[u],y:t.segpts[u+1]},f=t.roundCorners[u/2];if(f.radius===0){var p={x:t.segpts[u+2],y:t.segpts[u+3]};t.midX=d.x,t.midY=d.y,t.midVector=[d.y-p.y,p.x-d.x]}else{var m=[d.x-f.cx,d.y-f.cy],h=f.radius/Math.sqrt(m[0]**2+m[1]**2);m=m.map(function(e){return e*h}),t.midX=f.cx+m[0],t.midY=f.cy+m[1],t.midVector=m}}}}},OJ.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||$(t.startX)&&$(t.startY)&&$(t.endX)&&$(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,WL("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},OJ.findEdgeControlPoints=function(e){var t=this;if(!(!e||e.length===0)){for(var n=this,r=n.cy.hasCompoundNodes(),i=new rR,a=function(e,t){return[].concat(SF(e),[+!!t]).join(`-`)},o=[],s=[],c=0;c<e.length;c++){var l=e[c],u=l._private,d=l.pstyle(`curve-style`).value;if(!(l.removed()||!l.takesUpSpace())){if(d===`haystack`){s.push(l);continue}var f=d===`unbundled-bezier`||rI(d,`segments`)||d===`straight`||d===`straight-triangle`||rI(d,`taxi`),p=d===`unbundled-bezier`||d===`bezier`,m=u.source,h=u.target,g=[m.poolIndex(),h.poolIndex()].sort(),_=a(g,f),v=i.get(_);v??(v={eles:[]},o.push({pairId:g,edgeIsUnbundled:f}),i.set(_,v)),v.eles.push(l),f&&(v.hasUnbundled=!0),p&&(v.hasBezier=!0)}}for(var y=function(){var e=o[b],s=e.pairId,c=e.edgeIsUnbundled,l=a(s,c),u=i.get(l),d;if(!u.hasUnbundled){var f=u.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});$L(u.eles),f.forEach(function(e){return u.eles.push(e)}),u.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var p=u.eles[0],m=p.source(),h=p.target();if(m.poolIndex()>h.poolIndex()){var g=m;m=h,h=g}var _=u.srcPos=m.position(),v=u.tgtPos=h.position(),y=u.srcW=m.outerWidth(),x=u.srcH=m.outerHeight(),S=u.tgtW=h.outerWidth(),C=u.tgtH=h.outerHeight(),w=u.srcShape=n.nodeShapes[t.getNodeShape(m)],T=u.tgtShape=n.nodeShapes[t.getNodeShape(h)],E=u.srcCornerRadius=m.pstyle(`corner-radius`).value===`auto`?`auto`:m.pstyle(`corner-radius`).pfValue,D=u.tgtCornerRadius=h.pstyle(`corner-radius`).value===`auto`?`auto`:h.pstyle(`corner-radius`).pfValue,O=u.tgtRs=h._private.rscratch,k=u.srcRs=m._private.rscratch;u.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var A=0;A<u.eles.length;A++){var j=u.eles[A],M=j[0]._private.rscratch,N=j.pstyle(`curve-style`).value,P=N===`unbundled-bezier`||rI(N,`segments`)||rI(N,`taxi`),F=!m.same(j.source());if(!u.calculatedIntersection&&m!==h&&(u.hasBezier||u.hasUnbundled)){u.calculatedIntersection=!0;var I=w.intersectLine(_.x,_.y,y,x,v.x,v.y,0,E,k),L=u.srcIntn=I,R=T.intersectLine(v.x,v.y,S,C,_.x,_.y,0,D,O),ee=u.tgtIntn=R,z=u.intersectionPts={x1:I[0],x2:R[0],y1:I[1],y2:R[1]},B=u.posPts={x1:_.x,x2:v.x,y1:_.y,y2:v.y},V=R[1]-I[1],H=R[0]-I[0],te=Math.sqrt(H*H+V*V);$(te)&&te>=DJ||(te=Math.sqrt(Math.max(H*H,EJ)+Math.max(V*V,EJ)));var ne=u.vector={x:H,y:V},U=u.vectorNorm={x:ne.x/te,y:ne.y/te},re={x:-U.y,y:U.x};u.nodesOverlap=!$(te)||T.checkPoint(I[0],I[1],0,S,C,v.x,v.y,D,O)||w.checkPoint(R[0],R[1],0,y,x,_.x,_.y,E,k),u.vectorNormInverse=re,d={nodesOverlap:u.nodesOverlap,dirCounts:u.dirCounts,calculatedIntersection:!0,hasBezier:u.hasBezier,hasUnbundled:u.hasUnbundled,eles:u.eles,srcPos:v,srcRs:O,tgtPos:_,tgtRs:k,srcW:S,srcH:C,tgtW:y,tgtH:x,srcIntn:ee,tgtIntn:L,srcShape:T,tgtShape:w,posPts:{x1:B.x2,y1:B.y2,x2:B.x1,y2:B.y1},intersectionPts:{x1:z.x2,y1:z.y2,x2:z.x1,y2:z.y1},vector:{x:-ne.x,y:-ne.y},vectorNorm:{x:-U.x,y:-U.y},vectorNormInverse:{x:-re.x,y:-re.y}}}var ie=F?d:u;M.nodesOverlap=ie.nodesOverlap,M.srcIntn=ie.srcIntn,M.tgtIntn=ie.tgtIntn,M.isRound=N.startsWith(`round`),r&&(m.isParent()||m.isChild()||h.isParent()||h.isChild())&&(m.parents().anySame(h)||h.parents().anySame(m)||m.same(h)&&m.isParent())?t.findCompoundLoopPoints(j,ie,A,P):m===h?t.findLoopPoints(j,ie,A,P):N.endsWith(`segments`)?t.findSegmentsPoints(j,ie):N.endsWith(`taxi`)?t.findTaxiPoints(j,ie):N===`straight`||!P&&u.eles.length%2==1&&A===Math.floor(u.eles.length/2)?t.findStraightEdgePoints(j):t.findBezierPoints(j,ie,A,P,F),t.findEndpoints(j),t.tryToCorrectInvalidPoints(j,ie),t.checkForInvalidEdgeWarning(j),t.storeAllpts(j),t.storeEdgeProjections(j),t.calculateArrowAngles(j),t.recalculateEdgeLabelProjections(j),t.calculateLabelAngles(j)}},b=0;b<o.length;b++)y();this.findHaystackPoints(s)}};function kJ(e){var t=[];if(e!=null){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}OJ.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),t.edgeType===`segments`)return kJ(t.segpts)},OJ.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n===`bezier`||n===`multibezier`||n===`self`||n===`compound`)return kJ(t.ctrlpts)},OJ.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var AJ={};AJ.manualEndptToPx=function(e,t){var n=this,r=e.position(),i=e.outerWidth(),a=e.outerHeight(),o=e._private.rscratch;if(t.value.length===2){var s=[t.pfValue[0],t.pfValue[1]];return t.units[0]===`%`&&(s[0]*=i),t.units[1]===`%`&&(s[1]*=a),s[0]+=r.x,s[1]+=r.y,s}else{var c=t.pfValue[0];c=-Math.PI/2+c;var l=2*Math.max(i,a),u=[r.x+Math.cos(c)*l,r.y+Math.sin(c)*l];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,i,a,u[0],u[1],0,e.pstyle(`corner-radius`).value===`auto`?`auto`:e.pstyle(`corner-radius`).pfValue,o)}},AJ.findEndpoints=function(e){var t,n,r=this,i,a=e.source()[0],o=e.target()[0],s=a.position(),c=o.position(),l=e.pstyle(`target-arrow-shape`).value,u=e.pstyle(`source-arrow-shape`).value,d=e.pstyle(`target-distance-from-node`).pfValue,f=e.pstyle(`source-distance-from-node`).pfValue,p=a._private.rscratch,m=o._private.rscratch,h=e.pstyle(`curve-style`).value,g=e._private.rscratch,_=g.edgeType,v=rI(h,`taxi`),y=_===`self`||_===`compound`,b=_===`bezier`||_===`multibezier`||y,x=_!==`bezier`,S=_===`straight`||_===`segments`,C=_===`segments`,w=b||x||S,T=y||v,E=e.pstyle(`source-endpoint`),D=T?`outside-to-node`:E.value,O=a.pstyle(`corner-radius`).value===`auto`?`auto`:a.pstyle(`corner-radius`).pfValue,k=e.pstyle(`target-endpoint`),A=T?`outside-to-node`:k.value,j=o.pstyle(`corner-radius`).value===`auto`?`auto`:o.pstyle(`corner-radius`).pfValue;g.srcManEndpt=E,g.tgtManEndpt=k;var M,N,P,F,I=((k==null||(t=k.pfValue)==null?void 0:t.length)===2?k.pfValue:null)??[0,0],L=((E==null||(n=E.pfValue)==null?void 0:n.length)===2?E.pfValue:null)??[0,0];if(b){var R=[g.ctrlpts[0],g.ctrlpts[1]];M=x?[g.ctrlpts[g.ctrlpts.length-2],g.ctrlpts[g.ctrlpts.length-1]]:R,N=R}else if(S){var ee=C?g.segpts.slice(0,2):[c.x+I[0],c.y+I[1]];M=C?g.segpts.slice(g.segpts.length-2):[s.x+L[0],s.y+L[1]],N=ee}if(A===`inside-to-node`)i=[c.x,c.y];else if(k.units)i=this.manualEndptToPx(o,k);else if(A===`outside-to-line`)i=g.tgtIntn;else if(A===`outside-to-node`||A===`outside-to-node-or-label`?P=M:(A===`outside-to-line`||A===`outside-to-line-or-label`)&&(P=[s.x,s.y]),i=r.nodeShapes[this.getNodeShape(o)].intersectLine(c.x,c.y,o.outerWidth(),o.outerHeight(),P[0],P[1],0,j,m),A===`outside-to-node-or-label`||A===`outside-to-line-or-label`){var z=o._private.rscratch,B=z.labelWidth,V=z.labelHeight,H=z.labelX,te=z.labelY,ne=B/2,U=V/2,re=o.pstyle(`text-valign`).value;re===`top`?te-=U:re===`bottom`&&(te+=U);var ie=o.pstyle(`text-halign`).value;ie===`left`?H-=ne:ie===`right`&&(H+=ne);var ae=kz(P[0],P[1],[H-ne,te-U,H+ne,te-U,H+ne,te+U,H-ne,te+U],c.x,c.y);if(ae.length>0){var oe=s,se=WR(oe,PR(i)),ce=WR(oe,PR(ae)),le=se;ce<se&&(i=ae,le=ce),ae.length>2&&WR(oe,{x:ae[2],y:ae[3]})<le&&(i=[ae[2],ae[3]])}}var ue=jz(i,M,r.arrowShapes[l].spacing(e)+d),de=jz(i,M,r.arrowShapes[l].gap(e)+d);if(g.endX=de[0],g.endY=de[1],g.arrowEndX=ue[0],g.arrowEndY=ue[1],D===`inside-to-node`)i=[s.x,s.y];else if(E.units)i=this.manualEndptToPx(a,E);else if(D===`outside-to-line`)i=g.srcIntn;else if(D===`outside-to-node`||D===`outside-to-node-or-label`?F=N:(D===`outside-to-line`||D===`outside-to-line-or-label`)&&(F=[c.x,c.y]),i=r.nodeShapes[this.getNodeShape(a)].intersectLine(s.x,s.y,a.outerWidth(),a.outerHeight(),F[0],F[1],0,O,p),D===`outside-to-node-or-label`||D===`outside-to-line-or-label`){var fe=a._private.rscratch,pe=fe.labelWidth,me=fe.labelHeight,he=fe.labelX,ge=fe.labelY,_e=pe/2,ve=me/2,ye=a.pstyle(`text-valign`).value;ye===`top`?ge-=ve:ye===`bottom`&&(ge+=ve);var be=a.pstyle(`text-halign`).value;be===`left`?he-=_e:be===`right`&&(he+=_e);var xe=kz(F[0],F[1],[he-_e,ge-ve,he+_e,ge-ve,he+_e,ge+ve,he-_e,ge+ve],s.x,s.y);if(xe.length>0){var Se=c,Ce=WR(Se,PR(i)),we=WR(Se,PR(xe)),Te=Ce;we<Ce&&(i=[xe[0],xe[1]],Te=we),xe.length>2&&WR(Se,{x:xe[2],y:xe[3]})<Te&&(i=[xe[2],xe[3]])}}var Ee=jz(i,N,r.arrowShapes[u].spacing(e)+f),De=jz(i,N,r.arrowShapes[u].gap(e)+f);g.startX=De[0],g.startY=De[1],g.arrowStartX=Ee[0],g.arrowStartY=Ee[1],w&&(!$(g.startX)||!$(g.startY)||!$(g.endX)||!$(g.endY)?g.badLine=!0:g.badLine=!1)},AJ.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case`haystack`:return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}},AJ.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case`haystack`:return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}};var jJ={};function MJ(e,t,n){for(var r=function(e,t,n,r){return KR(e,t,n,r)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}jJ.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,r===`multibezier`||r===`bezier`||r===`self`||r===`compound`){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)MJ(this,e,n.allpts.slice(i,i+6))}else if(r===`segments`)for(var a=t.rstyle.linePts=[],i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]});else if(r===`haystack`){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.arrowShapeWidth},jJ.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var NJ={};NJ.recalculateNodeLabelProjection=function(e){var t=e.pstyle(`label`).strValue;if(!qF(t)){var n,r,i=e._private,a=e.width(),o=e.height(),s=e.padding(),c=e.position(),l=e.pstyle(`text-halign`).strValue,u=e.pstyle(`text-valign`).strValue,d=i.rscratch,f=i.rstyle;switch(l){case`left`:n=c.x-a/2-s;break;case`right`:n=c.x+a/2+s;break;default:n=c.x}switch(u){case`top`:r=c.y-o/2-s;break;case`bottom`:r=c.y+o/2+s;break;default:r=c.y}d.labelX=n,d.labelY=r,f.labelX=n,f.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var PJ=function(e,t){var n=Math.atan(t/e);return e===0&&n<0&&(n*=-1),n},FJ=function(e,t){return PJ(t.x-e.x,t.y-e.y)},IJ=function(e,t,n,r){var i=YR(0,r-.001,1),a=YR(0,r+.001,1);return FJ(qR(e,t,n,i),qR(e,t,n,a))};NJ.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle(`label`).strValue,source:e.pstyle(`source-label`).strValue,target:e.pstyle(`target-label`).strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){nR(n.rscratch,e,t,r),nR(n.rstyle,e,t,r)};o(`labelX`,null,t.x),o(`labelY`,null,t.y),o(`labelAutoAngle`,null,PJ(r.midDispX,r.midDispY));var s=function(){if(s.cache)return s.cache;for(var e=[],t=0;t+5<r.allpts.length;t+=4){var a={x:r.allpts[t],y:r.allpts[t+1]},o={x:r.allpts[t+2],y:r.allpts[t+3]},c={x:r.allpts[t+4],y:r.allpts[t+5]};e.push({p0:a,p1:o,p2:c,startDist:0,length:0,segments:[]})}var l=n.rstyle.bezierPts,u=i.bezierProjPcts.length;function d(e,t,n,r,i){var a=UR(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var f=0;f<e.length;f++){var p=e[f],m=e[f-1];m&&(p.startDist=m.startDist+m.length),d(p,p.p0,l[f*u],0,i.bezierProjPcts[0]);for(var h=0;h<u-1;h++)d(p,l[f*u+h],l[f*u+h+1],i.bezierProjPcts[h],i.bezierProjPcts[h+1]);d(p,l[f*u+u-1],p.p2,i.bezierProjPcts[u-1],1)}return s.cache=e},c=function(n){var i,c=n===`source`;if(a[n]){var l=e.pstyle(n+`-text-offset`).pfValue;switch(r.edgeType){case`self`:case`compound`:case`bezier`:case`multibezier`:for(var u=s(),d,f=0,p=0,m=0;m<u.length;m++){for(var h=u[c?m:u.length-1-m],g=0;g<h.segments.length;g++){var _=h.segments[c?g:h.segments.length-1-g],v=m===u.length-1&&g===h.segments.length-1;if(f=p,p+=_.length,p>=l||v){d={cp:h,segment:_};break}}if(d)break}var y=d.cp,b=d.segment,x=(l-f)/b.length,S=b.t1-b.t0,C=c?b.t0+S*x:b.t1-S*x;C=YR(0,C,1),t=qR(y.p0,y.p1,y.p2,C),i=IJ(y.p0,y.p1,y.p2,C);break;case`straight`:case`segments`:case`haystack`:for(var w=0,T,E,D,O,k=r.allpts.length,A=0;A+3<k&&(c?(D={x:r.allpts[A],y:r.allpts[A+1]},O={x:r.allpts[A+2],y:r.allpts[A+3]}):(D={x:r.allpts[k-2-A],y:r.allpts[k-1-A]},O={x:r.allpts[k-4-A],y:r.allpts[k-3-A]}),T=UR(D,O),E=w,w+=T,!(w>=l));A+=2);var j=(l-E)/T;j=YR(0,j,1),t=JR(D,O,j),i=FJ(D,O);break}o(`labelX`,n,t.x),o(`labelY`,n,t.y),o(`labelAutoAngle`,n,i)}};c(`source`),c(`target`),this.applyLabelDimensions(e)}},NJ.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,`source`),this.applyPrefixedLabelDimensions(e,`target`))},NJ.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=OL(r,e._private.labelDimsKey);if(tR(n.rscratch,`prefixedLabelDimsKey`,t)!==i){nR(n.rscratch,`prefixedLabelDimsKey`,t,i);var a=this.calculateLabelDimensions(e,r),o=e.pstyle(`line-height`).pfValue,s=e.pstyle(`text-wrap`).strValue,c=tR(n.rscratch,`labelWrapCachedLines`,t)||[],l=s===`wrap`?Math.max(c.length,1):1,u=a.height/l,d=u*o,f=a.width,p=a.height+(l-1)*(o-1)*u;nR(n.rstyle,`labelWidth`,t,f),nR(n.rscratch,`labelWidth`,t,f),nR(n.rstyle,`labelHeight`,t,p),nR(n.rscratch,`labelHeight`,t,p),nR(n.rscratch,`labelLineHeight`,t,d)}},NJ.getLabelText=function(e,t){var n=e._private,r=t?t+`-`:``,i=e.pstyle(r+`label`).strValue,a=e.pstyle(`text-transform`).value,o=function(e,r){return r?(nR(n.rscratch,e,t,r),r):tR(n.rscratch,e,t)};if(!i)return``;a==`none`||(a==`uppercase`?i=i.toUpperCase():a==`lowercase`&&(i=i.toLowerCase()));var s=e.pstyle(`text-wrap`).value;if(s===`wrap`){var c=o(`labelKey`);if(c!=null&&o(`labelWrapKey`)===c)return o(`labelWrapCachedText`);for(var l=``,u=i.split(`
|
|
88
|
-
`),d=e.pstyle(`text-max-width`).pfValue,f=e.pstyle(`text-overflow-wrap`).value===`anywhere`,p=[],m=/[\s\u200b]+|$/g,h=0;h<u.length;h++){var g=u[h],_=this.calculateLabelDimensions(e,g).width;if(f&&(g=g.split(``).join(l)),_>d){var v=g.matchAll(m),y=``,b=0,x=hF(v),S;try{for(x.s();!(S=x.n()).done;){var C=S.value,w=C[0],T=g.substring(b,C.index);b=C.index+w.length;var E=y.length===0?T:y+T+w;this.calculateLabelDimensions(e,E).width<=d?y+=T+w:(y&&p.push(y),y=T+w)}}catch(e){x.e(e)}finally{x.f()}y.match(/^[\s\u200b]+$/)||p.push(y)}else p.push(g)}o(`labelWrapCachedLines`,p),i=o(`labelWrapCachedText`,p.join(`
|
|
89
|
-
`)),o(`labelWrapKey`,c)}else if(s===`ellipsis`){var D=e.pstyle(`text-max-width`).pfValue,O=``,k=`…`,A=!1;if(this.calculateLabelDimensions(e,i).width<D)return i;for(var j=0;j<i.length&&!(this.calculateLabelDimensions(e,O+i[j]+k).width>D);j++)O+=i[j],j===i.length-1&&(A=!0);return A||(O+=k),O}return i},NJ.getLabelJustification=function(e){var t=e.pstyle(`text-justification`).strValue,n=e.pstyle(`text-halign`).strValue;if(t===`auto`)if(e.isNode())switch(n){case`left`:return`right`;case`right`:return`left`;default:return`center`}else return`center`;else return t},NJ.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=0,i=e.pstyle(`font-style`).strValue,a=e.pstyle(`font-size`).pfValue,o=e.pstyle(`font-family`).strValue,s=e.pstyle(`font-weight`).strValue,c=this.labelCalcCanvas,l=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=n.createElement(`canvas`),l=this.labelCalcCanvasContext=c.getContext(`2d`);var u=c.style;u.position=`absolute`,u.left=`-9999px`,u.top=`-9999px`,u.zIndex=`-1`,u.visibility=`hidden`,u.pointerEvents=`none`}l.font=`${i} ${s} ${a}px ${o}`;for(var d=0,f=0,p=t.split(`
|
|
90
|
-
`),m=0;m<p.length;m++){var h=p[m],g=l.measureText(h),_=Math.ceil(g.width),v=a;d=Math.max(_,d),f+=v}return d+=r,f+=r,{width:d,height:f}},NJ.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),i=t?t+`-`:``,a=e.pstyle(i+`text-rotation`),o=a.strValue;return o===`none`?0:r&&o===`autorotate`?n.labelAutoAngle:o===`autorotate`?0:a.pfValue},NJ.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private.rscratch;r.labelAngle=t.calculateLabelAngle(e),n&&(r.sourceLabelAngle=t.calculateLabelAngle(e,`source`),r.targetLabelAngle=t.calculateLabelAngle(e,`target`))};var LJ={},RJ=28,zJ=!1;LJ.getNodeShape=function(e){var t=this,n=e.pstyle(`shape`).value;if(n===`cutrectangle`&&(e.width()<RJ||e.height()<RJ))return zJ||=(WL("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),!0),`rectangle`;if(e.isParent())return n===`rectangle`||n===`roundrectangle`||n===`round-rectangle`||n===`cutrectangle`||n===`cut-rectangle`||n===`barrel`?n:`rectangle`;if(n===`polygon`){var r=e.pstyle(`shape-polygon-points`).value;return t.nodeShapes.makePolygon(r).name}return n};var BJ={};BJ.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(e),n)for(var r=0;r<e.length;r++){var i=e[r]._private.rstyle;i.clean=!1,i.cleanConnected=!1}};n.binder(e).on(`bounds.* dirty.*`,function(e){var t=e.target;r(t)}).on(`style.* background.*`,function(e){var t=e.target;r(t,!1)});var i=function(i){if(i){var a=n.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],c=s._private.rstyle;s.isNode()&&!c.cleanConnected&&(r(s.connectedEdges()),c.cleanConnected=!0)}if(a)for(var l=0;l<a.length;l++){var u=a[l];u(i,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},BJ.onUpdateEleCalcs=function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},BJ.recalculateRenderedStyle=function(e,t){var n=function(e){return e._private.rstyle.cleanConnected};if(e.length!==0){var r=[],i=[];if(!this.destroyed){t===void 0&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,c=s.rstyle;o.isEdge()&&(!n(o.source())||!n(o.target()))&&(c.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(e){return!e._private.rstyle.clean&&e.isBundledBezier()})&&(c.clean=!1),!(t&&c.clean||o.removed())&&o.pstyle(`display`).value!==`none`&&(s.group===`nodes`?i.push(o):r.push(o),c.clean=!0)}for(var l=0;l<i.length;l++){var u=i[l],d=u._private.rstyle,f=u.position();this.recalculateNodeLabelProjection(u),d.nodeX=f.x,d.nodeY=f.y,d.nodeW=u.pstyle(`width`).pfValue,d.nodeH=u.pstyle(`height`).pfValue}this.recalculateEdgeProjections(r);for(var p=0;p<r.length;p++){var m=r[p]._private,h=m.rstyle,g=m.rscratch;h.srcX=g.arrowStartX,h.srcY=g.arrowStartY,h.tgtX=g.arrowEndX,h.tgtY=g.arrowEndY,h.midX=g.midX,h.midY=g.midY,h.labelAngle=g.labelAngle,h.sourceLabelAngle=g.sourceLabelAngle,h.targetLabelAngle=g.targetLabelAngle}}}};var VJ={};VJ.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],i=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):i.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}},VJ.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},VJ.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(eK),t.interactive=t.filter(function(e){return e.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var HJ={};[eJ,tJ,OJ,AJ,jJ,NJ,LJ,BJ,VJ].forEach(function(e){pI(HJ,e)});var UJ={};UJ.getCachedImage=function(e,t,n){var r=this,i=r.imageCache=r.imageCache||{},a=i[e];if(a)return a.image.complete||a.image.addEventListener(`load`,n),a.image;a=i[e]=i[e]||{};var o=a.image=new Image;o.addEventListener(`load`,n),o.addEventListener(`error`,function(){o.error=!0});var s=`data:`;return e.substring(0,s.length).toLowerCase()!==s&&(t=t===`null`?null:t,o.crossOrigin=t),o.src=e,o};var WJ=function(e,t){var n=e[0];!n||n._private.grabbed===t||(n._private.grabbed=t,e.updateStyle(!1))},GJ=function(e){WJ(e,!0)},KJ=function(e){WJ(e,!1)},qJ={};qJ.registerBinding=function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var a=[],o=0;o<e.length;o++){var s=e[o];if(s!==void 0){var c=this.binder(s);a.push(c.on.apply(c,i))}}return a}var c=this.binder(e);return c.on.apply(c,i)},qJ.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||JF(e);if(t.supportsPassiveEvents==null){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});n.addEventListener(`test`,null,a)}catch{}t.supportsPassiveEvents=i}var o=function(n,i,a){var o=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(o[2]={capture:a??!1,passive:!1,once:!1}),t.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},qJ.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},qJ.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},qJ.load=function(){var e=this,t=e.cy.window(),n=function(e){return e.selected()},r=function(e){var t=e.getRootNode();if(t&&t.nodeType===11&&t.host!==void 0)return t},i=function(t,n,r,i){t??=e.cy;for(var a=0;a<n.length;a++){var o=n[a];t.emit({originalEvent:r,type:o,position:i})}},a=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},o=function(t,n){var r=!0;if(e.cy.hasCompoundNodes()&&t&&t.pannable())for(var i=0;n&&i<n.length;i++){var t=n[i];if(t.isNode()&&t.isParent()&&!t.pannable()){r=!1;break}}else r=!0;return r},s=function(e){e[0]._private.rscratch.inDragLayer=!0},c=function(e){e[0]._private.rscratch.inDragLayer=!1},l=function(e){e[0]._private.rscratch.isGrabTarget=!0},u=function(e){e[0]._private.rscratch.isGrabTarget=!1},d=function(e,t){var n=t.addToList;!n.has(e)&&e.grabbable()&&!e.locked()&&(n.merge(e),GJ(e))},f=function(e,t){if(e.cy().hasCompoundNodes()&&!(t.inDragLayer==null&&t.addToList==null)){var n=e.descendants();t.inDragLayer&&(n.forEach(s),n.connectedEdges().forEach(s)),t.addToList&&d(n,t)}},p=function(t,n){n||={};var r=t.cy().hasCompoundNodes();n.inDragLayer&&(t.forEach(s),t.neighborhood().stdFilter(function(e){return!r||e.isEdge()}).forEach(s)),n.addToList&&t.forEach(function(e){d(e,n)}),f(t,n),g(t,{inDragLayer:n.inDragLayer}),e.updateCachedGrabbedEles()},m=p,h=function(t){t&&(e.getCachedZSortedEles().forEach(function(e){KJ(e),c(e),u(e)}),e.updateCachedGrabbedEles())},g=function(e,t){if(!(t.inDragLayer==null&&t.addToList==null)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),i=r.connectedEdges();t.inDragLayer&&(i.forEach(s),r.forEach(s)),t.addToList&&r.forEach(function(e){d(e,t)})}}},_=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},v=typeof MutationObserver<`u`,y=typeof ResizeObserver<`u`;v?(e.removeObserver=new MutationObserver(function(t){for(var n=0;n<t.length;n++){var r=t[n].removedNodes;if(r){for(var i=0;i<r.length;i++)if(r[i]===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,`DOMNodeRemoved`,function(t){e.destroy()});var b=fL(function(){e.cy.resize()},100);v&&(e.styleObserver=new MutationObserver(b),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,`resize`,b),y&&(e.resizeObserver=new ResizeObserver(b),e.resizeObserver.observe(e.container));var x=function(e,t){for(;e!=null;)t(e),e=e.parentNode},S=function(){e.invalidateContainerClientCoordsCache()};x(e.container,function(t){e.registerBinding(t,`transitionend`,S),e.registerBinding(t,`animationend`,S),e.registerBinding(t,`scroll`,S)}),e.registerBinding(e.container,`contextmenu`,function(e){e.preventDefault()});var C=function(){return e.selection[4]!==0},w=function(t){for(var n=e.findContainerClientCoords(),r=n[0],i=n[1],a=n[2],o=n[3],s=t.touches?t.touches:[t],c=!1,l=0;l<s.length;l++){var u=s[l];if(r<=u.clientX&&u.clientX<=r+a&&i<=u.clientY&&u.clientY<=i+o){c=!0;break}}if(!c)return!1;for(var d=e.container,f=t.target.parentNode,p=!1;f;){if(f===d){p=!0;break}f=f.parentNode}return!!p};e.registerBinding(e.container,`mousedown`,function(t){if(w(t)&&!(e.hoverData.which===1&&t.which!==1)){t.preventDefault(),_(),e.hoverData.capture=!0,e.hoverData.which=t.which;var n=e.cy,r=[t.clientX,t.clientY],a=e.projectIntoViewport(r[0],r[1]),o=e.selection,s=e.findNearestElements(a[0],a[1],!0,!1),c=s[0],u=e.dragData.possibleDragElements;e.hoverData.mdownPos=a,e.hoverData.mdownGPos=r;var d=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}},f=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var t=e.hoverData.down;t?t.emit(d(`taphold`)):n.emit(d(`taphold`))}},e.tapholdDuration)};if(t.which==3){e.hoverData.cxtStarted=!0;var h={originalEvent:t,type:`cxttapstart`,position:{x:a[0],y:a[1]}};c?(c.activate(),c.emit(h),e.hoverData.down=c):n.emit(h),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(t.which==1){if(c&&c.activate(),c!=null&&e.nodeIsGrabbable(c)){var g=function(e){e.emit(d(`grab`))};if(l(c),!c.selected())u=e.dragData.possibleDragElements=n.collection(),m(c,{addToList:u}),c.emit(d(`grabon`)).emit(d(`grab`));else{u=e.dragData.possibleDragElements=n.collection();var v=n.$(function(t){return t.isNode()&&t.selected()&&e.nodeIsGrabbable(t)});p(v,{addToList:u}),c.emit(d(`grabon`)),v.forEach(g)}e.redrawHint(`eles`,!0),e.redrawHint(`drag`,!0)}e.hoverData.down=c,e.hoverData.downs=s,e.hoverData.downTime=new Date().getTime(),i(c,[`mousedown`,`tapstart`,`vmousedown`],t,{x:a[0],y:a[1]}),c==null?(o[4]=1,e.data.bgActivePosistion={x:a[0],y:a[1]},e.redrawHint(`select`,!0),e.redraw()):c.pannable()&&(o[4]=1),f()}o[0]=o[2]=a[0],o[1]=o[3]=a[1]}},!1);var T=r(e.container);e.registerBinding([t,T],`mousemove`,function(t){if(!(!e.hoverData.capture&&!w(t))){var n=!1,r=e.cy,s=r.zoom(),c=[t.clientX,t.clientY],l=e.projectIntoViewport(c[0],c[1]),u=e.hoverData.mdownPos,d=e.hoverData.mdownGPos,f=e.selection,m=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(m=e.findNearestElement(l[0],l[1],!0,!1));var g=e.hoverData.last,_=e.hoverData.down,v=[l[0]-f[2],l[1]-f[3]],y=e.dragData.possibleDragElements,b;if(d){var x=c[0]-d[0],S=x*x,C=c[1]-d[1],T=S+C*C;e.hoverData.isOverThresholdDrag=b=T>=e.desktopTapThreshold2}var E=a(t);b&&(e.hoverData.tapholdCancelled=!0);var D=function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];t.length===0?(t.push(v[0]),t.push(v[1])):(t[0]+=v[0],t[1]+=v[1])};n=!0,i(m,[`mousemove`,`vmousemove`,`tapdrag`],t,{x:l[0],y:l[1]});var O=function(e){return{originalEvent:t,type:e,position:{x:l[0],y:l[1]}}},k=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||r.emit(O(`boxstart`)),f[4]=1,e.hoverData.selecting=!0,e.redrawHint(`select`,!0),e.redraw()};if(e.hoverData.which===3){if(b){var A=O(`cxtdrag`);_?_.emit(A):r.emit(A),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||m!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(O(`cxtdragout`)),e.hoverData.cxtOver=m,m&&m.emit(O(`cxtdragover`)))}}else if(e.hoverData.dragging){if(n=!0,r.panningEnabled()&&r.userPanningEnabled()){var j;if(e.hoverData.justStartedPan){var M=e.hoverData.mdownPos;j={x:(l[0]-M[0])*s,y:(l[1]-M[1])*s},e.hoverData.justStartedPan=!1}else j={x:v[0]*s,y:v[1]*s};r.panBy(j),r.emit(O(`dragpan`)),e.hoverData.dragged=!0}l=e.projectIntoViewport(t.clientX,t.clientY)}else if(f[4]==1&&(_==null||_.pannable()))b&&(!e.hoverData.dragging&&r.boxSelectionEnabled()&&(E||!r.panningEnabled()||!r.userPanningEnabled())?k():!e.hoverData.selecting&&r.panningEnabled()&&r.userPanningEnabled()&&o(_,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,f[4]=0,e.data.bgActivePosistion=PR(u),e.redrawHint(`select`,!0),e.redraw()),_&&_.pannable()&&_.active()&&_.unactivate());else{if(_&&_.pannable()&&_.active()&&_.unactivate(),(!_||!_.grabbed())&&m!=g&&(g&&i(g,[`mouseout`,`tapdragout`],t,{x:l[0],y:l[1]}),m&&i(m,[`mouseover`,`tapdragover`],t,{x:l[0],y:l[1]}),e.hoverData.last=m),_)if(b){if(r.boxSelectionEnabled()&&E)_&&_.grabbed()&&(h(y),_.emit(O(`freeon`)),y.emit(O(`free`)),e.dragData.didDrag&&(_.emit(O(`dragfreeon`)),y.emit(O(`dragfree`)))),k();else if(_&&_.grabbed()&&e.nodeIsDraggable(_)){var N=!e.dragData.didDrag;N&&e.redrawHint(`eles`,!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||p(y,{inDragLayer:!0});var P={x:0,y:0};if($(v[0])&&$(v[1])&&(P.x+=v[0],P.y+=v[1],N)){var F=e.hoverData.dragDelta;F&&$(F[0])&&$(F[1])&&(P.x+=F[0],P.y+=F[1])}e.hoverData.draggingEles=!0,y.silentShift(P).emit(O(`position`)).emit(O(`drag`)),e.redrawHint(`drag`,!0),e.redraw()}}else D();n=!0}if(f[2]=l[0],f[3]=l[1],n)return t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1}},!1);var E,D,O;e.registerBinding(t,`mouseup`,function(t){if(!(e.hoverData.which===1&&t.which!==1&&e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var r=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,c=e.findNearestElement(o[0],o[1],!0,!1),l=e.dragData.possibleDragElements,u=e.hoverData.down,d=a(t);e.data.bgActivePosistion&&(e.redrawHint(`select`,!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,u&&u.unactivate();var f=function(e){return{originalEvent:t,type:e,position:{x:o[0],y:o[1]}}};if(e.hoverData.which===3){var p=f(`cxttapend`);if(u?u.emit(p):r.emit(p),!e.hoverData.cxtDragged){var m=f(`cxttap`);u?u.emit(m):r.emit(m)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(i(c,[`mouseup`,`tapend`,`vmouseup`],t,{x:o[0],y:o[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(i(u,[`click`,`tap`,`vclick`],t,{x:o[0],y:o[1]}),D=!1,t.timeStamp-O<=r.multiClickDebounceTime()?(E&&clearTimeout(E),D=!0,O=null,i(u,[`dblclick`,`dbltap`,`vdblclick`],t,{x:o[0],y:o[1]})):(E=setTimeout(function(){D||i(u,[`oneclick`,`onetap`,`voneclick`],t,{x:o[0],y:o[1]})},r.multiClickDebounceTime()),O=t.timeStamp)),u==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(t)&&(r.$(n).unselect([`tapunselect`]),l.length>0&&e.redrawHint(`eles`,!0),e.dragData.possibleDragElements=l=r.collection()),c==u&&!e.dragData.didDrag&&!e.hoverData.selecting&&c!=null&&c._private.selectable&&(e.hoverData.dragging||(r.selectionType()===`additive`||d?c.selected()?c.unselect([`tapunselect`]):c.select([`tapselect`]):d||(r.$(n).unmerge(c).unselect([`tapunselect`]),c.select([`tapselect`]))),e.redrawHint(`eles`,!0)),e.hoverData.selecting){var g=r.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint(`select`,!0),g.length>0&&e.redrawHint(`eles`,!0),r.emit(f(`boxend`)),r.selectionType()===`additive`||d||r.$(n).unmerge(g).unselect(),g.emit(f(`box`)).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(f(`boxselect`)),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint(`select`,!0),e.redrawHint(`eles`,!0),e.redraw()),!s[4]){e.redrawHint(`drag`,!0),e.redrawHint(`eles`,!0);var _=u&&u.grabbed();h(l),_&&(u.emit(f(`freeon`)),l.emit(f(`free`)),e.dragData.didDrag&&(u.emit(f(`dragfreeon`)),l.emit(f(`dragfree`))))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}},!1);var k=[],A=4,j,M=1e5,N=function(e,t){for(var n=0;n<e.length;n++)if(e[n]%t!==0)return!1;return!0},P=function(e){for(var t=Math.abs(e[0]),n=1;n<e.length;n++)if(Math.abs(e[n])!==t)return!1;return!0},F=function(t){var n=!1,r=t.deltaY;if(r??(t.wheelDeltaY==null?t.wheelDelta!=null&&(r=t.wheelDelta/4):r=t.wheelDeltaY/4),r!==0){if(j==null)if(k.length>=A){var i=k;if(j=N(i,5),!j){var a=Math.abs(i[0]);j=P(i)&&a>5}if(j)for(var o=0;o<i.length;o++)M=Math.min(Math.abs(i[o]),M)}else k.push(r),n=!0;else j&&(M=Math.min(Math.abs(r),M));if(!e.scrollingPage){var s=e.cy,c=s.zoom(),l=s.pan(),u=e.projectIntoViewport(t.clientX,t.clientY),d=[u[0]*c+l.x,u[1]*c+l.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||C()){t.preventDefault();return}if(s.panningEnabled()&&s.userPanningEnabled()&&s.zoomingEnabled()&&s.userZoomingEnabled()){t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint(`eles`,!0),e.redraw()},150);var f;n&&Math.abs(r)>5&&(r=HR(r)*5),f=r/-250,j&&(f/=M,f*=3),f*=e.wheelSensitivity,t.deltaMode===1&&(f*=33);var p=s.zoom()*10**f;t.type===`gesturechange`&&(p=e.gestureStartZoom*t.scale),s.zoom({level:p,renderedPosition:{x:d[0],y:d[1]}}),s.emit({type:t.type===`gesturechange`?`pinchzoom`:`scrollzoom`,originalEvent:t,position:{x:u[0],y:u[1]}})}}}};e.registerBinding(e.container,`wheel`,F,!0),e.registerBinding(t,`scroll`,function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,`gesturestart`,function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()},!0),e.registerBinding(e.container,`gesturechange`,function(t){e.hasTouchStarted||F(t)},!0),e.registerBinding(e.container,`mouseout`,function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:`mouseout`,position:{x:n[0],y:n[1]}})},!1),e.registerBinding(e.container,`mouseover`,function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:`mouseover`,position:{x:n[0],y:n[1]}})},!1);var I,L,R,ee,z,B,V,H,te,ne,U,re,ie,ae=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},oe=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)},se;e.registerBinding(e.container,`touchstart`,se=function(t){if(e.hasTouchStarted=!0,w(t)){_(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,r=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);r[0]=o[0],r[1]=o[1]}if(t.touches[1]){var o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);r[2]=o[0],r[3]=o[1]}if(t.touches[2]){var o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);r[4]=o[0],r[5]=o[1]}var s=function(e){return{originalEvent:t,type:e,position:{x:r[0],y:r[1]}}};if(t.touches[1]){e.touchData.singleTouchMoved=!0,h(e.dragData.touchDragEles);var c=e.findContainerClientCoords();te=c[0],ne=c[1],U=c[2],re=c[3],I=t.touches[0].clientX-te,L=t.touches[0].clientY-ne,R=t.touches[1].clientX-te,ee=t.touches[1].clientY-ne,ie=0<=I&&I<=U&&0<=R&&R<=U&&0<=L&&L<=re&&0<=ee&&ee<=re;var u=n.pan(),d=n.zoom();z=ae(I,L,R,ee),B=oe(I,L,R,ee),V=[(I+R)/2,(L+ee)/2],H=[(V[0]-u.x)/d,(V[1]-u.y)/d];var f=200,g=f*f;if(B<g&&!t.touches[2]){var v=e.findNearestElement(r[0],r[1],!0,!0),y=e.findNearestElement(r[2],r[3],!0,!0);v&&v.isNode()?(v.activate().emit(s(`cxttapstart`)),e.touchData.start=v):y&&y.isNode()?(y.activate().emit(s(`cxttapstart`)),e.touchData.start=y):n.emit(s(`cxttapstart`)),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,e.redraw();return}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(!t.touches[1]&&t.touches[0]){var b=e.findNearestElements(r[0],r[1],!0,!0),x=b[0];if(x!=null&&(x.activate(),e.touchData.start=x,e.touchData.starts=b,e.nodeIsGrabbable(x))){var S=e.dragData.touchDragEles=n.collection(),C=null;e.redrawHint(`eles`,!0),e.redrawHint(`drag`,!0),x.selected()?(C=n.$(function(t){return t.selected()&&e.nodeIsGrabbable(t)}),p(C,{addToList:S})):m(x,{addToList:S}),l(x),x.emit(s(`grabon`)),C?C.forEach(function(e){e.emit(s(`grab`))}):x.emit(s(`grab`))}i(x,[`touchstart`,`tapstart`,`vmousedown`],t,{x:r[0],y:r[1]}),x??(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint(`select`,!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved===!1&&!e.pinching&&!e.touchData.selecting&&i(e.touchData.start,[`taphold`],t,{x:r[0],y:r[1]})},e.tapholdDuration)}if(t.touches.length>=1){for(var T=e.touchData.startPosition=[null,null,null,null,null,null],E=0;E<r.length;E++)T[E]=a[E]=r[E];var D=t.touches[0];e.touchData.startGPosition=[D.clientX,D.clientY]}}},!1);var ce;e.registerBinding(t,`touchmove`,ce=function(t){var n=e.touchData.capture;if(!(!n&&!w(t))){var r=e.selection,a=e.cy,s=e.touchData.now,c=e.touchData.earlier,l=a.zoom();if(t.touches[0]){var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=u[0],s[1]=u[1]}if(t.touches[1]){var u=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=u[0],s[3]=u[1]}if(t.touches[2]){var u=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=u[0],s[5]=u[1]}var d=function(e){return{originalEvent:t,type:e,position:{x:s[0],y:s[1]}}},f=e.touchData.startGPosition,m;if(n&&t.touches[0]&&f){for(var g=[],_=0;_<s.length;_++)g[_]=s[_]-c[_];var v=t.touches[0].clientX-f[0],y=v*v,b=t.touches[0].clientY-f[1];m=y+b*b>=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var x=t.touches[0].clientX-te,S=t.touches[0].clientY-ne,C=t.touches[1].clientX-te,T=t.touches[1].clientY-ne,E=oe(x,S,C,T),D=E/B,O=150,k=O*O,A=1.5;if(D>=A*A||E>=k){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);var j=d(`cxttapend`);e.touchData.start?(e.touchData.start.unactivate().emit(j),e.touchData.start=null):a.emit(j)}}if(n&&e.touchData.cxt){var j=d(`cxtdrag`);e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0),e.touchData.start?e.touchData.start.emit(j):a.emit(j),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var M=e.findNearestElement(s[0],s[1],!0,!0);(!e.touchData.cxtOver||M!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit(d(`cxtdragout`)),e.touchData.cxtOver=M,M&&M.emit(d(`cxtdragover`)))}else if(n&&t.touches[2]&&a.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||a.emit(d(`boxstart`)),e.touchData.selecting=!0,e.touchData.didSelect=!0,r[4]=1,!r||r.length===0||r[0]===void 0?(r[0]=(s[0]+s[2]+s[4])/3,r[1]=(s[1]+s[3]+s[5])/3,r[2]=(s[0]+s[2]+s[4])/3+1,r[3]=(s[1]+s[3]+s[5])/3+1):(r[2]=(s[0]+s[2]+s[4])/3,r[3]=(s[1]+s[3]+s[5])/3),e.redrawHint(`select`,!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&a.zoomingEnabled()&&a.panningEnabled()&&a.userZoomingEnabled()&&a.userPanningEnabled()){t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);var N=e.dragData.touchDragEles;if(N){e.redrawHint(`drag`,!0);for(var P=0;P<N.length;P++){var F=N[P]._private;F.grabbed=!1,F.rscratch.inDragLayer=!1}}var V=e.touchData.start,x=t.touches[0].clientX-te,S=t.touches[0].clientY-ne,C=t.touches[1].clientX-te,T=t.touches[1].clientY-ne,U=ae(x,S,C,T),re=U/z;if(ie){var se=x-I,ce=S-L,le=C-R,ue=T-ee,de=(se+le)/2,fe=(ce+ue)/2,pe=a.zoom(),me=pe*re,he=a.pan(),ge=H[0]*pe+he.x,_e=H[1]*pe+he.y,ve={x:-me/pe*(ge-he.x-de)+ge,y:-me/pe*(_e-he.y-fe)+_e};if(V&&V.active()){var N=e.dragData.touchDragEles;h(N),e.redrawHint(`drag`,!0),e.redrawHint(`eles`,!0),V.unactivate().emit(d(`freeon`)),N.emit(d(`free`)),e.dragData.didDrag&&(V.emit(d(`dragfreeon`)),N.emit(d(`dragfree`)))}a.viewport({zoom:me,pan:ve,cancelOnFailedZoom:!0}),a.emit(d(`pinchzoom`)),z=U,I=x,L=S,R=C,ee=T,e.pinching=!0}if(t.touches[0]){var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=u[0],s[1]=u[1]}if(t.touches[1]){var u=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=u[0],s[3]=u[1]}if(t.touches[2]){var u=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=u[0],s[5]=u[1]}}else if(t.touches[0]&&!e.touchData.didSelect){var ye=e.touchData.start,be=e.touchData.last,M;if(!e.hoverData.draggingEles&&!e.swipePanning&&(M=e.findNearestElement(s[0],s[1],!0,!0)),n&&ye!=null&&t.preventDefault(),n&&ye!=null&&e.nodeIsDraggable(ye))if(m){var N=e.dragData.touchDragEles,xe=!e.dragData.didDrag;xe&&p(N,{inDragLayer:!0}),e.dragData.didDrag=!0;var Se={x:0,y:0};if($(g[0])&&$(g[1])&&(Se.x+=g[0],Se.y+=g[1],xe)){e.redrawHint(`eles`,!0);var Ce=e.touchData.dragDelta;Ce&&$(Ce[0])&&$(Ce[1])&&(Se.x+=Ce[0],Se.y+=Ce[1])}e.hoverData.draggingEles=!0,N.silentShift(Se).emit(d(`position`)).emit(d(`drag`)),e.redrawHint(`drag`,!0),e.touchData.startPosition[0]==c[0]&&e.touchData.startPosition[1]==c[1]&&e.redrawHint(`eles`,!0),e.redraw()}else{var Ce=e.touchData.dragDelta=e.touchData.dragDelta||[];Ce.length===0?(Ce.push(g[0]),Ce.push(g[1])):(Ce[0]+=g[0],Ce[1]+=g[1])}if(i(ye||M,[`touchmove`,`tapdrag`,`vmousemove`],t,{x:s[0],y:s[1]}),(!ye||!ye.grabbed())&&M!=be&&(be&&be.emit(d(`tapdragout`)),M&&M.emit(d(`tapdragover`))),e.touchData.last=M,n)for(var P=0;P<s.length;P++)s[P]&&e.touchData.startPosition[P]&&m&&(e.touchData.singleTouchMoved=!0);if(n&&(ye==null||ye.pannable())&&a.panningEnabled()&&a.userPanningEnabled()){o(ye,e.touchData.starts)&&(t.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=PR(e.touchData.startPosition)),e.swipePanning?(a.panBy({x:g[0]*l,y:g[1]*l}),a.emit(d(`dragpan`))):m&&(e.swipePanning=!0,a.panBy({x:v*l,y:b*l}),a.emit(d(`dragpan`)),ye&&(ye.unactivate(),e.redrawHint(`select`,!0),e.touchData.start=null)));var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=u[0],s[1]=u[1]}}for(var _=0;_<s.length;_++)c[_]=s[_];n&&t.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0),e.redraw())}},!1);var le;e.registerBinding(t,`touchcancel`,le=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()});var ue,de,fe,pe;if(e.registerBinding(t,`touchend`,ue=function(t){var r=e.touchData.start;if(e.touchData.capture)t.touches.length===0&&(e.touchData.capture=!1),t.preventDefault();else return;var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o=e.cy,s=o.zoom(),c=e.touchData.now,l=e.touchData.earlier;if(t.touches[0]){var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);c[0]=u[0],c[1]=u[1]}if(t.touches[1]){var u=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);c[2]=u[0],c[3]=u[1]}if(t.touches[2]){var u=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);c[4]=u[0],c[5]=u[1]}var d=function(e){return{originalEvent:t,type:e,position:{x:c[0],y:c[1]}}};r&&r.unactivate();var f;if(e.touchData.cxt){if(f=d(`cxttapend`),r?r.emit(f):o.emit(f),!e.touchData.cxtDragged){var p=d(`cxttap`);r?r.emit(p):o.emit(p)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!t.touches[2]&&o.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var m=o.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint(`select`,!0),o.emit(d(`boxend`)),m.emit(d(`box`)).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(d(`boxselect`)),m.nonempty()&&e.redrawHint(`eles`,!0),e.redraw()}if(r?.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);else if(!t.touches[1]&&!t.touches[0]&&!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);var g=e.dragData.touchDragEles;if(r!=null){var _=r._private.grabbed;h(g),e.redrawHint(`drag`,!0),e.redrawHint(`eles`,!0),_&&(r.emit(d(`freeon`)),g.emit(d(`free`)),e.dragData.didDrag&&(r.emit(d(`dragfreeon`)),g.emit(d(`dragfree`)))),i(r,[`touchend`,`tapend`,`vmouseup`,`tapdragout`],t,{x:c[0],y:c[1]}),r.unactivate(),e.touchData.start=null}else i(e.findNearestElement(c[0],c[1],!0,!0),[`touchend`,`tapend`,`vmouseup`,`tapdragout`],t,{x:c[0],y:c[1]});var v=e.touchData.startPosition[0]-c[0],y=v*v,b=e.touchData.startPosition[1]-c[1],x=(y+b*b)*s*s;e.touchData.singleTouchMoved||(r||o.$(`:selected`).unselect([`tapunselect`]),i(r,[`tap`,`vclick`],t,{x:c[0],y:c[1]}),de=!1,t.timeStamp-pe<=o.multiClickDebounceTime()?(fe&&clearTimeout(fe),de=!0,pe=null,i(r,[`dbltap`,`vdblclick`],t,{x:c[0],y:c[1]})):(fe=setTimeout(function(){de||i(r,[`onetap`,`voneclick`],t,{x:c[0],y:c[1]})},o.multiClickDebounceTime()),pe=t.timeStamp)),r!=null&&!e.dragData.didDrag&&r._private.selectable&&x<e.touchTapThreshold2&&!e.pinching&&(o.selectionType()===`single`?(o.$(n).unmerge(r).unselect([`tapunselect`]),r.select([`tapselect`])):r.selected()?r.unselect([`tapunselect`]):r.select([`tapselect`]),e.redrawHint(`eles`,!0)),e.touchData.singleTouchMoved=!0}for(var S=0;S<c.length;S++)l[S]=c[S];e.dragData.didDrag=!1,t.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),t.touches.length<2&&(t.touches.length===1&&(e.touchData.startGPosition=[t.touches[0].clientX,t.touches[0].clientY]),e.pinching=!1,e.redrawHint(`eles`,!0),e.redraw())},!1),typeof TouchEvent>`u`){var me=[],he=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},ge=function(e){return{event:e,touch:he(e)}},_e=function(e){me.push(ge(e))},ve=function(e){for(var t=0;t<me.length;t++)if(me[t].event.pointerId===e.pointerId){me.splice(t,1);return}},ye=function(e){var t=me.filter(function(t){return t.event.pointerId===e.pointerId})[0];t.event=e,t.touch=he(e)},be=function(e){e.touches=me.map(function(e){return e.touch})},xe=function(e){return e.pointerType===`mouse`||e.pointerType===4};e.registerBinding(e.container,`pointerdown`,function(e){xe(e)||(e.preventDefault(),_e(e),be(e),se(e))}),e.registerBinding(e.container,`pointerup`,function(e){xe(e)||(ve(e),be(e),ue(e))}),e.registerBinding(e.container,`pointercancel`,function(e){xe(e)||(ve(e),be(e),le(e))}),e.registerBinding(e.container,`pointermove`,function(e){xe(e)||(e.preventDefault(),ye(e),be(e),ce(e))})}};var JJ={};JJ.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(`polygon`,e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o,s){return kz(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o,s){return yz(e,t,this.points,a,o,r,i,[0,-1],n)},hasMiterBounds:e!==`rectangle`,miterBounds:function(e,t,n,r,i,a){return uz(this.points,e,t,n,r,i)}}},JJ.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:`ellipse`,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){return Cz(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o,s){return wz(e,t,r,i,a,o,n)}}},JJ.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(e,n,r,i,a,o,s){if(o[s]!==void 0&&o[s+`-cx`]===e&&o[s+`-cy`]===n)return o[s];o[s]=Array(t.length/2),o[s+`-cx`]=e,o[s+`-cy`]=n;var c=r/2,l=i/2;a=a===`auto`?Iz(r,i):a;for(var u=Array(t.length/2),d=0;d<t.length/2;d++)u[d]={x:e+c*t[d*2],y:n+l*t[d*2+1]};var f,p,m,h,g=u.length;for(p=u[g-1],f=0;f<g;f++)m=u[f%g],h=u[(f+1)%g],o[s][f]=TJ(p,m,h,a),p=m,m=h;return o[s]},draw:function(e,t,n,r,i,a,o){this.renderer.nodeShapeImpl(`round-polygon`,e,t,n,r,i,this.points,this.getOrCreateCorners(t,n,r,i,a,o,`drawCorners`))},intersectLine:function(e,t,n,r,i,a,o,s,c){return Az(i,a,this.points,e,t,n,r,o,this.getOrCreateCorners(e,t,n,r,s,c,`corners`))},checkPoint:function(e,t,n,r,i,a,o,s,c){return bz(e,t,this.points,a,o,r,i,this.getOrCreateCorners(a,o,r,i,s,c,`corners`))}}},JJ.generateRoundRectangle=function(){return this.nodeShapes[`round-rectangle`]=this.nodeShapes.roundrectangle={renderer:this,name:`round-rectangle`,points:Mz(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){return dz(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var c=r/2,l=i/2;s=s===`auto`?Fz(r,i):s,s=Math.min(c,l,s);var u=s*2;return!!(yz(e,t,this.points,a,o,r,i-u,[0,-1],n)||yz(e,t,this.points,a,o,r-u,i,[0,-1],n)||wz(e,t,u,u,a-c+s,o-l+s,n)||wz(e,t,u,u,a+c-s,o-l+s,n)||wz(e,t,u,u,a+c-s,o+l-s,n)||wz(e,t,u,u,a-c+s,o+l-s,n))}}},JJ.generateCutRectangle=function(){return this.nodeShapes[`cut-rectangle`]=this.nodeShapes.cutrectangle={renderer:this,name:`cut-rectangle`,cornerLength:Lz(),points:Mz(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,null,a)},generateCutTrianglePts:function(e,t,n,r,i){var a=i===`auto`?this.cornerLength:i,o=t/2,s=e/2,c=n-s,l=n+s,u=r-o,d=r+o;return{topLeft:[c,u+a,c+a,u,c+a,u+a],topRight:[l-a,u,l,u+a,l-a,u+a],bottomRight:[l,d-a,l-a,d,l-a,d-a],bottomLeft:[c+a,d,c,d-a,c+a,d-a]}},intersectLine:function(e,t,n,r,i,a,o,s){var c=this.generateCutTrianglePts(n+2*o,r+2*o,e,t,s);return kz(i,a,[].concat.apply([],[c.topLeft.splice(0,4),c.topRight.splice(0,4),c.bottomRight.splice(0,4),c.bottomLeft.splice(0,4)]),e,t)},checkPoint:function(e,t,n,r,i,a,o,s){var c=s===`auto`?this.cornerLength:s;if(yz(e,t,this.points,a,o,r,i-2*c,[0,-1],n)||yz(e,t,this.points,a,o,r-2*c,i,[0,-1],n))return!0;var l=this.generateCutTrianglePts(r,i,a,o);return vz(e,t,l.topLeft)||vz(e,t,l.topRight)||vz(e,t,l.bottomRight)||vz(e,t,l.bottomLeft)}}},JJ.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:`barrel`,points:Mz(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){var c=.15,l=.5,u=.85,d=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),f=function(e){var t=qR({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},c),n=qR({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},l),r=qR({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},u);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]};return kz(i,a,[].concat(f(d.topLeft),f(d.topRight),f(d.bottomRight),f(d.bottomLeft)),e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,a=e/2,o=n-a,s=n+a,c=r-i,l=r+i,u=zz(e,t),d=u.heightOffset,f=u.widthOffset,p=u.ctrlPtOffsetPct*e,m={topLeft:[o,c+d,o+p,c,o+f,c],topRight:[s-f,c,s-p,c,s,c+d],bottomRight:[s,l-d,s-p,l,s-f,l],bottomLeft:[o+f,l,o+p,l,o,l-d]};return m.topLeft.isTop=!0,m.topRight.isTop=!0,m.bottomLeft.isBottom=!0,m.bottomRight.isBottom=!0,m},checkPoint:function(e,t,n,r,i,a,o,s){var c=zz(r,i),l=c.heightOffset,u=c.widthOffset;if(yz(e,t,this.points,a,o,r,i-2*l,[0,-1],n)||yz(e,t,this.points,a,o,r-2*u,i,[0,-1],n))return!0;for(var d=this.generateBarrelBezierPts(r,i,a,o),f=function(e,t,n){var r=n[4],i=n[2],a=n[0],o=n[5],s=n[1];if(Math.min(r,a)<=e&&e<=Math.max(r,a)&&Math.min(o,s)<=t&&t<=Math.max(o,s)){var c=Rz(r,i,a),l=mz(c[0],c[1],c[2],e).filter(function(e){return 0<=e&&e<=1});if(l.length>0)return l[0]}return null},p=Object.keys(d),m=0;m<p.length;m++){var h=d[p[m]],g=f(e,t,h);if(g!=null){var _=h[5],v=h[3],y=h[1],b=KR(_,v,y,g);if(h.isTop&&b<=t||h.isBottom&&t<=b)return!0}}return!1}}},JJ.generateBottomRoundrectangle=function(){return this.nodeShapes[`bottom-round-rectangle`]=this.nodeShapes.bottomroundrectangle={renderer:this,name:`bottom-round-rectangle`,points:Mz(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){var c=e-(n/2+o),l=t-(r/2+o),u=l,d=Dz(i,a,e,t,c,l,e+(n/2+o),u,!1);return d.length>0?d:dz(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){s=s===`auto`?Fz(r,i):s;var c=2*s;if(yz(e,t,this.points,a,o,r,i-c,[0,-1],n)||yz(e,t,this.points,a,o,r-c,i,[0,-1],n))return!0;var l=r/2+2*n,u=i/2+2*n;return!!(vz(e,t,[a-l,o-u,a-l,o,a+l,o,a+l,o-u])||wz(e,t,c,c,a+r/2-s,o+i/2-s,n)||wz(e,t,c,c,a-r/2+s,o+i/2-s,n))}}},JJ.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon(`triangle`,Mz(3,0)),this.generateRoundPolygon(`round-triangle`,Mz(3,0)),this.generatePolygon(`rectangle`,Mz(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon(`diamond`,n),this.generateRoundPolygon(`round-diamond`,n),this.generatePolygon(`pentagon`,Mz(5,0)),this.generateRoundPolygon(`round-pentagon`,Mz(5,0)),this.generatePolygon(`hexagon`,Mz(6,0)),this.generateRoundPolygon(`round-hexagon`,Mz(6,0)),this.generatePolygon(`heptagon`,Mz(7,0)),this.generateRoundPolygon(`round-heptagon`,Mz(7,0)),this.generatePolygon(`octagon`,Mz(8,0)),this.generateRoundPolygon(`round-octagon`,Mz(8,0));var r=Array(20),i=Pz(5,0),a=Pz(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[s*2]*=o,a[s*2+1]*=o;for(var s=0;s<20/4;s++)r[s*4]=i[s*2],r[s*4+1]=i[s*2+1],r[s*4+2]=a[s*2],r[s*4+3]=a[s*2+1];r=Nz(r),this.generatePolygon(`star`,r),this.generatePolygon(`vee`,[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon(`rhomboid`,[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon(`right-rhomboid`,[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon(`concave-hexagon`,[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var c=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon(`tag`,c),this.generateRoundPolygon(`round-tag`,c),e.makePolygon=function(e){var n=`polygon-`+e.join(`$`),r;return(r=this[n])?r:t.generatePolygon(n,e)}};var YJ={};YJ.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},YJ.redraw=function(e){e||=XL();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},YJ.beforeRender=function(e,t){if(!this.destroyed){t??HL(`Priority is not optional for beforeRender`);var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(e,t){return t.priority-e.priority})}};var XJ=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};YJ.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function(r){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){XJ(e,!0,r);var i=_L();e.render(e.renderOptions);var a=e.lastDrawTime=_L();e.averageRedrawTime===void 0&&(e.averageRedrawTime=a-i),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else XJ(e,!1,r);e.skipFrame=!1,gL(n)}};gL(n)}};var ZJ=function(e){this.init(e)},QJ=ZJ.prototype;QJ.clientFunctions=[`redrawHint`,`render`,`renderTo`,`matchCanvasSize`,`nodeShapeImpl`,`arrowShapeImpl`],QJ.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var i=r.document,a=i.head,o=`__________cytoscape_stylesheet`,s=`__________cytoscape_container`,c=i.getElementById(o)!=null;if(n.className.indexOf(s)<0&&(n.className=(n.className||``)+` `+s),!c){var l=i.createElement(`style`);l.id=o,l.textContent=`.`+s+` { position: relative; }`,a.insertBefore(l,a.children[0])}r.getComputedStyle(n).getPropertyValue(`position`)===`static`&&WL(`A Cytoscape container has style position:static and so can not use UI extensions properly`)}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.webgl=e.webgl,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=$(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},QJ.notify=function(e,t){var n=this,r=n.cy;if(!this.destroyed){if(e===`init`){n.load();return}if(e===`destroy`){n.destroy();return}(e===`add`||e===`remove`||e===`move`&&r.hasCompoundNodes()||e===`load`||e===`zorder`||e===`mount`)&&n.invalidateCachedZSortedEles(),e===`viewport`&&n.redrawHint(`select`,!0),e===`gc`&&n.redrawHint(`gc`,!0),(e===`load`||e===`resize`||e===`mount`)&&(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint(`eles`,!0),n.redrawHint(`drag`,!0),this.startRenderLoop(),this.redraw()}},QJ.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n.target;(r.off||r.removeEventListener).apply(r,n.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch{}},QJ.isHeadless=function(){return!1},[$q,HJ,UJ,qJ,JJ,YJ].forEach(function(e){pI(QJ,e)});var $J=1e3/60,eY={setupDequeueing:function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=fL(function(){n.redrawHint(`eles`,!0),n.redrawHint(`drag`,!0),n.redraw()},e.deqRedrawThreshold),i=function(i,a){var o=_L(),s=n.averageRedrawTime,c=n.lastRedrawTime,l=[],u=n.cy.extent(),d=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var f=_L(),p=f-o,m=f-a;if(c<$J){var h=$J-(i?s:0);if(m>=e.deqFastCost*h)break}else if(i){if(p>=e.deqCost*c||p>=e.deqAvgCost*s)break}else if(m>=e.deqNoDrawCost*$J)break;var g=e.deq(t,d,u);if(g.length>0)for(var _=0;_<g.length;_++)l.push(g[_]);else break}l.length>0&&(e.onDeqd(t,l),!i&&e.shouldRedraw(t,l,d,u)&&r())},a=e.priority||VL;n.beforeRender(i,a(t))}}}},tY=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zL;fF(this,e),this.idsByKey=new rR,this.keyForId=new rR,this.cachesByLvl=new rR,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return mF(e,[{key:`getIdsFor`,value:function(e){e??HL(`Can not get id list for null key`);var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new oR,t.set(e,n)),n}},{key:`addIdForKey`,value:function(e,t){e!=null&&this.getIdsFor(e).add(t)}},{key:`deleteIdForKey`,value:function(e,t){e!=null&&this.getIdsFor(e).delete(t)}},{key:`getNumberOfIdsForKey`,value:function(e){return e==null?0:this.getIdsFor(e).size}},{key:`updateKeyMappingFor`,value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:`deleteKeyMappingFor`,value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:`keyHasChangedFor`,value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:`isInvalid`,value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:`getCachesAt`,value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new rR,t.set(e,r),n.push(e)),r}},{key:`getCache`,value:function(e,t){return this.getCachesAt(t).get(e)}},{key:`get`,value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return r!=null&&this.updateKeyMappingFor(e),r}},{key:`getForCachedKey`,value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:`hasCache`,value:function(e,t){return this.getCachesAt(t).has(e)}},{key:`has`,value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:`setCache`,value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:`set`,value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:`deleteCache`,value:function(e,t){this.getCachesAt(t).delete(e)}},{key:`delete`,value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:`invalidateKey`,value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:`invalidate`,value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||this.getNumberOfIdsForKey(n)===0}}])}(),nY=25,rY=50,iY=-4,aY=3,oY=7.99,sY=8,cY=1024,lY=1024,uY=1024,dY=.2,fY=.8,pY=10,mY=.15,hY=.1,gY=.9,_Y=.9,vY=100,yY=1,bY={dequeue:`dequeue`,downscale:`downscale`,highQuality:`highQuality`},xY=ZL({getKey:null,doesEleInvalidateKey:zL,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:RL,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),SY=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=xY(t);pI(n,r),n.lookup=new tY(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},CY=SY.prototype;CY.reasons=bY,CY.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},CY.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{};return n[e]=n[e]||[]},CY.getElementQueue=function(){var e=this;return e.eleCacheQueue=e.eleCacheQueue||new _R(function(e,t){return t.reqs-e.reqs})},CY.getElementKeyToQueue=function(){var e=this;return e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{}},CY.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),c=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(r??=Math.ceil(VR(s*n)),r<iY)r=iY;else if(s>=oY||r>aY)return null;var l=2**r,u=t.h*l,d=t.w*l,f=o.eleTextBiggerThanMin(e,l);if(!this.isVisible(e,f))return null;var p=c.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;var m=u<=nY?nY:u<=rY?rY:Math.ceil(u/rY)*rY;if(u>uY||d>lY)return null;var h=a.getTextureQueue(m),g=h[h.length-2],_=function(){return a.recycleTexture(m,d)||a.addTexture(m,d)};g||=h[h.length-1],g||=_(),g.width-g.usedWidth<d&&(g=_());for(var v=function(e){return e&&e.scaledLabelShown===f},y=i&&i===bY.dequeue,b=i&&i===bY.highQuality,x=i&&i===bY.downscale,S,C=r+1;C<=aY;C++){var w=c.get(e,C);if(w){S=w;break}}var T=S&&S.level===r+1?S:null,E=function(){g.context.drawImage(T.texture.canvas,T.x,0,T.width,T.height,g.usedWidth,0,d,u)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,d,m),v(T))E();else if(v(S))if(b){for(var D=S.level;D>r;D--)T=a.getElement(e,t,n,D,bY.downscale);E()}else return a.queueElement(e,S.level-1),S;else{var O;if(!y&&!b&&!x)for(var k=r-1;k>=iY;k--){var A=c.get(e,k);if(A){O=A;break}}if(v(O))return a.queueElement(e,r),O;g.context.translate(g.usedWidth,0),g.context.scale(l,l),this.drawElement(g.context,e,t,f,!1),g.context.scale(1/l,1/l),g.context.translate(-g.usedWidth,0)}return p={x:g.usedWidth,texture:g,level:r,scale:l,width:d,height:u,scaledLabelShown:f},g.usedWidth+=Math.ceil(d+sY),g.eleCaches.push(p),c.set(e,r,p),a.checkTextureFullness(g),p},CY.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},CY.invalidateElement=function(e){var t=this,n=t.lookup,r=[];if(n.isInvalid(e)){for(var i=iY;i<=aY;i++){var a=n.getForCachedKey(e,i);a&&r.push(a)}if(n.invalidate(e))for(var o=0;o<r.length;o++){var s=r[o],c=s.texture;c.invalidatedWidth+=s.width,s.invalidated=!0,t.checkTextureUtility(c)}t.removeFromQueue(e)}},CY.checkTextureUtility=function(e){e.invalidatedWidth>=dY*e.width&&this.retireTexture(e)},CY.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>fY&&e.fullnessChecks>=pY?QL(t,e):e.fullnessChecks++},CY.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),i=this.lookup;QL(r,e),e.retired=!0;for(var a=e.eleCaches,o=0;o<a.length;o++){var s=a[o];i.deleteCache(s.key,s.level)}$L(a),t.getRetiredTextureQueue(n).push(e)},CY.addTexture=function(e,t){var n=this,r=n.getTextureQueue(e),i={};return r.push(i),i.eleCaches=[],i.height=e,i.width=Math.max(cY,t),i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,i.canvas=n.renderer.makeOffscreenCanvas(i.width,i.height),i.context=i.canvas.getContext(`2d`),i},CY.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),i=n.getRetiredTextureQueue(e),a=0;a<i.length;a++){var o=i[a];if(o.width>=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,$L(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),QL(i,o),r.push(o),o}},CY.queueElement=function(e,t){var n=this,r=n.getElementQueue(),i=n.getElementKeyToQueue(),a=this.getKey(e),o=i[a];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,r.updateItem(o);else{var s={eles:e.spawn().merge(e),level:t,reqs:1,key:a};r.push(s),i[a]=s}},CY.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],a=t.lookup,o=0;o<yY&&n.size()>0;o++){var s=n.pop(),c=s.key,l=s.eles[0],u=a.hasCache(l,s.level);if(r[c]=null,!u){i.push(s);var d=t.getBoundingBox(l);t.getElement(l,d,e,s.level,bY.dequeue)}}return i},CY.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=this.getKey(e),a=r[i];a!=null&&(a.eles.length===1?(a.reqs=LL,n.updateItem(a),n.pop(),r[i]=null):a.eles.unmerge(e))},CY.onDequeue=function(e){this.onDequeues.push(e)},CY.offDequeue=function(e){QL(this.onDequeues,e)},CY.setupDequeueing=eY.setupDequeueing({deqRedrawThreshold:vY,deqCost:mY,deqAvgCost:hY,deqNoDrawCost:gY,deqFastCost:_Y,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){var r=e.onDequeues[n];r(t)}},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++)if(iz(a[o].boundingBox(),r))return!0;return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var wY=1,TY=-4,EY=2,DY=3.99,OY=50,kY=50,AY=.15,jY=.1,MY=.9,NY=.9,PY=1,FY=250,IY=4e3*4e3,LY=32767,RY=!0,zY=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=_L()-2*FY,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=fL(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},kY),n.beforeRender(function(e,n){n-t.lastInvalidationTime<=FY?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new _R(function(e,t){return t.reqs-e.reqs}),t.setupDequeueing()},BY=zY.prototype,VY=0,HY=2**53-1;BY.makeLayer=function(e,t){var n=2**t,r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),o={id:VY=++VY%HY,bb:e,level:t,width:r,height:i,canvas:a,context:a.getContext(`2d`),eles:[],elesQueue:[],reqs:0},s=o.context,c=-o.bb.x1,l=-o.bb.y1;return s.scale(n,n),s.translate(c,l),o},BY.getLayers=function(e,t,n){var r=this,i=r.renderer.cy.zoom(),a=r.firstGet;if(r.firstGet=!1,n==null){if(n=Math.ceil(VR(i*t)),n<TY)n=TY;else if(i>=DY||n>EY)return null}r.validateLayersElesOrdering(n,e);var o=r.layersByLevel,s=2**n,c=o[n]=o[n]||[],l,u=r.levelIsComplete(n,e),d,f=function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return d=o[t],!0},i=function(e){if(!d)for(var r=n+e;TY<=r&&r<=EY&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var s=c[a];s.invalid&&QL(c,s)}};if(!u)f();else return c;var p=function(){if(!l){l=XR();for(var t=0;t<e.length;t++)$R(l,e[t].boundingBox())}return l},m=function(e){e||={};var t=e.after;p();var i=Math.ceil(l.w*s),a=Math.ceil(l.h*s);if(i>LY||a>LY||i*a>IY)return null;var o=r.makeLayer(l,n);if(t!=null){var u=c.indexOf(t)+1;c.splice(u,0,o)}else (e.insert===void 0||e.insert)&&c.unshift(o);return o};if(r.skipping&&!a)return null;for(var h=null,g=e.length/wY,_=!a,v=0;v<e.length;v++){var y=e[v],b=y._private.rscratch,x=b.imgLayerCaches=b.imgLayerCaches||{},S=x[n];if(S){h=S;continue}if((!h||h.eles.length>=g||!sz(h.bb,y.boundingBox()))&&(h=m({insert:!0,after:h}),!h))return null;d||_?r.queueLayer(h,y):r.drawEleInLayer(h,y,n,t),h.eles.push(y),x[n]=h}return d||(_?null:c)},BY.getEleLevelForLayerLevel=function(e,t){return e},BY.drawEleInLayer=function(e,t,n,r){var i=this,a=this.renderer,o=e.context,s=t.boundingBox();s.w===0||s.h===0||!t.visible()||(n=i.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(o,!1),a.drawCachedElement(o,t,null,null,n,RY),a.setImgSmoothing(o,!0))},BY.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||n.length===0)return!1;for(var r=0,i=0;i<n.length;i++){var a=n[i];if(a.reqs>0||a.invalid)return!1;r+=a.eles.length}return r===t.length},BY.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0){this.invalidateLayer(i);continue}for(var s=a,o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}},BY.updateElementsInLayers=function(e,t){for(var n=this,r=HF(e[0]),i=0;i<e.length;i++)for(var a=r?null:e[i],o=r?e[i]:e[i].ele,s=o._private.rscratch,c=s.imgLayerCaches=s.imgLayerCaches||{},l=TY;l<=EY;l++){var u=c[l];u&&(a&&n.getEleLevelForLayerLevel(u.level)!==a.level||t(u,o,a))}},BY.haveLayers=function(){for(var e=this,t=!1,n=TY;n<=EY;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t},BY.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=_L(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},BY.invalidateLayer=function(e){if(this.lastInvalidationTime=_L(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];QL(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var a=n[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},BY.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(e,n,r){var i=e.replacement;if(i||(i=e.replacement=t.makeLayer(e.bb,e.level),i.replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])})},BY.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},BY.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,i=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;r.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},BY.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],i=0;i<PY&&n.size()!==0;){var a=n.peek();if(a.replacement){n.pop();continue}if(a.replaces&&a!==a.replaces.replacement){n.pop();continue}if(a.invalid){n.pop();continue}var o=a.elesQueue.shift();o&&(t.drawEleInLayer(a,o,a.level,e),i++),r.length===0&&r.push(!0),a.elesQueue.length===0&&(n.pop(),a.reqs=0,a.replaces&&t.applyLayerReplacement(a),t.requestRedraw())}return r},BY.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,i=n.indexOf(r);if(!(i<0||r.invalid)){n[i]=e;for(var a=0;a<e.eles.length;a++){var o=e.eles[a]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[e.level]=e)}t.requestRedraw()}},BY.requestRedraw=fL(function(){var e=this.renderer;e.redrawHint(`eles`,!0),e.redrawHint(`drag`,!0),e.redraw()},100),BY.setupDequeueing=eY.setupDequeueing({deqRedrawThreshold:OY,deqCost:AY,deqAvgCost:jY,deqNoDrawCost:MY,deqFastCost:NY,deq:function(e,t){return e.dequeue(t)},onDeqd:VL,shouldRedraw:RL,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var UY={},WY;function GY(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function KY(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];i===0&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function qY(e,t,n){e.beginPath&&e.beginPath();for(var r=t,i=0;i<r.length;i++){var a=r[i];e.lineTo(a.x,a.y)}var o=n,s=n[0];e.moveTo(s.x,s.y);for(var i=1;i<o.length;i++){var a=o[i];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function JY(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,Math.PI*2,!1);var a=t,o=a[0];e.moveTo(o.x,o.y);for(var s=0;s<a.length;s++){var c=a[s];e.lineTo(c.x,c.y)}e.closePath&&e.closePath()}function YY(e,t,n,r){e.arc(t,n,r,0,Math.PI*2,!1)}UY.arrowShapeImpl=function(e){return(WY||={polygon:GY,"triangle-backcurve":KY,"triangle-tee":qY,"circle-triangle":JY,"triangle-cross":qY,circle:YY})[e]};var XY={};XY.drawElement=function(e,t,n,r,i,a){var o=this;t.isNode()?o.drawNode(e,t,n,r,i,a):o.drawEdge(e,t,n,r,i,a)},XY.drawElementOverlay=function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)},XY.drawElementUnderlay=function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)},XY.drawCachedElementPortion=function(e,t,n,r,i,a,o,s){var c=this,l=n.getBoundingBox(t);if(!(l.w===0||l.h===0)){var u=n.getElement(t,l,r,i,a);if(u!=null){var d=s(c,t);if(d===0)return;var f=o(c,t),p=l.x1,m=l.y1,h=l.w,g=l.h,_,v,y,b,x;if(f!==0){var S=n.getRotationPoint(t);y=S.x,b=S.y,e.translate(y,b),e.rotate(f),x=c.getImgSmoothing(e),x||c.setImgSmoothing(e,!0);var C=n.getRotationOffset(t);_=C.x,v=C.y}else _=p,v=m;var w;d!==1&&(w=e.globalAlpha,e.globalAlpha=w*d),e.drawImage(u.texture.canvas,u.x,0,u.width,u.height,_,v,h,g),d!==1&&(e.globalAlpha=w),f!==0&&(e.rotate(-f),e.translate(-y,-b),x||c.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var ZY=function(){return 0},QY=function(e,t){return e.getTextAngle(t,null)},$Y=function(e,t){return e.getTextAngle(t,`source`)},eX=function(e,t){return e.getTextAngle(t,`target`)},tX=function(e,t){return t.effectiveOpacity()},nX=function(e,t){return t.pstyle(`text-opacity`).pfValue*t.effectiveOpacity()};XY.drawCachedElement=function(e,t,n,r,i,a){var o=this,s=o.data,c=s.eleTxrCache,l=s.lblTxrCache,u=s.slbTxrCache,d=s.tlbTxrCache,f=t.boundingBox(),p=a===!0?c.reasons.highQuality:null;if(!(f.w===0||f.h===0||!t.visible())&&(!r||iz(f,r))){var m=t.isEdge(),h=t.element()._private.rscratch.badLine;o.drawElementUnderlay(e,t),o.drawCachedElementPortion(e,t,c,n,i,p,ZY,tX),(!m||!h)&&o.drawCachedElementPortion(e,t,l,n,i,p,QY,nX),m&&!h&&(o.drawCachedElementPortion(e,t,u,n,i,p,$Y,nX),o.drawCachedElementPortion(e,t,d,n,i,p,eX,nX)),o.drawElementOverlay(e,t)}},XY.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var i=t[r];n.drawElement(e,i)}},XY.drawCachedElements=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var o=t[a];i.drawCachedElement(e,o,n,r)}},XY.drawCachedNodes=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var o=t[a];o.isNode()&&i.drawCachedElement(e,o,n,r)}},XY.drawLayeredElements=function(e,t,n,r){var i=this,a=i.data.lyrTxrCache.getLayers(t,n);if(a)for(var o=0;o<a.length;o++){var s=a[o],c=s.bb;c.w===0||c.h===0||e.drawImage(s.canvas,c.x1,c.y1,c.w,c.h)}else i.drawCachedElements(e,t,n,r)};var rX={};rX.drawEdge=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=t._private.rscratch;if(!(a&&!t.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var c;n&&(c=n,e.translate(-c.x1,-c.y1));var l=a?t.pstyle(`opacity`).value:1,u=a?t.pstyle(`line-opacity`).value:1,d=t.pstyle(`curve-style`).value,f=t.pstyle(`line-style`).value,p=t.pstyle(`width`).pfValue,m=t.pstyle(`line-cap`).value,h=t.pstyle(`line-outline-width`).value,g=t.pstyle(`line-outline-color`).value,_=l*u,v=l*u,y=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_;d===`straight-triangle`?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=m,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,f),e.lineCap=`butt`)},b=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_;if(e.lineWidth=p+h,e.lineCap=m,h>0)o.colorStrokeStyle(e,g[0],g[1],g[2],n);else{e.lineCap=`butt`;return}d===`straight-triangle`?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,f),e.lineCap=`butt`)},x=function(){i&&o.drawEdgeOverlay(e,t)},S=function(){i&&o.drawEdgeUnderlay(e,t)},C=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v;o.drawArrowheads(e,t,n)},w=function(){o.drawElementText(e,t,null,r)};if(e.lineJoin=`round`,t.pstyle(`ghost`).value===`yes`){var T=t.pstyle(`ghost-offset-x`).pfValue,E=t.pstyle(`ghost-offset-y`).pfValue,D=_*t.pstyle(`ghost-opacity`).value;e.translate(T,E),y(D),C(D),e.translate(-T,-E)}else b();S(),y(),C(),x(),w(),n&&e.translate(c.x1,c.y1)}};var iX=function(e){if(![`overlay`,`underlay`].includes(e))throw Error(`Invalid state`);return function(t,n){if(n.visible()){var r=n.pstyle(`${e}-opacity`).value;if(r!==0){var i=this,a=i.usePaths(),o=n._private.rscratch,s=2*n.pstyle(`${e}-padding`).pfValue,c=n.pstyle(`${e}-color`).value;t.lineWidth=s,o.edgeType===`self`&&!a?t.lineCap=`butt`:t.lineCap=`round`,i.colorStrokeStyle(t,c[0],c[1],c[2],r),i.drawEdgePath(n,t,o.allpts,`solid`)}}}};rX.drawEdgeOverlay=iX(`overlay`),rX.drawEdgeUnderlay=iX(`underlay`),rX.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,o,s=!1,c=this.usePaths(),l=e.pstyle(`line-dash-pattern`).pfValue,u=e.pstyle(`line-dash-offset`).pfValue;if(c){var d=n.join(`$`);i.pathCacheKey&&i.pathCacheKey===d?(o=t=i.pathCache,s=!0):(o=t=new Path2D,i.pathCacheKey=d,i.pathCache=o)}if(a.setLineDash)switch(r){case`dotted`:a.setLineDash([1,1]);break;case`dashed`:a.setLineDash(l),a.lineDashOffset=u;break;case`solid`:a.setLineDash([]);break}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case`bezier`:case`self`:case`compound`:case`multibezier`:for(var f=2;f+3<n.length;f+=4)t.quadraticCurveTo(n[f],n[f+1],n[f+2],n[f+3]);break;case`straight`:case`haystack`:for(var p=2;p+1<n.length;p+=2)t.lineTo(n[p],n[p+1]);break;case`segments`:if(i.isRound){var m=hF(i.roundCorners),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;wJ(t,g)}}catch(e){m.e(e)}finally{m.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var _=2;_+1<n.length;_+=2)t.lineTo(n[_],n[_+1]);break}t=a,c?t.stroke(o):t.stroke(),t.setLineDash&&t.setLineDash([])},rX.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle(`width`).pfValue,i=0;i+1<n.length;i+=2){var a=[n[i+2]-n[i],n[i+3]-n[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=[a[1]/o,-a[0]/o],c=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[i]-c[0],n[i+1]-c[1]),t.lineTo(n[i]+c[0],n[i+1]+c[1]),t.lineTo(n[i+2],n[i+3]),t.closePath(),t.fill()}},rX.drawArrowheads=function(e,t,n){var r=t._private.rscratch,i=r.edgeType===`haystack`;i||this.drawArrowhead(e,t,`source`,r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,`mid-target`,r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,`mid-source`,r.midX,r.midY,r.midsrcArrowAngle,n),i||this.drawArrowhead(e,t,`target`,r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},rX.drawArrowhead=function(e,t,n,r,i,a,o){if(!(isNaN(r)||r==null||isNaN(i)||i==null||isNaN(a)||a==null)){var s=this,c=t.pstyle(n+`-arrow-shape`).value;if(c!==`none`){var l=t.pstyle(n+`-arrow-fill`).value===`hollow`?`both`:`filled`,u=t.pstyle(n+`-arrow-fill`).value,d=t.pstyle(`width`).pfValue,f=t.pstyle(n+`-arrow-width`),p=f.value===`match-line`?d:f.pfValue;f.units===`%`&&(p*=d);var m=t.pstyle(`opacity`).value;o===void 0&&(o=m);var h=e.globalCompositeOperation;(o!==1||u===`hollow`)&&(e.globalCompositeOperation=`destination-out`,s.colorFillStyle(e,255,255,255,1),s.colorStrokeStyle(e,255,255,255,1),s.drawArrowShape(t,e,l,d,c,p,r,i,a),e.globalCompositeOperation=h);var g=t.pstyle(n+`-arrow-color`).value;s.colorFillStyle(e,g[0],g[1],g[2],o),s.colorStrokeStyle(e,g[0],g[1],g[2],o),s.drawArrowShape(t,e,u,d,c,p,r,i,a)}}},rX.drawArrowShape=function(e,t,n,r,i,a,o,s,c){var l=this,u=this.usePaths()&&i!==`triangle-cross`,d=!1,f,p=t,m={x:o,y:s},h=e.pstyle(`arrow-scale`).value,g=this.getArrowWidth(r,h),_=l.arrowShapes[i];if(u){var v=l.arrowPathCache=l.arrowPathCache||[],y=OL(i),b=v[y];b==null?(f=t=new Path2D,v[y]=f):(f=t=b,d=!0)}d||(t.beginPath&&t.beginPath(),u?_.draw(t,1,0,{x:0,y:0},1):_.draw(t,g,c,m,r),t.closePath&&t.closePath()),t=p,u&&(t.translate(o,s),t.rotate(c),t.scale(g,g)),(n===`filled`||n===`both`)&&(u?t.fill(f):t.fill()),(n===`hollow`||n===`both`)&&(t.lineWidth=a/(u?g:1),t.lineJoin=`miter`,u?t.stroke(f):t.stroke()),u&&(t.scale(1/g,1/g),t.rotate(-c),t.translate(-o,-s))};var aX={};aX.safeDrawImage=function(e,t,n,r,i,a,o,s,c,l){if(!(i<=0||a<=0||c<=0||l<=0))try{e.drawImage(t,n,r,i,a,o,s,c,l)}catch(e){WL(e)}},aX.drawInscribedImage=function(e,t,n,r,i){var a=this,o=n.position(),s=o.x,c=o.y,l=n.cy().style(),u=l.getIndexedStyle.bind(l),d=u(n,`background-fit`,`value`,r),f=u(n,`background-repeat`,`value`,r),p=n.width(),m=n.height(),h=n.padding()*2,g=p+(u(n,`background-width-relative-to`,`value`,r)===`inner`?0:h),_=m+(u(n,`background-height-relative-to`,`value`,r)===`inner`?0:h),v=n._private.rscratch,y=u(n,`background-clip`,`value`,r)===`node`,b=u(n,`background-image-opacity`,`value`,r)*i,x=u(n,`background-image-smoothing`,`value`,r),S=n.pstyle(`corner-radius`).value;S!==`auto`&&(S=n.pstyle(`corner-radius`).pfValue);var C=t.width||t.cachedW,w=t.height||t.cachedH;(C==null||w==null)&&(document.body.appendChild(t),C=t.cachedW=t.width||t.offsetWidth,w=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var T=C,E=w;if(u(n,`background-width`,`value`,r)!==`auto`&&(T=u(n,`background-width`,`units`,r)===`%`?u(n,`background-width`,`pfValue`,r)*g:u(n,`background-width`,`pfValue`,r)),u(n,`background-height`,`value`,r)!==`auto`&&(E=u(n,`background-height`,`units`,r)===`%`?u(n,`background-height`,`pfValue`,r)*_:u(n,`background-height`,`pfValue`,r)),!(T===0||E===0)){if(d===`contain`){var D=Math.min(g/T,_/E);T*=D,E*=D}else if(d===`cover`){var D=Math.max(g/T,_/E);T*=D,E*=D}var O=s-g/2,k=u(n,`background-position-x`,`units`,r),A=u(n,`background-position-x`,`pfValue`,r);k===`%`?O+=(g-T)*A:O+=A;var j=u(n,`background-offset-x`,`units`,r),M=u(n,`background-offset-x`,`pfValue`,r);j===`%`?O+=(g-T)*M:O+=M;var N=c-_/2,P=u(n,`background-position-y`,`units`,r),F=u(n,`background-position-y`,`pfValue`,r);P===`%`?N+=(_-E)*F:N+=F;var I=u(n,`background-offset-y`,`units`,r),L=u(n,`background-offset-y`,`pfValue`,r);I===`%`?N+=(_-E)*L:N+=L,v.pathCache&&(O-=s,N-=c,s=0,c=0);var R=e.globalAlpha;e.globalAlpha=b;var ee=a.getImgSmoothing(e),z=!1;x===`no`&&ee?(a.setImgSmoothing(e,!1),z=!0):x===`yes`&&!ee&&(a.setImgSmoothing(e,!0),z=!0),f===`no-repeat`?(y&&(e.save(),v.pathCache?e.clip(v.pathCache):(a.nodeShapes[a.getNodeShape(n)].draw(e,s,c,g,_,S,v),e.clip())),a.safeDrawImage(e,t,0,0,C,w,O,N,T,E),y&&e.restore()):(e.fillStyle=e.createPattern(t,f),a.nodeShapes[a.getNodeShape(n)].draw(e,s,c,g,_,S,v),e.translate(O,N),e.fill(),e.translate(-O,-N)),e.globalAlpha=R,z&&a.setImgSmoothing(e,ee)}};var oX={};oX.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio();t=2**Math.ceil(VR(n*r))}return!(e.pstyle(`font-size`).pfValue*t<e.pstyle(`min-zoomed-font-size`).pfValue)},oX.drawElementText=function(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(r==null){if(a&&!o.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var s=t.pstyle(`label`);if(!s||!s.value)return;e.textAlign=o.getLabelJustification(t),e.textBaseline=`bottom`}else{var c=t.element()._private.rscratch.badLine,l=t.pstyle(`label`),u=t.pstyle(`source-label`),d=t.pstyle(`target-label`);if(c||(!l||!l.value)&&(!u||!u.value)&&(!d||!d.value))return;e.textAlign=`center`,e.textBaseline=`bottom`}var f=!n,p;n&&(p=n,e.translate(-p.x1,-p.y1)),i==null?(o.drawText(e,t,null,f,a),t.isEdge()&&(o.drawText(e,t,`source`,f,a),o.drawText(e,t,`target`,f,a))):o.drawText(e,t,i,f,a),n&&e.translate(p.x1,p.y1)},oX.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(t=this.fontCaches[n],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t},oX.setupTextStyle=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=t.pstyle(`font-style`).strValue,i=t.pstyle(`font-size`).pfValue+`px`,a=t.pstyle(`font-family`).strValue,o=t.pstyle(`font-weight`).strValue,s=n?t.effectiveOpacity()*t.pstyle(`text-opacity`).value:1,c=t.pstyle(`text-outline-opacity`).value*s,l=t.pstyle(`color`).value,u=t.pstyle(`text-outline-color`).value;e.font=r+` `+o+` `+i+` `+a,e.lineJoin=`round`,this.colorFillStyle(e,l[0],l[1],l[2],s),this.colorStrokeStyle(e,u[0],u[1],u[2],c)};function sX(e,t,n,r,i){var a=Math.min(r,i)/2,o=t+r/2,s=n+i/2;e.beginPath(),e.arc(o,s,a,0,Math.PI*2),e.closePath()}function cX(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(a,r/2,i/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}oX.getTextAngle=function(e,t){var n,r=e._private.rscratch,i=t?t+`-`:``,a=e.pstyle(i+`text-rotation`);if(a.strValue===`autorotate`){var o=tR(r,`labelAngle`,t);n=e.isEdge()?o:0}else n=a.strValue===`none`?0:a.pfValue;return n},oX.drawText=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!(i&&(o===0||t.pstyle(`text-opacity`).value===0))){n===`main`&&(n=null);var s=tR(a,`labelX`,n),c=tR(a,`labelY`,n),l,u,d=this.getLabelText(t,n);if(d!=null&&d!==``&&!isNaN(s)&&!isNaN(c)){this.setupTextStyle(e,t,i);var f=n?n+`-`:``,p=tR(a,`labelWidth`,n),m=tR(a,`labelHeight`,n),h=t.pstyle(f+`text-margin-x`).pfValue,g=t.pstyle(f+`text-margin-y`).pfValue,_=t.isEdge(),v=t.pstyle(`text-halign`).value,y=t.pstyle(`text-valign`).value;_&&(v=`center`,y=`center`),s+=h,c+=g;var b=r?this.getTextAngle(t,n):0;switch(b!==0&&(l=s,u=c,e.translate(l,u),e.rotate(b),s=0,c=0),y){case`top`:break;case`center`:c+=m/2;break;case`bottom`:c+=m;break}var x=t.pstyle(`text-background-opacity`).value,S=t.pstyle(`text-border-opacity`).value,C=t.pstyle(`text-border-width`).pfValue,w=t.pstyle(`text-background-padding`).pfValue,T=t.pstyle(`text-background-shape`).strValue,E=T===`round-rectangle`||T===`roundrectangle`,D=T===`circle`,O=2;if(x>0||C>0&&S>0){var k=e.fillStyle,A=e.strokeStyle,j=e.lineWidth,M=t.pstyle(`text-background-color`).value,N=t.pstyle(`text-border-color`).value,P=t.pstyle(`text-border-style`).value,F=x>0,I=C>0&&S>0,L=s-w;switch(v){case`left`:L-=p;break;case`center`:L-=p/2;break}var R=c-m-w,ee=p+2*w,z=m+2*w;if(F&&(e.fillStyle=`rgba(${M[0]},${M[1]},${M[2]},${x*o})`),I&&(e.strokeStyle=`rgba(${N[0]},${N[1]},${N[2]},${S*o})`,e.lineWidth=C,e.setLineDash))switch(P){case`dotted`:e.setLineDash([1,1]);break;case`dashed`:e.setLineDash([4,2]);break;case`double`:e.lineWidth=C/4,e.setLineDash([]);break;default:e.setLineDash([]);break}if(E?(e.beginPath(),cX(e,L,R,ee,z,O)):D?(e.beginPath(),sX(e,L,R,ee,z)):(e.beginPath(),e.rect(L,R,ee,z)),F&&e.fill(),I&&e.stroke(),I&&P===`double`){var B=C/2;e.beginPath(),E?cX(e,L+B,R+B,ee-2*B,z-2*B,O):e.rect(L+B,R+B,ee-2*B,z-2*B),e.stroke()}e.fillStyle=k,e.strokeStyle=A,e.lineWidth=j,e.setLineDash&&e.setLineDash([])}var V=2*t.pstyle(`text-outline-width`).pfValue;if(V>0&&(e.lineWidth=V),t.pstyle(`text-wrap`).value===`wrap`){var H=tR(a,`labelWrapCachedLines`,n),te=tR(a,`labelLineHeight`,n),ne=p/2,U=this.getLabelJustification(t);switch(U===`auto`||(v===`left`?U===`left`?s+=-p:U===`center`&&(s+=-ne):v===`center`?U===`left`?s+=-ne:U===`right`&&(s+=ne):v===`right`&&(U===`center`?s+=ne:U===`right`&&(s+=p))),y){case`top`:c-=(H.length-1)*te;break;case`center`:case`bottom`:c-=(H.length-1)*te;break}for(var re=0;re<H.length;re++)V>0&&e.strokeText(H[re],s,c),e.fillText(H[re],s,c),c+=te}else V>0&&e.strokeText(d,s,c),e.fillText(d,s,c);b!==0&&(e.rotate(-b),e.translate(-l,-u))}}};var lX={};lX.drawNode=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,c,l=t._private,u=l.rscratch,d=t.position();if(!(!$(d.x)||!$(d.y))&&!(a&&!t.visible())){var f=a?t.effectiveOpacity():1,p=o.usePaths(),m,h=!1,g=t.padding();s=t.width()+2*g,c=t.height()+2*g;var _;n&&(_=n,e.translate(-_.x1,-_.y1));for(var v=t.pstyle(`background-image`).value,y=Array(v.length),b=Array(v.length),x=0,S=0;S<v.length;S++){var C=v[S];if(y[S]=C!=null&&C!==`none`){var w=t.cy().style().getIndexedStyle(t,`background-image-crossorigin`,`value`,S);x++,b[S]=o.getCachedImage(C,w,function(){l.backgroundTimestamp=Date.now(),t.emitAndNotify(`background`)})}}var T=t.pstyle(`background-blacken`).value,E=t.pstyle(`border-width`).pfValue,D=t.pstyle(`background-opacity`).value*f,O=t.pstyle(`border-color`).value,k=t.pstyle(`border-style`).value,A=t.pstyle(`border-join`).value,j=t.pstyle(`border-cap`).value,M=t.pstyle(`border-position`).value,N=t.pstyle(`border-dash-pattern`).pfValue,P=t.pstyle(`border-dash-offset`).pfValue,F=t.pstyle(`border-opacity`).value*f,I=t.pstyle(`outline-width`).pfValue,L=t.pstyle(`outline-color`).value,R=t.pstyle(`outline-style`).value,ee=t.pstyle(`outline-opacity`).value*f,z=t.pstyle(`outline-offset`).value,B=t.pstyle(`corner-radius`).value;B!==`auto`&&(B=t.pstyle(`corner-radius`).pfValue);var V=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D;o.eleFillStyle(e,t,n)},H=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;o.colorStrokeStyle(e,O[0],O[1],O[2],t)},te=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ee;o.colorStrokeStyle(e,L[0],L[1],L[2],t)},ne=function(e,t,n,r){var i=o.nodePathCache=o.nodePathCache||[],a=kL(n===`polygon`?n+`,`+r.join(`,`):n,``+t,``+e,``+B),s=i[a],c,l=!1;return s==null?(c=new Path2D,i[a]=u.pathCache=c):(c=s,l=!0,u.pathCache=c),{path:c,cacheHit:l}},U=t.pstyle(`shape`).strValue,re=t.pstyle(`shape-polygon-points`).pfValue;if(p){e.translate(d.x,d.y);var ie=ne(s,c,U,re);m=ie.path,h=ie.cacheHit}var ae=function(){if(!h){var n=d;p&&(n={x:0,y:0}),o.nodeShapes[o.getNodeShape(t)].draw(m||e,n.x,n.y,s,c,B,u)}p?e.fill(m):e.fill()},oe=function(){for(var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=l.backgrounding,a=0,s=0;s<b.length;s++){var c=t.cy().style().getIndexedStyle(t,`background-image-containment`,`value`,s);if(r&&c===`over`||!r&&c===`inside`){a++;continue}y[s]&&b[s].complete&&!b[s].error&&(a++,o.drawInscribedImage(e,b[s],t,s,n))}l.backgrounding=a!==x,i!==l.backgrounding&&t.updateStyle(!1)},se=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;o.hasPie(t)&&(o.drawPie(e,t,r),n&&(p||o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,s,c,B,u)))},ce=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;o.hasStripe(t)&&(e.save(),p?e.clip(u.pathCache):(o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,s,c,B,u),e.clip()),o.drawStripe(e,t,r),e.restore(),n&&(p||o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,s,c,B,u)))},le=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f,n=(T>0?T:-T)*t,r=T>0?0:255;T!==0&&(o.colorFillStyle(e,r,r,r,n),p?e.fill(m):e.fill())},ue=function(){if(E>0){if(e.lineWidth=E,e.lineCap=j,e.lineJoin=A,e.setLineDash)switch(k){case`dotted`:e.setLineDash([1,1]);break;case`dashed`:e.setLineDash(N),e.lineDashOffset=P;break;case`solid`:case`double`:e.setLineDash([]);break}if(M!==`center`){if(e.save(),e.lineWidth*=2,M===`inside`)p?e.clip(m):e.clip();else{var t=new Path2D;t.rect(-s/2-E,-c/2-E,s+2*E,c+2*E),t.addPath(m),e.clip(t,`evenodd`)}p?e.stroke(m):e.stroke(),e.restore()}else p?e.stroke(m):e.stroke();if(k===`double`){e.lineWidth=E/3;var n=e.globalCompositeOperation;e.globalCompositeOperation=`destination-out`,p?e.stroke(m):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},de=function(){if(I>0){if(e.lineWidth=I,e.lineCap=`butt`,e.setLineDash)switch(R){case`dotted`:e.setLineDash([1,1]);break;case`dashed`:e.setLineDash([4,2]);break;case`solid`:case`double`:e.setLineDash([]);break}var n=d;p&&(n={x:0,y:0});var r=o.getNodeShape(t),i=E;M===`inside`&&(i=0),M===`outside`&&(i*=2);var a=(s+i+(I+z))/s,l=(c+i+(I+z))/c,u=s*a,f=c*l,m=o.nodeShapes[r].points,h;if(p&&(h=ne(u,f,r,m).path),r===`ellipse`)o.drawEllipsePath(h||e,n.x,n.y,u,f);else if([`round-diamond`,`round-heptagon`,`round-hexagon`,`round-octagon`,`round-pentagon`,`round-polygon`,`round-triangle`,`round-tag`].includes(r)){var g=0,_=0,v=0;r===`round-diamond`?g=(i+z+I)*1.4:r===`round-heptagon`?(g=(i+z+I)*1.075,v=-(i/2+z+I)/35):r===`round-hexagon`?g=(i+z+I)*1.12:r===`round-pentagon`?(g=(i+z+I)*1.13,v=-(i/2+z+I)/15):r===`round-tag`?(g=(i+z+I)*1.12,_=(i/2+I+z)*.07):r===`round-triangle`&&(g=(i+z+I)*(Math.PI/2),v=-(i+z/2+I)/Math.PI),g!==0&&(a=(s+g)/s,u=s*a,[`round-hexagon`,`round-tag`].includes(r)||(l=(c+g)/c,f=c*l)),B=B===`auto`?Iz(u,f):B;for(var y=u/2,b=f/2,x=B+(i+I+z)/2,S=Array(m.length/2),C=Array(m.length/2),w=0;w<m.length/2;w++)S[w]={x:n.x+_+y*m[w*2],y:n.y+v+b*m[w*2+1]};var T,D,O,k,A=S.length;for(D=S[A-1],T=0;T<A;T++)O=S[T%A],k=S[(T+1)%A],C[T]=TJ(D,O,k,x),D=O,O=k;o.drawRoundPolygonPath(h||e,n.x+_,n.y+v,s*a,c*l,m,C)}else if([`roundrectangle`,`round-rectangle`].includes(r))B=B===`auto`?Fz(u,f):B,o.drawRoundRectanglePath(h||e,n.x,n.y,u,f,B+(i+I+z)/2);else if([`cutrectangle`,`cut-rectangle`].includes(r))B=B===`auto`?Lz():B,o.drawCutRectanglePath(h||e,n.x,n.y,u,f,null,B+(i+I+z)/4);else if([`bottomroundrectangle`,`bottom-round-rectangle`].includes(r))B=B===`auto`?Fz(u,f):B,o.drawBottomRoundRectanglePath(h||e,n.x,n.y,u,f,B+(i+I+z)/2);else if(r===`barrel`)o.drawBarrelPath(h||e,n.x,n.y,u,f);else if(r.startsWith(`polygon`)||[`rhomboid`,`right-rhomboid`,`round-tag`,`tag`,`vee`].includes(r)){var j=(i+I+z)/s;m=xz(Sz(m,j)),o.drawPolygonPath(h||e,n.x,n.y,s,c,m)}else{var N=(i+I+z)/s;m=xz(Sz(m,-N)),o.drawPolygonPath(h||e,n.x,n.y,s,c,m)}if(p?e.stroke(h):e.stroke(),R===`double`){e.lineWidth=i/3;var P=e.globalCompositeOperation;e.globalCompositeOperation=`destination-out`,p?e.stroke(h):e.stroke(),e.globalCompositeOperation=P}e.setLineDash&&e.setLineDash([])}},fe=function(){i&&o.drawNodeOverlay(e,t,d,s,c)},pe=function(){i&&o.drawNodeUnderlay(e,t,d,s,c)},me=function(){o.drawElementText(e,t,null,r)};if(t.pstyle(`ghost`).value===`yes`){var he=t.pstyle(`ghost-offset-x`).pfValue,ge=t.pstyle(`ghost-offset-y`).pfValue,_e=t.pstyle(`ghost-opacity`).value,ve=_e*f;e.translate(he,ge),te(),de(),V(_e*D),ae(),oe(ve,!0),H(_e*F),ue(),se(T!==0||E!==0),ce(T!==0||E!==0),oe(ve,!1),le(ve),e.translate(-he,-ge)}p&&e.translate(-d.x,-d.y),pe(),p&&e.translate(d.x,d.y),te(),de(),V(),ae(),oe(f,!0),H(),ue(),se(T!==0||E!==0),ce(T!==0||E!==0),oe(f,!1),le(),p&&e.translate(-d.x,-d.y),me(),fe(),n&&e.translate(_.x1,_.y1)}};var uX=function(e){if(![`overlay`,`underlay`].includes(e))throw Error(`Invalid state`);return function(t,n,r,i,a){var o=this;if(n.visible()){var s=n.pstyle(`${e}-padding`).pfValue,c=n.pstyle(`${e}-opacity`).value,l=n.pstyle(`${e}-color`).value,u=n.pstyle(`${e}-shape`).value,d=n.pstyle(`${e}-corner-radius`).value;if(c>0){if(r||=n.position(),i==null||a==null){var f=n.padding();i=n.width()+2*f,a=n.height()+2*f}o.colorFillStyle(t,l[0],l[1],l[2],c),o.nodeShapes[u].draw(t,r.x,r.y,i+s*2,a+s*2,d),t.fill()}}}};lX.drawNodeOverlay=uX(`overlay`),lX.drawNodeUnderlay=uX(`underlay`),lX.hasPie=function(e){return e=e[0],e._private.hasPie},lX.hasStripe=function(e){return e=e[0],e._private.hasStripe},lX.drawPie=function(e,t,n,r){t=t[0],r||=t.position();var i=t.cy().style(),a=t.pstyle(`pie-size`),o=t.pstyle(`pie-hole`),s=t.pstyle(`pie-start-angle`).pfValue,c=r.x,l=r.y,u=t.width(),d=t.height(),f=Math.min(u,d)/2,p,m=0;if(this.usePaths()&&(c=0,l=0),a.units===`%`?f*=a.pfValue:a.pfValue!==void 0&&(f=a.pfValue/2),o.units===`%`?p=f*o.pfValue:o.pfValue!==void 0&&(p=o.pfValue/2),!(p>=f))for(var h=1;h<=i.pieBackgroundN;h++){var g=t.pstyle(`pie-`+h+`-background-size`).value,_=t.pstyle(`pie-`+h+`-background-color`).value,v=t.pstyle(`pie-`+h+`-background-opacity`).value*n,y=g/100;y+m>1&&(y=1-m);var b=1.5*Math.PI+2*Math.PI*m;b+=s;var x=2*Math.PI*y,S=b+x;g===0||m>=1||m+y>1||(p===0?(e.beginPath(),e.moveTo(c,l),e.arc(c,l,f,b,S),e.closePath()):(e.beginPath(),e.arc(c,l,f,b,S),e.arc(c,l,p,S,b,!0),e.closePath()),this.colorFillStyle(e,_[0],_[1],_[2],v),e.fill(),m+=y)}},lX.drawStripe=function(e,t,n,r){t=t[0],r||=t.position();var i=t.cy().style(),a=r.x,o=r.y,s=t.width(),c=t.height(),l=0,u=this.usePaths();e.save();var d=t.pstyle(`stripe-direction`).value,f=t.pstyle(`stripe-size`);switch(d){case`vertical`:break;case`righward`:e.rotate(-Math.PI/2);break}var p=s,m=c;f.units===`%`?(p*=f.pfValue,m*=f.pfValue):f.pfValue!==void 0&&(p=f.pfValue,m=f.pfValue),u&&(a=0,o=0),o-=p/2,a-=m/2;for(var h=1;h<=i.stripeBackgroundN;h++){var g=t.pstyle(`stripe-`+h+`-background-size`).value,_=t.pstyle(`stripe-`+h+`-background-color`).value,v=t.pstyle(`stripe-`+h+`-background-opacity`).value*n,y=g/100;y+l>1&&(y=1-l),!(g===0||l>=1||l+y>1)&&(e.beginPath(),e.rect(a,o+m*l,p,m*y),e.closePath(),this.colorFillStyle(e,_[0],_[1],_[2],v),e.fill(),l+=y)}e.restore()};var dX={},fX=100;dX.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},dX.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],n=!0,r,i=0;i<t.length;i++)if(r=t[i],r.context===e){n=!1;break}return n&&(r={context:e},t.push(r)),r},dX.createGradientStyleFor=function(e,t,n,r,i){var a,o=this.usePaths(),s=n.pstyle(t+`-gradient-stop-colors`).value,c=n.pstyle(t+`-gradient-stop-positions`).pfValue;if(r===`radial-gradient`)if(n.isEdge()){var l=n.sourceEndpoint(),u=n.targetEndpoint(),d=n.midpoint(),f=UR(l,d),p=UR(u,d);a=e.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(f,p))}else{var m=o?{x:0,y:0}:n.position(),h=n.paddedWidth(),g=n.paddedHeight();a=e.createRadialGradient(m.x,m.y,0,m.x,m.y,Math.max(h,g))}else if(n.isEdge()){var _=n.sourceEndpoint(),v=n.targetEndpoint();a=e.createLinearGradient(_.x,_.y,v.x,v.y)}else{var y=o?{x:0,y:0}:n.position(),b=n.paddedWidth(),x=n.paddedHeight(),S=b/2,C=x/2;switch(n.pstyle(`background-gradient-direction`).value){case`to-bottom`:a=e.createLinearGradient(y.x,y.y-C,y.x,y.y+C);break;case`to-top`:a=e.createLinearGradient(y.x,y.y+C,y.x,y.y-C);break;case`to-left`:a=e.createLinearGradient(y.x+S,y.y,y.x-S,y.y);break;case`to-right`:a=e.createLinearGradient(y.x-S,y.y,y.x+S,y.y);break;case`to-bottom-right`:case`to-right-bottom`:a=e.createLinearGradient(y.x-S,y.y-C,y.x+S,y.y+C);break;case`to-top-right`:case`to-right-top`:a=e.createLinearGradient(y.x-S,y.y+C,y.x+S,y.y-C);break;case`to-bottom-left`:case`to-left-bottom`:a=e.createLinearGradient(y.x+S,y.y-C,y.x-S,y.y+C);break;case`to-top-left`:case`to-left-top`:a=e.createLinearGradient(y.x+S,y.y+C,y.x-S,y.y-C);break}}if(!a)return null;for(var w=c.length===s.length,T=s.length,E=0;E<T;E++)a.addColorStop(w?c[E]:E/(T-1),`rgba(`+s[E][0]+`,`+s[E][1]+`,`+s[E][2]+`,`+i+`)`);return a},dX.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,`background`,t,n,r);if(!i)return null;e.fillStyle=i},dX.colorFillStyle=function(e,t,n,r,i){e.fillStyle=`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`},dX.eleFillStyle=function(e,t,n){var r=t.pstyle(`background-fill`).value;if(r===`linear-gradient`||r===`radial-gradient`)this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle(`background-color`).value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},dX.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,`line`,t,n,r);if(!i)return null;e.strokeStyle=i},dX.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle=`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`},dX.eleStrokeStyle=function(e,t,n){var r=t.pstyle(`line-fill`).value;if(r===`linear-gradient`||r===`radial-gradient`)this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle(`line-color`).value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},dX.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),i=r[2],a=r[3],o=t.getPixelRatio(),s=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var c=i*o,l=a*o,u;if(!(c===t.canvasWidth&&l===t.canvasHeight)){t.fontCaches=null;var d=n.canvasContainer;d.style.width=i+`px`,d.style.height=a+`px`;for(var f=0;f<t.CANVAS_LAYERS;f++)u=n.canvases[f],u.width=c,u.height=l,u.style.width=i+`px`,u.style.height=a+`px`;for(var f=0;f<t.BUFFER_COUNT;f++)u=n.bufferCanvases[f],u.width=c,u.height=l,u.style.width=i+`px`,u.style.height=a+`px`;t.textureMult=1,o<=1&&(u=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,u.width=c*t.textureMult,u.height=l*t.textureMult),t.canvasWidth=c,t.canvasHeight=l,t.pixelRatio=o}},dX.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},dX.clearCanvas=function(){var e=this,t=e.data;function n(t){t.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])},dX.render=function(e){var t=this;e||=XL();var n=t.cy,r=e.forcedContext,i=e.drawAllLayers,a=e.drawOnlyNodeLayer,o=e.forcedZoom,s=e.forcedPan,c=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,l=t.data,u=l.canvasNeedsRedraw,d=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),f=e.motionBlur===void 0?t.motionBlur:e.motionBlur,p=t.motionBlurPxRatio,m=n.hasCompoundNodes(),h=t.hoverData.draggingEles,g=!!(t.hoverData.selecting||t.touchData.selecting);f=f&&!r&&t.motionBlurEnabled&&!g;var _=f;r||(t.prevPxRatio!==c&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint(`eles`,!0),t.redrawHint(`drag`,!0)),t.prevPxRatio=c),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),f&&(t.mbFrames??=0,t.mbFrames++,t.mbFrames<3&&(_=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!d&&(u[t.NODE]=!0,u[t.SELECT_BOX]=!0);var v=n.style(),y=n.zoom(),b=o===void 0?y:o,x=n.pan(),S={x:x.x,y:x.y},C={zoom:y,pan:{x:x.x,y:x.y}},w=t.prevViewport;!(w===void 0||C.zoom!==w.zoom||C.pan.x!==w.pan.x||C.pan.y!==w.pan.y)&&!(h&&!m)&&(t.motionBlurPxRatio=1),s&&(S=s),b*=c,S.x*=c,S.y*=c;var T=t.getCachedZSortedEles();function E(e,n,r,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation=`destination-out`,t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,i,a),e.globalCompositeOperation=o}function D(e,n){var a,c,u,d;!t.clearingMotionBlur&&(e===l.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]||e===l.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG])?(a={x:x.x*p,y:x.y*p},c=y*p,u=t.canvasWidth*p,d=t.canvasHeight*p):(a=S,c=b,u=t.canvasWidth,d=t.canvasHeight),e.setTransform(1,0,0,1,0,0),n===`motionBlur`?E(e,0,0,u,d):!r&&(n===void 0||n)&&e.clearRect(0,0,u,d),i||(e.translate(a.x,a.y),e.scale(c,c)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(d||(t.textureDrawLastFrame=!1),d){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var O=t.data.bufferContexts[t.TEXTURE_BUFFER];O.setTransform(1,0,0,1,0,0),O.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:O,drawOnlyNodeLayer:!0,forcedPxRatio:c*t.textureMult});var C=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};C.mpan={x:(0-C.pan.x)/C.zoom,y:(0-C.pan.y)/C.zoom}}u[t.DRAG]=!1,u[t.NODE]=!1;var k=l.contexts[t.NODE],A=t.textureCache.texture,C=t.textureCache.viewport;k.setTransform(1,0,0,1,0,0),f?E(k,0,0,C.width,C.height):k.clearRect(0,0,C.width,C.height);var j=v.core(`outside-texture-bg-color`).value,M=v.core(`outside-texture-bg-opacity`).value;t.colorFillStyle(k,j[0],j[1],j[2],M),k.fillRect(0,0,C.width,C.height);var y=n.zoom();D(k,!1),k.clearRect(C.mpan.x,C.mpan.y,C.width/C.zoom/c,C.height/C.zoom/c),k.drawImage(A,C.mpan.x,C.mpan.y,C.width/C.zoom/c,C.height/C.zoom/c)}else t.textureOnViewport&&!r&&(t.textureCache=null);var N=n.extent(),P=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),F=t.hideEdgesOnViewport&&P,I=[];if(I[t.NODE]=!u[t.NODE]&&f&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,I[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),I[t.DRAG]=!u[t.DRAG]&&f&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,I[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),u[t.NODE]||i||a||I[t.NODE]){var L=f&&!I[t.NODE]&&p!==1,k=r||(L?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:l.contexts[t.NODE]);D(k,f&&!L?`motionBlur`:void 0),F?t.drawCachedNodes(k,T.nondrag,c,N):t.drawLayeredElements(k,T.nondrag,c,N),t.debug&&t.drawDebugPoints(k,T.nondrag),!i&&!f&&(u[t.NODE]=!1)}if(!a&&(u[t.DRAG]||i||I[t.DRAG])){var L=f&&!I[t.DRAG]&&p!==1,k=r||(L?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:l.contexts[t.DRAG]);D(k,f&&!L?`motionBlur`:void 0),F?t.drawCachedNodes(k,T.drag,c,N):t.drawCachedElements(k,T.drag,c,N),t.debug&&t.drawDebugPoints(k,T.drag),!i&&!f&&(u[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,D),f&&p!==1){var R=l.contexts[t.NODE],ee=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],z=l.contexts[t.DRAG],B=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],V=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!_?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):E(e,0,0,t.canvasWidth,t.canvasHeight);var i=p;e.drawImage(n,0,0,t.canvasWidth*i,t.canvasHeight*i,0,0,t.canvasWidth,t.canvasHeight)};(u[t.NODE]||I[t.NODE])&&(V(R,ee,I[t.NODE]),u[t.NODE]=!1),(u[t.DRAG]||I[t.DRAG])&&(V(z,B,I[t.DRAG]),u[t.DRAG]=!1)}t.prevViewport=C,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),f&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!d,t.mbFrames=0,u[t.NODE]=!0,u[t.DRAG]=!0,t.redraw()},fX)),r||n.emit(`render`)};var pX;dX.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,i=n.data,a=r.style(),o=e.drawOnlyNodeLayer,s=e.drawAllLayers,c=i.canvasNeedsRedraw,l=e.forcedContext;if(n.showFps||!o&&c[n.SELECT_BOX]&&!s){var u=l||i.contexts[n.SELECT_BOX];if(t(u),n.selection[4]==1&&(n.hoverData.selecting||n.touchData.selecting)){var d=n.cy.zoom(),f=a.core(`selection-box-border-width`).value/d;u.lineWidth=f,u.fillStyle=`rgba(`+a.core(`selection-box-color`).value[0]+`,`+a.core(`selection-box-color`).value[1]+`,`+a.core(`selection-box-color`).value[2]+`,`+a.core(`selection-box-opacity`).value+`)`,u.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),f>0&&(u.strokeStyle=`rgba(`+a.core(`selection-box-border-color`).value[0]+`,`+a.core(`selection-box-border-color`).value[1]+`,`+a.core(`selection-box-border-color`).value[2]+`,`+a.core(`selection-box-opacity`).value+`)`,u.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(i.bgActivePosistion&&!n.hoverData.selecting){var d=n.cy.zoom(),p=i.bgActivePosistion;u.fillStyle=`rgba(`+a.core(`active-bg-color`).value[0]+`,`+a.core(`active-bg-color`).value[1]+`,`+a.core(`active-bg-color`).value[2]+`,`+a.core(`active-bg-opacity`).value+`)`,u.beginPath(),u.arc(p.x,p.y,a.core(`active-bg-size`).pfValue/d,0,2*Math.PI),u.fill()}var m=n.lastRedrawTime;if(n.showFps&&m){m=Math.round(m);var h=Math.round(1e3/m),g=`1 frame = `+m+` ms = `+h+` fps`;u.setTransform(1,0,0,1,0,0),u.fillStyle=`rgba(255, 0, 0, 0.75)`,u.strokeStyle=`rgba(255, 0, 0, 0.75)`,u.font=`30px Arial`,pX||=u.measureText(g).actualBoundingBoxAscent,u.fillText(g,0,pX),u.strokeRect(0,pX+10,250,20),u.fillRect(0,pX+10,250*Math.min(h/60,1),20)}s||(c[n.SELECT_BOX]=!1)}};function mX(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw Error(e.getShaderInfoLog(r));return r}function hX(e,t,n){var r=mX(e,e.VERTEX_SHADER,t),i=mX(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw Error(`Could not initialize shaders`);return a}function gX(e,t,n){n===void 0&&(n=t);var r=e.makeOffscreenCanvas(t,n),i=r.context=r.getContext(`2d`);return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function _X(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function vX(e){var t=e.pixelRatio;return e.cy.zoom()*t}function yX(e,t,n,r,i){var a=r*n+t.x,o=i*n+t.y;return o=Math.round(e.canvasHeight-o),[a,o]}function bX(e,t){return t.picking?!0:e.pstyle(`background-fill`).value!==`solid`||e.pstyle(`background-image`).strValue!==`none`?!1:e.pstyle(`border-width`).value===0||e.pstyle(`border-opacity`).value===0?!0:e.pstyle(`border-style`).value===`solid`}function xX(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function SX(e,t,n){var r=e[0]/255,i=e[1]/255,a=e[2]/255,o=t,s=n||[,,,,];return s[0]=r*o,s[1]=i*o,s[2]=a*o,s[3]=o,s}function CX(e,t){var n=t||[,,,,];return n[0]=(e>>0&255)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function wX(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function TX(e,t){var n=e.createTexture();return n.buffer=function(t){e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},n.deleteTexture=function(){e.deleteTexture(n)},n}function EX(e,t){switch(t){case`float`:return[1,e.FLOAT,4];case`vec2`:return[2,e.FLOAT,4];case`vec3`:return[3,e.FLOAT,4];case`vec4`:return[4,e.FLOAT,4];case`int`:return[1,e.INT,4];case`ivec2`:return[2,e.INT,4]}}function DX(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function OX(e,t,n,r,i,a){switch(t){case e.FLOAT:return new Float32Array(n.buffer,a*r,i);case e.INT:return new Int32Array(n.buffer,a*r,i)}}function kX(e,t,n,r){var i=xF(EX(e,t),2),a=i[0],o=i[1],s=DX(e,o,r),c=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,s,e.STATIC_DRAW),o===e.FLOAT?e.vertexAttribPointer(n,a,o,!1,0,0):o===e.INT&&e.vertexAttribIPointer(n,a,o,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,null),c}function AX(e,t,n,r){var i=xF(EX(e,n),3),a=i[0],o=i[1],s=i[2],c=DX(e,o,t*a),l=a*s,u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,t*l,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,a,o,!1,l,0):o===e.INT&&e.vertexAttribIPointer(r,a,o,l,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var d=Array(t),f=0;f<t;f++)d[f]=OX(e,o,c,l,a,f);return u.dataArray=c,u.stride=l,u.size=a,u.getView=function(e){return d[e]},u.setPoint=function(e,t,n){var r=d[e];r[0]=t,r[1]=n},u.bufferSubData=function(t){e.bindBuffer(e.ARRAY_BUFFER,u),t?e.bufferSubData(e.ARRAY_BUFFER,0,c,0,t*a):e.bufferSubData(e.ARRAY_BUFFER,0,c)},u}function jX(e,t,n){for(var r=9,i=new Float32Array(t*r),a=Array(t),o=0;o<t;o++){var s=o*r*4;a[o]=new Float32Array(i.buffer,s,r)}var c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,i.byteLength,e.DYNAMIC_DRAW);for(var l=0;l<3;l++){var u=n+l;e.enableVertexAttribArray(u),e.vertexAttribPointer(u,3,e.FLOAT,!1,36,l*12),e.vertexAttribDivisor(u,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),c.getMatrixView=function(e){return a[e]},c.setData=function(e,t){a[t].set(e,0)},c.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferSubData(e.ARRAY_BUFFER,0,i)},c}function MX(e){var t=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,t);var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.bindFramebuffer(e.FRAMEBUFFER,null),t.setFramebufferAttachmentSizes=function(t,r){e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null)},t}var NX=typeof Float32Array<`u`?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function PX(){var e=new NX(9);return NX!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function FX(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function IX(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=n[0],p=n[1],m=n[2],h=n[3],g=n[4],_=n[5],v=n[6],y=n[7],b=n[8];return e[0]=f*r+p*o+m*l,e[1]=f*i+p*s+m*u,e[2]=f*a+p*c+m*d,e[3]=h*r+g*o+_*l,e[4]=h*i+g*s+_*u,e[5]=h*a+g*c+_*d,e[6]=v*r+y*o+b*l,e[7]=v*i+y*s+b*u,e[8]=v*a+y*c+b*d,e}function LX(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=n[0],p=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e[6]=f*r+p*o+l,e[7]=f*i+p*s+u,e[8]=f*a+p*c+d,e}function RX(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=Math.sin(n),p=Math.cos(n);return e[0]=p*r+f*o,e[1]=p*i+f*s,e[2]=p*a+f*c,e[3]=p*o-f*r,e[4]=p*s-f*i,e[5]=p*c-f*a,e[6]=l,e[7]=u,e[8]=d,e}function zX(e,t,n){var r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function BX(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}var VX=function(){function e(t,n,r,i){fF(this,e),this.debugID=Math.floor(Math.random()*1e4),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(t,n,n),this.scratch=i(t,n,this.texHeight,`scratch`)}return mF(e,[{key:`lock`,value:function(){this.locked=!0}},{key:`getKeys`,value:function(){return new Set(this.keyToLocation.keys())}},{key:`getScale`,value:function(e){var t=e.w,n=e.h,r=this.texHeight,i=this.texSize,a=r/n,o=t*a,s=n*a;return o>i&&(a=i/t,o=t*a,s=n*a),{scale:a,texW:o,texH:s}}},{key:`draw`,value:function(e,t,n){var r=this;if(this.locked)throw Error(`can't draw, atlas is locked`);var i=this.texSize,a=this.texRows,o=this.texHeight,s=this.getScale(t),c=s.scale,l=s.texW,u=s.texH,d=function(e,r){if(n&&r){var i=r.context,a=e.x,s=e.row,l=a,u=o*s;i.save(),i.translate(l,u),i.scale(c,c),n(i,t),i.restore()}},f=[null,null],p=function(){d(r.freePointer,r.canvas),f[0]={x:r.freePointer.x,y:r.freePointer.row*o,w:l,h:u},f[1]={x:r.freePointer.x+l,y:r.freePointer.row*o,w:0,h:u},r.freePointer.x+=l,r.freePointer.x==i&&(r.freePointer.x=0,r.freePointer.row++)},m=function(){var e=r.scratch,t=r.canvas;e.clear(),d({x:0,row:0},e);var n=i-r.freePointer.x,a=l-n,s=o,c=r.freePointer.x,p=r.freePointer.row*o,m=n;t.context.drawImage(e,0,0,m,s,c,p,m,s),f[0]={x:c,y:p,w:m,h:u};var h=n,g=(r.freePointer.row+1)*o,_=a;t&&t.context.drawImage(e,h,0,_,s,0,g,_,s),f[1]={x:0,y:g,w:_,h:u},r.freePointer.x=a,r.freePointer.row++},h=function(){r.freePointer.x=0,r.freePointer.row++};if(this.freePointer.x+l<=i)p();else if(this.freePointer.row>=a-1)return!1;else this.freePointer.x===i?(h(),p()):this.enableWrapping?m():(h(),p());return this.keyToLocation.set(e,f),this.needsBuffer=!0,f}},{key:`getOffsets`,value:function(e){return this.keyToLocation.get(e)}},{key:`isEmpty`,value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:`canFit`,value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return this.freePointer.x+r>t?this.freePointer.row<n-1:!0}},{key:`bufferIfNeeded`,value:function(e){this.texture||=TX(e,this.debugID),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:`dispose`,value:function(){this.texture&&=(this.texture.deleteTexture(),null),this.canvas=null,this.scratch=null,this.locked=!0}}])}(),HX=function(){function e(t,n,r,i){fF(this,e),this.r=t,this.texSize=n,this.texRows=r,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return mF(e,[{key:`getKeys`,value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:`_createAtlas`,value:function(){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas;return new VX(e,t,n,r)}},{key:`_getScratchCanvas`,value:function(){if(!this.scratch){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas,i=Math.floor(t/n);this.scratch=r(e,t,i,`scratch`)}return this.scratch}},{key:`draw`,value:function(e,t,n){var r=this.styleKeyToAtlas.get(e);return r||(r=this.atlases[this.atlases.length-1],(!r||!r.canFit(t))&&(r&&r.lock(),r=this._createAtlas(),this.atlases.push(r)),r.draw(e,t,n),this.styleKeyToAtlas.set(e,r)),r}},{key:`getAtlas`,value:function(e){return this.styleKeyToAtlas.get(e)}},{key:`hasAtlas`,value:function(e){return this.styleKeyToAtlas.has(e)}},{key:`markKeyForGC`,value:function(e){this.markedKeys.add(e)}},{key:`gc`,value:function(){var e=this,t=this.markedKeys;if(t.size===0){console.log(`nothing to garbage collect`);return}var n=[],r=new Map,i=null,a=hF(this.atlases),o;try{var s=function(){var a=o.value,s=a.getKeys(),c=UX(t,s);if(c.size===0)return n.push(a),s.forEach(function(e){return r.set(e,a)}),1;i||(i=e._createAtlas(),n.push(i));var l=hF(s),u;try{for(l.s();!(u=l.n()).done;){var d=u.value;if(!c.has(d)){var f=xF(a.getOffsets(d),2),p=f[0],m=f[1];i.canFit({w:p.w+m.w,h:p.h})||(i.lock(),i=e._createAtlas(),n.push(i)),a.canvas&&(e._copyTextureToNewAtlas(d,a,i),r.set(d,i))}}}catch(e){l.e(e)}finally{l.f()}a.dispose()};for(a.s();!(o=a.n()).done;)if(s())continue}catch(e){a.e(e)}finally{a.f()}this.atlases=n,this.styleKeyToAtlas=r,this.markedKeys=new Set}},{key:`_copyTextureToNewAtlas`,value:function(e,t,n){var r=xF(t.getOffsets(e),2),i=r[0],a=r[1];if(a.w===0)n.draw(e,i,function(e){e.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h)});else{var o=this._getScratchCanvas();o.clear(),o.context.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h),o.context.drawImage(t.canvas,a.x,a.y,a.w,a.h,i.w,0,a.w,a.h);var s=i.w+a.w,c=i.h;n.draw(e,{w:s,h:c},function(e){e.drawImage(o,0,0,s,c,0,0,s,c)})}}},{key:`getCounts`,value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();function UX(e,t){return e.intersection?e.intersection(t):new Set(SF(e).filter(function(e){return t.has(e)}))}var WX=function(){function e(t,n){fF(this,e),this.r=t,this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return mF(e,[{key:`getAtlasSize`,value:function(){return this.atlasSize}},{key:`addAtlasCollection`,value:function(e,t){var n=this.globalOptions,r=n.webglTexSize,i=n.createTextureCanvas,a=t.texRows,o=this._cacheScratchCanvas(i),s=new HX(this.r,r,a,o);this.collections.set(e,s)}},{key:`addRenderType`,value:function(e,t){var n=t.collection;if(!this.collections.has(n))throw Error(`invalid atlas collection name '${n}'`);var r=pI({type:e,atlasCollection:this.collections.get(n)},t);this.renderTypes.set(e,r)}},{key:`getRenderTypeOpts`,value:function(e){return this.renderTypes.get(e)}},{key:`getAtlasCollection`,value:function(e){return this.collections.get(e)}},{key:`_cacheScratchCanvas`,value:function(e){var t=-1,n=-1,r=null;return function(i,a,o,s){return s?((!r||a!=t||o!=n)&&(t=a,n=o,r=e(i,a,o)),r):e(i,a,o)}}},{key:`_key`,value:function(e,t){return`${e}-${t}`}},{key:`invalidate`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.forceRedraw,i=r===void 0?!1:r,a=n.filterEle,o=a===void 0?function(){return!0}:a,s=n.filterType,c=s===void 0?function(){return!0}:s,l=!1,u=!1,d=hF(e),f;try{for(d.s();!(f=d.n()).done;){var p=f.value;if(o(p)){var m=hF(this.renderTypes.values()),h;try{var g=function(){var e=h.value,n=e.type;if(c(n)){var r=t.collections.get(e.collection),a=e.getKey(p),o=Array.isArray(a)?a:[a];if(i)o.forEach(function(e){return r.markKeyForGC(e)}),u=!0;else{var s=e.getID?e.getID(p):p.id(),d=t._key(n,s),f=t.typeAndIdToKey.get(d);f!==void 0&&!xX(o,f)&&(l=!0,t.typeAndIdToKey.delete(d),f.forEach(function(e){return r.markKeyForGC(e)}))}}};for(m.s();!(h=m.n()).done;)g()}catch(e){m.e(e)}finally{m.f()}}}}catch(e){d.e(e)}finally{d.f()}return u&&(this.gc(),l=!1),l}},{key:`gc`,value:function(){var e=hF(this.collections.values()),t;try{for(e.s();!(t=e.n()).done;)t.value.gc()}catch(t){e.e(t)}finally{e.f()}}},{key:`getOrCreateAtlas`,value:function(e,t,n,r){var i=this.renderTypes.get(t),a=this.collections.get(i.collection),o=!1,s=a.draw(r,n,function(t){i.drawClipped?(t.save(),t.beginPath(),t.rect(0,0,n.w,n.h),t.clip(),i.drawElement(t,e,n,!0,!0),t.restore()):i.drawElement(t,e,n,!0,!0),o=!0});if(o){var c=i.getID?i.getID(e):e.id(),l=this._key(t,c);this.typeAndIdToKey.has(l)?this.typeAndIdToKey.get(l).push(r):this.typeAndIdToKey.set(l,[r])}return s}},{key:`getAtlasInfo`,value:function(e,t){var n=this,r=this.renderTypes.get(t),i=r.getKey(e);return(Array.isArray(i)?i:[i]).map(function(i){var a=r.getBoundingBox(e,i),o=n.getOrCreateAtlas(e,t,a,i),s=xF(o.getOffsets(i),2),c=s[0];return{atlas:o,tex:c,tex1:c,tex2:s[1],bb:a}})}},{key:`getDebugInfo`,value:function(){var e=[],t=hF(this.collections),n;try{for(t.s();!(n=t.n()).done;){var r=xF(n.value,2),i=r[0],a=r[1].getCounts(),o=a.keyCount,s=a.atlasCount;e.push({type:i,keyCount:o,atlasCount:s})}}catch(e){t.e(e)}finally{t.f()}return e}}])}(),GX=function(){function e(t){fF(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]}return mF(e,[{key:`getMaxAtlasesPerBatch`,value:function(){return this.maxAtlasesPerBatch}},{key:`getAtlasSize`,value:function(){return this.atlasSize}},{key:`getIndexArray`,value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(e,t){return t})}},{key:`startBatch`,value:function(){this.batchAtlases=[]}},{key:`getAtlasCount`,value:function(){return this.batchAtlases.length}},{key:`getAtlases`,value:function(){return this.batchAtlases}},{key:`canAddToCurrentBatch`,value:function(e){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(e):!0}},{key:`getAtlasIndexForBatch`,value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw Error(`cannot add more atlases to batch`);this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}}])}(),KX=`
|
|
91
|
-
float circleSD(vec2 p, float r) {
|
|
92
|
-
return distance(vec2(0), p) - r; // signed distance
|
|
93
|
-
}
|
|
94
|
-
`,qX=`
|
|
95
|
-
float rectangleSD(vec2 p, vec2 b) {
|
|
96
|
-
vec2 d = abs(p)-b;
|
|
97
|
-
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
|
|
98
|
-
}
|
|
99
|
-
`,JX=`
|
|
100
|
-
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
|
|
101
|
-
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
|
|
102
|
-
cr.x = (p.y > 0.0) ? cr.x : cr.y;
|
|
103
|
-
vec2 q = abs(p) - b + cr.x;
|
|
104
|
-
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
|
|
105
|
-
}
|
|
106
|
-
`,YX=`
|
|
107
|
-
float ellipseSD(vec2 p, vec2 ab) {
|
|
108
|
-
p = abs( p ); // symmetry
|
|
109
|
-
|
|
110
|
-
// find root with Newton solver
|
|
111
|
-
vec2 q = ab*(p-ab);
|
|
112
|
-
float w = (q.x<q.y)? 1.570796327 : 0.0;
|
|
113
|
-
for( int i=0; i<5; i++ ) {
|
|
114
|
-
vec2 cs = vec2(cos(w),sin(w));
|
|
115
|
-
vec2 u = ab*vec2( cs.x,cs.y);
|
|
116
|
-
vec2 v = ab*vec2(-cs.y,cs.x);
|
|
117
|
-
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// compute final point and distance
|
|
121
|
-
float d = length(p-ab*vec2(cos(w),sin(w)));
|
|
122
|
-
|
|
123
|
-
// return signed distance
|
|
124
|
-
return (dot(p/ab,p/ab)>1.0) ? d : -d;
|
|
125
|
-
}
|
|
126
|
-
`,XX={SCREEN:{name:`screen`,screen:!0},PICKING:{name:`picking`,picking:!0}},ZX={IGNORE:1,USE_BB:2},QX=0,$X=1,eZ=2,tZ=3,nZ=4,rZ=5,iZ=6,aZ=7,oZ=function(){function e(t,n,r){fF(this,e),this.r=t,this.gl=n,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=gX,this.atlasManager=new WX(t,r),this.batchManager=new GX(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(XX.SCREEN),this.pickingProgram=this._createShaderProgram(XX.PICKING),this.vao=this._createVAO()}return mF(e,[{key:`addAtlasCollection`,value:function(e,t){this.atlasManager.addAtlasCollection(e,t)}},{key:`addTextureAtlasRenderType`,value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:`addSimpleShapeRenderType`,value:function(e,t){this.simpleShapeOptions.set(e,t)}},{key:`invalidate`,value:function(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).type,n=this.atlasManager;return t?n.invalidate(e,{filterType:function(e){return e===t},forceRedraw:!0}):n.invalidate(e)}},{key:`gc`,value:function(){this.atlasManager.gc()}},{key:`_createShaderProgram`,value:function(e){var t=this.gl,n=`#version 300 es
|
|
127
|
-
precision highp float;
|
|
128
|
-
|
|
129
|
-
uniform mat3 uPanZoomMatrix;
|
|
130
|
-
uniform int uAtlasSize;
|
|
131
|
-
|
|
132
|
-
// instanced
|
|
133
|
-
in vec2 aPosition; // a vertex from the unit square
|
|
134
|
-
|
|
135
|
-
in mat3 aTransform; // used to transform verticies, eg into a bounding box
|
|
136
|
-
in int aVertType; // the type of thing we are rendering
|
|
137
|
-
|
|
138
|
-
// the z-index that is output when using picking mode
|
|
139
|
-
in vec4 aIndex;
|
|
140
|
-
|
|
141
|
-
// For textures
|
|
142
|
-
in int aAtlasId; // which shader unit/atlas to use
|
|
143
|
-
in vec4 aTex; // x/y/w/h of texture in atlas
|
|
144
|
-
|
|
145
|
-
// for edges
|
|
146
|
-
in vec4 aPointAPointB;
|
|
147
|
-
in vec4 aPointCPointD;
|
|
148
|
-
in vec2 aLineWidth; // also used for node border width
|
|
149
|
-
|
|
150
|
-
// simple shapes
|
|
151
|
-
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
|
|
152
|
-
in vec4 aColor; // also used for edges
|
|
153
|
-
in vec4 aBorderColor; // aLineWidth is used for border width
|
|
154
|
-
|
|
155
|
-
// output values passed to the fragment shader
|
|
156
|
-
out vec2 vTexCoord;
|
|
157
|
-
out vec4 vColor;
|
|
158
|
-
out vec2 vPosition;
|
|
159
|
-
// flat values are not interpolated
|
|
160
|
-
flat out int vAtlasId;
|
|
161
|
-
flat out int vVertType;
|
|
162
|
-
flat out vec2 vTopRight;
|
|
163
|
-
flat out vec2 vBotLeft;
|
|
164
|
-
flat out vec4 vCornerRadius;
|
|
165
|
-
flat out vec4 vBorderColor;
|
|
166
|
-
flat out vec2 vBorderWidth;
|
|
167
|
-
flat out vec4 vIndex;
|
|
168
|
-
|
|
169
|
-
void main(void) {
|
|
170
|
-
int vid = gl_VertexID;
|
|
171
|
-
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
|
|
172
|
-
|
|
173
|
-
if(aVertType == ${QX}) {
|
|
174
|
-
float texX = aTex.x; // texture coordinates
|
|
175
|
-
float texY = aTex.y;
|
|
176
|
-
float texW = aTex.z;
|
|
177
|
-
float texH = aTex.w;
|
|
178
|
-
|
|
179
|
-
if(vid == 1 || vid == 2 || vid == 4) {
|
|
180
|
-
texX += texW;
|
|
181
|
-
}
|
|
182
|
-
if(vid == 2 || vid == 4 || vid == 5) {
|
|
183
|
-
texY += texH;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
float d = float(uAtlasSize);
|
|
187
|
-
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
|
|
188
|
-
|
|
189
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
190
|
-
}
|
|
191
|
-
else if(aVertType == ${nZ} || aVertType == ${aZ}
|
|
192
|
-
|| aVertType == ${rZ} || aVertType == ${iZ}) { // simple shapes
|
|
193
|
-
|
|
194
|
-
// the bounding box is needed by the fragment shader
|
|
195
|
-
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
|
|
196
|
-
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
|
|
197
|
-
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
|
|
198
|
-
|
|
199
|
-
// calculations are done in the fragment shader, just pass these along
|
|
200
|
-
vColor = aColor;
|
|
201
|
-
vCornerRadius = aCornerRadius;
|
|
202
|
-
vBorderColor = aBorderColor;
|
|
203
|
-
vBorderWidth = aLineWidth;
|
|
204
|
-
|
|
205
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
206
|
-
}
|
|
207
|
-
else if(aVertType == ${$X}) {
|
|
208
|
-
vec2 source = aPointAPointB.xy;
|
|
209
|
-
vec2 target = aPointAPointB.zw;
|
|
210
|
-
|
|
211
|
-
// adjust the geometry so that the line is centered on the edge
|
|
212
|
-
position.y = position.y - 0.5;
|
|
213
|
-
|
|
214
|
-
// stretch the unit square into a long skinny rectangle
|
|
215
|
-
vec2 xBasis = target - source;
|
|
216
|
-
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
|
217
|
-
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
|
|
218
|
-
|
|
219
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
|
|
220
|
-
vColor = aColor;
|
|
221
|
-
}
|
|
222
|
-
else if(aVertType == ${eZ}) {
|
|
223
|
-
vec2 pointA = aPointAPointB.xy;
|
|
224
|
-
vec2 pointB = aPointAPointB.zw;
|
|
225
|
-
vec2 pointC = aPointCPointD.xy;
|
|
226
|
-
vec2 pointD = aPointCPointD.zw;
|
|
227
|
-
|
|
228
|
-
// adjust the geometry so that the line is centered on the edge
|
|
229
|
-
position.y = position.y - 0.5;
|
|
230
|
-
|
|
231
|
-
vec2 p0, p1, p2, pos;
|
|
232
|
-
if(position.x == 0.0) { // The left side of the unit square
|
|
233
|
-
p0 = pointA;
|
|
234
|
-
p1 = pointB;
|
|
235
|
-
p2 = pointC;
|
|
236
|
-
pos = position;
|
|
237
|
-
} else { // The right side of the unit square, use same approach but flip the geometry upside down
|
|
238
|
-
p0 = pointD;
|
|
239
|
-
p1 = pointC;
|
|
240
|
-
p2 = pointB;
|
|
241
|
-
pos = vec2(0.0, -position.y);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
vec2 p01 = p1 - p0;
|
|
245
|
-
vec2 p12 = p2 - p1;
|
|
246
|
-
vec2 p21 = p1 - p2;
|
|
247
|
-
|
|
248
|
-
// Find the normal vector.
|
|
249
|
-
vec2 tangent = normalize(normalize(p12) + normalize(p01));
|
|
250
|
-
vec2 normal = vec2(-tangent.y, tangent.x);
|
|
251
|
-
|
|
252
|
-
// Find the vector perpendicular to p0 -> p1.
|
|
253
|
-
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
|
|
254
|
-
|
|
255
|
-
// Determine the bend direction.
|
|
256
|
-
float sigma = sign(dot(p01 + p21, normal));
|
|
257
|
-
float width = aLineWidth[0];
|
|
258
|
-
|
|
259
|
-
if(sign(pos.y) == -sigma) {
|
|
260
|
-
// This is an intersecting vertex. Adjust the position so that there's no overlap.
|
|
261
|
-
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
|
|
262
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
263
|
-
} else {
|
|
264
|
-
// This is a non-intersecting vertex. Treat it like a mitre join.
|
|
265
|
-
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
|
|
266
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
vColor = aColor;
|
|
270
|
-
}
|
|
271
|
-
else if(aVertType == ${tZ} && vid < 3) {
|
|
272
|
-
// massage the first triangle into an edge arrow
|
|
273
|
-
if(vid == 0)
|
|
274
|
-
position = vec2(-0.15, -0.3);
|
|
275
|
-
if(vid == 1)
|
|
276
|
-
position = vec2( 0.0, 0.0);
|
|
277
|
-
if(vid == 2)
|
|
278
|
-
position = vec2( 0.15, -0.3);
|
|
279
|
-
|
|
280
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
281
|
-
vColor = aColor;
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
vAtlasId = aAtlasId;
|
|
288
|
-
vVertType = aVertType;
|
|
289
|
-
vIndex = aIndex;
|
|
290
|
-
}
|
|
291
|
-
`,r=this.batchManager.getIndexArray(),i=hX(t,n,`#version 300 es
|
|
292
|
-
precision highp float;
|
|
293
|
-
|
|
294
|
-
// declare texture unit for each texture atlas in the batch
|
|
295
|
-
${r.map(function(e){return`uniform sampler2D uTexture${e};`}).join(`
|
|
296
|
-
`)}
|
|
297
|
-
|
|
298
|
-
uniform vec4 uBGColor;
|
|
299
|
-
uniform float uZoom;
|
|
300
|
-
|
|
301
|
-
in vec2 vTexCoord;
|
|
302
|
-
in vec4 vColor;
|
|
303
|
-
in vec2 vPosition; // model coordinates
|
|
304
|
-
|
|
305
|
-
flat in int vAtlasId;
|
|
306
|
-
flat in vec4 vIndex;
|
|
307
|
-
flat in int vVertType;
|
|
308
|
-
flat in vec2 vTopRight;
|
|
309
|
-
flat in vec2 vBotLeft;
|
|
310
|
-
flat in vec4 vCornerRadius;
|
|
311
|
-
flat in vec4 vBorderColor;
|
|
312
|
-
flat in vec2 vBorderWidth;
|
|
313
|
-
|
|
314
|
-
out vec4 outColor;
|
|
315
|
-
|
|
316
|
-
${KX}
|
|
317
|
-
${qX}
|
|
318
|
-
${JX}
|
|
319
|
-
${YX}
|
|
320
|
-
|
|
321
|
-
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
|
|
322
|
-
return vec4(
|
|
323
|
-
top.rgb + (bot.rgb * (1.0 - top.a)),
|
|
324
|
-
top.a + (bot.a * (1.0 - top.a))
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
|
|
329
|
-
// scale to the zoom level so that borders don't look blurry when zoomed in
|
|
330
|
-
// note 1.5 is an aribitrary value chosen because it looks good
|
|
331
|
-
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
void main(void) {
|
|
335
|
-
if(vVertType == ${QX}) {
|
|
336
|
-
// look up the texel from the texture unit
|
|
337
|
-
${r.map(function(e){return`if(vAtlasId == ${e}) outColor = texture(uTexture${e}, vTexCoord);`}).join(`
|
|
338
|
-
else `)}
|
|
339
|
-
}
|
|
340
|
-
else if(vVertType == ${tZ}) {
|
|
341
|
-
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
|
|
342
|
-
outColor = blend(vColor, uBGColor);
|
|
343
|
-
outColor.a = 1.0; // make opaque, masks out line under arrow
|
|
344
|
-
}
|
|
345
|
-
else if(vVertType == ${nZ} && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
|
|
346
|
-
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
|
|
347
|
-
}
|
|
348
|
-
else if(vVertType == ${nZ} || vVertType == ${aZ}
|
|
349
|
-
|| vVertType == ${rZ} || vVertType == ${iZ}) { // use SDF
|
|
350
|
-
|
|
351
|
-
float outerBorder = vBorderWidth[0];
|
|
352
|
-
float innerBorder = vBorderWidth[1];
|
|
353
|
-
float borderPadding = outerBorder * 2.0;
|
|
354
|
-
float w = vTopRight.x - vBotLeft.x - borderPadding;
|
|
355
|
-
float h = vTopRight.y - vBotLeft.y - borderPadding;
|
|
356
|
-
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
|
|
357
|
-
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
|
|
358
|
-
|
|
359
|
-
float d; // signed distance
|
|
360
|
-
if(vVertType == ${nZ}) {
|
|
361
|
-
d = rectangleSD(p, b);
|
|
362
|
-
} else if(vVertType == ${aZ} && w == h) {
|
|
363
|
-
d = circleSD(p, b.x); // faster than ellipse
|
|
364
|
-
} else if(vVertType == ${aZ}) {
|
|
365
|
-
d = ellipseSD(p, b);
|
|
366
|
-
} else {
|
|
367
|
-
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
|
|
371
|
-
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
|
|
372
|
-
if(d > 0.0) {
|
|
373
|
-
if(d > outerBorder) {
|
|
374
|
-
discard;
|
|
375
|
-
} else {
|
|
376
|
-
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
|
|
377
|
-
}
|
|
378
|
-
} else {
|
|
379
|
-
if(d > innerBorder) {
|
|
380
|
-
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
|
|
381
|
-
vec4 innerBorderColor = blend(vBorderColor, vColor);
|
|
382
|
-
outColor = distInterp(innerBorderColor, outerColor, d);
|
|
383
|
-
}
|
|
384
|
-
else {
|
|
385
|
-
vec4 outerColor;
|
|
386
|
-
if(innerBorder == 0.0 && outerBorder == 0.0) {
|
|
387
|
-
outerColor = vec4(0);
|
|
388
|
-
} else if(innerBorder == 0.0) {
|
|
389
|
-
outerColor = vBorderColor;
|
|
390
|
-
} else {
|
|
391
|
-
outerColor = blend(vBorderColor, vColor);
|
|
392
|
-
}
|
|
393
|
-
outColor = distInterp(vColor, outerColor, d - innerBorder);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
outColor = vColor;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
${e.picking?`if(outColor.a == 0.0) discard;
|
|
402
|
-
else outColor = vIndex;`:``}
|
|
403
|
-
}
|
|
404
|
-
`);i.aPosition=t.getAttribLocation(i,`aPosition`),i.aIndex=t.getAttribLocation(i,`aIndex`),i.aVertType=t.getAttribLocation(i,`aVertType`),i.aTransform=t.getAttribLocation(i,`aTransform`),i.aAtlasId=t.getAttribLocation(i,`aAtlasId`),i.aTex=t.getAttribLocation(i,`aTex`),i.aPointAPointB=t.getAttribLocation(i,`aPointAPointB`),i.aPointCPointD=t.getAttribLocation(i,`aPointCPointD`),i.aLineWidth=t.getAttribLocation(i,`aLineWidth`),i.aColor=t.getAttribLocation(i,`aColor`),i.aCornerRadius=t.getAttribLocation(i,`aCornerRadius`),i.aBorderColor=t.getAttribLocation(i,`aBorderColor`),i.uPanZoomMatrix=t.getUniformLocation(i,`uPanZoomMatrix`),i.uAtlasSize=t.getUniformLocation(i,`uAtlasSize`),i.uBGColor=t.getUniformLocation(i,`uBGColor`),i.uZoom=t.getUniformLocation(i,`uZoom`),i.uTextures=[];for(var a=0;a<this.batchManager.getMaxAtlasesPerBatch();a++)i.uTextures.push(t.getUniformLocation(i,`uTexture${a}`));return i}},{key:`_createVAO`,value:function(){var e=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=e.length/2;var t=this.maxInstances,n=this.gl,r=this.program,i=n.createVertexArray();return n.bindVertexArray(i),kX(n,`vec2`,r.aPosition,e),this.transformBuffer=jX(n,t,r.aTransform),this.indexBuffer=AX(n,t,`vec4`,r.aIndex),this.vertTypeBuffer=AX(n,t,`int`,r.aVertType),this.atlasIdBuffer=AX(n,t,`int`,r.aAtlasId),this.texBuffer=AX(n,t,`vec4`,r.aTex),this.pointAPointBBuffer=AX(n,t,`vec4`,r.aPointAPointB),this.pointCPointDBuffer=AX(n,t,`vec4`,r.aPointCPointD),this.lineWidthBuffer=AX(n,t,`vec2`,r.aLineWidth),this.colorBuffer=AX(n,t,`vec4`,r.aColor),this.cornerRadiusBuffer=AX(n,t,`vec4`,r.aCornerRadius),this.borderColorBuffer=AX(n,t,`vec4`,r.aBorderColor),n.bindVertexArray(null),i}},{key:`buffers`,get:function(){var e=this;return this._buffers||=Object.keys(this).filter(function(e){return rI(e,`Buffer`)}).map(function(t){return e[t]}),this._buffers}},{key:`startFrame`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:XX.SCREEN;this.panZoomMatrix=e,this.renderTarget=t,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:`startBatch`,value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:`endFrame`,value:function(){this.endBatch()}},{key:`_isVisible`,value:function(e,t){return e.visible()?t&&t.isVisible?t.isVisible(e):!0:!1}},{key:`drawTexture`,value:function(e,t,n){var r=this.atlasManager,i=this.batchManager,a=r.getRenderTypeOpts(n);if(this._isVisible(e,a)&&!(e.isEdge()&&!this._isValidEdge(e))){if(this.renderTarget.picking&&a.getTexPickingMode){var o=a.getTexPickingMode(e);if(o===ZX.IGNORE)return;if(o==ZX.USE_BB){this.drawPickingRectangle(e,t,n);return}}var s=hF(r.getAtlasInfo(e,n)),c;try{for(s.s();!(c=s.n()).done;){var l=c.value,u=l.atlas,d=l.tex1,f=l.tex2;i.canAddToCurrentBatch(u)||this.endBatch();for(var p=i.getAtlasIndexForBatch(u),m=0,h=[[d,!0],[f,!1]];m<h.length;m++){var g=xF(h[m],2),_=g[0],v=g[1];if(_.w!=0){var y=this.instanceCount;this.vertTypeBuffer.getView(y)[0]=QX,CX(t,this.indexBuffer.getView(y));var b=this.atlasIdBuffer.getView(y);b[0]=p;var x=this.texBuffer.getView(y);x[0]=_.x,x[1]=_.y,x[2]=_.w,x[3]=_.h;var S=this.transformBuffer.getMatrixView(y);this.setTransformMatrix(e,S,a,l,v),this.instanceCount++,v||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(e){s.e(e)}finally{s.f()}}}},{key:`setTransformMatrix`,value:function(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;if(n.shapeProps&&n.shapeProps.padding&&(a=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,c=r.tex2,l=s.w/(s.w+c.w);i||(l=1-l);var u=this._getAdjustedBB(o,a,i,l);this._applyTransformMatrix(t,u,n,e)}else{var d=n.getBoundingBox(e),f=this._getAdjustedBB(d,a,!0,1);this._applyTransformMatrix(t,f,n,e)}}},{key:`_applyTransformMatrix`,value:function(e,t,n,r){var i,a;FX(e);var o=n.getRotation?n.getRotation(r):0;if(o!==0){var s=n.getRotationPoint(r),c=s.x,l=s.y;LX(e,e,[c,l]),RX(e,e,o);var u=n.getRotationOffset(r);i=u.x+(t.xOffset||0),a=u.y+(t.yOffset||0)}else i=t.x1,a=t.y1;LX(e,e,[i,a]),zX(e,e,[t.w,t.h])}},{key:`_getAdjustedBB`,value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h,c=e.yOffset;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var l=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(l=o-u,i+=l,o=u),{x1:i,y1:a,w:o,h:s,xOffset:l,yOffset:c}}},{key:`drawPickingRectangle`,value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=nZ,CX(t,this.indexBuffer.getView(i)),SX([0,0,0],1,this.colorBuffer.getView(i));var a=this.transformBuffer.getMatrixView(i);this.setTransformMatrix(e,a,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:`drawNode`,value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var i=r.shapeProps,a=this._getVertTypeForShape(e,i.shape);if(a===void 0||r.isSimple&&!r.isSimple(e,this.renderTarget)){this.drawTexture(e,t,n);return}var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=a,a===rZ||a===iZ){var s=r.getBoundingBox(e),c=this._getCornerRadius(e,i.radius,s),l=this.cornerRadiusBuffer.getView(o);l[0]=c,l[1]=c,l[2]=c,l[3]=c,a===iZ&&(l[0]=0,l[2]=0)}CX(t,this.indexBuffer.getView(o));var u=this.renderTarget.picking?1:n===`node-body`?e.effectiveOpacity():1,d=this.renderTarget.picking?1:e.pstyle(i.opacity).value*u,f=e.pstyle(i.color).value;SX(f,d,this.colorBuffer.getView(o));var p=this.lineWidthBuffer.getView(o);if(p[0]=0,p[1]=0,i.border){var m=e.pstyle(`border-width`).value;if(m>0){var h=e.pstyle(`border-color`).value;SX(h,u*e.pstyle(`border-opacity`).value,this.borderColorBuffer.getView(o));var g=e.pstyle(`border-position`).value;if(g===`inside`)p[0]=0,p[1]=-m;else if(g===`outside`)p[0]=m,p[1]=0;else{var _=m/2;p[0]=_,p[1]=-_}}}var v=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,v,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:`_getVertTypeForShape`,value:function(e,t){switch(e.pstyle(t).value){case`rectangle`:return nZ;case`ellipse`:return aZ;case`roundrectangle`:case`round-rectangle`:return rZ;case`bottom-round-rectangle`:return iZ;default:return}}},{key:`_getCornerRadius`,value:function(e,t,n){var r=n.w,i=n.h;if(e.pstyle(t).value===`auto`)return Fz(r,i);var a=e.pstyle(t).pfValue,o=r/2,s=i/2;return Math.min(a,s,o)}},{key:`drawEdgeArrow`,value:function(e,t,n){if(e.visible()){var r=e._private.rscratch,i,a,o;if(n===`source`?(i=r.arrowStartX,a=r.arrowStartY,o=r.srcArrowAngle):(i=r.arrowEndX,a=r.arrowEndY,o=r.tgtArrowAngle),!(isNaN(i)||i==null||isNaN(a)||a==null||isNaN(o)||o==null)&&e.pstyle(n+`-arrow-shape`).value!==`none`){var s=e.pstyle(n+`-arrow-color`).value,c=e.pstyle(`opacity`).value*e.pstyle(`line-opacity`).value,l=e.pstyle(`width`).pfValue,u=e.pstyle(`arrow-scale`).value,d=this.r.getArrowWidth(l,u),f=this.instanceCount,p=this.transformBuffer.getMatrixView(f);FX(p),LX(p,p,[i,a]),zX(p,p,[d,d]),RX(p,p,o),this.vertTypeBuffer.getView(f)[0]=tZ,CX(t,this.indexBuffer.getView(f)),SX(s,c,this.colorBuffer.getView(f)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:`drawEdgeLine`,value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle(`opacity`).value,i=e.pstyle(`line-opacity`).value,a=e.pstyle(`width`).pfValue,o=e.pstyle(`line-color`).value,s=r*i;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var c=this.instanceCount;this.vertTypeBuffer.getView(c)[0]=$X,CX(t,this.indexBuffer.getView(c)),SX(o,s,this.colorBuffer.getView(c));var l=this.lineWidthBuffer.getView(c);l[0]=a;var u=this.pointAPointBBuffer.getView(c);u[0]=n[0],u[1]=n[1],u[2]=n[2],u[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var d=0;d<n.length-2;d+=2){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=eZ,CX(t,this.indexBuffer.getView(f)),SX(o,s,this.colorBuffer.getView(f));var p=this.lineWidthBuffer.getView(f);p[0]=a;var m=n[d-2],h=n[d-1],g=n[d],_=n[d+1],v=n[d+2],y=n[d+3],b=n[d+4],x=n[d+5];d==0&&(m=2*g-v+.001,h=2*_-y+.001),d==n.length-4&&(b=2*v-g+.001,x=2*y-_+.001);var S=this.pointAPointBBuffer.getView(f);S[0]=m,S[1]=h,S[2]=g,S[3]=_;var C=this.pointCPointDBuffer.getView(f);C[0]=v,C[1]=y,C[2]=b,C[3]=x,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:`_isValidEdge`,value:function(e){var t=e._private.rscratch;return!(t.badLine||t.allpts==null||isNaN(t.allpts[0]))}},{key:`_getEdgePoints`,value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e)){var n=t.allpts;if(n.length==4)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:`_getNumSegments`,value:function(e){return Math.min(15,this.maxInstances)}},{key:`_getCurveSegmentPoints`,value:function(e,t){if(e.length==4)return e;for(var n=Array((t+1)*2),r=0;r<=t;r++)if(r==0)n[0]=e[0],n[1]=e[1];else if(r==t)n[r*2]=e[e.length-2],n[r*2+1]=e[e.length-1];else{var i=r/t;this._setCurvePoint(e,i,n,r*2)}return n}},{key:`_setCurvePoint`,value:function(e,t,n,r){if(e.length<=2)n[r]=e[0],n[r+1]=e[1];else{for(var i=Array(e.length-2),a=0;a<i.length;a+=2){var o=(1-t)*e[a]+t*e[a+2],s=(1-t)*e[a+1]+t*e[a+3];i[a]=o,i[a+1]=s}return this._setCurvePoint(i,t,n,r)}}},{key:`endBatch`,value:function(){var e=this.gl,t=this.vao,n=this.vertexCount,r=this.instanceCount;if(r!==0){var i=this.renderTarget.picking?this.pickingProgram:this.program;e.useProgram(i),e.bindVertexArray(t);var a=hF(this.buffers),o;try{for(a.s();!(o=a.n()).done;)o.value.bufferSubData(r)}catch(e){a.e(e)}finally{a.f()}for(var s=this.batchManager.getAtlases(),c=0;c<s.length;c++)s[c].bufferIfNeeded(e);for(var l=0;l<s.length;l++)e.activeTexture(e.TEXTURE0+l),e.bindTexture(e.TEXTURE_2D,s[l].texture),e.uniform1i(i.uTextures[l],l);e.uniform1f(i.uZoom,vX(this.r)),e.uniformMatrix3fv(i.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(i.uAtlasSize,this.batchManager.getAtlasSize());var u=SX(this.bgColor,1);e.uniform4fv(i.uBGColor,u),e.drawArraysInstanced(e.TRIANGLES,0,n,r),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:r,atlasCount:s.length}),this.startBatch()}}},{key:`getDebugInfo`,value:function(){var e=this.atlasManager.getDebugInfo(),t=e.reduce(function(e,t){return e+t.atlasCount},0),n=this.batchDebugInfo,r=n.reduce(function(e,t){return e+t.count},0);return{atlasInfo:e,totalAtlases:t,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:r}}}])}(),sZ={};sZ.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL];e.bgColor=cZ(n),e.webglTexSize=Math.min(e.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=e.webglDebug,n.webglDebugShowAtlases=e.webglDebugShowAtlases,n.pickingFrameBuffer=MX(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new oZ(n,r,e);var i=function(e){return function(t){return n.getTextAngle(t,e)}},a=function(e){return function(t){var n=t.pstyle(e);return n&&n.value}},o=function(e){return function(t){return t.pstyle(`${e}-opacity`).value>0}},s=function(e){return e.pstyle(`text-events`).strValue===`yes`?ZX.USE_BB:ZX.IGNORE},c=function(e){var t=e.position(),n=t.x,r=t.y,i=e.outerWidth(),a=e.outerHeight();return{w:i,h:a,x1:n-i/2,y1:r-a/2}};n.drawing.addAtlasCollection(`node`,{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection(`label`,{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType(`node-body`,{collection:`node`,getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType(`node-body`,{getBoundingBox:c,isSimple:bX,shapeProps:{shape:`shape`,color:`background-color`,opacity:`background-opacity`,radius:`corner-radius`,border:!0}}),n.drawing.addSimpleShapeRenderType(`node-overlay`,{getBoundingBox:c,isVisible:o(`overlay`),shapeProps:{shape:`overlay-shape`,color:`overlay-color`,opacity:`overlay-opacity`,padding:`overlay-padding`,radius:`overlay-corner-radius`}}),n.drawing.addSimpleShapeRenderType(`node-underlay`,{getBoundingBox:c,isVisible:o(`underlay`),shapeProps:{shape:`underlay-shape`,color:`underlay-color`,opacity:`underlay-opacity`,padding:`underlay-padding`,radius:`underlay-corner-radius`}}),n.drawing.addTextureAtlasRenderType(`label`,{collection:`label`,getTexPickingMode:s,getKey:uZ(t.getLabelKey,null),getBoundingBox:dZ(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:i(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:a(`label`)}),n.drawing.addTextureAtlasRenderType(`edge-source-label`,{collection:`label`,getTexPickingMode:s,getKey:uZ(t.getSourceLabelKey,`source`),getBoundingBox:dZ(t.getSourceLabelBox,`source`),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:i(`source`),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:a(`source-label`)}),n.drawing.addTextureAtlasRenderType(`edge-target-label`,{collection:`label`,getTexPickingMode:s,getKey:uZ(t.getTargetLabelKey,`target`),getBoundingBox:dZ(t.getTargetLabelBox,`target`),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:i(`target`),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:a(`target-label`)});var l=fL(function(){console.log(`garbage collect flag set`),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(e,t){var r=!1;t&&t.length>0&&(r|=n.drawing.invalidate(t)),r&&l()}),fZ(n)};function cZ(e){var t=e.cy.container();return vI(t&&t.style&&t.style.backgroundColor||`white`)}function lZ(e,t){var n=e._private.rscratch;return tR(n,`labelWrapCachedLines`,t)||[]}var uZ=function(e,t){return function(n){var r=e(n),i=lZ(n,t);return i.length>1?i.map(function(e,t){return`${r}_${t}`}):r}},dZ=function(e,t){return function(n,r){var i=e(n);if(typeof r==`string`){var a=r.indexOf(`_`);if(a>0){var o=Number(r.substring(a+1)),s=lZ(n,t),c=i.h/s.length,l=c*o,u=i.y1+l;return{x1:i.x1,w:i.w,y1:u,h:c,yOffset:l}}}return i}};function fZ(e){var t=e.render;e.render=function(n){n||={};var r=e.cy;e.webgl&&(r.zoom()>oY?(pZ(e),t.call(e,n)):(mZ(e),CZ(e,n,XX.SCREEN)))};var n=e.matchCanvasSize;e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,r,i){return xZ(e,t,n)};var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0};var i=e.notify;e.notify=function(t,n){i.call(e,t,n),t===`viewport`||t===`bounds`?e.pickingFrameBuffer.needsDraw=!0:t===`background`&&e.drawing.invalidate(n,{type:`node-body`})}}function pZ(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function mZ(e){var t=function(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function hZ(e){var t=e.canvasWidth,n=e.canvasHeight,r=_X(e),i=r.pan,a=r.zoom,o=PX();LX(o,o,[i.x,i.y]),zX(o,o,[a,a]);var s=PX();BX(s,t,n);var c=PX();return IX(c,s,o),c}function gZ(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=_X(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function _Z(e,t){e.drawSelectionRectangle(t,function(t){return gZ(e,t)})}function vZ(e){var t=e.data.contexts[e.NODE];t.save(),gZ(e,t),t.strokeStyle=`rgba(0, 0, 0, 0.3)`,t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function yZ(e){var t=function(t,n,r){for(var i=t.atlasManager.getAtlasCollection(n),a=e.data.contexts[e.NODE],o=i.atlases,s=0;s<o.length;s++){var c=o[s].canvas;if(c){var l=c.width,u=c.height,d=l*s,f=c.height*r,p=.4;a.save(),a.scale(p,p),a.drawImage(c,d,f),a.strokeStyle=`black`,a.rect(d,f,l,u),a.stroke(),a.restore()}}},n=0;t(e.drawing,`node`,n++),t(e.drawing,`label`,n++)}function bZ(e,t,n,r,i){var a,o,s,c,l=_X(e),u=l.pan,d=l.zoom,f=xF(yX(e,u,d,t,n),2),p=f[0],m=f[1],h=6;if(a=p-h/2,o=m-h/2,s=h,c=h,s===0||c===0)return[];var g=e.data.contexts[e.WEBGL];g.bindFramebuffer(g.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(g.viewport(0,0,g.canvas.width,g.canvas.height),CZ(e,null,XX.PICKING),e.pickingFrameBuffer.needsDraw=!1);var _=s*c,v=new Uint8Array(_*4);g.readPixels(a,o,s,c,g.RGBA,g.UNSIGNED_BYTE,v),g.bindFramebuffer(g.FRAMEBUFFER,null);for(var y=new Set,b=0;b<_;b++){var x=wX(v.slice(b*4,b*4+4))-1;x>=0&&y.add(x)}return y}function xZ(e,t,n){var r=bZ(e,t,n),i=e.getCachedZSortedEles(),a,o,s=hF(r),c;try{for(s.s();!(c=s.n()).done;){var l=i[c.value];if(!a&&l.isNode()&&(a=l),!o&&l.isEdge()&&(o=l),a&&o)break}}catch(e){s.e(e)}finally{s.f()}return[a,o].filter(Boolean)}function SZ(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,`node-underlay`),r.drawNode(n,t,`node-body`),r.drawTexture(n,t,`label`),r.drawNode(n,t,`node-overlay`)):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,`source`),r.drawEdgeArrow(n,t,`target`),r.drawTexture(n,t,`label`),r.drawTexture(n,t,`edge-source-label`),r.drawTexture(n,t,`edge-target-label`))}function CZ(e,t,n){var r;e.webglDebug&&(r=performance.now());var i=e.drawing,a=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&_Z(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var o=e.data.contexts[e.WEBGL];n.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=hZ(e),c=e.getCachedZSortedEles();if(a=c.length,i.startFrame(s,n),n.screen){for(var l=0;l<c.nondrag.length;l++)SZ(e,l,c.nondrag[l]);for(var u=0;u<c.drag.length;u++)SZ(e,u,c.drag[u])}else if(n.picking)for(var d=0;d<c.length;d++)SZ(e,d,c[d]);i.endFrame(),n.screen&&e.webglDebugShowAtlases&&(vZ(e),yZ(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var f=performance.now(),p=!1,m=Math.ceil(f-r),h=i.getDebugInfo(),g=[`${a} elements`,`${h.totalInstances} instances`,`${h.batchCount} batches`,`${h.totalAtlases} atlases`,`${h.wrappedCount} wrapped textures`,`${h.simpleCount} simple shapes`].join(`, `);if(p)console.log(`WebGL (${n.name}) - time ${m}ms, ${g}`);else{console.log(`WebGL (${n.name}) - frame time ${m}ms`),console.log(`Totals:`),console.log(` ${g}`),console.log(`Texture Atlases Used:`);var _=h.atlasInfo,v=hF(_),y;try{for(v.s();!(y=v.n()).done;){var b=y.value;console.log(` ${b.type}: ${b.keyCount} keys, ${b.atlasCount} atlases`)}}catch(e){v.e(e)}finally{v.f()}console.log(``)}}e.data.gc&&(console.log(`Garbage Collect!`),e.data.gc=!1,i.gc())}var wZ={};wZ.drawPolygonPath=function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var c=1;c<a.length/2;c++)e.lineTo(t+o*a[c*2],n+s*a[c*2+1]);e.closePath()},wZ.drawRoundPolygonPath=function(e,t,n,r,i,a,o){o.forEach(function(t){return wJ(e,t)}),e.closePath()},wZ.drawRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?Fz(r,i):Math.min(a,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,c),e.arcTo(t+o,n+s,t,n+s,c),e.arcTo(t-o,n+s,t-o,n,c),e.arcTo(t-o,n-s,t,n-s,c),e.lineTo(t,n-s),e.closePath()},wZ.drawBottomRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?Fz(r,i):a;e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.lineTo(t+o,n-s),e.lineTo(t+o,n),e.arcTo(t+o,n+s,t,n+s,c),e.arcTo(t-o,n+s,t-o,n,c),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},wZ.drawCutRectanglePath=function(e,t,n,r,i,a,o){var s=r/2,c=i/2,l=o===`auto`?Lz():o;e.beginPath&&e.beginPath(),e.moveTo(t-s+l,n-c),e.lineTo(t+s-l,n-c),e.lineTo(t+s,n-c+l),e.lineTo(t+s,n+c-l),e.lineTo(t+s-l,n+c),e.lineTo(t-s+l,n+c),e.lineTo(t-s,n+c-l),e.lineTo(t-s,n-c+l),e.closePath()},wZ.drawBarrelPath=function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,c=t+a,l=n-o,u=n+o,d=zz(r,i),f=d.widthOffset,p=d.heightOffset,m=d.ctrlPtOffsetPct*f;e.beginPath&&e.beginPath(),e.moveTo(s,l+p),e.lineTo(s,u-p),e.quadraticCurveTo(s+m,u,s+f,u),e.lineTo(c-f,u),e.quadraticCurveTo(c-m,u,c,u-p),e.lineTo(c,l+p),e.quadraticCurveTo(c-m,l,c-f,l),e.lineTo(s+f,l),e.quadraticCurveTo(s+m,l,s,l+p),e.closePath()};for(var TZ=Math.sin(0),EZ=Math.cos(0),DZ={},OZ={},kZ=Math.PI/40,AZ=0*Math.PI;AZ<2*Math.PI;AZ+=kZ)DZ[AZ]=Math.sin(AZ),OZ[AZ]=Math.cos(AZ);wZ.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,c=i/2,l=0*Math.PI;l<2*Math.PI;l+=kZ)a=t-s*DZ[l]*TZ+s*OZ[l]*EZ,o=n+c*OZ[l]*TZ+c*DZ[l]*EZ,l===0?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var jZ={};jZ.createBuffer=function(e,t){var n=document.createElement(`canvas`);return n.width=e,n.height=t,[n,n.getContext(`2d`)]},jZ.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=$(e.maxWidth)||$(e.maxHeight),s=this.getPixelRatio(),c=1;if(e.scale!==void 0)i*=e.scale,a*=e.scale,c=e.scale;else if(o){var l=1/0,u=1/0;$(e.maxWidth)&&(l=c*e.maxWidth/i),$(e.maxHeight)&&(u=c*e.maxHeight/a),c=Math.min(l,u),i*=c,a*=c}o||(i*=s,a*=s,c*=s);var d=document.createElement(`canvas`);d.width=i,d.height=a,d.style.width=i+`px`,d.style.height=a+`px`;var f=d.getContext(`2d`);if(i>0&&a>0){f.clearRect(0,0,i,a),f.globalCompositeOperation=`source-over`;var p=this.getCachedZSortedEles();if(e.full)f.translate(-n.x1*c,-n.y1*c),f.scale(c,c),this.drawElements(f,p),f.scale(1/c,1/c),f.translate(n.x1*c,n.y1*c);else{var m=t.pan(),h={x:m.x*c,y:m.y*c};c*=t.zoom(),f.translate(h.x,h.y),f.scale(c,c),this.drawElements(f,p),f.scale(1/c,1/c),f.translate(-h.x,-h.y)}e.bg&&(f.globalCompositeOperation=`destination-over`,f.fillStyle=e.bg,f.rect(0,0,i,a),f.fill())}return d};function MZ(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}function NZ(e){var t=e.indexOf(`,`);return e.substr(t+1)}function PZ(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case`blob-promise`:return new gV(function(r,i){try{t.toBlob(function(e){e==null?i(Error("`canvas.toBlob()` sent a null value in its callback")):r(e)},n,e.quality)}catch(e){i(e)}});case`blob`:return MZ(NZ(r()),n);case`base64`:return NZ(r());default:return r()}}jZ.png=function(e){return PZ(e,this.bufferCanvasImage(e),`image/png`)},jZ.jpg=function(e){return PZ(e,this.bufferCanvasImage(e),`image/jpeg`)};var FZ={};FZ.nodeShapeImpl=function(e,t,n,r,i,a,o,s){switch(e){case`ellipse`:return this.drawEllipsePath(t,n,r,i,a);case`polygon`:return this.drawPolygonPath(t,n,r,i,a,o);case`round-polygon`:return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case`roundrectangle`:case`round-rectangle`:return this.drawRoundRectanglePath(t,n,r,i,a,s);case`cutrectangle`:case`cut-rectangle`:return this.drawCutRectanglePath(t,n,r,i,a,o,s);case`bottomroundrectangle`:case`bottom-round-rectangle`:return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case`barrel`:return this.drawBarrelPath(t,n,r,i,a)}};var IZ=RZ,LZ=RZ.prototype;LZ.CANVAS_LAYERS=3,LZ.SELECT_BOX=0,LZ.DRAG=1,LZ.NODE=2,LZ.WEBGL=3,LZ.CANVAS_TYPES=[`2d`,`2d`,`2d`,`webgl2`],LZ.BUFFER_COUNT=3,LZ.TEXTURE_BUFFER=0,LZ.MOTIONBLUR_BUFFER_NODE=1,LZ.MOTIONBLUR_BUFFER_DRAG=2;function RZ(e){var t=this,n=t.cy.window().document;e.webgl&&(LZ.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log(`webgl rendering enabled`)),t.data={canvases:Array(LZ.CANVAS_LAYERS),contexts:Array(LZ.CANVAS_LAYERS),canvasNeedsRedraw:Array(LZ.CANVAS_LAYERS),bufferCanvases:Array(LZ.BUFFER_COUNT),bufferContexts:Array(LZ.CANVAS_LAYERS)};var r=`-webkit-tap-highlight-color`,i=`rgba(0,0,0,0)`;t.data.canvasContainer=n.createElement(`div`);var a=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=i,a.position=`relative`,a.zIndex=`0`,a.overflow=`hidden`;var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=i;var s={"-webkit-user-select":`none`,"-moz-user-select":`-moz-none`,"user-select":`none`,"-webkit-tap-highlight-color":`rgba(0,0,0,0)`,"outline-style":`none`};ZF()&&(s[`-ms-touch-action`]=`none`,s[`touch-action`]=`none`);for(var c=0;c<LZ.CANVAS_LAYERS;c++){var l=t.data.canvases[c]=n.createElement(`canvas`),u=LZ.CANVAS_TYPES[c];t.data.contexts[c]=l.getContext(u),t.data.contexts[c]||HL(`Could not create canvas of type `+u),Object.keys(s).forEach(function(e){l.style[e]=s[e]}),l.style.position=`absolute`,l.setAttribute(`data-id`,`layer`+c),l.style.zIndex=String(LZ.CANVAS_LAYERS-c),t.data.canvasContainer.appendChild(l),t.data.canvasNeedsRedraw[c]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[LZ.NODE].setAttribute(`data-id`,`layer`+LZ.NODE+`-node`),t.data.canvases[LZ.SELECT_BOX].setAttribute(`data-id`,`layer`+LZ.SELECT_BOX+`-selectbox`),t.data.canvases[LZ.DRAG].setAttribute(`data-id`,`layer`+LZ.DRAG+`-drag`),t.data.canvases[LZ.WEBGL]&&t.data.canvases[LZ.WEBGL].setAttribute(`data-id`,`layer`+LZ.WEBGL+`-webgl`);for(var c=0;c<LZ.BUFFER_COUNT;c++)t.data.bufferCanvases[c]=n.createElement(`canvas`),t.data.bufferContexts[c]=t.data.bufferCanvases[c].getContext(`2d`),t.data.bufferCanvases[c].style.position=`absolute`,t.data.bufferCanvases[c].setAttribute(`data-id`,`buffer`+c),t.data.bufferCanvases[c].style.zIndex=String(-c-1),t.data.bufferCanvases[c].style.visibility=`hidden`;t.pathsEnabled=!0;var d=XR(),f=function(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}},p=function(e){return{x:-e.w/2,y:-e.h/2}},m=function(e){var t=e[0]._private;return t.oldBackgroundTimestamp!==t.backgroundTimestamp},h=function(e){return e[0]._private.nodeKey},g=function(e){return e[0]._private.labelStyleKey},_=function(e){return e[0]._private.sourceLabelStyleKey},v=function(e){return e[0]._private.targetLabelStyleKey},y=function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},b=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`main`,a)},x=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`source`,a)},S=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`target`,a)},C=function(e){return e.boundingBox(),e[0]._private.bodyBounds},w=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||d},T=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||d},E=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||d},D=function(e,t){return t},O=function(e){return f(C(e))},k=function(e,t,n){var r=e?e+`-`:``;return{x:t.x+n.pstyle(r+`text-margin-x`).pfValue,y:t.y+n.pstyle(r+`text-margin-y`).pfValue}},A=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},j=function(e){return k(``,A(e,`labelX`,`labelY`),e)},M=function(e){return k(`source`,A(e,`sourceLabelX`,`sourceLabelY`),e)},N=function(e){return k(`target`,A(e,`targetLabelX`,`targetLabelY`),e)},P=function(e){return p(C(e))},F=function(e){return p(T(e))},I=function(e){return p(E(e))},L=function(e){var t=w(e),n=p(w(e));if(e.isNode()){switch(e.pstyle(`text-halign`).value){case`left`:n.x=-t.w-(t.leftPad||0);break;case`right`:n.x=-(t.rightPad||0);break}switch(e.pstyle(`text-valign`).value){case`top`:n.y=-t.h-(t.topPad||0);break;case`bottom`:n.y=-(t.botPad||0);break}}return n},R=t.data.eleTxrCache=new SY(t,{getKey:h,doesEleInvalidateKey:m,drawElement:y,getBoundingBox:C,getRotationPoint:O,getRotationOffset:P,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),ee=t.data.lblTxrCache=new SY(t,{getKey:g,drawElement:b,getBoundingBox:w,getRotationPoint:j,getRotationOffset:L,isVisible:D}),z=t.data.slbTxrCache=new SY(t,{getKey:_,drawElement:x,getBoundingBox:T,getRotationPoint:M,getRotationOffset:F,isVisible:D}),B=t.data.tlbTxrCache=new SY(t,{getKey:v,drawElement:S,getBoundingBox:E,getRotationPoint:N,getRotationOffset:I,isVisible:D}),V=t.data.lyrTxrCache=new zY(t);t.onUpdateEleCalcs(function(e,t){R.invalidateElements(t),ee.invalidateElements(t),z.invalidateElements(t),B.invalidateElements(t),V.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}});var H=function(e){for(var t=0;t<e.length;t++)V.enqueueElementRefinement(e[t].ele)};R.onDequeue(H),ee.onDequeue(H),z.onDequeue(H),B.onDequeue(H),e.webgl&&t.initWebgl(e,{getStyleKey:h,getLabelKey:g,getSourceLabelKey:_,getTargetLabelKey:v,drawElement:y,drawLabel:b,drawSourceLabel:x,drawTargetLabel:S,getElementBox:C,getLabelBox:w,getSourceLabelBox:T,getTargetLabelBox:E,getElementRotationPoint:O,getElementRotationOffset:P,getLabelRotationPoint:j,getSourceLabelRotationPoint:M,getTargetLabelRotationPoint:N,getLabelRotationOffset:L,getSourceLabelRotationOffset:F,getTargetLabelRotationOffset:I})}LZ.redrawHint=function(e,t){var n=this;switch(e){case`eles`:n.data.canvasNeedsRedraw[LZ.NODE]=t;break;case`drag`:n.data.canvasNeedsRedraw[LZ.DRAG]=t;break;case`select`:n.data.canvasNeedsRedraw[LZ.SELECT_BOX]=t;break;case`gc`:n.data.gc=!0;break}};var zZ=typeof Path2D<`u`;LZ.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},LZ.usePaths=function(){return zZ&&this.pathsEnabled},LZ.setImgSmoothing=function(e,t){e.imageSmoothingEnabled==null?(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t):e.imageSmoothingEnabled=t},LZ.getImgSmoothing=function(e){return e.imageSmoothingEnabled==null?e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled:e.imageSmoothingEnabled},LZ.makeOffscreenCanvas=function(e,t){var n;return(typeof OffscreenCanvas>`u`?`undefined`:TF(OffscreenCanvas))===`undefined`?(n=this.cy.window().document.createElement(`canvas`),n.width=e,n.height=t):n=new OffscreenCanvas(e,t),n},[UY,XY,rX,aX,oX,lX,dX,sZ,wZ,jZ,FZ].forEach(function(e){pI(LZ,e)});var BZ=[{type:`layout`,extensions:Yq},{type:`renderer`,extensions:[{name:`null`,impl:Xq},{name:`base`,impl:ZJ},{name:`canvas`,impl:IZ}]}],VZ={},HZ={};function UZ(e,t,n){var r=n,i=function(n){WL("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if(e===`core`){if(sq.prototype[t])return i(t);sq.prototype[t]=n}else if(e===`collection`){if(xK.prototype[t])return i(t);xK.prototype[t]=n}else if(e===`layout`){for(var a=function(e){this.options=e,n.call(this,e),LF(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],c=0;c<s.length;c++){var l=s[c];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var u=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return u?u.call(this):this.emit(`layoutstop`),this},o.destroy||=function(){return this},o.cy=function(){return this._private.cy};var d=function(e){return e._private.cy},f={addEventFields:function(e,t){t.layout=e,t.cy=d(e),t.target=e},bubble:function(){return!0},parent:function(e){return d(e)}};pI(o,{createEmitter:function(){return this._private.emitter=new UG(f,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),gW.eventAliasesOn(o),r=a}else if(e===`renderer`&&t!==`null`&&t!==`base`){var p=WZ(`renderer`,`base`),m=p.prototype,h=n,g=n.prototype,_=function(){p.apply(this,arguments),h.apply(this,arguments)},v=_.prototype;for(var y in m){var b=m[y];if(g[y]!=null)return i(y);v[y]=b}for(var x in g)v[x]=g[x];m.clientFunctions.forEach(function(e){v[e]=v[e]||function(){HL("Renderer does not implement `renderer."+e+"()` on its prototype")}}),r=_}else if(e===`__proto__`||e===`constructor`||e===`prototype`)return HL(e+` is an illegal type to be registered, possibly lead to prototype pollutions`);return bI({map:VZ,keys:[e,t],value:r})}function WZ(e,t){return xI({map:VZ,keys:[e,t]})}function GZ(e,t,n,r,i){return bI({map:HZ,keys:[e,t,n,r],value:i})}function KZ(e,t,n,r){return xI({map:HZ,keys:[e,t,n,r]})}var qZ=function(){if(arguments.length===2)return WZ.apply(null,arguments);if(arguments.length===3)return UZ.apply(null,arguments);if(arguments.length===4)return KZ.apply(null,arguments);if(arguments.length===5)return GZ.apply(null,arguments);HL(`Invalid extension access syntax`)};sq.prototype.extension=qZ,BZ.forEach(function(e){e.extensions.forEach(function(t){UZ(e.type,t.name,t.impl)})});var JZ=function(){if(!(this instanceof JZ))return new JZ;this.length=0},YZ=JZ.prototype;YZ.instanceString=function(){return`stylesheet`},YZ.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},YZ.css=function(e,t){var n=this.length-1;if(PF(e))this[n].properties.push({name:e,value:t});else if(LF(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];if(s!=null){var c=tq.properties[o]||tq.properties[eI(o)];if(c!=null){var l=c.name,u=s;this[n].properties.push({name:l,value:u})}}}return this},YZ.style=YZ.css,YZ.generateStyle=function(e){var t=new tq(e);return this.appendToStyle(t)},YZ.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var XZ=`3.33.4`,ZZ=function(e){if(e===void 0&&(e={}),LF(e))return new sq(e);if(PF(e))return qZ.apply(qZ,arguments)};ZZ.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(ZZ),e.apply(null,t),this},ZZ.warnings=function(e){return UL(e)},ZZ.version=XZ,ZZ.stylesheet=ZZ.Stylesheet=JZ;var QZ=/^#{1,6}\s+/,$Z=/[*_`~]+/g,eQ=/\s+/g;function tQ(e){return e.replace(QZ,``).replace($Z,``).replace(eQ,` `).trim()}var nQ={sage:`#abcfb8`,ochre:`#edbf7f`,terracotta:`#ffb4a1`,neutral:`#8b928c`,dimNeutral:`#6e7370`,onSurface:`#e5e2e1`,surface:`#111111`},rQ={concept:nQ.sage,component:nQ.ochre,bug:nQ.terracotta,tool:nQ.neutral,file:nQ.neutral,spore:nQ.sage,session:nQ.ochre,other:nQ.dimNeutral},iQ=nQ.dimNeutral,aQ=24,oQ=60,sQ=12,cQ=10,lQ=8,uQ=1.5,dQ=.25,fQ=.7,pQ=9,mQ=.7,hQ=4,gQ=.6,_Q=1e4,vQ=120,yQ=.2,bQ=600,xQ=300,SQ=.95,CQ=1.2,wQ=50,TQ=20,EQ={concept:`Concept`,component:`Component`,bug:`Bug`,tool:`Tool`,file:`File`,spore:`Spore`,session:`Session`,other:`Other`};function DQ(e,t){return t?oQ*1.2:aQ+Math.min(e/sQ,1)*(oQ-aQ)}function OQ(e){let t=tQ(e);return t.length<=TQ?t:t.slice(0,TQ-1)+`…`}function kQ(e){return rQ[e?.toLowerCase()]??iQ}function AQ(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)%360}function jQ(e){e.elements().removeClass(`faded`),e.elements().unselect(),e.edges().style({"line-opacity":dQ,"text-opacity":0,width:uQ})}function MQ(e,t){if(!t){jQ(e);return}let n=e.$id(t);if(n.length===0){jQ(e);return}jQ(e),n.select();let r=n.closedNeighborhood();e.elements().not(r).addClass(`faded`),n.connectedEdges().style({"line-opacity":fQ,"text-opacity":0,width:2})}function NQ({nodes:e,edges:t,onNodeSelect:n,centerId:r,centerNodeType:i,selectedNodeId:a}){let o=(0,W.useRef)(null),s=(0,W.useRef)(null),c=(0,W.useRef)(null),l=(0,W.useRef)(null),u=(0,W.useRef)(n);u.current=n;let d=(0,W.useMemo)(()=>new Map(e.map(e=>[e.id,e])),[e]),f=(0,W.useMemo)(()=>{let n=new Map;for(let t of e)n.set(t.id,0);for(let e of t)n.set(e.source_id,(n.get(e.source_id)??0)+1),n.set(e.target_id,(n.get(e.target_id)??0)+1);return n},[e,t]),p=(0,W.useMemo)(()=>[{selector:`node`,style:{label:`data(label)`,"background-color":e=>kQ(e.data(`type`)),"background-opacity":.9,color:nQ.onSurface,"font-size":cQ,"font-family":`Inter, system-ui, sans-serif`,"text-valign":`bottom`,"text-margin-y":lQ,"text-outline-color":nQ.surface,"text-outline-width":2,"text-outline-opacity":.8,"text-wrap":`wrap`,"text-max-width":`120px`,width:`data(nodeSize)`,height:`data(nodeSize)`,"border-width":0,"border-color":nQ.sage,"border-opacity":0,"overlay-opacity":0}},{selector:`node.center`,style:{"border-width":2,"border-color":nQ.onSurface,"border-opacity":.4,"text-outline-color":nQ.surface,"text-outline-width":3,"font-weight":`bold`}},{selector:`node:active`,style:{"overlay-opacity":.08,"overlay-color":nQ.sage}},{selector:`node:selected`,style:{"border-width":hQ,"border-color":e=>kQ(e.data(`type`)),"border-opacity":gQ,"background-opacity":1}},{selector:`edge`,style:{width:uQ,"line-color":nQ.neutral,"line-opacity":dQ,"curve-style":`unbundled-bezier`,"control-point-distances":[40],"control-point-weights":[.5],"target-arrow-shape":`triangle`,"target-arrow-color":nQ.neutral,"arrow-scale":mQ,label:`data(label)`,"font-size":pQ,"font-family":`Inter, system-ui, sans-serif`,color:nQ.neutral,"text-opacity":0,"text-rotation":`autorotate`,"text-margin-y":-8,"text-outline-color":nQ.surface,"text-outline-width":2,"text-outline-opacity":.7}},{selector:`edge:active`,style:{"text-opacity":1,"line-opacity":fQ}},{selector:`node.faded`,style:{opacity:.3}},{selector:`edge.faded`,style:{opacity:.1}}],[]),m=(0,W.useCallback)(n=>{let i=o.current?.getBoundingClientRect(),a={x:i?i.width/2:0,y:i?i.height/2:0};return[...e.map(e=>{let i=EQ[e.type?.toLowerCase()]??EQ.other,o=e.id===r,s=n?.get(e.id);if(!s){let i=t.find(t=>t.source_id===e.id||t.target_id===e.id),o=i?i.source_id===e.id?i.target_id:i.source_id:r,c=(o&&n?.get(o))??a,l=AQ(e.id)*Math.PI/180,u=o===r?150:110;s={x:c.x+Math.cos(l)*u,y:c.y+Math.sin(l)*u}}return{data:{id:e.id,label:`${OQ(e.name)}\n${i}`,fullLabel:e.name,type:e.type,isCenter:o,degree:f.get(e.id)??0,nodeSize:DQ(f.get(e.id)??0,o)},position:s,classes:o?`center`:``}}),...t.map((e,t)=>({data:{id:`edge-${t}`,source:e.source_id,target:e.target_id,label:e.label??``,weight:e.weight??1}}))]},[r,f,t,e]),h=(0,W.useCallback)((e,t)=>{if(!t){e.resize(),MQ(e,a??null);return}let n=r&&i===`session`?e.layout({name:`cose`,animate:!0,animationDuration:bQ,nodeRepulsion:()=>_Q*1.5,idealEdgeLength:()=>vQ*1.35,gravity:yQ*.75,nodeDimensionsIncludeLabels:!0,fit:!0,padding:wQ*1.2,randomize:!1}):r?e.layout({name:`concentric`,animate:!0,animationDuration:xQ,fit:!0,padding:wQ,spacingFactor:CQ,avoidOverlap:!0,concentric:e=>e.id()===r?3:e.closedNeighborhood().some(e=>e.isNode()&&e.id()===r)?2:1,levelWidth:()=>1,nodeDimensionsIncludeLabels:!0}):e.layout({name:`cose`,animate:!0,animationDuration:bQ,nodeRepulsion:()=>_Q,idealEdgeLength:()=>vQ,gravity:yQ,nodeDimensionsIncludeLabels:!0,fit:!0,padding:wQ});n.on(`layoutstop`,()=>{let e=s.current;if(!e)return;let t=e.$(`node.center`);if(t.length>0){let n=t.closedNeighborhood();e.fit(n,wQ*1.5),e.zoom()<SQ&&(e.zoom(SQ),e.center(t))}else e.fit(void 0,wQ);MQ(e,a??null)}),n.run()},[r,i,a]);return(0,W.useEffect)(()=>{let e=o.current;if(!e)return;function t(){let t=e.getBoundingClientRect();if(t.width===0||t.height===0||s.current)return;let n=ZZ({container:e,elements:[],style:p,layout:{name:`preset`},userZoomingEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,minZoom:.3,maxZoom:3});n.on(`tap`,`node`,e=>{let t=e.target.data(),n=d.get(t.id);u.current?.(n??{id:t.id,name:t.fullLabel??t.label,type:t.type})}),n.on(`tap`,e=>{e.target===n&&u.current?.(null)}),n.on(`mouseover`,`edge`,e=>{e.target.style(`text-opacity`,1),e.target.style(`line-opacity`,fQ)}),n.on(`mouseout`,`edge`,e=>{let t=n.$(`node:selected`);t.length>0&&t.connectedEdges().contains(e.target)||(e.target.style(`text-opacity`,0),e.target.style(`line-opacity`,dQ))}),s.current=n}return t(),c.current?.disconnect(),c.current=new ResizeObserver(()=>{s.current?s.current.resize():t()}),c.current.observe(e),()=>{c.current?.disconnect(),c.current=null,s.current?.destroy(),s.current=null}},[d,p]),(0,W.useEffect)(()=>{let e=s.current;if(!e)return;let t=new Map;e.nodes().forEach(e=>{t.set(e.id(),{x:e.position(`x`),y:e.position(`y`)})}),e.elements().remove(),e.add(m(t));let n=l.current!==(r??null);l.current=r??null,h(e,n||t.size===0)},[m,r,h]),(0,W.useEffect)(()=>{let e=s.current;e&&MQ(e,a??null)},[a]),{containerRef:o,resetView:(0,W.useCallback)(()=>{let e=s.current;e&&(jQ(e),e.fit(void 0,wQ))},[])}}function PQ({nodes:e,edges:t,onNodeSelect:n,selectedNode:r,centerId:i,centerNodeType:a,isLoading:o}){let{containerRef:s,resetView:c}=NQ({nodes:e,edges:t,onNodeSelect:n,centerId:i,centerNodeType:a,selectedNodeId:r?.id??null});return(0,G.jsxs)(`div`,{className:`absolute inset-0`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 rounded-md bg-surface-container-lowest`,style:{backgroundImage:`radial-gradient(circle at 2px 2px, rgba(139, 146, 140, 0.05) 1px, transparent 0)`,backgroundSize:`40px 40px`}}),(0,G.jsx)(`div`,{ref:s,className:`absolute inset-0 rounded-md`,style:{width:`100%`,height:`100%`}}),(0,G.jsxs)(`div`,{className:`absolute bottom-3 left-3 z-10 flex items-center gap-3`,children:[e.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 font-mono text-[10px] text-on-surface-variant/60 mr-1`,children:[(0,G.jsxs)(`span`,{children:[e.length,` nodes`]}),(0,G.jsxs)(`span`,{children:[t.length,` edges`]})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:c,className:`gap-1.5 h-7 text-[10px] px-2 bg-surface-container-high/40 backdrop-blur-xs`,children:[(0,G.jsx)($a,{className:`h-3 w-3`}),`Reset View`]})]}),!o&&e.length===0&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No nodes to display`})})]})}var FQ=400,IQ={concept:`default`,component:`warning`,bug:`destructive`,tool:`secondary`,file:`secondary`,spore:`default`,session:`warning`},LQ={concept:`bg-primary`,component:`bg-secondary`,bug:`bg-tertiary`,tool:`bg-outline`,file:`bg-outline`,spore:`bg-primary`,session:`bg-secondary`};function RQ({label:e,value:t}){return(0,G.jsxs)(`div`,{className:`flex justify-between items-baseline py-1`,children:[(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:e}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface text-right max-w-[160px] truncate`,children:t})]})}function zQ(e){return e.type===`session`?`/sessions/${e.id}`:e.type===`spore`?`/mycelium?tab=spores&spore=${e.id}`:null}function BQ({node:e,edges:t,nodes:n,metadata:r,markdownPreview:i,connectedSpores:a,onClose:o,onNodeSelect:s,onFocusNode:c,onNavigateToSpore:l,isConnectionsLoading:u}){let d=Nn();if(!e)return null;let f=e.type.toLowerCase(),p=IQ[f]??`secondary`,m=LQ[f]??`bg-outline`,h=new Map((n??[]).map(e=>[e.id,e])),g=[];for(let n of t??[])if(n.source_id===e.id){let e=h.get(n.target_id);e&&g.push({nodeId:e.id,nodeName:e.name,nodeType:e.type,edgeLabel:n.label??`connected`,direction:`outgoing`,status:e.status})}else if(n.target_id===e.id){let e=h.get(n.source_id);e&&g.push({nodeId:e.id,nodeName:e.name,nodeType:e.type,edgeLabel:n.label??`connected`,direction:`incoming`,status:e.status})}g.sort((e,t)=>e.nodeName.localeCompare(t.nodeName));let _=i??e.content,v=_&&_.length>FQ?_.slice(0,FQ)+`…`:_,y=e.type===`spore`?`Observation`:e.type===`session`?`Summary`:`Notes`;return(0,G.jsxs)(Q,{glass:!0,className:`absolute top-3 right-3 bottom-3 z-20 w-[320px] overflow-y-auto flex flex-col shadow-lg border border-outline-variant/15 rounded-md`,children:[(0,G.jsx)(`div`,{className:`p-4 pb-3`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,G.jsx)(`div`,{className:`h-2 w-2 rounded-full ${m} shrink-0`}),(0,G.jsx)(X,{variant:p,className:`text-[10px] uppercase`,children:e.observation_type??e.type})]}),(0,G.jsx)(`h2`,{className:`font-serif text-lg text-on-surface leading-tight break-words`,children:tQ(e.name)}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-3 mt-2`,children:zQ(e)&&(0,G.jsxs)(`button`,{onClick:()=>{e.type===`spore`&&l?l(e.id):d(zQ(e))},className:`inline-flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-primary transition-colors group cursor-pointer`,children:[(0,G.jsxs)(`span`,{children:[`View `,e.type]}),(0,G.jsx)(va,{className:`h-3 w-3 group-hover:translate-x-0.5 transition-transform`})]})})]}),o&&(0,G.jsx)(`button`,{onClick:o,className:`shrink-0 rounded-md p-1 text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high transition-colors`,children:(0,G.jsx)(So,{className:`h-4 w-4`})})]})}),(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-0.5`,children:[(0,G.jsx)(MM,{children:`Metadata`}),(0,G.jsxs)(`div`,{className:`mt-1.5`,children:[(0,G.jsx)(RQ,{label:`Type`,value:e.observation_type??e.type}),(0,G.jsx)(RQ,{label:`ID`,value:e.id.slice(0,12)+`…`}),e.status&&(0,G.jsx)(RQ,{label:`Status`,value:e.status}),e.created_at!=null&&(0,G.jsx)(RQ,{label:`Created`,value:new Date(e.created_at).toLocaleDateString()}),e.mention_count!=null&&e.mention_count>0&&(0,G.jsx)(RQ,{label:`Mentions`,value:String(e.mention_count)}),(0,G.jsx)(RQ,{label:`Connections`,value:String(g.length)}),e.depth!==void 0&&(0,G.jsx)(RQ,{label:`Depth`,value:String(e.depth)}),r&&Object.entries(r).map(([e,t])=>(0,G.jsx)(RQ,{label:e,value:t},e))]})]}),v&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-1.5`,children:[(0,G.jsx)(MM,{children:y}),(0,G.jsx)(Q,{level:`lowest`,className:`p-3`,children:(0,G.jsx)(fO,{content:v,className:`text-xs leading-relaxed text-on-surface-variant`})})]})]}),(g.length>0||u)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(MM,{children:[`Connections (`,g.length,`)`]}),u&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] uppercase tracking-wider text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-3 w-3 animate-spin`}),`Updating`]})]}),(0,G.jsx)(`div`,{className:`space-y-1`,children:g.map((e,t)=>(0,G.jsxs)(`div`,{className:`group w-full rounded-md border border-transparent px-2 py-2 transition-colors hover:border-outline-variant/10 hover:bg-surface-container-high/50`,children:[(0,G.jsx)(`button`,{type:`button`,className:`w-full text-left`,onClick:()=>{let t=h.get(e.nodeId);s?.(t??{id:e.nodeId,name:e.nodeName,type:e.nodeType,status:e.status},`inspector`)},children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`div`,{className:`mt-1 h-2 w-2 rounded-full ${LQ[e.nodeType.toLowerCase()]??`bg-outline`} shrink-0`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate font-sans text-xs text-on-surface transition-colors group-hover:text-primary`,children:tQ(e.nodeName)}),(0,G.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 text-[9px] uppercase tracking-wider text-on-surface-variant/60`,children:[(0,G.jsx)(`span`,{children:e.nodeType}),(0,G.jsx)(`span`,{children:`•`}),(0,G.jsx)(`span`,{children:e.edgeLabel})]})]}),(0,G.jsx)(qi,{className:`mt-0.5 h-3 w-3 shrink-0 text-on-surface-variant/50 ${e.direction===`incoming`?`rotate-180`:``}`})]})}),(0,G.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 px-2 text-[10px] uppercase tracking-wide`,onClick:()=>{let t=h.get(e.nodeId);c?.(t??{id:e.nodeId,name:e.nodeName,type:e.nodeType,status:e.status})},children:`Focus`})})]},`${e.nodeId}-${e.edgeLabel}-${t}`))})]})]}),a&&a.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-1.5`,children:[(0,G.jsx)(MM,{children:`Connected Spores`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:a.map(e=>(0,G.jsx)(X,{variant:`secondary`,className:`cursor-pointer text-[10px] hover:bg-surface-container-highest transition-colors`,children:e.name},e.id))})]})]})]})}function VQ({searchPlaceholder:e=`Search...`,searchValue:t,onSearchChange:n,filters:r=[],filterValues:i={},onFilterChange:a,inputRef:o}){return(0,G.jsxs)(Q,{level:`bright`,className:`flex items-center gap-3 px-4 py-2 rounded-md`,children:[(0,G.jsx)(no,{className:`h-3.5 w-3.5 text-on-surface-variant shrink-0`}),(0,G.jsx)(Kf,{ref:o,placeholder:e,value:t,onChange:e=>n(e.target.value),className:`bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1`,"aria-label":e}),r.map(e=>(0,G.jsx)(`div`,{className:`w-40 shrink-0`,children:(0,G.jsxs)(c_,{value:i[e.key]??`all`,onValueChange:t=>a?.(e.key,t),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:e.label})}),(0,G.jsx)(d_,{children:e.options.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})},e.key))]})}function HQ(e){switch(e){case`wisdom`:return`bg-primary/15 text-primary`;case`discovery`:return`bg-primary/15 text-primary`;case`decision`:return`bg-secondary/15 text-secondary`;case`trade_off`:return`bg-secondary/15 text-secondary`;case`gotcha`:return`bg-tertiary/15 text-tertiary`;case`bug_fix`:return`bg-tertiary/15 text-tertiary`;default:return`bg-surface-container text-on-surface-variant`}}function UQ(e){switch(e){case`active`:return`bg-primary/15 text-primary`;case`consolidated`:return`bg-surface-container-high text-on-surface-variant`;case`superseded`:return`bg-tertiary/10 text-tertiary/70`;case`obsolete`:return`bg-surface-container text-on-surface-variant/60`;default:return`bg-surface-container text-on-surface-variant`}}function WQ(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}var GQ=120,KQ=1e3,qQ=[{key:`type`,label:`Type`,options:[`all`,`gotcha`,`decision`,`discovery`,`trade_off`,`bug_fix`].map(e=>({value:e,label:e===`all`?`All types`:WQ(e)}))},{key:`status`,label:`Status`,options:[`all`,`active`,`superseded`,`consolidated`,`obsolete`].map(e=>({value:e,label:e===`all`?`All statuses`:WQ(e)}))}];function JQ(e){return new Date(e*KQ).toLocaleDateString()}function YQ({spore:e,onClick:t,isSelected:n}){return(0,G.jsx)(Q,{level:n?`high`:`low`,className:J(`p-4 cursor-pointer transition-all duration-150 hover:bg-surface-container-high hover:shadow-[inset_3px_0_0_var(--primary)] rounded-lg`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,n&&`ring-1 ring-primary/30`),onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},tabIndex:0,role:`button`,"aria-label":`${WQ(e.observation_type)} spore: ${ev(e.content,GQ)}`,"aria-pressed":n,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold`,HQ(e.observation_type)),children:WQ(e.observation_type)}),(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold`,UQ(e.status)),children:WQ(e.status)}),e.importance!==null&&(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:e.importance.toFixed(1)}),(0,G.jsx)(xM,{annotation:e.release_state})]}),(0,G.jsx)(fO,{content:e.content,compact:!0,className:`text-on-surface line-clamp-2`})]}),(0,G.jsxs)(`div`,{className:`shrink-0 text-right space-y-1`,children:[e.session_id&&(0,G.jsx)(`div`,{className:`font-mono text-xs text-on-surface-variant`,children:tv(e.session_id)}),(0,G.jsx)(`div`,{className:`font-sans text-xs text-on-surface-variant`,children:JQ(e.created_at)})]})]})})}function XQ(){return(0,G.jsx)(Q,{level:`low`,className:`p-4 rounded-lg`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`div`,{className:`h-5 w-16 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-5 w-14 animate-pulse rounded bg-surface-container`})]}),(0,G.jsx)(`div`,{className:`h-4 w-3/4 animate-pulse rounded bg-surface-container`})]}),(0,G.jsxs)(`div`,{className:`shrink-0 space-y-1`,children:[(0,G.jsx)(`div`,{className:`h-3 w-14 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-16 animate-pulse rounded bg-surface-container`})]})]})})}function ZQ({onSelectSpore:e,selectedSporeId:t}){let{searchInput:n,debouncedSearch:r,filterValues:i,offset:a,setOffset:o,handleSearchChange:s,handleFilterChange:c,activeFilter:l}=GN({initialFilters:{type:`all`,status:`all`}}),u=l(`type`),d=l(`status`),{data:f,isLoading:p,isError:m,error:h}=hN({type:u,status:d,search:r,limit:50,offset:a}),g=f?.spores??[],_=f?.total??0;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(VQ,{searchPlaceholder:`Search spores...`,searchValue:n,onSearchChange:s,filters:qQ,filterValues:i,onFilterChange:c}),m?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-destructive`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load spores`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:h instanceof Error?h.message:`Unknown error`})]}):(0,G.jsx)(`div`,{className:`space-y-2`,children:p?[1,2,3,4,5].map(e=>(0,G.jsx)(XQ,{},e)):g.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(lo,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:_===0&&!r&&!u&&!d?`No spores yet`:`No matching spores`}),_===0&&!r&&!u&&!d&&(0,G.jsx)(`span`,{className:`font-sans text-xs`,children:`Spores are extracted from session activity by the agent`})]}):g.map(n=>(0,G.jsx)(YQ,{spore:n,onClick:()=>e(n),isSelected:n.id===t},n.id))}),(0,G.jsx)(fM,{total:_,offset:a,limit:50,onPageChange:o})]})}var QQ=12,$Q=8;function e$({type:e}){return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold`,HQ(e)),children:WQ(e)})}function t$({status:e}){return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold`,UQ(e)),children:WQ(e)})}function n$({label:e,value:t,children:n}){return(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 py-1.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-on-surface-variant`,children:e}),n??(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface text-right break-all`,children:t})]})}function r$({id:e,onBack:t,onNavigateToSpore:n,onNavigateToGraph:r}){let i=Nn(),{data:a,isLoading:o,isError:s,error:c}=gN(e);if(o)return(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans`,children:`Loading spore...`})]});if(s||!a)return(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-destructive`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Spore not found`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:c instanceof Error?c.message:`Unknown error`})]});let l=(()=>{if(!a.tags)return[];if(a.tags.startsWith(`[`))try{return JSON.parse(a.tags)}catch{}return a.tags.split(`,`).map(e=>e.trim()).filter(Boolean)})();return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Spores`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,G.jsx)(e$,{type:a.observation_type}),(0,G.jsx)(t$,{status:a.status}),(0,G.jsx)(xM,{annotation:a.release_state}),a.importance!==null&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Importance: `,(0,G.jsx)(`span`,{className:`text-on-surface font-medium`,children:a.importance.toFixed(1)})]}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant ml-auto`,children:Q_(a.created_at)})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-5`,children:[(0,G.jsx)(MM,{className:`mb-2`,children:`Observation`}),(0,G.jsx)(fO,{content:a.content})]}),a.context&&(0,G.jsxs)(Q,{level:`low`,className:`p-5`,children:[(0,G.jsx)(MM,{className:`mb-2`,children:`Context`}),(0,G.jsx)(fO,{content:a.context})]}),l.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:l.map(e=>(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-surface-container px-2.5 py-0.5 font-sans text-xs text-on-surface-variant`,children:e},e))}),(a.predecessor_id||a.successor_id)&&(0,G.jsxs)(Q,{level:`low`,className:`p-5 space-y-2`,children:[(0,G.jsx)(MM,{children:`Resolution History`}),a.predecessor_id&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{children:`Supersedes`}),(0,G.jsxs)(`button`,{className:`font-mono text-primary hover:underline flex items-center gap-1`,onClick:()=>n?.(a.predecessor_id),children:[a.predecessor_id.slice(0,$Q),(0,G.jsx)(qi,{className:`h-3 w-3`})]})]}),a.successor_id&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{children:`Superseded by`}),(0,G.jsxs)(`button`,{className:`font-mono text-primary hover:underline flex items-center gap-1`,onClick:()=>n?.(a.successor_id),children:[a.successor_id.slice(0,$Q),(0,G.jsx)(qi,{className:`h-3 w-3`})]})]})]}),(0,G.jsxs)(Q,{glass:!0,className:`p-5`,children:[(0,G.jsx)(MM,{className:`mb-2`,children:`Metadata`}),(0,G.jsxs)(`div`,{className:`text-sm`,children:[(0,G.jsx)(n$,{label:`ID`,value:a.id}),(0,G.jsx)(n$,{label:`Created`,value:$_(a.created_at)}),(0,G.jsx)(n$,{label:`Updated`,value:$_(a.updated_at)}),a.session_id&&(0,G.jsx)(n$,{label:`Session`,children:(0,G.jsxs)(`button`,{className:`font-mono text-xs text-primary hover:underline flex items-center gap-1`,onClick:()=>i(`/sessions/${a.session_id}`),children:[a.session_id.slice(0,QQ),(0,G.jsx)(va,{className:`h-3 w-3`})]})}),a.agent_id&&(0,G.jsx)(n$,{label:`Agent`,value:a.agent_id})]})]})]})}var i$=new Set([`spore`,`session`,`other`]),a$=200,o$=`right-[332px]`,s$=6,c$=`h-[calc(100vh-285px)]`,l$=[{id:`graph`,label:`Graph`,description:`connection map`},{id:`spores`,label:`Spores`,description:`captured knowledge`}],u$=`tab`,d$=`spore`,f$=new Set([`graph`,`spores`]);function p$(){let e=new URLSearchParams(window.location.search),t=e.get(u$),n=e.get(d$)??void 0;return{tab:n?`spores`:t&&f$.has(t)?t:`graph`,sporeId:n}}function m$(e,t){let n=new URLSearchParams;e!==`graph`&&n.set(u$,e),t&&n.set(d$,t);let r=n.toString(),i=r?`${window.location.pathname}?${r}`:window.location.pathname;window.history.pushState(null,``,i)}function h$(e){if(!e)return[];let t=[];return`center`in e&&e.center&&t.push(e.center),e.nodes&&t.push(...e.nodes),t}function g$(e,t){let n=e.findIndex(e=>e.id===t.id);return n>=0?[...e.slice(0,n),t].slice(-3):[...e,t].slice(-3)}function _$({onNavigateToSpore:e}){let[t,n]=(0,W.useState)(`focus`),[r,i]=(0,W.useState)(null),[a,o]=(0,W.useState)(1),[s]=(0,W.useState)(new Set(i$)),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)([]),{data:m,isLoading:h}=yN(),g=t===`focus`&&r!==null,{data:_,isLoading:v}=vN(t===`global`||c.length>0),{data:y,isLoading:b}=_N(r??void 0,a,g),x=u!==null&&u.id!==r,{data:S,isLoading:C}=_N(u?.id,1,x),w=t===`global`?_:y,T=t===`global`?v:h||g&&b,E=(_?.nodes?.length??0)>a$;(0,W.useEffect)(()=>{if(!r&&m?.recommended_id){let e=m.seeds.find(e=>e.id===m.recommended_id),t=(e?.type===`session`?m.seeds.find(e=>e.type!==`session`):null)??e??m.seeds[0];t&&(i(t.id),d(t),p(e=>g$(e,t)))}},[r,m]),(0,W.useEffect)(()=>{t===`focus`&&r&&y?.center?.id===r&&(d(y.center),p(e=>e.length===0?[y.center]:g$(e,y.center)))},[r,y,t]);let D=u?.id===r?y:S,O=u?.id===r?b:C,k=(0,W.useMemo)(()=>h$(D),[D]),A=D?.edges??[],j=(0,W.useMemo)(()=>h$(w),[w]),M=(0,W.useMemo)(()=>j.filter(e=>{let t=e.type.toLowerCase(),n=i$.has(t)?t:`other`;return!!s.has(n)}),[j,s]),N=(0,W.useMemo)(()=>{let e=w?.edges??[],t=new Set(M.map(e=>e.id));return e.filter(e=>t.has(e.source_id)&&t.has(e.target_id))},[w?.edges,M]),P=(0,W.useCallback)((e,t=`canvas`)=>{d(e)},[t]),F=(0,W.useCallback)(e=>{p(t=>g$(t,e)),i(e.id),d(e),n(`focus`)},[]),I=(0,W.useCallback)(()=>{n(`global`)},[]),L=(0,W.useCallback)(()=>{!r&&u&&(p(e=>g$(e,u)),i(u.id)),n(`focus`)},[r,u]),R=(0,W.useCallback)(e=>{p(t=>{let n=t.findIndex(t=>t.id===e.id);return n>=0?t.slice(0,n+1):t}),i(e.id),d(e),n(`focus`)},[]),ee=(0,W.useCallback)(()=>{p(e=>{if(e.length<=1)return e;let t=e.slice(0,-1),r=t[t.length-1];return r&&(i(r.id),d(r),n(`focus`)),t})},[]),z=(0,W.useMemo)(()=>{let e=_?.nodes??[];return e.length>0?e:j},[_?.nodes,j]),B=c?z.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t).filter(e=>tQ(e.name).toLowerCase().includes(c.toLowerCase())).slice(0,s$):[];return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg border border-outline-variant/20 bg-surface-container/72 px-4 py-3 shadow-xs`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative min-w-[260px] flex-1 max-w-[420px]`,children:[(0,G.jsx)(no,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-on-surface-variant/60`}),(0,G.jsx)(Kf,{placeholder:`Find a node or idea...`,value:c,onChange:e=>l(e.target.value),className:`h-9 pl-9`})]}),(0,G.jsxs)(`div`,{className:`flex rounded-lg border border-outline-variant/10 bg-surface-container-high p-1 shadow-xs`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,className:J(`h-8 px-3 gap-1.5 transition-all`,t===`global`?`bg-surface-container-lowest text-primary shadow-xs`:`text-on-surface-variant hover:text-on-surface`),onClick:I,children:[(0,G.jsx)(Ga,{className:`h-3.5 w-3.5`}),(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:`Overview`})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!r&&!u,className:J(`h-8 px-3 gap-1.5 transition-all`,t===`focus`?`bg-surface-container-lowest text-primary shadow-xs`:`text-on-surface-variant hover:text-on-surface`,!r&&!u&&`cursor-not-allowed opacity-50`),onClick:L,children:[(0,G.jsx)(po,{className:`h-3.5 w-3.5`}),(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:`Focus`})]})]}),t===`focus`&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1 rounded-lg border border-outline-variant/10 bg-surface-container-high p-1 shadow-xs`,children:[(0,G.jsx)(`span`,{className:`px-2 font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`Depth`}),[1,2,3].map(e=>(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:J(`h-7 min-w-7 rounded-md border px-2 font-mono text-[10px] transition-all`,a===e?`border-primary/40 bg-primary/15 text-primary shadow-xs font-bold`:`border-transparent text-on-surface-variant hover:border-outline-variant/20 hover:text-on-surface`),onClick:()=>o(e),children:e},e))]})]}),B.length>0&&(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 pt-1`,children:[(0,G.jsx)(`span`,{className:`text-[11px] uppercase tracking-[0.16em] text-on-surface-variant`,children:`Jump To`}),B.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>F(e),className:J(`max-w-[220px] truncate rounded-full border px-3 py-1 text-[11px] transition-colors`,u?.id===e.id?`border-primary/40 bg-primary/10 text-on-surface`:`border-outline-variant/20 bg-surface-container-low/50 text-on-surface-variant hover:text-on-surface`),title:tQ(e.name),children:tQ(e.name)},e.id))]}),c&&B.length===0&&_&&(0,G.jsxs)(`div`,{className:`mt-3 border-t border-outline-variant/10 pt-3 text-sm text-on-surface-variant`,children:['No graph nodes matched `"',c,'"`.']}),f.length>0&&(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-outline-variant/10 pt-3`,children:[(0,G.jsx)(`span`,{className:`text-[11px] uppercase tracking-[0.16em] text-on-surface-variant`,children:`Trail`}),f.length>1&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:`h-7 shrink-0 px-2 text-[10px]`,onClick:ee,children:`Back`}),f.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>R(e),className:J(`max-w-[180px] truncate rounded-full border px-3 py-1 text-[11px] transition-colors`,r===e.id?`border-primary/40 bg-primary/10 text-on-surface`:`border-outline-variant/20 bg-surface-container-low/50 text-on-surface-variant hover:text-on-surface`),title:tQ(e.name),children:tQ(e.name)},e.id))]})]}),(0,G.jsxs)(`div`,{className:J(`relative`,c$),children:[T&&(0,G.jsx)(`div`,{className:`absolute inset-0 z-30 flex items-center justify-center rounded-md bg-surface-container-lowest/50 backdrop-blur-[2px] transition-opacity`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent`}),(0,G.jsxs)(`span`,{className:`text-xs font-mono animate-pulse text-on-surface-variant`,children:[`Cultivating `,t,` graph...`]})]})}),(0,G.jsx)(`div`,{className:J(`absolute inset-y-3 left-3`,u?o$:`right-3`),children:(0,G.jsx)(PQ,{nodes:M,edges:N,onNodeSelect:P,selectedNode:u,centerId:t===`focus`?r:null,centerNodeType:t===`focus`?y?.center?.type??null:null,isLoading:T})}),t===`global`&&E&&(0,G.jsxs)(`div`,{className:J(`absolute bottom-3 left-3 z-10 flex max-w-[280px] flex-col items-start gap-2 rounded-lg border border-warning/20 bg-warning-container/80 p-3 text-on-warning-container shadow-lg backdrop-blur-xs`,u?o$:`right-3`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ma,{className:`h-4 w-4 shrink-0 text-warning`}),(0,G.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-wider`,children:`Overview Snapshot`})]}),(0,G.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-on-warning-container/80`,children:[`This overview still contains `,_?.nodes?.length,` nodes. Use Focus mode for navigation and step through connections from the drawer.`]}),(0,G.jsx)(Y,{variant:`destructive`,size:`sm`,className:`mt-1 h-7 w-full px-3 text-[10px]`,onClick:L,children:`Return to Focus`})]}),(0,G.jsx)(BQ,{node:u,edges:A,nodes:k,onClose:()=>{d(null)},onNodeSelect:P,onFocusNode:F,onNavigateToSpore:e,isConnectionsLoading:O})]})]})}function v$(){let e=An(),t=p$(),[n,r]=(0,W.useState)(t.tab),[i,a]=(0,W.useState)(t.sporeId?{id:t.sporeId}:null),o=(0,W.useRef)(!1),s=(0,W.useRef)(!1);(0,W.useEffect)(()=>{if(!o.current){o.current=!0;return}if(s.current){s.current=!1;return}m$(n,i?.id)},[n,i?.id]),(0,W.useEffect)(()=>{s.current=!0;let e=p$();r(e.tab),a(e.sporeId?{id:e.sporeId}:null)},[e.search,e.key]);function c(e){a(e)}function l(){a(null)}function u(e){a({id:e})}function d(e){r(e),e!==`spores`&&a(null)}return(0,G.jsxs)(`div`,{className:`p-6 space-y-6`,children:[(0,G.jsx)(YN,{title:`Mycelium`,subtitle:`Derived intelligence — spores, entity graph, and synthesized context.`}),(0,G.jsx)(PP,{tabs:l$.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:n,onTabChange:e=>d(e),columns:2}),n===`graph`&&(0,G.jsx)(_$,{onNavigateToSpore:e=>{r(`spores`),a({id:e})}}),n===`spores`&&(i?(0,G.jsx)(r$,{id:i.id,onBack:l,onNavigateToSpore:u}):(0,G.jsx)(ZQ,{onSelectSpore:c}))]})}function y$({chip:e}){return(0,G.jsxs)(`span`,{"data-capability":e.id,title:e.title,className:J(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] font-medium transition-colors`,`border-outline-variant/30 bg-surface-container text-on-surface`,`hover:bg-surface-container-high hover:border-outline-variant/60`),children:[(0,G.jsx)(wk,{tone:e.tone,sizePx:5}),(0,G.jsx)(`span`,{children:e.label})]})}function b$({chip:e,href:t}){return(0,G.jsx)(ri,{to:t,"aria-label":`${e.label} — open feature`,className:`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40 rounded-full`,children:(0,G.jsx)(y$,{chip:e})})}function x$(e){let t=[],n=`agent=${encodeURIComponent(e.name)}`;if(e.supportsSessions&&t.push({id:`sessions`,label:`Sessions`,to:`/sessions?${n}`,tone:`sage`,title:`Prompts, tool calls, and responses captured from this symbiont`}),e.supportsSessionStartInjection&&(t.push({id:`cortex-instructions`,label:`Cortex Instructions`,to:`/cortex?tab=instructions`,tone:`sage`,title:`Project-scoped instructions injected at session start`}),t.push({id:`cortex-digest`,label:`Cortex Digest`,to:`/cortex?tab=digest`,tone:`sage`,title:`Project state digest injected at session start`})),e.supportsCanopyInjection&&t.push({id:`cortex-canopy`,label:`Cortex Canopy`,to:`/cortex?tab=canopy`,tone:`sage`,title:`File-read context injected on tool use`}),e.supportsSubagentStartInjection&&t.push({id:`cortex-subagent`,label:`Subagent context`,to:`/cortex?tab=instructions`,tone:`sage`,title:`Myco can inject a Cortex primer when this symbiont starts a subagent`}),e.supportsSessions&&t.push({id:`cortex-spores`,label:`Cortex Spores`,to:`/mycelium?tab=spores`,tone:`sage`,title:`Durable knowledge mined from this symbiont’s sessions`}),e.supportsPlanCapture&&t.push({id:`plans`,label:`Plans`,to:`/sessions?${n}&has_plan=true`,tone:`sage`,title:`Plans this symbiont produced`}),e.supportsSkills&&t.push({id:`skills`,label:`Skills`,to:`/skills`,tone:`sage`,title:`Myco skills exposed inside this symbiont`}),e.supportsMcp){let n=e.mcpActive===!0;t.push({id:`mcp`,label:n?`MCP`:`MCP (quiet)`,to:`/skills`,tone:n?`sage`:`outline`,title:n?`Myco MCP tools called within the last 7 days`:`MCP is configured but no recent tool calls were observed`})}return t}function S$(e){return e.detected?e.globallyInstalled?{label:`Available`,tone:`sage`}:{label:`Detected`,tone:`ochre`}:{label:`Not detected`,tone:`outline`}}function C$({symbiont:e,onSetOverride:t,overrideDisabled:n=!1,overrideDisabledReason:r,busy:i=!1}){let a=S$(e),o=ys(),s=(0,W.useMemo)(()=>x$(e),[e]);function c(e){t(e)}return(0,G.jsx)(uM,{accent:`sage`,interactive:!1,"data-symbiont":e.name,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5 min-w-0 flex-1`,children:[(0,G.jsx)(wk,{tone:a.tone,className:`mt-1.5 shrink-0`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 flex-wrap`,children:[(0,G.jsx)(`h3`,{className:`font-serif italic text-sm text-on-surface truncate leading-snug`,children:e.displayName}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:e.name}),(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:[`· `,a.label]})]}),e.detected&&!e.globallyInstalled&&(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:[`Not connected yet — use `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Re-detect now`}),` above to wire Myco into this agent, or run `,(0,G.jsx)(`code`,{className:`rounded bg-surface-container px-1 py-0.5 font-mono text-[11px]`,children:`myco update`}),`.`]}),s.length>0&&(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:s.map(e=>(0,G.jsx)(b$,{chip:e,href:o(e.to)},e.id))})]})]}),e.detected&&(0,G.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,title:n?r:void 0,children:(0,G.jsx)(XN,{checked:e.enabled,onCheckedChange:c,disabled:i||n})})]})})}function w$(){let e=We(),t=_s();return st({mutationFn:async e=>{if(!t)throw Error(`No project selected`);return ns(`/projects/${t.project.project_id}/symbionts-customization`,e)},onSuccess:()=>{e.invalidateQueries({queryKey:[`symbionts`]})}})}function T$(){let e=We(),t=_s();return st({mutationFn:async e=>{if(!t)throw Error(`No project selected`);return rs(`/projects/${t.project.project_id}/symbionts`,e)},onSuccess:()=>{e.invalidateQueries({queryKey:[`symbionts`]})}})}function E$(){let{data:e,isLoading:t,refetch:n}=mM(),r=We(),i=_s(),a=T$(),o=w$(),[s,c]=(0,W.useState)(!1),l=e?.symbionts??[],u=l.filter(e=>e.detected),d=l.filter(e=>!e.detected),f=!!e?.projectCustomizationActive,p=!i;async function m(){c(!0);try{await q(`/symbionts/detect`,{method:`POST`}),await r.invalidateQueries({queryKey:[`symbionts`]}),await n()}finally{c(!1)}}function h(e){p||o.mutate({enabled:e})}let g=o.isPending,_=a.isPending||g,v=p||!f,y=p?`Select a project to override this symbiont per-project.`:f?void 0:`Turn on "Customize for this project" to override individual symbionts here.`;return(0,G.jsxs)(bj,{children:[(0,G.jsx)(YN,{title:`Symbionts`,description:`Coding agents Myco supports on this machine, and the Myco features available for each.`,actions:(0,G.jsxs)(Y,{onClick:m,disabled:s,variant:`outline`,size:`sm`,children:[(0,G.jsx)(Qa,{className:`h-4 w-4 mr-1.5 ${s?`animate-spin`:``}`}),s?`Detecting…`:`Re-detect now`]})}),(0,G.jsx)(Q,{className:`px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-sans text-sm text-on-surface`,children:`Customize for this project`}),(0,G.jsx)(`div`,{className:`mt-0.5 font-sans text-xs text-on-surface-variant`,children:p?`Select a project from the switcher to enable per-project customization.`:f?`This project overrides which symbionts are active. Toggle individual symbionts below.`:`Using the global defaults. Turn on to override individual symbionts for this project.`})]}),(0,G.jsx)(XN,{checked:f,onCheckedChange:h,disabled:p||g})]})}),t?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant`,children:`Loading…`}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(Q,{children:u.length===0?(0,G.jsx)(`p`,{className:`px-4 py-6 text-sm text-on-surface-variant`,children:`No coding agents detected. Myco picks them up automatically once one is installed.`}):u.map(e=>(0,G.jsx)(C$,{symbiont:e,busy:_,overrideDisabled:v,overrideDisabledReason:y,onSetOverride:t=>{v||a.mutate({symbionts:{[e.name]:{enabled:t}}})}},e.name))}),d.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(MM,{children:`Not detected`}),(0,G.jsx)(Q,{children:d.map(e=>(0,G.jsx)(C$,{symbiont:e,onSetOverride:()=>{}},e.name))})]})]})]})}function D$({selectedCount:e,onClear:t,onCompare:n,minSelected:r=2,primaryLabel:i=`Compare`,nounSingular:a=`run`,nounPlural:o=`runs`,className:s}){if(e===0)return null;let c=e===1?a:o;return(0,G.jsxs)(`div`,{role:`region`,"aria-label":`Selection actions`,className:J(`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3 rounded-full bg-surface-container-high px-4 py-2 shadow-lg border border-outline-variant/30`,s),children:[(0,G.jsxs)(`span`,{className:`font-sans text-sm text-on-surface`,children:[e,` selected`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`default`,className:`gap-2`,disabled:e<r,onClick:n,children:[(0,G.jsx)(Aa,{className:`h-3.5 w-3.5`}),i,` `,e,` `,c]}),(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`gap-2 text-on-surface-variant`,onClick:t,children:[(0,G.jsx)(So,{className:`h-3.5 w-3.5`}),`Clear selection`]})]})}var O$=/[\s/_.:-]+/,k$=/[\s/_.:-]+/g,A$=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function j$(e){return e.trim().toLowerCase()}function M$(e){return j$(e).split(O$).filter(Boolean)}function N$(e){return e.length>1&&e.every(e=>e.length>=2)}function P$(e,t){let n=j$(t);if(n===``)return 0;let r=j$(e.label),i=j$(e.value),a=j$(`${e.label} ${e.value} ${e.searchText??``}`),o=M$(n),s=M$(a),c=n.replace(k$,``),l=a.replace(k$,``);return r===n||i===n?0:r.startsWith(n)||i.startsWith(n)?1:r.includes(n)||i.includes(n)||a.includes(n)?2:s.some(e=>e.startsWith(n))?3:N$(o)&&o.every(e=>a.includes(e))?4:c!==``&&l.includes(c)?5:null}function F$({options:e,value:t,onValueChange:n,placeholder:r=`Select an option`,searchPlaceholder:i=`Search...`,emptyMessage:a=`No matching options.`,disabled:o=!1,sortOptions:s=!1,className:c,triggerClassName:l,contentClassName:u,monospace:d=!1,renderOption:f,renderValue:p}){let[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(``),v=(0,W.useDeferredValue)(g),y=(0,W.useRef)(null),b=(0,W.useRef)(null),x=(0,W.useRef)(null),S=(0,W.useId)(),C=(0,W.useMemo)(()=>{let t=[...e];return s&&t.sort((e,t)=>A$.compare(e.label,t.label)||A$.compare(e.value,t.value)),t},[e,s]),w=(0,W.useMemo)(()=>{let e=C.map(e=>({option:e,rank:P$(e,v)})).filter(e=>e.rank!==null);return e.sort((e,t)=>e.rank-t.rank||A$.compare(e.option.label,t.option.label)||A$.compare(e.option.value,t.option.value)),e.map(e=>e.option)},[v,C]),T=C.find(e=>e.value===t)??(t?{value:t,label:t}:void 0);return(0,W.useEffect)(()=>{if(!m){_(``);return}let e=window.requestAnimationFrame(()=>{x.current?.focus(),x.current?.select()});return()=>window.cancelAnimationFrame(e)},[m]),(0,W.useEffect)(()=>{if(!m)return;let e=e=>{y.current?.contains(e.target)||h(!1)},t=e=>{e.key===`Escape`&&(h(!1),b.current?.focus())};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[m]),(0,G.jsxs)(`div`,{ref:y,className:J(`relative`,c),children:[(0,G.jsxs)(`button`,{ref:b,type:`button`,disabled:o,"aria-expanded":m,"aria-controls":S,className:J(`flex h-9 w-full items-center justify-between rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-left text-sm shadow-xs transition-colors focus-visible:outline-hidden focus-visible:border-primary/40 disabled:cursor-not-allowed disabled:opacity-50`,l),onClick:()=>h(e=>!e),children:[(0,G.jsx)(`span`,{className:J(`truncate text-on-surface`,!T&&`text-on-surface-variant/60`),children:T?p?.(T)??(0,G.jsx)(`span`,{className:J(d&&`font-mono`),children:T.label}):r}),(0,G.jsx)($i,{className:`h-4 w-4 shrink-0 opacity-50`})]}),m?(0,G.jsxs)(`div`,{className:J(`absolute left-0 right-0 z-50 mt-1 rounded-md border border-[var(--ghost-border)] bg-surface-container-highest shadow-ambient`,u),children:[(0,G.jsx)(`div`,{className:`border-b border-[var(--ghost-border)] p-2`,children:(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(no,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-on-surface-variant/70`}),(0,G.jsx)(Kf,{ref:x,value:g,onChange:e=>_(e.target.value),placeholder:i,className:`pl-9`})]})}),(0,G.jsx)(`div`,{id:S,role:`listbox`,className:`max-h-72 overflow-y-auto p-1`,children:w.length>0?w.map(e=>{let r=e.value===t;return(0,G.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":r,className:J(`flex w-full items-center justify-between rounded-xs px-2 py-1.5 text-left text-sm text-on-surface outline-hidden transition-colors hover:bg-surface-bright focus-visible:bg-surface-bright`,r&&`bg-surface-bright`),onClick:()=>{n(e.value),h(!1),b.current?.focus()},children:[(0,G.jsx)(`span`,{className:J(`truncate`,d&&`font-mono`),children:f?.(e)??e.label}),r?(0,G.jsx)(Qi,{className:`ml-2 h-4 w-4 shrink-0`}):null]},e.value)}):(0,G.jsx)(`div`,{className:`px-2 py-3 text-sm text-on-surface-variant`,children:a})})]}):null]})}var I$=`claude-sdk`,L$=`openai-agents`,R$=[`anthropic`,`ollama`,`lmstudio`,`openai`,`openrouter`,`openai-compatible`],z$=32768,B$=2e5,V$={anthropic:{harness:I$,supportedHarnesses:[I$],defaultContextWindowTokens:B$},ollama:{harness:I$,supportedHarnesses:[I$,L$],defaultContextWindowTokens:z$},lmstudio:{harness:I$,supportedHarnesses:[I$,L$],defaultContextWindowTokens:z$},openai:{harness:L$,supportedHarnesses:[L$],defaultContextWindowTokens:B$},openrouter:{harness:L$,supportedHarnesses:[L$],defaultContextWindowTokens:B$},"openai-compatible":{harness:L$,supportedHarnesses:[L$],defaultContextWindowTokens:128e3}};function H$(e){if(e)return V$[e]}function U$(e){return H$(e)?.harness}function W$(e){return H$(e)?.supportedHarnesses??[]}function G$(e,t){return!e||!t?!1:W$(e).includes(t)}var K$=3e4,q$=Array.from(new Set(Object.values(V$).flatMap(e=>e.supportedHarnesses)));function J$(e){return q$.includes(e)?e:``}function Y$(e){return R$.includes(e)?e:``}var X$=[`low`,`default`,`high`],Z$={ollama:`http://localhost:11434`,lmstudio:`http://localhost:1234`};function Q$(e,t,n){return e===`openai-compatible`&&t?Z$[t]:n??``}function $$(e){return e?U$(e)??``:``}function e1(e){return e?U$(e):void 0}function t1(e,t){return G$(e||void 0,t||void 0)}function n1(e,t,n){let r=e??`default`;return t?.reasoning_map?.[r]??t?.model??n??``}function r1(e,t,n){let r=t.find(t=>t.type===e),i=new Set(r?.models??[]),a=r?.models?.[0]??``,o=(...e)=>r?.models?.find(t=>e.some(e=>t.includes(e)))??``;return{harness:n&&t1(e,n)?n:r?.harness??$$(e),type:e,localBackend:``,model:a,reasoningLow:i.size>0?e===`anthropic`?o(`haiku`):e===`openai`?o(`nano`):a:``,reasoningDefault:i.size>0?(e===`anthropic`?o(`sonnet`):e===`openai`?o(`mini`):a)||a:``,reasoningHigh:i.size>0?e===`anthropic`?o(`opus`):e===`openai`?(e=>r?.models?.find(t=>t===e)??``)(`gpt-5.4`):``:``,baseUrl:r?.baseUrl??``,contextLength:``}}function i1(e){if(e.type===``)return;let t=e.type===`ollama`||e.type===`lmstudio`||e.type===`openai-compatible`,n={...e.reasoningLow?{low:e.reasoningLow}:{},...e.reasoningDefault?{default:e.reasoningDefault}:{},...e.reasoningHigh?{high:e.reasoningHigh}:{}};return{type:e.type,...e.type===`openai-compatible`&&e.localBackend?{local_backend:e.localBackend}:{},...e.model?{model:e.model}:{},...Object.keys(n).length>0?{reasoning_map:n}:{},...t&&e.baseUrl?{base_url:e.baseUrl}:{},...t&&e.contextLength?{context_length:Number(e.contextLength)}:{}}}function a1(e){return ot({queryKey:xs([`task-config`,e]),queryFn:({signal:t})=>q(`/agent/tasks/${e}/config`,{signal:t}),enabled:e!==void 0,staleTime:K$})}function o1(){return ot({queryKey:xs([`providers`]),queryFn:({signal:e})=>q(`/providers`,{signal:e}),staleTime:K$})}function s1(){return st({mutationFn:e=>ts(`/providers/test`,e)})}function c1(){let e=We();return st({mutationFn:({taskId:e,config:t})=>ns(`/agent/tasks/${e}/config`,t),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`task-config`,n.taskId]})}})}var l1=new Set([`openai-compatible`]);function u1(e,t,n,r){let i=e?l1.has(e):!1,a=!!e&&(!i||!!t);return ot({queryKey:xs([`models`,e,t,n,r]),queryFn:({signal:i})=>{let a=new URLSearchParams({provider:e});return t&&a.set(`base_url`,t),n&&a.set(`type`,n),r&&a.set(`local_backend`,r),q(`/models?${a.toString()}`,{signal:i})},enabled:a,staleTime:Os})}var d1=new Set([`ollama`,`lmstudio`,`openai-compatible`]);function f1({providerType:e,localBackend:t=``,baseUrl:n,model:r,modelPlaceholder:i,providers:a,onModelChange:o,label:s=`Model`}){let c=a.find(t=>t.type===e),l=e!==``,u=n||Q$(e,t,c?.baseUrl),d=u1(e||null,u,`llm`,t||null),f=d.data?.models??c?.models??[],p=d1.has(e),m=f.length>0,h=d.isPending&&l,g=c?.authConfigured===!1?`Configure an API key to load models.`:c?.available===!1?`Provider unavailable.`:`No models returned.`,_=i??`Select a model`;return l?(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:s}),h?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-sm text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),`Loading models...`]}):m?(0,G.jsx)(F$,{value:r,onValueChange:o,placeholder:_,searchPlaceholder:`Search models...`,emptyMessage:`No models match that search.`,options:f.map(e=>({value:e,label:e})),sortOptions:!0,monospace:!0}):p?(0,G.jsx)(Kf,{value:r,onChange:e=>o(e.target.value),placeholder:c?.available===!1?`Provider offline`:`Enter model name`,disabled:c?.available===!1}):(0,G.jsx)(`div`,{className:`rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2`,children:(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:g})})]}):null}var p1={"claude-sdk":`Claude Agents`,"openai-agents":`OpenAI Agents`},m1={anthropic:`Anthropic`,ollama:`Ollama`,lmstudio:`LM Studio`,openai:`OpenAI`,openrouter:`OpenRouter`,"openai-compatible":`OpenAI-compatible`},h1={anthropic:da,ollama:ro,lmstudio:ma,openai:da,openrouter:da,"openai-compatible":ro},g1=[{value:`lmstudio`,label:`LM Studio`},{value:`ollama`,label:`Ollama`}];function _1({harness:e,providerType:t,localBackend:n=``,model:r,baseUrl:i,contextLength:a,modelPlaceholder:o,providers:s,isLoadingProviders:c,showHarnessSelector:l=!0,showModelSelector:u=!0,onHarnessChange:d,onProviderChange:f,onLocalBackendChange:p,onModelChange:m,onBaseUrlChange:h,onContextLengthChange:g,onBaseUrlBlur:_,onContextLengthBlur:v}){let y=s.filter(t=>t1(t.type,e)),b=s.find(e=>e.type===t),x=t===`ollama`||t===`lmstudio`||t===`openai-compatible`,S=i||Q$(t,n,b?.baseUrl);return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[l&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Runtime`}),(0,G.jsxs)(c_,{value:e,onValueChange:d,children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:`Select a runtime`})}),(0,G.jsx)(d_,{children:Object.entries(p1).map(([e,t])=>(0,G.jsx)(f_,{value:e,children:t},e))})]})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:y.map(e=>{let n=h1[e.type];return n?(0,G.jsxs)(`button`,{onClick:()=>f(e.type),className:`
|
|
405
|
-
flex flex-col items-center gap-1.5 rounded-md border px-3 py-2.5 transition-colors
|
|
406
|
-
${t===e.type?`border-primary/40 bg-primary/5 text-on-surface`:`border-[var(--ghost-border)] bg-surface-container-lowest text-on-surface-variant hover:border-primary/20`}
|
|
407
|
-
`,children:[(0,G.jsx)(n,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-xs font-medium`,children:m1[e.type]??e.type}),!c&&(0,G.jsx)(X,{variant:e.authConfigured===!1||!e.available?`destructive`:`secondary`,className:`text-[10px] px-1.5 py-0`,children:e.authConfigured===!1?`key required`:e.available?`online`:`offline`})]},e.type):null})}),x&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Base URL`}),(0,G.jsx)(Kf,{value:i,onChange:e=>h(e.target.value),onBlur:_,placeholder:S})]}),t===`openai-compatible`&&p&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Local Backend`}),(0,G.jsxs)(c_,{value:n||`lmstudio`,onValueChange:e=>p(e),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:`Select a backend`})}),(0,G.jsx)(d_,{children:g1.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant/70`,children:`OpenAI-compatible chat endpoints look the same, but local backends still need different model-loading and context handling.`})]}),x&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Context Length`}),(0,G.jsx)(Kf,{type:`number`,value:a,onChange:e=>g(e.target.value),onBlur:v,placeholder:`32768 (default)`}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant/70`,children:`Leave blank to use the 32K default. Myco creates a Modelfile variant at this size so the model loads at the size you asked for, not its (much larger) native default.`})]}),u&&(0,G.jsx)(f1,{providerType:t,localBackend:n,baseUrl:i,model:r,modelPlaceholder:o,providers:s,onModelChange:m})]})}function v1({phase:e,override:t,taskHarness:n,taskProviderType:r,taskModel:i,taskReasoningMap:a,providers:o,isLoadingProviders:s,onChange:c}){let[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(t.provider?.model!==void 0||t.model!==void 0),p=t.reasoningLevel??e.reasoningLevel??`default`,m=t.provider?.model??t.model??e.model??n1(p,{model:i||void 0,reasoning_map:a},i)??`(unresolved)`,h=t.provider!==void 0||t.model!==void 0||t.reasoningLevel!==void 0||t.maxTurns!==void 0;return(0,G.jsxs)(`div`,{className:`border border-[var(--ghost-border)] rounded-md`,children:[(0,G.jsxs)(`button`,{onClick:()=>u(!l),className:`flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-surface-container-low/50 transition-colors rounded-md`,children:[l?(0,G.jsx)($i,{className:`h-3.5 w-3.5 text-on-surface-variant`}):(0,G.jsx)(ta,{className:`h-3.5 w-3.5 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface`,children:e.name}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[p,` · max `,t.maxTurns??e.maxTurns,` turns`]}),h&&(0,G.jsx)(X,{variant:`secondary`,className:`text-[10px] ml-auto`,children:`override`})]}),l&&(0,G.jsxs)(`div`,{className:`px-3 pb-3 space-y-3 border-t border-[var(--ghost-border)]`,children:[(0,G.jsxs)(`div`,{className:`pt-3 space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Reasoning Level`}),(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-low border border-[var(--ghost-border)] rounded-md px-3 py-2 text-sm font-mono text-on-surface focus:outline-none focus:ring-1 focus:ring-primary`,value:t.reasoningLevel??``,onChange:e=>{let n=e.target.value;c({...t,reasoningLevel:n===``?void 0:n})},children:[(0,G.jsxs)(`option`,{value:``,children:[`inherit (`,e.reasoningLevel??`default`,`)`]}),X$.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsxs)(`p`,{className:`font-sans text-[11px] text-on-surface-variant`,children:[`Resolves to `,(0,G.jsx)(`span`,{className:`font-mono`,children:m}),` via the provider's reasoning map.`]})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Max Turns`}),(0,G.jsx)(Kf,{type:`number`,value:t.maxTurns??``,onChange:e=>c({...t,maxTurns:e.target.value?Number(e.target.value):void 0}),placeholder:String(e.maxTurns)})]}),(0,G.jsxs)(`div`,{className:`border-t border-[var(--ghost-border)] pt-3`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>f(!d),className:`flex items-center gap-1 text-xs text-on-surface-variant hover:text-on-surface`,children:[d?(0,G.jsx)($i,{className:`h-3 w-3`}):(0,G.jsx)(ta,{className:`h-3 w-3`}),`Advanced — pin provider / model`]}),d&&(0,G.jsxs)(`div`,{className:`pt-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant pb-2`,children:`Pinning a model overrides the reasoning map for this phase. Future model upgrades won't propagate here until you clear it.`}),(0,G.jsx)(_1,{harness:n,providerType:t.provider?.type??r,localBackend:t.provider?.local_backend??``,model:t.provider?.model??t.model??``,baseUrl:t.provider?.base_url??``,contextLength:t.provider?.context_length==null?``:String(t.provider.context_length),modelPlaceholder:m,providers:o,isLoadingProviders:s,showHarnessSelector:!1,onHarnessChange:()=>{},onProviderChange:e=>{let n=o.find(t=>t.type===e)?.baseUrl;c({...t,provider:{type:e,base_url:n},model:void 0})},onLocalBackendChange:e=>c({...t,provider:{...t.provider??{type:r},local_backend:e||void 0}}),onModelChange:e=>c({...t,provider:{...t.provider??{type:r},model:e},model:void 0}),onBaseUrlChange:e=>c({...t,provider:{...t.provider??{type:r},base_url:e}}),onContextLengthChange:e=>c({...t,provider:{...t.provider??{type:r},context_length:e?Number(e):void 0}})})]})]}),h&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>c(null),className:`text-xs text-on-surface-variant`,children:`Clear Phase Override`})]})]})}var y1=/\b(session_id|batch_id|target_session)\s*[:=]\s*(?:"([^"]+)"|'([^']+)'|([A-Za-z0-9_-]+))/gi;function b1(e){let t={};if(!e)return t;let n=new RegExp(y1.source,`gi`),r;for(;(r=n.exec(e))!==null;){let e=r[1].toLowerCase(),n=r[2]??r[3]??r[4];n&&t[e]===void 0&&(t[e]=n)}return t}var x1=new Set([`instruction`]);function S1(e,t={}){if(!e)return[];let{includeAutoResolved:n=!1}=t,r=new Set,i=[];for(let t of e.matchAll(/\{\{(\w+)\}\}/g)){let e=t[1];!n&&x1.has(e)||r.has(e)||(r.add(e),i.push(e))}return i}var C1=[`anthropic`,`ollama`,`lmstudio`,`openai`,`openrouter`,`openai-compatible`];function w1(e){return C1.includes(e)?e:`openai-compatible`}function T1(e){if(!e)return;let t={type:e.type};return e.local_backend&&(t.localBackend=e.local_backend),e.base_url&&(t.baseUrl=e.base_url),e.model&&(t.model=e.model),e.reasoning_map&&(t.reasoningMap=e.reasoning_map),e.context_length&&(t.contextLength=e.context_length),t}function E1(e){if(!e)return;let t={type:w1(e.type)};return e.localBackend&&(t.local_backend=e.localBackend),e.baseUrl&&(t.base_url=e.baseUrl),e.model&&(t.model=e.model),e.reasoningMap&&(t.reasoning_map=e.reasoningMap),typeof e.contextLength==`number`&&(t.context_length=e.contextLength),t}function D1(e){if(!e)return;let t={type:w1(e.type)};return e.model&&(t.model=e.model),e.reasoning_map&&(t.reasoning_map=e.reasoning_map),t}function O1(e){if(e)return X$.includes(e)?e:void 0}var k1=[`claude-sdk`,`openai-agents`];function A1(e){if(e)return k1.includes(e)?e:void 0}function j1(e,t){let n=e.task??``,r=t.find(e=>e.name===n),i=n!==``&&r===void 0,a=e.instruction??``,o=b1(a),s={};if(r){let e=new Set(S1(r.prompt,{includeAutoResolved:!0}));for(let[t,n]of Object.entries(o))e.has(t)&&(s[t]=n)}else for(let[e,t]of Object.entries(o))s[e]=t;let c=e.execution_overrides??null,l=A1(c?.harness),u=O1(c?.reasoningLevel),d=c?.model||void 0,f=E1(c?.provider),p={};if(c?.phases)for(let[e,t]of Object.entries(c.phases)){let n=E1(t.provider),r=t.model&&t.model.length>0?t.model:void 0,i=typeof t.maxTurns==`number`?t.maxTurns:void 0,a=O1(t.reasoningLevel);if(n!==void 0||r!==void 0||i!==void 0||a!==void 0){let t={};n&&(t.provider=n),a&&(t.reasoningLevel=a),r&&(t.model=r),i!==void 0&&(t.maxTurns=i),p[e]=t}}let m=l!==void 0||u!==void 0||d!==void 0||f!==void 0||Object.keys(p).length>0;return{taskName:n,taskMissing:i,instruction:a,dryRun:e.dry_run===!0,varValues:s,harness:l,reasoningLevel:u,model:d,provider:f,phaseOverrides:p,hasAnyOverride:m}}function M1(){return{harness:``,type:``,localBackend:``,model:``,reasoningLow:``,reasoningDefault:``,reasoningHigh:``,baseUrl:``,contextLength:``}}function N1(e,t){return(e?.harness?J$(e.harness):``)||(e?.provider?.type?e1(Y$(e.provider.type)||void 0):void 0)||(t?.harness?J$(t.harness):``)||((t?.providerType?e1(Y$(t.providerType)||void 0):void 0)??``)}function P1(e,t){let n=e?.provider?.type?Y$(e.provider.type):``;return n===``?{harness:N1(e,t),type:t?.providerType?Y$(t.providerType):``,localBackend:t?.localBackend??``,model:e?.model??t?.model??``,reasoningLow:t?.reasoningMap?.low??``,reasoningDefault:t?.reasoningMap?.default??e?.model??t?.model??``,reasoningHigh:t?.reasoningMap?.high??``,baseUrl:t?.baseUrl??``,contextLength:t?.contextLength==null?``:String(t.contextLength)}:{harness:N1(e,t),type:n,localBackend:e?.provider?.local_backend??t?.localBackend??``,model:e?.provider?.model??e?.model??``,reasoningLow:e?.provider?.reasoning_map?.low??``,reasoningDefault:e?.provider?.reasoning_map?.default??e?.provider?.model??e?.model??``,reasoningHigh:e?.provider?.reasoning_map?.high??``,baseUrl:e?.provider?.base_url??``,contextLength:e?.provider?.context_length?.toString()??``}}function F1(e,t){return e.harness===t.harness&&e.type===t.type&&e.localBackend===t.localBackend&&e.model===t.model&&e.reasoningLow===t.reasoningLow&&e.reasoningDefault===t.reasoningDefault&&e.reasoningHigh===t.reasoningHigh&&e.baseUrl===t.baseUrl&&e.contextLength===t.contextLength}function I1(e,t){return e===``||t.length===0||t.includes(e)?e:``}function L1(e,t){return i1({...e,reasoningLow:I1(e.reasoningLow,t),reasoningDefault:I1(e.reasoningDefault,t),reasoningHigh:I1(e.reasoningHigh,t)})}function R1(e){return e===``||e===Q$(`openai-compatible`,`ollama`)||e===Q$(`openai-compatible`,`lmstudio`)}function z1(e,t){let n=J$(e),r=t.find(e=>t1(e.type,n));return r?r1(r.type,t,n||void 0):{...M1(),harness:n}}function B1({source:e,defaults:t,providers:n}){let r=(0,W.useMemo)(()=>P1(e,t),[e?.harness,e?.model,e?.provider?.type,e?.provider?.local_backend,e?.provider?.model,e?.provider?.reasoning_map?.low,e?.provider?.reasoning_map?.default,e?.provider?.reasoning_map?.high,e?.provider?.base_url,e?.provider?.context_length,t?.harness,t?.providerType,t?.localBackend,t?.model,t?.reasoningMap?.low,t?.reasoningMap?.default,t?.reasoningMap?.high,t?.baseUrl,t?.contextLength]),[i,a]=(0,W.useState)(r),[o,s]=(0,W.useState)(r),c=(0,W.useRef)(i);c.current=i,(0,W.useEffect)(()=>{a(r),s(e=>F1(e,c.current)?r:e)},[r]);let l=!F1(o,i),u=(0,W.useCallback)(e=>{let t=J$(e);s(r=>t1(r.type,t)?{...r,harness:t}:z1(e,n))},[n]),d=(0,W.useCallback)(e=>{let t=Y$(e);s(r=>r1(e,n,t1(t,r.harness)?r.harness:void 0))},[n]),f=(0,W.useCallback)(e=>{s(t=>({...t,model:e,reasoningDefault:t.reasoningDefault||e}))},[]),p=(0,W.useCallback)(e=>{s(t=>({...t,localBackend:e,...t.type===`openai-compatible`&&e&&R1(t.baseUrl)?{baseUrl:Q$(t.type,e)}:{},...t.type===`openai-compatible`?{model:``,reasoningLow:``,reasoningDefault:``,reasoningHigh:``}:{}}))},[]),m=(0,W.useCallback)((e,t)=>{s(n=>({...n,...e===`low`?{reasoningLow:t}:{},...e==="default"?{reasoningDefault:t}:{},...e===`high`?{reasoningHigh:t}:{}}))},[]),h=(0,W.useCallback)(e=>{s(t=>({...t,baseUrl:e}))},[]),g=(0,W.useCallback)(e=>{s(t=>({...t,contextLength:e}))},[]),_=(0,W.useCallback)(()=>{s(i)},[i]);return{draft:o,savedDraft:i,isDirty:l,setDraft:s,commitDraft:(0,W.useCallback)(e=>{let t=e??o;a(t),s(t)},[o]),resetDraft:_,clearDraft:(0,W.useCallback)(()=>{s(M1())},[]),handleHarnessChange:u,handleProviderChange:d,handleModelChange:f,handleLocalBackendChange:p,handleReasoningChange:m,handleBaseUrlChange:h,handleContextLengthChange:g}}function V1(e){let{data:t}=RA(),n=t?.tasks??[],r=e?n.find(t=>t.name===e):void 0,{effective:i}=LO(),a=i?.agent?.provider,o=a?.type&&Y$(a.type)||void 0,s=i?.agent?.harness,{data:c}=a1(e),l=c?.config,u=r?.execution,d=u?.provider?.type&&Y$(u.provider.type)||void 0,f=l?.harness??u?.harness??s??e1(l?.provider?.type)??e1(o)??e1(d)??`claude-sdk`,p=u?.reasoningLevel??r?.reasoningLevel,m=l?.provider??D1(u?.provider)??a,h=m?.type??`anthropic`,g=l?.provider?.model??l?.model??u?.model??r?.model??a?.model;return{taskRow:r,harness:f,provider:m,providerType:h,modelFallback:g,reasoning:p,resolvedModel:n1(p,m,g),draftSource:(0,W.useMemo)(()=>({harness:l?.harness??u?.harness,provider:m,model:g}),[l?.harness,u?.harness,m,g]),draftDefaults:{harness:f,providerType:h,localBackend:m?.local_backend,model:g,reasoningMap:m?.reasoning_map,baseUrl:m?.base_url,contextLength:m?.context_length}}}function H1(e){if(e===void 0)return;let t=e.trim();return t.length>0?t:void 0}function U1(e,t){return e===t?!0:!e||!t?!1:W1(e)===W1(t)}function W1(e){if(typeof e!=`object`||!e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(W1).join(`,`)}]`;let t=e;return`{${Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${W1(t[e])}`).join(`,`)}}`}function G1(e,t){let n={};e.harness&&e.harness!==t.harness&&(n.harness=e.harness),e.reasoningLevel&&e.reasoningLevel!==t.reasoningLevel&&(n.reasoningLevel=e.reasoningLevel);let r=H1(e.model);r&&r!==t.model&&(n.model=r),e.provider&&!U1(e.provider,t.provider)&&(n.provider=T1(e.provider));let i=new Map;for(let e of t.phases??[])i.set(e.name,{reasoningLevel:e.reasoningLevel,model:e.model,provider:e.provider,maxTurns:e.maxTurns});let a={};for(let[t,n]of Object.entries(e.phases)){let e=i.get(t)??{},r={};n.reasoningLevel&&n.reasoningLevel!==e.reasoningLevel&&(r.reasoningLevel=n.reasoningLevel);let o=H1(n.model);o&&o!==e.model&&(r.model=o),n.provider&&!U1(n.provider,e.provider)&&(r.provider=T1(n.provider)),n.maxTurns!==void 0&&n.maxTurns!==e.maxTurns&&(r.maxTurns=n.maxTurns),(r.reasoningLevel!==void 0||r.model!==void 0||r.provider!==void 0||r.maxTurns!==void 0)&&(a[t]=r)}if(Object.keys(a).length>0&&(n.phases=a),!(n.harness===void 0&&n.reasoningLevel===void 0&&n.model===void 0&&n.provider===void 0&&n.phases===void 0))return n}function K1(e,t){let n=G1(e,t);if(!n)return 0;let r=0;if(n.harness!==void 0&&r++,n.reasoningLevel!==void 0&&r++,n.model!==void 0&&r++,n.provider!==void 0&&r++,n.phases)for(let e of Object.values(n.phases))e.reasoningLevel!==void 0&&r++,e.model!==void 0&&r++,e.provider!==void 0&&r++,e.maxTurns!==void 0&&r++;return r}var q1={session_id:`Session ID`},J1={session_id:`e.g. 36858a44-4ef7-4448-96e8-382e992e8ba4`},Y1=`__task_default__`,X1=`skill-survey`;function Z1(e){return q1[e]??e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Q1(e){return e.displayName??e.name}function $1({open:e,onOpenChange:t,preselectedTask:n,onTriggered:r,sourceRun:i}){let[a,o]=(0,W.useState)(void 0),[s,c]=(0,W.useState)({}),[l,u]=(0,W.useState)(``),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(null),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(void 0),[y,b]=(0,W.useState)({}),{data:x,isLoading:S}=RA(),{mutate:C,isPending:w,error:T}=WA(),{data:E,isPending:D}=o1(),O=E?.providers??[],k=x?.tasks??[],A=k.find(e=>e.isDefault),j=n?.name??a??A?.name??k[0]?.name??``,{taskRow:M,harness:N,provider:P,providerType:F,modelFallback:I,reasoning:L,resolvedModel:R,draftSource:ee,draftDefaults:z}=V1(j||void 0),B=n??M,{draft:V,isDirty:H,handleHarnessChange:te,handleProviderChange:ne,handleModelChange:U,handleLocalBackendChange:re,handleBaseUrlChange:ie,handleContextLengthChange:ae,setDraft:oe}=B1({source:ee,defaults:z,providers:O}),se=V.baseUrl||O.find(e=>e.type===V.type)?.baseUrl||``,ce=u1(V.type||null,se||void 0,`llm`,V.localBackend||null).data?.models??O.find(e=>e.type===V.type)?.models??[],le=(0,W.useRef)(null);(0,W.useEffect)(()=>{e||(o(void 0),c({}),u(``),f(!1),m(null),g(!1),v(void 0),b({}),le.current=null)},[e]),(0,W.useEffect)(()=>{if(!e||!i||k.length===0&&S||le.current===i.id)return;let t=j1(i,k);o(t.taskName||void 0),c(t.varValues),u(t.instruction),f(t.dryRun),v(t.reasoningLevel),b(t.phaseOverrides),t.provider?oe({harness:J$(t.harness??z.harness??`claude-sdk`)||`claude-sdk`,type:Y$(t.provider.type),localBackend:t.provider.local_backend??``,model:t.provider.model??``,reasoningLow:t.provider.reasoning_map?.low??``,reasoningDefault:t.provider.reasoning_map?.default??``,reasoningHigh:t.provider.reasoning_map?.high??``,baseUrl:t.provider.base_url??``,contextLength:t.provider.context_length==null?``:String(t.provider.context_length)}):t.harness&&oe(e=>({...e,harness:t.harness})),t.hasAnyOverride&&g(!0),le.current=i.id},[e,i,k.length,S]);let ue=(0,W.useRef)(j);(0,W.useEffect)(()=>{ue.current!==j&&(ue.current=j,!(i&&le.current===i.id)&&(v(void 0),b({})))},[j,i]);let de=(0,W.useMemo)(()=>S1(B?.prompt),[B?.prompt]),fe=(0,W.useMemo)(()=>{if(H)return L1(V,ce)},[V,ce,H]),pe=(0,W.useMemo)(()=>{if(H&&V.harness)return V.harness===N?void 0:V.harness},[V.harness,N,H]),me=(0,W.useMemo)(()=>{let e=B?.phases??[];return{harness:N,reasoningLevel:L,model:R||void 0,provider:P,phases:e.map(e=>({name:e.name,reasoningLevel:e.reasoningLevel,model:e.model,maxTurns:e.maxTurns}))}},[B?.phases,N,L,R,P]),he=(0,W.useMemo)(()=>({harness:pe,reasoningLevel:_,model:void 0,provider:fe,phases:y}),[pe,_,fe,y]),ge=K1(he,me),_e=pe??N,ve=_??L,ye=fe??P,be=ye?.type??F,xe=n1(ve,ye,fe?.model??I),Se=i!==void 0&&i.task!==null&&!k.some(e=>e.name===i.task),Ce=B?Q1(B):i?.task??``,we=i?Se?`Rerun ${Ce} (task definition not found)`:`Rerun ${Ce}`:n?`Run ${Q1(n)}`:`Trigger Agent Run`,Te=i?`Starts a new run with the same settings as the source. The source run is untouched.`:n?void 0:`Run the Myco agent now. It will process unprocessed sessions and update the vault.`;function Ee(e,t){c(n=>({...n,[e]:t}))}function De(e,t){b(n=>{let r={...n};return t===null?delete r[e]:r[e]=t,r})}function Oe(){m(null);let e=[];for(let t of de){let n=s[t]?.trim();n&&e.push(`${t}: ${n}`)}let n=l.trim();n&&e.push(n);let i=e.length>0?e.join(`
|
|
408
|
-
`):void 0,a=G1(he,me);C({task:j||void 0,instruction:i,...d?{dryRun:!0}:{},...j===X1?{force:!0}:{},...a?{executionOverrides:a}:{}},{onSuccess:e=>{if(e?.status===`skipped`||!e?.runId){m(e?.message??`Task skipped — no work to do.`);return}t(!1),r?.(e.runId)}})}let ke=B?.phases??[];return(0,G.jsx)(Lf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Vf,{className:`sm:max-w-4xl max-h-[90vh] overflow-y-auto`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:we}),Te&&(0,G.jsx)(Gf,{children:Te})]}),(0,G.jsxs)(`div`,{className:`space-y-4 py-2`,children:[!n&&(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Task`}),S?(0,G.jsxs)(`div`,{className:`flex h-9 items-center gap-2 text-on-surface-variant font-sans text-sm`,children:[(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),`Loading tasks...`]}):(0,G.jsxs)(c_,{value:j,onValueChange:o,children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{})}),(0,G.jsx)(d_,{children:k.map(e=>(0,G.jsxs)(f_,{value:e.name,children:[Q1(e),e.isDefault&&(0,G.jsx)(`span`,{className:`ml-1 font-sans text-xs text-on-surface-variant`,children:`(default)`})]},e.name))})]})]}),i&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-surface-container-lowest px-3 py-2 text-on-surface-variant`,children:[(0,G.jsx)($a,{className:`h-3.5 w-3.5 mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,G.jsxs)(`p`,{className:`font-sans text-xs`,children:[`Pre-filled from run`,` `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:i.id.slice(0,8)}),`… — this will start a new run.`]})]}),B&&(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-low p-3`,children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Effective execution`}),(0,G.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-4 font-mono text-xs text-on-surface`,children:[(0,G.jsxs)(`span`,{children:[`harness: `,_e]}),(0,G.jsxs)(`span`,{children:[`provider: `,be]}),ve&&(0,G.jsxs)(`span`,{children:[`reasoning: `,ve]}),xe&&(0,G.jsxs)(`span`,{children:[`model: `,xe]})]})]}),de.map((e,t)=>(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:Z1(e)}),(0,G.jsx)(Kf,{value:s[e]??``,onChange:t=>Ee(e,t.target.value),placeholder:J1[e]??`Enter ${Z1(e).toLowerCase()}`,className:`font-mono`,autoFocus:t===0})]},e)),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:[`Instruction`,(0,G.jsx)(`span`,{className:`ml-1 font-sans text-xs text-on-surface-variant font-normal`,children:`(optional)`})]}),(0,G.jsx)(`textarea`,{className:`w-full rounded-md bg-surface-container-lowest px-3 py-2 font-sans text-sm text-on-surface placeholder:text-on-surface-variant/50 focus:outline-hidden focus:ring-2 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 resize-none`,rows:3,placeholder:`Additional instructions for this run...`,value:l,onChange:e=>u(e.target.value),disabled:w})]}),B&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>g(e=>!e),className:`flex items-center gap-2 font-sans text-sm font-medium text-on-surface hover:text-on-surface focus:outline-hidden focus:ring-2 focus:ring-primary/40 rounded`,children:[(0,G.jsx)($i,{className:`h-4 w-4 transition-transform ${h?`rotate-180`:``}`}),`Override execution for this run`,ge>0&&(0,G.jsx)(X,{variant:`default`,className:`px-1.5 py-0 text-xs`,children:ge})]}),h&&(0,G.jsxs)(`div`,{className:`rounded-md border border-[var(--ghost-border)] bg-surface-container-low p-3`,children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant mb-4`,children:`Customize provider, model, and reasoning without modifying the task definition.`}),(0,G.jsxs)(`div`,{className:ke.length>0?`grid gap-6 md:grid-cols-2`:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(_1,{harness:V.harness||N,providerType:V.type||``,localBackend:V.localBackend,model:V.model,baseUrl:V.baseUrl,contextLength:V.contextLength,modelPlaceholder:R||void 0,providers:O,isLoadingProviders:D,showHarnessSelector:!0,onHarnessChange:te,onProviderChange:ne,onLocalBackendChange:re,onModelChange:U,onBaseUrlChange:ie,onContextLengthChange:ae}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs font-medium text-on-surface-variant`,children:`Reasoning level`}),(0,G.jsxs)(c_,{value:_??Y1,onValueChange:e=>v(e===Y1?void 0:e),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{})}),(0,G.jsxs)(d_,{children:[(0,G.jsxs)(f_,{value:Y1,children:[`Use task default (`,L??`default`,`)`]}),X$.map(e=>(0,G.jsx)(f_,{value:e,children:e},e))]})]}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant/70`,children:`Maps to the provider's reasoning profile for this run only.`})]}),ge>0&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>{v(void 0),b({}),oe({harness:J$(z.harness??`claude-sdk`)||`claude-sdk`,type:Y$(z.providerType??``),localBackend:z.localBackend??``,model:z.model??``,reasoningLow:z.reasoningMap?.low??``,reasoningDefault:z.reasoningMap?.default??``,reasoningHigh:z.reasoningMap?.high??``,baseUrl:z.baseUrl??``,contextLength:z.contextLength==null?``:String(z.contextLength)})},className:`text-xs text-on-surface-variant`,children:`Reset to task defaults`})]}),ke.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide`,children:`Per-phase overrides`}),ke.map(e=>(0,G.jsx)(v1,{phase:e,override:y[e.name]??{},taskHarness:V.harness||N,taskProviderType:V.type||F,taskModel:V.model||I||``,taskReasoningMap:{...P?.reasoning_map??{},...V.reasoningLow?{low:V.reasoningLow}:{},...V.reasoningDefault?{default:V.reasoningDefault}:{},...V.reasoningHigh?{high:V.reasoningHigh}:{}},providers:O,isLoadingProviders:D,onChange:t=>De(e.name,t)},e.name))]})]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`input`,{id:`run-task-dialog-dry-run`,type:`checkbox`,checked:d,onChange:e=>f(e.target.checked),disabled:w,className:`mt-0.5 h-4 w-4 rounded accent-primary`}),(0,G.jsxs)(`label`,{htmlFor:`run-task-dialog-dry-run`,className:`space-y-0.5`,children:[(0,G.jsx)(`span`,{className:`block font-sans text-sm font-medium text-on-surface`,children:`Dry run`}),(0,G.jsx)(`span`,{className:`block font-sans text-xs text-on-surface-variant`,children:`Intercept writes and record them as intents — no vault mutations.`})]})]}),T&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-tertiary`,children:T instanceof Error?T.message:`Failed to trigger run`}),p&&(0,G.jsx)(`p`,{className:`rounded-md bg-surface-container-low px-3 py-2 font-sans text-xs text-on-surface-variant`,children:p})]}),(0,G.jsxs)(Uf,{children:[(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(!1),disabled:w,children:`Cancel`}),(0,G.jsx)(Y,{size:`sm`,className:`gap-2`,onClick:Oe,disabled:w,children:w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ra,{className:`h-3.5 w-3.5 animate-spin`}),`Starting...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ja,{className:`h-3.5 w-3.5`}),`Run`]})})]})]})})}function e0(e,t){return t===`unavailable`||e===null?`—`:`${t===`estimated`?`~`:``}$${e.toFixed(4)}`}function t0(e){return e===null?`—`:e.toLocaleString()}function n0(e){switch(e){case`completed`:return`default`;case`running`:return`warning`;case`failed`:return`destructive`;default:return`secondary`}}function r0(e){return e===`user`?`warning`:`secondary`}var i0=`Default task`;function a0(e,t){return e?t.find(t=>t.name===e)?.displayName??e:i0}function o0(e){return e===`running`?`sage`:e===`completed`?`outline`:e===`failed`||e===`cancelled`?`terracotta`:`ochre`}function s0({status:e}){let t=n0(e);return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-semibold`,t==="default"?`bg-primary-container/20 text-primary`:t===`destructive`?`bg-tertiary-container/20 text-tertiary`:t===`warning`?`bg-secondary-container/20 text-secondary`:`bg-surface-container-high text-on-surface-variant`),children:rv(e)})}function c0(e){switch(e){case`completed`:case`complete`:case`done`:return`done`;case`running`:case`active`:case`in_progress`:return`active`;case`failed`:case`error`:case`cancelled`:return`failed`;case`skipped`:return`skipped`;default:return`pending`}}function l0({phases:e,status:t,className:n}){return!e||e.length===0?null:(0,G.jsx)(`div`,{className:J(`flex items-center gap-[3px]`,n),"aria-label":`${e.length} phase checkpoints for ${t} run`,title:`${e.length} phase checkpoints`,children:e.map(t=>{let n=c0(t.status);return(0,G.jsx)(`span`,{title:`${t.name}: ${t.status}`,"data-state":n,className:J(`h-1 rounded-[1px] bg-surface-container-high`,e.length>8?`w-1.5`:e.length>5?`w-2`:`w-3`,n===`done`&&`bg-sage`,n===`active`&&`animate-pulse bg-gradient-to-r from-sage to-sage/45 shadow-[0_0_4px_color-mix(in_srgb,var(--sage)_50%,transparent)]`,n===`failed`&&`bg-terracotta`,n===`skipped`&&`bg-sage/30`)},t.name)})})}function u0(){return(0,G.jsx)(`div`,{className:`border-b border-outline-variant/20 px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`h-4 w-4 animate-pulse rounded bg-surface-container shrink-0`}),(0,G.jsx)(`div`,{className:`h-4 w-4 animate-pulse rounded bg-surface-container shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,G.jsx)(`div`,{className:`h-4 w-2/3 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-1/2 animate-pulse rounded bg-surface-container`})]})]})})}var d0=(0,W.memo)((0,W.forwardRef)(function({run:e,onSelectRun:t,taskNameMap:n,selected:r,onToggleSelected:i,onRerun:a,isActive:o,isCursor:s},c){let l=(0,W.useCallback)(()=>t(e.id),[t,e.id]),u=e.task?n.get(e.task)??e.task:i0,d=(e.phase_checkpoints?.length??0)>1,f=[];if(e.started_at!==null&&e.completed_at!==null&&f.push(iv(e.started_at,e.completed_at)),e.tokens_used!==null&&e.tokens_used>0&&f.push(`${e.tokens_used.toLocaleString()} tok`),e.cost_source!==`unavailable`&&e.cost_usd!==null&&e.cost_usd>0){let t=e.cost_source===`estimated`?`~`:``;f.push(`${t}$${e.cost_usd.toFixed(4)}`)}return(0,G.jsxs)(`div`,{ref:c,"data-selected":o||void 0,"data-cursor":s||void 0,className:J(`group relative border-b border-[var(--ghost-border)] last:border-b-0 px-4 py-3 cursor-pointer transition-colors duration-100`,`hover:bg-surface-container`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sage/40`,o&&`bg-sage/[0.08] shadow-[inset_2px_0_0_var(--sage)]`,s&&!o&&`bg-surface-container/60 ring-1 ring-inset ring-sage/30`),onClick:l,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l())},tabIndex:0,role:`row`,"aria-selected":o,"aria-label":`Agent run: ${u}, status ${e.status}`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`pt-1 shrink-0`,onClick:e=>e.stopPropagation(),children:(0,G.jsx)(`input`,{type:`checkbox`,"aria-label":`Select run ${e.id.slice(0,8)}`,checked:r,onChange:()=>i(e.id),onClick:e=>e.stopPropagation(),className:`h-4 w-4 rounded accent-primary cursor-pointer`})}),(0,G.jsx)(wk,{tone:o0(e.status),pulse:e.status===`running`,className:`mt-1.5 shrink-0`}),(0,G.jsx)(`h3`,{className:`font-serif italic text-sm text-on-surface truncate leading-snug`,children:u}),e.dry_run&&(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-xs bg-secondary/15 px-1.5 py-0.5 font-sans text-[10px] uppercase tracking-wide text-secondary shrink-0`,title:`Dry run — writes were intercepted, no vault mutations`,children:`Dry`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[e.started_at!==null&&(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant whitespace-nowrap`,children:Q_(e.started_at)}),(0,G.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,G.jsx)(Y,{size:`icon`,variant:`ghost`,className:`h-7 w-7 text-on-surface-variant hover:text-on-surface opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity`,onClick:t=>{t.stopPropagation(),a(e)},title:`Rerun with same settings`,"aria-label":`Rerun ${e.id.slice(0,8)} with same settings`,children:(0,G.jsx)($a,{className:`h-3.5 w-3.5`})})})]})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 ml-11 flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(s0,{status:e.status}),e.resumable&&e.status===`failed`&&(0,G.jsx)(`span`,{className:`font-sans text-[10px] uppercase tracking-wide text-secondary`,children:`resumable`}),e.cost_source===`estimated`&&(0,G.jsx)(`span`,{className:`font-sans text-[10px] uppercase tracking-wide text-secondary`,children:`est`})]}),d?(0,G.jsx)(l0,{phases:e.phase_checkpoints,status:e.status,className:`shrink-0`}):(0,G.jsx)(jj,{data:e.activity_buckets,kind:`agent-run`,widthPx:48,heightPx:14,className:`shrink-0`})]}),f.length>0&&(0,G.jsx)(`div`,{className:`mt-1 ml-11 font-mono text-[11px] text-on-surface-variant truncate`,children:f.join(` · `)}),e.branch&&(0,G.jsxs)(`div`,{className:`mt-0.5 ml-11 inline-flex items-center gap-1 font-mono text-[10px] italic text-on-surface-variant`,children:[(0,G.jsx)(ka,{className:`h-2.5 w-2.5`}),e.branch]})]})}));function f0({selectedId:e,search:t,statusFilter:n,taskFilter:r,offset:i,onOffsetChange:a,filterInputRef:o,onSelectRun:s,onTriggerRun:c,onCompareRuns:l}){let[u,d]=(0,W.useState)(new Set),f=(0,W.useCallback)(e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),p=(0,W.useCallback)(()=>d(new Set),[]),[m,h]=(0,W.useState)(null),{data:g}=RA(),_=(0,W.useMemo)(()=>{let e=new Map;for(let t of g?.tasks??[])e.set(t.name,t.displayName);return e},[g]),{data:v,isLoading:y,isError:b,error:x}=PA({limit:50,offset:i,search:t,status:n,task:r}),S=v?.runs??[],C=v?.total??0,w=(0,W.useRef)(!1);(0,W.useEffect)(()=>{w.current||!e&&!y&&S.length>0&&(w.current=!0,s(S[0].id,{replace:!0}))},[e,y,S,s]);let T=EM({items:S,getId:e=>e.id,selectedId:e,onActivate:e=>s(e),filterInputRef:o}),E=S.filter(e=>e.status===`running`).length,D=S.reduce((e,t)=>e+(t.tokens_used??0),0),O=(0,G.jsxs)(`div`,{className:`px-4 py-3 border-b border-outline-variant/20`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-2`,children:[(0,G.jsx)(`h2`,{className:`font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`Runs`}),(0,G.jsx)(`span`,{className:`font-serif italic text-sm text-on-surface`,children:`History`})]}),(0,G.jsxs)(`div`,{className:`font-mono text-[11px] text-on-surface-variant inline-flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:C.toLocaleString()}),` TOTAL`]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:E.toLocaleString()}),` RUNNING`]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:D.toLocaleString()}),` TOKENS`]})]})]});return b?(0,G.jsxs)(`div`,{className:`p-4 space-y-4`,children:[O,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load runs`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:x instanceof Error?x.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{className:`p-4 space-y-4`,children:[O,y?(0,G.jsx)(`div`,{className:`rounded-md bg-surface-container-low overflow-hidden`,children:[1,2,3].map(e=>(0,G.jsx)(u0,{},e))}):S.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-3 rounded-md bg-surface-container-low text-on-surface-variant`,children:[(0,G.jsx)(Xi,{className:`h-10 w-10 opacity-30`}),(0,G.jsxs)(`div`,{className:`text-center font-sans`,children:[(0,G.jsx)(`p`,{className:`text-sm`,children:C===0&&!t&&!n&&!r?`No agent runs yet`:`No matching runs`}),C===0&&!t&&!n&&!r&&(0,G.jsx)(`p`,{className:`text-xs mt-1`,children:`Trigger the first run to see the agent at work`})]}),C===0&&!t&&!n&&!r&&(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,className:`gap-2 mt-2`,onClick:c,children:[(0,G.jsx)(Ja,{className:`h-3.5 w-3.5`}),`Run Now`]})]}):(0,G.jsx)(`div`,{...T.containerProps,role:`group`,"aria-label":`Agent run list keyboard navigation`,className:`rounded-md bg-surface-container-low overflow-hidden outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40`,children:(()=>{let t=wM(S,{isActive:e=>e.status===`running`,startedAtEpochSec:e=>e.started_at}),n=0;return t.map(t=>(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{role:`separator`,className:`flex items-center justify-between px-4 py-2 border-b border-outline-variant/20 bg-surface-container/30`,children:[(0,G.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:t.label}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:t.rows.length})]}),t.rows.map(t=>{let r=n++;return(0,G.jsx)(d0,{ref:T.setRowRef(r),run:t,taskNameMap:_,selected:u.has(t.id),onToggleSelected:f,onSelectRun:s,onRerun:h,isActive:e===t.id,isCursor:T.cursorIndex===r},t.id)})]},t.label))})()}),(0,G.jsx)(fM,{total:C,offset:i,limit:50,onPageChange:a}),(0,G.jsx)(D$,{selectedCount:u.size,onClear:p,onCompare:()=>l([...u])}),m!==null&&(0,G.jsx)($1,{open:!0,onOpenChange:e=>{e||h(null)},sourceRun:m})]})}function p0(e){return!Number.isFinite(e)||e<=0?null:e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:`${Math.round(e/6e4)}m`}function m0({intervalMs:e,isFetching:t,onManualRefresh:n,lastUpdatedAt:r,className:i}){let a=e===void 0?null:p0(e);return(0,G.jsxs)(`div`,{className:J(`flex items-center gap-2 text-on-surface-variant`,i),"aria-busy":t,children:[(0,G.jsx)(`span`,{"data-testid":`refresh-indicator-dot`,className:J(`h-1.5 w-1.5 rounded-full bg-primary`,t&&`animate-pulse`),"aria-hidden":!0}),a?(0,G.jsxs)(`span`,{className:`font-sans text-xs`,children:[`every `,a]}):null,(0,G.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Refresh now`,className:`rounded-md p-1 hover:bg-surface-container-high hover:text-on-surface transition-colors`,children:(0,G.jsx)(Qa,{className:J(`h-3 w-3`,t&&`animate-spin`)})})]})}function h0(e,t){if(typeof e!=`string`||e.length===0)return null;let n;try{n=JSON.parse(e)}catch{return null}return t?t(n)?n:null:n}var g0=80;function _0(e){switch(e){case`completed`:return`default`;case`failed`:return`destructive`;case`skipped`:return`secondary`;default:return`warning`}}function v0(e,t){return e.length<=t?e:`${e.slice(0,t)}…`}function y0({entry:e}){let[t,n]=(0,W.useState)(!1),r=Object.entries(e.toolCalls),i=e.writeIntents?Object.entries(e.writeIntents.byTool):[];return(0,G.jsxs)(Q,{level:`low`,className:`overflow-hidden`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 px-4 py-3 text-left hover:bg-surface-container-high/30 transition-colors`,onClick:()=>n(!t),"aria-expanded":t,children:[t?(0,G.jsx)($i,{className:`h-3.5 w-3.5 mt-1 shrink-0 text-on-surface-variant`}):(0,G.jsx)(ta,{className:`h-3.5 w-3.5 mt-1 shrink-0 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:e.phaseName}),(0,G.jsx)(X,{variant:_0(e.status),children:e.status}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[e.turnsUsed,` turn`,e.turnsUsed===1?``:`s`,e.maxTurns?` / ${e.maxTurns}`:``]}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[t0(e.tokensUsed),` tok`]}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:e0(e.costUsd,e.costSource??null)}),e.durationMs!==null&&(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[(e.durationMs/1e3).toFixed(1),`s`]})]}),e.skipReason&&(0,G.jsxs)(`p`,{className:`font-sans text-xs text-secondary mt-1`,children:[`Skipped: `,e.skipReason]})]})]}),t&&(0,G.jsxs)(`div`,{className:`space-y-3 border-t border-outline-variant/20 px-4 py-3`,children:[r.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wide text-on-surface-variant mb-1.5`,children:`Tool calls`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map(([e,t])=>(0,G.jsxs)(X,{variant:`secondary`,className:`font-mono`,children:[e,` × `,t]},e))})]}),e.writeIntents&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:`font-sans text-[11px] uppercase tracking-wide text-on-surface-variant mb-1.5`,children:[`Write intents (`,e.writeIntents.total,`)`]}),i.length===0?(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:`None attributed to this phase.`}):(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.map(([e,t])=>(0,G.jsxs)(X,{variant:`warning`,className:`font-mono`,children:[e,` × `,t]},e))})]}),e.summary&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wide text-on-surface-variant mb-1.5`,children:`Summary`}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface whitespace-pre-wrap`,children:e.summary})]})]})]})}function b0({turn:e}){let[t,n]=(0,W.useState)(!1),r=e.tool_input?h0(e.tool_input)??e.tool_input:null,i=e.tool_input?v0(e.tool_input,g0):`—`,a=e.tool_input!==null&&e.tool_input.length>g0;return(0,G.jsx)(`div`,{role:`button`,tabIndex:0,className:`px-4 py-2.5 hover:bg-surface-container-high/30 transition-colors border-b border-outline-variant/10 last:border-b-0 cursor-pointer`,onClick:()=>n(!t),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(!t))},"aria-expanded":t,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant w-5 shrink-0 pt-0.5 text-right`,children:e.turn_number}),(0,G.jsx)(`span`,{className:`font-mono text-xs font-medium text-on-surface shrink-0 pt-0.5 min-w-[140px]`,children:e.tool_name}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[a?(0,G.jsxs)(`div`,{className:`flex items-start gap-1 font-mono text-xs text-on-surface-variant w-full`,children:[t?(0,G.jsx)($i,{className:`h-3 w-3 mt-0.5 shrink-0`}):(0,G.jsx)(ta,{className:`h-3 w-3 mt-0.5 shrink-0`}),(0,G.jsx)(`span`,{className:t?void 0:`truncate`,children:i})]}):(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant truncate block`,children:i}),t&&r!==null&&(0,G.jsx)(`pre`,{className:`mt-1.5 ml-4 rounded-md bg-surface-container-lowest p-2.5 font-mono text-xs whitespace-pre-wrap overflow-x-auto max-h-48 text-on-surface-variant`,children:typeof r==`string`?r:JSON.stringify(r,null,2)}),t&&e.tool_output_summary&&(0,G.jsxs)(`div`,{className:`mt-1.5 ml-4`,children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wide text-on-surface-variant mb-1`,children:`Output`}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface whitespace-pre-wrap`,children:e.tool_output_summary})]})]})]})})}function x0(e){return e.slice().sort((e,t)=>(e.startedAt??e.completedAt??2**53-1)-(t.startedAt??t.completedAt??2**53-1))}function S0(e,t){let n=new Map;for(let e of t)n.set(e.phaseName,[]);n.set(`_unphased`,[]);for(let r of e){let e=r.started_at,i=null;if(e!==null){let n=-1/0;for(let r of t){let t=r.completedAt??1/0;if(e>n&&e<=t){i=r.phaseName;break}r.completedAt!==null&&(n=r.completedAt)}}i===null?n.get(`_unphased`).push(r):n.get(i).push(r)}for(let e of n.values())e.sort((e,t)=>e.turn_number-t.turn_number);let r=[];for(let e of t)r.push({phaseName:e.phaseName,turns:n.get(e.phaseName)});let i=n.get(`_unphased`);return i.length>0&&r.push({phaseName:`_unphased`,turns:i}),r}function C0({runId:e,runStatus:t,className:n}){let r=qA(e),i=LA(e,t),a=r.data?.audit.phases??[],o=i.data??[],s=r.isPending||i.isPending,c=!s&&a.length===0&&o.length===0;if(s)return(0,G.jsxs)(`div`,{className:J(`flex items-center gap-2 text-on-surface-variant py-4`,n),children:[(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Loading audit trail...`})]});if(c)return(0,G.jsx)(Q,{level:`low`,className:J(`flex h-20 items-center justify-center`,n),children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface-variant italic`,children:`This run had no recorded tool calls.`})});let l=x0(a),u=S0(o,l),d=new Map(l.map(e=>[e.phaseName,e]));return(0,G.jsxs)(`div`,{className:J(`space-y-3`,n),children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wide text-on-surface-variant`,children:`Audit Trail`}),u.map(e=>{let t=d.get(e.phaseName);return(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[t?(0,G.jsx)(y0,{entry:t}):(0,G.jsx)(`div`,{className:`px-4 py-2 rounded-md bg-surface-container/30`,children:(0,G.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:[`misc (`,e.turns.length,`)`]})}),e.turns.length>0&&(0,G.jsx)(Q,{level:`low`,className:`overflow-hidden ml-3`,children:e.turns.map(e=>(0,G.jsx)(b0,{turn:e},e.id))})]},e.phaseName)})]})}function w0({text:e}){let[t,n]=(0,W.useState)(!1),r=e.length>200||e.includes(`
|
|
409
|
-
`);return(0,G.jsxs)(`div`,{className:`mt-1`,children:[(0,G.jsx)(`div`,{className:!t&&r?`line-clamp-2`:void 0,children:(0,G.jsx)(fO,{content:e,className:`text-on-surface-variant [&>*]:text-on-surface-variant`})}),r&&(0,G.jsx)(`button`,{className:`flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors mt-1`,onClick:()=>n(!t),children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)($i,{className:`h-3 w-3`}),` Show less`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ta,{className:`h-3 w-3`}),` Show more`]})})]})}function T0({phases:e}){return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`h3`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Phase Execution`}),e.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-surface-container-high font-mono text-sm font-medium text-on-surface-variant shrink-0`,children:t+1}),(0,G.jsxs)(Q,{level:`default`,className:`flex-1 p-3`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:e.name}),(0,G.jsx)(X,{variant:n0(e.status),children:e.status})]}),(0,G.jsxs)(`div`,{className:`flex gap-3 font-mono text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{children:[e.turnsUsed,` turns`]}),(0,G.jsx)(`span`,{children:t0(e.tokensUsed)}),(0,G.jsx)(`span`,{children:e0(e.costUsd,e.costSource??null)})]})]}),e.summary&&(0,G.jsx)(w0,{text:e.summary})]})]},e.name))]})}function E0(e){let t=e.toLowerCase();return t.includes(`extract`)||t.includes(`create`)||t.includes(`supersed`)||t.includes(`update`)?`default`:t.includes(`skip`)||t.includes(`no-op`)?`secondary`:t.includes(`error`)||t.includes(`fail`)?`destructive`:`default`}function D0(e){switch(e){case`completed`:return`sage`;case`running`:return`ochre`;case`failed`:case`cancelled`:return`terra`;default:return`default`}}function O0({status:e}){return(0,G.jsx)(X,{variant:n0(e),className:`max-w-full truncate px-2.5 py-1 font-mono text-[11px] uppercase tracking-wide`,title:e,children:rv(e)})}function k0(e){return e===null?`—`:new Date(e*Ms).toLocaleTimeString()}function A0(e){if(!e)return`—`;switch(e){case`provider-config`:return`provider config`;case`provider-metadata`:return`provider metadata`;case`provider-default`:return`inferred provider default`;default:return e}}function j0(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function M0(e){return j0(e)}function N0(e){return j0(e)}function P0({label:e,value:t}){return(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-lowest px-3 py-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wide text-on-surface-variant`,children:e}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface`,children:t})]})}function F0({report:e}){let[t,n]=(0,W.useState)(!1),[r,i]=(0,W.useState)(!1),a=e.details!==null&&e.details.length>0,o=e.summary.length>200||e.summary.includes(`
|
|
410
|
-
`),s=a?h0(e.details)??e.details:null;return(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(X,{variant:E0(e.action),children:e.action}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:!r&&o?`line-clamp-3`:void 0,children:(0,G.jsx)(fO,{content:e.summary})}),o&&(0,G.jsx)(`button`,{className:`flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors mt-1`,onClick:()=>i(!r),children:r?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)($i,{className:`h-3 w-3`}),` Show less`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ta,{className:`h-3 w-3`}),` Show more`]})})]}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant shrink-0`,children:k0(e.created_at)})]}),a&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`button`,{className:`flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors`,onClick:()=>n(!t),children:[t?(0,G.jsx)($i,{className:`h-3.5 w-3.5`}):(0,G.jsx)(ta,{className:`h-3.5 w-3.5`}),t?`Hide details`:`Show details`]}),t&&(0,G.jsx)(`pre`,{className:`mt-2 rounded-md bg-surface-container-lowest p-3 font-mono text-xs overflow-auto max-h-48 text-on-surface-variant`,children:typeof s==`string`?s:JSON.stringify(s,null,2)})]})]})}function I0(e){let t=new Map;for(let n of e){let e=t.get(n.tool_name)??[];e.push(n),t.set(n.tool_name,e)}return Array.from(t.entries()).map(([e,t])=>({tool:e,items:t}))}function L0({tool:e,items:t}){let[n,r]=(0,W.useState)(!1);return(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-lowest`,children:[(0,G.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-surface-container-high/30 transition-colors`,onClick:()=>r(!n),children:[n?(0,G.jsx)($i,{className:`h-3.5 w-3.5 text-on-surface-variant`}):(0,G.jsx)(ta,{className:`h-3.5 w-3.5 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:e}),(0,G.jsx)(X,{variant:`secondary`,className:`ml-auto`,children:t.length})]}),n&&(0,G.jsx)(`div`,{className:`space-y-2 border-t border-outline-variant/20 px-3 py-3`,children:t.map(e=>(0,G.jsxs)(`div`,{className:`space-y-1`,children:[e.stub_id&&(0,G.jsxs)(`p`,{className:`font-mono text-[11px] text-on-surface-variant`,children:[`stub: `,(0,G.jsx)(`span`,{className:`text-on-surface`,children:e.stub_id})]}),(0,G.jsx)(`pre`,{className:`rounded-md bg-surface-container p-2 font-mono text-[11px] overflow-auto max-h-40 text-on-surface-variant`,children:JSON.stringify(e.tool_input,null,2)})]},e.id))})]})}function R0({runId:e}){let{data:t,isLoading:n,isError:r}=KA(e),i=t?.intents??[],a=(0,W.useMemo)(()=>I0(i),[i]);return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:[`Intended Writes`,i.length>0&&(0,G.jsxs)(`span`,{className:`ml-2 text-on-surface normal-case font-normal`,children:[i.length,` `,i.length===1?`intent`:`intents`]})]}),n?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface-variant py-4`,children:[(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Loading write intents...`})]}):r?(0,G.jsx)(Q,{level:`low`,className:`flex h-20 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-tertiary`,children:`Failed to load write intents`})}):i.length===0?(0,G.jsx)(Q,{level:`low`,className:`flex h-24 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface-variant`,children:`No writes attempted`})}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`space-y-2`,children:a.map(e=>(0,G.jsx)(L0,{tool:e.tool,items:e.items},e.tool))}),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant italic`,children:[i.length,` `,i.length===1?`write`:`writes`,` would have been performed — no vault data was mutated.`]})]})]})}var z0=5e3;function B0({revision:e,onRestore:t,isPending:n}){let[r,i]=(0,W.useState)(!1),a=e.content.length>240?e.content.slice(0,240)+`…`:e.content;return(0,G.jsx)(Q,{level:`low`,className:`p-3 space-y-2`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface`,children:[`#`,e.id]}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:ov(e.created_at)}),e.run_id&&(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:[`run: `,e.run_id.slice(0,8)]})]}),(0,G.jsx)(`button`,{className:`mt-1 text-left font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors whitespace-pre-wrap`,onClick:()=>i(!r),children:r?e.content:a})]}),(0,G.jsx)(Y,{size:`sm`,variant:`outline`,onClick:t,disabled:n,className:`shrink-0`,children:n?(0,G.jsx)(Ra,{className:`h-3.5 w-3.5 animate-spin`}):`Restore`})]})})}function V0({agentId:e,tier:t}){let[n,r]=(0,W.useState)(!1),{data:i,isLoading:a}=JA(n?e:``,t),o=YA(),s=i?.revisions??[],c=e=>{window.confirm(`Restore revision #${e}? The current digest content will be preserved as a new revision.`)&&o.mutate({revisionId:e})};return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`button`,{className:`flex items-center gap-2 font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide hover:text-on-surface transition-colors`,onClick:()=>r(!n),children:[n?(0,G.jsx)($i,{className:`h-4 w-4`}):(0,G.jsx)(ta,{className:`h-4 w-4`}),`Digest Revisions`,(0,G.jsxs)(`span`,{className:`normal-case font-normal text-xs`,children:[`(tier `,t,`)`]})]}),n&&(a?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface-variant py-4`,children:[(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Loading revisions...`})]}):s.length===0?(0,G.jsx)(Q,{level:`low`,className:`flex h-20 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface-variant`,children:`No revisions recorded`})}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[o.isError&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-tertiary`,children:o.error instanceof Error?o.error.message:`Restore failed`}),s.map(e=>(0,G.jsx)(B0,{revision:e,onRestore:()=>c(e.id),isPending:o.isPending},e.id))]}))]})}function H0({runId:e,onBack:t}){let[n,r]=(0,W.useState)(!1),{data:i,isLoading:a,isError:o,isFetching:s,refetch:c}=FA(e),l=i?.run?.status,{data:u,isLoading:d}=IA(e,l),{data:f}=RA(),p=GA(),m=(0,W.useMemo)(()=>f?.tasks??[],[f]),h=(0,W.useMemo)(()=>h0(i?.run?.cost_data,M0),[i?.run?.cost_data]),g=(0,W.useMemo)(()=>h0(i?.run?.usage_data,N0),[i?.run?.usage_data]),_=(0,W.useMemo)(()=>{let e=h0(i?.run?.actions_taken,j0);return e?.phases&&Array.isArray(e.phases)?e.phases:null},[i?.run?.actions_taken]);if(a)return(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans`,children:`Loading run...`})]});if(o||!i?.run)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Runs`]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Run not found`})]})]});let v=i.run,y=u?.reports??[],b=v.cost_source===`estimated`?`Estimated Cost`:`Cost`,x=v.dry_run===!0,S=[`completed`,`failed`,`skipped`].includes(v.status),C=!x&&v.task===`vault-evolve`;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Runs`]}),x&&(0,G.jsx)(X,{variant:`warning`,title:`Writes were intercepted and recorded as intents`,children:`Dry Run`}),!S&&(0,G.jsx)(m0,{className:`ml-auto`,intervalMs:Es.RUN_DETAIL,isFetching:s,onManualRefresh:()=>{c()}})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-4`,children:[(0,G.jsx)(Nj,{label:`Status`,value:(0,G.jsx)(O0,{status:v.status}),tone:D0(v.status),mono:!0}),(0,G.jsx)(Nj,{label:`Task`,value:a0(v.task,m),mono:!0}),(0,G.jsx)(Nj,{label:`Started`,value:ov(v.started_at),mono:!0}),(0,G.jsx)(Nj,{label:`Duration`,value:iv(v.started_at,v.completed_at),mono:!0}),(0,G.jsx)(Nj,{label:`Tokens`,value:t0(v.tokens_used),tone:`ochre`,mono:!0}),(0,G.jsx)(Nj,{label:b,value:e0(v.cost_usd,v.cost_source),tone:`ochre`,mono:!0})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[v.resumable&&v.status===`failed`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{size:`sm`,onClick:()=>p.mutate({runId:v.id,mode:`manual`}),disabled:p.isPending,children:[p.isPending?(0,G.jsx)(Ra,{className:`h-3.5 w-3.5 animate-spin`}):null,`Resume Run`]}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Resume status: `,v.resume_status??`ready`]})]}),(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,className:`gap-2`,onClick:()=>r(!0),title:`Start a new run with the same settings as this one`,children:[(0,G.jsx)($a,{className:`h-3.5 w-3.5`}),`Rerun with same settings`]})]}),(v.harness||v.provider||v.model)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 px-1`,children:[v.harness&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Harness: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:v.harness})]}),v.provider&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Provider: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:v.provider})]}),v.model&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Model: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:v.model})]}),v.cost_source&&v.cost_source!==`unavailable`&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Cost source: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:v.cost_source})]})]}),(h||g?.run)&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-3`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Cost Diagnostics`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-3`,children:[(0,G.jsx)(P0,{label:`Input`,value:t0(h?.breakdown.inputTokens??g?.run?.inputTokens??null)}),(0,G.jsx)(P0,{label:`Cached Input`,value:t0(h?.breakdown.cachedInputTokens??g?.run?.cachedTokens??null)}),(0,G.jsx)(P0,{label:`Uncached Input`,value:t0(h?.breakdown.uncachedInputTokens??null)}),(0,G.jsx)(P0,{label:`Output`,value:t0(h?.breakdown.outputTokens??g?.run?.outputTokens??null)}),(0,G.jsx)(P0,{label:`Requests`,value:t0(h?.breakdown.requestCount??g?.run?.requests??null)}),(0,G.jsx)(P0,{label:`Cache Savings`,value:e0(h?.breakdown.cacheSavingsUsd??null,`estimated`)})]}),h?.message&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:h.message})]}),g?.runBudget&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-3`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Token Budget`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-3`,children:[(0,G.jsx)(P0,{label:`Context Window`,value:t0(g.runBudget.contextWindowTokens)}),(0,G.jsx)(P0,{label:`Peak Request`,value:t0(g.runBudget.peakRequestTotalTokens)}),(0,G.jsx)(P0,{label:`Peak Input`,value:t0(g.runBudget.peakRequestInputTokens)}),(0,G.jsx)(P0,{label:`Peak Output`,value:t0(g.runBudget.peakRequestOutputTokens)}),(0,G.jsx)(P0,{label:`Budget Used`,value:g.runBudget.utilizationPercent==null?`—`:`${g.runBudget.utilizationPercent}%`}),(0,G.jsx)(P0,{label:`Headroom`,value:t0(g.runBudget.headroomTokens)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 px-1`,children:[(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Budget status: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:g.runBudget.status})]}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Context source: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:A0(g.runBudget.contextWindowSource)})]})]}),g.runBudget.message&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:g.runBudget.message})]}),v.error&&(0,G.jsx)(`div`,{className:`rounded-md bg-tertiary/10 px-3 py-2`,children:(0,G.jsx)(`p`,{className:`font-mono text-xs text-tertiary`,children:v.error})}),_&&_.length>0&&(0,G.jsx)(Q,{level:`low`,className:`p-4`,children:(0,G.jsx)(T0,{phases:_})}),v.phase_checkpoints&&v.phase_checkpoints.length>0&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-2`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Checkpoints`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:v.phase_checkpoints.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md bg-surface-container-lowest px-3 py-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface`,children:e.name}),(0,G.jsxs)(`p`,{className:`font-mono text-xs text-on-surface-variant`,children:[e.status,e.costSource?` • ${e.costSource}`:``]})]}),(0,G.jsx)(`p`,{className:`font-mono text-xs text-on-surface-variant`,children:ov(Math.floor(e.updatedAt))})]},e.name))})]}),x&&(0,G.jsx)(R0,{runId:v.id}),C&&(0,G.jsx)(V0,{agentId:v.agent_id,tier:z0}),(0,G.jsx)(C0,{runId:v.id,runStatus:v.status}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:[`Decisions`,y.length>0&&(0,G.jsxs)(`span`,{className:`ml-2 text-on-surface normal-case font-normal`,children:[y.length,` `,y.length===1?`action`:`actions`]})]}),d?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface-variant py-4`,children:[(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Loading decisions...`})]}):y.length===0?(0,G.jsx)(Q,{level:`low`,className:`flex h-24 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface-variant`,children:`No decisions recorded for this run`})}):(0,G.jsx)(`div`,{className:`space-y-2`,children:y.map(e=>(0,G.jsx)(F0,{report:e},e.id))})]}),(0,G.jsx)($1,{open:n,onOpenChange:r,sourceRun:v})]})}function U0(e){return!e.phases||e.phases.length===0?`Single query`:`${e.phases.length} phases`}function W0(e){return e===`user`?`User`:`Built-in`}function G0({task:e,onClick:t}){return(0,G.jsxs)(Q,{level:`low`,interactive:!0,className:J(`p-4 space-y-2 transition-all`,e.isDefault&&`ring-1 ring-primary/20 shadow-[inset_0_0_12px_rgba(171,207,184,0.08)]`),onClick:t,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface truncate`,children:e.displayName}),e.isDefault&&(0,G.jsx)(uo,{className:`h-3.5 w-3.5 text-primary shrink-0 fill-primary/30`})]}),e.description&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant mt-1 line-clamp-2`,children:e.description})]}),(0,G.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:(0,G.jsx)(X,{variant:r0(e.source),children:W0(e.source)})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-on-surface-variant`,children:[(0,G.jsx)(Pa,{className:`h-3 w-3`}),(0,G.jsx)(`span`,{className:`font-mono text-xs`,children:U0(e)})]}),e.reasoningLevel&&(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant/70 truncate max-w-[160px]`,children:[`reasoning `,e.reasoningLevel]}),e.maxTurns!==void 0&&(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant/70`,children:[`max `,e.maxTurns,` turns`]})]})]})}function K0({onSelect:e}){let{data:t,isLoading:n}=RA(),r=t?.tasks??[];return n?(0,G.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:Array.from({length:3}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-28 rounded-md animate-pulse bg-surface-container-low`},t))}):r.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No tasks found.`}):(0,G.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:r.map(t=>(0,G.jsx)(G0,{task:t,onClick:()=>e(t.name)},t.name))})}function q0({task:e,onRunTriggered:t,onDeleted:n,onCustomized:r}){let i=BA(),a=VA(),[o,s]=(0,W.useState)(!1);return(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(Y,{size:`sm`,onClick:()=>s(!0),children:`Run Now`}),e.source===`built-in`&&(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>i.mutate({taskId:e.name},{onSuccess:e=>{let t=e?.task?.name;t&&r&&r(t)}}),children:`Customize`}),e.source===`user`&&(0,G.jsx)(Y,{variant:`destructive`,size:`sm`,onClick:()=>{a.mutate(e.name,{onSuccess:()=>n?.()})},children:`Delete`}),(0,G.jsx)($1,{open:o,onOpenChange:s,preselectedTask:e,onTriggered:t})]})}var J0=20;function Y0({taskId:e,onSaved:t}){let{data:n,isLoading:r,isError:i}=HA(e),a=UA(),[o,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(!1);(0,W.useEffect)(()=>{n?.yaml&&(s(n.yaml),l(!1))},[n?.yaml]);function u(e){s(e),l(!0)}function d(){a.mutate({taskId:e,yaml:o},{onSuccess:()=>{l(!1),t?.()}})}function f(){n?.yaml&&(s(n.yaml),l(!1))}if(r)return(0,G.jsx)(`div`,{className:`h-64 animate-pulse rounded-md bg-surface-container-low`});if(i)return(0,G.jsx)(`div`,{className:`rounded-md bg-tertiary-container/20 p-4 font-sans text-sm text-tertiary`,children:`Failed to load task YAML.`});let p=n?.source!==`user`;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:[`Task Definition `,p&&`(read-only)`]}),!p&&(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:f,disabled:!c,children:`Reset`}),(0,G.jsx)(Y,{size:`sm`,onClick:d,disabled:!c||a.isPending,children:a.isPending?`Saving...`:`Save`})]})]}),(0,G.jsx)(`textarea`,{value:o,onChange:e=>u(e.target.value),readOnly:p,rows:J0,spellCheck:!1,className:`w-full rounded-md bg-surface-container-lowest p-4 font-mono text-sm text-on-surface leading-relaxed resize-y focus:outline-hidden focus:ring-2 focus:ring-primary/40 ${p?`opacity-75 cursor-not-allowed`:``}`}),a.isError&&(0,G.jsx)(`div`,{className:`rounded-md bg-tertiary-container/20 p-3 font-sans text-sm text-tertiary`,children:a.error.message}),a.isSuccess&&!c&&(0,G.jsx)(`div`,{className:`rounded-md bg-primary-container/20 p-3 font-sans text-sm text-primary`,children:`Task saved successfully.`})]})}var X0=`Used only when the selected reasoning profile has no mapping — e.g. local providers without a reasoning map.`;function Z0({open:e,onOpenChange:t,helperText:n=X0,...r}){let[i,a]=(0,W.useState)(!1),o=e!==void 0,s=o?e:i;return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{let e=!s;o?t?.(e):a(e)},className:`flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface`,children:[s?(0,G.jsx)($i,{className:`h-3.5 w-3.5`}):(0,G.jsx)(ta,{className:`h-3.5 w-3.5`}),`Advanced: pin a specific model`]}),s&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(f1,{...r}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant/70`,children:n})]})]})}var Q0=[[`low`,`Reasoning Low`],[`default`,`Reasoning Default`],[`high`,`Reasoning High`]];function $0({description:e,values:t,onChange:n,models:r,fallbackModel:i,fallbackReasoningMap:a,placeholderWhenEmpty:o=`Use default model`}){let s={...t.low?{low:t.low}:{},...t.default?{default:t.default}:{},...t.high?{high:t.high}:{}};return(0,G.jsxs)(`div`,{className:`space-y-3 rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest p-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant uppercase tracking-wide`,children:`Reasoning Profiles`}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant/80 mt-1`,children:e})]}),Q0.map(([e,c])=>{let l=t[e],u=n1(e,{reasoning_map:s},a?.[e]??i)||o;return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:c}),r.length>0?(0,G.jsx)(F$,{value:l,onValueChange:t=>n(e,t),placeholder:u,searchPlaceholder:`Search models...`,emptyMessage:`No models match that search.`,options:r.map(e=>({value:e,label:e})),sortOptions:!0,monospace:!0}):(0,G.jsx)(Kf,{value:l,onChange:t=>n(e,t.target.value),placeholder:u})]},e)})]})}var e2=[`active`,`idle`,`sleep`],t2={active:`Active`,idle:`Idle`,sleep:`Sleep`},n2=`__task_default__`;function r2(e){return JSON.stringify(e??null)}function i2(e){return{maxTurns:e?.maxTurns==null?``:String(e.maxTurns),timeoutSeconds:e?.timeoutSeconds==null?``:String(e.timeoutSeconds),phaseOverrides:e?.phases??{},scheduleOverride:e?.schedule??{},paramsOverride:e?.params??{}}}function a2({taskId:e,phases:t,defaults:n,schedule:r,params:i}){let{data:a,isPending:o}=o1(),{data:s}=a1(e),c=s1(),l=c1(),u=s?.config,d=i2(u),[f,p]=(0,W.useState)(d.maxTurns),[m,h]=(0,W.useState)(d.timeoutSeconds),[g,_]=(0,W.useState)(d.phaseOverrides),[v,y]=(0,W.useState)(d.scheduleOverride),[b,x]=(0,W.useState)(d.paramsOverride),[S,C]=(0,W.useState)(d),[w,T]=(0,W.useState)(u?.reasoningLevel),[E,D]=(0,W.useState)(u?.reasoningLevel),[O,k]=(0,W.useState)(!1),A=a?.providers??[],j={harness:n?.harness,providerType:n?.providerType,localBackend:n?.localBackend,model:n?.model,reasoningMap:n?.reasoningMap,baseUrl:n?.baseUrl,contextLength:n?.contextLength},{draft:M,isDirty:N,commitDraft:P,handleHarnessChange:F,handleProviderChange:I,handleModelChange:L,handleLocalBackendChange:R,handleReasoningChange:ee,handleBaseUrlChange:z,handleContextLengthChange:B}=B1({source:{harness:u?.harness,provider:u?.provider,model:u?.model},defaults:j,providers:A}),V=M.harness,H=M.type,te=M.model,ne=M.reasoningLow,U=M.reasoningDefault,re=M.reasoningHigh,ie=M.baseUrl,ae=M.contextLength,oe=ie||Q$(H,M.localBackend),se=u1(H||null,oe||void 0,`llm`,M.localBackend||null).data?.models??A.find(e=>e.type===H)?.models??[],ce=V||e1(H)||n?.harness||e1(n?.providerType)||`claude-sdk`,le=N||w!==E||f!==S.maxTurns||m!==S.timeoutSeconds||r2(g)!==r2(S.phaseOverrides)||r2(v)!==r2(S.scheduleOverride)||r2(b)!==r2(S.paramsOverride);(0,W.useEffect)(()=>{if(!s)return;let e=i2(u);p(e.maxTurns),h(e.timeoutSeconds),_(e.phaseOverrides),y(e.scheduleOverride),x(e.paramsOverride),C(e),T(u?.reasoningLevel),D(u?.reasoningLevel),u?.model&&k(!0)},[u,s,n?.maxTurns,n?.timeoutSeconds]);let ue=v.enabled??r?.enabled??!1,de=S.scheduleOverride.enabled,fe=v.enabled!==de,pe=s?.capability!=null&&s.capabilityEnabled===!1,me=pe?!1:fe?ue:s?.effectiveScheduleEnabled??ue,he=v.runIn??r?.runIn??[];function ge(e){I(e),c.reset()}function _e(e,t){_(n=>{let r={...n};return t===null?delete r[e]:r[e]=t,r})}function ve(){let t=L1({...M,harness:ce},se);if(!t)return;let n=r?Object.keys(v).length>0?{schedule:v}:{schedule:null}:{},a=i&&Object.keys(b).length>0?{params:b}:{};l.mutate({taskId:e,config:{harness:ce,provider:t,reasoningLevel:w??null,maxTurns:f?Number(f):null,timeoutSeconds:m?Number(m):null,phases:Object.keys(g).length>0?g:null,...n,...a}},{onSuccess:()=>{P(P1({harness:ce,provider:t},j)),D(w),C({maxTurns:f,timeoutSeconds:m,phaseOverrides:g,scheduleOverride:v,paramsOverride:b})}})}function ye(){l.mutate({taskId:e,config:{harness:null,provider:null,reasoningLevel:null,model:null,maxTurns:null,timeoutSeconds:null,phases:null,schedule:null,params:null}},{onSuccess:()=>{let e=i2(null);P(P1(null,j)),T(void 0),D(void 0),k(!1),p(e.maxTurns),h(e.timeoutSeconds),_(e.phaseOverrides),y(e.scheduleOverride),x(e.paramsOverride),C(e)}})}function be(){let e=H===`ollama`||H===`lmstudio`||H===`openai-compatible`,t={type:H,...H===`openai-compatible`&&M.localBackend?{local_backend:M.localBackend}:{},...e&&ie?{base_url:ie}:{}};c.mutate(t)}return(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Task Config`}),u&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:ye,className:`text-xs text-on-surface-variant`,children:`Clear All Overrides`})]}),(0,G.jsx)(_1,{harness:ce,providerType:H,localBackend:M.localBackend,model:te,baseUrl:ie,contextLength:ae,modelPlaceholder:n?.model,providers:A,isLoadingProviders:o,showModelSelector:!1,onHarnessChange:e=>{F(e)},onProviderChange:ge,onLocalBackendChange:R,onModelChange:L,onBaseUrlChange:z,onContextLengthChange:B}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Default reasoning profile`}),(0,G.jsxs)(c_,{value:w??n2,onValueChange:e=>T(e===n2?void 0:e),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{})}),(0,G.jsxs)(d_,{children:[(0,G.jsxs)(f_,{value:n2,children:[`Use inherited default (`,n?.reasoningLevel??`default`,`)`]}),X$.map(e=>(0,G.jsx)(f_,{value:e,children:e},e))]})]}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant/70`,children:`Resolves to a model through the reasoning profiles below.`})]}),H!==``&&(0,G.jsx)($0,{description:`Built-in task reasoning levels resolve through these task-level model mappings before falling back to the inherited defaults.`,values:{low:ne,default:U,high:re},onChange:ee,models:se,fallbackModel:te||n?.model,fallbackReasoningMap:n?.reasoningMap,placeholderWhenEmpty:`Use inherited model`}),H!==``&&(0,G.jsx)(Z0,{open:O,onOpenChange:k,providerType:H,localBackend:M.localBackend,baseUrl:ie,model:te,modelPlaceholder:n?.model,providers:A,onModelChange:L}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Max Turns`}),(0,G.jsx)(Kf,{type:`number`,value:f,onChange:e=>{p(e.target.value)},placeholder:n?.maxTurns==null?`—`:String(n.maxTurns)})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Timeout (seconds)`}),(0,G.jsx)(Kf,{type:`number`,value:m,onChange:e=>{h(e.target.value)},placeholder:n?.timeoutSeconds==null?`—`:String(n.timeoutSeconds)})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:be,disabled:c.isPending,className:`gap-1.5 text-on-surface-variant`,children:[c.isPending?(0,G.jsx)(Ra,{className:`h-3.5 w-3.5 animate-spin`}):(0,G.jsx)(Co,{className:`h-3.5 w-3.5`}),`Test`]}),c.isSuccess&&(0,G.jsx)(`span`,{className:`flex items-center gap-1 text-xs`,children:c.data.ok?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(oa,{className:`h-3.5 w-3.5 text-green-500`}),(0,G.jsxs)(`span`,{className:`text-green-500 font-mono`,children:[c.data.latency_ms,`ms`]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ca,{className:`h-3.5 w-3.5 text-red-400`}),(0,G.jsx)(`span`,{className:`text-red-400`,children:c.data.error})]})}),(0,G.jsx)(`div`,{className:`flex-1`}),(0,G.jsxs)(Y,{size:`sm`,onClick:ve,disabled:!le||l.isPending,className:`gap-1.5`,children:[l.isPending&&(0,G.jsx)(Ra,{className:`h-3.5 w-3.5 animate-spin`}),`Save`]})]}),r&&(0,G.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-[var(--ghost-border)]`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ua,{className:`h-3.5 w-3.5 text-on-surface-variant`}),(0,G.jsx)(`h3`,{className:`font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide`,children:`Scheduling`}),(0,G.jsx)(X,{variant:me?`secondary`:`outline`,className:`text-[10px] px-1.5 py-0`,children:pe?`governed off`:me?`active`:`off`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface`,children:`Auto-run`}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant`,children:`Automatically run this task on a schedule`})]}),(0,G.jsx)(XN,{checked:me,disabled:pe,onCheckedChange:e=>{y(t=>({...t,enabled:e}))}})]}),me&&(0,G.jsxs)(`div`,{className:`space-y-3 pl-0.5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Run every (seconds)`}),(0,G.jsx)(Kf,{type:`number`,min:10,value:v.intervalSeconds??``,onChange:e=>{let t=e.target.value;y(e=>({...e,intervalSeconds:t?Number(t):void 0}))},placeholder:r.intervalSeconds==null?`300`:String(r.intervalSeconds)})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Run in states`}),(0,G.jsx)(`div`,{className:`flex gap-2`,children:e2.map(e=>{let t=he.includes(e);return(0,G.jsx)(`button`,{onClick:()=>{let n=t?he.filter(t=>t!==e):[...he,e];y(e=>({...e,runIn:n.length>0?n:void 0}))},className:`
|
|
411
|
-
rounded-md border px-3 py-1.5 font-sans text-xs font-medium transition-colors
|
|
412
|
-
${t?`border-primary/40 bg-primary/5 text-on-surface`:`border-[var(--ghost-border)] bg-surface-container-lowest text-on-surface-variant hover:border-primary/20`}
|
|
413
|
-
`,children:t2[e]},e)})})]})]})]}),i&&Object.keys(i).length>0&&(0,G.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-[var(--ghost-border)]`,children:[(0,G.jsx)(`h3`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Parameters`}),Object.entries(i).map(([e,t])=>{let n=b[e],r=n??t,i=e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase());return typeof t==`boolean`?(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm text-on-surface`,children:i}),(0,G.jsx)(XN,{checked:r,onCheckedChange:t=>{x(n=>({...n,[e]:t}))}})]},e):(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm text-on-surface`,children:i}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Kf,{type:typeof t==`number`?`number`:`text`,value:n==null?``:String(n),placeholder:String(t),onChange:n=>{let r=typeof t==`number`?n.target.value===``?void 0:Number(n.target.value):n.target.value;x(r===void 0?t=>{let n={...t};return delete n[e],n}:t=>({...t,[e]:r}))},className:`w-40 font-mono`}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`default: `,String(t)]})]})]},e)})]}),t&&t.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2 pt-2 border-t border-[var(--ghost-border)]`,children:[(0,G.jsx)(`h3`,{className:`font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide`,children:`Per-Phase Overrides`}),t.map(e=>(0,G.jsx)(v1,{phase:e,override:g[e.name]??{},taskHarness:ce,taskProviderType:H,taskModel:te||n?.model||``,taskReasoningMap:{...n?.reasoningMap??{},...ne?{low:ne}:{},...U?{default:U}:{},...re?{high:re}:{}},providers:A,isLoadingProviders:o,onChange:t=>_e(e.name,t)},e.name))]})]})}var o2=3;function s2(e){return{harness:e.execution?.harness,provider:e.execution?.provider?.type,model:e.execution?.model??e.model,reasoningLevel:e.execution?.reasoningLevel??e.reasoningLevel,maxTurns:e.execution?.maxTurns??e.maxTurns,timeoutSeconds:e.execution?.timeoutSeconds??e.timeoutSeconds}}function c2(e,t){let n=t?.agent?.provider,r=e.execution?.provider,i=e.execution?.reasoningLevel??e.reasoningLevel,a=e.execution?.model??e.model??n?.model;return{harness:e.execution?.harness??t?.agent?.harness??e1(r?.type)??e1(n?.type),providerType:r?.type??n?.type,localBackend:r?.local_backend??n?.local_backend,reasoningLevel:i,model:n1(i,r??n,a),reasoningMap:r?.reasoning_map??n?.reasoning_map,baseUrl:r?.base_url??n?.base_url,contextLength:r?.context_length??n?.context_length,maxTurns:e.execution?.maxTurns??e.maxTurns,timeoutSeconds:e.execution?.timeoutSeconds??e.timeoutSeconds}}function l2(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(`div`,{className:`h-8 w-24 animate-pulse rounded bg-surface-container-high`}),(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-low p-4 space-y-3`,children:[(0,G.jsx)(`div`,{className:`h-6 w-48 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-64 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-8 w-32 animate-pulse rounded bg-surface-container-high`})]}),(0,G.jsx)(`div`,{className:`rounded-md bg-surface-container-low p-4 space-y-2`,children:Array.from({length:o2}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-5 animate-pulse rounded bg-surface-container-high`},t))})]})}function u2({phase:e,index:t}){return(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`flex h-6 w-6 items-center justify-center rounded-full bg-surface-container-high font-mono text-xs font-semibold text-on-surface-variant shrink-0`,children:t+1}),(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:e.name}),!e.required&&(0,G.jsx)(X,{variant:`secondary`,children:`optional`})]}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant shrink-0`,children:[`max `,e.maxTurns,` turns`]})]}),e.reasoningLevel&&(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsxs)(X,{variant:`secondary`,children:[`reasoning `,e.reasoningLevel]})}),e.tools.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.tools.map(e=>(0,G.jsx)(`span`,{className:`font-mono text-xs px-1.5 py-0.5 rounded-xs bg-surface-container-high text-on-surface-variant`,children:e},e))}),(0,G.jsx)(Q,{level:`lowest`,className:`p-3 overflow-auto max-h-40`,children:(0,G.jsx)(fO,{content:e.prompt})})]})}function d2({taskId:e,onBack:t,onNavigate:n,onRunTriggered:r}){let{data:i,isPending:a,isError:o}=zA(e),{effective:s}=LO(),c=i?.task,l=c?.phases??[],u=c?s2(c):{},d=c?c2(c,s):{},f=(0,W.useMemo)(()=>({harness:d.harness,providerType:d.providerType,localBackend:d.localBackend,reasoningLevel:d.reasoningLevel,reasoningMap:d.reasoningMap,model:d.model,baseUrl:d.baseUrl,contextLength:d.contextLength,maxTurns:d.maxTurns,timeoutSeconds:d.timeoutSeconds}),[d.harness,d.providerType,d.localBackend,d.reasoningLevel,d.reasoningMap,d.model,d.baseUrl,d.contextLength,d.maxTurns,d.timeoutSeconds]);return a?(0,G.jsx)(l2,{}):o||!i?.task?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Tasks`]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Task not found`})]})]}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Tasks`]}),(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 space-y-1 min-w-0`,children:[(0,G.jsx)(`h1`,{className:`font-serif text-lg text-on-surface`,children:c.displayName}),c.description&&(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:c.description})]}),(0,G.jsx)(X,{variant:r0(c.source),className:`shrink-0`,children:rv(c.source??`built-in`)})]}),(0,G.jsx)(q0,{task:c,onDeleted:t,onCustomized:e=>n?.(e),onRunTriggered:r})]}),(0,G.jsx)(a2,{taskId:e,phases:l,defaults:f,schedule:c.schedule,params:c.params}),(u.model!==void 0||u.reasoningLevel!==void 0||u.maxTurns!==void 0||u.timeoutSeconds!==void 0)&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-3`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Task Definition`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[u.harness!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Runtime`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.harness})]}),u.provider!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Provider`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.provider})]}),u.model!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Model`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.model})]}),u.reasoningLevel!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Reasoning`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.reasoningLevel})]}),u.maxTurns!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Max Turns`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.maxTurns})]}),u.timeoutSeconds!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Timeout`}),(0,G.jsxs)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:[u.timeoutSeconds,`s`]})]})]})]}),l.length>0?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:[`Phases`,(0,G.jsxs)(`span`,{className:`ml-2 text-on-surface normal-case font-normal`,children:[l.length,` `,l.length===1?`phase`:`phases`]})]}),l.map((e,t)=>(0,G.jsx)(u2,{phase:e,index:t},e.name))]}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Prompt`}),(0,G.jsx)(Q,{level:`lowest`,className:`p-4 overflow-auto max-h-96`,children:(0,G.jsx)(fO,{content:c.prompt??``})})]}),(0,G.jsx)(Y0,{taskId:e})]})}function f2({label:e,value:t,max:n,color:r}){let i=n>0?Math.round(t/n*100):0,a=2*Math.PI*36,o=a-i/100*a;return(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative h-20 w-20`,children:[(0,G.jsxs)(`svg`,{className:`h-20 w-20 -rotate-90`,viewBox:`0 0 80 80`,children:[(0,G.jsx)(`circle`,{cx:`40`,cy:`40`,r:`36`,fill:`none`,stroke:`currentColor`,className:`text-surface-container/30`,strokeWidth:`6`}),(0,G.jsx)(`circle`,{cx:`40`,cy:`40`,r:`36`,fill:`none`,stroke:r,strokeWidth:`6`,strokeLinecap:`round`,strokeDasharray:a,strokeDashoffset:o,className:`transition-all duration-700`})]}),(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,G.jsxs)(`span`,{className:`text-sm font-semibold font-mono text-on-surface`,children:[i,`%`]})})]}),(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant text-center font-sans`,children:e})]})}function p2({label:e,value:t}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant font-sans`,children:e}),(0,G.jsx)(`span`,{className:`text-xs font-mono text-on-surface`,children:t})]})}function m2({stats:e}){let t=e.embedding.total_embeddable>0?e.embedding.embedded_count:0,n=e.embedding.total_embeddable;return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`h2`,{className:`text-xs font-semibold text-on-surface-variant uppercase tracking-widest flex items-center gap-2 font-sans`,children:[(0,G.jsx)(Gi,{className:`h-3.5 w-3.5`}),`System Health`]}),(0,G.jsxs)(`div`,{className:`flex justify-center gap-8 py-2`,children:[(0,G.jsx)(f2,{label:`Embedding Coverage`,value:t,max:n,color:`#abcfb8`}),(0,G.jsx)(f2,{label:`Queue Health`,value:Math.max(0,n-e.embedding.queue_depth),max:n,color:`#edbf7f`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-0`,children:[(0,G.jsx)(p2,{label:`Sessions`,value:String(e.vault.session_count)}),(0,G.jsx)(p2,{label:`Spores`,value:String(e.vault.spore_count)}),(0,G.jsx)(p2,{label:`Entities`,value:String(e.vault.entity_count)}),(0,G.jsx)(p2,{label:`Graph edges`,value:String(e.vault.edge_count)}),(0,G.jsx)(p2,{label:`Uptime`,value:X_(e.daemon.uptime_seconds)}),(0,G.jsx)(p2,{label:`Daemon`,value:`v${e.daemon.version} :${e.daemon.port}`}),e.agent.last_run_at!==null&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(p2,{label:`Last run`,value:Q_(e.agent.last_run_at)}),(0,G.jsx)(p2,{label:`Total runs`,value:String(e.agent.total_runs)})]}),e.digest.freshest_tier!==null&&(0,G.jsx)(p2,{label:`Digest tier`,value:`T${e.digest.freshest_tier}`})]})]})}function h2(){let{effective:e,isLoading:t}=LO(),{data:n,isLoading:r}=Fs(),{data:i,isLoading:a}=RA(),o=i?.tasks??[],[s,c]=(0,W.useState)(null),l=o.find(e=>e.isDefault)?.name??``,u=s??l,d=(0,W.useCallback)(e=>{c(e)},[]),f=!!e?.agent?.provider;return t||!e?(0,G.jsx)(`div`,{className:`space-y-4`,children:[1,2,3].map(e=>(0,G.jsx)(`div`,{className:`h-32 rounded-md animate-pulse bg-surface-container-low`},e))}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Q,{id:Pi.agentOperations,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-sage transition-all duration-300`,children:[(0,G.jsx)(MM,{children:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(io,{className:`h-4 w-4 text-primary`}),`Agent Operations`]})}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(iP,{path:`agent.scheduled_tasks_enabled`,label:`Scheduled Tasks`,hint:`runs intelligence/skill-survey/skill-evolve on a cron`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t,disabled:!f})}),(0,G.jsx)(iP,{path:`agent.event_tasks_enabled`,label:`Event-Driven Tasks`,hint:`titles + summaries on session end`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t,disabled:!f})})]}),!f&&(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant/70`,children:[`Configure an agent provider in`,` `,(0,G.jsx)(ri,{to:`/settings`,className:`underline hover:text-on-surface transition-colors`,children:`Settings`}),` `,`to enable agent tasks.`]}),(0,G.jsx)(`div`,{className:`border-t border-outline-variant/20`}),(0,G.jsx)(iP,{path:`agent.summary_batch_interval`,label:`Title & Summary Batch Interval`,commitOn:`blur`,hint:`batches between event-driven summary triggers; 0 disables`,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(Kf,{type:`number`,min:0,placeholder:`5`,value:e??``,onChange:e=>t(Number(e.target.value)),onBlur:n,className:`w-32 font-mono`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:`batches`})]})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Default Task`}),a?(0,G.jsxs)(`div`,{className:`flex h-9 items-center gap-2 text-on-surface-variant font-sans text-sm`,children:[(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),`Loading tasks...`]}):(0,G.jsxs)(c_,{value:u,onValueChange:d,children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:`Select default task`})}),(0,G.jsx)(d_,{children:o.map(e=>(0,G.jsx)(f_,{value:e.name,children:e.displayName},e.name))})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`The task used when Run Now is clicked or no task is specified.`})]})]}),r?(0,G.jsx)(Q,{level:`low`,className:`p-6`,children:(0,G.jsx)(`div`,{className:`h-32 animate-pulse rounded-md bg-surface-container`})}):n?(0,G.jsx)(Q,{level:`low`,className:`p-6`,children:(0,G.jsx)(m2,{stats:n})}):null]})}var g2={sage:`border-t-sage`,ochre:`border-t-ochre`,terracotta:`border-t-terracotta`,outline:`border-t-outline`},_2={sage:`text-sage`,ochre:`text-ochre`,terracotta:`text-terracotta`,outline:`text-on-surface`};function v2({label:e,value:t,sublabel:n,accent:r,sparklineData:i,className:a,href:o}){let s=J(`rounded-lg border border-outline-variant/10 bg-surface-container/60 p-4 border-t-2 transition-[border-color,background-color] duration-200 hover:border-outline-variant/25 hover:bg-surface-container/80`,o&&`cursor-pointer`,g2[r],a),c=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-wider text-outline mb-2`,children:e}),(0,G.jsxs)(`div`,{className:`flex items-end justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:J(`font-serif text-2xl font-bold`,_2[r]),children:t}),i&&i.length>=2&&(0,G.jsx)(Ej,{data:i,widthPx:80,heightPx:28,className:`opacity-60`})]}),n&&(0,G.jsx)(`p`,{className:`font-mono text-[10px] text-outline mt-1`,children:n})]});return o?(0,G.jsx)(ri,{to:o,className:J(s,`block no-underline`),children:c}):(0,G.jsx)(`div`,{className:s,children:c})}var y2=`(task default)`;function b2(e){return e.reasoning_level??`(task default)`}function x2(e){let t=[];return S2(e.harness)&&t.push(String(e.harness)),S2(e.reasoningLevel)&&t.push(String(e.reasoningLevel)),S2(e.model)&&t.push(String(e.model)),t.length===0?`default`:t.join(` / `)}function S2(e){return!(e==null||e===``||e===`(task default)`)}function C2(e,t){return e==null||!Number.isFinite(e)||t<=0?null:Math.round(e/t*1e4)/1e4}function w2(e,t){let n=null,r=null,i=null,a=null;for(let o=0;o<e.length;o++){let s=e[o],c=x2({harness:s.harness,reasoningLevel:t[o],model:s.model});s.cost_usd!==null&&s.cost_usd!==void 0&&Number.isFinite(s.cost_usd)&&((n===null||s.cost_usd<n.run.cost_usd)&&(n={run:s,label:c}),(r===null||s.cost_usd>r)&&(r=s.cost_usd));let l=s.write_intents?.total??0;l>0&&(i===null||l>(i.run.write_intents?.total??0))&&(i={run:s,label:c}),s.duration_ms!==null&&s.duration_ms!==void 0&&Number.isFinite(s.duration_ms)&&(a===null||s.duration_ms<a.run.duration_ms)&&(a={run:s,label:c})}let o=n&&r!==null&&r>0?Math.round((n.run.cost_usd??0)/r*100):null;return{cheapest:n,cheapestPct:o,mostWrites:i,fastest:a}}function T2(e){let t=Object.entries(e);return t.length===0?``:(t.sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])),t.map(([e,t])=>`${E2(e)}×${t}`).join(`, `))}function E2(e){let t=e.split(`_`);if(t.length<=1)return e;let n=t[t.length-1];return n.length<3?e:n}function D2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function O2(e){let t=h0(e,D2)?.phases;if(!Array.isArray(t)||t.length===0)return null;let n=0,r=!1;for(let e of t)typeof e.turnsUsed==`number`&&Number.isFinite(e.turnsUsed)&&(n+=e.turnsUsed,r=!0);return r?n:null}var k2=new Set([`status`]);function A2(e,t){switch(t){case`harness`:return e.harness??`__missing__`;case`reasoning`:return e.reasoning_level??`__missing__`;case`model`:return e.model??`__missing__`;case`status`:return e.status;case`turns`:{let t=O2(e.usage_data);return t===null?`__missing__`:String(t)}case`tokens`:return e.tokens_used===null||e.tokens_used===void 0?`__missing__`:String(e.tokens_used);case`cost`:return e.cost_usd===null||e.cost_usd===void 0?`__missing__`:e.cost_usd.toFixed(6);case`duration`:return e.duration_ms===null||e.duration_ms===void 0?`__missing__`:String(e.duration_ms);case`writes`:return String(e.write_intents?.total??0);case`costPerWrite`:{let t=C2(e.cost_usd,e.write_intents?.total??0);return t===null?`__missing__`:t.toFixed(4)}}}function j2(e,t){if(e.length<2)return new Set(t);let n=new Set;for(let r of t){if(k2.has(r)){n.add(r);continue}let t=A2(e[0],r),i=!1;for(let n=1;n<e.length;n++)if(A2(e[n],r)!==t){i=!0;break}i&&n.add(r)}return n}var M2=`run`;function N2(e){let t=P2(e.usage_data),n=e.execution_overrides?.phases??{},r=e.reasoning_level??null,i=e.model??null;return t.length===0?[{name:M2,reasoning:r,model:i,turnsUsed:O2(e.usage_data),tokensUsed:e.tokens_used??null,costUsd:e.cost_usd??null,durationMs:e.duration_ms??null}]:t.map(e=>{let t=n[e.name];return{name:e.name,reasoning:t?.reasoningLevel??r,model:t?.model??i,turnsUsed:typeof e.turnsUsed==`number`&&Number.isFinite(e.turnsUsed)?e.turnsUsed:null,tokensUsed:typeof e.tokensUsed==`number`&&Number.isFinite(e.tokensUsed)?e.tokensUsed:null,costUsd:typeof e.costUsd==`number`&&Number.isFinite(e.costUsd)?e.costUsd:null,durationMs:typeof e.usage?.durationMs==`number`&&Number.isFinite(e.usage.durationMs)?e.usage.durationMs:null}})}function P2(e){let t=h0(e,D2)?.phases;return Array.isArray(t)?t.filter(e=>typeof e?.name==`string`):[]}function F2(e){let t=e.execution_overrides?.phases;return t?Object.keys(t).length:0}function I2(e){let t=e.execution_overrides?.phases;if(!t)return``;let n=[];for(let[e,r]of Object.entries(t)){let t=[];r?.reasoningLevel&&t.push(r.reasoningLevel),r?.model&&t.push(`model=${r.model}`),n.push(`${e}: ${t.length>0?t.join(`, `):`(no override)`}`)}return n.join(` · `)}function L2(e){let t=0,n=0,r=0,i=0,a=0;for(let o of e)o.status===`completed`?t+=1:o.status===`failed`?n+=1:o.status===`skipped`&&(r+=1),typeof o.tokens_used==`number`&&Number.isFinite(o.tokens_used)&&(i+=o.tokens_used),typeof o.cost_usd==`number`&&Number.isFinite(o.cost_usd)&&(a+=o.cost_usd);return{total:e.length,completed:t,failed:n,skipped:r,totalTokens:i,totalCostUsd:a}}function R2(e){if(e.length<2)return{show:!1,spanMinutes:0,differentTasks:!1};let t=null,n=null,r=new Set;for(let i of e){i.task!==null&&i.task!==void 0?r.add(i.task):r.add(`__null_task__`);let e=i.started_at;typeof e==`number`&&Number.isFinite(e)&&((t===null||e<t)&&(t=e),(n===null||e>n)&&(n=e))}let i=t!==null&&n!==null?n-t:0,a=Math.floor(i/60),o=r.size>1;return{show:a>5||o,spanMinutes:a,differentTasks:o}}function z2(e){let t=Math.max(0,Math.floor(e));if(t<60)return`${t} ${t===1?`minute`:`minutes`}`;let n=Math.floor(t/60);if(n<24)return`${n} ${n===1?`hour`:`hours`}`;let r=Math.floor(n/24);return`${r} ${r===1?`day`:`days`}`}function B2(e){if(e.length===0)return{sameInput:null};let t=e.map(e=>({runId:e.id,inputs:b1(e.instruction)}));if(!t.some(e=>Object.keys(e.inputs).length>0))return{sameInput:null};let n=t[0].inputs,r=t.every(e=>V2(e.inputs,n)),i=Object.keys(n).length>0;return r&&i?{sameInput:!0,inputs:n}:{sameInput:!1,perRun:t}}function V2(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}var H2=[`harness`,`reasoning`,`model`,`status`,`turns`,`tokens`,`cost`,`duration`,`writes`,`costPerWrite`],U2={harness:`Runtime`,reasoning:`Reasoning`,model:`Model`,status:`Status`,turns:`Turns`,tokens:`Tokens`,cost:`Cost`,duration:`Duration`,writes:`Writes`,costPerWrite:`$/write`},W2=32;function G2({runs:e,isLoading:t,isError:n,errorMessage:r,onBack:i,onOpenRun:a,title:o=`Comparison`,subtitle:s,aggregate:c,metadataSlot:l,backLabel:u=`Back`}){let d=(0,W.useMemo)(()=>c??L2(e),[c,e]),f=(0,W.useMemo)(()=>e.map(e=>b2(e)),[e]),p=(0,W.useMemo)(()=>w2(e,f),[e,f]),m=(0,W.useMemo)(()=>R2(e),[e]),h=(0,W.useMemo)(()=>B2(e),[e]),{data:g}=RA(),_=(0,W.useMemo)(()=>{let e=new Map;for(let t of g?.tasks??[])e.set(t.name,t.displayName);return e},[g]),v=(0,W.useMemo)(()=>Z2(e,_),[e,_]),[y,b]=(0,W.useState)(!1),[x,S]=(0,W.useState)(new Set),C=(0,W.useCallback)(e=>{S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),w=(0,W.useMemo)(()=>y?j2(e,H2):new Set(H2),[y,e]),T=(0,W.useMemo)(()=>e.some(e=>F2(e)>0),[e]);if(t&&e.length===0)return(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans`,children:`Loading runs...`})]});if(n)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),u]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load runs`}),r&&(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:r})]})]});let E=e.length>1,D=e.length>1,O=s??`${e.length} ${e.length===1?`run`:`runs`}`,k=w.size+2;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),u]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h1`,{className:`font-serif text-xl text-on-surface`,children:o}),O&&(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:O})]}),m.show&&m.spanMinutes>5&&(0,G.jsxs)(Q,{level:`low`,className:`flex items-start gap-2 p-3 border border-outline-variant/40`,children:[(0,G.jsx)(_o,{className:`h-4 w-4 mt-0.5 text-secondary shrink-0`,"aria-hidden":!0}),(0,G.jsxs)(`div`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Runs span `,z2(m.spanMinutes),` of vault activity — results may reflect different vault states. Consider running with the same input (session_id, batch_id) for apples-to-apples comparison.`]})]}),(v.kind!==`none`||h.sameInput!==null)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v.kind===`single`&&(0,G.jsxs)(X,{variant:`outline`,className:`text-xs`,children:[`Task: `,v.label]}),v.kind===`mixed`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(X,{variant:`warning`,className:`text-xs`,title:v.tooltip,children:[`Tasks: `,v.count]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(_o,{className:`h-3 w-3 inline`,"aria-hidden":!0}),`Runs span multiple tasks — mechanical metrics are still comparable but output semantics differ.`]})]}),h.sameInput===!0&&(0,G.jsxs)(X,{variant:`default`,className:`gap-1 text-xs`,title:$2(h.inputs),children:[(0,G.jsx)(oa,{className:`h-3 w-3`,"aria-hidden":!0}),`Same input: `,Q2(h.inputs)]}),h.sameInput===!1&&(0,G.jsxs)(X,{variant:`warning`,className:`gap-1 text-xs`,children:[(0,G.jsx)(_o,{className:`h-3 w-3 inline`,"aria-hidden":!0}),`Different inputs — each run targeted different data`]})]}),l,(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4`,children:[(0,G.jsx)(v2,{label:`Runs`,value:String(d.total),accent:`outline`}),(0,G.jsx)(v2,{label:`Completed`,value:String(d.completed),accent:`sage`}),(0,G.jsx)(v2,{label:`Failed`,value:String(d.failed),accent:`terracotta`}),(0,G.jsx)(v2,{label:`Skipped`,value:String(d.skipped),accent:`outline`}),(0,G.jsx)(v2,{label:`Tokens`,value:t0(d.totalTokens),accent:`ochre`}),(0,G.jsx)(v2,{label:`Cost`,value:e0(d.totalCostUsd,`actual`),accent:`ochre`})]}),E&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[p.cheapest?(0,G.jsx)(t4,{label:`Cheapest`,cell:p.cheapest.label,value:`${e0(p.cheapest.run.cost_usd,`actual`)}${p.cheapestPct===null?``:` (${p.cheapestPct}% of most expensive)`}`}):null,p.mostWrites?(0,G.jsx)(t4,{label:`Most writes`,cell:p.mostWrites.label,value:`${p.mostWrites.run.write_intents.total} intents`}):null,p.fastest?(0,G.jsx)(t4,{label:`Fastest`,cell:p.fastest.label,value:av(p.fastest.run.duration_ms)}):null]}),T&&(0,G.jsx)(`p`,{className:`font-sans text-xs italic text-on-surface-variant`,children:`Some runs use phase-level overrides — expand rows to see per-phase differences.`}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Run comparison`}),D&&(0,G.jsx)(Y,{variant:y?`secondary`:`ghost`,size:`sm`,onClick:()=>b(e=>!e),className:`gap-2 text-xs`,"aria-pressed":y,children:`Show only varying dimensions`})]}),e.length===0?(0,G.jsx)(Q,{level:`low`,className:`flex h-24 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface-variant`,children:t?`Loading runs...`:`No runs to compare`})}):(0,G.jsx)(`div`,{className:`rounded-md bg-surface-container-low overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full`,"aria-label":`Run comparison`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/20 bg-surface-container/50`,children:[(0,G.jsx)(K2,{}),H2.filter(e=>w.has(e)).map(e=>(0,G.jsx)(K2,{children:U2[e]},e)),(0,G.jsx)(K2,{children:``})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsx)(q2,{run:e,expanded:x.has(e.id),onToggleExpanded:C,onOpenRun:a,visibleColumns:w,colSpan:k},e.id))})]})})]})]})}function K2({children:e}){return(0,G.jsx)(`th`,{className:`px-3 py-2 text-left text-[11px] font-medium text-on-surface-variant uppercase tracking-widest font-sans whitespace-nowrap`,children:e})}var q2=(0,W.memo)(function({run:e,expanded:t,onToggleExpanded:n,onOpenRun:r,visibleColumns:i,colSpan:a}){let o=(0,W.useMemo)(()=>({turnsTotal:O2(e.usage_data),costPerWrite:C2(e.cost_usd,e.write_intents.total),byToolLabel:T2(e.write_intents.by_tool),reasoning:b2(e),phaseOverrideCount:F2(e),phaseOverrideTooltip:I2(e)}),[e]),s=(0,W.useMemo)(()=>t?N2(e):[],[t,e]),c=(0,W.useCallback)(()=>n(e.id),[n,e.id]),l=(0,W.useCallback)(()=>r(e.id),[r,e.id]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/10 last:border-0 hover:bg-surface-container-high/40 transition-colors`,children:[(0,G.jsx)(Y2,{children:(0,G.jsx)(`button`,{type:`button`,onClick:c,"aria-expanded":t,"aria-label":t?`Collapse phase breakdown`:`Expand phase breakdown`,className:`flex items-center justify-center text-on-surface-variant hover:text-on-surface transition-colors`,children:t?(0,G.jsx)($i,{className:`h-4 w-4`}):(0,G.jsx)(ta,{className:`h-4 w-4`})})}),i.has(`harness`)&&(0,G.jsx)(Y2,{children:e.harness||(0,G.jsx)(X2,{})}),i.has(`reasoning`)&&(0,G.jsx)(Y2,{children:o.reasoning===`(task default)`?(0,G.jsx)(X2,{}):o.reasoning}),i.has(`model`)&&(0,G.jsx)(Y2,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{children:e.model||(0,G.jsx)(X2,{})}),o.phaseOverrideCount>0&&(0,G.jsxs)(X,{variant:`secondary`,className:`text-[10px]`,title:o.phaseOverrideTooltip||void 0,children:[`Phases: `,o.phaseOverrideCount]})]})}),i.has(`status`)&&(0,G.jsx)(Y2,{children:(0,G.jsx)(X,{variant:n0(e.status),children:rv(e.status)})}),i.has(`turns`)&&(0,G.jsx)(Y2,{children:o.turnsTotal===null?`—`:o.turnsTotal}),i.has(`tokens`)&&(0,G.jsx)(Y2,{children:t0(e.tokens_used)}),i.has(`cost`)&&(0,G.jsx)(Y2,{children:e0(e.cost_usd,`actual`)}),i.has(`duration`)&&(0,G.jsx)(Y2,{children:av(e.duration_ms)}),i.has(`writes`)&&(0,G.jsx)(Y2,{children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{children:e.write_intents.total}),o.byToolLabel&&(0,G.jsx)(`span`,{className:`font-sans text-[10px] text-on-surface-variant`,children:o.byToolLabel})]})}),i.has(`costPerWrite`)&&(0,G.jsx)(Y2,{children:o.costPerWrite===null?`—`:`$${o.costPerWrite.toFixed(4)}`}),(0,G.jsx)(Y2,{children:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`gap-1 h-7 text-on-surface-variant`,onClick:l,children:[(0,G.jsx)(va,{className:`h-3 w-3`}),`View run`]})})]}),t&&(0,G.jsx)(`tr`,{className:`bg-surface-container/30 border-b border-outline-variant/10 last:border-0`,children:(0,G.jsx)(`td`,{colSpan:a,className:`px-3 py-3`,children:(0,G.jsx)(J2,{phases:s})})})]})},(e,t)=>e.run===t.run&&e.expanded===t.expanded&&e.visibleColumns===t.visibleColumns&&e.colSpan===t.colSpan&&e.onToggleExpanded===t.onToggleExpanded&&e.onOpenRun===t.onOpenRun);function J2({phases:e}){return e.length===0?(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant italic`,children:`No phase data available.`}):(0,G.jsx)(`div`,{className:`rounded-xs bg-surface-container-low/60 overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full`,"aria-label":`Phase breakdown`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/20`,children:[(0,G.jsx)(K2,{children:`Phase`}),(0,G.jsx)(K2,{children:`Reasoning`}),(0,G.jsx)(K2,{children:`Model`}),(0,G.jsx)(K2,{children:`Turns`}),(0,G.jsx)(K2,{children:`Tokens`}),(0,G.jsx)(K2,{children:`Cost`}),(0,G.jsx)(K2,{children:`Duration`})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/10 last:border-0`,children:[(0,G.jsx)(Y2,{children:e.name}),(0,G.jsx)(Y2,{children:e.reasoning??(0,G.jsx)(X2,{})}),(0,G.jsx)(Y2,{children:e.model??(0,G.jsx)(X2,{})}),(0,G.jsx)(Y2,{children:e.turnsUsed===null?`—`:e.turnsUsed}),(0,G.jsx)(Y2,{children:t0(e.tokensUsed)}),(0,G.jsx)(Y2,{children:e0(e.costUsd,`actual`)}),(0,G.jsx)(Y2,{children:av(e.durationMs)})]},e.name))})]})})}function Y2({children:e}){return(0,G.jsx)(`td`,{className:`px-3 py-2 font-mono text-xs text-on-surface whitespace-nowrap`,children:e})}function X2(){return(0,G.jsx)(`span`,{className:`font-sans text-[11px] italic text-on-surface-variant`,children:y2})}function Z2(e,t){let n=new Set;for(let t of e)t.task&&n.add(t.task);if(n.size===0)return{kind:`none`};if(n.size===1){let[e]=n;return{kind:`single`,label:t.get(e)??e}}let r=[...n].map(e=>t.get(e)??e).sort();return{kind:`mixed`,count:n.size,tooltip:r.join(`, `)}}function Q2(e){let t=Object.entries(e).filter(e=>!!e[1]);return t.length===0?``:t.map(([e,t])=>`${e}=${e4(t)}`).join(`, `)}function $2(e){return Object.entries(e).filter(e=>!!e[1]).map(([e,t])=>`${e}=${t}`).join(`, `)}function e4(e){return e.length<=W2?e:`${e.slice(0,W2-1)}…`}function t4({label:e,cell:t,value:n}){return(0,G.jsxs)(Q,{level:`low`,className:`px-3 py-2 flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`font-sans font-medium text-on-surface-variant uppercase tracking-wide text-[10px]`,children:e}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:t}),(0,G.jsxs)(`span`,{className:`font-mono text-on-surface-variant`,children:[`— `,n]})]})}var n4=`tab`,r4=`task`,i4=`runs`,a4=new Set([`runs`,`tasks`,`config`,`comparisons`]),o4={evaluations:`comparisons`};function s4(e){if(!e)return;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0}function c4(e){let t=e.get(n4),n=`runs`;return t&&(a4.has(t)?n=t:o4[t]&&(n=o4[t])),{tab:n,taskId:e.get(r4)??void 0,compareRunIds:s4(e.get(i4))}}function l4({tab:e,taskId:t,compareRunIds:n}){let r=new URLSearchParams;return e!==`runs`&&r.set(n4,e),t&&r.set(r4,t),n&&n.length>0&&r.set(i4,n.join(`,`)),r}var u4=[{id:`runs`,label:`Runs`,description:`execution log`},{id:`tasks`,label:`Tasks`,description:`task library`},{id:`comparisons`,label:`Comparisons`,description:`side-by-side`},{id:`config`,label:`Config`,description:`agent settings`}],d4={key:`status`,label:`Status`,options:[{value:`all`,label:`All statuses`},{value:`running`,label:`Running`},{value:`completed`,label:`Completed`},{value:`failed`,label:`Failed`},{value:`cancelled`,label:`Cancelled`}]};function f4({runIds:e,onBack:t,onOpenRun:n}){let{runs:r,isLoading:i,isError:a,errors:o}=ZA(e);return(0,G.jsx)(G2,{runs:r,isLoading:i,isError:a,errorMessage:o[0]?.message,onBack:t,onOpenRun:n,title:`Comparison`,subtitle:`${e.length} ${e.length===1?`run`:`runs`}`,backLabel:`Comparisons`})}function p4(){let{id:e}=Ln(),t=Nn(),n=An(),[r]=di(),i=(0,W.useMemo)(()=>c4(r),[r]),a=e?`runs`:i.tab,{taskId:o,compareRunIds:s}=i,[c,l]=(0,W.useState)(!1),u=(0,W.useRef)(null),{searchInput:d,debouncedSearch:f,filterValues:p,offset:m,setOffset:h,handleSearchChange:g,handleFilterChange:_,activeFilter:v}=GN({initialFilters:{status:`all`,task:`all`}}),y=(0,W.useMemo)(()=>{if(e){let t=`/${e}`;if(n.pathname.endsWith(t))return n.pathname.slice(0,-t.length)}return n.pathname},[n.pathname,e]);(0,W.useEffect)(()=>{let r=new URLSearchParams(n.search),i=r.get(`run`),a=r.get(n4),o=a?o4[a]:void 0,s=n.pathname,c=!1;if(i&&!e&&(r.delete(`run`),s=`${y}/${i}`,c=!0),o&&(o===`runs`?r.delete(n4):r.set(n4,o),c=!0),c){let e=r.toString();t(`${s}${e?`?${e}`:``}`,{replace:!0})}},[]);let b=(0,W.useCallback)((e,n,r)=>{let i=l4({tab:e,taskId:n,compareRunIds:r}).toString();t(i?`${y}?${i}`:y)},[y,t]),x=(0,W.useCallback)((e,n)=>{t(`${y}/${e}`,n)},[y,t]),S=(0,W.useCallback)(e=>{b(e)},[b]),C;a===`runs`&&(C=(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,className:`gap-2`,onClick:()=>l(!0),children:[(0,G.jsx)(Ja,{className:`h-3.5 w-3.5`}),`Run Now`]}));let{data:w}=RA(),T=(0,W.useMemo)(()=>[d4,{key:`task`,label:`Task`,options:[{value:`all`,label:`All tasks`},...(w?.tasks??[]).map(e=>({value:e.name,label:e.displayName}))]}],[w]),E=v(`status`),D=v(`task`);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsxs)(`div`,{className:`shrink-0 p-6 pb-0 space-y-6`,children:[(0,G.jsx)(YN,{title:`Agent`,subtitle:`Intelligence runs, task configuration, and operational settings`,actions:C}),(0,G.jsx)(PP,{tabs:u4.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:a,onTabChange:S,columns:4}),a===`runs`&&(0,G.jsx)(oM,{searchPlaceholder:`Search runs...`,searchValue:d,onSearchChange:g,filters:T,filterValues:p,onFilterChange:_,inputRef:u})]}),a===`runs`&&(0,G.jsx)(`div`,{className:`flex-1 min-h-0 mt-4`,children:(0,G.jsx)(iM,{hasSelection:!!e,onCloseMobileDetail:()=>t(y),masterAriaLabel:`Agent runs`,detailAriaLabel:`Run details`,master:(0,G.jsx)(f0,{selectedId:e,search:f,statusFilter:E,taskFilter:D,offset:m,onOffsetChange:h,filterInputRef:u,onSelectRun:x,onTriggerRun:()=>l(!0),onCompareRuns:e=>b(`comparisons`,void 0,e)}),detail:e?(0,G.jsx)(H0,{runId:e,onBack:()=>t(y)}):(0,G.jsx)(aM,{message:`Select a run to see its details.`})})}),a===`tasks`&&(0,G.jsx)(`div`,{className:`p-6 pt-4 space-y-4`,children:o?(0,G.jsx)(d2,{taskId:o,onBack:()=>b(`tasks`),onNavigate:e=>b(`tasks`,e),onRunTriggered:e=>{e&&x(e)}}):(0,G.jsx)(K0,{onSelect:e=>b(`tasks`,e)})}),a===`comparisons`&&(0,G.jsx)(`div`,{className:`p-6 pt-4 space-y-4`,children:s&&s.length>0?(0,G.jsx)(f4,{runIds:s,onBack:()=>b(`comparisons`),onOpenRun:e=>x(e)}):(0,G.jsxs)(Q,{level:`low`,className:`p-8 text-center space-y-2`,children:[(0,G.jsx)(`h2`,{className:`font-serif text-lg text-on-surface`,children:`Compare selected runs`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Select two or more runs in the Runs tab and use "Compare selected" to see them side by side here.`}),(0,G.jsx)(Y,{variant:`outline`,size:`sm`,className:`mt-2`,onClick:()=>b(`runs`),children:`Go to Runs`})]})}),a===`config`&&(0,G.jsx)(`div`,{className:`p-6 pt-4 space-y-4`,children:(0,G.jsx)(h2,{})}),(0,G.jsx)($1,{open:c,onOpenChange:l,onTriggered:e=>{e&&x(e)}})]})}var m4={IDENTIFIED:`identified`,APPROVED:`approved`,GENERATED:`generated`,DISMISSED:`dismissed`,DEFERRED:`deferred`},h4=`${m4.APPROVED},${m4.GENERATED}`,g4=[{key:`status`,label:`Status`,options:[{value:`all`,label:`All statuses`},{value:m4.IDENTIFIED,label:`Identified`},{value:h4,label:`Approved & generated`},{value:m4.APPROVED,label:`Awaiting generation`},{value:m4.GENERATED,label:`Generated`},{value:m4.DEFERRED,label:`Deferred`},{value:m4.DISMISSED,label:`Dismissed`}]}];function _4(e){let t=`${(e*100).toFixed(0)}%`;return e>=.85?{text:t,variant:`default`}:e>=.7?{text:t,variant:`secondary`}:{text:t,variant:`outline`}}function v4(e){let t=Math.floor(Date.now()/1e3)-e;return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function y4(e){switch(e){case m4.IDENTIFIED:return(0,G.jsx)(X,{variant:`outline`,children:`Identified`});case m4.APPROVED:return(0,G.jsx)(X,{variant:`secondary`,children:`Awaiting generation`});case m4.GENERATED:return(0,G.jsx)(X,{variant:`default`,children:`Generated`});case m4.DEFERRED:return(0,G.jsx)(X,{variant:`outline`,children:`Deferred`});case m4.DISMISSED:return(0,G.jsx)(X,{variant:`outline`,className:`opacity-50`,children:`Dismissed`});default:return(0,G.jsx)(X,{variant:`outline`,children:e})}}function b4(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function x4(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||typeof t.type!=`string`?null:`${t.type}:${t.id}`}function S4({label:e,values:t}){return t.length===0?null:(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`dt`,{className:`text-on-surface-variant`,children:e}),(0,G.jsx)(`dd`,{className:`mt-1 flex flex-wrap gap-1.5`,children:t.map(e=>(0,G.jsx)(`code`,{className:`max-w-full truncate rounded border border-outline-variant/40 bg-surface-container px-1.5 py-0.5 font-mono text-[11px] text-on-surface`,title:e,children:e},e))})]})}function C4({candidate:e}){let t=b4(e.source_ids).map(x4).filter(e=>!!e),n=b4(e.quality_failures).filter(e=>typeof e==`string`),r=b4(e.coverage_matches).filter(e=>typeof e==`string`),i=typeof e.quality_score==`number`&&Number.isFinite(e.quality_score)?e.quality_score:null;return e.evidence_bundle_id||i!==null||n.length>0||r.length>0||t.length>0||e.reconciliation_reason?(0,G.jsxs)(`details`,{className:`group font-sans text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`summary`,{className:`flex cursor-pointer list-none flex-wrap items-center gap-2 [&::-webkit-details-marker]:hidden`,children:[i!==null&&(0,G.jsxs)(X,{variant:i>=.7?`secondary`:`outline`,children:[`Quality `,(i*100).toFixed(0),`%`]}),e.evidence_bundle_id&&(0,G.jsxs)(X,{variant:`outline`,className:`max-w-[240px] truncate`,title:e.evidence_bundle_id,children:[`Bundle `,e.evidence_bundle_id]}),t.length>0&&(0,G.jsxs)(X,{variant:`outline`,title:t.join(`, `),children:[t.length,` source`,t.length===1?``:`s`]}),r.length>0&&(0,G.jsxs)(X,{variant:`outline`,title:r.join(`, `),children:[r.length,` overlap`,r.length===1?``:`s`]}),n.slice(0,3).map(e=>(0,G.jsx)(X,{variant:`outline`,className:`opacity-70`,children:e},e)),n.length>3&&(0,G.jsxs)(X,{variant:`outline`,className:`opacity-70`,children:[`+`,n.length-3,` more`]}),(0,G.jsx)(`span`,{className:`text-on-surface-variant underline-offset-2 group-open:underline`,children:`Evidence details`})]}),(0,G.jsxs)(`dl`,{className:`mt-3 grid gap-3 border-l border-outline-variant/40 pl-3 sm:grid-cols-2`,children:[e.evidence_bundle_id&&(0,G.jsx)(S4,{label:`Bundle`,values:[e.evidence_bundle_id]}),(0,G.jsx)(S4,{label:`Sources`,values:t}),(0,G.jsx)(S4,{label:`Coverage matches`,values:r}),(0,G.jsx)(S4,{label:`Quality failures`,values:n}),e.reconciliation_reason&&(0,G.jsxs)(`div`,{className:`min-w-0 sm:col-span-2`,children:[(0,G.jsx)(`dt`,{className:`text-on-surface-variant`,children:`Latest reconciliation`}),(0,G.jsx)(`dd`,{className:`mt-1 leading-relaxed text-on-surface`,children:e.reconciliation_reason})]})]})]}):null}function w4({candidate:e,onApprove:t,onDefer:n,onDismiss:r,isApproving:i,isDeferring:a,isDismissing:o}){let s=_4(e.confidence),c=e.status===m4.IDENTIFIED||e.status===m4.APPROVED;return(0,G.jsxs)(Q,{level:`low`,className:`p-5 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`h3`,{className:`font-serif text-lg text-on-surface leading-tight`,children:e.topic}),e.approved_at!==null&&(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant mt-1`,children:[`Approved `,v4(e.approved_at),e.status===m4.GENERATED&&` · generated`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[y4(e.status),(0,G.jsx)(X,{variant:s.variant,children:s.text}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:v4(e.created_at)})]})]}),(0,G.jsx)(fO,{content:e.rationale,className:`text-sm text-on-surface-variant`}),(0,G.jsx)(C4,{candidate:e}),c&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[e.status===m4.IDENTIFIED&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{size:`sm`,variant:`default`,onClick:t,disabled:i,children:[(0,G.jsx)(Qi,{className:`h-3.5 w-3.5 mr-1.5`}),i?`Approving...`:`Approve`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,onClick:n,disabled:a,className:`text-on-surface-variant`,children:[(0,G.jsx)(ua,{className:`h-3.5 w-3.5 mr-1.5`}),a?`Deferring...`:`Defer`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,onClick:r,disabled:o,className:`text-on-surface-variant`,children:[(0,G.jsx)(ca,{className:`h-3.5 w-3.5 mr-1.5`}),o?`Dismissing...`:`Dismiss`]})]}),e.status===m4.APPROVED&&(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:`Awaiting generation`})]})]})}function T4(){return(0,G.jsxs)(Q,{level:`low`,className:`p-5 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,G.jsx)(`div`,{className:`h-5 w-64 rounded bg-surface-container-high animate-pulse`}),(0,G.jsx)(`div`,{className:`h-5 w-20 rounded bg-surface-container-high animate-pulse`})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`h-3 w-full rounded bg-surface-container-high animate-pulse`}),(0,G.jsx)(`div`,{className:`h-3 w-3/4 rounded bg-surface-container-high animate-pulse`})]}),(0,G.jsx)(`div`,{className:`h-8 w-32 rounded bg-surface-container-high animate-pulse`})]})}function E4(){let e=$A(),{searchInput:t,debouncedSearch:n,filterValues:r,offset:i,setOffset:a,handleSearchChange:o,handleFilterChange:s,activeFilter:c}=GN({initialFilters:{status:m4.IDENTIFIED}}),l=c(`status`),{data:u,isLoading:d,isError:f,error:p}=QA({status:l,limit:50,offset:i}),m=u?.candidates??[],h=u?.total??0,g=(0,W.useMemo)(()=>{if(!n)return m;let e=n.toLowerCase();return m.filter(t=>t.topic.toLowerCase().includes(e)||t.rationale.toLowerCase().includes(e))},[m,n]);function _(t){e.mutate({id:t.id,status:m4.APPROVED})}function v(t){e.mutate({id:t.id,status:m4.DEFERRED})}function y(t){e.mutate({id:t.id,status:m4.DISMISSED})}let b=(0,G.jsx)(oM,{searchPlaceholder:`Search candidates by title or rationale...`,searchValue:t,onSearchChange:o,filters:g4,filterValues:r,onFilterChange:s});if(f)return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[b,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load candidates`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:p instanceof Error?p.message:`Unknown error`})]})]});if(d)return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[b,Array.from({length:3}).map((e,t)=>(0,G.jsx)(T4,{},t))]});let x=e.isError?e.variables:void 0,S=x?m.find(e=>e.id===x.id)?.topic:void 0;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[b,e.isError&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-terracotta/40 bg-terracotta/5 px-3 py-2 font-sans text-sm text-on-surface`,children:[(0,G.jsx)(ra,{className:`mt-0.5 h-4 w-4 shrink-0 text-terracotta`}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[`Couldn't update `,S?`"${S}"`:`candidate`,`.`]}),` `,(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:e.error instanceof Error?e.error.message:`Unknown error`})]})]}),g.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-3 text-on-surface-variant`,children:[(0,G.jsx)(La,{className:`h-10 w-10 opacity-20`}),h===0&&!l&&!n?(0,G.jsxs)(`div`,{className:`text-center space-y-2 max-w-md`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`No skill candidates discovered yet`}),(0,G.jsx)(`p`,{className:`font-sans text-xs leading-relaxed`,children:`Candidates are procedural patterns discovered from your vault knowledge. Review and approve them here, then Myco generates full skills from them.`}),(0,G.jsxs)(`div`,{className:`font-sans text-xs space-y-1 pt-1`,children:[(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Automatic:`}),` `,`The`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-survey`,className:`text-primary hover:underline`,children:`Skill Survey`}),` `,`task runs automatically during idle periods and discovers candidates from session history, decisions, and gotchas.`]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Manual:`}),` `,`Run`,` `,(0,G.jsxs)(ri,{to:`/agent?tab=tasks&task=skill-survey`,className:`inline-flex items-center gap-1 text-primary hover:underline`,children:[(0,G.jsx)(va,{className:`h-3 w-3`}),`Skill Survey`]}),` `,`from the Agent page to discover candidates on demand.`]})]})]}):(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No matching candidates`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:n?`${g.length} of ${h} candidate${h===1?``:`s`}`:`${h} candidate${h===1?``:`s`}`}),g.map(t=>(0,G.jsx)(w4,{candidate:t,onApprove:()=>_(t),onDefer:()=>v(t),onDismiss:()=>y(t),isApproving:e.isPending&&e.variables?.id===t.id&&e.variables?.status===m4.APPROVED,isDeferring:e.isPending&&e.variables?.id===t.id&&e.variables?.status===m4.DEFERRED,isDismissing:e.isPending&&e.variables?.id===t.id&&e.variables?.status===m4.DISMISSED},t.id))]}),(0,G.jsx)(fM,{total:n?g.length:h,offset:i,limit:50,onPageChange:a})]})}var D4=5,O4=[{key:`status`,label:`Status`,options:[{value:`all`,label:`All statuses`},{value:`active`,label:`Active`},{value:`stale`,label:`Stale`},{value:`retired`,label:`Retired`}]}];function k4(e){return e===`active`?`default`:e===`stale`?`secondary`:`outline`}function A4({children:e,className:t}){return(0,G.jsx)(`th`,{className:J(`px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,t),children:e})}function j4(){return(0,G.jsxs)(`tr`,{className:`border-b border-[var(--ghost-border)]`,children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-40 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-12 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-16 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-10 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-20 rounded bg-surface-container-high animate-pulse`})})]})}function M4({record:e,onClick:t}){return(0,G.jsxs)(`tr`,{className:`border-b border-[var(--ghost-border)] last:border-0 hover:bg-surface-container/60 cursor-pointer transition-all duration-150 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40 hover:shadow-[inset_3px_0_0_var(--primary)]`,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},tabIndex:0,role:`row`,"aria-label":`Skill: ${e.display_name}`,children:[(0,G.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface block`,children:e.display_name}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant block mt-0.5`,children:e.name})]}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsxs)(X,{variant:`outline`,className:`font-mono text-[10px] px-1.5 py-0`,children:[`gen `,e.generation]})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(X,{variant:k4(e.status),children:e.status})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:e.usage_count})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:ov(e.updated_at)})})]})}function N4({onSelectSkill:e}){let{searchInput:t,debouncedSearch:n,filterValues:r,offset:i,setOffset:a,handleSearchChange:o,handleFilterChange:s,activeFilter:c}=GN({initialFilters:{status:`all`}}),l=c(`status`),{data:u,isLoading:d,isError:f,error:p}=ej({status:l,limit:50,offset:i}),m=u?.records??[],h=u?.total??0,g=n?m.filter(e=>e.display_name.toLowerCase().includes(n.toLowerCase())||e.name.toLowerCase().includes(n.toLowerCase())||e.description.toLowerCase().includes(n.toLowerCase())):m,_=(0,G.jsx)(oM,{searchPlaceholder:`Search skills by name, slug, or description...`,searchValue:t,onSearchChange:o,filters:O4,filterValues:r,onFilterChange:s,count:h>0?`${h} ${h===1?`skill`:`skills`}`:void 0}),v=(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-[var(--ghost-border)] bg-surface-container/50`,children:[(0,G.jsx)(A4,{children:`Name`}),(0,G.jsx)(A4,{children:`Generation`}),(0,G.jsx)(A4,{children:`Status`}),(0,G.jsx)(A4,{children:`Usage`}),(0,G.jsx)(A4,{children:`Last Evolved`})]})});return f?(0,G.jsxs)(`div`,{children:[_,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary mt-4`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load skills`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:p instanceof Error?p.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{children:[_,d?(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsxs)(`table`,{className:`w-full`,children:[v,(0,G.jsx)(`tbody`,{children:Array.from({length:D4}).map((e,t)=>(0,G.jsx)(j4,{},t))})]})}):g.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-3 text-on-surface-variant mt-4`,children:[(0,G.jsx)(Yi,{className:`h-10 w-10 opacity-20`}),h===0&&!n&&!l?(0,G.jsxs)(`div`,{className:`text-center space-y-2 max-w-md`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`No skills generated yet`}),(0,G.jsx)(`p`,{className:`font-sans text-xs leading-relaxed`,children:`Skills are project-specific procedural guides generated from your vault knowledge. They teach agents how to accomplish tasks in this codebase.`}),(0,G.jsxs)(`div`,{className:`font-sans text-xs space-y-1 pt-1`,children:[(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Automatic:`}),` `,`The`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-survey`,className:`text-primary hover:underline`,children:`Skill Survey`}),` `,`task runs automatically and discovers candidates from your vault. Approve candidates in the`,` `,(0,G.jsx)(ri,{to:`/skills?tab=candidates`,className:`text-primary hover:underline`,children:`Candidates tab`}),`, then enable the`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-generate`,className:`text-primary hover:underline`,children:`Skill Generate`}),` `,`task to produce skills automatically.`]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Manual:`}),` `,`Run`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-generate`,className:`text-primary hover:underline`,children:`Skill Generate`}),` `,`from the Agent page to generate a skill on demand.`]})]})]}):(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No matching skills`})]}):(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsxs)(`table`,{className:`w-full`,"aria-label":`Skills`,children:[v,(0,G.jsx)(`tbody`,{children:g.map(t=>(0,G.jsx)(M4,{record:t,onClick:()=>e(t.name)},t.id))})]})}),(0,G.jsx)(fM,{total:h,offset:i,limit:50,onPageChange:a})]})}var P4={created:`default`,updated:`secondary`,split:`warning`,retired:`outline`};function F4({entry:e}){let[t,n]=(0,W.useState)(!1);return(0,G.jsxs)(`div`,{className:`relative pl-6`,children:[(0,G.jsx)(`div`,{className:`absolute left-0 top-2 h-2.5 w-2.5 rounded-full border-2 border-outline-variant bg-surface-container`}),(0,G.jsxs)(`button`,{type:`button`,className:`w-full text-left group cursor-pointer`,onClick:()=>n(e=>!e),"aria-expanded":t,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(X,{variant:`outline`,className:`font-mono text-[10px] px-1.5 py-0`,children:[`v`,e.generation]}),(0,G.jsx)(X,{variant:P4[e.action]??`outline`,children:e.action}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant ml-auto shrink-0`,children:ov(e.created_at)}),(0,G.jsx)(ta,{className:J(`h-3.5 w-3.5 text-on-surface-variant transition-transform duration-150`,t&&`rotate-90`)})]}),e.rationale&&(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant mt-1 leading-relaxed`,children:e.rationale})]}),t&&e.content_snapshot&&(0,G.jsx)(Q,{level:`lowest`,className:`mt-2 p-3 overflow-auto max-h-96`,children:(0,G.jsx)(`pre`,{className:`font-mono text-xs text-on-surface whitespace-pre-wrap break-words`,children:e.content_snapshot})})]})}function I4({entries:e}){return e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant py-4`,children:`No evolution history.`}):(0,G.jsxs)(`div`,{className:`relative space-y-4`,children:[(0,G.jsx)(`div`,{className:`absolute left-[4.5px] top-2 bottom-2 w-px bg-outline-variant/30`}),e.map(e=>(0,G.jsx)(F4,{entry:e},e.id))]})}function L4(e){return e===`active`?`default`:e===`stale`?`secondary`:`outline`}function R4(e){if(!e)return 0;try{let t=JSON.parse(e);return Array.isArray(t)?t.length:0}catch{return 0}}function z4(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(`div`,{className:`h-8 w-24 animate-pulse rounded bg-surface-container-high`}),(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-low p-4 space-y-3`,children:[(0,G.jsx)(`div`,{className:`h-6 w-48 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-64 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-5 w-32 animate-pulse rounded bg-surface-container-high`})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:Array.from({length:3}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-container-high`},t))})]})}function B4({skillName:e,onBack:t}){let{data:n,isPending:r,isError:i}=tj(e),a=nj(),[o,s]=(0,W.useState)(!1);if(r)return(0,G.jsx)(z4,{});if(i||!n)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Skills`]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Skill not found`})]})]});let c=R4(n.source_ids),l=n.lineage?.[0]?.content_snapshot??null,u=n.frontmatter??{},d=l?.replace(/^---\n[\s\S]*?\n---\n*/,``)??null;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Skills`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`gap-2 text-tertiary hover:text-tertiary hover:bg-tertiary/10`,onClick:()=>s(!0),children:[(0,G.jsx)(ho,{className:`h-4 w-4`}),`Delete`]})]}),(0,G.jsx)(Q,{level:`low`,accent:`sage`,className:`p-5 space-y-3`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 space-y-1 min-w-0`,children:[(0,G.jsxs)(wj,{tone:`sage`,children:[`Skill · `,n.name]}),(0,G.jsx)(`h1`,{className:`myco-display-md text-on-surface m-0`,children:n.display_name}),n.description&&(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:n.description}),n.path&&(0,G.jsx)(`p`,{className:`font-mono text-[10px] text-on-surface-variant mt-1`,children:n.path}),Object.keys(u).length>0&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 mt-2`,children:[u[`user-invocable`]===`true`&&(0,G.jsx)(X,{variant:`secondary`,children:`user-invocable`}),u[`allowed-tools`]&&(0,G.jsxs)(X,{variant:`outline`,children:[`tools: `,u[`allowed-tools`]]})]})]}),(0,G.jsx)(X,{variant:L4(n.status),className:`shrink-0`,children:n.status})]})}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,G.jsx)(Nj,{label:`Generation`,value:`v${n.generation}`,tone:`sage`,mono:!0}),(0,G.jsx)(Nj,{label:`Usage`,value:`${n.usage_total??n.usage_count??0}`,sub:`sessions`,tone:`ochre`}),(0,G.jsx)(Nj,{label:`Sources`,value:`${c}`})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(MM,{children:`Evolution History`}),(0,G.jsx)(I4,{entries:n.lineage??[]})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(MM,{children:`Current Content`}),d?(0,G.jsx)(fO,{content:d}):(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant py-4`,children:`No content snapshot available.`})]}),(0,G.jsx)(dM,{open:o,onOpenChange:s,title:`Delete Skill`,description:`This will permanently delete the skill record, evolution history, and the SKILL.md file from disk.`,icon:(0,G.jsx)(ho,{className:`h-4 w-4 text-tertiary`}),meta:n?[{label:`Name`,value:n.name},{label:`Title`,value:n.display_name}]:[],confirmLabel:`Delete Skill`,variant:`destructive`,onConfirm:()=>{a.mutate(n.name,{onSuccess:()=>{s(!1),t()}})},isPending:a.isPending})]})}var V4=`tab`,H4=`skill`,U4=new Set([`candidates`,`skills`]);function W4(e){let t=new URLSearchParams(e),n=t.get(V4);return{tab:n&&U4.has(n)?n:`skills`,skill:t.get(H4)??void 0}}function G4(e,t){let n=new URLSearchParams;e!==`skills`&&n.set(V4,e),t&&n.set(H4,t);let r=n.toString(),i=r?`${window.location.pathname}?${r}`:window.location.pathname;window.history.replaceState(null,``,i)}var K4=[{id:`skills`,label:`Skills`,description:`promoted records`},{id:`candidates`,label:`Candidates`,description:`approval queue`}];function q4(){return(0,G.jsxs)(Lf,{children:[(0,G.jsx)(Rf,{asChild:!0,children:(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:`text-on-surface-variant`,children:(0,G.jsx)(sa,{className:`h-4 w-4`})})}),(0,G.jsxs)(Vf,{className:`max-w-lg`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`How Skills Work`}),(0,G.jsx)(Gf,{children:`Skills are project-specific procedural guides generated from your vault knowledge. They teach agents how to accomplish tasks in your codebase.`})]}),(0,G.jsxs)(`div`,{className:`space-y-4 font-sans text-sm text-on-surface-variant`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`h4`,{className:`font-medium text-on-surface`,children:`The Pipeline`}),(0,G.jsxs)(`ol`,{className:`list-decimal pl-5 space-y-1`,children:[(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Survey`}),` — discovers candidate skills from vault knowledge (sessions, decisions, gotchas)`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Approve`}),` — you review candidates and approve the ones worth generating`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Generate`}),` — produces a SKILL.md file from the approved candidate's source material`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Evolve`}),` — updates existing skills when new knowledge makes them stale`]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`h4`,{className:`font-medium text-on-surface`,children:`Scheduling`}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Skill Survey`}),` runs automatically during idle periods. Skill Generate and Skill Evolve are off by default — enable them in the`,` `,(0,G.jsxs)(ri,{to:`/agent?tab=tasks`,className:`text-primary hover:underline inline-flex items-center gap-0.5`,children:[`Agent Tasks`,(0,G.jsx)(va,{className:`h-3 w-3`})]}),` `,`page for fully automatic operation, or trigger them manually with Run Now.`]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`h4`,{className:`font-medium text-on-surface`,children:`Quick Start`}),(0,G.jsxs)(`ol`,{className:`list-decimal pl-5 space-y-1`,children:[(0,G.jsx)(`li`,{children:`Wait for the survey to discover candidates (or run it manually)`}),(0,G.jsx)(`li`,{children:`Review candidates in the Candidates tab and approve the best ones`}),(0,G.jsxs)(`li`,{children:[`Run`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-generate`,className:`text-primary hover:underline`,children:`Skill Generate`}),` `,`to produce skills from approved candidates`]})]})]})]})]})]})}function J4(){let e=An(),t=W4(e.search),[n,r]=(0,W.useState)(t.tab),[i,a]=(0,W.useState)(t.skill),{data:o}=QA({status:`identified`}),{data:s}=ej({status:`active`}),c=o?.total??0,l=s?.total??0;(0,W.useEffect)(()=>{G4(n,i)},[n,i]),(0,W.useEffect)(()=>{let t=W4(e.search);r(t.tab),a(t.skill)},[e.search,e.key]);let u=(0,W.useCallback)(e=>{let t=e;r(t),t!==`skills`&&a(void 0)},[]),d=(0,W.useCallback)(e=>{r(`skills`),a(e)},[]);return(0,G.jsxs)(bj,{children:[(0,G.jsx)(YN,{title:`Skills`,subtitle:`Discovered skill candidates and promoted skill records`,actions:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c>0&&(0,G.jsxs)(X,{variant:`secondary`,children:[c,` pending`]}),l>0&&(0,G.jsxs)(X,{variant:`default`,children:[l,` active`]}),(0,G.jsx)(q4,{})]})}),(0,G.jsx)(PP,{tabs:K4.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:n,onTabChange:u,columns:2}),n===`candidates`&&(0,G.jsx)(E4,{}),n===`skills`&&!i&&(0,G.jsx)(N4,{onSelectSkill:d}),n===`skills`&&i&&(0,G.jsx)(B4,{skillName:i,onBack:()=>a(void 0)})]})}function Y4({id:e,value:t,onChange:n,disabled:r,readonly:i}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,id:e,children:[(0,G.jsx)(XN,{checked:t,onCheckedChange:e=>n(e),disabled:r||i}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:t?`On`:`Off`})]})}function X4({id:e,value:t,onChange:n,disabled:r,readonly:i,options:a,optionLabels:o,placeholder:s}){return i?(0,G.jsx)(`div`,{id:e,className:`flex h-9 items-center rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 font-mono text-sm text-on-surface`,children:o?.[t]??t}):(0,G.jsxs)(c_,{value:t,onValueChange:n,disabled:r,children:[(0,G.jsx)(u_,{id:e,children:(0,G.jsx)(l_,{placeholder:s})}),(0,G.jsx)(d_,{children:a.map(e=>(0,G.jsx)(f_,{value:e,children:o?.[e]??e},e))})]})}function Z4(e,t,n){let r=e;return typeof t==`number`&&(r=Math.max(t,r)),typeof n==`number`&&(r=Math.min(n,r)),r}function Q4({id:e,value:t,onChange:n,disabled:r,readonly:i,min:a,max:o,step:s,suffix:c,placeholder:l}){let[u,d]=(0,W.useState)(String(t));(0,W.useEffect)(()=>{d(String(t))},[t]);function f(){let e=Number(u);if(Number.isNaN(e)){d(String(t));return}let r=Z4(e,a,o);r!==t&&n(r),d(String(r))}function p(e){e.key===`Enter`?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),d(String(t)))}return i?(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{id:e,className:`flex h-9 w-32 items-center rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 font-mono text-sm text-on-surface`,children:t}),c&&(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:c})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Kf,{id:e,type:`number`,value:u,min:a,max:o,step:s??1,disabled:r,placeholder:l,onChange:e=>d(e.target.value),onBlur:f,onKeyDown:p,className:`w-32 font-mono`}),c&&(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:c})]})}function $4({id:e,value:t,onChange:n,disabled:r,readonly:i,placeholder:a,trim:o=!0}){let[s,c]=(0,W.useState)(t);(0,W.useEffect)(()=>{c(t)},[t]);function l(){let e=o?s.trim():s;e!==t&&n(e),c(e)}function u(e){e.key===`Enter`?(e.preventDefault(),l()):e.key===`Escape`&&(e.preventDefault(),c(t))}return i?(0,G.jsx)(`div`,{id:e,className:`flex h-9 w-full items-center rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 font-mono text-sm text-on-surface`,children:t}):(0,G.jsx)(Kf,{id:e,type:`text`,value:s,placeholder:a,disabled:r,onChange:e=>c(e.target.value),onBlur:l,onKeyDown:u,className:`font-mono`})}function e3(e){return e.split(/\r?\n|,/).map(e=>e.trim()).filter(e=>e.length>0)}function t3({id:e,value:t,onChange:n,disabled:r,readonly:i,placeholder:a,allowDuplicates:o=!1,onAdd:s,onRemove:c}){let[l,u]=(0,W.useState)(``);function d(e){if(e.length===0)return;if(s){let n=new Set(o?[]:t);for(let t of e)!o&&n.has(t)||(n.add(t),s(t));return}let r=new Set(o?[]:t),i=t.slice();for(let t of e)!o&&r.has(t)||(r.add(t),i.push(t));i.length!==t.length&&n(i)}function f(){d(e3(l)),u(``)}function p(e){if(c){c(t[e]);return}let r=t.slice();r.splice(e,1),n(r)}function m(e){e.key===`Enter`&&(e.preventDefault(),f())}function h(e){let t=e.clipboardData.getData(`text`);t&&/[\r\n,]/.test(t)&&(e.preventDefault(),d(e3(l+t)),u(``))}return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[t.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map((e,t)=>(0,G.jsxs)(X,{variant:`secondary`,className:`gap-1 pr-1`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e}),!i&&(0,G.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e}`,disabled:r,onClick:()=>p(t),className:`rounded-xs p-0.5 text-on-surface-variant hover:bg-surface-container-highest hover:text-on-surface disabled:opacity-50`,children:(0,G.jsx)(So,{className:`h-3 w-3`})})]},`${e}-${t}`))}),!i&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Kf,{id:e,type:`text`,value:l,placeholder:a,disabled:r,onChange:e=>u(e.target.value),onKeyDown:m,onPaste:h,onBlur:()=>{l.trim().length>0&&f()},className:`font-mono`}),(0,G.jsx)(Y,{type:`button`,variant:`outline`,size:`sm`,disabled:r||l.trim().length===0,onClick:f,children:`Add`})]})]})}function n3({id:e,value:t,onChange:n,disabled:r,readonly:i,configured:a,source:o,placeholder:s}){let[c,l]=(0,W.useState)(t),[u,d]=(0,W.useState)(!1);(0,W.useEffect)(()=>{l(t)},[t]);function f(){c!==t&&n(c)}function p(e){e.key===`Enter`?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),l(t))}let m=o?`stored in ${o}`:`stored in keychain`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Kf,{id:e,type:u?`text`:`password`,value:c,placeholder:s,disabled:r||i,readOnly:i,autoComplete:`off`,onChange:e=>l(e.target.value),onBlur:f,onKeyDown:p,className:`font-mono`}),(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":u?`Hide secret`:`Reveal secret`,"aria-pressed":u,disabled:r,onClick:()=>d(e=>!e),children:u?(0,G.jsx)(ya,{className:`h-4 w-4`}):(0,G.jsx)(ba,{className:`h-4 w-4`})})]}),a&&(0,G.jsx)(`div`,{children:(0,G.jsx)(X,{variant:`default`,className:`bg-primary/15 text-primary`,children:m})})]})}function r3(){let[e,t]=(0,W.useState)({}),[n,r]=(0,W.useState)(``),[i,a]=(0,W.useState)(!0),o=jO(),s=MO();(0,W.useEffect)(()=>{q(`/config/plan-dirs`).then(e=>t(e.symbiont)).catch(()=>{}).finally(()=>a(!1))},[]);let c=Object.entries(e);return(0,G.jsxs)(Q,{id:Pi.settingsPlanCapture,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-amber-500 transition-all duration-300`,children:[(0,G.jsx)(MM,{children:`Plan Capture`}),i?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading...`}):(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Agent Directories`}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Directories monitored by connected agents. Managed by symbiont manifests.`}),c.length===0?(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant italic`,children:`No agent directories configured.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:c.map(([e,t])=>(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide`,children:e}),(0,G.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,G.jsx)(`div`,{className:`rounded bg-surface-container px-3 py-1.5 font-mono text-xs text-on-surface-variant`,children:e},e))})]},e))})]}),(0,G.jsx)(iP,{path:`capture.ignore_plan_dirs_in_git`,label:`Ignore Custom Plan Dirs In Git`,hint:`.gitignore is rewritten on every change`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!1,onCheckedChange:t})}),(0,G.jsx)(iP,{path:`capture.plan_dirs`,label:`Custom Directories`,hint:`extra paths to watch for plan files`,children:({value:e})=>{let t=e??[];return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[t.length>0&&(0,G.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded bg-surface-container px-3 py-1.5`,children:[(0,G.jsx)(`span`,{className:`flex-1 font-mono text-xs text-on-surface`,children:e}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>s.mutate({path:`capture.plan_dirs`,value:e}),className:`font-sans text-xs text-on-surface-variant hover:text-tertiary transition-colors leading-none`,"aria-label":`Remove ${e}`,children:`x`})]},e))}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(Kf,{placeholder:`/path/to/plans`,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{if(e.key!==`Enter`)return;let i=n.trim();!i||t.includes(i)||(o.mutate({path:`capture.plan_dirs`,value:i}),r(``))},className:`flex-1 font-mono text-xs`}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:()=>{let e=n.trim();!e||t.includes(e)||(o.mutate({path:`capture.plan_dirs`,value:e}),r(``))},disabled:!n.trim(),children:`Add`})]})]})}})]})]})}var i3={banner:`Banner`,summary:`Summary`};function a3({children:e}){return(0,G.jsx)(`div`,{className:`rounded-lg border border-outline-variant/20 bg-surface-container/40 p-4`,children:e})}function o3(){let{effective:e,setField:t,resetField:n,isLocalOverride:r}=LO(),{data:i}=hv(),a=i?.domains??[],o=e?.notifications?.enabled??!0,s=e?.notifications?.default_mode??`summary`,c=!o,l=(0,W.useCallback)(async(e,r)=>{let i=`notifications.domains.${e}.mode`;r==="default"?await n(i):await t(i,r,`local`)},[n,t]),u=(0,W.useCallback)(async(e,n)=>{await t(`notifications.domains.${e}.enabled`,n,`local`)},[t]);return e?(0,G.jsxs)(Q,{id:Pi.settingsNotifications,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-sage transition-all duration-300`,children:[(0,G.jsx)(MM,{children:`Notifications`}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(a3,{children:(0,G.jsx)(iP,{path:`notifications.enabled`,label:`Notifications`,hint:`master switch for this machine`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})})}),(0,G.jsxs)(`div`,{className:c?`space-y-4 opacity-60`:`space-y-4`,children:[(0,G.jsx)(a3,{children:(0,G.jsx)(iP,{path:`notifications.default_mode`,label:`Default Display`,hint:`summary = panel only; banner = temporary popup`,children:({value:e,onChange:t})=>(0,G.jsxs)(c_,{value:e??`summary`,onValueChange:e=>t(e),disabled:c,children:[(0,G.jsx)(u_,{className:`w-40`,children:(0,G.jsx)(l_,{})}),(0,G.jsxs)(d_,{children:[(0,G.jsx)(f_,{value:`summary`,children:`Summary`}),(0,G.jsx)(f_,{value:`banner`,children:`Banner`})]})]})})}),(0,G.jsx)(a3,{children:(0,G.jsx)(iP,{path:`notifications.system_notifications`,label:`Browser Notifications`,hint:`OS popups when tab unfocused; only for banner mode`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!1,onCheckedChange:t,disabled:c})})}),a.length>0&&(0,G.jsx)(a3,{children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Per-Domain Overrides`}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:"Leave on `Default` unless a domain should behave differently from the project-wide setting."})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:a.map(i=>{let a=e.notifications?.domains?.[i.domain]??{enabled:!0},o=a.enabled,d=a.mode??s,f=a.mode??`default`,p=`notifications.domains.${i.domain}`,m=r(p);return(0,G.jsx)(`div`,{className:`rounded-md border border-outline-variant/20 bg-surface-container-low/40 px-3 py-3`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-on-surface`,children:i.label}),(0,G.jsx)(`span`,{className:`rounded-full bg-surface-container-high px-2 py-0.5 text-[11px] text-on-surface-variant`,children:o?i3[d]:`Off`}),(0,G.jsx)(pk,{path:p,hasLocalOverride:m,onSavePersonal:()=>t(p,a,`local`),onReset:()=>n(p)})]}),(0,G.jsx)(`p`,{className:`text-[11px] text-on-surface-variant`,children:i.types.map(e=>e.label).join(`, `)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 self-start`,children:[(0,G.jsxs)(c_,{value:f,onValueChange:e=>{l(i.domain,e)},disabled:c||!o,children:[(0,G.jsx)(u_,{className:`h-8 w-[120px] text-xs`,children:(0,G.jsx)(l_,{})}),(0,G.jsxs)(d_,{children:[(0,G.jsx)(f_,{value:`default`,children:`Default`}),(0,G.jsx)(f_,{value:`summary`,children:`Summary`}),(0,G.jsx)(f_,{value:`banner`,children:`Banner`})]})]}),(0,G.jsx)(XN,{checked:o,onCheckedChange:e=>{u(i.domain,e)},disabled:c})]})]})},i.domain)})})]})}),c&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Notifications are currently disabled, so display and domain settings are inactive.`})]})]})]}):null}var s3=[`provider-secrets`],c3=[`providers`],l3=[`models`];function u3(){return ot({queryKey:xs([...s3]),queryFn:({signal:e})=>q(`/providers/secrets`,{signal:e})})}function d3(e){e.invalidateQueries({queryKey:s3}),e.invalidateQueries({queryKey:c3}),e.invalidateQueries({queryKey:l3})}function f3(){let e=We();return st({mutationFn:({provider:e,apiKey:t,scope:n})=>ns(`/providers/secrets/${e}`,{api_key:t,scope:n}),onSuccess:()=>d3(e)})}function p3(){let e=We();return st({mutationFn:({provider:e,scope:t})=>is(`/providers/secrets/${e}${t?`?scope=${encodeURIComponent(t)}`:``}`),onSuccess:()=>d3(e)})}var m3={openai:`OpenAI API Key`,openrouter:`OpenRouter API Key`};function h3(e){return e===`openai`||e===`openrouter`}function g3(){let{effective:e,setFields:t,isLocalOverride:n,resetFields:r}=LO(),{data:i,isPending:a}=o1(),{data:o}=u3(),s=f3(),c=p3(),l=s1(),u=i?.providers??[],d=e?.agent?.provider,f=e?.agent?.harness,{draft:p,savedDraft:m,isDirty:h,clearDraft:g,resetDraft:_,handleHarnessChange:v,handleProviderChange:y,handleModelChange:b,handleLocalBackendChange:x,handleReasoningChange:S,handleBaseUrlChange:C,handleContextLengthChange:w}=B1({source:{harness:f,provider:d},providers:u}),[T,E]=(0,W.useState)(``),D=h3(p.type)?p.type:null,O=D?o?.secrets[D]:void 0,k=p.baseUrl||Q$(p.type,p.localBackend),A=u1(p.type||null,k||void 0,`llm`,p.localBackend||null).data?.models??u.find(e=>e.type===p.type)?.models??[],j=p.type!==``;(0,W.useEffect)(()=>{E(``)},[p.type]);let M=e?.agent?.reasoningLevel,[N,P]=(0,W.useState)(M??`default`);(0,W.useEffect)(()=>{P(M??`default`)},[M]);let F=h||N!==(M??`default`),I=n(`agent.provider`)||n(`agent.harness`),L=(0,W.useCallback)(async()=>{let e=n(`agent.harness`),t=n(`agent.provider`);if(e&&t){await r([`agent.harness`,`agent.provider`]);return}if(e){await r([`agent.harness`]);return}t&&await r([`agent.provider`])},[n,r]),R=(0,W.useCallback)(async()=>{let e=L1(p,A);await t([{path:`agent.harness`,value:p.harness||e1(p.type)},{path:`agent.provider`,value:e},{path:`agent.reasoningLevel`,value:N}],`local`)},[p,N,A,t]),ee=(0,W.useCallback)((e,n)=>{let r=L1(e,A),i=[{path:`agent.harness`,value:e.harness||e1(e.type)},{path:`agent.provider`,value:r},{path:`agent.reasoningLevel`,value:N}];n&&i.push({path:`agent.scheduled_tasks_enabled`,value:!0},{path:`agent.event_tasks_enabled`,value:!0}),t(i,I?`local`:`grove`)},[I,N,A,t]),z=(0,W.useCallback)(()=>{g(),l.reset()},[l,g]),B=(0,W.useCallback)(()=>{_(),P(M??`default`),l.reset()},[l,_,M]),V=(0,W.useCallback)(async()=>{if(p.type===``){try{await t([{path:`agent.scheduled_tasks_enabled`,value:!1},{path:`agent.event_tasks_enabled`,value:!1}],I?`local`:`grove`,[`agent.provider`,`agent.harness`,`agent.reasoningLevel`])}catch(e){console.error(`[agent-card] clear provider failed`,e)}return}ee(p,m.type===``&&p.type!==``)},[p,I,m.type,t,ee]),H=(0,W.useCallback)(()=>{!D||T.trim()===``||s.mutate({provider:D,apiKey:T.trim()},{onSuccess:()=>{E(``),l.reset()}})},[l,T,s,D]),te=(0,W.useCallback)(()=>{D&&c.mutate({provider:D},{onSuccess:()=>{E(``),l.reset()}})},[l,c,D]),ne=(0,W.useCallback)(()=>{p.type!==``&&l.mutate({type:p.type,...p.type===`openai-compatible`&&p.localBackend?{local_backend:p.localBackend}:{},...p.baseUrl?{base_url:p.baseUrl}:{}})},[p.baseUrl,p.localBackend,p.type,l]);return(0,G.jsxs)(Q,{id:Pi.settingsAgent,"data-config-field":`agent.provider`,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-sage transition-all duration-300`,children:[(0,G.jsx)(MM,{children:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`Myco Agent`,(0,G.jsx)(pk,{path:`agent.provider`,hasLocalOverride:I,onSavePersonal:R,onReset:L})]})}),p.type===``?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No provider configured -- data collection is active. Configure a provider to enable the intelligence pipeline.`}):null,(0,G.jsx)(_1,{harness:p.harness,providerType:p.type,localBackend:p.localBackend,model:p.model,baseUrl:p.baseUrl,contextLength:p.contextLength,providers:u,isLoadingProviders:a,showModelSelector:!1,onHarnessChange:e=>{v(e),l.reset()},onProviderChange:e=>{y(e),l.reset()},onLocalBackendChange:e=>{x(e),l.reset()},onModelChange:b,onBaseUrlChange:C,onContextLengthChange:w}),j&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Default reasoning profile`}),(0,G.jsxs)(c_,{value:N,onValueChange:e=>P(e),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{})}),(0,G.jsx)(d_,{children:X$.map(e=>(0,G.jsx)(f_,{value:e,children:e},e))})]}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant/70`,children:`Resolves to a model through the reasoning profiles below. Tasks may override per-task.`})]}),j&&(0,G.jsx)($0,{description:"Built-in tasks resolve `low`, `default`, and `high` reasoning phases through these model mappings.",values:{low:p.reasoningLow,default:p.reasoningDefault,high:p.reasoningHigh},onChange:S,models:A,fallbackModel:p.model,placeholderWhenEmpty:`Use default model`}),j&&(0,G.jsx)(Z0,{providerType:p.type,localBackend:p.localBackend,baseUrl:p.baseUrl,model:p.model,providers:u,onModelChange:b}),D&&(0,G.jsxs)(`div`,{className:`space-y-2 rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest p-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:m3[D]}),(0,G.jsx)(Kf,{type:`password`,value:T,onChange:e=>E(e.target.value),placeholder:O?.configured?`Replace saved key`:`Paste API key`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:H,disabled:s.isPending||T.trim()===``,children:`Save key`}),O?.configured&&(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:te,disabled:c.isPending,children:`Clear key`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant break-all`,children:O?.configured?`${O.maskedValue} from ${O.source===`env`?`environment`:`${O.source} secrets`}`:`Key is required for model discovery and connection tests.`})]})]}),(p.type!==``||F)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:V,disabled:!F,children:`Save Changes`}),F?(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:B,children:`Reset`}):null,p.type===``?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:ne,disabled:l.isPending,children:[l.isPending?(0,G.jsx)(Ra,{className:`mr-2 h-4 w-4 animate-spin`}):null,`Test Connection`]}),l.isSuccess&&l.data.ok&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-primary`,children:[(0,G.jsx)(aa,{className:`h-4 w-4`}),`Connected — `,l.data.latency_ms,`ms`]}),l.isSuccess&&!l.data.ok&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-tertiary`,children:[(0,G.jsx)(ca,{className:`h-4 w-4`}),l.data.error??`Connection failed.`]}),l.isError&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-tertiary`,children:[(0,G.jsx)(ca,{className:`h-4 w-4`}),l.error.message]})]})]}),p.type!==``||m.type!==``?(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:z,className:`text-xs text-on-surface-variant`,children:`Clear provider`}):null]})]})}var _3=[{value:`ollama`,label:`Ollama`},{value:`openai-compatible`,label:`OpenAI-compatible`}];function v3(){let{effective:e}=LO(),t=e?.embedding.provider??`ollama`,n=e?.embedding.base_url??``,{data:r}=u1(t,n||void 0,`embedding`),i=r?.models??[],[a,o]=(0,W.useState)(`idle`),[s,c]=(0,W.useState)(``),l=(0,W.useCallback)(async()=>{o(`testing`),c(``);try{let e=new URLSearchParams({provider:t,type:`embedding`});n&&e.set(`base_url`,n);let r=(await q(`/models?${e.toString()}`)).models.length;o(`success`),c(`Connected -- ${r} model${r===1?``:`s`} available.`)}catch(e){o(`error`),c(e instanceof Error?e.message:`Connection failed.`)}},[t,n]);return(0,G.jsxs)(Q,{id:Pi.settingsEmbedding,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-ochre transition-all duration-300`,children:[(0,G.jsx)(MM,{children:`Embedding`}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(iP,{path:`embedding.provider`,label:`Provider`,requiresRestart:!0,children:({value:e,onChange:t})=>(0,G.jsxs)(c_,{value:e??`ollama`,onValueChange:e=>{t(e),o(`idle`)},children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{})}),(0,G.jsx)(d_,{children:_3.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})}),(0,G.jsx)(iP,{path:`embedding.model`,label:`Model`,requiresRestart:!0,commitOn:i.length>0?`change`:`blur`,children:({value:e,onChange:t,onBlur:n})=>i.length>0?(0,G.jsx)(F$,{value:e??``,onValueChange:t,placeholder:`Select a model`,searchPlaceholder:`Search embedding models...`,emptyMessage:`No embedding models match that search.`,options:i.map(e=>({value:e,label:e})),sortOptions:!0,monospace:!0}):(0,G.jsx)(Kf,{placeholder:`bge-m3`,value:e??``,onChange:e=>t(e.target.value),onBlur:n})}),(0,G.jsx)(iP,{path:`embedding.base_url`,label:`Base URL`,hint:`optional`,requiresRestart:!0,commitOn:`blur`,parse:e=>e===``?void 0:e,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsx)(Kf,{type:`url`,placeholder:`http://localhost:11434`,value:e??``,onChange:e=>{t(e.target.value),o(`idle`)},onBlur:n})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:l,disabled:a===`testing`,children:[a===`testing`?(0,G.jsx)(Ra,{className:`mr-2 h-4 w-4 animate-spin`}):null,`Test Connection`]}),a===`success`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-primary`,children:[(0,G.jsx)(aa,{className:`h-4 w-4`}),s]}),a===`error`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-tertiary`,children:[(0,G.jsx)(ca,{className:`h-4 w-4`}),s]})]})]})]})}function y3(e){return e.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean)}function b3({value:e,onChange:t,placeholder:n}){let r=(e??[]).join(`
|
|
414
|
-
`),[i,a]=(0,W.useState)(r);return(0,W.useEffect)(()=>{a(r)},[r]),(0,G.jsx)(`textarea`,{className:`min-h-24 w-full rounded-md border border-border bg-surface px-3 py-2 font-mono text-sm text-on-surface shadow-xs focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,value:i,placeholder:n,onChange:e=>a(e.target.value),onBlur:()=>t(y3(i))})}function x3(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(e=>{let[t,n]=e.split(/\s*(?:=>|=)\s*/,2);return{path_glob:t?.trim()??``,tag_pattern:n?.trim()??``}}).filter(e=>e.path_glob&&e.tag_pattern)}function S3({value:e,onChange:t}){let n=(e??[]).map(e=>`${e.path_glob} => ${e.tag_pattern}`).join(`
|
|
415
|
-
`),[r,i]=(0,W.useState)(n);return(0,W.useEffect)(()=>{i(n)},[n]),(0,G.jsx)(`textarea`,{className:`min-h-20 w-full rounded-md border border-border bg-surface px-3 py-2 font-mono text-sm text-on-surface shadow-xs focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,value:r,placeholder:`packages/api/ => refs/tags/api/v*`,onChange:e=>i(e.target.value),onBlur:()=>t(x3(r))})}function C3({children:e}){return(0,G.jsx)(`p`,{className:`font-sans text-xs leading-5 text-on-surface-variant`,children:e})}function w3({title:e,description:t,children:n}){return(0,G.jsxs)(`section`,{className:`space-y-4 border-t border-outline-variant/20 pt-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h3`,{className:`font-sans text-xs font-semibold uppercase tracking-wider text-on-surface-variant`,children:e}),(0,G.jsx)(C3,{children:t})]}),n]})}function T3(){let{effective:e,setFields:t}=LO(),{data:n}=u3(),r=f3(),i=p3(),[a,o]=(0,W.useState)(``),s=`refs/tags/${e?.release_provenance.github.repo.split(`/`).pop()?.replace(/\.git$/,``)||`project`}/v*`,c=n?.secrets.github,l=c?.configured?`${c.maskedValue??`GitHub access`} connected for PR evidence.`:`Required for private repos and reliable squash-merge matches.`,u=(0,W.useCallback)((e,n)=>{t([{path:`release_provenance.production_refs`,value:e},{path:`release_provenance.integration_refs`,value:n}],`project`).catch(e=>console.error(`[settings] release provenance preset failed`,e))},[t]),d=(0,W.useCallback)(()=>{let e=a.trim();e&&r.mutate({provider:`github`,apiKey:e},{onSuccess:()=>o(``)})},[a,r]),f=(0,W.useCallback)(()=>{i.mutate({provider:`github`})},[i]);return(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg p-6 space-y-6`,children:[(0,G.jsxs)(`div`,{className:`max-w-4xl space-y-2`,children:[(0,G.jsx)(MM,{children:`Release provenance`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Myco uses Git evidence to tell whether captured knowledge is released, merged but unreleased, or still only local.`})]}),(0,G.jsxs)(w3,{title:`Release model`,description:`Define what counts as released and what counts as merged for this project.`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>u([`refs/tags/v*`],[`origin/main`]),children:`Semver tags`}),(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>u([s],[`origin/main`]),children:`Project tag family`}),(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>u([`origin/main`],[]),children:`Main branch deploys`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(iP,{path:`release_provenance.production_refs`,label:`Production refs`,hint:`one per line`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(b3,{value:e??[],onChange:t,placeholder:`refs/tags/v*`}),(0,G.jsx)(C3,{children:`Refs that mean code is released. Use release tags, project tag families, or the branch that deploys directly.`})]})}),(0,G.jsx)(iP,{path:`release_provenance.integration_refs`,label:`Integration refs`,hint:`one per line`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(b3,{value:e??[],onChange:t,placeholder:`origin/main`}),(0,G.jsx)(C3,{children:`Refs that mean work is merged but not necessarily released. For GitHub projects this is usually the default branch.`})]})})]})]}),(0,G.jsx)(w3,{title:`GitHub evidence`,description:`Optional PR evidence improves reconciliation when squash merges hide direct commit ancestry.`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(20rem,1fr)_12rem]`,children:[(0,G.jsx)(iP,{path:`release_provenance.github.repo`,label:`Repository`,hint:`owner/name`,commitOn:`blur`,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(Kf,{value:e??``,placeholder:`owner/name`,onChange:e=>t(e.target.value),onBlur:n}),(0,G.jsx)(C3,{children:`Detected from the GitHub remote when possible. Leave blank to disable GitHub PR evidence.`})]})}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Access token`}),(0,G.jsx)(dk,{scope:`machine`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,G.jsx)(Kf,{className:`min-w-0 flex-1`,type:`password`,value:a,placeholder:c?.configured?`Paste new GitHub token`:`Paste GitHub token`,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())}}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:d,disabled:r.isPending||a.trim()===``,children:r.isPending?`Saving`:c?.configured?`Update`:`Connect`}),c?.configured&&c.source!==`env`&&(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:f,disabled:i.isPending,children:`Clear`})]}),(0,G.jsx)(C3,{children:l})]}),(0,G.jsx)(iP,{path:`release_provenance.github.max_lookups_per_run`,label:`PR lookups`,commitOn:`blur`,parse:e=>Number(e),children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(Kf,{type:`number`,min:0,max:200,value:String(e??20),onChange:e=>t(Number(e.target.value)),onBlur:n}),(0,G.jsx)(C3,{children:`Maximum GitHub PR searches per reconcile run. Higher values can improve older squash-merge matches but use more API quota.`})]})})]})}),(0,G.jsx)(w3,{title:`Reconciliation behavior`,description:`Control whether provenance runs, how often it refreshes, and how unknown Git states are treated.`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-3`,children:[(0,G.jsx)(iP,{path:`release_provenance.enabled`,label:`Enabled`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t}),(0,G.jsx)(C3,{children:`Enabled by default for Git projects. Missing refs leave records unreconciled instead of guessed.`})]})}),(0,G.jsx)(iP,{path:`release_provenance.reconcile_interval_minutes`,label:`Reconcile interval`,hint:`minutes`,commitOn:`blur`,parse:e=>Number(e),children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(Kf,{type:`number`,min:1,max:1440,value:String(e??15),onChange:e=>t(Number(e.target.value)),onBlur:n}),(0,G.jsx)(C3,{children:`How often the daemon rechecks captured Git evidence against the release model.`})]})}),(0,G.jsx)(iP,{path:`release_provenance.production_debug_include_unknown`,label:`Include unknown debug`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t}),(0,G.jsx)(C3,{children:`Include dirty worktrees and other unknown Git states in production-scoped debug context.`})]})})]})}),(0,G.jsx)(w3,{title:`Advanced monorepo releases`,description:`Use this only when different paths in one repository release through different tag families.`,children:(0,G.jsx)(iP,{path:`release_provenance.package_map`,label:`Monorepo release mapping`,hint:`path => release tag ref`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(S3,{value:e??[],onChange:t}),(0,G.jsx)(C3,{children:`Map a path prefix to the tag pattern that releases that part of the repository.`})]})})})]})}function E3(e){if(e instanceof Error)return e.message||e.constructor.name||`Error`;if(typeof e==`string`)return e||`Empty string error`;try{return JSON.stringify(e)}catch{return`Unserializable error`}}var D3=500,O3=6e4;function k3(e){return e?new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):`Never`}function A3(e,t){return e<=0?null:e===1&&t?t:`${e} packages`}function j3(){let{data:e}=Ek(),t=Dk(),n=Ok(),r=kk(),[i,a]=(0,W.useState)(`idle`),[o,s]=(0,W.useState)(null);(0,W.useEffect)(()=>{if(!e?.restarting||i!==`idle`)return;a(`restarting`);let t=Date.now()+O3,n=!1,r=async()=>{if(!(n||Date.now()>t)){try{if((await fetch(Vo(`/health`))).ok){window.location.reload();return}}catch{}n||setTimeout(r,D3)}},o=setTimeout(r,D3);return()=>{n=!0,clearTimeout(o)}},[e?.restarting,i]);let c=(0,W.useCallback)(async()=>{a(`applying`),s(null);try{let e=(await n.mutateAsync()).version;a(`restarting`);let t=Date.now()+O3;await new Promise((n,r)=>{let i=async()=>{if(Date.now()>t){r(Error(`timeout`));return}try{let t=await fetch(Vo(`/health`));if(t.ok&&(await t.json().catch(()=>null))?.version===e){n();return}}catch{}setTimeout(i,D3)};setTimeout(i,D3)}),window.location.reload()}catch(e){a(`error`),s(E3(e)===`timeout`?`Daemon did not restart within the expected time. Check the terminal.`:E3(e))}},[n]),l=(0,W.useCallback)(()=>{t.mutate()},[t]),u=(0,W.useCallback)(e=>{r.mutate(e)},[r]);if(!e)return null;let d=t.isPending,f=i===`applying`||i===`restarting`,p=e.update_available===!0,m=e.revert_available===!0,h=p||m,g=e.channel??`stable`,_=(e.packages??[]).filter(e=>e.installed),v=_.filter(e=>e.update_available),y=v.length,b=A3(y,v[0]?.latest_version??void 0),x=(e.runtime_scope??`machine`)===`managed`?`This machine is using a managed Myco runtime under ~/.myco/runtime/. Switching back to Stable removes the managed runtime and falls back to the global install on PATH.`:`This machine is using the global Myco install on PATH. Switching to Beta installs a managed runtime under ~/.myco/runtime/.`;return e.exempt?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(so,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(MM,{children:`Updates`})]}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Updates are disabled in development mode.`,` `,(0,G.jsx)(`span`,{className:`font-mono text-xs text-outline`,children:e.running_version})]})]}):(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ia,{className:J(`h-4 w-4`,h?`text-secondary`:`text-primary`)}),(0,G.jsx)(MM,{children:`Updates`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-outline`,children:e.running_version}),p&&b&&(0,G.jsx)(X,{variant:`warning`,children:b})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[h?(0,G.jsx)(Y,{variant:`default`,size:`sm`,onClick:c,disabled:f,children:f?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Qa,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}),i===`restarting`?`Restarting…`:m&&!p?`Reverting…`:`Updating…`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ia,{className:`mr-1.5 h-3.5 w-3.5`}),m&&!p?`Revert to Stable & Restart`:y>1?`Update ${y} Packages & Restart`:`Update & Restart`]})}):(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-primary`,children:[(0,G.jsx)(oa,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Up to date`})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:l,disabled:d||f,children:[(0,G.jsx)(Qa,{className:J(`mr-1.5 h-3.5 w-3.5`,d&&`animate-spin`)}),`Check Now`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:js.map(e=>(0,G.jsx)(Y,{variant:g===e?`default`:`ghost`,className:`text-xs capitalize h-6 px-2`,onClick:()=>u(e),disabled:r.isPending||f,children:e},e))}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Checked: `,k3(e.last_check)]})]}),_.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[_.map(e=>{let t=e.revert_available&&!e.update_available;return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-outline/20 px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-sans text-sm text-on-surface`,children:e.display_name}),(0,G.jsxs)(`div`,{className:`font-mono text-xs text-on-surface-variant`,children:[e.installed_version??`not installed`,(e.update_available||t)&&e.latest_version?` → ${e.latest_version}`:``]})]}),(0,G.jsx)(X,{variant:e.update_available||t?`warning`:`secondary`,children:e.update_available?`Update available`:t?`Revert pending`:`Installed`})]},e.id)}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:x})]}),(i===`error`||e.error)&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-4 w-4 mt-0.5 shrink-0`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:o??e.error})]})]})}var M3=[`project`,`grove`,`all-groves`],N3={project:`Project`,grove:`Grove`,"all-groves":`All Groves`},P3={project:`Operate on the active project only`,grove:`Operate on every project in this Grove`,"all-groves":`Operate across every Grove on this machine`},F3={project:`border-outline-variant/30 bg-on-surface-variant/15 text-on-surface`,grove:`border-secondary/50 bg-secondary/10 text-secondary`,"all-groves":`border-tertiary/50 bg-tertiary/10 text-tertiary`},I3={project:`border-outline-variant/20 text-on-surface-variant hover:bg-on-surface-variant/5`,grove:`border-outline-variant/20 text-on-surface-variant hover:bg-secondary/5`,"all-groves":`border-outline-variant/20 text-on-surface-variant hover:bg-tertiary/5`};function L3({value:e,onChange:t,available:n=M3,helperText:r}){let i=M3.filter(e=>n.includes(e));return i.length===0?null:(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`div`,{role:`group`,"aria-label":`Operation scope`,className:`inline-flex items-center gap-1`,children:i.map(n=>{let r=e===n;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n),title:P3[n],"aria-pressed":r,className:J(`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wider transition-colors`,r?F3[n]:I3[n]),children:[(0,G.jsx)(`span`,{className:J(`inline-block h-1.5 w-1.5 rounded-full`,r&&n===`grove`&&`bg-secondary`,r&&n===`all-groves`&&`bg-tertiary`,r&&n===`project`&&`bg-on-surface-variant`,!r&&`bg-outline-variant/60`),"aria-hidden":!0}),N3[n]]},n)})}),r&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:r})]})}var R3={grove:`Aggregated for this Grove. Switch projects via the upper-left switcher to view a different Grove.`,"all-groves":`Aggregates every Grove on this machine.`,project:`Filtered to the active project.`},z3={project:`Action targets the active project only.`,grove:`Action targets every project in this Grove.`,"all-groves":`Action targets every Grove on this machine.`};function B3(e,t){if(e===`all-groves`)return{kind:`all-groves`};if(t)return e===`grove`?{kind:`grove`,grove_id:t.grove.id}:{kind:`project`,grove_id:t.grove.id,project_id:t.project.project_id}}function V3(e){switch(e.kind){case`project`:return`the active project only`;case`grove`:return`every project in this Grove`;case`all-groves`:return`every Grove on this machine`}}function H3(e){switch(e.kind){case`project`:return`Project`;case`grove`:return`Grove`;case`all-groves`:return`All Groves`}}function U3({open:e,onOpenChange:t,action:n,scope:r,costEstimate:i,variant:a=`destructive`,onConfirm:o,isPending:s=!1}){let c=`${n} will run against ${V3(r)}. ${i?`Estimated cost: ${i}.`:``} This cannot be undone automatically.`,l=[{label:`Scope`,value:H3(r)}];return(0,G.jsx)(dM,{open:e,onOpenChange:t,title:n,description:c.trim(),icon:(0,G.jsx)(_o,{className:`h-5 w-5 text-tertiary`}),meta:l,confirmLabel:n,variant:a,onConfirm:o,isPending:s})}function W3(e,t){return t.kind===`all-groves`||e===`rebuild`||e===`vacuum`||e===`reindex`||e===`reembed-stale`&&t.kind===`grove`}function G3(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function K3(e){let t=new Map;for(let n of e){let e=new Date(n.modified_at).toISOString().slice(0,10),r=t.get(e)??[];r.push(n),t.set(e,r)}return t}function q3(e){let t=new Date().toISOString().slice(0,10),n=new Date(Date.now()-24*36e5).toISOString().slice(0,10);return e===t?`Today`:e===n?`Yesterday`:new Date(e).toLocaleDateString(void 0,{weekday:`long`,month:`short`,day:`numeric`})}function J3({open:e,onOpenChange:t,backups:n,groveId:r,headers:i}){let a=We(),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)({kind:`idle`});(0,W.useEffect)(()=>{e&&(s(null),l(null),d(null),p({kind:`idle`}))},[e]);async function m(e){s(e),l(null),d(null),p({kind:`idle`});try{l(await q(`/restore/preview`,{method:`POST`,headers:i,body:JSON.stringify({file_name:e.file_name})}))}catch(e){d(E3(e))}}async function h(e){let t=Date.now()+30*6e4;for(;;){await new Promise(e=>setTimeout(e,2e3));let n=await q(`/restore/status?job_id=${encodeURIComponent(e)}`,{headers:i});if(n.status!==`running`)return n;if(Date.now()>t)return{...n,status:`error`,error:`Restore is taking unusually long; check the server logs.`}}}async function g(){if(o){p({kind:`restoring`});try{let e=await h((await q(`/restore`,{method:`POST`,headers:i,body:JSON.stringify({file_name:o.file_name})})).job_id);e.status===`done`&&e.result?(p({kind:`done`,result:e.result}),await a.invalidateQueries({queryKey:[`backups`,r]})):p({kind:`error`,message:e.error??`unknown error`})}catch(e){p({kind:`error`,message:E3(e)})}}}let _=f.kind===`restoring`;return(0,G.jsx)(Lf,{open:e,onOpenChange:e=>{_||t(e)},children:(0,G.jsxs)(Vf,{className:`max-w-2xl`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`Restore from backup`}),(0,G.jsx)(Gf,{children:o?`Review what this backup holds, then restore. Restore merges records (existing rows are kept) and never deletes.`:`Pick a backup to restore. You’ll see its contents before anything happens.`})]}),o?(0,G.jsx)(X3,{backup:o,preview:c,previewError:u,phase:f,onBack:()=>{s(null),l(null),d(null),p({kind:`idle`})},onRestore:g,onClose:()=>t(!1)}):(0,G.jsx)(Y3,{backups:n,onSelect:m})]})})}function Y3({backups:e,onSelect:t}){return e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No backups available yet.`}):(0,G.jsx)(`div`,{className:`max-h-[55vh] overflow-y-auto pr-1 space-y-4`,children:Array.from(K3(e).entries()).map(([e,n])=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wider text-on-surface-variant sticky top-0 bg-surface-container-highest py-1`,children:q3(e)}),n.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:J(`w-full flex items-center justify-between rounded-md px-4 py-3 text-left`,`bg-surface-container-lowest hover:bg-surface-container-low transition-colors`),children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface`,children:G3(e.modified_at)}),(0,G.jsx)(X,{variant:`secondary`,children:lv(e.size_bytes)}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant truncate`,children:e.machine_id})]}),(0,G.jsx)(ta,{className:`h-4 w-4 text-on-surface-variant shrink-0`})]},e.file_name))]},e))})}function X3({backup:e,preview:t,previewError:n,phase:r,onBack:i,onRestore:a,onClose:o}){let s=r.kind===`restoring`,c=r.kind===`done`;return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:i,disabled:s,className:`inline-flex items-center gap-1.5 font-sans text-sm text-on-surface-variant hover:text-on-surface disabled:opacity-50`,children:[(0,G.jsx)(Ki,{className:`h-3.5 w-3.5`}),` All backups`]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface`,children:G3(e.modified_at)}),(0,G.jsx)(X,{variant:`secondary`,children:lv(e.size_bytes)})]})]}),(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-lowest p-4`,children:[(0,G.jsx)(`p`,{className:`font-sans font-medium text-xs uppercase tracking-widest text-on-surface-variant mb-2`,children:`Backup contents`}),n?(0,G.jsxs)(`p`,{className:`font-sans text-sm text-tertiary`,children:[`Could not read contents: `,n]}):t?(0,G.jsx)(`div`,{className:`max-h-[34vh] overflow-y-auto`,children:(0,G.jsxs)(`table`,{className:`w-full font-mono text-sm`,"aria-label":`Backup contents`,children:[(0,G.jsx)(`thead`,{className:`sticky top-0 bg-surface-container-lowest`,children:(0,G.jsxs)(`tr`,{className:`text-left text-on-surface-variant`,children:[(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Table`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`In backup`}),(0,G.jsx)(`th`,{className:`pb-2 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`In database`})]})}),(0,G.jsx)(`tbody`,{children:t.tables.map((e,t)=>(0,G.jsxs)(`tr`,{className:J(t%2==1?`bg-surface-container-low/30`:``),children:[(0,G.jsx)(`td`,{className:`py-1.5 pr-4`,children:e.table}),(0,G.jsx)(`td`,{className:`py-1.5 pr-4 text-right text-primary`,children:e.in_backup}),(0,G.jsx)(`td`,{className:`py-1.5 text-right text-on-surface-variant`,children:e.in_db})]},e.table))})]})}):(0,G.jsxs)(`p`,{className:`flex items-center gap-2 font-sans text-sm text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-3.5 w-3.5 animate-spin`}),` Reading backup contents…`]})]}),r.kind===`error`&&(0,G.jsxs)(`p`,{className:`font-sans text-sm text-tertiary`,children:[`Restore failed: `,r.message]}),s&&(0,G.jsxs)(`p`,{className:`flex items-center gap-2 font-sans text-sm text-primary`,children:[(0,G.jsx)(Ra,{className:`h-3.5 w-3.5 animate-spin`}),`Restoring… this runs in the background and can take a minute on a large backup. You can keep using Myco.`]}),c&&(0,G.jsxs)(`p`,{className:`flex items-center gap-2 font-sans text-sm text-primary`,children:[(0,G.jsx)(oa,{className:`h-3.5 w-3.5`}),`Restored `,r.result.total_restored,` records, skipped `,r.result.total_skipped,` already present.`]}),(0,G.jsx)(`div`,{className:`flex justify-end gap-2`,children:c?(0,G.jsx)(Y,{variant:`default`,size:`sm`,onClick:o,children:`Done`}):(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:a,disabled:s||!!n,children:[(0,G.jsx)(vo,{className:`mr-1.5 h-3.5 w-3.5`}),s?`Restoring…`:`Restore this backup`]})})]})}var Z3=[`grove`,`all-groves`],Q3=3;function $3({embedded:e=!1}={}){let[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(`grove`),[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(!1),d=_s(),f=d?.grove.id??null,p=d?ko(d):void 0,m=ot({queryKey:[`backups`,f],queryFn:()=>q(`/backups`,{headers:p}),enabled:!!f}),h=m.data?.backups??[],g=!!f&&(m.isSuccess||m.isError),_=h.slice(0,Q3),v=h.length>0?h[h.length-1]:null;async function y(){u(!0),n(null);try{let e=B3(r,d),t=await q(`/backup`,{method:`POST`,headers:p,body:JSON.stringify({scope:e})});t.summary?n({type:t.summary.failed>0?`error`:`success`,text:`Backed up ${t.summary.ok} Grove(s); ${t.summary.failed} failed`}):n({type:`success`,text:`Backup created (${lv(t.size_bytes)})`}),await m.refetch()}catch(e){n({type:`error`,text:`Backup failed: ${E3(e)}`})}finally{u(!1)}}function b(){let e=B3(r,d);if(e&&W3(`backup`,e)){o(!0);return}y()}let x=m.isError?`Failed to load backups: ${E3(m.error)}`:null,S=(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>m.refetch(),children:[(0,G.jsx)(Qa,{className:`mr-1.5 h-3.5 w-3.5`}),`Refresh`]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>c(!0),disabled:h.length===0,children:[(0,G.jsx)(vo,{className:`mr-1.5 h-3.5 w-3.5`}),`Restore…`]}),(0,G.jsxs)(Y,{variant:`default`,size:`sm`,onClick:b,disabled:l,children:[(0,G.jsx)(ga,{className:`mr-1.5 h-3.5 w-3.5`}),`Backup Now`]})]}),C=(0,G.jsxs)(G.Fragment,{children:[e?(0,G.jsx)(`div`,{className:`flex items-center justify-end`,children:S}):(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(ja,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(MM,{children:`Backup & Restore`}),(0,G.jsx)(L3,{value:r,onChange:i,available:Z3})]}),S]}),(0,G.jsx)(U3,{open:a,onOpenChange:o,action:`Create backup`,scope:B3(r,d)??{kind:`all-groves`},isPending:l,onConfirm:async()=>{await y(),o(!1)}}),(0,G.jsx)(J3,{open:s,onOpenChange:c,backups:h,groveId:f,headers:p}),!e&&(0,G.jsx)(iP,{path:`backup.dir`,label:`Backup Directory`,commitOn:`blur`,requiresRestart:!0,hint:`leave blank for default .myco/backups; ~ supported`,parse:e=>e===``?void 0:e,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Da,{className:`h-3.5 w-3.5 text-on-surface-variant shrink-0`}),(0,G.jsx)(`input`,{type:`text`,value:e??``,onChange:e=>t(e.target.value),onBlur:n,placeholder:`.myco/backups`,className:`flex-1 bg-surface-container text-on-surface font-mono text-sm rounded px-3 py-1.5 outline-hidden border border-outline-variant/15 focus:border-primary/40 placeholder:text-on-surface-variant/50`})]})}),(t||x)&&(0,G.jsx)(`p`,{className:J(`font-sans text-sm`,t?.type===`success`?`text-primary`:`text-tertiary`),children:t?.text??x}),h.length>0?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[_.map((e,t)=>(0,G.jsx)(`div`,{className:`flex items-center justify-between rounded-md bg-surface-container-lowest px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface`,children:G3(e.modified_at)}),t===0&&(0,G.jsx)(X,{variant:`outline`,children:`Latest`}),(0,G.jsx)(X,{variant:`secondary`,children:lv(e.size_bytes)}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant truncate`,children:e.machine_id})]})},e.file_name)),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[h.length,` backup`,h.length===1?``:`s`,` kept`,v?` · oldest ${G3(v.modified_at)}`:``,` · `,(0,G.jsx)(`button`,{type:`button`,onClick:()=>c(!0),className:`text-primary hover:underline`,children:`browse & restore`})]})]}):g&&!x?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No backups yet. Click "Backup Now" to create one.`}):null]});return e?(0,G.jsx)(`div`,{className:`space-y-4`,children:C}):(0,G.jsx)(Q,{id:Pi.operationsBackup,level:`low`,className:`rounded-lg p-6 space-y-4 transition-all duration-300`,children:C})}var e6=[{id:`agent`,label:`Agent`,desc:`Default provider, runtime, and scheduled-task gates that drive the agent pipeline.`,category:`Agent`,icon:`Bot`,fields:[{key:`agent.provider.type`,label:`Provider`,scope:`grove`,kind:`select`,category:`Agent`,icon:`Bot`,options:[`anthropic`,`ollama`,`lmstudio`,`openai`,`openrouter`,`openai-compatible`],note:`Default provider for agent tasks. Individual tasks may override.`,customRender:`card-owns`},{key:`agent.provider.model`,label:`Model`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Provider-specific model identifier (e.g. claude-opus-4-7, gpt-oss:20b).`,customRender:`card-owns`},{key:`agent.provider.base_url`,label:`Base URL`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Override for self-hosted or OpenAI-compatible endpoints.`,customRender:`card-owns`},{key:`agent.provider.context_length`,label:`Context length`,scope:`grove`,kind:`number`,category:`Agent`,icon:`Bot`,note:`Context window size for local models (Ollama num_ctx, LM Studio context_length).`,customRender:`card-owns`},{key:`agent.reasoningLevel`,label:`Default reasoning profile`,scope:`grove`,kind:`select`,category:`Agent`,icon:`Bot`,options:[`low`,`default`,`high`],note:`Grove-wide default reasoning tier. Resolves to a model through the reasoning profiles, so it stays portable across model upgrades. Tasks may override per-task.`,customRender:`card-owns`},{key:`agent.model`,label:`Default model (advanced)`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Escape hatch — pins a specific model SKU when a reasoning tier has no mapping (e.g. local providers without a reasoning map).`,customRender:`card-owns`},{key:`agent.harness`,label:`Runtime`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Runtime id (e.g. claude-sdk, openai-agents). Picked from the installed runtime registry.`,customRender:`card-owns`}]},{id:`scheduled-tasks`,label:`Scheduled tasks`,desc:`Master switches and freshness gates for the agent pipeline's scheduled and event-driven tasks.`,category:`Scheduled tasks`,icon:`Activity`,fields:[{key:`agent.scheduled_tasks_enabled`,label:`Scheduled tasks`,scope:`grove`,kind:`toggle`,category:`Scheduled tasks`,icon:`Activity`,note:`Master switch for all scheduled agent tasks (canopy-describe, intelligence-skill, etc.).`},{key:`agent.event_tasks_enabled`,label:`Event-driven tasks`,scope:`grove`,kind:`toggle`,category:`Scheduled tasks`,icon:`Activity`,note:`Master switch for tasks fired by capture events (e.g., end-of-session summaries).`},{key:`agent.scheduled_tasks_active_window_days`,label:`Active project window`,scope:`grove`,kind:`number`,category:`Scheduled tasks`,icon:`Activity`,min:0,max:365,suffix:`days`,note:`Only run scheduled tasks against projects touched within this window. 0 disables the gate (all projects always considered active).`}]},{id:`embedding`,label:`Embedding`,desc:`Vector embedding provider for spores, sessions, and semantic recall.`,category:`Embedding`,icon:`Brain`,fields:[{key:`embedding.provider`,label:`Provider`,scope:`grove`,kind:`select`,category:`Embedding`,icon:`Brain`,options:[`ollama`,`openai-compatible`,`openrouter`,`openai`],customRender:`card-owns`},{key:`embedding.model`,label:`Model`,scope:`grove`,kind:`text`,category:`Embedding`,icon:`Brain`,note:`Default is bge-m3. Must match the provider's embedding-model id.`,customRender:`card-owns`},{key:`embedding.base_url`,label:`Base URL`,scope:`grove`,kind:`text`,category:`Embedding`,icon:`Brain`,note:`Override for self-hosted or OpenAI-compatible endpoints.`,customRender:`card-owns`},{key:`embedding.run_in_deep_sleep`,label:`Keep embedding while deep-sleeping`,scope:`grove`,kind:`toggle`,category:`Embedding`,icon:`Brain`,note:`Keep draining the embedding queue when the daemon would otherwise enter deep sleep. Recommended when the backlog is large.`,customRender:`card-owns`}]},{id:`capture`,label:`Capture`,desc:`Where Myco picks up transcripts, plans, and other artifacts.`,category:`Capture`,icon:`MessageSquare`,fields:[{key:`capture.transcript_paths`,label:`Transcript paths`,scope:`machine`,kind:`list`,category:`Capture`,icon:`MessageSquare`,note:`Additional directories scanned for agent transcripts. Empty uses the agent symbionts' defaults.`},{key:`capture.plan_dirs`,label:`Plan directories`,scope:`machine`,kind:`list`,category:`Capture`,icon:`MessageSquare`,note:`Directories Myco watches for agent-authored plans.`,customRender:`card-owns`},{key:`capture.ignore_plan_dirs_in_git`,label:`Add plan dirs to .gitignore`,scope:`machine`,kind:`toggle`,category:`Capture`,icon:`MessageSquare`,note:`When on, Myco maintains a managed block in .gitignore covering the configured plan directories.`,customRender:`card-owns`},{key:`capture.artifact_extensions`,label:`Artifact extensions`,scope:`machine`,kind:`list`,category:`Capture`,icon:`MessageSquare`,note:`File extensions captured as artifacts (e.g. .md, .py).`},{key:`capture.buffer_max_events`,label:`Event buffer size`,scope:`machine`,kind:`number`,category:`Capture`,icon:`MessageSquare`,min:100,step:100,note:`In-memory cap on pending capture events before backpressure kicks in.`}]},{id:`release-provenance`,label:`Release Provenance`,desc:`How Myco classifies session work against shipped, integrated, and unreleased refs.`,category:`Release Provenance`,icon:`GitBranch`,fields:[{key:`release_provenance.enabled`,label:`Enable release provenance`,scope:`project`,kind:`toggle`,category:`Release Provenance`,icon:`GitBranch`,customRender:`card-owns`},{key:`release_provenance.production_refs`,label:`Production refs`,scope:`project`,kind:`list`,category:`Release Provenance`,icon:`GitBranch`,note:`Refs that represent shipped code (e.g. tags v*, refs/tags/release-*). Empty keeps state unreconciled rather than guessing.`,customRender:`card-owns`},{key:`release_provenance.integration_refs`,label:`Integration refs`,scope:`project`,kind:`list`,category:`Release Provenance`,icon:`GitBranch`,note:`Refs that represent merged-but-not-yet-shipped code (e.g. main, develop).`,customRender:`card-owns`},{key:`release_provenance.github.repo`,label:`GitHub repo`,scope:`project`,kind:`text`,category:`Release Provenance`,icon:`GitBranch`,note:`owner/name. Empty disables PR-evidence lookup.`,customRender:`card-owns`},{key:`release_provenance.github.token_env`,label:`GitHub token env var`,scope:`project`,kind:`text`,category:`Release Provenance`,icon:`GitBranch`,note:`Name of the environment variable holding the GitHub token. Token values must never be stored in config.`,customRender:`card-owns`},{key:`release_provenance.github.max_lookups_per_run`,label:`Max PR lookups per run`,scope:`project`,kind:`number`,category:`Release Provenance`,icon:`GitBranch`,min:0,max:200,note:`Caps per-reconcile GitHub API calls so a noisy backlog can't drain the rate limit.`,customRender:`card-owns`},{key:`release_provenance.reconcile_interval_minutes`,label:`Reconcile interval (minutes)`,scope:`grove`,kind:`number`,category:`Release Provenance`,icon:`GitBranch`,min:1,max:1440,note:`How often the PowerManager-driven reconciler refreshes provenance state.`,customRender:`card-owns`},{key:`release_provenance.production_debug_include_unknown`,label:`Include unknown clues in production-debug`,scope:`project`,kind:`toggle`,category:`Release Provenance`,icon:`GitBranch`,note:`Lets production-debug retrieval surface unclassified clues alongside released hits.`,customRender:`card-owns`},{key:`release_provenance.package_map`,label:`Package map`,scope:`project`,kind:`list`,category:`Release Provenance`,icon:`GitBranch`,note:`Monorepo path-glob → tag-pattern entries. Records outside any mapping fall back to the umbrella refs.`,customRender:`card-owns`}]},{id:`notifications`,label:`Notifications`,desc:`What Myco surfaces in the daemon UI and which channels it uses.`,category:`Notifications`,icon:`Bell`,fields:[{key:`notifications.enabled`,label:`Enable notifications`,scope:`machine`,kind:`toggle`,category:`Notifications`,icon:`Bell`,note:`Master switch — disables every notification channel when off.`,customRender:`card-owns`},{key:`notifications.default_mode`,label:`Default mode`,scope:`machine`,kind:`select`,category:`Notifications`,icon:`Bell`,options:[`banner`,`summary`],note:`How new notification types display until you customize them per-domain.`,customRender:`card-owns`},{key:`notifications.system_notifications`,label:`Browser system notifications`,scope:`machine`,kind:`toggle`,category:`Notifications`,icon:`Bell`,note:`Pipe banner-mode notifications through the browser Notification API.`,customRender:`card-owns`}]},{id:`skills`,label:`Skills`,desc:`Thresholds the skill-lifecycle pipeline uses to surface, promote, and retire skills.`,category:`Skills`,icon:`Sparkles`,fields:[{key:`skills.confidence_threshold`,label:`Auto-promote confidence`,scope:`grove`,kind:`number`,category:`Skills`,icon:`Sparkles`,min:0,max:1,step:.05,note:`Survey candidates above this score auto-promote without a manual approve.`},{key:`skills.usage_stale_days`,label:`Stale-skill window (days)`,scope:`grove`,kind:`number`,category:`Skills`,icon:`Sparkles`,min:0,suffix:`days`,note:`Skills with no usage in this many days get flagged for review.`}]},{id:`maintenance`,label:`Maintenance`,desc:`Background database hygiene jobs the daemon runs against this Grove.`,category:`Maintenance`,icon:`Wrench`,fields:[{key:`maintenance.auto_optimize`,label:`Auto-run PRAGMA optimize`,scope:`grove`,kind:`toggle`,category:`Maintenance`,icon:`Wrench`},{key:`maintenance.auto_optimize_interval_hours`,label:`Optimize interval (hours)`,scope:`grove`,kind:`number`,category:`Maintenance`,icon:`Wrench`,min:1,max:720,suffix:`hours`,dependsOn:{key:`maintenance.auto_optimize`,value:!0}},{key:`maintenance.auto_integrity_check`,label:`Auto-run integrity check`,scope:`grove`,kind:`toggle`,category:`Maintenance`,icon:`Wrench`,note:`Runs integrity + foreign-key checks on a slow cadence; failures surface in the Database panel.`},{key:`maintenance.auto_integrity_check_interval_hours`,label:`Integrity-check interval (hours)`,scope:`grove`,kind:`number`,category:`Maintenance`,icon:`Wrench`,min:1,max:8760,suffix:`hours`,dependsOn:{key:`maintenance.auto_integrity_check`,value:!0},note:`Default is 168 hours (weekly).`}]},{id:`backup`,label:`Backup`,desc:`Where Grove backups land and how many are kept.`,category:`Backup`,icon:`Save`,fields:[{key:`backup.dir`,label:`Backup directory`,scope:`grove`,kind:`text`,category:`Backup`,icon:`Save`,nullableEmpty:!0,note:`Override for the backup root. Supports ~. Defaults to <groveHome>/backups when empty.`},{key:`backup.auto_interval_hours`,label:`Auto-backup interval (hours)`,scope:`grove`,kind:`number`,category:`Backup`,icon:`Save`,min:1,max:720,suffix:`hours`,note:`Minimum hours between auto-backups. Default is 24 (one per day per machine).`},{key:`backup.retention.keep_daily`,label:`Daily backups to keep`,scope:`grove`,kind:`number`,category:`Backup`,icon:`Save`,min:1,max:365,suffix:`days`},{key:`backup.retention.keep_weekly`,label:`Weekly backups to keep`,scope:`grove`,kind:`number`,category:`Backup`,icon:`Save`,min:0,max:52,suffix:`weeks`,note:`Kept beyond the daily window for longer-term restore points.`}]},{id:`sessions`,label:`Sessions`,desc:`Session lifecycle thresholds the daemon uses for staleness detection.`,category:`Sessions`,icon:`Activity`,fields:[{key:`daemon.stale_session_threshold_ms`,label:`Stale-session threshold (ms)`,scope:`grove`,kind:`number`,category:`Sessions`,icon:`Activity`,min:1,max:10080,unit:{displayUnit:`minutes`,factor:6e4},note:`How long an idle session waits before it's auto-completed (display in minutes; daemon stores milliseconds).`}]},{id:`logging`,label:`Logging`,desc:`Daemon-process log verbosity and retention.`,category:`Logging`,icon:`ScrollText`,fields:[{key:`daemon.log_level`,label:`Log level`,scope:`machine`,kind:`select`,category:`Logging`,icon:`ScrollText`,options:[`debug`,`info`,`warn`,`error`]},{key:`daemon.log_retention_days`,label:`Log retention (days)`,scope:`machine`,kind:`number`,category:`Logging`,icon:`ScrollText`,min:1,max:365,suffix:`days`,note:`Window for log_entries rows. One daemon, one retention policy across every Grove it serves.`}]},{id:`update`,label:`Update`,desc:`Which release stream the daemon pulls updates from.`,category:`Update`,icon:`RotateCcw`,fields:[{key:`daemon.update_channel`,label:`Update channel`,scope:`machine`,kind:`select`,category:`Update`,icon:`RotateCcw`,options:[`stable`,`beta`],note:`Use beta for dogfood/preview builds. Machine-wide — one channel per machine.`,customRender:`card-owns`}]}];function t6(){let e=LO(),t=EO(),n=kO(),r=DO(),i=AO(),a=t.data?.config,o=n.data?.config;return{readField:(0,W.useCallback)(t=>{switch(t.scope){case`project`:{let n=e.effective;return n==null?void 0:SO(n,t.key)}case`grove`:return a?SO(a,t.key):void 0;case`machine`:return o?SO(o,t.key):void 0}},[e.effective,a,o]),writeField:(0,W.useCallback)(async(t,n)=>{switch(t.scope){case`project`:await e.setField(t.key,n,`project`);return;case`grove`:{let e={};CO(e,t.key,n),await r.mutateAsync(e);return}case`machine`:{let e={};CO(e,t.key,n),await i.mutateAsync(e);return}}},[e,r,i]),isLoading:e.isLoading||!!t.isLoading||!!n.isLoading,error:t.error??n.error??null,scopeCounts:(0,W.useMemo)(()=>{let e={project:0,grove:0,machine:0};for(let t of e6)for(let n of t.fields)n.customRender!==`card-owns`&&(e[n.scope]+=1);return e},[])}}var n6=[{value:`all`,label:`All`},{value:`project`,label:`Project`},{value:`grove`,label:`Grove`},{value:`machine`,label:`Machine`}];function r6({scope:e,onScopeChange:t,searchInput:n,onSearchChange:r,scopeCounts:i}){let a=i.project+i.grove+i.machine;return(0,G.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(`div`,{role:`tablist`,"aria-label":`Filter settings by scope`,className:`inline-flex overflow-hidden rounded-md border border-[var(--ghost-border)] bg-surface-container-low`,children:n6.map(n=>{let r=n.value===`all`?a:i[n.value],o=n.value===e;return(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o,onClick:()=>t(n.value),className:J(`relative flex items-center gap-1.5 px-3 py-1.5 transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,o?`bg-sage/10 text-on-surface`:`text-on-surface-variant hover:bg-surface-container hover:text-on-surface`),children:[o&&(0,G.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-[2px] bg-sage`}),(0,G.jsx)(`span`,{className:J(`myco-display-xs`,!o&&`text-on-surface-variant`),children:n.label}),(0,G.jsx)(X,{variant:`outline`,className:`px-1 py-0 text-[10px] font-mono`,children:r})]},n.value)})}),(0,G.jsxs)(`div`,{className:`relative flex-1 min-w-[16rem] max-w-md`,children:[(0,G.jsx)(no,{className:`pointer-events-none absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-on-surface-variant`}),(0,G.jsx)(Kf,{type:`search`,value:n,placeholder:`Search settings...`,onChange:e=>r(e.target.value),className:`pl-8 pr-8`}),n&&(0,G.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,onClick:()=>r(``),className:`absolute right-1.5 top-1/2 -translate-y-1/2 rounded-sm p-1 text-on-surface-variant hover:bg-surface-container-high/40 hover:text-on-surface`,children:(0,G.jsx)(So,{className:`h-4 w-4`})})]})]})}var i6={Activity:Gi,Bell:Ji,Bot:Xi,Brain:Zi,GitBranch:ka,MessageSquare:Ha,RotateCcw:$a,Save:eo,ScrollText:to,Sparkles:co,Users:yo,Wrench:xo};function a6({name:e,className:t}){return(0,G.jsx)(i6[e]??Xi,{className:t})}var o6={toggle:Y4,select:X4,number:Q4,text:$4,list:t3,secret:n3},s6={project:`project`,grove:`grove`,machine:`machine`};function c6(e,t){let[n,r]=(0,W.useState)(e);return(0,W.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function l6(e,t){return t?`${e.label} ${e.key} ${e.category}`.toLowerCase().includes(t.toLowerCase()):!0}function u6(e){return e.customRender!==`card-owns`}function d6(e){return e.fields.filter(u6)}function f6(e,t,n){return d6(e).filter(e=>t!==`all`&&e.scope!==t?!1:l6(e,n))}function p6(e,t){for(let n of e6)for(let r of n.fields)if(r.key===e&&r.scope===t)return r}function m6(e,t,n,r,i){if(i){let t=r.trim(),i=e=>n===`all`||e.scope===n;return t.length>0?e.fields.some(e=>i(e)&&l6(e,t)):n===`all`?!0:e.fields.some(e=>i(e))}return t.length>0}var h6=new Set([`agent`,`embedding`,`capture`,`release-provenance`,`notifications`,`update`,`backup`,`logging`]),g6={agent:()=>(0,G.jsx)(g3,{}),embedding:()=>(0,G.jsx)(v3,{}),capture:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(r3,{}),e.length>0&&(0,G.jsx)(C6,{fields:e,hasProject:t,unified:n})]}),"release-provenance":()=>(0,G.jsx)(T3,{}),notifications:()=>(0,G.jsx)(o3,{}),update:()=>(0,G.jsx)(j3,{}),backup:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(C6,{fields:e,hasProject:t,unified:n}),(0,G.jsx)($3,{embedded:!0})]}),logging:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(C6,{fields:e,hasProject:t,unified:n}),(0,G.jsx)(_6,{})]})};function _6(){let e=Fs().data?.context?.request?.machine_id??`—`;return(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 py-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] md:items-start`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Machine ID`}),(0,G.jsx)(dk,{scope:s6.machine})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Stable identifier this daemon uses when speaking to the team worker. Read-only.`})]}),(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsx)(`div`,{className:`flex h-9 w-full items-center rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 font-mono text-sm text-on-surface`,children:e})})]})}function v6(){return(0,G.jsx)(QN,{children:(0,G.jsx)(y6,{})})}function y6(){let e=gs(),t=An(),n=e!==null,r=t6(),[i,a]=(0,W.useState)(`all`),[o,s]=(0,W.useState)(``),c=c6(o,150),[l,u]=(0,W.useState)(e6[0]?.id??``),d=(0,W.useRef)(null),f=(0,W.useMemo)(()=>e6.map(e=>{let t=h6.has(e.id),n=f6(e,i,c);return{group:e,isCustom:t,visibleFields:n,visible:m6(e,n,i,c,t),mixedScopes:new Set(e.fields.map(e=>e.scope)).size>1}}),[i,c]),p=f.some(e=>e.visible);(0,W.useEffect)(()=>{let e=t.hash.replace(`#`,``);if(!e||!e6.some(t=>t.id===e))return;u(e);let n=document.getElementById(e);n&&requestAnimationFrame(()=>n.scrollIntoView({behavior:`auto`,block:`start`}))},[t.hash]),(0,W.useEffect)(()=>{if(r.isLoading)return;let e=new URLSearchParams(t.search),n=e.get(`configField`),i=e.get(`configSection`);if(!n&&!i)return;let a=[`ring-2`,`ring-primary/40`,`bg-primary/5`],o=(()=>{if(n){let e=n;for(;e.length>0;){let t=document.getElementById(Fi(e));if(t)return t;let n=e.lastIndexOf(`.`);if(n===-1)break;e=e.slice(0,n)}}if(i){let e=document.getElementById(i);if(e)return e}return null})();o&&(i&&e6.some(e=>e.id===i)&&u(i),requestAnimationFrame(()=>{o.scrollIntoView({behavior:`smooth`,block:`center`}),o.classList.add(...a),window.setTimeout(()=>o.classList.remove(...a),2e3)}))},[r.isLoading,t.search]);let m=(0,W.useCallback)(e=>{u(e);let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})},[]);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsxs)(`div`,{className:`px-6 pt-6`,children:[(0,G.jsx)(YN,{title:`Settings`,subtitle:`Project, Grove, and Machine settings in one place. Use the filter bar to narrow by scope.`}),(0,G.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-md border border-outline-variant/30 bg-surface-container/40 px-3 py-2 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Scopes`}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(dk,{scope:`personal`}),` only you, this machine`]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(dk,{scope:`project`}),` shared via the repo`]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(dk,{scope:`grove`}),` all projects in this Grove`]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(dk,{scope:`machine`}),` every Grove on this machine`]}),(0,G.jsx)(`span`,{className:`text-on-surface-variant/70`,children:`Precedence: Personal › Project › Grove › Machine.`})]}),!n&&(0,G.jsx)(`div`,{className:`mb-3 rounded-md border border-outline-variant/30 bg-surface-container/40 px-3 py-2 font-sans text-sm text-on-surface-variant`,children:`Select a project to edit Project and Grove settings. Machine-scoped settings are still editable below.`}),(0,G.jsx)(tP,{}),(0,G.jsx)(r6,{scope:i,onScopeChange:a,searchInput:o,onSearchChange:s,scopeCounts:r.scopeCounts})]}),(0,G.jsx)(`div`,{ref:d,className:`flex-1 overflow-auto px-6 pb-6`,children:(0,G.jsxs)(`div`,{className:`flex gap-6`,children:[(0,G.jsx)(b6,{summaries:f,activeId:l,onSelect:m}),(0,G.jsxs)(`main`,{className:`flex-1 space-y-4`,children:[!p&&(0,G.jsx)(`div`,{className:`flex h-64 items-center justify-center font-sans text-sm text-on-surface-variant`,children:`No settings match your filters.`}),f.map(e=>e.visible?(0,G.jsx)(x6,{group:e.group,isCustom:e.isCustom,visibleFields:e.visibleFields,mixedScopes:e.mixedScopes,hasProject:n,unified:r},e.group.id):null)]})]})})]})}function b6({summaries:e,activeId:t,onSelect:n}){return(0,G.jsx)(`nav`,{"aria-label":`Settings sections`,className:`sticky top-0 hidden h-fit w-[200px] shrink-0 self-start lg:block`,children:(0,G.jsx)(`ul`,{className:`space-y-0.5 py-2`,children:e.map(({group:e,visible:r,isCustom:i,visibleFields:a})=>{let o=e.id===t,s=i?d6(e).length:a.length;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:J(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left font-sans text-sm transition-colors`,o?`bg-surface-container-high/60 text-on-surface`:`text-on-surface-variant hover:bg-surface-container/40 hover:text-on-surface`,!r&&`opacity-40`),children:[(0,G.jsx)(a6,{name:e.icon,className:`h-4 w-4 shrink-0`}),(0,G.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:s})]})},e.id)})})})}function x6({group:e,isCustom:t,visibleFields:n,mixedScopes:r,hasProject:i,unified:a}){return(0,G.jsx)(Q,{level:`low`,className:`rounded-md p-4`,children:(0,G.jsxs)(`section`,{id:e.id,className:`scroll-mt-4`,children:[(0,G.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(a6,{name:e.icon,className:`h-4 w-4 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:e.category}),(0,G.jsx)(`h2`,{className:`font-sans text-base text-on-surface`,children:e.label}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-outline`,children:e.desc})]}),r&&(0,G.jsx)(X,{variant:`outline`,className:`text-[10px]`,children:`Mixed scopes`})]}),t?(0,G.jsx)(S6,{groupId:e.id,fields:n,hasProject:i,unified:a}):(0,G.jsx)(C6,{fields:n,hasProject:i,unified:a})]})})}function S6({groupId:e,fields:t,hasProject:n,unified:r}){let i=g6[e];return i?(0,G.jsx)(`div`,{children:i({fields:t,hasProject:n,unified:r})}):null}function C6({fields:e,hasProject:t,unified:n}){return e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No fields match the current filters.`}):(0,G.jsx)(`div`,{className:`divide-y divide-outline-variant/20`,children:e.map(e=>(0,G.jsx)(w6,{field:e,hasProject:t,unified:n},e.key))})}function w6({field:e,hasProject:t,unified:n}){let r=Fi(e.key),i=`setting-${e.key.replace(/\./g,`-`)}`,a=n.readField(e),o=e.scope===`grove`&&!t||e.scope===`project`&&!t,s=(()=>{if(!e.dependsOn)return!1;let t=p6(e.dependsOn.key,e.scope);return t?n.readField(t)!==e.dependsOn.value:!1})(),c=o||s,l=(0,W.useCallback)(t=>{n.writeField(e,t).catch(t=>{console.error(`[settings] writeField failed: ${e.key}`,t)})},[n,e]),u=jO(),d=MO(),f=e.scope===`machine`&&e.kind===`list`,p=f?t=>u.mutate({path:e.key,value:t}):void 0,m=f?t=>d.mutate({path:e.key,value:t}):void 0;return(0,G.jsxs)(`div`,{id:r,className:`grid grid-cols-1 gap-3 py-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] md:items-start scroll-mt-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:i,className:`font-sans text-sm font-medium text-on-surface`,children:e.label}),(0,G.jsx)(dk,{scope:s6[e.scope]}),(0,G.jsx)(`code`,{className:`font-mono text-[10px] text-on-surface-variant`,children:e.key})]}),e.note&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:e.note})]}),(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsx)(T6,{inputId:i,field:e,value:a,onChange:l,disabled:c,onAdd:p,onRemove:m})})]})}function T6({inputId:e,field:t,value:n,onChange:r,disabled:i,onAdd:a,onRemove:o}){if(!o6[t.kind])return null;switch(t.kind){case`toggle`:return(0,G.jsx)(Y4,{id:e,value:n??!1,onChange:e=>r(e),disabled:i,readonly:t.readonly});case`select`:return(0,G.jsx)(X4,{id:e,value:n??``,onChange:e=>r(e),options:t.options??[],disabled:i,readonly:t.readonly});case`number`:{let a=t.unit?.factor??1,o=typeof n==`number`?n:0;return(0,G.jsx)(Q4,{id:e,value:a===1?o:o/a,onChange:e=>r(a===1?e:e*a),min:t.min,max:t.max,step:t.step,suffix:t.unit?.displayUnit??t.suffix,disabled:i,readonly:t.readonly})}case`text`:return(0,G.jsx)($4,{id:e,value:typeof n==`string`?n:``,onChange:e=>{let n=typeof e==`string`?e:``;t.nullableEmpty&&n.length===0?r(null):r(e)},disabled:i,readonly:t.readonly});case`list`:return(0,G.jsx)(t3,{id:e,value:Array.isArray(n)?n:[],onChange:e=>r(e),disabled:i,readonly:t.readonly,onAdd:a,onRemove:o});case`secret`:return(0,G.jsx)(n3,{id:e,value:typeof n==`string`?n:``,onChange:e=>r(e),disabled:i,readonly:t.readonly});default:return null}}function E6({Icon:e,children:t,...n}){return(0,G.jsxs)(wj,{...n,children:[(0,G.jsx)(e,{className:`h-3 w-3 mr-1.5`,"aria-hidden":!0}),t]})}function D6({term:e,children:t}){return(0,G.jsxs)(`div`,{className:`flex justify-between gap-2 text-xs`,children:[(0,G.jsx)(`dt`,{className:`text-on-surface-variant`,children:e}),(0,G.jsx)(`dd`,{className:`text-on-surface`,children:t})]})}function O6({name:e,slug:t,projectCount:n,machineId:r}){return(0,G.jsx)(Tj,{tone:`sage`,eyebrow:(0,G.jsx)(E6,{Icon:go,tone:`sage`,children:`Grove`}),title:e,children:(0,G.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(D6,{term:`Slug`,children:(0,G.jsx)(`code`,{className:`font-mono`,children:t})}),(0,G.jsx)(D6,{term:`Projects`,children:(0,G.jsx)(`span`,{children:n})}),(0,G.jsx)(D6,{term:`Machine`,children:(0,G.jsx)(`code`,{className:`font-mono`,children:r})})]})})}function k6({uptimeSeconds:e,port:t,version:n}){return(0,G.jsx)(Tj,{tone:`sage`,eyebrow:(0,G.jsx)(E6,{Icon:mo,tone:`sage`,children:`Daemon`}),title:Ak(e),children:(0,G.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(D6,{term:`Port`,children:(0,G.jsxs)(`code`,{className:`font-mono`,children:[`:`,t]})}),(0,G.jsx)(D6,{term:`Version`,children:(0,G.jsx)(`code`,{className:`font-mono`,children:n})}),(0,G.jsx)(D6,{term:`Status`,children:(0,G.jsx)(X,{variant:`default`,children:`running`})})]})})}function A6(e){return e?`?team_id=${encodeURIComponent(e)}`:``}function j6(e){let t=A6(e);return Ts({queryKey:[`team-status`,e??null],queryFn:({signal:e})=>q(`/team/status${t}`,{signal:e}),refetchInterval:Es.STATS,pollCategory:`standard`})}function M6(e,t){let n=A6(t);return Ts({queryKey:[`team-queue-stats`,t??null],queryFn:({signal:e})=>q(`/team/queue-stats${n}`,{signal:e}),refetchInterval:Es.TEAM,pollCategory:`standard`,enabled:e,placeholderData:H})}function N6(e,t){let n=A6(t);return Ts({queryKey:[`team-sync-summary`,t??null],queryFn:({signal:e})=>q(`/team/sync-summary${n}`,{signal:e}),refetchInterval:Es.TEAM,pollCategory:`standard`,enabled:e,placeholderData:H})}function P6(e,t){let n=A6(t);return Ts({queryKey:[`team-dlq`,t??null],queryFn:({signal:e})=>q(`/team/dlq${n}`,{signal:e}),refetchInterval:Es.TEAM,pollCategory:`standard`,enabled:e,placeholderData:H})}function F6(){return Ts({queryKey:[`team-registry`],queryFn:({signal:e})=>q(`/team/registry`,{signal:e}),refetchInterval:Es.TEAM,pollCategory:`standard`})}function I6(){return Ts({queryKey:[`team-projects`],queryFn:({signal:e})=>q(`/team/projects`,{signal:e}),refetchInterval:Es.TEAM,pollCategory:`standard`})}function L6(){let e=We();return st({mutationFn:e=>ts(`/team/project-membership`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`team-registry`]}),e.invalidateQueries({queryKey:[`team-projects`]})}})}function R6(){let e=We();return st({mutationFn:e=>ts(`/team/join`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`team-registry`]}),e.invalidateQueries({queryKey:[`team-projects`]}),e.invalidateQueries({queryKey:[`team-status`]})}})}function z6(){let e=We();return st({mutationFn:e=>ts(`/team/forget`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`team-registry`]}),e.invalidateQueries({queryKey:[`team-projects`]}),e.invalidateQueries({queryKey:[`team-status`]})}})}function B6(e){let t=A6(e);return Ts({queryKey:[`team-members`,e??null],queryFn:({signal:e})=>q(`/team/members${t}`,{signal:e}),refetchInterval:Es.STATS,pollCategory:`standard`})}function V6({groveSlug:e}){let{data:t}=j6(),{data:n}=B6(),r=t?.enabled??!1,i=t?.healthy??!1,a=r?i?`default`:`destructive`:`outline`,o=r?i?`synced`:`unhealthy`:`not connected`,s=n?.members.length??0;return(0,G.jsx)(ri,{to:`/g/${e}/team`,className:`block transition-opacity hover:opacity-90`,children:(0,G.jsx)(Tj,{tone:`ochre`,eyebrow:(0,G.jsx)(E6,{Icon:yo,tone:`ochre`,children:`Team`}),title:`${s} member${s===1?``:`s`}`,children:(0,G.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(D6,{term:`Status`,children:(0,G.jsx)(X,{variant:a,children:o})}),(0,G.jsx)(D6,{term:`Pending sync`,children:(0,G.jsx)(`span`,{children:t?.pending_sync_count??0})})]})})})}function H6({groveSlug:e}){let{data:t,isLoading:n}=K_(),r=(t?.projects??[]).filter(t=>t.grove_slug===e).sort((e,t)=>(t.last_activity_at?Date.parse(t.last_activity_at):0)-(e.last_activity_at?Date.parse(e.last_activity_at):0));return(0,G.jsx)(Tj,{tone:`sage`,eyebrow:`Projects`,title:`In this Grove`,actions:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:r.length}),padded:!1,children:n&&r.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:`Loading…`}):r.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:`No projects yet.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:r.map(t=>(0,G.jsx)(`li`,{children:(0,G.jsx)(uM,{accent:`sage`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(Ia,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(ri,{to:`/g/${e}/p/${t.project_id}`,className:`block truncate text-sm text-on-surface hover:text-sage`,children:t.project_name}),(0,G.jsxs)(`div`,{className:`flex gap-x-3 text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{children:[t.scheduled_runs_last_24h,` run`,t.scheduled_runs_last_24h===1?``:`s`,` / 24h`]}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{children:[`last activity`,` `,t.last_activity_at?Z_(t.last_activity_at):`never`]})]})]}),(0,G.jsx)(X,{variant:t.is_active?`default`:`outline`,children:t.is_active?`active`:`cold`})]})})},t.project_id))})})}function U6(e){let t=Nn(),{data:n,isLoading:r}=_A({status:`active`,limit:10}),i=n?.sessions??[];return(0,G.jsx)(Tj,{tone:`sage`,eyebrow:`Active now`,title:`${i.length} ${i.length===1?`live session`:`live sessions`}`,padded:!1,children:r&&i.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:`Loading…`}):i.length===0?(0,G.jsxs)(`div`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:[(0,G.jsx)(`p`,{className:`font-medium m-0`,children:`Nothing active`}),(0,G.jsx)(`p`,{className:`text-xs m-0`,children:`No symbiont sessions are running right now in this Grove.`})]}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:i.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(uM,{accent:`sage`,onClick:()=>t(`/sessions/${e.id}`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(wk,{tone:`sage`,pulse:!0}),(0,G.jsx)(`span`,{className:`truncate text-sm text-on-surface flex-1 min-w-0`,children:e.title||`Untitled session`}),(0,G.jsx)(X,{variant:`outline`,children:e.agent}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant whitespace-nowrap`,children:Q_(e.started_at)})]}),e.branch&&(0,G.jsxs)(`div`,{className:`mt-1 ml-5 flex items-center gap-1 font-mono text-[10px] italic text-on-surface-variant`,children:[(0,G.jsx)(ka,{className:`h-2.5 w-2.5`}),e.branch]})]})},e.id))})})}function W6(e=`project`){let t=e===`all-groves`?`grove`:e;return Ts({queryKey:[`embedding-details`,t],queryFn:({signal:e})=>q(`/embedding/details?scope=${t}`,{signal:e}),refetchInterval:Es.STATS,pollCategory:`standard`})}function G6(){return Ts({queryKey:[`database-details`],queryFn:({signal:e})=>q(`/database/details`,{signal:e}),refetchInterval:Es.STATS,pollCategory:`standard`})}function K6({groveSlug:e}){let{data:t}=W6(`grove`),{data:n}=G6(),r=t?Object.values(t.pending).reduce((e,t)=>e+t,0):0;return(0,G.jsx)(Tj,{tone:`sage`,eyebrow:(0,G.jsx)(E6,{Icon:ma,tone:`sage`,children:`Grove`}),title:`Vault`,actions:(0,G.jsxs)(ri,{to:`/g/${e}/operations`,className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Operations `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,G.jsx)(Nj,{label:`Vectors`,value:t?String(t.total):`—`,tone:`sage`,mono:!0}),(0,G.jsx)(Nj,{label:`Pending`,value:String(r),tone:r>0?`ochre`:`default`,mono:!0}),(0,G.jsx)(Nj,{label:`DB size`,value:n?lv(n.file.size_bytes):`—`,tone:`sage`,mono:!0}),(0,G.jsx)(Nj,{label:`Fragmentation`,value:n?`${n.file.fragmentation_pct.toFixed(1)}%`:`—`,tone:n&&n.file.fragmentation_pct>25?`ochre`:`default`,mono:!0})]})})}function q6({error:e,isLoading:t,backups:n,last:r}){return e?`Snapshot unavailable`:t||!n?`—`:r?Z_(r.modified_at):`No backups yet`}function J6(){let e=_s(),t=e?.grove.id??null,n=(0,W.useMemo)(()=>e?ko(e):void 0,[e]),{data:r,error:i,isLoading:a}=ot({queryKey:[`backups`,t],queryFn:({signal:e})=>q(`/backups`,{signal:e,headers:n}),enabled:!!t}),o=r?.backups??null,s=o&&o.length>0?o[0]:null,c=o?o.slice(1,5):[];return(0,G.jsx)(Tj,{tone:`sage`,eyebrow:`Backup`,title:q6({error:i??null,isLoading:a,backups:o,last:s}),actions:(0,G.jsxs)(ri,{to:`/settings#backup`,className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Settings `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:i?(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0`,children:i.message}):a||!o?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`Loading…`}):s===null?(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:[`Use `,(0,G.jsx)(`span`,{className:`text-on-surface`,children:`Backup Now`}),` in Settings to create the first snapshot.`]}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-on-surface`,children:[(0,G.jsx)(Ta,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),(0,G.jsx)(`code`,{className:`font-mono truncate`,children:s.file_name})]}),(0,G.jsxs)(`div`,{className:`mt-1 flex gap-x-3 text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(ua,{className:`h-3 w-3`}),Z_(s.modified_at)]}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsx)(`span`,{children:lv(s.size_bytes)})]})]}),c.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`myco-eyebrow-sm text-outline`,children:`Recent`}),(0,G.jsx)(`ul`,{className:`mt-1 m-0 p-0 list-none flex flex-col gap-0.5`,children:c.map(e=>(0,G.jsxs)(`li`,{className:`flex justify-between text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{children:Z_(e.modified_at)}),(0,G.jsx)(`span`,{children:lv(e.size_bytes)})]},e.file_name))})]})]})})}function Y6({currentGroveSlug:e}){let{data:t,isLoading:n}=fs(),r=(t?.groves??[]).filter(t=>t.slug!==e);return n&&r.length===0?(0,G.jsx)(Tj,{tone:`ochre`,eyebrow:`Other Groves`,title:`Loading…`}):r.length===0?(0,G.jsx)(Tj,{tone:`ochre`,eyebrow:`Other Groves`,title:`Just this one`,children:(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:[`Create another with `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco grove create`}),`.`]})}):(0,G.jsx)(Tj,{tone:`ochre`,eyebrow:`Other Groves`,title:`${r.length} ${r.length===1?`sibling Grove`:`sibling Groves`}`,children:(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:r.map(e=>(0,G.jsxs)(ri,{to:`/g/${e.slug}`,className:`block rounded-md border border-[var(--ghost-border)] p-3 transition-colors hover:bg-surface-container`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(go,{className:`h-3.5 w-3.5 text-ochre`}),(0,G.jsx)(`span`,{className:`truncate text-sm font-medium text-on-surface`,children:e.name}),e.is_default&&(0,G.jsx)(X,{variant:`outline`,children:`default`})]}),(0,G.jsxs)(`div`,{className:`mt-1 flex gap-x-3 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e.slug}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{children:[e.project_count,` project`,e.project_count===1?``:`s`]})]})]},e.slug))})})}function X6(){let e=gs(),{data:t}=Fs();if(!e||!t)return(0,G.jsx)(vj,{isLoading:!0,error:null,loadingText:`Loading Grove…`,children:(0,G.jsx)(`span`,{})});let n=e.grove;return(0,G.jsxs)(bj,{children:[(0,G.jsx)(YN,{title:n.name,subtitle:`Database boundary for this set of projects. Embedding, vault, backups, and team sync are all Grove-scoped.`}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[(0,G.jsx)(O6,{name:n.name,slug:n.slug,projectCount:n.project_count??0,machineId:t.context.request.machine_id}),(0,G.jsx)(k6,{uptimeSeconds:t.daemon.uptime_seconds,port:t.daemon.port,version:t.daemon.version}),(0,G.jsx)(V6,{groveSlug:n.slug})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,G.jsx)(H6,{groveSlug:n.slug}),(0,G.jsx)(U6,{groveSlug:n.slug})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,G.jsx)(K6,{groveSlug:n.slug}),(0,G.jsx)(J6,{})]}),(0,G.jsx)(Y6,{currentGroveSlug:n.slug})]})}var Z6=[`sessions`,`spores`,`plans`,`artifacts`,`skill_records`,`canopy_entries`],Q6={},$6=20;function e8(e){return e.provider.available?Object.values(e.pending).some(e=>e>0)?`processing`:`idle`:`unavailable`}function t8(e){return e.provider.available?Object.values(e.pending).some(e=>e>0)?`bg-secondary`:`bg-primary`:`bg-tertiary`}function n8({data:e}){return(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full font-mono text-sm`,"aria-label":`Embedding namespace breakdown`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-left text-on-surface-variant`,children:[(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Namespace`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Embedded`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Pending`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Stale`}),(0,G.jsx)(`th`,{className:`pb-2 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Total`})]})}),(0,G.jsx)(`tbody`,{children:Z6.map((t,n)=>{let r=e.namespace_breakdown?.[t],i=e.by_namespace[t],a=r?.embedded??i?.embedded??0,o=r?.pending??e.pending[t]??0,s=r?.stale??i?.stale??0,c=r?.total??a+o;return(0,G.jsxs)(`tr`,{className:J(`transition-colors hover:bg-surface-container-high/50`,n%2==1?`bg-surface-container-low/30`:``),children:[(0,G.jsx)(`td`,{className:`py-2.5 pr-4`,children:Q6[t]??t}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:a}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:o>0?(0,G.jsx)(`span`,{className:`text-secondary`,children:o}):o}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:s>0?(0,G.jsx)(`span`,{className:`text-tertiary`,children:s}):s}),(0,G.jsx)(`td`,{className:`py-2.5 text-right`,children:c})]},t)})})]})})}function r8(){let e=We(),t=gs(),[n,r]=(0,W.useState)(null),i=`grove`,{data:a,isLoading:o,isError:s,error:c}=W6(`grove`),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1);function p(e,n,r,a){let o=B3(i,t);if(!(o&&W3(e,o))){r();return}u({action:n,scopeKind:i,run:r,variant:a})}let[m,h]=(0,W.useState)([]),g=a?.total??null;(0,W.useEffect)(()=>{g!==null&&h(e=>{let t=[...e,g];return t.length>$6?t.slice(-20):t})},[g]);async function _(){r(null);try{let n=await ts(`/embedding/reembed-stale`,{scope:B3(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Re-embed dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Re-embedded ${n.reembedded??0} stale vectors in ${n.passes??0} pass(es)`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${E3(e)}`})}}function v(){p(`reembed-stale`,`Re-embed stale vectors`,_)}async function y(){r(null);try{let n=await ts(`/embedding/rebuild`,{scope:B3(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Rebuild dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Rebuild cleared ${n.queued??0} vectors and re-embedded ${n.embedded??0} records (passes ${n.passes??0}, remaining ${n.remaining_queue_depth??0})`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${E3(e)}`})}}function b(){p(`rebuild`,`Rebuild all vectors`,y,`destructive`)}async function x(){r(null);try{let n=await ts(`/embedding/clean-orphans`,{scope:B3(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Clean orphans dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Cleaned ${n.orphans_cleaned??0} orphan vectors`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${E3(e)}`})}}function S(){p(`clean-orphans`,`Clean orphan vectors`,x)}async function C(){r(null);try{let n=await ts(`/embedding/reconcile`,{scope:B3(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Reconcile dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Reconcile complete: ${n.embedded??0} embedded, ${n.orphans_cleaned??0} orphans cleaned (${n.duration_ms??0}ms)`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${E3(e)}`})}}function w(){p(`reconcile`,`Force reconcile embeddings`,C)}if(!a)return(0,G.jsx)(vj,{isLoading:o,error:s?c instanceof Error?c:Error(`Unable to reach daemon`):null,loadingText:`Loading embedding details...`,children:(0,G.jsx)(`div`,{})});let T=Object.values(a.pending).reduce((e,t)=>e+t,0),E=Object.values(a.by_namespace).reduce((e,t)=>e+t.stale,0),D=a.canopy_describe?.pending??0;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-sans text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ma,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Provider`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:a.provider.name})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Model`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface truncate max-w-[200px]`,title:a.provider.model,children:a.provider.model})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:J(`h-2 w-2 rounded-full`,t8(a))}),(0,G.jsx)(`span`,{className:`text-on-surface-variant capitalize`,children:e8(a)})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3`,children:[(0,G.jsx)(v2,{label:`Total Vectors`,value:String(a.total),sparklineData:m,accent:`sage`}),(0,G.jsx)(v2,{label:`Pending`,value:String(T),accent:T>0?`ochre`:`outline`}),(0,G.jsx)(v2,{label:`Stale`,value:String(E),accent:E>0?`terracotta`:`outline`}),(0,G.jsx)(v2,{label:`Canopy Scribe`,value:String(D),sublabel:D>0?`${a.canopy_describe?.undescribed??0} new, ${a.canopy_describe?.stale??0} stale`:`fresh`,accent:D>0?`ochre`:`outline`})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsx)(MM,{children:`Namespace Breakdown`}),(0,G.jsx)(n8,{data:a})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[(0,G.jsx)(MM,{children:`Actions`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:v,children:[(0,G.jsx)(Qa,{className:`mr-2 h-4 w-4`}),`Re-embed stale`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:S,children:[(0,G.jsx)(ho,{className:`mr-2 h-4 w-4`}),`Clean orphans`]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:w,children:[(0,G.jsx)(Ja,{className:`mr-2 h-4 w-4`}),`Force reconcile`]}),(0,G.jsxs)(Y,{variant:`destructive`,size:`sm`,onClick:b,children:[(0,G.jsx)($a,{className:`mr-2 h-4 w-4`}),`Rebuild all`]})]}),n&&(0,G.jsx)(`p`,{className:J(`font-sans text-sm`,n.type===`success`?`text-primary`:`text-tertiary`),children:n.text})]}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(ri,{to:`/logs?component=embedding`,className:`font-sans text-xs text-primary hover:text-primary/80 transition-colors flex items-center gap-1`,children:`View embedding activity in Logs →`})}),l&&(0,G.jsx)(U3,{open:!0,onOpenChange:e=>{e||u(null)},action:l.action,scope:B3(l.scopeKind,t)??{kind:`all-groves`},variant:l.variant,isPending:d,onConfirm:async()=>{f(!0);try{await l.run()}finally{f(!1),u(null)}}})]})}var i8=15,a8=`insufficient_disk_space`,o8=20,s8=[`grove`,`all-groves`];function c8(e){if(e<=0)return`now`;let t=Math.floor(e/1e3);if(t<60)return t+`s`;let n=Math.floor(t/60);return n<60?n+`m`:Math.floor(n/60)+`h`}function l8({title:e,value:t,onChange:n,available:r}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(MM,{children:e}),(0,G.jsx)(L3,{value:t,onChange:n,available:r})]})}function u8({scope:e}){return(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:z3[e]})}function d8({tables:e}){let t=[...e].sort((e,t)=>t.rows-e.rows);return(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full font-mono text-sm`,"aria-label":`Database table breakdown`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-left text-on-surface-variant`,children:[(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Table`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Rows`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Indexes`}),(0,G.jsx)(`th`,{className:`pb-2 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Type`})]})}),(0,G.jsx)(`tbody`,{children:t.map((e,t)=>(0,G.jsxs)(`tr`,{className:J(`transition-colors hover:bg-surface-container-high/50`,t%2==1?`bg-surface-container-low/30`:``),children:[(0,G.jsx)(`td`,{className:`py-2.5 pr-4`,children:e.name}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:e.rows.toLocaleString()}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:e.index_count}),(0,G.jsx)(`td`,{className:`py-2.5`,children:e.is_fts?(0,G.jsx)(X,{variant:`outline`,className:`px-1.5 py-0 text-[10px] uppercase`,children:`FTS5`}):(0,G.jsx)(`span`,{className:`text-on-surface-variant/60`,children:`btree`})})]},e.name))})]})})}function f8({details:e,onActionResult:t}){let{effective:n}=LO(),r=We(),i=gs(),[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(`grove`),[l,u]=(0,W.useState)(!1);if(!n)return null;let d=n.maintenance.auto_optimize,f=n.maintenance.auto_optimize_interval_hours,p=e.last_optimize_at?new Date(e.last_optimize_at).getTime():null,m=p===null?0:p+f*q_*1e3-Date.now();async function h(){o(!0);try{let e=await ts(`/database/optimize`,{scope:B3(s,i)});if(e.summary)t({type:e.summary.failed>0?`error`:`success`,text:`Optimize dispatched across ${e.summary.ok+e.summary.failed} Grove(s); ${e.summary.failed} failed`});else{let n=e.actions_failed?.length??0;t({type:n>0?`error`:`success`,text:`Optimize complete: `+(e.actions_completed?.length??0)+` steps, `+n+` failed (`+(e.duration_ms??0)+`ms)`})}r.invalidateQueries({queryKey:[`database-details`]})}catch(e){t({type:`error`,text:`Error: `+E3(e)})}finally{o(!1)}}function g(){let e=B3(s,i);if(e&&W3(`optimize`,e)){u(!0);return}h()}return(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsx)(l8,{title:`Scheduled Maintenance`,value:s,onChange:c,available:s8}),(0,G.jsx)(u8,{scope:s}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`Auto-optimize`}),` `,d?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-primary`,children:`on`}),`, every `,f,`h.`]}):(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`off.`}),` `,(0,G.jsx)(ri,{to:`/settings#maintenance`,className:`text-primary hover:text-primary/80 transition-colors text-xs`,children:`Configure in Settings →`})]}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Last run: `,e.last_optimize_at?Z_(e.last_optimize_at):`never`,d&&p!==null&&(0,G.jsxs)(G.Fragment,{children:[` · Next: `,c8(m)]})]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:g,disabled:a,children:[(0,G.jsx)(Ja,{className:`mr-2 h-4 w-4`}),a?`Running...`:`Run now`]}),(0,G.jsx)(U3,{open:l,onOpenChange:u,action:`Optimize database`,scope:B3(s,i)??{kind:`all-groves`},isPending:a,onConfirm:async()=>{await h(),u(!1)}})]})}function p8({onActionResult:e}){let[t,n]=(0,W.useState)(!1);async function r(){n(!0);try{let t=await ts(`/api/maintenance/release-provenance/reconcile`,{});if(t.disabled){e({type:`success`,text:`Release provenance reconciliation is disabled in config.`});return}let n=t.results??[],r=n.reduce((e,t)=>({reconciled:e.reconciled+t.reconciled,unchanged:e.unchanged+t.unchanged,failed:e.failed+t.failed,errors:e.errors+ +!!t.error}),{reconciled:0,unchanged:0,failed:0,errors:0}),i=`Release reconcile: ${n.length} project(s), ${r.reconciled} updated, ${r.unchanged} unchanged${r.failed?`, ${r.failed} rows failed`:``}${r.errors?`, ${r.errors} project errors`:``}.`;e({type:r.errors>0?`error`:`success`,text:i})}catch(t){e({type:`error`,text:`Error: `+E3(t)})}finally{n(!1)}}return(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[(0,G.jsx)(MM,{children:`Release provenance`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Re-runs ancestry, patch-id, and (when configured) GitHub PR squash evidence checks for every served project. Reconciliation is idempotent — safe to invoke repeatedly. Status counts surface in each Grove's maintenance summary.`}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Y,{onClick:r,disabled:t,variant:`outline`,size:`sm`,children:t?`Reconciling...`:`Reconcile now`})})]})}function m8({onActionResult:e}){let t=We(),n=gs(),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(`grove`),[s,c]=(0,W.useState)(null);function l(e,t,r,i){let o=B3(a,n);if(!(o&&W3(e,o))){r();return}c({action:t,run:r,variant:i})}async function u(){i(!0);try{let r=await ts(`/database/integrity-check`,{scope:B3(a,n)});r.summary?e({type:r.summary.failed>0?`error`:`success`,text:`Integrity check across ${r.summary.ok+r.summary.failed} Grove(s); ${r.summary.failed} failed`}):r.status===`ok`?e({type:`success`,text:`Integrity check OK (`+(r.duration_ms??0)+`ms)`}):e({type:`error`,text:`Integrity issues: `+(r.issues?.length??0)+` problems, `+(r.fk_violations??0)+` FK violations`}),t.invalidateQueries({queryKey:[`database-details`]})}catch(t){e({type:`error`,text:`Error: `+E3(t)})}finally{i(!1)}}function d(){l(`integrity-check`,`Run integrity check`,u)}async function f(){i(!0);try{let r=await ts(`/database/vacuum`,{scope:B3(a,n)});r.summary?e({type:r.summary.failed>0?`error`:`success`,text:`Vacuum across ${r.summary.ok+r.summary.failed} Grove(s); ${r.summary.failed} failed`}):e({type:`success`,text:`Vacuum complete: freed `+lv(r.freed_bytes??0)+` in `+(r.duration_ms??0)+`ms`}),t.invalidateQueries({queryKey:[`database-details`]})}catch(t){if(t instanceof ls){let n=t.body;if(n?.error===a8){e({type:`error`,text:`Insufficient disk: need `+lv(n.required_bytes??0)+`, have `+lv(n.free_bytes??0)});return}}e({type:`error`,text:`Error: `+E3(t)})}finally{i(!1)}}function p(){l(`vacuum`,`Vacuum database`,f,`destructive`)}async function m(){i(!0);try{let r=await ts(`/database/reindex`,{scope:B3(a,n)});r.summary?e({type:r.summary.failed>0?`error`:`success`,text:`Reindex across ${r.summary.ok+r.summary.failed} Grove(s); ${r.summary.failed} failed`}):e({type:`success`,text:`Reindex complete (`+(r.duration_ms??0)+`ms)`}),t.invalidateQueries({queryKey:[`database-details`]})}catch(t){e({type:`error`,text:`Error: `+E3(t)})}finally{i(!1)}}function h(){l(`reindex`,`Reindex database`,m)}return(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[(0,G.jsx)(l8,{title:`Actions`,value:a,onChange:o,available:s8}),(0,G.jsx)(u8,{scope:a}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:d,disabled:r,children:[(0,G.jsx)(Qa,{className:`mr-2 h-4 w-4`}),`Integrity check`]}),(0,G.jsxs)(Y,{variant:`destructive`,size:`sm`,onClick:p,disabled:r,children:[(0,G.jsx)(ho,{className:`mr-2 h-4 w-4`}),`Vacuum`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:h,disabled:r,children:[(0,G.jsx)($a,{className:`mr-2 h-4 w-4`}),`Reindex`]})]}),s&&(0,G.jsx)(U3,{open:!0,onOpenChange:e=>{e||c(null)},action:s.action,scope:B3(a,n)??{kind:`all-groves`},variant:s.variant,isPending:r,onConfirm:async()=>{await s.run(),c(null)}})]})}function h8(){let{data:e,isLoading:t,isError:n,error:r}=G6(),[i,a]=(0,W.useState)([]),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(`grove`);if((0,W.useEffect)(()=>{e&&a(t=>{let n=[...t,e.file.size_bytes];return n.length>o8?n.slice(-20):n})},[e]),t)return(0,G.jsx)(`div`,{className:`text-on-surface-variant`,children:`Loading database details...`});if(n)return(0,G.jsxs)(`div`,{className:`text-tertiary`,children:[`Error: `,r.message]});if(!e)return null;let u=e.file.fragmentation_pct.toFixed(1)+`%`,d=e.file.fragmentation_pct>i8?`ochre`:`outline`;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-sans text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ha,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Database`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:`myco.db`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Schema`}),(0,G.jsxs)(`span`,{className:`font-mono text-on-surface`,children:[`v`,e.schema.version]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Journal`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface uppercase`,children:e.schema.journal_mode})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`h-2 w-2 rounded-full bg-primary`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`healthy`})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-3`,children:[(0,G.jsx)(v2,{label:`Database Size`,value:lv(e.file.size_bytes),sparklineData:i,accent:`sage`}),(0,G.jsx)(v2,{label:`Fragmentation`,value:u,accent:d}),(0,G.jsx)(v2,{label:`WAL Size`,value:lv(e.file.wal_size_bytes),accent:`outline`})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsx)(l8,{title:`Schema Breakdown`,value:c,onChange:l,available:s8}),(0,G.jsx)(u8,{scope:c}),(0,G.jsx)(d8,{tables:e.tables})]}),(0,G.jsx)(f8,{details:e,onActionResult:s}),(0,G.jsx)(p8,{onActionResult:s}),(0,G.jsx)(m8,{onActionResult:s}),o&&(0,G.jsx)(`p`,{className:J(`font-sans text-sm`,o.type===`success`?`text-primary`:`text-tertiary`),children:o.text}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(ri,{to:`/logs?component=database`,className:`font-sans text-xs text-primary hover:text-primary/80 transition-colors flex items-center gap-1`,children:`View database activity in Logs →`})})]})}var g8=[{id:`embedding`,label:`Embedding`,description:`queues + namespaces`},{id:`database`,label:`Database`,description:`file health + maintenance`}],_8=new Set([`embedding`,`database`]),v8={embedding:`Provider, queues, namespaces. Each action runs against the active Grove.`,database:`File health, tables, schedule, and on-demand maintenance for this Grove’s SQLite store.`},y8=`tab`;function b8(){let e=new URLSearchParams(window.location.search).get(y8);return e&&_8.has(e)?e:`embedding`}function x8(e){let t=new URLSearchParams;e!==`embedding`&&t.set(y8,e);let n=t.toString(),r=n?`${window.location.pathname}?${n}`:window.location.pathname;window.history.replaceState(null,``,r)}function S8(){let e=We(),[t,n]=(0,W.useState)(b8),r=(0,W.useCallback)(e=>{let t=e;n(t),x8(t)},[]),i=(0,W.useCallback)(()=>{e.invalidateQueries({queryKey:[`embedding-details`]}),e.invalidateQueries({queryKey:[`database-details`]})},[e]);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsxs)(`div`,{className:`px-6 pt-6 space-y-6`,children:[(0,G.jsx)(YN,{title:`Operations`,subtitle:v8[t],actions:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,children:[(0,G.jsx)(Qa,{size:14}),`Refresh`]})}),(0,G.jsx)(PP,{tabs:g8.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:t,onTabChange:r,columns:2})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,G.jsxs)(`div`,{className:`px-6 pb-6`,children:[t===`embedding`&&(0,G.jsx)(r8,{}),t===`database`&&(0,G.jsx)(h8,{})]})})]})}var C8=[{value:`15m`,label:`15m`},{value:`1h`,label:`1h`},{value:`6h`,label:`6h`},{value:`24h`,label:`24h`},{value:`7d`,label:`7d`},{value:`30d`,label:`30d`}];function w8({mode:e,onModeChange:t,searchValue:n,onSearchChange:r,onSearchSubmit:i,activeLevel:a,onLevelChange:o,components:s,activeComponents:c,onComponentToggle:l,onComponentsClear:u,timeRange:d,onTimeRangeChange:f,totalResults:p,paused:m=!1,onPausedToggle:h}){return(0,G.jsxs)(Q,{level:`default`,className:`rounded-md p-3 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center rounded-md bg-surface-container-low`,children:[(0,G.jsxs)(Y,{size:`sm`,variant:e===`live`?`default`:`ghost`,className:`h-7 gap-1.5 px-2.5 text-xs rounded-r-none`,onClick:()=>t(`live`),children:[(0,G.jsx)(Za,{className:`h-3 w-3`}),`Live`]}),(0,G.jsxs)(Y,{size:`sm`,variant:e===`search`?`default`:`ghost`,className:`h-7 gap-1.5 px-2.5 text-xs rounded-l-none`,onClick:()=>t(`search`),children:[(0,G.jsx)(no,{className:`h-3 w-3`}),`Search`]})]}),e===`live`&&h&&(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`h-7 gap-1.5 px-2.5 text-xs`,onClick:h,"aria-label":m?`Resume log stream`:`Pause log stream`,title:m?`Resume`:`Pause`,children:[m?(0,G.jsx)(Ja,{className:`h-3 w-3`}):(0,G.jsx)(qa,{className:`h-3 w-3`}),m?`Resume`:`Pause`]}),e===`search`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-5 w-px bg-outline-variant/30`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(ua,{className:`h-3 w-3 text-on-surface-variant/50`}),C8.map(e=>(0,G.jsx)(Y,{size:`sm`,variant:d===e.value?`default`:`ghost`,className:`h-6 px-1.5 text-[10px]`,onClick:()=>f(e.value),children:e.label},e.value))]})]}),(0,G.jsx)(`form`,{className:`ml-auto flex items-center gap-1.5`,onSubmit:e=>{e.preventDefault(),i()},children:(0,G.jsx)(Kf,{className:`h-7 w-56 text-xs`,placeholder:e===`search`?`Search logs...`:`Filter messages...`,value:n,onChange:e=>r(e.target.value),"aria-label":`Search log messages`})}),e===`search`&&p!==void 0&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-on-surface-variant/50 tabular-nums whitespace-nowrap`,children:[p.toLocaleString(),` results`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:ks.map(e=>(0,G.jsxs)(Y,{size:`sm`,variant:a===e?`default`:`ghost`,className:`h-6 px-2 text-[10px] capitalize gap-1.5`,onClick:()=>o(e),children:[(0,G.jsx)(`div`,{className:J(`h-1.5 w-1.5 rounded-full`,Ps(e))}),e]},e))}),s.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-4 w-px bg-outline-variant/20`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 flex-wrap`,children:[s.map(e=>(0,G.jsx)(Y,{size:`sm`,variant:c.has(e)?`default`:`ghost`,className:`h-5 px-1.5 text-[10px]`,onClick:()=>l(e),children:e},e)),c.size>0&&(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-5 px-1.5 text-[10px] text-on-surface-variant`,onClick:u,children:`clear`})]})]})]})]})}var T8={debug:`border-l-outline/30`,info:`border-l-primary/50`,warn:`border-l-secondary/70`,error:`border-l-tertiary/80`},E8={context:`text-primary/70`,hooks:`text-on-surface-variant/70`,agent:`text-secondary/80`,daemon:`text-on-surface-variant/60`,capture:`text-primary/60`,processor:`text-on-surface-variant/70`,lifecycle:`text-primary/50`,embedding:`text-on-surface-variant/60`,power:`text-on-surface-variant/50`,server:`text-on-surface-variant/60`};function D8(e,t){if(t)return Z_(e);let n=new Date(e);return`${String(n.getHours()).padStart(2,`0`)}:${String(n.getMinutes()).padStart(2,`0`)}:${String(n.getSeconds()).padStart(2,`0`)}`}var O8=40,k8=60;function A8(e){return typeof e==`string`&&e.length>0?e:null}var j8=[{pick:e=>A8(e.tool_name)},{pick:e=>A8(e.type)},{pick:e=>A8(e.agent_type)},{pick:e=>A8(e.task_subject),format:e=>ev(e,O8)},{pick:e=>A8(e.filename)},{pick:e=>A8(e.source_path)??A8(e.path),format:nv},{pick:e=>A8(e.error),format:e=>ev(e,k8)},{pick:e=>typeof e.pid==`number`?`pid ${e.pid}`:null}];function M8(e){if(!e)return``;for(let{pick:t,format:n}of j8){let r=t(e);if(r)return n?n(r):r}return``}function N8({entries:e,selectedId:t,onSelect:n,autoScroll:r=!1,relativeTime:i=!1,compact:a=!0}){let o=(0,W.useRef)(null);return(0,W.useEffect)(()=>{!r||!o.current||(o.current.scrollTop=o.current.scrollHeight)},[e,r]),(0,G.jsx)(`div`,{ref:o,className:`flex-1 overflow-y-auto bg-surface-container-lowest font-mono text-xs`,children:e.length===0?(0,G.jsx)(`div`,{className:`flex h-full min-h-[200px] items-center justify-center text-on-surface-variant/50 font-sans text-sm`,children:`No log entries`}):(0,G.jsxs)(`table`,{className:`w-full border-collapse`,"aria-label":`Log entries`,children:[(0,G.jsx)(`thead`,{className:`sticky top-0 z-10 bg-surface-container-lowest/95 backdrop-blur supports-[backdrop-filter]:bg-surface-container-lowest/80`,children:(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/10 text-[10px] uppercase tracking-[0.16em] text-on-surface-variant/50`,children:[(0,G.jsx)(`th`,{className:`w-[68px] px-3 py-2 text-left font-medium`,children:`Time`}),(0,G.jsx)(`th`,{className:`w-[12px] px-0 py-2`,"aria-hidden":`true`}),(0,G.jsx)(`th`,{className:`w-[48px] px-0 py-2 text-left font-medium`,children:`Level`}),(0,G.jsx)(`th`,{className:`w-[90px] px-0 py-2 text-left font-medium`,children:`Area`}),(0,G.jsx)(`th`,{className:`w-[72px] px-0 py-2 text-left font-medium`,children:`Session`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Message`})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsx)(P8,{entry:e,selected:e.id===t,onSelect:n,relativeTime:i,compact:a},e.id))})]})})}var P8=(0,W.memo)(function({entry:e,selected:t,onSelect:n,relativeTime:r,compact:i}){let a=i?`py-0.5`:`py-1.5`,o=tv(e.session_id),s=M8(e.data);return(0,G.jsxs)(`tr`,{className:J(`cursor-pointer transition-colors border-l-2`,T8[e.level],t?`bg-primary/10`:`hover:bg-surface-container-high/30`),onClick:()=>n(e),children:[(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pl-3 pr-2 text-on-surface-variant/50 align-top w-[68px] tabular-nums`,a),children:D8(e.timestamp,r)}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-1 align-top w-[12px]`,a),children:(0,G.jsx)(`div`,{className:J(`h-1.5 w-1.5 rounded-full mt-1`,Ps(e.level))})}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-2 align-top w-[48px]`,a),children:(0,G.jsx)(X,{variant:Ns(e.level),className:`px-1 py-0 text-[9px] uppercase`,children:e.level})}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-2 align-top w-[90px] truncate max-w-[90px]`,a,E8[e.component]??`text-on-surface-variant/60`),children:e.component}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-2 align-top w-[72px] tabular-nums text-on-surface-variant/40`,a),title:e.session_id??``,children:o}),(0,G.jsxs)(`td`,{className:J(`pr-3 text-on-surface align-top break-words`,a),children:[(0,G.jsx)(`span`,{children:e.message}),s&&(0,G.jsxs)(`span`,{className:`ml-2 text-on-surface-variant/50`,children:[`· `,s]})]})]})});function F8({value:e}){let t=String(e),n=t.slice(0,8);return(0,G.jsxs)(ri,{to:`/sessions/${t}`,className:`font-mono text-primary hover:underline`,children:[n,`...`]})}function I8({value:e}){return Array.isArray(e)?(0,G.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.map((e,t)=>(0,G.jsx)(X,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:String(e)},t))}):(0,G.jsx)(`span`,{children:String(e)})}function L8({value:e}){return Array.isArray(e)?(0,G.jsx)(`span`,{className:`flex gap-1`,children:e.map((e,t)=>(0,G.jsx)(X,{variant:`outline`,className:`text-[10px] px-1.5 py-0 tabular-nums`,children:String(e)},t))}):(0,G.jsx)(`span`,{children:String(e)})}function R8({value:e}){return(0,G.jsx)(`span`,{className:`rounded bg-tertiary/10 px-2 py-0.5 text-tertiary font-mono text-[11px]`,children:String(e)})}function z8({value:e}){return(0,G.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded bg-surface-container-lowest px-2 py-1 text-[11px] font-mono text-on-surface-variant whitespace-pre-wrap`,children:String(e)})}function B8({value:e}){let t=new Date(String(e)),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),a=Math.floor(i/24),o;return o=r<1?`just now`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${a}d ago`,(0,G.jsx)(`span`,{className:`tabular-nums`,title:t.toISOString(),children:o})}function V8({value:e}){return typeof e==`object`&&e?(0,G.jsx)(`pre`,{className:`text-[11px] font-mono text-on-surface-variant whitespace-pre-wrap`,children:JSON.stringify(e,null,2)}):(0,G.jsx)(`span`,{children:String(e)})}var H8={session_id:F8,spore_titles:I8,scores:L8,error:R8,preview:z8,generated_at:B8,text:z8},U8=new Set([`id`,`timestamp`,`level`,`kind`,`component`,`message`]);function W8(e,t){return(0,G.jsx)(H8[e]??V8,{value:t})}function G8(e){return U8.has(e)}function K8(e){return e?Object.entries(e).filter(([e])=>!G8(e)):[]}var q8={debug:`text-on-surface-variant/60`,info:`text-primary`,warn:`text-secondary`,error:`text-tertiary`};function J8({entry:e,resolved:t,onClose:n}){let r=K8(e.data);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col bg-surface-container-low`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(X,{variant:`outline`,className:`text-[10px] px-1.5 py-0 font-mono`,children:e.kind}),(0,G.jsx)(`span`,{className:J(`text-xs font-medium`,q8[e.level]),children:e.level.toUpperCase()})]}),(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0`,onClick:n,"aria-label":`Close detail panel`,children:(0,G.jsx)(So,{className:`h-3.5 w-3.5`})})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-3 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5`,children:`Timestamp`}),(0,G.jsx)(`div`,{className:`font-mono text-xs tabular-nums`,children:new Date(e.timestamp).toLocaleString()})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5`,children:`Message`}),(0,G.jsx)(`div`,{className:`text-sm text-on-surface leading-relaxed`,children:e.message})]}),e.session_id&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5`,children:`Session`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[W8(`session_id`,e.session_id),!!t?.session_title&&(0,G.jsx)(`span`,{className:`text-on-surface-variant/70`,children:String(t.session_title)})]})]}),r.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-1.5`,children:`Metadata`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:r.map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] text-on-surface-variant/40 mb-0.5`,children:e}),(0,G.jsx)(`div`,{className:`text-xs`,children:W8(e,t)})]},e))})]})]}),(0,G.jsx)(`div`,{className:`px-4 py-2 border-t border-outline-variant/10`,children:(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant/40 tabular-nums`,children:[`id: `,e.id]})})]})}var Y8=5e3;function X8(e=!1){let[t,n]=(0,W.useState)([]),r=(0,W.useRef)(null),{data:i,refetch:a}=Ts({queryKey:[`logs-stream`],queryFn:({signal:e})=>q(r.current===null?`/logs/stream`:`/logs/stream?since=${r.current}`,{signal:e}),pollCategory:`realtime`,refetchInterval:e?!1:Es.LOGS,contextFree:!0}),o=(0,W.useRef)(e);return(0,W.useEffect)(()=>{o.current&&!e&&a(),o.current=e},[e,a]),(0,W.useEffect)(()=>{if(!i?.entries.length){i&&r.current===null&&(r.current=i.cursor);return}r.current=i.cursor,n(e=>{let t=[...e,...i.entries];return t.length>Y8?t.slice(-5e3):t})},[i]),{entries:t,clear:(0,W.useCallback)(()=>{n([]),r.current=null},[])}}function Z8(e,t){let n=new URLSearchParams;return e.q&&n.set(`q`,e.q),e.level&&n.set(`level`,e.level),e.component&&n.set(`component`,e.component),e.kind&&n.set(`kind`,e.kind),e.session_id&&n.set(`session_id`,e.session_id),e.from&&n.set(`from`,e.from),e.to&&n.set(`to`,e.to),e.page&&n.set(`page`,String(e.page)),e.page_size&&n.set(`page_size`,String(e.page_size)),ot({queryKey:[`logs-search`,Object.fromEntries(n)],queryFn:({signal:e})=>q(`/logs/search?${n.toString()}`,{signal:e}),enabled:t})}function Q8(e){return ot({queryKey:[`log-detail`,e],queryFn:({signal:t})=>q(`/logs/${e}`,{signal:t}),enabled:e!==null})}function $8(e){return new Date(Date.now()-({"15m":15*6e4,"1h":60*6e4,"6h":360*6e4,"24h":1440*6e4,"7d":10080*6e4,"30d":720*60*6e4}[e]??1440*6e4)).toISOString()}function e5(){let e=(0,W.useMemo)(()=>{let e=new URLSearchParams(window.location.search),t=e.get(`component`)?.split(`,`).filter(Boolean)??[],n=e.get(`level`),r=e.get(`q`)??``;return{components:t,level:n,q:r,hasFilters:t.length>0||!!n||!!r}},[]),[t,n]=(0,W.useState)(e.hasFilters?`search`:`live`),[r,i]=(0,W.useState)(e.q),[a,o]=(0,W.useState)(e.q),[s,c]=(0,W.useState)(e.level??`debug`),[l,u]=(0,W.useState)(new Set(e.components)),[d,f]=(0,W.useState)(`24h`),[p,m]=(0,W.useState)(1),[h,g]=(0,W.useState)(null),[_,v]=(0,W.useState)(!1),{entries:y,clear:b}=X8(_),{data:x}=Z8((0,W.useMemo)(()=>({q:a||void 0,level:s===`debug`?void 0:s,component:l.size>0?Array.from(l).join(`,`):void 0,from:$8(d),page:p,page_size:50}),[a,s,l,d,p]),t===`search`),{data:S}=Q8(h?.id??null),[C,w]=(0,W.useState)(e.components);(0,W.useEffect)(()=>{let e=t===`live`?y:x?.entries??[];w(t=>{let n=new Set(t),r=!1;for(let t of e)n.has(t.component)||(n.add(t.component),r=!0);return r?Array.from(n).sort():t})},[y,x,t]);let T=(0,W.useMemo)(()=>{let e=As[s]??0,t=r.trim().toLowerCase();return y.filter(n=>!((As[n.level]??0)<e||l.size>0&&!l.has(n.component)||t&&!n.message.toLowerCase().includes(t)))},[y,s,l,r]),E=t===`live`?T:x?.entries??[],D=(0,W.useCallback)(e=>{n(e),g(null),e===`live`&&(b(),v(!1))},[b]),O=(0,W.useCallback)(()=>{o(r),m(1)},[r]),k=(0,W.useCallback)(e=>{g(t=>t?.id===e.id?null:e)},[]),A=(0,W.useCallback)(e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),m(1)},[]),j=(0,W.useCallback)(e=>{c(e),m(1)},[]),M=h!==null;return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsx)(`div`,{className:`px-6 pt-6`,children:(0,G.jsx)(YN,{title:`Logs`,subtitle:`Daemon log explorer`})}),(0,G.jsx)(`div`,{className:`px-6 mb-3`,children:(0,G.jsx)(w8,{mode:t,onModeChange:D,searchValue:r,onSearchChange:i,onSearchSubmit:O,activeLevel:s,onLevelChange:j,components:C,activeComponents:l,onComponentToggle:A,onComponentsClear:()=>{u(new Set),m(1)},timeRange:d,onTimeRangeChange:e=>{f(e),m(1)},totalResults:t===`search`?x?.total:void 0,paused:_,onPausedToggle:()=>v(e=>!e)})}),(0,G.jsx)(`div`,{className:`flex flex-1 overflow-hidden mx-6 mb-6 rounded-lg border border-outline-variant/10`,children:(0,G.jsxs)(`div`,{className:`flex flex-col w-full`,children:[(0,G.jsx)(N8,{entries:E,selectedId:h?.id??null,onSelect:k,autoScroll:t===`live`&&!_,relativeTime:t===`live`,compact:!0}),t===`search`&&x&&(0,G.jsx)(`div`,{className:`border-t border-outline-variant/10 px-3 py-2 bg-surface-container-low`,children:(0,G.jsx)(fM,{total:x.total,offset:(p-1)*50,limit:50,onPageChange:e=>m(Math.floor(e/50)+1)})})]})}),(0,G.jsx)(SP,{open:M&&!!h,onClose:()=>g(null),ariaLabel:`Log entry detail`,children:h&&(0,G.jsx)(J8,{entry:h,resolved:S?.resolved,onClose:()=>g(null)})})]})}function t5({title:e,scope:t,meta:n,loading:r,error:i,empty:a,emptyText:o,children:s}){let c=(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(MM,{children:e}),t&&(0,G.jsx)(dk,{scope:t})]});return r?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[c,(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading…`})]}):i?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[c,(0,G.jsxs)(`p`,{className:`font-sans text-sm text-tertiary`,children:[`Failed to load: `,i.message]})]}):a?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[c,(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:o})]}):(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[c,n]}),t&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:R3[t]}),s]})}function n5({primary:e,meta:t}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-3 rounded-md bg-surface-container-low/40 p-3`,children:[(0,G.jsx)(`div`,{className:`min-w-0 space-y-1`,children:e}),(0,G.jsx)(`div`,{className:`flex flex-col items-end gap-0.5 text-right font-sans text-xs`,children:t})]})}function r5(e,t){if(!e)return!0;let n=Date.parse(e);return Number.isFinite(n)?Date.now()-n>t*60*60*1e3:!0}function i5(e){let{flags:t}=e;return t.error_count>0||t.integrity_issues>0?{label:`Issues detected`,icon:oo,tone:`error`}:t.backup_overdue>0||t.optimize_overdue>0?{label:`Maintenance overdue`,icon:ra,tone:`warn`}:{label:`All Groves healthy`,icon:oa,tone:`ok`}}function a5({row:e,thresholds:t}){let n=!e.error&&r5(e.last_backup_at,t.backup_overdue_hours),r=!e.error&&r5(e.last_optimize_at,t.optimize_overdue_hours),i=e.last_integrity_check?.status===`issues`;return(0,G.jsx)(n5,{primary:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface truncate`,children:e.grove.name}),(0,G.jsx)(X,{variant:`outline`,className:`px-1.5 py-0 text-[10px] uppercase`,children:e.grove.mode}),e.error&&(0,G.jsx)(X,{variant:`outline`,className:`border-tertiary px-1.5 py-0 text-[10px] uppercase text-tertiary`,children:`error`})]}),e.error?(0,G.jsx)(`p`,{className:`font-sans text-xs text-tertiary truncate`,title:e.error,children:e.error}):(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[e.project_count,` project`,e.project_count===1?``:`s`,` · `,lv(e.db_size_bytes),e.embedding_pending===null?(0,G.jsxs)(G.Fragment,{children:[` · `,(0,G.jsx)(`span`,{className:`text-tertiary`,children:`embedding signal unavailable`})]}):e.embedding_pending>0?(0,G.jsxs)(G.Fragment,{children:[` · `,(0,G.jsxs)(`span`,{className:`text-secondary`,children:[e.embedding_pending,` pending`]})]}):null]})]}),meta:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:J(`text-on-surface-variant`,n&&`text-secondary`),children:[`backup: `,e.last_backup_at?Z_(e.last_backup_at):`never`]}),(0,G.jsxs)(`span`,{className:J(`text-on-surface-variant`,r&&`text-secondary`),children:[`optimize: `,e.last_optimize_at?Z_(e.last_optimize_at):`never`]}),(0,G.jsxs)(`span`,{className:J(`text-on-surface-variant`,i&&`text-tertiary`),children:[`integrity:`,` `,e.last_integrity_check?`${e.last_integrity_check.status} · ${Z_(e.last_integrity_check.at)}`:`never`]})]})})}function o5(){let{data:e,isLoading:t,isError:n,error:r}=G_(),i=n?r instanceof Error?r:Error(`unknown error`):null,a=e?i5(e):null,o=a?.icon;return(0,G.jsx)(t5,{title:`Groves Overview`,scope:`all-groves`,loading:t,error:i,empty:!!e&&e.groves.length===0,emptyText:`No Groves are registered yet.`,meta:a&&o&&(0,G.jsxs)(`div`,{className:J(`flex items-center gap-1.5 font-sans text-xs`,a.tone===`ok`&&`text-primary`,a.tone===`warn`&&`text-secondary`,a.tone===`error`&&`text-tertiary`),children:[(0,G.jsx)(o,{className:`h-3.5 w-3.5`}),a.label]}),children:e&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 font-sans text-xs`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(ha,{className:`h-3.5 w-3.5 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Groves`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:e.groves.length})]}),e.flags.backup_overdue>0&&(0,G.jsxs)(`span`,{className:`text-secondary`,children:[e.flags.backup_overdue,` backup overdue`]}),e.flags.optimize_overdue>0&&(0,G.jsxs)(`span`,{className:`text-secondary`,children:[e.flags.optimize_overdue,` optimize overdue`]}),e.flags.integrity_issues>0&&(0,G.jsxs)(`span`,{className:`text-tertiary`,children:[e.flags.integrity_issues,` integrity issue`,e.flags.integrity_issues===1?``:`s`]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:e.groves.map(t=>(0,G.jsx)(a5,{row:t,thresholds:e.thresholds},t.grove.id))})]})})}function s5({row:e}){return(0,G.jsx)(n5,{primary:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface truncate`,children:e.project_name}),(0,G.jsx)(X,{variant:`outline`,className:J(`px-1.5 py-0 text-[10px] uppercase`,e.is_active?`border-primary text-primary`:`border-on-surface-variant text-on-surface-variant`),children:e.is_active?`active`:`cold`})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant truncate`,title:e.project_root,children:e.project_root})]}),meta:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[`last activity: `,e.last_activity_at?Z_(e.last_activity_at):`never`]}),(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[e.scheduled_runs_last_24h,` run`,e.scheduled_runs_last_24h===1?``:`s`,` / 24h`]})]})})}function c5(){let{data:e,isLoading:t,isError:n,error:r}=K_(),i=n?r instanceof Error?r:Error(`unknown error`):null,a=e?.projects.filter(e=>e.is_active).length??0,o=(e?.projects.length??0)-a;return(0,G.jsx)(t5,{title:`Project Activity`,scope:`all-groves`,loading:t,error:i,empty:!!e&&e.projects.length===0,emptyText:`No projects are registered yet.`,meta:e&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(Gi,{className:`h-3.5 w-3.5`}),`window: `,e.active_window_days,`d`]}),children:e&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 font-sans text-xs`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Active`}),(0,G.jsx)(`span`,{className:`font-mono text-primary`,children:a})]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Cold`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface-variant`,children:o})]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:e.projects.map(e=>(0,G.jsx)(s5,{row:e},`${e.grove_id}:${e.project_id}`))}),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Cold projects skip scheduled agent tasks. Configure the window in Settings under `,(0,G.jsx)(`span`,{className:`font-mono`,children:`agent.cold_project_threshold_days`}),`.`]})]})})}function l5(e){if(!Number.isFinite(e)||e<=0)return`—`;let t=Math.floor(e);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<48?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function u5(){let{data:e}=Fs();if(!e)return(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ro,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(MM,{children:`Daemon`})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading…`})]});let{pid:t,port:n,version:r,uptime_seconds:i,active_sessions:a}=e.daemon;return(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ro,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(MM,{children:`Daemon`})]}),(0,G.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-6 gap-y-3 sm:grid-cols-3`,children:[(0,G.jsx)(d5,{label:`PID`,value:String(t),mono:!0}),(0,G.jsx)(d5,{label:`Running port`,value:String(n),mono:!0}),(0,G.jsx)(d5,{label:`Version`,value:r,mono:!0}),(0,G.jsx)(d5,{label:`Uptime`,value:l5(i)}),(0,G.jsx)(d5,{label:`Active sessions`,value:String(a.length)})]})]})}function d5({label:e,value:t,mono:n=!1}){return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`font-sans text-[11px] uppercase tracking-wider text-on-surface-variant`,children:e}),(0,G.jsx)(`dd`,{className:J(`mt-0.5 text-sm text-on-surface`,n&&`font-mono`),children:t})]})}function f5(){return(0,G.jsxs)(bj,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(ma,{className:`h-5 w-5 text-primary`}),(0,G.jsx)(YN,{title:`Machine`,subtitle:`Status of the Myco daemon and every Grove on this machine.`,className:`flex-1 pb-0`})]}),(0,G.jsx)(u5,{}),(0,G.jsx)(o5,{}),(0,G.jsx)(c5,{})]})}function p5({label:e,value:t,mono:n=!0}){let[r,i]=(0,W.useState)(`idle`),a=(0,W.useRef)(null),o=(0,W.useCallback)(()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},[]);(0,W.useEffect)(()=>o,[o]);let s=(0,W.useCallback)(()=>{o(),navigator.clipboard.writeText(t).then(()=>{i(`copied`),a.current=setTimeout(()=>i(`idle`),2e3)},()=>{i(`failed`),a.current=setTimeout(()=>i(`idle`),2e3)})},[t,o]);return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant`,children:e}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 group`,children:[(0,G.jsx)(`span`,{className:`text-sm text-on-surface break-all ${n?`font-mono`:``}`,children:t}),(0,G.jsxs)(`button`,{type:`button`,onClick:s,className:`shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface opacity-0 group-hover:opacity-100 transition-opacity`,title:r===`failed`?`Copy failed — check clipboard permissions`:`Copy to clipboard`,"aria-live":`polite`,children:[r===`copied`&&(0,G.jsx)(Qi,{className:`h-3.5 w-3.5 text-primary`}),r===`failed`&&(0,G.jsx)(So,{className:`h-3.5 w-3.5 text-error`}),r===`idle`&&(0,G.jsx)(pa,{className:`h-3.5 w-3.5`})]})]})]})}function m5({team:e,onLeave:t,leaving:n}){let r=e.projects.length,i=`myco-team update --team-id ${e.team_id} --observability`;return(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-[var(--ghost-border)] px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-on-surface`,children:e.name}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface-variant break-all`,children:e.worker_url}),e.has_deployment&&(0,G.jsx)(`div`,{className:`mt-2`,children:(0,G.jsx)(p5,{label:`Update command`,value:i})})]}),(0,G.jsxs)(`div`,{className:`flex flex-col items-end gap-2 shrink-0`,children:[(0,G.jsxs)(X,{variant:`outline`,children:[r,` project`,r===1?``:`s`]}),(0,G.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>t(e),className:`text-xs text-on-surface-variant hover:text-terracotta-text transition-colors disabled:opacity-50`,children:`Leave team`})]})]})}function h5({project:e,teams:t,disabled:n,onChange:r}){let i=e.team_id??``;return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-[var(--ghost-border)] px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-on-surface truncate`,children:e.project_name}),(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant truncate`,children:e.grove_name})]}),(0,G.jsxs)(`select`,{className:`shrink-0 rounded-md border border-[var(--ghost-border)] bg-surface-container px-3 py-1.5 text-xs text-on-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 disabled:opacity-50`,value:i,disabled:n,"aria-label":`Team for ${e.project_name}`,onChange:e=>r(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`Not synced`}),t.map(e=>(0,G.jsx)(`option`,{value:e.team_id,children:e.name},e.team_id))]})]})}function g5(){let{data:e,isLoading:t}=F6(),{data:n,isLoading:r}=I6(),i=L6(),a=R6(),o=z6(),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(``),[p,m]=(0,W.useState)(``),[h,g]=(0,W.useState)(null),_=e?.teams??[],v=n?.projects??[],y=i.isPending,b=async()=>{g(null);try{await a.mutateAsync({worker_url:d.trim(),team_key:p.trim()}),f(``),m(``)}catch(e){g(e instanceof Error?e.message:String(e))}},x=async e=>{let t=e.has_deployment?`Leave "${e.name}"? This removes it from this machine only — the worker keeps running. Use "myco-team destroy" to delete the worker.`:`Leave "${e.name}"? This removes it from this machine and stops syncing your projects to it.`;if(window.confirm(t)){u(null),c(e.team_id);try{await o.mutateAsync({team_id:e.team_id})}catch(e){u(e instanceof Error?e.message:String(e))}finally{c(null)}}},S=async(e,t)=>{let n=e.team_id??``;if(t!==n){u(null);try{n&&await i.mutateAsync({team_id:n,grove_id:e.grove_id,project_id:e.project_id,action:`remove`}),t!==``&&await i.mutateAsync({team_id:t,grove_id:e.grove_id,project_id:e.project_id,action:`add`})}catch(e){u(e instanceof Error?e.message:String(e))}}};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(Tj,{tone:`sage`,eyebrow:(0,G.jsx)(E6,{Icon:Ga,children:`Teams`}),title:`Registered teams`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 mb-4`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Join a team a teammate shared with you. Paste the Worker URL and Team key — no extra install required.`}),(0,G.jsx)(`label`,{className:`myco-eyebrow-sm text-on-surface-variant`,htmlFor:`join-worker-url`,children:`Worker URL`}),(0,G.jsx)(`input`,{id:`join-worker-url`,"aria-label":`Worker URL`,className:`rounded-md border border-[var(--ghost-border)] bg-surface-container px-3 py-1.5 text-xs text-on-surface`,value:d,onChange:e=>f(e.target.value),placeholder:`https://team.example.workers.dev`}),(0,G.jsx)(`label`,{className:`myco-eyebrow-sm text-on-surface-variant`,htmlFor:`join-team-key`,children:`Team key`}),(0,G.jsx)(`input`,{id:`join-team-key`,"aria-label":`Team key`,type:`password`,className:`rounded-md border border-[var(--ghost-border)] bg-surface-container px-3 py-1.5 text-xs text-on-surface`,value:p,onChange:e=>m(e.target.value)}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Y,{size:`sm`,disabled:a.isPending||!d.trim()||!p.trim(),onClick:b,children:a.isPending?`Joining…`:`Join team`})}),h&&(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0`,"data-testid":`team-join-error`,children:h})]}),t&&_.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`Loading teams…`}):_.length===0?(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:[`No teams yet. An operator provisions one with `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco-team install`}),`, or join one a teammate shared with you using the form above.`]}):(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:_.map(e=>(0,G.jsx)(m5,{team:e,onLeave:x,leaving:s===e.team_id},e.team_id))})]}),(0,G.jsxs)(Tj,{tone:`sage`,eyebrow:(0,G.jsx)(E6,{Icon:Oa,children:`Projects`}),title:`Assign projects to a team`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0 mb-3`,children:`Choose which team each project syncs to. Moving a project removes it from its current team before adding it to the new one.`}),r&&v.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`Loading projects…`}):v.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(wj,{size:`sm`,children:`No projects`}),(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`No projects are registered with this daemon yet.`})]}):(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:v.map(e=>(0,G.jsx)(h5,{project:e,teams:_,disabled:y,onChange:t=>S(e,t)},`${e.grove_id}:${e.project_id}`))}),l&&(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0 mt-3`,"data-testid":`team-selection-error`,children:l})]})]})}var _5=16;function v5(e){return e.length<_5?`•`.repeat(Math.max(8,e.length)):`${e.slice(0,8)}${`•`.repeat(e.length-12)}${e.slice(-4)}`}function y5({label:e,value:t}){let[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(`idle`),o=(0,W.useRef)(null),s=(0,W.useCallback)(()=>{o.current!==null&&(clearTimeout(o.current),o.current=null)},[]);(0,W.useEffect)(()=>s,[s]);let c=(0,W.useCallback)(()=>{s(),navigator.clipboard.writeText(t).then(()=>{a(`copied`),o.current=setTimeout(()=>a(`idle`),2e3)},()=>{a(`failed`),o.current=setTimeout(()=>a(`idle`),2e3)})},[t,s]),l=v5(t);return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant`,children:e}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 group`,children:[(0,G.jsx)(`span`,{className:`text-sm text-on-surface font-mono break-all`,children:n?t:l}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface transition-opacity`,title:n?`Hide`:`Reveal`,children:n?(0,G.jsx)(ya,{className:`h-3.5 w-3.5`}):(0,G.jsx)(ba,{className:`h-3.5 w-3.5`})}),(0,G.jsxs)(`button`,{type:`button`,onClick:c,className:`shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface opacity-0 group-hover:opacity-100 transition-opacity`,title:i===`failed`?`Copy failed — check clipboard permissions`:`Copy to clipboard`,"aria-live":`polite`,children:[i===`copied`&&(0,G.jsx)(Qi,{className:`h-3.5 w-3.5 text-primary`}),i===`failed`&&(0,G.jsx)(So,{className:`h-3.5 w-3.5 text-error`}),i===`idle`&&(0,G.jsx)(pa,{className:`h-3.5 w-3.5`})]})]})]})}function b5({status:e}){let t=We(),[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(null);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(Tj,{tone:`sage`,eyebrow:(0,G.jsx)(E6,{Icon:Na,children:`Team Credentials`}),title:`Worker credentials`,actions:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!0,title:`Coming soon`,children:[(0,G.jsx)(Qa,{className:`h-3.5 w-3.5 mr-1.5`}),`Rotate team key`]}),children:[(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0 mb-3`,children:[`These credentials belong to the registered Team worker for`,` `,(0,G.jsx)(`span`,{className:`text-on-surface font-medium`,children:e.grove?.name??`this Grove`}),`. Keep the Team key private because it authorizes writes to the worker.`,` `,`Share the Worker URL and Team key out-of-band with a teammate so they can `,(0,G.jsx)(`span`,{className:`text-on-surface font-medium`,children:`Join`}),` this team on their Teams tab.`]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.worker_url&&(0,G.jsx)(p5,{label:`Worker URL`,value:e.worker_url}),e.team_key&&(0,G.jsx)(y5,{label:`Team key`,value:e.team_key})]})]}),e.mcp_token&&e.mcp_endpoint&&(0,G.jsxs)(Tj,{tone:`sage`,eyebrow:(0,G.jsx)(E6,{Icon:da,children:`Cloud MCP endpoint`}),title:`For cloud agents`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(X,{variant:e.mcp_healthy?`default`:`destructive`,children:e.mcp_healthy?`healthy`:`unhealthy`}),(0,G.jsxs)(`button`,{onClick:()=>s(!0),className:`text-xs text-on-surface-variant hover:text-terracotta-text transition-colors inline-flex items-center gap-1`,children:[(0,G.jsx)(Qa,{className:`h-3.5 w-3.5`}),`Rotate token`]})]}),children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0 mb-3`,children:`Configure cloud agents with this endpoint to access Grove team intelligence.`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(p5,{label:`MCP URL`,value:e.mcp_endpoint}),(0,G.jsx)(y5,{label:`MCP Access Token`,value:e.mcp_token})]}),(0,G.jsxs)(`div`,{className:`text-xs mt-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(!i),className:`myco-eyebrow-sm text-on-surface-variant cursor-pointer hover:text-on-surface transition-colors`,children:i?`Hide snippet`:`Config snippet`}),i&&(()=>{let t=JSON.stringify({mcp_servers:[{type:`url`,url:e.mcp_endpoint,name:`myco`,authorization_token:e.mcp_token}]},null,2);return(0,G.jsxs)(`div`,{className:`relative mt-2`,children:[(0,G.jsx)(`pre`,{className:`text-xs bg-surface-container p-3 rounded-lg overflow-x-auto text-on-surface-variant`,children:t}),(0,G.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(t),className:`absolute top-2 right-2 p-1 rounded hover:bg-surface-container-high transition-colors`,children:(0,G.jsx)(pa,{className:`h-3.5 w-3.5 text-on-surface-variant`})})]})})()]})]}),(0,G.jsxs)(Tj,{tone:`sage`,eyebrow:(0,G.jsx)(E6,{Icon:mo,children:`This node`}),title:`Identity of this machine in the team`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(wj,{size:`sm`,children:`Machine ID`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.machine_id})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(wj,{size:`sm`,children:`Package version`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.package_version})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(wj,{size:`sm`,children:`Protocol version`}),(0,G.jsxs)(`code`,{className:`text-xs font-mono text-on-surface`,children:[`v`,e.sync_protocol_version]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(wj,{size:`sm`,children:`Schema version`}),(0,G.jsxs)(`code`,{className:`text-xs font-mono text-on-surface`,children:[`v`,e.schema_version]})]})]}),e.health_error&&(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0 mt-3`,children:e.health_error})]}),(0,G.jsx)(Tj,{tone:`sage`,eyebrow:(0,G.jsx)(E6,{Icon:Ga,children:`Collective`}),title:`Cross-team coordination`,actions:(0,G.jsx)(X,{variant:e.collective_connected?`default`:`outline`,children:e.collective_connected?`connected`:`not connected`}),children:e.collective_connected?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[e.collective_url&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(wj,{size:`sm`,children:`URL`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.collective_url})]}),e.collective_project_id&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(wj,{size:`sm`,children:`Project ID`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.collective_project_id})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(wj,{size:`sm`,children:`Last settings sync`}),(0,G.jsx)(`p`,{className:`text-xs font-mono text-on-surface m-0`,children:e.collective_last_settings_sync?new Date(e.collective_last_settings_sync*1e3).toLocaleString():`Never`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(wj,{size:`sm`,children:`Last heartbeat`}),(0,G.jsx)(`p`,{className:`text-xs font-mono text-on-surface m-0`,children:e.collective_last_heartbeat?new Date(e.collective_last_heartbeat*1e3).toLocaleString():`Never`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(wj,{size:`sm`,children:`Capabilities`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.collective_capabilities.map(e=>(0,G.jsx)(X,{variant:`outline`,children:e},e))})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(wj,{size:`sm`,children:`Effective overrides`}),(0,G.jsx)(`pre`,{className:`text-xs bg-surface-container p-3 rounded-lg overflow-x-auto text-on-surface-variant`,children:JSON.stringify(e.collective_settings,null,2)})]})]}):(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`This team worker is not currently connected to a Myco Collective.`})}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:async()=>{r(!0),p(null);try{await ts(`/team/disconnect`),t.invalidateQueries({queryKey:[`team-status`]})}catch(e){p(e instanceof Error?e.message:String(e))}finally{r(!1)}},disabled:n,children:n?`Disconnecting...`:`Disconnect`})}),(0,G.jsx)(dM,{open:o,onOpenChange:s,title:`Rotate MCP Access Token`,description:`This will invalidate the current MCP token. Any cloud agents using it will lose access until reconfigured with the new token.`,confirmLabel:`Rotate Token`,variant:`destructive`,isPending:c,onConfirm:async()=>{l(!0),d(null);try{await ts(`/team/rotate-mcp-token`),t.invalidateQueries({queryKey:[`team-status`]}),s(!1)}catch(e){d(e instanceof Error?e.message:String(e))}finally{l(!1)}},errorMessage:u}),f&&(0,G.jsxs)(`p`,{className:`text-sm text-terracotta text-right m-0`,"data-testid":`team-disconnect-error`,children:[`Disconnect failed: `,f]})]})}var x5={sage:`bg-primary/10 text-primary`,ochre:`bg-secondary/10 text-secondary`,terracotta:`bg-tertiary/10 text-tertiary`,outline:`bg-surface-container text-on-surface-variant`};function S5({label:e,value:t,tone:n,pulse:r,sub:i}){return(0,G.jsxs)(`div`,{className:J(`flex flex-col gap-1 rounded-md p-3`,x5[n]),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-wider`,children:[(0,G.jsx)(`span`,{className:J(`h-2 w-2 rounded-full bg-current`,r&&`animate-pulse`)}),e]}),(0,G.jsx)(`div`,{className:`font-mono text-2xl tabular-nums`,children:t}),i?(0,G.jsx)(`div`,{className:`text-[10px] text-on-surface-variant`,children:i}):null]})}function C5({title:e,actions:t,children:n}){return(0,G.jsx)(Tj,{tone:`sage`,eyebrow:`Sync`,title:e,actions:t,children:n})}function w5(e){return typeof e==`number`&&Number.isFinite(e)?e.toLocaleString():`—`}function T5(e){if(!e)return`Never`;let t=new Date(e);return Number.isNaN(t.getTime())?`Never`:t.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`,second:`2-digit`})}function E5(e){return e.replace(/_/g,` `)}function D5(e){return e===0?`0`:e>0?`+${e.toLocaleString()}`:e.toLocaleString()}function O5(e,t){return t===void 0?`—`:D5(t-e)}function k5({remote:e}){if(!e)return(0,G.jsx)(v2,{label:`Vectors`,value:`—`,accent:`outline`});if(!e.vector_index_healthy)return(0,G.jsx)(v2,{label:`Vectors`,value:`error`,sublabel:e.vector_index_error??`index unavailable`,accent:`terracotta`});let t=e.vector_count??0,n=e.embeddable_count,r=w5(t);if(n==null)return(0,G.jsx)(v2,{label:`Vectors`,value:r,accent:`sage`});let i=n+Math.ceil(n*.1);if(t>=n&&t<=i)return(0,G.jsx)(v2,{label:`Vectors`,value:r,sublabel:`indexed (target ${w5(n)})`,accent:`sage`});if(t>i)return(0,G.jsx)(v2,{label:`Vectors`,value:r,sublabel:`+${w5(t-n)} stale vs target ${w5(n)}`,accent:`ochre`});let a=n-t,o=n>0&&t<Math.max(1,n*.05);return(0,G.jsx)(v2,{label:`Vectors`,value:r,sublabel:o?`index empty — run reindex (target ${w5(n)})`:`${w5(a)} missing of ${w5(n)}`,accent:o?`terracotta`:`ochre`})}function A5({rows:e}){return(0,G.jsx)(`div`,{className:`overflow-hidden rounded-md border border-outline-variant/10`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{className:`bg-surface-container/40 text-xs uppercase text-outline`,children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-mono`,children:`Table`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-mono`,children:`Local`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-mono`,children:`Cloud`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-mono`,children:`Δ`})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsxs)(`tr`,{className:e.delta===0?`border-t border-outline-variant/10`:`border-t border-outline-variant/10 bg-terracotta/[0.04]`,children:[(0,G.jsx)(`td`,{className:`px-3 py-2 text-on-surface`,children:E5(e.table)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right tabular-nums text-on-surface`,children:w5(e.local)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right tabular-nums text-on-surface`,children:w5(e.cloud)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right tabular-nums ${e.delta===0?`text-on-surface-variant`:`text-terracotta`}`,children:D5(e.delta)})]},e.table))})]})})}function j5({message:e,onAction:t,busy:n}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-2 border-b border-outline-variant/10 last:border-b-0`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-on-surface font-mono truncate`,children:[e.table_name,` / `,e.row_id]}),(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant truncate`,children:[`machine=`,e.machine_id,` op=`,e.operation,e.reason?` · ${e.reason}`:``]}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant/60`,children:new Date(e.created_at*1e3).toLocaleString()})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`outline`,disabled:n,onClick:()=>t(`retry`,e.lease_id),children:`Retry`}),(0,G.jsx)(Y,{size:`sm`,variant:`outline`,disabled:n,onClick:()=>t(`discard`,e.lease_id),children:`Discard`})]})]})}function M5({status:e,teamId:t}){let n=We(),r=e.enabled&&e.healthy,{data:i,isLoading:a,isFetching:o,refetch:s}=M6(r,t),{data:c,isLoading:l,isFetching:u,refetch:d}=N6(r,t),{data:f}=Fs(),p=r,{data:m,isLoading:h,isFetching:g,refetch:_}=P6(p,t),[v,y]=(0,W.useState)(!1),[b,x]=(0,W.useState)(null),[S,C]=(0,W.useState)(!1),[w,T]=(0,W.useState)(null),[E,D]=(0,W.useState)(!1),[O,k]=(0,W.useState)(null),A=!r||!a&&!i,j=a||p&&h,M=!r||!j&&p&&!m,N=`Team connection is unhealthy.`,P=o||u||g,F=(0,W.useCallback)(()=>{s(),d(),_()},[s,d,_]),I=(0,W.useCallback)(async()=>{C(!0),T(null);try{let e=await ts(`/team/backfill`,{mode:`all`}),t=e.vector_error?`; vector reindex failed: ${e.vector_error}`:e.vector_enqueued?` and queued ${w5(e.vector_enqueued)} vectors for reindex`:``;e.flush_error?T(`Backfilled ${e.enqueued} records, but sync failed: ${e.flush_error}`):e.enqueued>0||(e.flushed??0)>0?T(`Backfilled ${w5(e.enqueued)} records and handed off ${w5(e.flushed)} in ${e.batches??0} batches${t}.`):e.vector_enqueued?T(`No eligible Grove records found${t}.`):T(`No eligible Grove records found.`),n.invalidateQueries({queryKey:[`team-status`]}),n.invalidateQueries({queryKey:[`team-sync-summary`]}),n.invalidateQueries({queryKey:[`team-queue-stats`]}),n.invalidateQueries({queryKey:[`team-dlq`]})}catch{T(`Backfill failed.`)}finally{C(!1)}},[n]),L=(0,W.useCallback)(async(e,t)=>{y(!0),x(null);try{let r=await ts(`/team/dlq/${e}`,{lease_ids:[t]});x(((e===`retry`?r.retried:r.discarded)??0)>0?`${e===`retry`?`Retried`:`Discarded`} 1 message.`:`${e===`retry`?`Retry`:`Discard`} returned 0 — lease may have expired. Refresh and try again.`),await Promise.all([n.refetchQueries({queryKey:[`team-dlq`]}),n.refetchQueries({queryKey:[`team-queue-stats`]}),n.refetchQueries({queryKey:[`team-sync-summary`]})])}catch(t){x(`${e} failed: ${t instanceof Error?t.message:String(t)}`)}finally{y(!1)}},[n]),R=(0,W.useCallback)(async()=>{if(!(!m||m.messages.length===0)){y(!0),x(null);try{x(`Retried ${(await ts(`/team/dlq/retry`,{lease_ids:m.messages.map(e=>e.lease_id)})).retried??0} of ${m.messages.length} messages.`),await Promise.all([n.refetchQueries({queryKey:[`team-dlq`]}),n.refetchQueries({queryKey:[`team-queue-stats`]}),n.refetchQueries({queryKey:[`team-sync-summary`]})])}catch(e){x(`Retry failed: ${e instanceof Error?e.message:String(e)}`)}finally{y(!1)}}},[m,n]),ee=(0,W.useCallback)(async()=>{D(!0),k(null);try{let e=await ts(`/team/rebuild`);e.error?k(`Rebuild failed: ${e.error}`):k(`Rebuilt: handed off ${w5(e.handedOff)} records in ${e.batches} batch${e.batches===1?``:`es`}.`),n.invalidateQueries({queryKey:[`team-status`]}),n.invalidateQueries({queryKey:[`team-sync-summary`]}),n.invalidateQueries({queryKey:[`team-queue-stats`]}),n.invalidateQueries({queryKey:[`team-dlq`]})}catch(e){k(`Rebuild failed: ${e instanceof Error?e.message:String(e)}`)}finally{D(!1)}},[n]),z=m?.messages??[],B=c?.remote_machine_total??null,V=c?.local.total_records??null;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,G.jsx)(m0,{intervalMs:r?Es.TEAM:void 0,isFetching:P,onManualRefresh:F})}),(0,G.jsx)(C5,{title:`Remote store`,actions:c?.remote?e.worker_update_available?(0,G.jsxs)(X,{variant:`outline`,title:`Update available — deployed v${e.deployed_worker_version}, v${e.local_team_package_version} ready. Contact admin to update.`,children:[`v`,c.remote.package_version]}):(0,G.jsxs)(X,{variant:`default`,children:[`v`,c.remote.package_version]}):null,children:l&&!c?(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Loading...`}):c?.remote_error?(0,G.jsx)(`p`,{className:`text-sm text-terracotta break-words m-0`,children:c.remote_error}):c?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,G.jsx)(v2,{label:`Local records`,value:w5(V),sublabel:`this machine`,accent:`outline`}),(0,G.jsx)(v2,{label:`Remote records`,value:w5(B),sublabel:`this machine`,accent:`outline`}),(0,G.jsx)(v2,{label:`Delta`,value:B===null||V===null?`—`:O5(V,B),accent:B!==null&&V!==null&&B!==V?`ochre`:`outline`}),(0,G.jsx)(k5,{remote:c.remote,localEmbedded:f?.embedding.embedded_count??null})]}),c.drift&&c.drift.length>0?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Local vs cloud (this machine)`}),(0,G.jsx)(A5,{rows:c.drift})]}):c.total_delta===0?(0,G.jsx)(`p`,{className:`text-xs text-sage m-0`,children:`In sync`}):null,(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`Last synced `,T5(c.last_handoff?.completed_at)]}),(c.total_delta??0)>0&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-outline-variant/10 pt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Replaces this machine's cloud data with your local Grove. One-way; no reconciliation.`}),(0,G.jsx)(Y,{size:`sm`,variant:`outline`,onClick:ee,disabled:E,children:E?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Qa,{className:`h-3.5 w-3.5 animate-spin mr-1.5`}),`Rebuilding...`]}):`Rebuild from local`})]}),O&&(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:O})]})]}):(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:N})}),(0,G.jsx)(C5,{title:`Queue health`,children:a?(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Loading...`}):A?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:N}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,G.jsx)(S5,{label:`In flight`,value:i?.backlog??0,tone:(i?.backlog??0)>0?`ochre`:`outline`,pulse:(i?.backlog??0)>0,sub:(i?.backlog??0)>0?`draining`:void 0}),(0,G.jsx)(S5,{label:`Failed`,value:i?.failed??0,tone:(i?.failed??0)>0?`terracotta`:`outline`}),(0,G.jsx)(S5,{label:`Embeds failed`,value:i?.embed_failed??0,tone:(i?.embed_failed??0)>0?`terracotta`:`outline`})]}),i?.last_run_at!=null&&(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`Last run `,new Date(i.last_run_at*1e3).toLocaleString()]}),i?.last_error&&(0,G.jsx)(`p`,{className:`text-xs text-terracotta break-words m-0`,children:i.last_error}),(i?.embed_failed??0)>0&&i?.last_embed_error&&(0,G.jsx)(`p`,{className:`text-xs text-terracotta break-words m-0`,children:i.last_embed_error})]})}),(0,G.jsxs)(C5,{title:`Failed syncs`,actions:z.length>0?(0,G.jsx)(Y,{size:`sm`,variant:`outline`,disabled:v||M,onClick:R,children:`Retry all (${z.length})`}):null,children:[b&&(0,G.jsx)(`p`,{className:`text-xs font-mono text-on-surface-variant m-0 mb-3`,children:b}),j?(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Loading...`}):M?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:N}):z.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`No failed syncs.`}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`These records couldn't reach the cloud after repeated tries. Retry to attempt again, or discard to drop them.`}),(0,G.jsx)(`div`,{className:`divide-y divide-outline-variant/10`,children:z.map(e=>(0,G.jsx)(j5,{message:e,onAction:L,busy:v},e.lease_id))})]})]}),(0,G.jsxs)(C5,{title:`Backfill`,actions:(0,G.jsx)(Y,{size:`sm`,variant:`default`,onClick:I,disabled:S,children:S?`Backfilling...`:`Backfill existing records`}),children:[(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`Re-sends every local record to the cloud — for recovery after a cloud-side reset or lost data. Not part of routine sync.`}),w&&(0,G.jsx)(`p`,{className:`text-sm text-sage m-0 mt-3`,children:w})]})]})}function N5(e){let t=e.trim();if(!t)return`?`;let n=t.split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[1][0]).toUpperCase():t.slice(0,2).toUpperCase()}var P5=(0,W.forwardRef)(({name:e,initials:t,size:n=36,className:r,style:i,...a},o)=>{let s=(t??N5(e)).slice(0,2);return(0,G.jsx)(`span`,{ref:o,"aria-label":e,className:J(`inline-flex items-center justify-center rounded-full font-mono font-semibold uppercase text-[var(--on-primary)] shrink-0`,r),style:{width:n,height:n,fontSize:Math.round(n/3),background:`linear-gradient(135deg, var(--sage-dim), var(--ochre))`,...i},...a,children:s})});P5.displayName=`MemberAvatar`;function F5(e){if(!e)return`never`;let t=Date.now()-e*1e3,n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<48?`${r}h ago`:`${Math.floor(r/24)}d ago`}function I5({m:e,isSelf:t}){return(0,G.jsx)(uM,{accent:`ochre`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(P5,{name:e.user,size:36}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-sm text-on-surface`,children:e.user}),t&&(0,G.jsx)(X,{variant:`outline`,children:`this machine`}),e.role&&(0,G.jsx)(X,{variant:e.role===`owner`?`default`:`outline`,children:e.role})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e.machine_id}),e.joined&&(0,G.jsxs)(`span`,{children:[`joined `,e.joined]}),!t&&(0,G.jsxs)(`span`,{children:[`last received `,F5(e.synced_at)]}),e.tags.map(e=>(0,G.jsxs)(`span`,{className:`font-mono`,children:[`#`,e]},e))]})]})]})})}function L5({teamId:e}={}){let{data:t,isLoading:n}=B6(e),{data:r,isLoading:i}=j6(e),a=r?.machine_id??null,o=n||i,s=t?.members.length??0;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(Tj,{tone:`ochre`,eyebrow:`Members`,title:`Roster`,actions:o?null:(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[s,` `,s===1?`member`:`members`]}),padded:!1,children:o?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant m-0`,children:`Loading…`}):!t||t.members.length===0?(0,G.jsxs)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant m-0`,children:[`No team members yet. Run `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco-team join`}),` on a teammate's machine to add them.`]}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:t.members.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(I5,{m:e,isSelf:e.machine_id===a})},e.id))})}),(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`Members come from the local `,(0,G.jsx)(`code`,{className:`font-mono`,children:`team_members`}),` table, synced from peers via the team Worker.`]})]})}var R5=(0,W.forwardRef)(({number:e,size:t=28,className:n,style:r,...i},a)=>(0,G.jsx)(`span`,{ref:a,className:J(`inline-flex items-center justify-center rounded-full bg-surface-container-high text-on-surface font-mono font-semibold shrink-0`,n),style:{width:t,height:t,fontSize:Math.round(t*12/28),...r},...i,children:e}));R5.displayName=`StepCircle`;function z5({n:e,state:t,title:n,children:r}){return(0,G.jsxs)(`li`,{"aria-current":t===`active`?`step`:void 0,className:J(`flex gap-3 rounded-md border border-[var(--ghost-border)] px-4 py-3 transition-colors`,t===`active`&&`bg-sage/[0.05] border-l-2 border-l-sage`,t===`complete`&&`opacity-70`),children:[(0,G.jsx)(R5,{number:e,className:J(t===`active`&&`bg-sage/15 text-sage`,t===`complete`&&`bg-sage text-on-sage`)}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-on-surface m-0`,children:n}),r]})]})}function B5({scopeName:e}){return(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,G.jsxs)(Tj,{tone:`ochre`,eyebrow:(0,G.jsx)(E6,{Icon:bo,tone:`ochre`,children:`Not syncing`}),title:`Team sync for ${e}`,children:[(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0 mb-3`,children:`This project is not assigned to a registered team.`}),(0,G.jsxs)(`ol`,{className:`m-0 p-0 list-none flex flex-col gap-3`,children:[(0,G.jsx)(z5,{n:1,state:`active`,title:`Install prerequisites`,children:(0,G.jsx)(`code`,{className:`block font-mono text-xs bg-surface-container rounded px-3 py-2 text-on-surface-variant`,children:`npm install -g @goondocks/myco-team wrangler && wrangler login`})}),(0,G.jsxs)(z5,{n:2,state:`idle`,title:`Provision the Grove worker`,children:[(0,G.jsx)(`code`,{className:`block font-mono text-xs bg-surface-container rounded px-3 py-2 text-on-surface-variant`,children:`myco-team install`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0 mt-1`,children:`Creates the worker and registers the team on this machine.`})]}),(0,G.jsx)(z5,{n:3,state:`idle`,title:`Add or join the team`,children:(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`On the Teams tab, provision a new team with `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco-team install`}),` — or, if a teammate shared a Worker URL and Team key, use "Join a team". Then assign this project to it.`]})})]})]})})}var V5=[{id:`teams`,label:`Teams`,description:`select projects`,Icon:Ga},{id:`status`,label:`Status`,description:`identity + health`,Icon:Gi},{id:`sync`,label:`Sync`,description:`queue + secrets`,Icon:Qa},{id:`members`,label:`Members`,description:`roster`,Icon:yo}],H5=new Set([`teams`,`status`,`sync`,`members`]);function U5({status:e}){if(e.version_status!==`client_too_old`&&e.version_status!==`worker_too_old`)return null;let t=e.version_status===`client_too_old`,n=t?`Sync paused — this machine is out of date`:`Sync paused — the team worker is out of date`,r=t?`myco update`:`myco-team update --team-id ${e.team_id??`<team_id>`}`,i=t?`This daemon speaks sync protocol v${e.daemon_protocol_version}, but the team worker requires at least v${e.worker_min_client_version??`?`}.`:`This daemon speaks sync protocol v${e.daemon_protocol_version}, but the team worker only supports up to v${e.worker_protocol_version??`?`}.`;return(0,G.jsxs)(Sj,{accent:`terra`,padded:!0,className:`mb-4 flex items-start gap-3`,role:`alert`,children:[(0,G.jsx)(_o,{className:`size-5 shrink-0 text-terracotta-text`,"aria-hidden":!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`p`,{className:`m-0 text-sm font-medium text-on-surface`,children:n}),(0,G.jsxs)(`p`,{className:`m-0 text-sm text-on-surface-variant`,children:[i,` Pending changes are held safely; run `,(0,G.jsx)(`code`,{className:`text-terracotta-text`,children:r}),` to resume syncing.`]})]})]})}function W5(){let[e,t]=di(),{data:n,isLoading:r}=F6(),i=n?.teams??[],a=e.get(`team`)??i[0]?.team_id??void 0,{data:o,isLoading:s}=j6(r?void 0:a),c=e.get(`tab`)??`teams`,l=H5.has(c)?c:`teams`;if(r||s)return(0,G.jsx)(vj,{isLoading:!0,error:null,loadingText:`Loading team…`,children:(0,G.jsx)(`span`,{})});if(!o)return null;let u=o.enabled&&o.worker_url,d=o.grove?.name??o.project.name??`this Grove`;function f(){return l===`teams`?(0,G.jsx)(g5,{}):u?l===`sync`?(0,G.jsx)(M5,{status:o,teamId:a}):l===`members`?(0,G.jsx)(L5,{teamId:a}):(0,G.jsx)(b5,{status:o}):(0,G.jsx)(B5,{scopeName:d})}return(0,G.jsxs)(bj,{children:[(0,G.jsx)(YN,{title:`Team`,subtitle:`Sync your projects to shared team clouds`,actions:i.length>0&&l!==`teams`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`label`,{htmlFor:`team-scope`,className:`myco-eyebrow-sm text-on-surface-variant`,children:`Team`}),(0,G.jsx)(`select`,{id:`team-scope`,"aria-label":`Selected team`,className:`rounded-md border border-[var(--ghost-border)] bg-surface-container px-3 py-1.5 text-xs text-on-surface`,value:a??``,onChange:e=>t(t=>{let n=new URLSearchParams(t);return n.set(`team`,e.target.value),n},{replace:!0}),children:i.map(e=>(0,G.jsx)(`option`,{value:e.team_id,children:e.name},e.team_id))})]}):void 0}),(0,G.jsx)(U5,{status:o}),(0,G.jsx)(PP,{tabs:V5,activeTab:l,onTabChange:e=>t(t=>{let n=new URLSearchParams(t);return n.set(`tab`,e),n},{replace:!0}),columns:4}),f()]})}function G5(){let[e]=di(),t=e.has(`preview`),n=Fs(),r=mM(),i=fs({refetchInterval:t?void 0:4e3}).data?.groves??[],a=Lo(i)??jo(i);if(a&&!t)return(0,G.jsx)(sr,{to:Mo(a),replace:!0});let o=!!a,s=i.reduce((e,t)=>e+t.projects.length,0),c=(r.data?.symbionts??[]).filter(e=>e.detected),l=n.data?.daemon.version,u=n.data?.daemon.port;return(0,G.jsx)(bj,{variant:`narrow`,className:`min-h-full justify-center`,children:(0,G.jsxs)(`div`,{className:`flex max-w-xl flex-col gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-md bg-primary/10 text-primary`,children:(0,G.jsx)(mo,{className:`h-5 w-5`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-semibold text-on-surface`,children:o?`You're all set — Myco is capturing`:`You're set up — waiting for your first session`}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-on-surface-variant`,children:`Open any git repository in a supported agent (Claude Code, Cursor, Codex, Copilot, Antigravity, Windsurf, OpenCode, or Pi). Myco registers the project automatically on the first hook and this page opens its dashboard. Capture is scoped to git repositories — work in a non-git folder isn't recorded.`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-outline/40 bg-surface-container/40 p-4 text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface`,children:[(0,G.jsx)(oa,{className:`h-4 w-4 shrink-0 text-green-500`}),(0,G.jsxs)(`span`,{children:[`Myco is running`,l?(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[` · v`,l]}):null,u?(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[` · port `,u]}):null]})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`mt-px font-medium text-on-surface`,children:`Agents`}),(0,G.jsx)(`span`,{children:c.length>0?`${c.length} detected — ${c.map(e=>e.displayName).join(`, `)}`:`No supported coding agents detected on this machine yet`})]}),o&&a?(0,G.jsxs)(ri,{to:Mo(a),className:`inline-flex items-center gap-1.5 font-medium text-primary hover:underline`,children:[s,` project`,s===1?``:`s`,` registered — go to dashboard`,(0,G.jsx)(qi,{className:`h-3.5 w-3.5`})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{className:`relative flex h-2 w-2 shrink-0`,children:[(0,G.jsx)(`span`,{className:`absolute inline-flex h-full w-full animate-ping rounded-full bg-primary/60`}),(0,G.jsx)(`span`,{className:`relative inline-flex h-2 w-2 rounded-full bg-primary`})]}),(0,G.jsx)(`span`,{children:`Waiting for your first session…`})]})]})]})})}function K5(){let e=We();return st({mutationFn:e=>ts(`/groves`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function q5(){let e=We();return st({mutationFn:({id:e,name:t})=>q(`/groves/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({name:t})}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`groves`],exact:!1}),e.invalidateQueries({queryKey:[`grove`,n.id]})}})}function J5(){let e=We();return st({mutationFn:({id:e})=>q(`/groves/${encodeURIComponent(e)}`,{method:`DELETE`}),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function Y5(){let e=We();return st({mutationFn:({targetGroveId:e,projectId:t})=>ts(`/groves/${encodeURIComponent(e)}/projects/${encodeURIComponent(t)}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function X5(){let e=We();return st({mutationFn:({id:e})=>ts(`/groves/${encodeURIComponent(e)}/default`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function Z5(){let e=We();return st({mutationFn:({groveId:e,projectId:t})=>ts(`/groves/${encodeURIComponent(e)}/projects/${encodeURIComponent(t)}/archive`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function Q5(){let e=We();return st({mutationFn:({groveId:e,projectId:t})=>ts(`/groves/${encodeURIComponent(e)}/projects/${encodeURIComponent(t)}/unarchive`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function $5(){let e=We();return st({mutationFn:({groveId:e,projectId:t,confirmationName:n})=>q(`/groves/${encodeURIComponent(e)}/projects/${encodeURIComponent(t)}`,{method:`DELETE`,body:JSON.stringify({confirmation_name:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}var e7={cortex:{id:`cortex`,label:`Cortex`,masterGate:`cortex.enabled`,memberGates:[],scheduledTasks:[`cortex-instructions`],advancedSettingsLink:`/settings#scheduled-tasks`},canopy:{id:`canopy`,label:`Canopy`,masterGate:`cortex.canopy.enabled`,memberGates:[],scheduledTasks:[`canopy-map`,`canopy-describe`],advancedSettingsLink:`/settings#scheduled-tasks`},skills:{id:`skills`,label:`Skills`,masterGate:`skills.enabled`,memberGates:[],scheduledTasks:[`skill-survey`,`skill-generate`,`skill-evolve`],advancedSettingsLink:`/settings#skills`},vault_evolution:{id:`vault_evolution`,label:`Vault Evolution`,masterGate:`vault_evolution.enabled`,memberGates:[],scheduledTasks:[`vault-evolve`],advancedSettingsLink:`/settings#scheduled-tasks`}};function t7(e,t){return e?SO(e,e7[t].masterGate)!==!1:!1}function n7(e){let t=Object.keys(e7).filter(t=>e[t]);return t.length===0?[{id:`capture-only`,label:`Capture-only`,to:``,tone:`outline`,title:`Sessions, search, and MCP only`}]:t.map(e=>({id:e,label:e7[e].label,to:e7[e].advancedSettingsLink,tone:`sage`,title:`${e7[e].label} enabled`}))}function r7({items:e,ariaLabel:t,trigger:n,align:r=`right`}){let[i,a]=(0,W.useState)(!1),o=(0,W.useRef)(null);return(0,W.useEffect)(()=>{if(!i)return;function e(e){o.current&&(o.current.contains(e.target)||a(!1))}function t(e){e.key===`Escape`&&a(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]),(0,G.jsxs)(`div`,{ref:o,className:`relative inline-block`,children:[(0,G.jsx)(`button`,{type:`button`,"aria-label":t,"aria-haspopup":`menu`,"aria-expanded":i,onClick:e=>{e.preventDefault(),e.stopPropagation(),a(e=>!e)},className:`inline-flex h-8 w-8 items-center justify-center rounded-md text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,children:n??(0,G.jsx)(_a,{className:`h-4 w-4`})}),i&&(0,G.jsx)(`div`,{role:`menu`,className:J(`absolute z-50 mt-1 min-w-[12rem] rounded-md border border-outline-variant/30 bg-surface-container-highest p-1 shadow-lg`,r===`right`?`right-0`:`left-0`),children:e.map(e=>(0,G.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:e.disabled,title:e.disabled?e.disabledReason:void 0,onClick:t=>{t.preventDefault(),t.stopPropagation(),!e.disabled&&(a(!1),e.onSelect())},className:J(`flex w-full items-center rounded-sm px-3 py-1.5 text-left text-sm transition-colors`,`text-on-surface hover:bg-surface-container-high`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent`,e.destructive&&!e.disabled&&`text-tertiary hover:bg-tertiary/10`),children:e.label},e.key))})]})}function i7({groveName:e,projectCount:t,isDefault:n,onRename:r,onDelete:i,onSetDefault:a}){let o=t>0;return(0,G.jsx)(r7,{items:[{key:`set-default`,label:`Set as default`,disabled:n,disabledReason:n?`Already the default Grove`:void 0,onSelect:a},{key:`rename`,label:`Rename`,onSelect:r},{key:`delete`,label:`Delete Grove`,destructive:!0,disabled:o,disabledReason:o?`Move or remove projects first`:void 0,onSelect:i}],ariaLabel:`${e} actions`})}function a7({projectName:e,archived:t=!1,onMove:n,onOpen:r,onArchive:i,onUnarchive:a,onDelete:o,onIgnore:s}){return(0,G.jsx)(r7,{items:[{key:`open`,label:`Open dashboard`,onSelect:r,disabled:t},{key:`move`,label:`Move to another Grove`,onSelect:n,disabled:t},{key:`ignore`,label:`Ignore project…`,onSelect:s,disabled:t},t?{key:`unarchive`,label:`Unarchive project`,onSelect:a}:{key:`archive`,label:`Archive project`,onSelect:i},{key:`delete`,label:`Delete permanently…`,onSelect:o,destructive:!0}],ariaLabel:`${e} actions`})}function o7(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`default`}function s7({open:e,onOpenChange:t}){let[n,r]=(0,W.useState)(``),[i,a]=(0,W.useState)(null),o=K5();(0,W.useEffect)(()=>{e&&(r(``),a(null),o.reset())},[e]);let s=n.trim(),c=s.length>0?o7(s):``;function l(e){if(e.preventDefault(),s.length===0){a(`Name is required.`);return}a(null),o.mutate({name:s},{onSuccess:e=>{cA({level:`success`,title:`Grove created`,detail:e.slug}),t(!1)},onError:e=>{cA({level:`error`,title:`Could not create Grove`,detail:e.message})}})}return(0,G.jsx)(Lf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Vf,{className:`sm:max-w-md`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`New Grove`}),(0,G.jsx)(Gf,{children:`Group projects into a local Grove.`})]}),(0,G.jsxs)(`form`,{onSubmit:l,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`new-grove-name`,className:`text-sm font-medium text-on-surface`,children:`Name`}),(0,G.jsx)(`input`,{id:`new-grove-name`,type:`text`,value:n,autoFocus:!0,onChange:e=>r(e.target.value),placeholder:`Personal`,className:`w-full rounded-md border border-outline-variant/40 bg-surface-container-low px-3 py-1.5 text-sm text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`}),c&&(0,G.jsxs)(`p`,{className:`font-mono text-xs text-on-surface-variant`,children:[`slug: `,c]}),i&&(0,G.jsx)(`p`,{className:`text-xs text-tertiary`,children:i})]}),(0,G.jsxs)(Uf,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:o.isPending,children:`Cancel`}),(0,G.jsx)(Y,{type:`submit`,size:`sm`,disabled:o.isPending||s.length===0,children:o.isPending?`Creating…`:`Create`})]})]})]})})}function c7({open:e,onOpenChange:t,groveId:n,currentName:r}){let[i,a]=(0,W.useState)(r),o=q5();(0,W.useEffect)(()=>{e&&(a(r),o.reset())},[e,r]);let s=i.trim(),c=s===r;function l(e){e.preventDefault(),!(s.length===0||c)&&o.mutate({id:n,name:s},{onSuccess:()=>{cA({level:`success`,title:`Grove renamed`}),t(!1)},onError:e=>{cA({level:`error`,title:`Rename failed`,detail:e.message})}})}return(0,G.jsx)(Lf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Vf,{className:`sm:max-w-md`,children:[(0,G.jsx)(Hf,{children:(0,G.jsx)(Wf,{children:`Rename Grove`})}),(0,G.jsxs)(`form`,{onSubmit:l,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`rename-grove-name`,className:`text-sm font-medium text-on-surface`,children:`Name`}),(0,G.jsx)(`input`,{id:`rename-grove-name`,type:`text`,value:i,autoFocus:!0,onChange:e=>a(e.target.value),className:`w-full rounded-md border border-outline-variant/40 bg-surface-container-low px-3 py-1.5 text-sm text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant`,children:`The Grove slug may change if the new name slugifies differently. Auto-suffixes on collision.`})]}),(0,G.jsxs)(Uf,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:o.isPending,children:`Cancel`}),(0,G.jsx)(Y,{type:`submit`,size:`sm`,disabled:o.isPending||s.length===0||c,children:o.isPending?`Saving…`:`Save`})]})]})]})})}function l7({open:e,onOpenChange:t,groveId:n,groveName:r,projectCount:i}){let a=J5(),o=i>0;function s(){o||a.mutate({id:n},{onSuccess:()=>{cA({level:`success`,title:`Grove deleted`,detail:r}),t(!1)},onError:e=>{e instanceof ls&&e.status===409?cA({level:`error`,title:`Grove not empty`,detail:`${e.body?.project_count??`?`} project(s) still bound`}):cA({level:`error`,title:`Delete failed`,detail:e.message})}})}return(0,G.jsx)(Lf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Vf,{className:`sm:max-w-md`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`Delete Grove`}),(0,G.jsxs)(Gf,{children:[`Delete `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:r}),`? This removes the Grove from the local registry.`]})]}),o&&(0,G.jsxs)(`p`,{className:`rounded-md border border-tertiary/30 bg-tertiary/10 px-3 py-2 text-sm text-on-surface`,children:[`Move or remove the `,i,` project`,i===1?``:`s`,` in this Grove first.`]}),(0,G.jsxs)(Uf,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:a.isPending,children:`Cancel`}),(0,G.jsx)(`span`,{title:o?`Grove still has projects`:void 0,children:(0,G.jsx)(Y,{type:`button`,variant:`destructive`,size:`sm`,onClick:s,disabled:a.isPending||o,children:a.isPending?`Deleting…`:`Delete Grove`})})]})]})})}function u7({open:e,onOpenChange:t,sourceGroveId:n,projectId:r,projectName:i,groves:a}){let o=a.filter(e=>e.id!==n),[s,c]=(0,W.useState)(o[0]?.id??``),l=Y5();(0,W.useEffect)(()=>{e&&(c(o[0]?.id??``),l.reset())},[e,n,r]);function u(){s&&l.mutate({targetGroveId:s,projectId:r},{onSuccess:()=>{cA({level:`success`,title:`Project moved`}),t(!1)},onError:e=>{cA({level:`error`,title:`Move failed`,detail:e.message})}})}return(0,G.jsx)(Lf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Vf,{className:`sm:max-w-md`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`Move project`}),(0,G.jsxs)(Gf,{children:[`Move `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:i}),` to another Grove.`]})]}),o.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant`,children:`No other Groves available. Create a new Grove first.`}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`move-target-grove`,className:`text-sm font-medium text-on-surface`,children:`Destination Grove`}),(0,G.jsx)(`select`,{id:`move-target-grove`,value:s,onChange:e=>c(e.target.value),disabled:l.isPending,className:`w-full rounded-md border border-outline-variant/40 bg-surface-container-low px-3 py-1.5 text-sm text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,children:o.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant`,children:`The project keeps its data; only its Grove binding changes.`})]}),(0,G.jsxs)(Uf,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:l.isPending,children:`Cancel`}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,onClick:u,disabled:l.isPending||o.length===0||!s,className:`gap-2`,children:[l.isPending&&(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),l.isPending?`Moving…`:`Confirm move`]})]})]})})}function d7({open:e,onOpenChange:t,groveId:n,projectId:r,projectName:i}){let[a,o]=(0,W.useState)(``),s=$5(),c=a===i;function l(){c&&s.mutate({groveId:n,projectId:r,confirmationName:a},{onSuccess:e=>{cA({level:`success`,title:`Project deleted`,detail:e.delete.snapshot_path}),o(``),t(!1)},onError:e=>{cA({level:`error`,title:`Delete failed`,detail:e.message})}})}return(0,G.jsx)(Lf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Vf,{className:`sm:max-w-md`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`Delete Project Permanently`}),(0,G.jsxs)(Gf,{children:[`This deletes `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:i}),` from its Grove and cannot be undone.`]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant`,children:[`Type `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:i}),` to confirm.`]}),(0,G.jsx)(Kf,{value:a,onChange:e=>o(e.target.value),"aria-label":`Project name confirmation`,autoComplete:`off`})]}),(0,G.jsxs)(Uf,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:s.isPending,children:`Cancel`}),(0,G.jsx)(Y,{type:`button`,variant:`destructive`,size:`sm`,onClick:l,disabled:s.isPending||!c,children:s.isPending?`Deleting…`:`Delete Permanently`})]})]})})}function f7({capId:e,scoped:t}){let n=e7[e],r=t7(t.effective,e);return(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-3 border-b border-outline-variant/15 last:border-b-0`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-on-surface`,children:n.label}),(0,G.jsx)(ri,{to:n.advancedSettingsLink,className:`text-xs text-on-surface-variant hover:text-on-surface transition-colors`,children:`Advanced settings →`})]}),(0,G.jsx)(XN,{checked:r,onCheckedChange:e=>{t.setFields([{path:n.masterGate,value:e}],`local`)}})]})}function p7({target:e,open:t,onClose:n}){let r=IO(e);return(0,G.jsxs)(SP,{open:t,onClose:n,ariaLabel:`Project capabilities`,testIdRoot:`capability-panel`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 mb-5`,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-on-surface-variant`,children:`Capabilities`}),(0,G.jsx)(`div`,{className:`text-base font-semibold text-on-surface`,children:e.project.name}),(0,G.jsx)(`div`,{className:`text-xs text-on-surface-variant`,children:`Toggles apply at Personal scope — only this machine.`})]}),(0,G.jsx)(`div`,{className:`flex flex-col`,children:nk.map(e=>(0,G.jsx)(f7,{capId:e,scoped:r},e))}),(0,G.jsx)(`div`,{className:`mt-5 pt-4 border-t border-outline-variant/15`,children:(0,G.jsx)(`button`,{type:`button`,className:`text-xs text-on-surface-variant hover:text-on-surface transition-colors`,onClick:()=>{r.resetFields(nk.map(e=>e7[e].masterGate))},children:`Reset to defaults`})})]})}function m7(){let e=Nn(),t=X5(),n=Z5(),r=Q5(),i=kO(),a=jO(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(null),[m,h]=(0,W.useState)(null),[g,_]=(0,W.useState)(!1),[v,y]=(0,W.useState)(``),[b,x]=(0,W.useState)(null),S=fs({includeArchived:g}),C=S.data?.groves??[],{data:w}=K_(),T=(0,W.useMemo)(()=>{let e=new Map;for(let t of w?.projects??[])e.set(t.project_id,t.last_activity_at);return e},[w]),E=e=>{let t=T.get(e);return t?Date.parse(t):0},D=e=>{let t=v.trim().toLowerCase();return[...t?e.projects.filter(e=>`${e.name} ${e.root}`.toLowerCase().includes(t)):e.projects].sort((e,t)=>E(t.project_id)-E(e.project_id))},O=v.trim().length>0;function k(e,t){n.mutate({groveId:e.id,projectId:t.project_id},{onSuccess:()=>cA({level:`success`,title:`Project archived`,detail:t.name}),onError:e=>cA({level:`error`,title:`Archive failed`,detail:e.message})})}function A(e,t){r.mutate({groveId:e.id,projectId:t.project_id},{onSuccess:()=>cA({level:`success`,title:`Project unarchived`,detail:t.name}),onError:e=>cA({level:`error`,title:`Unarchive failed`,detail:e.message})})}function j(e){t.mutate({id:e.id},{onSuccess:()=>{cA({level:`success`,title:`${e.name} is now the default Grove`})},onError:e=>{cA({level:`error`,title:`Failed to set default`,detail:e.message})}})}function M(e,t){if((i.data?.config.capture.ignore?.paths??[]).includes(t.root)){k(e,t);return}a.mutate({path:`capture.ignore.paths`,value:t.root},{onSuccess:()=>k(e,t),onError:e=>cA({level:`error`,title:`Ignore failed`,detail:e.message})})}return(0,G.jsxs)(vj,{isLoading:S.isLoading,error:S.error,loadingText:`Loading Groves...`,children:[(0,G.jsxs)(bj,{children:[(0,G.jsxs)(`header`,{className:`flex items-end justify-between gap-4 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(wj,{children:`Grove management`}),(0,G.jsx)(`h1`,{className:`myco-display-lg text-on-surface m-0`,children:`Groves`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`Registered local Grove projects for this daemon.`})]}),(0,G.jsxs)(Y,{size:`sm`,onClick:()=>s(!0),className:`gap-1.5`,children:[(0,G.jsx)(Xa,{className:`h-4 w-4`}),`New Grove`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`label`,{className:`flex w-full max-w-xs items-center gap-2 rounded-md border border-outline-variant/30 bg-surface px-2 py-1.5 text-sm`,children:[(0,G.jsx)(no,{className:`h-4 w-4 text-on-surface-variant`}),(0,G.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`Search projects by name or path`,className:`min-w-0 flex-1 bg-transparent outline-none placeholder:text-on-surface-variant`})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-on-surface-variant`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`h-4 w-4 accent-primary`}),`Show archived projects`]})]}),(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:C.map(t=>{let n=D(t);return O&&n.length===0?null:(0,G.jsx)(Tj,{tone:`sage`,eyebrow:`Grove`,title:t.name,actions:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t.is_default&&(0,G.jsx)(X,{variant:`outline`,children:`default`}),(0,G.jsx)(`span`,{className:`font-mono text-[11px] text-on-surface-variant`,children:O?`${n.length} of ${t.project_count}`:`${t.project_count} project${t.project_count===1?``:`s`}`}),(0,G.jsx)(i7,{groveName:t.name,projectCount:t.project_count,isDefault:t.is_default,onRename:()=>l(t),onDelete:()=>d(t),onSetDefault:()=>j(t)})]}),padded:!1,children:n.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:O?`No matching projects.`:`No projects in this Grove.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:n.map(n=>{let r=T.get(n.project_id);return(0,G.jsx)(`li`,{children:(0,G.jsx)(uM,{accent:`sage`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(ii,{to:Mo({grove:t,project:n}),className:`flex min-w-0 flex-1 items-center gap-3 hover:text-sage`,children:[(0,G.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-xs font-semibold text-white`,style:{backgroundColor:zo(n.project_id)},children:Ro(n.name)}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-sm font-medium text-on-surface`,children:n.name}),(0,G.jsx)(`span`,{className:`block truncate text-xs text-on-surface-variant font-mono`,children:n.root}),(0,G.jsx)(`span`,{className:`block truncate text-[11px] text-on-surface-variant`,children:r?`last active ${Z_(r)}`:`no activity yet`})]}),n.manifest_state!==`present`&&(0,G.jsx)(X,{variant:`outline`,children:n.manifest_state}),n.status===`archived`&&(0,G.jsx)(X,{variant:`outline`,children:`archived`})]}),n.capabilities&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>x({grove:t,project:n}),"aria-label":`Configure ${n.name} capabilities`,title:`Configure capabilities`,"data-testid":`capability-badge-strip`,className:`shrink-0 flex flex-wrap items-center gap-1 rounded-md p-1 hover:bg-surface-container-high transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,children:n7(n.capabilities).map(e=>(0,G.jsx)(y$,{chip:e},e.id))}),(0,G.jsx)(a7,{projectName:n.name,archived:n.status===`archived`,onOpen:()=>e(Mo({grove:t,project:n})),onMove:()=>p({grove:t,project:n}),onIgnore:()=>M(t,n),onArchive:()=>k(t,n),onUnarchive:()=>A(t,n),onDelete:()=>h({grove:t,project:n})})]})})},n.project_id)})})},t.id)})})]}),(0,G.jsx)(s7,{open:o,onOpenChange:s}),c&&(0,G.jsx)(c7,{open:c!==null,onOpenChange:e=>!e&&l(null),groveId:c.id,currentName:c.name}),u&&(0,G.jsx)(l7,{open:u!==null,onOpenChange:e=>!e&&d(null),groveId:u.id,groveName:u.name,projectCount:u.project_count}),f&&(0,G.jsx)(u7,{open:f!==null,onOpenChange:e=>!e&&p(null),sourceGroveId:f.grove.id,projectId:f.project.project_id,projectName:f.project.name,groves:C}),m&&(0,G.jsx)(d7,{open:m!==null,onOpenChange:e=>!e&&h(null),groveId:m.grove.id,projectId:m.project.project_id,projectName:m.project.name}),b&&(0,G.jsx)(p7,{target:b,open:!0,onClose:()=>x(null)})]})}function h7(){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(lA,{}),(0,G.jsxs)(dr,{children:[(0,G.jsx)(lr,{path:`/`,element:(0,G.jsx)(g7,{})}),(0,G.jsxs)(lr,{element:(0,G.jsx)(hs,{children:(0,G.jsx)(ek,{children:(0,G.jsx)(nA,{})})}),children:[(0,G.jsx)(lr,{path:`/onboarding`,element:(0,G.jsx)(G5,{})}),(0,G.jsx)(lr,{path:`/groves`,element:(0,G.jsx)(m7,{})}),(0,G.jsx)(lr,{path:`/symbionts`,element:(0,G.jsx)(E$,{})}),(0,G.jsx)(lr,{path:`/logs`,element:(0,G.jsx)(e5,{})}),(0,G.jsx)(lr,{path:`/machine`,element:(0,G.jsx)(f5,{})}),(0,G.jsx)(lr,{path:`/settings`,element:(0,G.jsx)(E7,{})}),(0,G.jsx)(lr,{path:`/machine/settings`,element:(0,G.jsx)(w7,{})}),(0,G.jsx)(lr,{path:`/system`,element:(0,G.jsx)(sr,{to:`/settings#logging`,replace:!0})})]}),(0,G.jsxs)(lr,{path:`/g/:groveSlug/p/:projectSlug`,element:(0,G.jsx)(D7,{}),children:[(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(zj,{})}),(0,G.jsx)(lr,{path:`sessions`,element:(0,G.jsx)(JN,{})}),(0,G.jsx)(lr,{path:`sessions/:id`,element:(0,G.jsx)(JN,{})}),(0,G.jsx)(lr,{path:`cortex`,element:(0,G.jsx)(tF,{})}),(0,G.jsx)(lr,{path:`mycelium`,element:(0,G.jsx)(v$,{})}),(0,G.jsx)(lr,{path:`agent`,element:(0,G.jsx)(p4,{})}),(0,G.jsx)(lr,{path:`agent/:id`,element:(0,G.jsx)(p4,{})}),(0,G.jsx)(lr,{path:`skills`,element:(0,G.jsx)(J4,{})}),(0,G.jsx)(lr,{path:`settings`,element:(0,G.jsx)(T7,{})}),(0,G.jsx)(lr,{path:`operations`,element:(0,G.jsx)(x7,{})}),(0,G.jsx)(lr,{path:`team`,element:(0,G.jsx)(y7,{})})]}),(0,G.jsx)(lr,{path:`/g/:groveSlug/dashboard`,element:(0,G.jsx)(O7,{}),children:(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(X6,{})})}),(0,G.jsx)(lr,{path:`/g/:groveSlug/operations`,element:(0,G.jsx)(O7,{}),children:(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(S8,{})})}),(0,G.jsx)(lr,{path:`/g/:groveSlug/settings`,element:(0,G.jsx)(C7,{})}),(0,G.jsx)(lr,{path:`/g/:groveSlug/maintenance`,element:(0,G.jsx)(S7,{})}),(0,G.jsxs)(lr,{path:`/g/:groveSlug/team`,element:(0,G.jsx)(O7,{}),children:[(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(W5,{})}),(0,G.jsx)(lr,{path:`maintenance`,element:(0,G.jsx)(b7,{})})]}),(0,G.jsx)(lr,{path:`/sessions`,element:(0,G.jsx)(_7,{suffix:`/sessions`})}),(0,G.jsx)(lr,{path:`/sessions/:id`,element:(0,G.jsx)(_7,{suffixFromPath:!0})}),(0,G.jsx)(lr,{path:`/cortex`,element:(0,G.jsx)(_7,{suffix:`/cortex`})}),(0,G.jsx)(lr,{path:`/mycelium`,element:(0,G.jsx)(_7,{suffix:`/mycelium`})}),(0,G.jsx)(lr,{path:`/agent`,element:(0,G.jsx)(_7,{suffix:`/agent`})}),(0,G.jsx)(lr,{path:`/agent/:id`,element:(0,G.jsx)(_7,{suffixFromPath:!0})}),(0,G.jsx)(lr,{path:`/skills`,element:(0,G.jsx)(_7,{suffix:`/skills`})}),(0,G.jsx)(lr,{path:`/operations`,element:(0,G.jsx)(v7,{suffix:`/operations`})}),(0,G.jsx)(lr,{path:`/team`,element:(0,G.jsx)(v7,{suffix:`/team`})}),(0,G.jsx)(lr,{path:`*`,element:(0,G.jsx)(sr,{to:`/`,replace:!0})})]})]})}function g7(){let{data:e,isLoading:t,error:n}=fs();if(t)return(0,G.jsx)(k7,{text:`Loading projects...`});if(n)return(0,G.jsx)(k7,{text:n.message});let r=e?.groves??[],i=Lo(r)??jo(r);return i?(0,G.jsx)(sr,{to:Mo(i),replace:!0}):(0,G.jsx)(sr,{to:`/onboarding`,replace:!0})}function _7({suffix:e,suffixFromPath:t=!1}){let n=An(),{data:r,isLoading:i,error:a}=fs();if(i)return(0,G.jsx)(k7,{text:`Loading projects...`});if(a)return(0,G.jsx)(k7,{text:a.message});let o=Lo(r?.groves??[])??jo(r?.groves??[]);return o?(0,G.jsx)(sr,{to:Mo(o,t?n.pathname:e),replace:!0}):(0,G.jsx)(sr,{to:`/onboarding`,replace:!0})}function v7({suffix:e}){let{data:t,isLoading:n,error:r}=fs();if(n)return(0,G.jsx)(k7,{text:`Loading Grove...`});if(r)return(0,G.jsx)(k7,{text:r.message});let i=t?.groves??[],a=(Lo(i)??jo(i))?.grove??i[0];if(!a)return(0,G.jsx)(sr,{to:`/onboarding`,replace:!0});let o=e.startsWith(`/`)?e:`/${e}`;return(0,G.jsx)(sr,{to:`/g/${a.slug}${o}`,replace:!0})}function y7(){let{groveSlug:e}=Ln();return e?(0,G.jsx)(sr,{to:`/g/${e}/team`,replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function b7(){let{groveSlug:e}=Ln();return e?(0,G.jsx)(sr,{to:`/g/${e}/team?tab=sync`,replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function x7(){let{groveSlug:e}=Ln();return e?(0,G.jsx)(sr,{to:`/g/${e}/operations`,replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function S7(){let{groveSlug:e}=Ln();return e?(0,G.jsx)(sr,{to:`/g/${e}/operations`,replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function C7(){return(0,G.jsx)(sr,{to:`/settings#backup`,replace:!0})}function w7(){return(0,G.jsx)(sr,{to:`/settings#logging`,replace:!0})}function T7(){let e=An();return(0,G.jsx)(sr,{to:`/settings${e.search}${e.hash}`,replace:!0})}function E7(){let{data:e,isLoading:t,error:n}=fs();if(t)return(0,G.jsx)(k7,{text:`Loading settings...`});if(n)return(0,G.jsx)(k7,{text:n.message});let r=e?.groves??[],i=Lo(r)??jo(r);return i?(0,G.jsx)(ms,{selection:i,children:(0,G.jsx)(ek,{children:(0,G.jsx)(v6,{})})}):(0,G.jsx)(hs,{children:(0,G.jsx)(ek,{children:(0,G.jsx)(v6,{})})})}function D7(){let{groveSlug:e,projectSlug:t}=Ln(),{data:n,isLoading:r,error:i}=fs();if(r)return(0,G.jsx)(k7,{text:`Loading project...`});if(i)return(0,G.jsx)(k7,{text:i.message});let a=Ao(n?.groves??[],e,t);return a?(0,G.jsx)(ms,{selection:a,children:(0,G.jsx)(ek,{children:(0,G.jsx)(nA,{})})}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function O7(){let{groveSlug:e}=Ln(),{data:t,isLoading:n,error:r}=fs();if(n)return(0,G.jsx)(k7,{text:`Loading Grove...`});if(r)return(0,G.jsx)(k7,{text:r.message});let i=(t?.groves??[]).find(t=>t.slug===e);if(!i)return(0,G.jsx)(sr,{to:`/`,replace:!0});let a=i.projects[0];return a?(0,G.jsx)(ms,{selection:{grove:i,project:a},children:(0,G.jsx)(ek,{children:(0,G.jsx)(nA,{})})}):(0,G.jsx)(sr,{to:`/onboarding`,replace:!0})}function k7({text:e}){return(0,G.jsx)(`div`,{className:`flex h-screen items-center justify-center bg-surface text-sm text-on-surface-variant`,children:e})}XO();var A7=new Be({defaultOptions:{queries:{staleTime:Ds}}});Si.createRoot(document.getElementById(`root`)).render((0,G.jsx)(W.StrictMode,{children:(0,G.jsx)(ki,{children:(0,G.jsx)(Ge,{client:A7,children:(0,G.jsx)(ei,{basename:Bo()||void 0,children:(0,G.jsx)(h7,{})})})})}));
|