memhouse 0.4.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +244 -114
- package/bin/memhouse.js +1169 -233
- package/editors/base.js +6 -0
- package/editors/claude.js +44 -9
- package/editors/goose.js +4 -0
- package/editors/index.js +0 -0
- package/editors/opencode.js +3 -0
- package/{mem-house → memhouse}/COMPETITION.md +5 -5
- package/{mem-house → memhouse}/DESIGN.md +18 -12
- package/memhouse/RESUME-AND-UPDATE.md +185 -0
- package/{mem-house → memhouse}/delivery/AGENT-INSTALL-PROMPT.md +1 -1
- package/{mem-house → memhouse}/delivery/AGENT-INSTALL.md +9 -7
- package/{mem-house → memhouse}/delivery/PROMPT.md +8 -8
- package/{mem-house → memhouse}/delivery/kernel-install.md +3 -3
- package/{mem-house → memhouse}/delivery/plugin/.claude-plugin/plugin.json +1 -1
- package/{mem-house/delivery/skills/memhouse-search → memhouse/delivery/plugin/skills/search}/SKILL.md +60 -18
- package/memhouse/delivery/plugin/skills/sessions/SKILL.md +177 -0
- package/memhouse/delivery/plugin/skills/sql/SKILL.md +206 -0
- package/memhouse/host.js +101 -0
- package/{mem-house → memhouse}/per-member/INSTALL.md +59 -14
- package/{mem-house → memhouse}/per-member/SCHEMA.md +47 -0
- package/memhouse/per-member/provision.js +265 -0
- package/memhouse/per-member/rooms.js +235 -0
- package/memhouse/per-member/schema-member.sql.tpl +125 -0
- package/{mem-house → memhouse}/per-member/schema-merge.sql.tpl +3 -3
- package/memhouse/resume.js +150 -0
- package/memhouse/self-update.js +150 -0
- package/{mem-house → memhouse}/server/queries.js +80 -34
- package/memhouse/server/server.js +451 -0
- package/{mem-house → memhouse}/service.js +48 -29
- package/memhouse/shipper/ship.js +949 -0
- package/package.json +5 -20
- package/public/assets/{index-CtH-5i95.js → index-CnWzrjF3.js} +10 -7
- package/public/index.html +2 -2
- package/ui/index.html +1 -1
- package/ui/src/App.jsx +1 -1
- package/ui/src/lib/api.js +29 -13
- package/ui/src/pages/Dashboard.jsx +8 -5
- package/ui/src/pages/Sessions.jsx +3 -1
- package/ui/src/pages/SqlViewer.jsx +6 -23
- package/cache.js +0 -850
- package/ch-ingest.js +0 -329
- package/ch-schema.js +0 -152
- package/clickhouse.js +0 -87
- package/index.js +0 -425
- package/mcp-server.js +0 -294
- package/mem-house/delivery/install.sh +0 -183
- package/mem-house/delivery/skills/memhouse-sessions/SKILL.md +0 -125
- package/mem-house/delivery/skills/memhouse-sql/SKILL.md +0 -146
- package/mem-house/per-member/provision.js +0 -142
- package/mem-house/per-member/rooms.js +0 -132
- package/mem-house/per-member/schema-member.sql.tpl +0 -85
- package/mem-house/server/server.js +0 -228
- package/mem-house/shipper/ship.js +0 -504
- package/relay-client.js +0 -306
- package/relay-server.js +0 -577
- package/server.js +0 -860
- package/share-image.js +0 -367
- /package/{mem-house → memhouse}/deploy.js +0 -0
- /package/{mem-house → memhouse}/envfile.js +0 -0
- /package/{mem-house → memhouse}/per-member/PLAN.md +0 -0
- /package/{mem-house → memhouse}/per-member/PROVISIONING.md +0 -0
- /package/{mem-house → memhouse}/per-member/README.md +0 -0
- /package/{mem-house → memhouse}/per-member/SHARING.md +0 -0
|
@@ -8,7 +8,10 @@ Error generating stack: `+e.message+`
|
|
|
8
8
|
`+e.stack}}var we=Object.prototype.hasOwnProperty,Te=t.unstable_scheduleCallback,Ee=t.unstable_cancelCallback,De=t.unstable_shouldYield,Oe=t.unstable_requestPaint,ke=t.unstable_now,Ae=t.unstable_getCurrentPriorityLevel,je=t.unstable_ImmediatePriority,Me=t.unstable_UserBlockingPriority,Ne=t.unstable_NormalPriority,Pe=t.unstable_LowPriority,Fe=t.unstable_IdlePriority,Ie=t.log,Le=t.unstable_setDisableYieldValue,Re=null,ze=null;function Be(e){if(typeof Ie==`function`&&Le(e),ze&&typeof ze.setStrictMode==`function`)try{ze.setStrictMode(Re,e)}catch{}}var Ve=Math.clz32?Math.clz32:We,He=Math.log,Ue=Math.LN2;function We(e){return e>>>=0,e===0?32:31-(He(e)/Ue|0)|0}var Ge=256,Ke=262144,qe=4194304;function Je(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 Ye(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=Je(n))):i=Je(o):i=Je(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Je(n))):i=Je(o)):i=Je(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 Xe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ze(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 Qe(){var e=qe;return qe<<=1,!(qe&62914560)&&(qe=4194304),e}function $e(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function et(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function tt(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-Ve(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&&nt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function nt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ve(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function rt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ve(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function it(e,t){var n=t&-t;return n=n&42?1:at(n),(n&(e.suspendedLanes|t))===0?n:0}function at(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ot(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function st(){var e=N.p;return e===0?(e=window.event,e===void 0?32:Sp(e.type)):e}function ct(e,t){var n=N.p;try{return N.p=e,t()}finally{N.p=n}}var lt=Math.random().toString(36).slice(2),ut=`__reactFiber$`+lt,dt=`__reactProps$`+lt,ft=`__reactContainer$`+lt,pt=`__reactEvents$`+lt,mt=`__reactListeners$`+lt,ht=`__reactHandles$`+lt,gt=`__reactResources$`+lt,_t=`__reactMarker$`+lt;function vt(e){delete e[ut],delete e[dt],delete e[pt],delete e[mt],delete e[ht]}function yt(e){var t=e[ut];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ft]||n[ut]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=yf(e);e!==null;){if(n=e[ut])return n;e=yf(e)}return t}e=n,n=e.parentNode}return null}function bt(e){if(e=e[ut]||e[ft]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function xt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function St(e){var t=e[gt];return t||=e[gt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Ct(e){e[_t]=!0}var wt=new Set,Tt={};function Et(e,t){Dt(e,t),Dt(e+`Capture`,t)}function Dt(e,t){for(Tt[e]=t,e=0;e<t.length;e++)wt.add(t[e])}var Ot=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]*$`),kt={},At={};function jt(e){return we.call(At,e)?!0:we.call(kt,e)?!1:Ot.test(e)?At[e]=!0:(kt[e]=!0,!1)}function Mt(e,t,n){if(jt(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 Nt(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 Pt(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 Ft(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function It(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Lt(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 Rt(e){if(!e._valueTracker){var t=It(e)?`checked`:`value`;e._valueTracker=Lt(e,t,``+e[t])}}function zt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=It(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Bt(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 Vt=/[\n"\\]/g;function Ht(e){return e.replace(Vt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Ut(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=``+Ft(t)):e.value!==``+Ft(t)&&(e.value=``+Ft(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Gt(e,o,Ft(n)):Gt(e,o,Ft(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=``+Ft(s):e.removeAttribute(`name`)}function Wt(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)){Rt(e);return}n=n==null?``:``+Ft(n),t=t==null?n:``+Ft(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),Rt(e)}function Gt(e,t,n){t===`number`&&Bt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Kt(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=``+Ft(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 qt(e,t,n){if(t!=null&&(t=``+Ft(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Ft(n)}function Jt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(re(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Ft(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Rt(e)}function Yt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Xt=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 Zt(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||Xt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Qt(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&&Zt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Zt(e,o,t[o])}function $t(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 en=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`]]),tn=/^[\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 nn(e){return tn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function rn(){}var an=null;function on(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var sn=null,cn=null;function ln(e){var t=bt(e);if(t&&(e=t.stateNode)){var n=e[dt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Ut(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="`+Ht(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[dt]||null;if(!a)throw Error(i(90));Ut(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&&zt(r)}break a;case`textarea`:qt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Kt(e,!!n.multiple,t,!1)}}}var un=!1;function dn(e,t,n){if(un)return e(t,n);un=!0;try{return e(t)}finally{if(un=!1,(sn!==null||cn!==null)&&(Eu(),sn&&(t=sn,e=cn,cn=sn=null,ln(t),e)))for(t=0;t<e.length;t++)ln(e[t])}}function fn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[dt]||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 pn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),mn=!1;if(pn)try{var hn={};Object.defineProperty(hn,`passive`,{get:function(){mn=!0}}),window.addEventListener(`test`,hn,hn),window.removeEventListener(`test`,hn,hn)}catch{mn=!1}var gn=null,_n=null,vn=null;function yn(){if(vn)return vn;var e,t=_n,n=t.length,r,i=`value`in gn?gn.value:gn.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 vn=i.slice(e,1<r?1-r:void 0)}function bn(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 xn(){return!0}function Sn(){return!1}function Cn(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)?xn:Sn,this.isPropagationStopped=Sn,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=xn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=xn)},persist:function(){},isPersistent:xn}),t}var wn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Tn=Cn(wn),En=m({},wn,{view:0,detail:0}),Dn=Cn(En),On,kn,An,jn=m({},En,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Hn,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!==An&&(An&&e.type===`mousemove`?(On=e.screenX-An.screenX,kn=e.screenY-An.screenY):kn=On=0,An=e),On)},movementY:function(e){return`movementY`in e?e.movementY:kn}}),Mn=Cn(jn),Nn=Cn(m({},jn,{dataTransfer:0})),Pn=Cn(m({},En,{relatedTarget:0})),Fn=Cn(m({},wn,{animationName:0,elapsedTime:0,pseudoElement:0})),In=Cn(m({},wn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Ln=Cn(m({},wn,{data:0})),Rn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},zn={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`},Bn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Vn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Bn[e])?!!t[e]:!1}function Hn(){return Vn}var Un=Cn(m({},En,{key:function(e){if(e.key){var t=Rn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=bn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?zn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Hn,charCode:function(e){return e.type===`keypress`?bn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?bn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Wn=Cn(m({},jn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Gn=Cn(m({},En,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Hn})),Kn=Cn(m({},wn,{propertyName:0,elapsedTime:0,pseudoElement:0})),qn=Cn(m({},jn,{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})),Jn=Cn(m({},wn,{newState:0,oldState:0})),Yn=[9,13,27,32],Xn=pn&&`CompositionEvent`in window,Zn=null;pn&&`documentMode`in document&&(Zn=document.documentMode);var Qn=pn&&`TextEvent`in window&&!Zn,F=pn&&(!Xn||Zn&&8<Zn&&11>=Zn),$n=` `,er=!1;function tr(e,t){switch(e){case`keyup`:return Yn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function nr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var rr=!1;function ir(e,t){switch(e){case`compositionend`:return nr(t);case`keypress`:return t.which===32?(er=!0,$n):null;case`textInput`:return e=t.data,e===$n&&er?null:e;default:return null}}function ar(e,t){if(rr)return e===`compositionend`||!Xn&&tr(e,t)?(e=yn(),vn=_n=gn=null,rr=!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 F&&t.locale!==`ko`?null:t.data;default:return null}}var or={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 sr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!or[e.type]:t===`textarea`}function cr(e,t,n,r){sn?cn?cn.push(r):cn=[r]:sn=r,t=Nd(t,`onChange`),0<t.length&&(n=new Tn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var I=null,lr=null;function ur(e){Ed(e,0)}function dr(e){if(zt(xt(e)))return e}function fr(e,t){if(e===`change`)return t}var pr=!1;if(pn){var mr;if(pn){var hr=`oninput`in document;if(!hr){var gr=document.createElement(`div`);gr.setAttribute(`oninput`,`return;`),hr=typeof gr.oninput==`function`}mr=hr}else mr=!1;pr=mr&&(!document.documentMode||9<document.documentMode)}function _r(){I&&(I.detachEvent(`onpropertychange`,vr),lr=I=null)}function vr(e){if(e.propertyName===`value`&&dr(lr)){var t=[];cr(t,lr,e,on(e)),dn(ur,t)}}function yr(e,t,n){e===`focusin`?(_r(),I=t,lr=n,I.attachEvent(`onpropertychange`,vr)):e===`focusout`&&_r()}function br(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return dr(lr)}function xr(e,t){if(e===`click`)return dr(t)}function Sr(e,t){if(e===`input`||e===`change`)return dr(t)}function Cr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var wr=typeof Object.is==`function`?Object.is:Cr;function Tr(e,t){if(wr(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(!we.call(t,i)||!wr(e[i],t[i]))return!1}return!0}function Er(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dr(e,t){var n=Er(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=Er(n)}}function Or(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Or(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bt(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=Bt(e.document)}return t}function Ar(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 jr=pn&&`documentMode`in document&&11>=document.documentMode,Mr=null,Nr=null,Pr=null,Fr=!1;function Ir(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Fr||Mr==null||Mr!==Bt(r)||(r=Mr,`selectionStart`in r&&Ar(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}),Pr&&Tr(Pr,r)||(Pr=r,r=Nd(Nr,`onSelect`),0<r.length&&(t=new Tn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Mr)))}function Lr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Rr={animationend:Lr(`Animation`,`AnimationEnd`),animationiteration:Lr(`Animation`,`AnimationIteration`),animationstart:Lr(`Animation`,`AnimationStart`),transitionrun:Lr(`Transition`,`TransitionRun`),transitionstart:Lr(`Transition`,`TransitionStart`),transitioncancel:Lr(`Transition`,`TransitionCancel`),transitionend:Lr(`Transition`,`TransitionEnd`)},zr={},Br={};pn&&(Br=document.createElement(`div`).style,`AnimationEvent`in window||(delete Rr.animationend.animation,delete Rr.animationiteration.animation,delete Rr.animationstart.animation),`TransitionEvent`in window||delete Rr.transitionend.transition);function Vr(e){if(zr[e])return zr[e];if(!Rr[e])return e;var t=Rr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Br)return zr[e]=t[n];return e}var Hr=Vr(`animationend`),Ur=Vr(`animationiteration`),Wr=Vr(`animationstart`),Gr=Vr(`transitionrun`),Kr=Vr(`transitionstart`),qr=Vr(`transitioncancel`),Jr=Vr(`transitionend`),Yr=new Map,Xr=`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(` `);Xr.push(`scrollEnd`);function Zr(e,t){Yr.set(e,t),Et(t,[e])}var Qr=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)},$r=[],ei=0,ti=0;function ni(){for(var e=ei,t=ti=ei=0;t<e;){var n=$r[t];$r[t++]=null;var r=$r[t];$r[t++]=null;var i=$r[t];$r[t++]=null;var a=$r[t];if($r[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&&oi(n,i,a)}}function ri(e,t,n,r){$r[ei++]=e,$r[ei++]=t,$r[ei++]=n,$r[ei++]=r,ti|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ii(e,t,n,r){return ri(e,t,n,r),si(e)}function ai(e,t){return ri(e,null,null,t),si(e)}function oi(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-Ve(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function si(e){if(50<_u)throw _u=0,vu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ci={};function li(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 ui(e,t,n,r){return new li(e,t,n,r)}function di(e){return e=e.prototype,!(!e||!e.isReactComponent)}function fi(e,t){var n=e.alternate;return n===null?(n=ui(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 pi(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 mi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)di(e)&&(s=1);else if(typeof e==`string`)s=Zf(e,n,le.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ui(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return hi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ui(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ui(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ui(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=ui(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function hi(e,t,n,r){return e=ui(7,e,r,t),e.lanes=n,e}function gi(e,t,n){return e=ui(6,e,null,t),e.lanes=n,e}function _i(e){var t=ui(18,null,null,0);return t.stateNode=e,t}function vi(e,t,n){return t=ui(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var yi=new WeakMap;function bi(e,t){if(typeof e==`object`&&e){var n=yi.get(e);return n===void 0?(t={value:e,source:t,stack:Ce(t)},yi.set(e,t),t):n}return{value:e,source:t,stack:Ce(t)}}var xi=[],Si=0,Ci=null,wi=0,Ti=[],Ei=0,Di=null,Oi=1,ki=``;function Ai(e,t){xi[Si++]=wi,xi[Si++]=Ci,Ci=e,wi=t}function ji(e,t,n){Ti[Ei++]=Oi,Ti[Ei++]=ki,Ti[Ei++]=Di,Di=e;var r=Oi;e=ki;var i=32-Ve(r)-1;r&=~(1<<i),n+=1;var a=32-Ve(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Oi=1<<32-Ve(t)+i|n<<i|r,ki=a+e}else Oi=1<<a|n<<i|r,ki=e}function Mi(e){e.return!==null&&(Ai(e,1),ji(e,1,0))}function Ni(e){for(;e===Ci;)Ci=xi[--Si],xi[Si]=null,wi=xi[--Si],xi[Si]=null;for(;e===Di;)Di=Ti[--Ei],Ti[Ei]=null,ki=Ti[--Ei],Ti[Ei]=null,Oi=Ti[--Ei],Ti[Ei]=null}function Pi(e,t){Ti[Ei++]=Oi,Ti[Ei++]=ki,Ti[Ei++]=Di,Oi=t.id,ki=t.overflow,Di=e}var Fi=null,Ii=null,Li=!1,Ri=null,zi=!1,Bi=Error(i(519));function Vi(e){throw qi(bi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Bi}function Hi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ut]=e,t[dt]=r,n){case`dialog`:G(`cancel`,t),G(`close`,t);break;case`iframe`:case`object`:case`embed`:G(`load`,t);break;case`video`:case`audio`:for(n=0;n<wd.length;n++)G(wd[n],t);break;case`source`:G(`error`,t);break;case`img`:case`image`:case`link`:G(`error`,t),G(`load`,t);break;case`details`:G(`toggle`,t);break;case`input`:G(`invalid`,t),Wt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:G(`invalid`,t);break;case`textarea`:G(`invalid`,t),Jt(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||zd(t.textContent,n)?(r.popover!=null&&(G(`beforetoggle`,t),G(`toggle`,t)),r.onScroll!=null&&G(`scroll`,t),r.onScrollEnd!=null&&G(`scrollend`,t),r.onClick!=null&&(t.onclick=rn),t=!0):t=!1,t||Vi(e,!0)}function Ui(e){for(Fi=e.return;Fi;)switch(Fi.tag){case 5:case 31:case 13:zi=!1;return;case 27:case 3:zi=!0;return;default:Fi=Fi.return}}function Wi(e){if(e!==Fi)return!1;if(!Li)return Ui(e),Li=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Zd(e.type,e.memoizedProps)),n=!n),n&&Ii&&Vi(e),Ui(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ii=vf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ii=vf(e)}else t===27?(t=Ii,of(e.type)?(e=_f,_f=null,Ii=e):Ii=t):Ii=Fi?gf(e.stateNode.nextSibling):null;return!0}function Gi(){Ii=Fi=null,Li=!1}function Ki(){var e=Ri;return e!==null&&(ru===null?ru=e:ru.push.apply(ru,e),Ri=null),e}function qi(e){Ri===null?Ri=[e]:Ri.push(e)}var Ji=se(null),Yi=null,Xi=null;function Zi(e,t,n){P(Ji,t._currentValue),t._currentValue=n}function Qi(e){e._currentValue=Ji.current,ce(Ji)}function $i(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 ea(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),$i(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),$i(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 ta(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;wr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===fe.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[op]:e.push(op))}a=a.return}e!==null&&ea(t,e,n,r),t.flags|=262144}function na(e){for(e=e.firstContext;e!==null;){if(!wr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ra(e){Yi=e,Xi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ia(e){return oa(Yi,e)}function aa(e,t){return Yi===null&&ra(e),oa(e,t)}function oa(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Xi===null){if(e===null)throw Error(i(308));Xi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xi=Xi.next=t;return n}var sa=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()})}},ca=t.unstable_scheduleCallback,la=t.unstable_NormalPriority,ua={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function da(){return{controller:new sa,data:new Map,refCount:0}}function fa(e){e.refCount--,e.refCount===0&&ca(la,function(){e.controller.abort()})}var pa=null,ma=0,ha=0,ga=null;function _a(e,t){if(pa===null){var n=pa=[];ma=0,ha=vd(),ga={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ma++,t.then(va,va),t}function va(){if(--ma===0&&pa!==null){ga!==null&&(ga.status=`fulfilled`);var e=pa;pa=null,ha=0,ga=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ya(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 ba=M.S;M.S=function(e,t){ou=ke(),typeof t==`object`&&t&&typeof t.then==`function`&&_a(e,t),ba!==null&&ba(e,t)};var xa=se(null);function Sa(){var e=xa.current;return e===null?Ul.pooledCache:e}function Ca(e,t){t===null?P(xa,xa.current):P(xa,t.pool)}function wa(){var e=Sa();return e===null?null:{parent:ua._currentValue,pool:e}}var Ta=Error(i(460)),Ea=Error(i(474)),Da=Error(i(542)),Oa={then:function(){}};function ka(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Aa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(rn,rn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Pa(e),e;default:if(typeof t.status==`string`)t.then(rn,rn);else{if(e=Ul,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,Pa(e),e}throw Ma=t,Ta}}function ja(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ma=e,Ta):e}}var Ma=null;function Na(){if(Ma===null)throw Error(i(459));var e=Ma;return Ma=null,e}function Pa(e){if(e===Ta||e===Da)throw Error(i(483))}var Fa=null,Ia=0;function La(e){var t=Ia;return Ia+=1,Fa===null&&(Fa=[]),Aa(Fa,e,t)}function Ra(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function za(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 Ba(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=fi(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=gi(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&&ja(i)===t.type)?(t=a(t,n.props),Ra(t,n),t.return=e,t):(t=mi(n.type,n.key,n.props,null,e.mode,r),Ra(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=vi(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=hi(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=gi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=mi(t.type,t.key,t.props,null,e.mode,n),Ra(n,t),n.return=e,n;case v:return t=vi(t,e.mode,n),t.return=e,t;case O:return t=ja(t),f(e,t,n)}if(re(t)||ee(t))return t=hi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,La(t),n);if(t.$$typeof===C)return f(e,aa(e,t),n);za(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=ja(n),p(e,t,n,r)}if(re(n)||ee(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,La(n),r);if(n.$$typeof===C)return p(e,t,aa(e,n),r);za(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=ja(r),m(e,t,n,r,i)}if(re(r)||ee(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,La(r),i);if(r.$$typeof===C)return m(e,t,n,aa(t,r),i);za(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),Li&&Ai(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 Li&&Ai(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)}),Li&&Ai(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),Li&&Ai(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 Li&&Ai(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)}),Li&&Ai(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&&ja(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ra(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=hi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=mi(o.type,o.key,o.props,null,e.mode,c),Ra(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=vi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=ja(o),b(e,r,o,c)}if(re(o))return h(e,r,o,c);if(ee(o)){if(l=ee(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,La(o),c);if(o.$$typeof===C)return b(e,r,aa(e,o),c);za(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=gi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ia=0;var i=b(e,t,n,r);return Fa=null,i}catch(t){if(t===Ta||t===Da)throw t;var a=ui(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Va=Ba(!0),Ha=Ba(!1),Ua=!1;function Wa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ga(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 Ka(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function qa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,H&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=si(e),oi(e,null,n),t}return ri(e,r,t,n),si(e)}function Ja(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,rt(e,n)}}function Ya(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 Xa=!1;function Za(){if(Xa){var e=ga;if(e!==null)throw e}}function Qa(e,t,n,r){Xa=!1;var i=e.updateQueue;Ua=!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?(W&f)===f:(r&f)===f){f!==0&&f===ha&&(Xa=!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:Ua=!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),Zl|=o,e.lanes=o,e.memoizedState=d}}function $a(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function eo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)$a(n[e],t)}var to=se(null),no=se(0);function ro(e,t){e=Yl,P(no,e),P(to,t),Yl=e|t.baseLanes}function io(){P(no,Yl),P(to,to.current)}function ao(){Yl=no.current,ce(to),ce(no)}var oo=se(null),so=null;function co(e){var t=e.alternate;P(mo,mo.current&1),P(oo,e),so===null&&(t===null||to.current!==null||t.memoizedState!==null)&&(so=e)}function lo(e){P(mo,mo.current),P(oo,e),so===null&&(so=e)}function uo(e){e.tag===22?(P(mo,mo.current),P(oo,e),so===null&&(so=e)):fo(e)}function fo(){P(mo,mo.current),P(oo,oo.current)}function po(e){ce(oo),so===e&&(so=null),ce(mo)}var mo=se(0);function ho(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||pf(n)||mf(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 go=0,L=null,R=null,_o=null,z=!1,vo=!1,B=!1,yo=0,bo=0,V=null,xo=0;function So(){throw Error(i(321))}function Co(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wr(e[n],t[n]))return!1;return!0}function wo(e,t,n,r,i,a){return go=a,L=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?Vs:Hs,B=!1,a=n(r,i),B=!1,vo&&(a=Eo(t,n,r,i)),To(e),a}function To(e){M.H=Bs;var t=R!==null&&R.next!==null;if(go=0,_o=R=L=null,z=!1,bo=0,V=null,t)throw Error(i(300));e===null||ac||(e=e.dependencies,e!==null&&na(e)&&(ac=!0))}function Eo(e,t,n,r){L=e;var a=0;do{if(vo&&(V=null),bo=0,vo=!1,25<=a)throw Error(i(301));if(a+=1,_o=R=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}M.H=Us,o=t(n,r)}while(vo);return o}function Do(){var e=M.H,t=e.useState()[0];return t=typeof t.then==`function`?Po(t):t,e=e.useState()[0],(R===null?null:R.memoizedState)!==e&&(L.flags|=1024),t}function Oo(){var e=yo!==0;return yo=0,e}function ko(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Ao(e){if(z){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}z=!1}go=0,_o=R=L=null,vo=!1,bo=yo=0,V=null}function jo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _o===null?L.memoizedState=_o=e:_o=_o.next=e,_o}function Mo(){if(R===null){var e=L.alternate;e=e===null?null:e.memoizedState}else e=R.next;var t=_o===null?L.memoizedState:_o.next;if(t!==null)_o=t,R=e;else{if(e===null)throw L.alternate===null?Error(i(467)):Error(i(310));R=e,e={memoizedState:R.memoizedState,baseState:R.baseState,baseQueue:R.baseQueue,queue:R.queue,next:null},_o===null?L.memoizedState=_o=e:_o=_o.next=e}return _o}function No(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Po(e){var t=bo;return bo+=1,V===null&&(V=[]),e=Aa(V,e,t),t=L,(_o===null?t.memoizedState:_o.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?Vs:Hs),e}function Fo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Po(e);if(e.$$typeof===C)return ia(e)}throw Error(i(438,String(e)))}function Io(e){var t=null,n=L.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=L.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=No(),L.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 Lo(e,t){return typeof t==`function`?t(e):t}function Ro(e){return zo(Mo(),R,e)}function zo(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?(go&f)===f:(W&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===ha&&(d=!0);else if((go&p)===p){u=u.next,p===ha&&(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,L.lanes|=p,Zl|=p;f=u.action,B&&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,L.lanes|=f,Zl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!wr(o,e.memoizedState)&&(ac=!0,d&&(n=ga,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 Bo(e){var t=Mo(),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);wr(o,t.memoizedState)||(ac=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Vo(e,t,n){var r=L,a=Mo(),o=Li;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!wr((R||a).memoizedState,n);if(s&&(a.memoizedState=n,ac=!0),a=a.queue,fs(Wo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||_o!==null&&_o.memoizedState.tag&1){if(r.flags|=2048,ss(9,{destroy:void 0},Uo.bind(null,r,a,n,t),null),Ul===null)throw Error(i(349));o||go&127||Ho(r,t,n)}return n}function Ho(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=L.updateQueue,t===null?(t=No(),L.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Uo(e,t,n,r){t.value=n,t.getSnapshot=r,Go(t)&&Ko(e)}function Wo(e,t,n){return n(function(){Go(t)&&Ko(e)})}function Go(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wr(e,n)}catch{return!0}}function Ko(e){var t=ai(e,2);t!==null&&xu(t,e,2)}function qo(e){var t=jo();if(typeof e==`function`){var n=e;if(e=n(),B){Be(!0);try{n()}finally{Be(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:e},t}function Jo(e,t,n,r){return e.baseState=n,zo(e,R,typeof r==`function`?r:Lo)}function Yo(e,t,n,r,a){if(Ls(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)}};M.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Xo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Xo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=M.T,o={};M.T=o;try{var s=n(i,r),c=M.S;c!==null&&c(o,s),Zo(e,t,s)}catch(n){$o(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),M.T=a}}else try{a=n(i,r),Zo(e,t,a)}catch(n){$o(e,t,n)}}function Zo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Qo(e,t,n)},function(n){return $o(e,t,n)}):Qo(e,t,n)}function Qo(e,t,n){t.status=`fulfilled`,t.value=n,es(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Xo(e,n)))}function $o(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,es(t),t=t.next;while(t!==r)}e.action=null}function es(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ts(e,t){return t}function ns(e,t){if(Li){var n=Ul.formState;if(n!==null){a:{var r=L;if(Li){if(Ii){b:{for(var i=Ii,a=zi;i.nodeType!==8;){if(!a){i=null;break b}if(i=gf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ii=gf(i.nextSibling),r=i.data===`F!`;break a}}Vi(r)}r=!1}r&&(t=n[0])}}return n=jo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ts,lastRenderedState:t},n.queue=r,n=Ps.bind(null,L,r),r.dispatch=n,r=qo(!1),a=Is.bind(null,L,!1,r.queue),r=jo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Yo.bind(null,L,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function rs(e){return is(Mo(),R,e)}function is(e,t,n){if(t=zo(e,t,ts)[0],e=Ro(Lo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Po(t)}catch(e){throw e===Ta?Da:e}else r=t;t=Mo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(L.flags|=2048,ss(9,{destroy:void 0},as.bind(null,i,n),null)),[r,a,e]}function as(e,t){e.action=t}function os(e){var t=Mo(),n=R;if(n!==null)return is(t,n,e);Mo(),t=t.memoizedState,n=Mo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ss(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=L.updateQueue,t===null&&(t=No(),L.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 cs(){return Mo().memoizedState}function ls(e,t,n,r){var i=jo();L.flags|=e,i.memoizedState=ss(1|t,{destroy:void 0},n,r===void 0?null:r)}function us(e,t,n,r){var i=Mo();r=r===void 0?null:r;var a=i.memoizedState.inst;R!==null&&r!==null&&Co(r,R.memoizedState.deps)?i.memoizedState=ss(t,a,n,r):(L.flags|=e,i.memoizedState=ss(1|t,a,n,r))}function ds(e,t){ls(8390656,8,e,t)}function fs(e,t){us(2048,8,e,t)}function ps(e){L.flags|=4;var t=L.updateQueue;if(t===null)t=No(),L.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ms(e){var t=Mo().memoizedState;return ps({ref:t,nextImpl:e}),function(){if(H&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function hs(e,t){return us(4,2,e,t)}function gs(e,t){return us(4,4,e,t)}function _s(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 vs(e,t,n){n=n==null?null:n.concat([e]),us(4,4,_s.bind(null,t,e),n)}function ys(){}function bs(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Co(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function xs(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Co(t,r[1]))return r[0];if(r=e(),B){Be(!0);try{e()}finally{Be(!1)}}return n.memoizedState=[r,t],r}function Ss(e,t,n){return n===void 0||go&1073741824&&!(W&261930)?e.memoizedState=t:(e.memoizedState=n,e=bu(),L.lanes|=e,Zl|=e,n)}function Cs(e,t,n,r){return wr(n,t)?n:to.current===null?!(go&42)||go&1073741824&&!(W&261930)?(ac=!0,e.memoizedState=n):(e=bu(),L.lanes|=e,Zl|=e,t):(e=Ss(e,n,r),wr(e,t)||(ac=!0),e)}function ws(e,t,n,r,i){var a=N.p;N.p=a!==0&&8>a?a:8;var o=M.T,s={};M.T=s,Is(e,!1,t,n);try{var c=i(),l=M.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Fs(e,t,ya(c,r),yu(e)):Fs(e,t,r,yu(e))}catch(n){Fs(e,t,{then:function(){},status:`rejected`,reason:n},yu())}finally{N.p=a,o!==null&&s.types!==null&&(o.types=s.types),M.T=o}}function Ts(){}function Es(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ds(e).queue;ws(e,a,t,ie,n===null?Ts:function(){return Os(e),n(r)})}function Ds(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:ie},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Os(e){var t=Ds(e);t.next===null&&(t=e.alternate.memoizedState),Fs(e,t.next.queue,{},yu())}function ks(){return ia(op)}function As(){return Mo().memoizedState}function js(){return Mo().memoizedState}function Ms(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=yu();e=Ka(n);var r=qa(t,e,n);r!==null&&(xu(r,t,n),Ja(r,t,n)),t={cache:da()},e.payload=t;return}t=t.return}}function Ns(e,t,n){var r=yu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ls(e)?Rs(t,n):(n=ii(e,t,n,r),n!==null&&(xu(n,e,r),zs(n,t,r)))}function Ps(e,t,n){Fs(e,t,n,yu())}function Fs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ls(e))Rs(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,wr(s,o))return ri(e,t,i,0),Ul===null&&ni(),!1}catch{}if(n=ii(e,t,i,r),n!==null)return xu(n,e,r),zs(n,t,r),!0}return!1}function Is(e,t,n,r){if(r={lane:2,revertLane:vd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ls(e)){if(t)throw Error(i(479))}else t=ii(e,n,r,2),t!==null&&xu(t,e,2)}function Ls(e){var t=e.alternate;return e===L||t!==null&&t===L}function Rs(e,t){vo=z=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function zs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,rt(e,n)}}var Bs={readContext:ia,use:Fo,useCallback:So,useContext:So,useEffect:So,useImperativeHandle:So,useLayoutEffect:So,useInsertionEffect:So,useMemo:So,useReducer:So,useRef:So,useState:So,useDebugValue:So,useDeferredValue:So,useTransition:So,useSyncExternalStore:So,useId:So,useHostTransitionStatus:So,useFormState:So,useActionState:So,useOptimistic:So,useMemoCache:So,useCacheRefresh:So};Bs.useEffectEvent=So;var Vs={readContext:ia,use:Fo,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:ia,useEffect:ds,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ls(4194308,4,_s.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ls(4194308,4,e,t)},useInsertionEffect:function(e,t){ls(4,2,e,t)},useMemo:function(e,t){var n=jo();t=t===void 0?null:t;var r=e();if(B){Be(!0);try{e()}finally{Be(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=jo();if(n!==void 0){var i=n(t);if(B){Be(!0);try{n(t)}finally{Be(!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=Ns.bind(null,L,e),[r.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:function(e){e=qo(e);var t=e.queue,n=Ps.bind(null,L,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ys,useDeferredValue:function(e,t){return Ss(jo(),e,t)},useTransition:function(){var e=qo(!1);return e=ws.bind(null,L,e.queue,!0,!1),jo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=L,a=jo();if(Li){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ul===null)throw Error(i(349));W&127||Ho(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ds(Wo.bind(null,r,o,e),[e]),r.flags|=2048,ss(9,{destroy:void 0},Uo.bind(null,r,o,n,t),null),n},useId:function(){var e=jo(),t=Ul.identifierPrefix;if(Li){var n=ki,r=Oi;n=(r&~(1<<32-Ve(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=yo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=xo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ks,useFormState:ns,useActionState:ns,useOptimistic:function(e){var t=jo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Is.bind(null,L,!0,n),n.dispatch=t,[e,t]},useMemoCache:Io,useCacheRefresh:function(){return jo().memoizedState=Ms.bind(null,L)},useEffectEvent:function(e){var t=jo(),n={impl:e};return t.memoizedState=n,function(){if(H&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Hs={readContext:ia,use:Fo,useCallback:bs,useContext:ia,useEffect:fs,useImperativeHandle:vs,useInsertionEffect:hs,useLayoutEffect:gs,useMemo:xs,useReducer:Ro,useRef:cs,useState:function(){return Ro(Lo)},useDebugValue:ys,useDeferredValue:function(e,t){return Cs(Mo(),R.memoizedState,e,t)},useTransition:function(){var e=Ro(Lo)[0],t=Mo().memoizedState;return[typeof e==`boolean`?e:Po(e),t]},useSyncExternalStore:Vo,useId:As,useHostTransitionStatus:ks,useFormState:rs,useActionState:rs,useOptimistic:function(e,t){return Jo(Mo(),R,e,t)},useMemoCache:Io,useCacheRefresh:js};Hs.useEffectEvent=ms;var Us={readContext:ia,use:Fo,useCallback:bs,useContext:ia,useEffect:fs,useImperativeHandle:vs,useInsertionEffect:hs,useLayoutEffect:gs,useMemo:xs,useReducer:Bo,useRef:cs,useState:function(){return Bo(Lo)},useDebugValue:ys,useDeferredValue:function(e,t){var n=Mo();return R===null?Ss(n,e,t):Cs(n,R.memoizedState,e,t)},useTransition:function(){var e=Bo(Lo)[0],t=Mo().memoizedState;return[typeof e==`boolean`?e:Po(e),t]},useSyncExternalStore:Vo,useId:As,useHostTransitionStatus:ks,useFormState:os,useActionState:os,useOptimistic:function(e,t){var n=Mo();return R===null?(n.baseState=e,[e,n.queue.dispatch]):Jo(n,R,e,t)},useMemoCache:Io,useCacheRefresh:js};Us.useEffectEvent=ms;function Ws(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 Gs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=yu(),i=Ka(r);i.payload=t,n!=null&&(i.callback=n),t=qa(e,i,r),t!==null&&(xu(t,e,r),Ja(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=yu(),i=Ka(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=qa(e,i,r),t!==null&&(xu(t,e,r),Ja(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=yu(),r=Ka(n);r.tag=2,t!=null&&(r.callback=t),t=qa(e,r,n),t!==null&&(xu(t,e,n),Ja(t,e,n))}};function Ks(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?!Tr(n,r)||!Tr(i,a):!0}function qs(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&&Gs.enqueueReplaceState(t,t.state,null)}function Js(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 Ys(e){Qr(e)}function Xs(e){console.error(e)}function Zs(e){Qr(e)}function Qs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function $s(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 ec(e,t,n){return n=Ka(n),n.tag=3,n.payload={element:null},n.callback=function(){Qs(e,t)},n}function tc(e){return e=Ka(e),e.tag=3,e}function nc(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(){$s(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){$s(t,n,r),typeof i!=`function`&&(lu===null?lu=new Set([this]):lu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function rc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ta(t,n,a,!0),n=oo.current,n!==null){switch(n.tag){case 31:case 13:return so===null?Nu():n.alternate===null&&Xl===0&&(Xl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Oa?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===Oa?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),Nu(),!1}if(Li)return t=oo.current,t===null?(r!==Bi&&(t=Error(i(423),{cause:r}),qi(bi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=bi(r,n),a=ec(e.stateNode,r,a),Ya(e,a),Xl!==4&&(Xl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Bi&&(e=Error(i(422),{cause:r}),qi(bi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=bi(o,n),nu===null?nu=[o]:nu.push(o),Xl!==4&&(Xl=2),t===null)return!0;r=bi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=ec(n.stateNode,r,e),Ya(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`&&(lu===null||!lu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=tc(a),nc(a,e,n,r),Ya(n,a),!1}n=n.return}while(n!==null);return!1}var ic=Error(i(461)),ac=!1;function oc(e,t,n,r){t.child=e===null?Ha(t,null,n,r):Va(t,e.child,n,r)}function sc(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 ra(t),r=wo(e,t,n,o,a,i),s=Oo(),e!==null&&!ac?(ko(e,t,i),jc(e,t,i)):(Li&&s&&Mi(t),t.flags|=1,oc(e,t,r,i),t.child)}function cc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!di(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,lc(e,t,a,r,i)):(e=mi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Mc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Tr:n,n(o,r)&&e.ref===t.ref)return jc(e,t,i)}return t.flags|=1,e=fi(a,r),e.ref=t.ref,e.return=t,t.child=e}function lc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Tr(a,r)&&e.ref===t.ref)if(ac=!1,t.pendingProps=r=a,Mc(e,i))e.flags&131072&&(ac=!0);else return t.lanes=e.lanes,jc(e,t,i)}return _c(e,t,n,r,i)}function uc(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 fc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ca(t,a===null?null:a.cachePool),a===null?io():ro(t,a),uo(t);else return r=t.lanes=536870912,fc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ca(t,null),io(),fo(t)):(Ca(t,a.cachePool),ro(t,a),fo(t),t.memoizedState=null);return oc(e,t,i,n),t.child}function dc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function fc(e,t,n,r,i){var a=Sa();return a=a===null?null:{parent:ua._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ca(t,null),io(),uo(t),e!==null&&ta(e,t,r,!0),t.childLanes=i,null}function pc(e,t){return t=Ec({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function mc(e,t,n){return Va(t,e.child,null,n),e=pc(t,t.pendingProps),e.flags|=2,po(t),t.memoizedState=null,e}function hc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Li){if(r.mode===`hidden`)return e=pc(t,r),t.lanes=536870912,dc(null,e);if(lo(t),(e=Ii)?(e=ff(e,zi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Di===null?null:{id:Oi,overflow:ki},retryLane:536870912,hydrationErrors:null},n=_i(e),n.return=t,t.child=n,Fi=t,Ii=null)):e=null,e===null)throw Vi(t);return t.lanes=536870912,null}return pc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(lo(t),a)if(t.flags&256)t.flags&=-257,t=mc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(ac||ta(e,t,n,!1),a=(n&e.childLanes)!==0,ac||a){if(r=Ul,r!==null&&(s=it(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ai(e,s),xu(r,e,s),ic;Nu(),t=mc(e,t,n)}else e=o.treeContext,Ii=gf(s.nextSibling),Fi=t,Li=!0,Ri=null,zi=!1,e!==null&&Pi(t,e),t=pc(t,r),t.flags|=4096;return t}return e=fi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function gc(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 _c(e,t,n,r,i){return ra(t),n=wo(e,t,n,r,void 0,i),r=Oo(),e!==null&&!ac?(ko(e,t,i),jc(e,t,i)):(Li&&r&&Mi(t),t.flags|=1,oc(e,t,n,i),t.child)}function vc(e,t,n,r,i,a){return ra(t),t.updateQueue=null,n=Eo(t,r,n,i),To(e),r=Oo(),e!==null&&!ac?(ko(e,t,a),jc(e,t,a)):(Li&&r&&Mi(t),t.flags|=1,oc(e,t,n,a),t.child)}function yc(e,t,n,r,i){if(ra(t),t.stateNode===null){var a=ci,o=n.contextType;typeof o==`object`&&o&&(a=ia(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Gs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Wa(t),o=n.contextType,a.context=typeof o==`object`&&o?ia(o):ci,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ws(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&&Gs.enqueueReplaceState(a,a.state,null),Qa(t,r,a,i),Za(),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=Js(n,s);a.props=c;var l=a.context,u=n.contextType;o=ci,typeof u==`object`&&u&&(o=ia(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)&&qs(t,a,r,o),Ua=!1;var f=t.memoizedState;a.state=f,Qa(t,r,a,i),Za(),l=t.memoizedState,s||f!==l||Ua?(typeof d==`function`&&(Ws(t,n,d,r),l=t.memoizedState),(c=Ua||Ks(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,Ga(e,t),o=t.memoizedProps,u=Js(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ci,typeof l==`object`&&l&&(c=ia(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)&&qs(t,a,r,c),Ua=!1,f=t.memoizedState,a.state=f,Qa(t,r,a,i),Za();var p=t.memoizedState;o!==d||f!==p||Ua||e!==null&&e.dependencies!==null&&na(e.dependencies)?(typeof s==`function`&&(Ws(t,n,s,r),p=t.memoizedState),(u=Ua||Ks(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&na(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,gc(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=Va(t,e.child,null,i),t.child=Va(t,null,n,i)):oc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=jc(e,t,i),e}function bc(e,t,n,r){return Gi(),t.flags|=256,oc(e,t,n,r),t.child}var xc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Sc(e){return{baseLanes:e,cachePool:wa()}}function Cc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=eu),e}function wc(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:(mo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Li){if(a?co(t):fo(t),(e=Ii)?(e=ff(e,zi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Di===null?null:{id:Oi,overflow:ki},retryLane:536870912,hydrationErrors:null},n=_i(e),n.return=t,t.child=n,Fi=t,Ii=null)):e=null,e===null)throw Vi(t);return mf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(fo(t),a=t.mode,c=Ec({mode:`hidden`,children:c},a),r=hi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Sc(n),r.childLanes=Cc(e,s,n),t.memoizedState=xc,dc(null,r)):(co(t),Tc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(co(t),t.flags&=-257,t=Dc(e,t,n)):t.memoizedState===null?(fo(t),c=r.fallback,a=t.mode,r=Ec({mode:`visible`,children:r.children},a),c=hi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Va(t,e.child,null,n),r=t.child,r.memoizedState=Sc(n),r.childLanes=Cc(e,s,n),t.memoizedState=xc,t=dc(null,r)):(fo(t),t.child=e.child,t.flags|=128,t=null);else if(co(t),mf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,qi({value:r,source:null,stack:null}),t=Dc(e,t,n)}else if(ac||ta(e,t,n,!1),s=(n&e.childLanes)!==0,ac||s){if(s=Ul,s!==null&&(r=it(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ai(e,r),xu(s,e,r),ic;pf(c)||Nu(),t=Dc(e,t,n)}else pf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ii=gf(c.nextSibling),Fi=t,Li=!0,Ri=null,zi=!1,e!==null&&Pi(t,e),t=Tc(t,r.children),t.flags|=4096);return t}return a?(fo(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=fi(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=hi(c,a,n,null),c.flags|=2):c=fi(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,dc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Sc(n):(a=c.cachePool,a===null?a=wa():(l=ua._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Cc(e,s,n),t.memoizedState=xc,dc(e.child,r)):(co(t),n=e.child,e=n.sibling,n=fi(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 Tc(e,t){return t=Ec({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Ec(e,t){return e=ui(22,e,null,t),e.lanes=0,e}function Dc(e,t,n){return Va(t,e.child,null,n),e=Tc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Oc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),$i(e.return,t,n)}function kc(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 Ac(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=mo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,P(mo,o),oc(e,t,r,n),r=Li?wi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Oc(e,n,t);else if(e.tag===19)Oc(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&&ho(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),kc(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&&ho(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}kc(t,!0,n,null,a,r);break;case`together`:kc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function jc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Zl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ta(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=fi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=fi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Mc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&na(e))):!0}function Nc(e,t,n){switch(t.tag){case 3:pe(t,t.stateNode.containerInfo),Zi(t,ua,e.memoizedState.cache),Gi();break;case 27:case 5:he(t);break;case 4:pe(t,t.stateNode.containerInfo);break;case 10:Zi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,lo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(co(t),e=jc(e,t,n),e===null?null:e.sibling):wc(e,t,n):(co(t),t.flags|=128,null);co(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(ta(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Ac(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),P(mo,mo.current),r)break;return null;case 22:return t.lanes=0,uc(e,t,n,t.pendingProps);case 24:Zi(t,ua,e.memoizedState.cache)}return jc(e,t,n)}function Pc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ac=!0;else{if(!Mc(e,n)&&!(t.flags&128))return ac=!1,Nc(e,t,n);ac=!!(e.flags&131072)}else ac=!1,Li&&t.flags&1048576&&ji(t,wi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ja(t.elementType),t.type=e,typeof e==`function`)di(e)?(r=Js(e,r),t.tag=1,t=yc(null,t,e,r,n)):(t.tag=0,t=_c(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=sc(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=cc(null,t,e,r,n);break a}}throw t=ne(e)||e,Error(i(306,t,``))}}return t;case 0:return _c(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Js(r,t.pendingProps),yc(e,t,r,a,n);case 3:a:{if(pe(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ga(e,t),Qa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Zi(t,ua,r),r!==o.cache&&ea(t,[ua],n,!0),Za(),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=bc(e,t,r,n);break a}else if(r!==a){a=bi(Error(i(424)),t),qi(a),t=bc(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(Ii=gf(e.firstChild),Fi=t,Li=!0,Ri=null,zi=!0,n=Ha(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Gi(),r===a){t=jc(e,t,n);break a}oc(e,t,r,n)}t=t.child}return t;case 26:return gc(e,t),e===null?(n=Lf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Li||(n=t.type,e=t.pendingProps,r=Jd(de.current).createElement(n),r[ut]=t,r[dt]=e,Hd(r,n,e),Ct(r),t.stateNode=r):t.memoizedState=Lf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return he(t),e===null&&Li&&(r=t.stateNode=bf(t.type,t.pendingProps,de.current),Fi=t,zi=!0,a=Ii,of(t.type)?(_f=a,Ii=gf(r.firstChild)):Ii=a),oc(e,t,t.pendingProps.children,n),gc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Li&&((a=r=Ii)&&(r=uf(r,t.type,t.pendingProps,zi),r===null?a=!1:(t.stateNode=r,Fi=t,Ii=gf(r.firstChild),zi=!1,a=!0)),a||Vi(t)),he(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Zd(a,o)?r=null:s!==null&&Zd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=wo(e,t,Do,null,null,n),op._currentValue=a),gc(e,t),oc(e,t,r,n),t.child;case 6:return e===null&&Li&&((e=n=Ii)&&(n=df(n,t.pendingProps,zi),n===null?e=!1:(t.stateNode=n,Fi=t,Ii=null,e=!0)),e||Vi(t)),null;case 13:return wc(e,t,n);case 4:return pe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Va(t,null,r,n):oc(e,t,r,n),t.child;case 11:return sc(e,t,t.type,t.pendingProps,n);case 7:return oc(e,t,t.pendingProps,n),t.child;case 8:return oc(e,t,t.pendingProps.children,n),t.child;case 12:return oc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Zi(t,t.type,r.value),oc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,ra(t),a=ia(a),r=r(a),t.flags|=1,oc(e,t,r,n),t.child;case 14:return cc(e,t,t.type,t.pendingProps,n);case 15:return lc(e,t,t.type,t.pendingProps,n);case 19:return Ac(e,t,n);case 31:return hc(e,t,n);case 22:return uc(e,t,n,t.pendingProps);case 24:return ra(t),r=ia(ua),e===null?(a=Sa(),a===null&&(a=Ul,o=da(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Wa(t),Zi(t,ua,a)):((e.lanes&n)!==0&&(Ga(e,t),Qa(t,null,null,n),Za()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Zi(t,ua,r),r!==a.cache&&ea(t,[ua],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Zi(t,ua,r))),oc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Fc(e){e.flags|=4}function Ic(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(Au())e.flags|=8192;else throw Ma=Oa,Ea}else e.flags&=-16777217}function Lc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Qf(t))if(Au())e.flags|=8192;else throw Ma=Oa,Ea}function Rc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Qe(),e.lanes|=t,tu|=t)}function zc(e,t){if(!Li)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 Bc(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 Vc(e,t,n){var r=t.pendingProps;switch(Ni(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bc(t),null;case 1:return Bc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Qi(ua),me(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Wi(t)?Fc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ki())),Bc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Fc(t),o===null?(Bc(t),Ic(t,a,null,r,n)):(Bc(t),Lc(t,o))):o?o===e.memoizedState?(Bc(t),t.flags&=-16777217):(Fc(t),Bc(t),Lc(t,o)):(e=e.memoizedProps,e!==r&&Fc(t),Bc(t),Ic(t,a,e,r,n)),null;case 27:if(ge(t),n=de.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Bc(t),null}e=le.current,Wi(t)?Hi(t,e):(e=bf(a,r,n),t.stateNode=e,Fc(t))}return Bc(t),null;case 5:if(ge(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Bc(t),null}if(o=le.current,Wi(t))Hi(t,o);else{var s=Jd(de.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[ut]=t,o[dt]=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(Hd(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&&Fc(t)}}return Bc(t),Ic(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=de.current,Wi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Fi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ut]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||zd(e.nodeValue,n)),e||Vi(t,!0)}else e=Jd(e).createTextNode(r),e[ut]=t,t.stateNode=e}return Bc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Wi(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[ut]=t}else Gi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Bc(t),e=!1}else n=Ki(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(po(t),t):(po(t),null);if(t.flags&128)throw Error(i(558))}return Bc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Wi(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[ut]=t}else Gi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Bc(t),a=!1}else a=Ki(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(po(t),t):(po(t),null)}return po(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),Rc(t,t.updateQueue),Bc(t),null);case 4:return me(),e===null&&kd(t.stateNode.containerInfo),Bc(t),null;case 10:return Qi(t.type),Bc(t),null;case 19:if(ce(mo),r=t.memoizedState,r===null)return Bc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)zc(r,!1);else{if(Xl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ho(e),o!==null){for(t.flags|=128,zc(r,!1),e=o.updateQueue,t.updateQueue=e,Rc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)pi(n,e),n=n.sibling;return P(mo,mo.current&1|2),Li&&Ai(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ke()>su&&(t.flags|=128,a=!0,zc(r,!1),t.lanes=4194304)}else{if(!a)if(e=ho(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Rc(t,e),zc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Li)return Bc(t),null}else 2*ke()-r.renderingStartTime>su&&n!==536870912&&(t.flags|=128,a=!0,zc(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?(Bc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ke(),e.sibling=null,n=mo.current,P(mo,a?n&1|2:n&1),Li&&Ai(t,r.treeForkCount),e);case 22:case 23:return po(t),ao(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Bc(t),t.subtreeFlags&6&&(t.flags|=8192)):Bc(t),n=t.updateQueue,n!==null&&Rc(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&&ce(xa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Qi(ua),Bc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Hc(e,t){switch(Ni(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qi(ua),me(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ge(t),null;case 31:if(t.memoizedState!==null){if(po(t),t.alternate===null)throw Error(i(340));Gi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(po(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Gi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ce(mo),null;case 4:return me(),null;case 10:return Qi(t.type),null;case 22:case 23:return po(t),ao(),e!==null&&ce(xa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Qi(ua),null;case 25:return null;default:return null}}function Uc(e,t){switch(Ni(t),t.tag){case 3:Qi(ua),me();break;case 26:case 27:case 5:ge(t);break;case 4:me();break;case 31:t.memoizedState!==null&&po(t);break;case 13:po(t);break;case 19:ce(mo);break;case 10:Qi(t.type);break;case 22:case 23:po(t),ao(),e!==null&&ce(xa);break;case 24:Qi(ua)}}function Wc(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){Zu(t,t.return,e)}}function Gc(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){Zu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Zu(t,t.return,e)}}function Kc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{eo(t,n)}catch(t){Zu(e,e.return,t)}}}function qc(e,t,n){n.props=Js(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Zu(e,t,n)}}function Jc(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){Zu(e,t,n)}}function Yc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Zu(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){Zu(e,t,n)}else n.current=null}function Xc(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){Zu(e,e.return,t)}}function Zc(e,t,n){try{var r=e.stateNode;Ud(r,e.type,n,t),r[dt]=t}catch(t){Zu(e,e.return,t)}}function Qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&of(e.type)||e.tag===4}function $c(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Qc(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&&of(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 el(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=rn));else if(r!==4&&(r===27&&of(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(el(e,t,n),e=e.sibling;e!==null;)el(e,t,n),e=e.sibling}function tl(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&&of(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(tl(e,t,n),e=e.sibling;e!==null;)tl(e,t,n),e=e.sibling}function nl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Hd(t,r,n),t[ut]=e,t[dt]=n}catch(t){Zu(e,e.return,t)}}var rl=!1,il=!1,al=!1,ol=typeof WeakSet==`function`?WeakSet:Set,sl=null;function cl(e,t){if(e=e.containerInfo,Kd=hp,e=kr(e),Ar(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(qd={focusedElem:e,selectionRange:n},hp=!1,sl=t;sl!==null;)if(t=sl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,sl=e;else for(;sl!==null;){switch(t=sl,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=Js(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Zu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)lf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:lf(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,sl=e;break}sl=t.return}}function ll(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:wl(e,n),r&4&&Wc(5,n);break;case 1:if(wl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Zu(n,n.return,e)}else{var i=Js(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Zu(n,n.return,e)}}r&64&&Kc(n),r&512&&Jc(n,n.return);break;case 3:if(wl(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{eo(e,t)}catch(e){Zu(n,n.return,e)}}break;case 27:t===null&&r&4&&nl(n);case 26:case 5:wl(e,n),t===null&&r&4&&Xc(n),r&512&&Jc(n,n.return);break;case 12:wl(e,n);break;case 31:wl(e,n),r&4&&hl(e,n);break;case 13:wl(e,n),r&4&&gl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=td.bind(null,n),hf(e,n))));break;case 22:if(r=n.memoizedState!==null||rl,!r){t=t!==null&&t.memoizedState!==null||il,i=rl;var a=il;rl=r,(il=t)&&!a?El(e,n,(n.subtreeFlags&8772)!=0):wl(e,n),rl=i,il=a}break;case 30:break;default:wl(e,n)}}function ul(e){var t=e.alternate;t!==null&&(e.alternate=null,ul(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&vt(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 dl=null,fl=!1;function pl(e,t,n){for(n=n.child;n!==null;)ml(e,t,n),n=n.sibling}function ml(e,t,n){if(ze&&typeof ze.onCommitFiberUnmount==`function`)try{ze.onCommitFiberUnmount(Re,n)}catch{}switch(n.tag){case 26:il||Yc(n,t),pl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:il||Yc(n,t);var r=dl,i=fl;of(n.type)&&(dl=n.stateNode,fl=!1),pl(e,t,n),xf(n.stateNode),dl=r,fl=i;break;case 5:il||Yc(n,t);case 6:if(r=dl,i=fl,dl=null,pl(e,t,n),dl=r,fl=i,dl!==null)if(fl)try{(dl.nodeType===9?dl.body:dl.nodeName===`HTML`?dl.ownerDocument.body:dl).removeChild(n.stateNode)}catch(e){Zu(n,t,e)}else try{dl.removeChild(n.stateNode)}catch(e){Zu(n,t,e)}break;case 18:dl!==null&&(fl?(e=dl,sf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Vp(e)):sf(dl,n.stateNode));break;case 4:r=dl,i=fl,dl=n.stateNode.containerInfo,fl=!0,pl(e,t,n),dl=r,fl=i;break;case 0:case 11:case 14:case 15:Gc(2,n,t),il||Gc(4,n,t),pl(e,t,n);break;case 1:il||(Yc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&qc(n,t,r)),pl(e,t,n);break;case 21:pl(e,t,n);break;case 22:il=(r=il)||n.memoizedState!==null,pl(e,t,n),il=r;break;default:pl(e,t,n)}}function hl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Vp(e)}catch(e){Zu(t,t.return,e)}}}function gl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Vp(e)}catch(e){Zu(t,t.return,e)}}function _l(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ol),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ol),t;default:throw Error(i(435,e.tag))}}function vl(e,t){var n=_l(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=nd.bind(null,e,t);t.then(r,r)}})}function yl(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(of(c.type)){dl=c.stateNode,fl=!1;break a}break;case 5:dl=c.stateNode,fl=!1;break a;case 3:case 4:dl=c.stateNode.containerInfo,fl=!0;break a}c=c.return}if(dl===null)throw Error(i(160));ml(o,s,a),dl=null,fl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)xl(t,e),t=t.sibling}var bl=null;function xl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:yl(t,e),Sl(e),r&4&&(Gc(3,e,e.return),Wc(3,e),Gc(5,e,e.return));break;case 1:yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),r&64&&rl&&(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=bl;if(yl(t,e),Sl(e),r&512&&(il||n===null||Yc(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[_t]||o[ut]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Hd(o,r,n),o[ut]=e,Ct(o),r=o;break a;case`link`:var s=Yf(`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),Hd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Yf(`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),Hd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[ut]=e,Ct(o),r=o}e.stateNode=r}else Xf(a,e.type,e.stateNode);else e.stateNode=Wf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Zc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Xf(a,e.type,e.stateNode):Wf(a,r,e.memoizedProps))}break;case 27:yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),n!==null&&r&4&&Zc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),e.flags&32){a=e.stateNode;try{Yt(a,``)}catch(t){Zu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Zc(e,a,n===null?a:n.memoizedProps)),r&1024&&(al=!0);break;case 6:if(yl(t,e),Sl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Zu(e,e.return,t)}}break;case 3:if(Jf=null,a=bl,bl=wf(t.containerInfo),yl(t,e),bl=a,Sl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Vp(t.containerInfo)}catch(t){Zu(e,e.return,t)}al&&(al=!1,Cl(e));break;case 4:r=bl,bl=wf(e.stateNode.containerInfo),yl(t,e),Sl(e),bl=r;break;case 12:yl(t,e),Sl(e);break;case 31:yl(t,e),Sl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,vl(e,r)));break;case 13:yl(t,e),Sl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(au=ke()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,vl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=rl,d=il;if(rl=u||a,il=d||l,yl(t,e),il=d,rl=u,Sl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||rl||il||Tl(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){Zu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Zu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?cf(m,!0):cf(l.stateNode,!1)}catch(e){Zu(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,vl(e,n))));break;case 19:yl(t,e),Sl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,vl(e,r)));break;case 30:break;case 21:break;default:yl(t,e),Sl(e)}}function Sl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Qc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;tl(e,$c(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Yt(o,``),n.flags&=-33),tl(e,$c(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;el(e,$c(e),s);break;default:throw Error(i(161))}}catch(t){Zu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Cl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Cl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function wl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ll(e,t.alternate,t),t=t.sibling}function Tl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Gc(4,t,t.return),Tl(t);break;case 1:Yc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&qc(t,t.return,n),Tl(t);break;case 27:xf(t.stateNode);case 26:case 5:Yc(t,t.return),Tl(t);break;case 22:t.memoizedState===null&&Tl(t);break;case 30:Tl(t);break;default:Tl(t)}e=e.sibling}}function El(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:El(i,a,n),Wc(4,a);break;case 1:if(El(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Zu(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++)$a(c[i],s)}catch(e){Zu(r,r.return,e)}}n&&o&64&&Kc(a),Jc(a,a.return);break;case 27:nl(a);case 26:case 5:El(i,a,n),n&&r===null&&o&4&&Xc(a),Jc(a,a.return);break;case 12:El(i,a,n);break;case 31:El(i,a,n),n&&o&4&&hl(i,a);break;case 13:El(i,a,n),n&&o&4&&gl(i,a);break;case 22:a.memoizedState===null&&El(i,a,n),Jc(a,a.return);break;case 30:break;default:El(i,a,n)}t=t.sibling}}function Dl(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&&fa(n))}function Ol(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&fa(e))}function kl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Al(e,t,n,r),t=t.sibling}function Al(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:kl(e,t,n,r),i&2048&&Wc(9,t);break;case 1:kl(e,t,n,r);break;case 3:kl(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&&fa(e)));break;case 12:if(i&2048){kl(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){Zu(t,t.return,e)}}else kl(e,t,n,r);break;case 31:kl(e,t,n,r);break;case 13:kl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?kl(e,t,n,r):(a._visibility|=2,jl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?kl(e,t,n,r):Ml(e,t),i&2048&&Dl(o,t);break;case 24:kl(e,t,n,r),i&2048&&Ol(t.alternate,t);break;default:kl(e,t,n,r)}}function jl(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:jl(a,o,s,c,i),Wc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,jl(a,o,s,c,i)):u._visibility&2?jl(a,o,s,c,i):Ml(a,o),i&&l&2048&&Dl(o.alternate,o);break;case 24:jl(a,o,s,c,i),i&&l&2048&&Ol(o.alternate,o);break;default:jl(a,o,s,c,i)}t=t.sibling}}function Ml(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:Ml(n,r),i&2048&&Dl(r.alternate,r);break;case 24:Ml(n,r),i&2048&&Ol(r.alternate,r);break;default:Ml(n,r)}t=t.sibling}}var Nl=8192;function Pl(e,t,n){if(e.subtreeFlags&Nl)for(e=e.child;e!==null;)Fl(e,t,n),e=e.sibling}function Fl(e,t,n){switch(e.tag){case 26:Pl(e,t,n),e.flags&Nl&&e.memoizedState!==null&&$f(n,bl,e.memoizedState,e.memoizedProps);break;case 5:Pl(e,t,n);break;case 3:case 4:var r=bl;bl=wf(e.stateNode.containerInfo),Pl(e,t,n),bl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Nl,Nl=16777216,Pl(e,t,n),Nl=r):Pl(e,t,n));break;default:Pl(e,t,n)}}function Il(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 Ll(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];sl=r,Bl(r,e)}Il(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Rl(e),e=e.sibling}function Rl(e){switch(e.tag){case 0:case 11:case 15:Ll(e),e.flags&2048&&Gc(9,e,e.return);break;case 3:Ll(e);break;case 12:Ll(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,zl(e)):Ll(e);break;default:Ll(e)}}function zl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];sl=r,Bl(r,e)}Il(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Gc(8,t,t.return),zl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,zl(t));break;default:zl(t)}e=e.sibling}}function Bl(e,t){for(;sl!==null;){var n=sl;switch(n.tag){case 0:case 11:case 15:Gc(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:fa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,sl=r;else a:for(n=e;sl!==null;){r=sl;var i=r.sibling,a=r.return;if(ul(r),r===n){sl=null;break a}if(i!==null){i.return=a,sl=i;break a}sl=a}}}var Vl={getCacheForType:function(e){var t=ia(ua),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ia(ua).controller.signal}},Hl=typeof WeakMap==`function`?WeakMap:Map,H=0,Ul=null,U=null,W=0,Wl=0,Gl=null,Kl=!1,ql=!1,Jl=!1,Yl=0,Xl=0,Zl=0,Ql=0,$l=0,eu=0,tu=0,nu=null,ru=null,iu=!1,au=0,ou=0,su=1/0,cu=null,lu=null,uu=0,du=null,fu=null,pu=0,mu=0,hu=null,gu=null,_u=0,vu=null;function yu(){return H&2&&W!==0?W&-W:M.T===null?st():vd()}function bu(){if(eu===0)if(!(W&536870912)||Li){var e=Ke;Ke<<=1,!(Ke&3932160)&&(Ke=262144),eu=e}else eu=536870912;return e=oo.current,e!==null&&(e.flags|=32),eu}function xu(e,t,n){(e===Ul&&(Wl===2||Wl===9)||e.cancelPendingCommit!==null)&&(Ou(e,0),Tu(e,W,eu,!1)),et(e,n),(!(H&2)||e!==Ul)&&(e===Ul&&(!(H&2)&&(Ql|=n),Xl===4&&Tu(e,W,eu,!1)),ud(e))}function Su(e,t,n){if(H&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Xe(e,t),a=r?Iu(e,t):Pu(e,t,!0),o=r;do{if(a===0){ql&&!r&&Tu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!wu(n)){a=Pu(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=nu;var l=c.current.memoizedState.isDehydrated;if(l&&(Ou(c,s).flags|=256),s=Pu(c,s,!1),s!==2){if(Jl&&!l){c.errorRecoveryDisabledLanes|=o,Ql|=o,a=4;break a}o=ru,ru=a,o!==null&&(ru===null?ru=o:ru.push.apply(ru,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Ou(e,0),Tu(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:Tu(r,t,eu,!Kl);break a;case 2:ru=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=au+300-ke(),10<a)){if(Tu(r,t,eu,!Kl),Ye(r,0,!0)!==0)break a;pu=t,r.timeoutHandle=ef(Cu.bind(null,r,n,ru,cu,iu,t,eu,Ql,tu,Kl,o,`Throttled`,-0,0),a);break a}Cu(r,n,ru,cu,iu,t,eu,Ql,tu,Kl,o,null,-0,0)}}break}while(1);ud(e)}function Cu(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:rn},Fl(t,a,d);var m=(a&62914560)===a?au-ke():(a&4194048)===a?ou-ke():0;if(m=tp(d,m),m!==null){pu=a,e.cancelPendingCommit=m(Uu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Tu(e,a,o,!l);return}}Uu(e,t,a,n,r,i,o,s,c)}function wu(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(!wr(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 Tu(e,t,n,r){t&=~$l,t&=~Ql,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ve(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&nt(e,n,t)}function Eu(){return H&6?!0:(dd(0,!1),!1)}function Du(){if(U!==null){if(Wl===0)var e=U.return;else e=U,Xi=Yi=null,Ao(e),Fa=null,Ia=0,e=U;for(;e!==null;)Uc(e.alternate,e),e=e.return;U=null}}function Ou(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,tf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),pu=0,Du(),Ul=e,U=n=fi(e.current,null),W=t,Wl=0,Gl=null,Kl=!1,ql=Xe(e,t),Jl=!1,tu=eu=$l=Ql=Zl=Xl=0,ru=nu=null,iu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ve(r),a=1<<i;t|=e[i],r&=~a}return Yl=t,ni(),n}function ku(e,t){L=null,M.H=Bs,t===Ta||t===Da?(t=Na(),Wl=3):t===Ea?(t=Na(),Wl=4):Wl=t===ic?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Gl=t,U===null&&(Xl=1,Qs(e,bi(t,e.current)))}function Au(){var e=oo.current;return e===null?!0:(W&4194048)===W?so===null:(W&62914560)===W||W&536870912?e===so:!1}function ju(){var e=M.H;return M.H=Bs,e===null?Bs:e}function Mu(){var e=M.A;return M.A=Vl,e}function Nu(){Xl=4,Kl||(W&4194048)!==W&&oo.current!==null||(ql=!0),!(Zl&134217727)&&!(Ql&134217727)||Ul===null||Tu(Ul,W,eu,!1)}function Pu(e,t,n){var r=H;H|=2;var i=ju(),a=Mu();(Ul!==e||W!==t)&&(cu=null,Ou(e,t)),t=!1;var o=Xl;a:do try{if(Wl!==0&&U!==null){var s=U,c=Gl;switch(Wl){case 8:Du(),o=6;break a;case 3:case 2:case 9:case 6:oo.current===null&&(t=!0);var l=Wl;if(Wl=0,Gl=null,Bu(e,s,c,l),n&&ql){o=0;break a}break;default:l=Wl,Wl=0,Gl=null,Bu(e,s,c,l)}}Fu(),o=Xl;break}catch(t){ku(e,t)}while(1);return t&&e.shellSuspendCounter++,Xi=Yi=null,H=r,M.H=i,M.A=a,U===null&&(Ul=null,W=0,ni()),o}function Fu(){for(;U!==null;)Ru(U)}function Iu(e,t){var n=H;H|=2;var r=ju(),a=Mu();Ul!==e||W!==t?(cu=null,su=ke()+500,Ou(e,t)):ql=Xe(e,t);a:do try{if(Wl!==0&&U!==null){t=U;var o=Gl;b:switch(Wl){case 1:Wl=0,Gl=null,Bu(e,t,o,1);break;case 2:case 9:if(ka(o)){Wl=0,Gl=null,zu(t);break}t=function(){Wl!==2&&Wl!==9||Ul!==e||(Wl=7),ud(e)},o.then(t,t);break a;case 3:Wl=7;break a;case 4:Wl=5;break a;case 7:ka(o)?(Wl=0,Gl=null,zu(t)):(Wl=0,Gl=null,Bu(e,t,o,7));break;case 5:var s=null;switch(U.tag){case 26:s=U.memoizedState;case 5:case 27:var c=U;if(s?Qf(s):c.stateNode.complete){Wl=0,Gl=null;var l=c.sibling;if(l!==null)U=l;else{var u=c.return;u===null?U=null:(U=u,Vu(u))}break b}}Wl=0,Gl=null,Bu(e,t,o,5);break;case 6:Wl=0,Gl=null,Bu(e,t,o,6);break;case 8:Du(),Xl=6;break a;default:throw Error(i(462))}}Lu();break}catch(t){ku(e,t)}while(1);return Xi=Yi=null,M.H=r,M.A=a,H=n,U===null?(Ul=null,W=0,ni(),Xl):0}function Lu(){for(;U!==null&&!De();)Ru(U)}function Ru(e){var t=Pc(e.alternate,e,Yl);e.memoizedProps=e.pendingProps,t===null?Vu(e):U=t}function zu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=vc(n,t,t.pendingProps,t.type,void 0,W);break;case 11:t=vc(n,t,t.pendingProps,t.type.render,t.ref,W);break;case 5:Ao(t);default:Uc(n,t),t=U=pi(t,Yl),t=Pc(n,t,Yl)}e.memoizedProps=e.pendingProps,t===null?Vu(e):U=t}function Bu(e,t,n,r){Xi=Yi=null,Ao(t),Fa=null,Ia=0;var i=t.return;try{if(rc(e,i,t,n,W)){Xl=1,Qs(e,bi(n,e.current)),U=null;return}}catch(t){if(i!==null)throw U=i,t;Xl=1,Qs(e,bi(n,e.current)),U=null;return}t.flags&32768?(Li||r===1?e=!0:ql||W&536870912?e=!1:(Kl=e=!0,(r===2||r===9||r===3||r===6)&&(r=oo.current,r!==null&&r.tag===13&&(r.flags|=16384))),Hu(t,e)):Vu(t)}function Vu(e){var t=e;do{if(t.flags&32768){Hu(t,Kl);return}e=t.return;var n=Vc(t.alternate,t,Yl);if(n!==null){U=n;return}if(t=t.sibling,t!==null){U=t;return}U=t=e}while(t!==null);Xl===0&&(Xl=5)}function Hu(e,t){do{var n=Hc(e.alternate,e);if(n!==null){n.flags&=32767,U=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){U=e;return}U=e=n}while(e!==null);Xl=6,U=null}function Uu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Ju();while(uu!==0);if(H&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=ti,tt(e,n,o,s,c,l),e===Ul&&(U=Ul=null,W=0),fu=t,du=e,pu=n,mu=o,hu=a,gu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,rd(Ne,function(){return Yu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=M.T,M.T=null,a=N.p,N.p=2,s=H,H|=4;try{cl(e,t,n)}finally{H=s,N.p=a,M.T=r}}uu=1,Wu(),Gu(),Ku()}}function Wu(){if(uu===1){uu=0;var e=du,t=fu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=H;H|=4;try{xl(t,e);var a=qd,o=kr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Or(s.ownerDocument.documentElement,s)){if(c!==null&&Ar(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 _=Dr(s,h),v=Dr(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}}hp=!!Kd,qd=Kd=null}finally{H=i,N.p=r,M.T=n}}e.current=t,uu=2}}function Gu(){if(uu===2){uu=0;var e=du,t=fu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=H;H|=4;try{ll(e,t.alternate,t)}finally{H=i,N.p=r,M.T=n}}uu=3}}function Ku(){if(uu===4||uu===3){uu=0,Oe();var e=du,t=fu,n=pu,r=gu;t.subtreeFlags&10256||t.flags&10256?uu=5:(uu=0,fu=du=null,qu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(lu=null),ot(n),t=t.stateNode,ze&&typeof ze.onCommitFiberRoot==`function`)try{ze.onCommitFiberRoot(Re,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=M.T,i=N.p,N.p=2,M.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{M.T=t,N.p=i}}pu&3&&Ju(),ud(e),i=e.pendingLanes,n&261930&&i&42?e===vu?_u++:(_u=0,vu=e):_u=0,dd(0,!1)}}function qu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,fa(t)))}function Ju(){return Wu(),Gu(),Ku(),Yu()}function Yu(){if(uu!==5)return!1;var e=du,t=mu;mu=0;var n=ot(pu),r=M.T,a=N.p;try{N.p=32>n?32:n,M.T=null,n=hu,hu=null;var o=du,s=pu;if(uu=0,fu=du=null,pu=0,H&6)throw Error(i(331));var c=H;if(H|=4,Rl(o.current),Al(o,o.current,s,n),H=c,dd(0,!1),ze&&typeof ze.onPostCommitFiberRoot==`function`)try{ze.onPostCommitFiberRoot(Re,o)}catch{}return!0}finally{N.p=a,M.T=r,qu(e,t)}}function Xu(e,t,n){t=bi(n,t),t=ec(e.stateNode,t,2),e=qa(e,t,2),e!==null&&(et(e,2),ud(e))}function Zu(e,t,n){if(e.tag===3)Xu(e,e,n);else for(;t!==null;){if(t.tag===3){Xu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(lu===null||!lu.has(r))){e=bi(n,e),n=tc(2),r=qa(t,n,2),r!==null&&(nc(n,r,t,e),et(r,2),ud(r));break}}t=t.return}}function Qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Hl;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)||(Jl=!0,i.add(n),e=$u.bind(null,e,t,n),t.then(e,e))}function $u(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ul===e&&(W&n)===n&&(Xl===4||Xl===3&&(W&62914560)===W&&300>ke()-au?!(H&2)&&Ou(e,0):$l|=n,tu===W&&(tu=0)),ud(e)}function ed(e,t){t===0&&(t=Qe()),e=ai(e,t),e!==null&&(et(e,t),ud(e))}function td(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ed(e,n)}function nd(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),ed(e,n)}function rd(e,t){return Te(e,t)}var id=null,ad=null,od=!1,sd=!1,cd=!1,ld=0;function ud(e){e!==ad&&e.next===null&&(ad===null?id=ad=e:ad=ad.next=e),sd=!0,od||(od=!0,_d())}function dd(e,t){if(!cd&&sd){cd=!0;do for(var n=!1,r=id;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-Ve(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,gd(r,a))}else a=W,a=Ye(r,r===Ul?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Xe(r,a)||(n=!0,gd(r,a));r=r.next}while(n);cd=!1}}function fd(){pd()}function pd(){sd=od=!1;var e=0;ld!==0&&$d()&&(e=ld);for(var t=ke(),n=null,r=id;r!==null;){var i=r.next,a=md(r,t);a===0?(r.next=null,n===null?id=i:n.next=i,i===null&&(ad=n)):(n=r,(e!==0||a&3)&&(sd=!0)),r=i}uu!==0&&uu!==5||dd(e,!1),ld!==0&&(ld=0)}function md(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ve(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ze(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ul,n=W,n=Ye(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Wl===2||Wl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ee(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Xe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ee(r),ot(n)){case 2:case 8:n=Me;break;case 32:n=Ne;break;case 268435456:n=Fe;break;default:n=Ne}return r=hd.bind(null,e),n=Te(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ee(r),e.callbackPriority=2,e.callbackNode=null,2}function hd(e,t){if(uu!==0&&uu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Ju()&&e.callbackNode!==n)return null;var r=W;return r=Ye(e,e===Ul?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Su(e,r,t),md(e,ke()),e.callbackNode!=null&&e.callbackNode===n?hd.bind(null,e):null)}function gd(e,t){if(Ju())return null;Su(e,t,!0)}function _d(){rf(function(){H&6?Te(je,fd):pd()})}function vd(){if(ld===0){var e=ha;e===0&&(e=Ge,Ge<<=1,!(Ge&261888)&&(Ge=256)),ld=e}return ld}function yd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:nn(``+e)}function bd(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 xd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=yd((i[dt]||null).action),o=r.submitter;o&&(t=(t=o[dt]||null)?yd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Tn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ld!==0){var e=o?bd(i,o):new FormData(i);Es(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?bd(i,o):new FormData(i),Es(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Sd=0;Sd<Xr.length;Sd++){var Cd=Xr[Sd];Zr(Cd.toLowerCase(),`on`+(Cd[0].toUpperCase()+Cd.slice(1)))}Zr(Hr,`onAnimationEnd`),Zr(Ur,`onAnimationIteration`),Zr(Wr,`onAnimationStart`),Zr(`dblclick`,`onDoubleClick`),Zr(`focusin`,`onFocus`),Zr(`focusout`,`onBlur`),Zr(Gr,`onTransitionRun`),Zr(Kr,`onTransitionStart`),Zr(qr,`onTransitionCancel`),Zr(Jr,`onTransitionEnd`),Dt(`onMouseEnter`,[`mouseout`,`mouseover`]),Dt(`onMouseLeave`,[`mouseout`,`mouseover`]),Dt(`onPointerEnter`,[`pointerout`,`pointerover`]),Dt(`onPointerLeave`,[`pointerout`,`pointerover`]),Et(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Et(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Et(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Et(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Et(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Et(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var wd=`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(` `),Td=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(wd));function Ed(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){Qr(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){Qr(e)}i.currentTarget=null,a=c}}}}function G(e,t){var n=t[pt];n===void 0&&(n=t[pt]=new Set);var r=e+`__bubble`;n.has(r)||(Ad(t,e,2,!1),n.add(r))}function Dd(e,t,n){var r=0;t&&(r|=4),Ad(n,e,r,t)}var Od=`_reactListening`+Math.random().toString(36).slice(2);function kd(e){if(!e[Od]){e[Od]=!0,wt.forEach(function(t){t!==`selectionchange`&&(Td.has(t)||Dd(t,!1,e),Dd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Od]||(t[Od]=!0,Dd(`selectionchange`,!1,t))}}function Ad(e,t,n,r){switch(Sp(t)){case 2:var i=gp;break;case 8:i=_p;break;default:i=vp}n=i.bind(null,t,n,e),i=void 0,!mn||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 jd(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=yt(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}dn(function(){var r=a,i=on(n),s=[];a:{var c=Yr.get(e);if(c!==void 0){var l=Tn,u=e;switch(e){case`keypress`:if(bn(n)===0)break a;case`keydown`:case`keyup`:l=Un;break;case`focusin`:u=`focus`,l=Pn;break;case`focusout`:u=`blur`,l=Pn;break;case`beforeblur`:case`afterblur`:l=Pn;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=Mn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Nn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Gn;break;case Hr:case Ur:case Wr:l=Fn;break;case Jr:l=Kn;break;case`scroll`:case`scrollend`:l=Dn;break;case`wheel`:l=qn;break;case`copy`:case`cut`:case`paste`:l=In;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Wn;break;case`toggle`:case`beforetoggle`:l=Jn}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=fn(m,p),g!=null&&d.push(Md(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!==an&&(u=n.relatedTarget||n.fromElement)&&(yt(u)||u[ft]))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?yt(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=Mn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Wn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:xt(l),h=u==null?c:xt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,yt(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=Pd,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&&Fd(s,c,l,d,!1),u!==null&&f!==null&&Fd(s,f,u,d,!0)}}a:{if(c=r?xt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=fr;else if(sr(c))if(pr)v=Sr;else{v=br;var y=yr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&$t(r.elementType)&&(v=fr):v=xr;if(v&&=v(e,r)){cr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Gt(c,`number`,c.value)}switch(y=r?xt(r):window,e){case`focusin`:(sr(y)||y.contentEditable===`true`)&&(Mr=y,Nr=r,Pr=null);break;case`focusout`:Pr=Nr=Mr=null;break;case`mousedown`:Fr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Fr=!1,Ir(s,n,i);break;case`selectionchange`:if(jr)break;case`keydown`:case`keyup`:Ir(s,n,i)}var b;if(Xn)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 rr?tr(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(F&&n.locale!==`ko`&&(rr||x!==`onCompositionStart`?x===`onCompositionEnd`&&rr&&(b=yn()):(gn=i,_n=`value`in gn?gn.value:gn.textContent,rr=!0)),y=Nd(r,x),0<y.length&&(x=new Ln(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=nr(n),b!==null&&(x.data=b)))),(b=Qn?ir(e,n):ar(e,n))&&(x=Nd(r,`onBeforeInput`),0<x.length&&(y=new Ln(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),xd(s,e,r,n,i)}Ed(s,t)})}function Md(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Nd(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=fn(e,n),i!=null&&r.unshift(Md(e,i,a)),i=fn(e,t),i!=null&&r.push(Md(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Pd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Fd(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=fn(n,a),l!=null&&o.unshift(Md(n,l,c))):i||(l=fn(n,a),l!=null&&o.push(Md(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Id=/\r\n?/g,Ld=/\u0000|\uFFFD/g;function Rd(e){return(typeof e==`string`?e:``+e).replace(Id,`
|
|
9
9
|
`).replace(Ld,``)}function zd(e,t){return t=Rd(t),Rd(e)===t}function Bd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Yt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Yt(e,``+r);break;case`className`:Nt(e,`class`,r);break;case`tabIndex`:Nt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Nt(e,n,r);break;case`style`:Qt(e,r,o);break;case`data`:if(t!==`object`){Nt(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=nn(``+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`&&Bd(e,t,`name`,a.name,a,null),Bd(e,t,`formEncType`,a.formEncType,a,null),Bd(e,t,`formMethod`,a.formMethod,a,null),Bd(e,t,`formTarget`,a.formTarget,a,null)):(Bd(e,t,`encType`,a.encType,a,null),Bd(e,t,`method`,a.method,a,null),Bd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=nn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=rn);break;case`onScroll`:r!=null&&G(`scroll`,e);break;case`onScrollEnd`:r!=null&&G(`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=nn(``+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`:G(`beforetoggle`,e),G(`toggle`,e),Mt(e,`popover`,r);break;case`xlinkActuate`:Pt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Pt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Pt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Pt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Pt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Pt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Pt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Pt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Pt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Mt(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=en.get(n)||n,Mt(e,n,r))}}function Vd(e,t,n,r,a,o){switch(n){case`style`:Qt(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`?Yt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Yt(e,``+r);break;case`onScroll`:r!=null&&G(`scroll`,e);break;case`onScrollEnd`:r!=null&&G(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=rn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Tt.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[dt]||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,``):Mt(e,n,r)}}}function Hd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:G(`error`,e),G(`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:Bd(e,t,o,s,n,null)}}a&&Bd(e,t,`srcSet`,n.srcSet,n,null),r&&Bd(e,t,`src`,n.src,n,null);return;case`input`:G(`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:Bd(e,t,r,d,n,null)}}Wt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in G(`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:Bd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Kt(e,!!r,n,!0):Kt(e,!!r,t,!1);return;case`textarea`:for(s in G(`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:Bd(e,t,s,c,n,null)}Jt(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:Bd(e,t,l,r,n,null)}return;case`dialog`:G(`beforetoggle`,e),G(`toggle`,e),G(`cancel`,e),G(`close`,e);break;case`iframe`:case`object`:G(`load`,e);break;case`video`:case`audio`:for(r=0;r<wd.length;r++)G(wd[r],e);break;case`image`:G(`error`,e),G(`load`,e);break;case`details`:G(`toggle`,e);break;case`embed`:case`source`:case`link`:G(`error`,e),G(`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:Bd(e,t,u,r,n,null)}return;default:if($t(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Vd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Bd(e,t,c,r,n,null))}function Ud(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)||Bd(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&&Bd(e,t,p,m,r,f)}}Ut(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)||Bd(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&&Bd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Kt(e,!!n,n?[]:``,!1):Kt(e,!!n,t,!0)):Kt(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:Bd(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&&Bd(e,t,s,a,r,o)}qt(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:Bd(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:Bd(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)&&Bd(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:Bd(e,t,u,p,r,m)}return;default:if($t(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Vd(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||Vd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Bd(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||Bd(e,t,f,p,r,m)}function Wd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Gd(){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&&Wd(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&&Wd(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 Kd=null,qd=null;function Jd(e){return e.nodeType===9?e:e.ownerDocument}function Yd(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 Xd(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 Zd(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 Qd=null;function $d(){var e=window.event;return e&&e.type===`popstate`?e===Qd?!1:(Qd=e,!0):(Qd=null,!1)}var ef=typeof setTimeout==`function`?setTimeout:void 0,tf=typeof clearTimeout==`function`?clearTimeout:void 0,nf=typeof Promise==`function`?Promise:void 0,rf=typeof queueMicrotask==`function`?queueMicrotask:nf===void 0?ef:function(e){return nf.resolve(null).then(e).catch(af)};function af(e){setTimeout(function(){throw e})}function of(e){return e===`head`}function sf(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),Vp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)xf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,xf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[_t]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&xf(e.ownerDocument.body);n=i}while(n);Vp(t)}function cf(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 lf(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`:lf(n),vt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function uf(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[_t])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=gf(e.nextSibling),e===null)break}return null}function df(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=gf(e.nextSibling),e===null))return null;return e}function ff(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=gf(e.nextSibling),e===null))return null;return e}function pf(e){return e.data===`$?`||e.data===`$~`}function mf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function hf(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 gf(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 _f=null;function vf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return gf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function yf(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 bf(e,t,n){switch(t=Jd(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 xf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);vt(e)}var Sf=new Map,Cf=new Set;function wf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Tf=N.d;N.d={f:Ef,r:Df,D:Af,C:jf,L:Mf,m:Nf,X:Ff,S:Pf,M:If};function Ef(){var e=Tf.f(),t=Eu();return e||t}function Df(e){var t=bt(e);t!==null&&t.tag===5&&t.type===`form`?Os(t):Tf.r(e)}var Of=typeof document>`u`?null:document;function kf(e,t,n){var r=Of;if(r&&typeof t==`string`&&t){var i=Ht(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Cf.has(i)||(Cf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Hd(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function Af(e){Tf.D(e),kf(`dns-prefetch`,e,null)}function jf(e,t){Tf.C(e,t),kf(`preconnect`,e,t)}function Mf(e,t,n){Tf.L(e,t,n);var r=Of;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ht(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ht(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ht(n.imageSizes)+`"]`)):i+=`[href="`+Ht(e)+`"]`;var a=i;switch(t){case`style`:a=Rf(e);break;case`script`:a=Hf(e)}Sf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Sf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(zf(a))||t===`script`&&r.querySelector(Uf(a))||(t=r.createElement(`link`),Hd(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function Nf(e,t){Tf.m(e,t);var n=Of;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ht(r)+`"][href="`+Ht(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Hf(e)}if(!Sf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),Sf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Uf(a)))return}r=n.createElement(`link`),Hd(r,`link`,e),Ct(r),n.head.appendChild(r)}}}function Pf(e,t,n){Tf.S(e,t,n);var r=Of;if(r&&e){var i=St(r).hoistableStyles,a=Rf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(zf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Sf.get(a))&&Kf(e,n);var c=o=r.createElement(`link`);Ct(c),Hd(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,Gf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Ff(e,t){Tf.X(e,t);var n=Of;if(n&&e){var r=St(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=m({src:e,async:!0},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),Ct(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function If(e,t){Tf.M(e,t);var n=Of;if(n&&e){var r=St(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),Ct(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lf(e,t,n,r){var a=(a=de.current)?wf(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=Rf(n.href),n=St(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=Rf(n.href);var o=St(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(zf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Sf.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},Sf.set(e,n),o||Vf(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=Hf(n),n=St(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 Rf(e){return`href="`+Ht(e)+`"`}function zf(e){return`link[rel="stylesheet"][`+e+`]`}function Bf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Vf(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}),Hd(t,`link`,n),Ct(t),e.head.appendChild(t))}function Hf(e){return`[src="`+Ht(e)+`"]`}function Uf(e){return`script[async]`+e}function Wf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ht(n.href)+`"]`);if(r)return t.instance=r,Ct(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`),Ct(r),Hd(r,`style`,a),Gf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Rf(n.href);var o=e.querySelector(zf(a));if(o)return t.state.loading|=4,t.instance=o,Ct(o),o;r=Bf(n),(a=Sf.get(a))&&Kf(r,a),o=(e.ownerDocument||e).createElement(`link`),Ct(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Hd(o,`link`,r),t.state.loading|=4,Gf(o,n.precedence,e),t.instance=o;case`script`:return o=Hf(n.src),(a=e.querySelector(Uf(o)))?(t.instance=a,Ct(a),a):(r=n,(a=Sf.get(o))&&(r=m({},n),qf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Ct(a),Hd(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,Gf(r,n.precedence,e));return t.instance}function Gf(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 Kf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function qf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Jf=null;function Yf(e,t,n){if(Jf===null){var r=new Map,i=Jf=new Map;i.set(n,r)}else i=Jf,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[_t]||a[ut]||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 Xf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Zf(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 Qf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function $f(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=Rf(r.href),a=t.querySelector(zf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=np.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ct(a);return}a=t.ownerDocument||t,r=Bf(r),(i=Sf.get(i))&&Kf(r,i),a=a.createElement(`link`),Ct(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Hd(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=np.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ep=0;function tp(e,t){return e.stylesheets&&e.count===0&&ip(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ip(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ep===0&&(ep=62500*Gd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ip(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ep?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function np(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ip(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var rp=null;function ip(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,rp=new Map,t.forEach(ap,e),rp=null,np.call(e))}function ap(e,t){if(!(t.state.loading&4)){var n=rp.get(e);if(n)var r=n.get(null);else{n=new Map,rp.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=np.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 op={$$typeof:C,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function sp(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=$e(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$e(0),this.hiddenUpdates=$e(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 cp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new sp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ui(3,null,null,t),e.current=a,a.stateNode=e,t=da(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Wa(a),e}function lp(e){return e?(e=ci,e):ci}function up(e,t,n,r,i,a){i=lp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ka(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=qa(e,r,t),n!==null&&(xu(n,e,t),Ja(n,e,t))}function dp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fp(e,t){dp(e,t),(e=e.alternate)&&dp(e,t)}function pp(e){if(e.tag===13||e.tag===31){var t=ai(e,67108864);t!==null&&xu(t,e,67108864),fp(e,67108864)}}function mp(e){if(e.tag===13||e.tag===31){var t=yu();t=at(t);var n=ai(e,t);n!==null&&xu(n,e,t),fp(e,t)}}var hp=!0;function gp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=2,vp(e,t,n,r)}finally{N.p=a,M.T=i}}function _p(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=8,vp(e,t,n,r)}finally{N.p=a,M.T=i}}function vp(e,t,n,r){if(hp){var i=yp(r);if(i===null)jd(e,t,r,bp,n),jp(e,r);else if(Np(i,e,t,n,r))r.stopPropagation();else if(jp(e,r),t&4&&-1<Ap.indexOf(e)){for(;i!==null;){var a=bt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Je(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ve(o);s.entanglements[1]|=c,o&=~c}ud(a),!(H&6)&&(su=ke()+500,dd(0,!1))}}break;case 31:case 13:s=ai(a,2),s!==null&&xu(s,a,2),Eu(),fp(a,2)}if(a=yp(r),a===null&&jd(e,t,r,bp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else jd(e,t,r,null,n)}}function yp(e){return e=on(e),xp(e)}var bp=null;function xp(e){if(bp=null,e=yt(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 bp=e,null}function Sp(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(Ae()){case je:return 2;case Me:return 8;case Ne:case Pe:return 32;case Fe:return 268435456;default:return 32}default:return 32}}var Cp=!1,wp=null,Tp=null,Ep=null,Dp=new Map,Op=new Map,kp=[],Ap=`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 jp(e,t){switch(e){case`focusin`:case`focusout`:wp=null;break;case`dragenter`:case`dragleave`:Tp=null;break;case`mouseover`:case`mouseout`:Ep=null;break;case`pointerover`:case`pointerout`:Dp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Op.delete(t.pointerId)}}function Mp(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=bt(t),t!==null&&pp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Np(e,t,n,r,i){switch(t){case`focusin`:return wp=Mp(wp,e,t,n,r,i),!0;case`dragenter`:return Tp=Mp(Tp,e,t,n,r,i),!0;case`mouseover`:return Ep=Mp(Ep,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Dp.set(a,Mp(Dp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Op.set(a,Mp(Op.get(a)||null,e,t,n,r,i)),!0}return!1}function Pp(e){var t=yt(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,ct(e.priority,function(){mp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ct(e.priority,function(){mp(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 Fp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=yp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);an=r,n.target.dispatchEvent(r),an=null}else return t=bt(n),t!==null&&pp(t),e.blockedOn=n,!1;t.shift()}return!0}function Ip(e,t,n){Fp(e)&&n.delete(t)}function Lp(){Cp=!1,wp!==null&&Fp(wp)&&(wp=null),Tp!==null&&Fp(Tp)&&(Tp=null),Ep!==null&&Fp(Ep)&&(Ep=null),Dp.forEach(Ip),Op.forEach(Ip)}function Rp(e,n){e.blockedOn===n&&(e.blockedOn=null,Cp||(Cp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Lp)))}var zp=null;function Bp(e){zp!==e&&(zp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){zp===e&&(zp=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(xp(r||n)===null)continue;break}var a=bt(n);a!==null&&(e.splice(t,3),t-=3,Es(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Vp(e){function t(t){return Rp(t,e)}wp!==null&&Rp(wp,e),Tp!==null&&Rp(Tp,e),Ep!==null&&Rp(Ep,e),Dp.forEach(t),Op.forEach(t);for(var n=0;n<kp.length;n++){var r=kp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<kp.length&&(n=kp[0],n.blockedOn===null);)Pp(n),n.blockedOn===null&&kp.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[dt]||null;if(typeof a==`function`)o||Bp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[dt]||null)s=o.formAction;else if(xp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Bp(n)}}}function Hp(){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 Up(e){this._internalRoot=e}Wp.prototype.render=Up.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;up(n,yu(),e,t,null,null)},Wp.prototype.unmount=Up.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;up(e.current,2,null,e,null,null),Eu(),t[ft]=null}};function Wp(e){this._internalRoot=e}Wp.prototype.unstable_scheduleHydration=function(e){if(e){var t=st();e={blockedOn:null,target:e,priority:t};for(var n=0;n<kp.length&&t!==0&&t<kp[n].priority;n++);kp.splice(n,0,e),n===0&&Pp(e)}};var Gp=n.version;if(Gp!==`19.2.4`)throw Error(i(527,Gp,`19.2.4`));N.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 Kp={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:M,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var qp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qp.isDisabled&&qp.supportsFiber)try{Re=qp.inject(Kp),ze=qp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ys,s=Xs,c=Zs;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=cp(e,1,!1,null,null,n,r,null,o,s,c,Hp),e[ft]=t.current,kd(e),new Up(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=`modulepreload`,y=function(e){return`/`+e},b={};const x=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=y(t,n),t in b)return;b[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`:v,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)})};var S=l(d(),1),C=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,w=/^[\\/]{2}/;function T(e,t){return t+e.replace(/\\/g,`/`)}var E=`popstate`;function D(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function O(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return te(``,{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:ne(t)}return M(t,n,null,e)}function k(e,t){if(e===!1||e==null)throw Error(t)}function A(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function j(){return Math.random().toString(36).substring(2,10)}function ee(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 te(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?re(t):t,state:n,key:t&&t.key||r||j(),mask:i}}function ne({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 re(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 M(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=D(e)?e:te(h.location,e,t);n&&n(r,e),l=u()+1;let d=ee(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=D(e)?e:te(h.location,e,t);n&&n(r,e),l=u();let i=ee(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 N(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(E,d),c=e,()=>{i.removeEventListener(E,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 N(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),k(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:ne(t);return i=i.replace(/ $/,`%20`),!n&&w.test(i)&&(i=r+i),new URL(i,r)}function ie(e,t,n=`/`){return ae(e,t,n,!1)}function ae(e,t,n,r,i){let a=we((typeof t==`string`?re(t):t).pathname||`/`,n);if(a==null)return null;let o=i??se(e),s=null,c=Ce(a);for(let e=0;s==null&&e<o.length;++e)s=ye(o[e],c,r);return s}function oe(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 se(e){let t=ce(e);return le(t),t}function ce(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;k(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=Me([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(k(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ce(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:_e(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Se(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of P(e.path))a(e,t,!0,n)}),t}function P(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=P(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 le(e){e.sort((e,t)=>e.score===t.score?ve(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ue=/^:[\w-]+$/,de=3,fe=2,pe=1,me=10,he=-2,ge=e=>e===`*`;function _e(e,t){let n=e.split(`/`),r=n.length;return n.some(ge)&&(r+=he),t&&(r+=fe),n.filter(e=>!ge(e)).reduce((e,t)=>e+(ue.test(t)?de:t===``?pe:me),r)}function ve(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 ye(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={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?xe(u,l,s.matcher,s.compiledParams):be(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=be({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:Me([a,d.pathname]),pathnameBase:Pe(Me([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=Me([a,d.pathnameBase]))}return o}function be(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Se(e.path,e.caseSensitive,e.end);return xe(e,t,n,r)}function xe(e,t,n,r){let 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 Se(e,t=!1,n=!0){A(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 Ce(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return A(!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 we(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)||`/`}function Te(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?re(e):e,a;return n?(n=je(n),a=n.startsWith(`/`)?Ee(n.substring(1),`/`):Ee(n,t)):a=t,{pathname:a,search:Fe(r),hash:Ie(i)}}function Ee(e,t){let n=Ne(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function De(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 Oe(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ke(e){let t=Oe(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Ae(e,t,n,r=!1){let i;typeof e==`string`?i=re(e):(i={...e},k(!i.pathname||!i.pathname.includes(`?`),De(`?`,`pathname`,`search`,i)),k(!i.pathname||!i.pathname.includes(`#`),De(`#`,`pathname`,`hash`,i)),k(!i.search||!i.search.includes(`#`),De(`#`,`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=Te(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var je=e=>e.replace(/[\\/]{2,}/g,`/`),Me=e=>je(e.join(`/`)),Ne=e=>e.replace(/\/+$/,``),Pe=e=>Ne(e).replace(/^\/*/,`/`),Fe=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Ie=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Le=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 Re(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function ze(e){return Me(e.map(e=>e.route.path).filter(Boolean))||`/`}var Be=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ve(e,t){let n=e;if(typeof n!=`string`||!C.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Be)try{let e=new URL(window.location.href),r=w.test(n)?new URL(T(n,e.protocol)):new URL(n),a=we(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{A(!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 He=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Ue(e){try{return He.includes(new URL(e).protocol)}catch{return!1}}var We=S.createContext(null);We.displayName=`DataRouter`;var Ge=S.createContext(null);Ge.displayName=`DataRouterState`;var Ke=S.createContext(!1);function qe(){return S.useContext(Ke)}var Je=S.createContext({isTransitioning:!1});Je.displayName=`ViewTransition`;var Ye=S.createContext(new Map);Ye.displayName=`Fetchers`;var Xe=S.createContext(null);Xe.displayName=`Await`;var Ze=S.createContext(null);Ze.displayName=`Navigation`;var Qe=S.createContext(null);Qe.displayName=`Location`;var $e=S.createContext({outlet:null,matches:[],isDataRoute:!1});$e.displayName=`Route`;var et=S.createContext(null);et.displayName=`RouteError`;var tt=`REACT_ROUTER_ERROR`,nt=`REDIRECT`,rt=`ROUTE_ERROR_RESPONSE`;function it(e){if(e.startsWith(`${tt}:${nt}:{`))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 at(e){if(e.startsWith(`${tt}:${rt}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Le(t.status,t.statusText,t.data)}catch{}}function ot(e,{relative:t}={}){k(st(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=S.useContext(Ze),{hash:i,pathname:a,search:o}=mt(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Me([n,a])),r.createHref({pathname:s,search:o,hash:i})}function st(){return S.useContext(Qe)!=null}function ct(){return k(st(),`useLocation() may be used only in the context of a <Router> component.`),S.useContext(Qe).location}var lt=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function ut(e){S.useContext(Ze).static||S.useLayoutEffect(e)}function dt(){let{isDataRoute:e}=S.useContext($e);return e?Nt():ft()}function ft(){k(st(),`useNavigate() may be used only in the context of a <Router> component.`);let e=S.useContext(We),{basename:t,navigator:n}=S.useContext(Ze),{matches:r}=S.useContext($e),{pathname:i}=ct(),a=JSON.stringify(ke(r)),o=S.useRef(!1);return ut(()=>{o.current=!0}),S.useCallback((r,s={})=>{if(A(o.current,lt),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Ae(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Me([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}S.createContext(null);function pt(){let{matches:e}=S.useContext($e);return e[e.length-1]?.params??{}}function mt(e,{relative:t}={}){let{matches:n}=S.useContext($e),{pathname:r}=ct(),i=JSON.stringify(ke(n));return S.useMemo(()=>Ae(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function ht(e,t){return gt(e,t)}function gt(e,t,n){k(st(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=S.useContext(Ze),{matches:i}=S.useContext($e),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||``;Ft(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
10
|
|
|
11
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=ct(),d;if(t){let e=typeof t==`string`?re(t):t;k(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})):ie(e,{pathname:p});A(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),A(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=Ct(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Me([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Me([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?S.createElement(Qe.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function _t(){let e=Mt(),t=Re(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=S.createElement(S.Fragment,null,S.createElement(`p`,null,`💿 Hey developer 👋`),S.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,S.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,S.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),S.createElement(S.Fragment,null,S.createElement(`h2`,null,`Unexpected Application Error!`),S.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?S.createElement(`pre`,{style:i},n):null,o)}var vt=S.createElement(_t,null),yt=class extends S.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=at(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:S.createElement($e.Provider,{value:this.props.routeContext},S.createElement(et.Provider,{value:e,children:this.props.component}));return this.context?S.createElement(xt,{error:e},t):t}};yt.contextType=Ke;var bt=new WeakMap;function xt({children:e,error:t}){let{basename:n}=S.useContext(Ze);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=it(t.digest);if(e){let r=bt.get(t);if(r)throw r;let i=Ve(e.location,n),a=i.absoluteURL||i.to;if(Ue(a))throw Error(`Invalid redirect location`);if(Be&&!bt.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw bt.set(t,n),n}return S.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function St({routeContext:e,match:t,children:n}){let r=S.useContext(We);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),S.createElement($e.Provider,{value:e},n)}function Ct(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);k(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:ze(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||vt,o&&(s<0&&c===0?(Ft(`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?S.createElement(n.route.Component,null):n.route.element?n.route.element:e,S.createElement(St,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?S.createElement(yt,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function wt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Tt(e){let t=S.useContext(We);return k(t,wt(e)),t}function Et(e){let t=S.useContext(Ge);return k(t,wt(e)),t}function Dt(e){let t=S.useContext($e);return k(t,wt(e)),t}function Ot(e){let t=Dt(e),n=t.matches[t.matches.length-1];return k(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function kt(){return Ot(`useRouteId`)}function At(){let e=Et(`useNavigation`);return S.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function jt(){let{matches:e,loaderData:t}=Et(`useMatches`);return S.useMemo(()=>e.map(e=>oe(e,t)),[e,t])}function Mt(){let e=S.useContext(et),t=Et(`useRouteError`),n=Ot(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Nt(){let{router:e}=Tt(`useNavigate`),t=Ot(`useNavigate`),n=S.useRef(!1);return ut(()=>{n.current=!0}),S.useCallback(async(r,i={})=>{A(n.current,lt),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Pt={};function Ft(e,t,n){!t&&!Pt[e]&&(Pt[e]=!0,A(!1,n))}S.useOptimistic,S.memo(It);function It({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return gt(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Lt(e){k(!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 Rt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){k(!st(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=S.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=re(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=S.useMemo(()=>{let e=we(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 A(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:S.createElement(Ze.Provider,{value:c},S.createElement(Qe.Provider,{children:t,value:h}))}function zt({children:e,location:t}){return ht(Bt(e),t)}function Bt(e,t=[]){let n=[];return S.Children.forEach(e,(e,r)=>{if(!S.isValidElement(e))return;let i=[...t,r];if(e.type===S.Fragment){n.push.apply(n,Bt(e.props.children,i));return}k(e.type===Lt,`[${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>`),k(!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=Bt(e.props.children,i)),n.push(a)}),n}var Vt=`get`,Ht=`application/x-www-form-urlencoded`;function Ut(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Wt(e){return Ut(e)&&e.tagName.toLowerCase()===`button`}function Gt(e){return Ut(e)&&e.tagName.toLowerCase()===`form`}function Kt(e){return Ut(e)&&e.tagName.toLowerCase()===`input`}function qt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Jt(e,t){return e.button===0&&(!t||t===`_self`)&&!qt(e)}function Yt(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 Xt(e,t){let n=Yt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Zt=null;function Qt(){if(Zt===null)try{new FormData(document.createElement(`form`),0),Zt=!1}catch{Zt=!0}return Zt}var $t=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function en(e){return e!=null&&!$t.has(e)?(A(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ht}"`),null):e}function tn(e,t){let n,r,i,a,o;if(Gt(e)){let o=e.getAttribute(`action`);r=o?we(o,t):null,n=e.getAttribute(`method`)||Vt,i=en(e.getAttribute(`enctype`))||Ht,a=new FormData(e)}else if(Wt(e)||Kt(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?we(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Vt,i=en(e.getAttribute(`formenctype`))||en(o.getAttribute(`enctype`))||Ht,a=new FormData(o,e),!Qt()){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(Ut(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Vt,r=null,i=Ht,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 nn={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},rn=/[&><\u2028\u2029]/g;function an(e){return e.replace(rn,e=>nn[e])}function on(e,t){if(e===!1||e==null)throw Error(t)}function sn(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&&we(i.pathname,t)===`/`?i.pathname=`${Ne(t)}/_root.${r}`:i.pathname=`${Ne(i.pathname)}.${r}`,i}async function cn(e,t){if(e.id in t)return t[e.id];try{let n=await x(()=>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 ln(e){return e!=null&&typeof e.page==`string`}function un(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 dn(e,t,n){return gn((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await cn(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(un).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function fn(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 pn(e,t,{includeHydrateFallback:n}={}){return mn(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 mn(e){return[...new Set(e)]}function hn(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function gn(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!ln(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(hn(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function _n(){let e=S.useContext(We);return on(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function vn(){let e=S.useContext(Ge);return on(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var yn=S.createContext(void 0);yn.displayName=`FrameworkContext`;function bn(){let e=S.useContext(yn);return on(e,`You must render this element inside a <HydratedRouter> element`),e}function xn(e,t){let n=S.useContext(yn),[r,i]=S.useState(!1),[a,o]=S.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=S.useRef(null);S.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]),S.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:Sn(s,p),onBlur:Sn(c,m),onMouseEnter:Sn(l,p),onMouseLeave:Sn(u,m),onTouchStart:Sn(d,p)}]:[a,f,{}]:[!1,f,{}]}function Sn(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Cn({page:e,...t}){let n=qe(),{nonce:r}=bn(),{router:i}=_n(),a=S.useMemo(()=>ie(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?S.createElement(Tn,{page:e,matches:a,...t}):S.createElement(En,{page:e,matches:a,...t})):null}function wn(e){let{manifest:t,routeModules:n}=bn(),[r,i]=S.useState([]);return S.useEffect(()=>{let r=!1;return dn(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Tn({page:e,matches:t,...n}){let r=ct(),{future:i}=bn(),{basename:a}=_n(),o=S.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=sn(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 S.createElement(S.Fragment,null,o.map(e=>S.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function En({page:e,matches:t,...n}){let r=ct(),{future:i,manifest:a,routeModules:o}=bn(),{basename:s}=_n(),{loaderData:c,matches:l}=vn(),u=S.useMemo(()=>fn(e,t,l,a,r,`data`),[e,t,l,a,r]),d=S.useMemo(()=>fn(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=S.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=sn(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=S.useMemo(()=>pn(d,a),[d,a]),m=wn(d);return S.createElement(S.Fragment,null,f.map(e=>S.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>S.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>S.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Dn(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var On=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{On&&(window.__reactRouterVersion=`7.18.1`)}catch{}function kn({basename:e,children:t,useTransitions:n,window:r}){let i=S.useRef();i.current??=O({window:r,v5Compat:!0});let a=i.current,[o,s]=S.useState({action:a.action,location:a.location}),c=S.useCallback(e=>{n===!1?s(e):S.startTransition(()=>s(e))},[n]);return S.useLayoutEffect(()=>a.listen(c),[a,c]),S.createElement(Rt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function An({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=S.useState({action:n.action,location:n.location}),o=S.useCallback(e=>{r===!1?a(e):S.startTransition(()=>a(e))},[r]);return S.useLayoutEffect(()=>n.listen(o),[n,o]),S.createElement(Rt,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}An.displayName=`unstable_HistoryRouter`;var jn=S.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:_}=S.useContext(Ze),v=typeof l==`string`&&C.test(l),y=Ve(l,h);l=y.to;let b=ot(l,{relative:r}),x=ct(),w=null;if(o){let e=Ae(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Me([h,e.pathname])),w=g.createHref(e)}let[T,E,D]=xn(n,p),O=Rn(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function k(t){e&&e(t),t.defaultPrevented||O(t)}let A=!(y.isExternal||i),j=S.createElement(`a`,{...p,...D,href:(A?w:void 0)||y.absoluteURL||b,onClick:A?k:e,ref:Dn(m,E),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return T&&!v?S.createElement(S.Fragment,null,j,S.createElement(Cn,{page:b})):j});jn.displayName=`Link`;var Mn=S.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=mt(a,{relative:c.relative}),d=ct(),f=S.useContext(Ge),{navigator:p,basename:m}=S.useContext(Ze),h=f!=null&&Yn(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=we(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)===`/`),C={isActive:b,isPending:x,isTransitioning:h},w=b?e:void 0,T;T=typeof n==`function`?n(C):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return S.createElement(jn,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Mn.displayName=`NavLink`;var Nn=S.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Vt,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=S.useContext(Ze),g=Hn(),_=Un(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&C.test(s);return S.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?S.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Nn.displayName=`Form`;function Pn({getKey:e,storageKey:t,...n}){let r=S.useContext(yn),{basename:i}=S.useContext(Ze),a=ct(),o=jt();qn({getKey:e,storageKey:t});let s=S.useMemo(()=>{if(!r||!e)return null;let t=Kn(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 n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),S.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${an(JSON.stringify(t||Wn))}, ${an(JSON.stringify(s))})`}})}Pn.displayName=`ScrollRestoration`;function Fn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function In(e){let t=S.useContext(We);return k(t,Fn(e)),t}function Ln(e){let t=S.useContext(Ge);return k(t,Fn(e)),t}function Rn(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=dt(),d=ct(),f=mt(e,{relative:o});return S.useCallback(p=>{if(Jt(p,t)){p.preventDefault();let t=n===void 0?ne(d)===ne(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?S.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function zn(e){A(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=S.useRef(Yt(e)),n=S.useRef(!1),r=ct(),i=S.useMemo(()=>Xt(r.search,n.current?null:t.current),[r.search]),a=dt();return[i,S.useCallback((e,t)=>{let r=Yt(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Bn=0,Vn=()=>`__${String(++Bn)}__`;function Hn(){let{router:e}=In(`useSubmit`),{basename:t}=S.useContext(Ze),n=kt(),r=e.fetch,i=e.navigate;return S.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=tn(e,t);a.navigate===!1?await r(a.fetcherKey||Vn(),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 Un(e,{relative:t}={}){let{basename:n}=S.useContext(Ze),r=S.useContext($e);k(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...mt(e||`.`,{relative:t})},o=ct();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:Me([n,a.pathname])),ne(a)}var Wn=`react-router-scroll-positions`,Gn={};function Kn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:we(e.pathname,n)||e.pathname},t)),i??=e.key,i}function qn({getKey:e,storageKey:t}={}){let{router:n}=In(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Ln(`useScrollRestoration`),{basename:a}=S.useContext(Ze),o=ct(),s=jt(),c=At();S.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Jn(S.useCallback(()=>{if(c.state===`idle`){let t=Kn(o,s,a,e);Gn[t]=window.scrollY}try{sessionStorage.setItem(t||Wn,JSON.stringify(Gn))}catch(e){A(!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`&&(S.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Wn);e&&(Gn=JSON.parse(e))}catch{}},[t]),S.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Gn,()=>window.scrollY,e?(t,n)=>Kn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),S.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{A(!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 Jn(e,t){let{capture:n}=t||{};S.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Yn(e,{relative:t}={}){let n=S.useContext(Je);k(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=In(`useViewTransitionState`),i=mt(e,{relative:t});if(!n.isTransitioning)return!1;let a=we(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=we(n.nextLocation.pathname,r)||n.nextLocation.pathname;return be(i.pathname,o)!=null||be(i.pathname,a)!=null}var Xn=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})),Zn=o(((e,t)=>{t.exports=Xn()})),Qn=l(_(),1),F=Zn(),$n=(0,S.createContext)();function er({children:e}){let[t,n]=(0,S.useState)(()=>{let e=localStorage.getItem(`agentlytics-theme`);return e?e===`dark`:!0});return(0,S.useEffect)(()=>{document.documentElement.classList.toggle(`light`,!t),localStorage.setItem(`agentlytics-theme`,t?`dark`:`light`)},[t]),(0,F.jsx)($n.Provider,{value:{dark:t,toggle:()=>n(e=>!e)},children:e})}function tr(){return(0,S.useContext)($n)}var nr=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),rr=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ir=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ar=e=>{let t=ir(e);return t.charAt(0).toUpperCase()+t.slice(1)},or={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`},sr=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},cr=(0,S.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,S.createElement)(`svg`,{ref:c,...or,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:nr(`lucide`,i),...!a&&!sr(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,S.createElement)(e,t)),...Array.isArray(a)?a:[a]])),I=(e,t)=>{let n=(0,S.forwardRef)(({className:n,...r},i)=>(0,S.createElement)(cr,{ref:i,iconNode:t,className:nr(`lucide-${rr(ar(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ar(e),n},lr=I(`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`}]]),ur=I(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),dr=I(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),fr=I(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),pr=I(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),mr=I(`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`}]]),hr=I(`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`}]]),gr=I(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),_r=I(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),vr=I(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),yr=I(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),br=I(`chart-line`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`m19 9-5 5-4-4-3 3`,key:`2osh9i`}]]),xr=I(`chart-pie`,[[`path`,{d:`M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z`,key:`pzmjnu`}],[`path`,{d:`M21.21 15.89A10 10 0 1 1 8 2.83`,key:`k2fpak`}]]),Sr=I(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Cr=I(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),wr=I(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Tr=I(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Er=I(`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`}]]),Dr=I(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Or=I(`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`}]]),kr=I(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ar=I(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),jr=I(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Mr=I(`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`}]]),Nr=I(`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`}]]),Pr=I(`credit-card`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}]]),Fr=I(`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`}]]),Ir=I(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),Lr=I(`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`}]]),Rr=I(`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`}]]),zr=I(`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`}]]),Br=I(`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`}]]),Vr=I(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),Hr=I(`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`}]]),Ur=I(`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`}]]),Wr=I(`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`}]]),Gr=I(`github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),Kr=I(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),qr=I(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Jr=I(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Yr=I(`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`}]]),Xr=I(`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`}]]),Zr=I(`list-todo`,[[`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`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),Qr=I(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),$r=I(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ei=I(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),ti=I(`merge`,[[`path`,{d:`m8 6 4-4 4 4`,key:`ybng9g`}],[`path`,{d:`M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22`,key:`1hyw0i`}],[`path`,{d:`m20 22-5-5`,key:`1m27yz`}]]),ni=I(`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`}]]),ri=I(`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`}]]),ii=I(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),ai=I(`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`}]]),oi=I(`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`}]]),si=I(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),ci=I(`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`}]]),li=I(`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`}]]),ui=I(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),di=I(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),fi=I(`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`}]]),pi=I(`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`}]]),mi=I(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),hi=I(`shield-check`,[[`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:`m9 12 2 2 4-4`,key:`dzmm74`}]]),gi=I(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),_i=I(`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`}]]),vi=I(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),yi=I(`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`}]]),bi=I(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),xi=I(`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`}]]),Si=I(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Ci=I(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),wi=I(`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`}]]),Ti=I(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),Ei=I(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Di=I(`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`}]]),Oi=I(`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`}]]),ki=I(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ai=I(`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`}]]),ji=`agentlytics_relay_token`;function Mi(){return localStorage.getItem(ji)}function Ni(e){e?localStorage.setItem(ji,e):localStorage.removeItem(ji)}var Pi=null;function Fi(e){Pi=e}async function Ii(e,t={}){let n=Mi();n&&(t.headers={...t.headers,Authorization:`Bearer ${n}`});let r=await fetch(e,t);if(r.status===401)throw Ni(null),Pi&&Pi(),Error(`Unauthorized`);return r}async function Li(e){let t=await fetch(`/api/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||`Login failed`)}let n=await t.json();return n.token&&Ni(n.token),n}function Ri(e,t){t.dateFrom&&e.set(`dateFrom`,t.dateFrom),t.dateTo&&e.set(`dateTo`,t.dateTo)}async function zi(e={}){let t=new URLSearchParams;e.editor&&t.set(`editor`,e.editor),Ri(t,e);let n=t.toString();return(await fetch(`/api/overview${n?`?`+n:``}`)).json()}async function Bi(e={}){let t=new URLSearchParams;return e.editor&&t.set(`editor`,e.editor),e.folder&&t.set(`folder`,e.folder),e.limit&&t.set(`limit`,e.limit),e.offset&&t.set(`offset`,e.offset),e.named===!1&&t.set(`named`,`false`),Ri(t,e),(await fetch(`/api/chats?${t}`)).json()}async function Vi(e){return(await fetch(`/api/chats/${encodeURIComponent(e)}`)).json()}async function Hi(e={}){let t=new URLSearchParams;Ri(t,e);let n=t.toString();return(await fetch(`/api/projects${n?`?`+n:``}`)).json()}async function Ui(e={}){let t=new URLSearchParams;e.editor&&t.set(`editor`,e.editor),Ri(t,e);let n=t.toString();return(await fetch(`/api/daily-activity${n?`?`+n:``}`)).json()}async function Wi(e={}){let t=new URLSearchParams;return e.editor&&t.set(`editor`,e.editor),e.folder&&t.set(`folder`,e.folder),e.limit&&t.set(`limit`,e.limit),Ri(t,e),(await fetch(`/api/deep-analytics?${t}`)).json()}function Gi(e){return new Promise((t,n)=>{let r=new EventSource(`/api/refetch`);r.onmessage=i=>{try{let a=JSON.parse(i.data);a.done?(r.close(),t(a)):a.error?(r.close(),n(Error(a.error))):e&&e(a)}catch{}},r.onerror=()=>{r.close(),n(Error(`SSE error`))}})}async function Ki(e={}){let t=new URLSearchParams;e.editor&&t.set(`editor`,e.editor),Ri(t,e);let n=t.toString();return(await fetch(`/api/dashboard-stats${n?`?`+n:``}`)).json()}async function qi(e={}){let t=new URLSearchParams;e.editor&&t.set(`editor`,e.editor),Ri(t,e);let n=t.toString();return(await fetch(`/api/cost-analytics${n?`?`+n:``}`)).json()}async function Ji(e={}){let t=new URLSearchParams;e.editor&&t.set(`editor`,e.editor),e.folder&&t.set(`folder`,e.folder),e.chatId&&t.set(`chatId`,e.chatId),Ri(t,e);let n=t.toString();return(await fetch(`/api/costs${n?`?`+n:``}`)).json()}async function Yi(){return(await fetch(`/api/config`)).json()}async function Xi(e){return(await fetch(`/api/config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).json()}async function Zi(){return(await fetch(`/api/all-projects`)).json()}async function Qi(e){return(await fetch(`/api/query`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sql:e})})).json()}async function $i(){return(await fetch(`/api/schema`)).json()}async function ea(e={}){let t=new URLSearchParams;e.showEditors!==void 0&&t.set(`showEditors`,e.showEditors),e.showModels!==void 0&&t.set(`showModels`,e.showModels),e.showCosts!==void 0&&t.set(`showCosts`,e.showCosts),e.showTokens!==void 0&&t.set(`showTokens`,e.showTokens),e.showHours!==void 0&&t.set(`showHours`,e.showHours),e.username&&t.set(`username`,e.username),e.theme&&t.set(`theme`,e.theme),e.folder&&t.set(`folder`,e.folder);let n=t.toString();return(await fetch(`/api/share-image${n?`?`+n:``}`)).text()}async function ta(e,t={}){let n=new URLSearchParams({name:e});return t.limit&&n.set(`limit`,t.limit),t.folder&&n.set(`folder`,t.folder),t.editor&&n.set(`editor`,t.editor),Ri(n,t),(await fetch(`/api/tool-calls?${n}`)).json()}async function na(e){let t=new URLSearchParams({folder:e});return(await fetch(`/api/check-ai?${t}`)).json()}async function ra(){return(await fetch(`/api/usage`)).json()}async function ia(){return(await fetch(`/api/artifacts`)).json()}async function aa(e){let t=new URLSearchParams({path:e});return(await fetch(`/api/artifact-content?${t}`)).json()}async function oa(){return(await fetch(`/api/mcps`)).json()}async function sa(){return(await fetch(`/api/gsd/projects`)).json()}async function ca(e){let t=new URLSearchParams({folder:e});return(await fetch(`/api/gsd/phases?${t}`)).json()}async function la(e,t){let n=new URLSearchParams({folder:e,phase:t});return(await fetch(`/api/gsd/plan?${n}`)).json()}async function ua(){return(await fetch(`/api/gsd/overview`)).json()}async function da(e){let t=new URLSearchParams({folder:e});return(await fetch(`/api/gsd/config?${t}`)).json()}async function fa(e){let t=new URLSearchParams({folder:e});return(await fetch(`/api/gsd/phase-tokens?${t}`)).json()}async function pa(e,t,n){let r=new URLSearchParams({folder:e,type:t});return n&&r.set(`phase`,n),(await fetch(`/api/gsd/file?${r}`)).json()}async function ma(){try{let e=await fetch(`/api/mode`);return e.ok?e.json():{mode:`local`}}catch{return{mode:`local`}}}async function ha(){return(await Ii(`/relay/team-stats`)).json()}async function ga(e,t={}){let n=new URLSearchParams;t.folder&&n.set(`folder`,t.folder),t.limit&&n.set(`limit`,t.limit);let r=n.toString();return(await Ii(`/relay/activity/${encodeURIComponent(e)}${r?`?`+r:``}`)).json()}async function _a(e,t={}){let n=new URLSearchParams({q:e});return t.username&&n.set(`username`,t.username),t.folder&&n.set(`folder`,t.folder),t.limit&&n.set(`limit`,t.limit),(await Ii(`/relay/search?${n}`)).json()}async function va(e={}){let t=new URLSearchParams;e.limit&&t.set(`limit`,e.limit),e.since&&t.set(`since`,e.since);let n=t.toString();return(await Ii(`/relay/feed${n?`?`+n:``}`)).json()}async function ya(e,t){return(await Ii(`/relay/merge-users`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({from:e,to:t})})).json()}async function ba(e,t){let n=new URLSearchParams;t&&n.set(`username`,t);let r=n.toString();return(await Ii(`/relay/session/${encodeURIComponent(e)}${r?`?`+r:``}`)).json()}var xa=`agentlytics-live`;function Sa(){let[e,t]=(0,S.useState)(()=>localStorage.getItem(xa)===`true`);return(0,S.useEffect)(()=>{localStorage.setItem(xa,e)},[e]),{live:e,toggle:(0,S.useCallback)(()=>t(e=>!e),[])}}function Ca({size:e=22}){return(0,F.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:e,height:e,fill:`none`,style:{overflow:`hidden`},children:[(0,F.jsx)(`style`,{children:`
|
|
11
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=ct(),d;if(t){let e=typeof t==`string`?re(t):t;k(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})):ie(e,{pathname:p});A(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),A(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=Ct(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Me([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Me([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?S.createElement(Qe.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function _t(){let e=Mt(),t=Re(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=S.createElement(S.Fragment,null,S.createElement(`p`,null,`💿 Hey developer 👋`),S.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,S.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,S.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),S.createElement(S.Fragment,null,S.createElement(`h2`,null,`Unexpected Application Error!`),S.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?S.createElement(`pre`,{style:i},n):null,o)}var vt=S.createElement(_t,null),yt=class extends S.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=at(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:S.createElement($e.Provider,{value:this.props.routeContext},S.createElement(et.Provider,{value:e,children:this.props.component}));return this.context?S.createElement(xt,{error:e},t):t}};yt.contextType=Ke;var bt=new WeakMap;function xt({children:e,error:t}){let{basename:n}=S.useContext(Ze);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=it(t.digest);if(e){let r=bt.get(t);if(r)throw r;let i=Ve(e.location,n),a=i.absoluteURL||i.to;if(Ue(a))throw Error(`Invalid redirect location`);if(Be&&!bt.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw bt.set(t,n),n}return S.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function St({routeContext:e,match:t,children:n}){let r=S.useContext(We);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),S.createElement($e.Provider,{value:e},n)}function Ct(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);k(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:ze(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||vt,o&&(s<0&&c===0?(Ft(`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?S.createElement(n.route.Component,null):n.route.element?n.route.element:e,S.createElement(St,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?S.createElement(yt,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function wt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Tt(e){let t=S.useContext(We);return k(t,wt(e)),t}function Et(e){let t=S.useContext(Ge);return k(t,wt(e)),t}function Dt(e){let t=S.useContext($e);return k(t,wt(e)),t}function Ot(e){let t=Dt(e),n=t.matches[t.matches.length-1];return k(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function kt(){return Ot(`useRouteId`)}function At(){let e=Et(`useNavigation`);return S.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function jt(){let{matches:e,loaderData:t}=Et(`useMatches`);return S.useMemo(()=>e.map(e=>oe(e,t)),[e,t])}function Mt(){let e=S.useContext(et),t=Et(`useRouteError`),n=Ot(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Nt(){let{router:e}=Tt(`useNavigate`),t=Ot(`useNavigate`),n=S.useRef(!1);return ut(()=>{n.current=!0}),S.useCallback(async(r,i={})=>{A(n.current,lt),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Pt={};function Ft(e,t,n){!t&&!Pt[e]&&(Pt[e]=!0,A(!1,n))}S.useOptimistic,S.memo(It);function It({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return gt(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Lt(e){k(!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 Rt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){k(!st(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=S.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=re(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=S.useMemo(()=>{let e=we(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 A(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:S.createElement(Ze.Provider,{value:c},S.createElement(Qe.Provider,{children:t,value:h}))}function zt({children:e,location:t}){return ht(Bt(e),t)}function Bt(e,t=[]){let n=[];return S.Children.forEach(e,(e,r)=>{if(!S.isValidElement(e))return;let i=[...t,r];if(e.type===S.Fragment){n.push.apply(n,Bt(e.props.children,i));return}k(e.type===Lt,`[${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>`),k(!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=Bt(e.props.children,i)),n.push(a)}),n}var Vt=`get`,Ht=`application/x-www-form-urlencoded`;function Ut(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Wt(e){return Ut(e)&&e.tagName.toLowerCase()===`button`}function Gt(e){return Ut(e)&&e.tagName.toLowerCase()===`form`}function Kt(e){return Ut(e)&&e.tagName.toLowerCase()===`input`}function qt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Jt(e,t){return e.button===0&&(!t||t===`_self`)&&!qt(e)}function Yt(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 Xt(e,t){let n=Yt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Zt=null;function Qt(){if(Zt===null)try{new FormData(document.createElement(`form`),0),Zt=!1}catch{Zt=!0}return Zt}var $t=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function en(e){return e!=null&&!$t.has(e)?(A(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ht}"`),null):e}function tn(e,t){let n,r,i,a,o;if(Gt(e)){let o=e.getAttribute(`action`);r=o?we(o,t):null,n=e.getAttribute(`method`)||Vt,i=en(e.getAttribute(`enctype`))||Ht,a=new FormData(e)}else if(Wt(e)||Kt(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?we(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Vt,i=en(e.getAttribute(`formenctype`))||en(o.getAttribute(`enctype`))||Ht,a=new FormData(o,e),!Qt()){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(Ut(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Vt,r=null,i=Ht,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 nn={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},rn=/[&><\u2028\u2029]/g;function an(e){return e.replace(rn,e=>nn[e])}function on(e,t){if(e===!1||e==null)throw Error(t)}function sn(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&&we(i.pathname,t)===`/`?i.pathname=`${Ne(t)}/_root.${r}`:i.pathname=`${Ne(i.pathname)}.${r}`,i}async function cn(e,t){if(e.id in t)return t[e.id];try{let n=await x(()=>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 ln(e){return e!=null&&typeof e.page==`string`}function un(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 dn(e,t,n){return gn((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await cn(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(un).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function fn(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 pn(e,t,{includeHydrateFallback:n}={}){return mn(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 mn(e){return[...new Set(e)]}function hn(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function gn(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!ln(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(hn(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function _n(){let e=S.useContext(We);return on(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function vn(){let e=S.useContext(Ge);return on(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var yn=S.createContext(void 0);yn.displayName=`FrameworkContext`;function bn(){let e=S.useContext(yn);return on(e,`You must render this element inside a <HydratedRouter> element`),e}function xn(e,t){let n=S.useContext(yn),[r,i]=S.useState(!1),[a,o]=S.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=S.useRef(null);S.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]),S.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:Sn(s,p),onBlur:Sn(c,m),onMouseEnter:Sn(l,p),onMouseLeave:Sn(u,m),onTouchStart:Sn(d,p)}]:[a,f,{}]:[!1,f,{}]}function Sn(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Cn({page:e,...t}){let n=qe(),{nonce:r}=bn(),{router:i}=_n(),a=S.useMemo(()=>ie(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?S.createElement(Tn,{page:e,matches:a,...t}):S.createElement(En,{page:e,matches:a,...t})):null}function wn(e){let{manifest:t,routeModules:n}=bn(),[r,i]=S.useState([]);return S.useEffect(()=>{let r=!1;return dn(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Tn({page:e,matches:t,...n}){let r=ct(),{future:i}=bn(),{basename:a}=_n(),o=S.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=sn(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 S.createElement(S.Fragment,null,o.map(e=>S.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function En({page:e,matches:t,...n}){let r=ct(),{future:i,manifest:a,routeModules:o}=bn(),{basename:s}=_n(),{loaderData:c,matches:l}=vn(),u=S.useMemo(()=>fn(e,t,l,a,r,`data`),[e,t,l,a,r]),d=S.useMemo(()=>fn(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=S.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=sn(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=S.useMemo(()=>pn(d,a),[d,a]),m=wn(d);return S.createElement(S.Fragment,null,f.map(e=>S.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>S.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>S.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Dn(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var On=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{On&&(window.__reactRouterVersion=`7.18.1`)}catch{}function kn({basename:e,children:t,useTransitions:n,window:r}){let i=S.useRef();i.current??=O({window:r,v5Compat:!0});let a=i.current,[o,s]=S.useState({action:a.action,location:a.location}),c=S.useCallback(e=>{n===!1?s(e):S.startTransition(()=>s(e))},[n]);return S.useLayoutEffect(()=>a.listen(c),[a,c]),S.createElement(Rt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function An({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=S.useState({action:n.action,location:n.location}),o=S.useCallback(e=>{r===!1?a(e):S.startTransition(()=>a(e))},[r]);return S.useLayoutEffect(()=>n.listen(o),[n,o]),S.createElement(Rt,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}An.displayName=`unstable_HistoryRouter`;var jn=S.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:_}=S.useContext(Ze),v=typeof l==`string`&&C.test(l),y=Ve(l,h);l=y.to;let b=ot(l,{relative:r}),x=ct(),w=null;if(o){let e=Ae(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Me([h,e.pathname])),w=g.createHref(e)}let[T,E,D]=xn(n,p),O=Rn(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function k(t){e&&e(t),t.defaultPrevented||O(t)}let A=!(y.isExternal||i),j=S.createElement(`a`,{...p,...D,href:(A?w:void 0)||y.absoluteURL||b,onClick:A?k:e,ref:Dn(m,E),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return T&&!v?S.createElement(S.Fragment,null,j,S.createElement(Cn,{page:b})):j});jn.displayName=`Link`;var Mn=S.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=mt(a,{relative:c.relative}),d=ct(),f=S.useContext(Ge),{navigator:p,basename:m}=S.useContext(Ze),h=f!=null&&Yn(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=we(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)===`/`),C={isActive:b,isPending:x,isTransitioning:h},w=b?e:void 0,T;T=typeof n==`function`?n(C):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return S.createElement(jn,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Mn.displayName=`NavLink`;var Nn=S.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Vt,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=S.useContext(Ze),g=Hn(),_=Un(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&C.test(s);return S.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?S.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Nn.displayName=`Form`;function Pn({getKey:e,storageKey:t,...n}){let r=S.useContext(yn),{basename:i}=S.useContext(Ze),a=ct(),o=jt();qn({getKey:e,storageKey:t});let s=S.useMemo(()=>{if(!r||!e)return null;let t=Kn(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 n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),S.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${an(JSON.stringify(t||Wn))}, ${an(JSON.stringify(s))})`}})}Pn.displayName=`ScrollRestoration`;function Fn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function In(e){let t=S.useContext(We);return k(t,Fn(e)),t}function Ln(e){let t=S.useContext(Ge);return k(t,Fn(e)),t}function Rn(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=dt(),d=ct(),f=mt(e,{relative:o});return S.useCallback(p=>{if(Jt(p,t)){p.preventDefault();let t=n===void 0?ne(d)===ne(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?S.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function zn(e){A(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=S.useRef(Yt(e)),n=S.useRef(!1),r=ct(),i=S.useMemo(()=>Xt(r.search,n.current?null:t.current),[r.search]),a=dt();return[i,S.useCallback((e,t)=>{let r=Yt(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Bn=0,Vn=()=>`__${String(++Bn)}__`;function Hn(){let{router:e}=In(`useSubmit`),{basename:t}=S.useContext(Ze),n=kt(),r=e.fetch,i=e.navigate;return S.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=tn(e,t);a.navigate===!1?await r(a.fetcherKey||Vn(),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 Un(e,{relative:t}={}){let{basename:n}=S.useContext(Ze),r=S.useContext($e);k(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...mt(e||`.`,{relative:t})},o=ct();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:Me([n,a.pathname])),ne(a)}var Wn=`react-router-scroll-positions`,Gn={};function Kn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:we(e.pathname,n)||e.pathname},t)),i??=e.key,i}function qn({getKey:e,storageKey:t}={}){let{router:n}=In(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Ln(`useScrollRestoration`),{basename:a}=S.useContext(Ze),o=ct(),s=jt(),c=At();S.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Jn(S.useCallback(()=>{if(c.state===`idle`){let t=Kn(o,s,a,e);Gn[t]=window.scrollY}try{sessionStorage.setItem(t||Wn,JSON.stringify(Gn))}catch(e){A(!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`&&(S.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Wn);e&&(Gn=JSON.parse(e))}catch{}},[t]),S.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Gn,()=>window.scrollY,e?(t,n)=>Kn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),S.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{A(!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 Jn(e,t){let{capture:n}=t||{};S.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Yn(e,{relative:t}={}){let n=S.useContext(Je);k(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=In(`useViewTransitionState`),i=mt(e,{relative:t});if(!n.isTransitioning)return!1;let a=we(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=we(n.nextLocation.pathname,r)||n.nextLocation.pathname;return be(i.pathname,o)!=null||be(i.pathname,a)!=null}var Xn=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})),Zn=o(((e,t)=>{t.exports=Xn()})),Qn=l(_(),1),F=Zn(),$n=(0,S.createContext)();function er({children:e}){let[t,n]=(0,S.useState)(()=>{let e=localStorage.getItem(`agentlytics-theme`);return e?e===`dark`:!0});return(0,S.useEffect)(()=>{document.documentElement.classList.toggle(`light`,!t),localStorage.setItem(`agentlytics-theme`,t?`dark`:`light`)},[t]),(0,F.jsx)($n.Provider,{value:{dark:t,toggle:()=>n(e=>!e)},children:e})}function tr(){return(0,S.useContext)($n)}var nr=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),rr=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ir=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ar=e=>{let t=ir(e);return t.charAt(0).toUpperCase()+t.slice(1)},or={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`},sr=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},cr=(0,S.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,S.createElement)(`svg`,{ref:c,...or,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:nr(`lucide`,i),...!a&&!sr(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,S.createElement)(e,t)),...Array.isArray(a)?a:[a]])),I=(e,t)=>{let n=(0,S.forwardRef)(({className:n,...r},i)=>(0,S.createElement)(cr,{ref:i,iconNode:t,className:nr(`lucide-${rr(ar(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ar(e),n},lr=I(`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`}]]),ur=I(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),dr=I(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),fr=I(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),pr=I(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),mr=I(`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`}]]),hr=I(`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`}]]),gr=I(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),_r=I(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),vr=I(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),yr=I(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),br=I(`chart-line`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`m19 9-5 5-4-4-3 3`,key:`2osh9i`}]]),xr=I(`chart-pie`,[[`path`,{d:`M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z`,key:`pzmjnu`}],[`path`,{d:`M21.21 15.89A10 10 0 1 1 8 2.83`,key:`k2fpak`}]]),Sr=I(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Cr=I(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),wr=I(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Tr=I(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Er=I(`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`}]]),Dr=I(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Or=I(`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`}]]),kr=I(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ar=I(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),jr=I(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Mr=I(`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`}]]),Nr=I(`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`}]]),Pr=I(`credit-card`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}]]),Fr=I(`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`}]]),Ir=I(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),Lr=I(`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`}]]),Rr=I(`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`}]]),zr=I(`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`}]]),Br=I(`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`}]]),Vr=I(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),Hr=I(`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`}]]),Ur=I(`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`}]]),Wr=I(`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`}]]),Gr=I(`github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),Kr=I(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),qr=I(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Jr=I(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Yr=I(`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`}]]),Xr=I(`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`}]]),Zr=I(`list-todo`,[[`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`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),Qr=I(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),$r=I(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ei=I(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),ti=I(`merge`,[[`path`,{d:`m8 6 4-4 4 4`,key:`ybng9g`}],[`path`,{d:`M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22`,key:`1hyw0i`}],[`path`,{d:`m20 22-5-5`,key:`1m27yz`}]]),ni=I(`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`}]]),ri=I(`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`}]]),ii=I(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),ai=I(`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`}]]),oi=I(`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`}]]),si=I(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),ci=I(`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`}]]),li=I(`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`}]]),ui=I(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),di=I(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),fi=I(`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`}]]),pi=I(`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`}]]),mi=I(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),hi=I(`shield-check`,[[`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:`m9 12 2 2 4-4`,key:`dzmm74`}]]),gi=I(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),_i=I(`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`}]]),vi=I(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),yi=I(`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`}]]),bi=I(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),xi=I(`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`}]]),Si=I(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Ci=I(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),wi=I(`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`}]]),Ti=I(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),Ei=I(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Di=I(`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`}]]),Oi=I(`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`}]]),ki=I(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ai=I(`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`}]]),ji=`agentlytics_relay_token`;function Mi(){return localStorage.getItem(ji)}function Ni(e){e?localStorage.setItem(ji,e):localStorage.removeItem(ji)}var Pi=null;function Fi(e){Pi=e}async function Ii(e,t={}){let n=Mi();n&&(t.headers={...t.headers,Authorization:`Bearer ${n}`});let r=await fetch(e,t);if(r.status===401)throw Ni(null),Pi&&Pi(),Error(`Unauthorized`);return r}async function Li(e){let t=await fetch(`/api/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||`Login failed`)}let n=await t.json();return n.token&&Ni(n.token),n}function Ri(e,t){t.dateFrom&&e.set(`dateFrom`,t.dateFrom),t.dateTo&&e.set(`dateTo`,t.dateTo)}async function zi(e={}){let t=new URLSearchParams;e.editor&&t.set(`editor`,e.editor),Ri(t,e);let n=t.toString();return(await fetch(`/api/overview${n?`?`+n:``}`)).json()}async function Bi(e={}){let t=new URLSearchParams;return e.editor&&t.set(`editor`,e.editor),e.folder&&t.set(`folder`,e.folder),e.limit&&t.set(`limit`,e.limit),e.offset&&t.set(`offset`,e.offset),e.named===!1&&t.set(`named`,`false`),Ri(t,e),(await fetch(`/api/chats?${t}`)).json()}async function Vi(e){return(await fetch(`/api/chats/${encodeURIComponent(e)}`)).json()}async function Hi(e={}){let t=new URLSearchParams;Ri(t,e);let n=t.toString();return(await fetch(`/api/projects${n?`?`+n:``}`)).json()}async function Ui(e={}){let t=new URLSearchParams;e.editor&&t.set(`editor`,e.editor),Ri(t,e);let n=t.toString();return(await fetch(`/api/daily-activity${n?`?`+n:``}`)).json()}async function Wi(e={}){let t=new URLSearchParams;return e.editor&&t.set(`editor`,e.editor),e.folder&&t.set(`folder`,e.folder),e.limit&&t.set(`limit`,e.limit),Ri(t,e),(await fetch(`/api/deep-analytics?${t}`)).json()}async function Gi(e){let t=await fetch(`/api/refetch`,{method:`POST`});if(!t.ok||!t.body)throw Error(`refetch failed (${t.status})`);let n=t.body.getReader(),r=new TextDecoder,i=``,a=null;for(;;){let{value:t,done:o}=await n.read();if(o)break;i+=r.decode(t,{stream:!0});let s=i.split(`
|
|
12
|
+
|
|
13
|
+
`);i=s.pop()||``;for(let t of s){let n=t.split(`
|
|
14
|
+
`).find(e=>e.startsWith(`data:`));if(!n)continue;let r;try{r=JSON.parse(n.slice(5).trim())}catch{continue}if(r.error)throw Error(r.error);r.done?a=r:e&&e(r)}}if(!a)throw Error(`refetch ended without completing`);return a}async function Ki(e={}){let t=new URLSearchParams;e.editor&&t.set(`editor`,e.editor),Ri(t,e);let n=t.toString();return(await fetch(`/api/dashboard-stats${n?`?`+n:``}`)).json()}async function qi(e={}){let t=new URLSearchParams;e.editor&&t.set(`editor`,e.editor),Ri(t,e);let n=t.toString();return(await fetch(`/api/cost-analytics${n?`?`+n:``}`)).json()}async function Ji(e={}){let t=new URLSearchParams;e.editor&&t.set(`editor`,e.editor),e.folder&&t.set(`folder`,e.folder),e.chatId&&t.set(`chatId`,e.chatId),Ri(t,e);let n=t.toString();return(await fetch(`/api/costs${n?`?`+n:``}`)).json()}async function Yi(){return(await fetch(`/api/config`)).json()}async function Xi(e){return(await fetch(`/api/config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).json()}async function Zi(){return(await fetch(`/api/all-projects`)).json()}async function Qi(e){return(await fetch(`/api/query`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sql:e})})).json()}async function $i(){return(await fetch(`/api/schema`)).json()}async function ea(e={}){let t=new URLSearchParams;e.showEditors!==void 0&&t.set(`showEditors`,e.showEditors),e.showModels!==void 0&&t.set(`showModels`,e.showModels),e.showCosts!==void 0&&t.set(`showCosts`,e.showCosts),e.showTokens!==void 0&&t.set(`showTokens`,e.showTokens),e.showHours!==void 0&&t.set(`showHours`,e.showHours),e.username&&t.set(`username`,e.username),e.theme&&t.set(`theme`,e.theme),e.folder&&t.set(`folder`,e.folder);let n=t.toString();return(await fetch(`/api/share-image${n?`?`+n:``}`)).text()}async function ta(e,t={}){let n=new URLSearchParams({name:e});return t.limit&&n.set(`limit`,t.limit),t.folder&&n.set(`folder`,t.folder),t.editor&&n.set(`editor`,t.editor),Ri(n,t),(await fetch(`/api/tool-calls?${n}`)).json()}async function na(e){let t=new URLSearchParams({folder:e});return(await fetch(`/api/check-ai?${t}`)).json()}async function ra(){return(await fetch(`/api/usage`)).json()}async function ia(){return(await fetch(`/api/artifacts`)).json()}async function aa(e){let t=new URLSearchParams({path:e});return(await fetch(`/api/artifact-content?${t}`)).json()}async function oa(){return(await fetch(`/api/mcps`)).json()}async function sa(){return(await fetch(`/api/gsd/projects`)).json()}async function ca(e){let t=new URLSearchParams({folder:e});return(await fetch(`/api/gsd/phases?${t}`)).json()}async function la(e,t){let n=new URLSearchParams({folder:e,phase:t});return(await fetch(`/api/gsd/plan?${n}`)).json()}async function ua(){return(await fetch(`/api/gsd/overview`)).json()}async function da(e){let t=new URLSearchParams({folder:e});return(await fetch(`/api/gsd/config?${t}`)).json()}async function fa(e){let t=new URLSearchParams({folder:e});return(await fetch(`/api/gsd/phase-tokens?${t}`)).json()}async function pa(e,t,n){let r=new URLSearchParams({folder:e,type:t});return n&&r.set(`phase`,n),(await fetch(`/api/gsd/file?${r}`)).json()}async function ma(){try{let e=await fetch(`/api/mode`);return e.ok?e.json():{mode:`local`}}catch{return{mode:`local`}}}async function ha(){return(await Ii(`/relay/team-stats`)).json()}async function ga(e,t={}){let n=new URLSearchParams;t.folder&&n.set(`folder`,t.folder),t.limit&&n.set(`limit`,t.limit);let r=n.toString();return(await Ii(`/relay/activity/${encodeURIComponent(e)}${r?`?`+r:``}`)).json()}async function _a(e,t={}){let n=new URLSearchParams({q:e});return t.username&&n.set(`username`,t.username),t.folder&&n.set(`folder`,t.folder),t.limit&&n.set(`limit`,t.limit),(await Ii(`/relay/search?${n}`)).json()}async function va(e={}){let t=new URLSearchParams;e.limit&&t.set(`limit`,e.limit),e.since&&t.set(`since`,e.since);let n=t.toString();return(await Ii(`/relay/feed${n?`?`+n:``}`)).json()}async function ya(e,t){return(await Ii(`/relay/merge-users`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({from:e,to:t})})).json()}async function ba(e,t){let n=new URLSearchParams;t&&n.set(`username`,t);let r=n.toString();return(await Ii(`/relay/session/${encodeURIComponent(e)}${r?`?`+r:``}`)).json()}var xa=`agentlytics-live`;function Sa(){let[e,t]=(0,S.useState)(()=>localStorage.getItem(xa)===`true`);return(0,S.useEffect)(()=>{localStorage.setItem(xa,e)},[e]),{live:e,toggle:(0,S.useCallback)(()=>t(e=>!e),[])}}function Ca({size:e=22}){return(0,F.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:e,height:e,fill:`none`,style:{overflow:`hidden`},children:[(0,F.jsx)(`style`,{children:`
|
|
12
15
|
@keyframes carousel {
|
|
13
16
|
0% { transform: translateX(0); }
|
|
14
17
|
5% { transform: translateX(0); }
|
|
@@ -57,19 +60,19 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
|
|
|
57
60
|
`).length&&(0,F.jsxs)(`div`,{className:`px-2`,style:{color:`var(--c-text3)`},children:[` ... `,(t||``).split(`
|
|
58
61
|
`).length-12,` more lines`]}),n&&i.map((e,t)=>(0,F.jsxs)(`div`,{className:`px-2`,style:{background:`rgba(52,211,153,0.1)`,color:`#34d399`},children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`,userSelect:`none`},children:`+ `}),e]},`n`+t)),n&&i.length<(n||``).split(`
|
|
59
62
|
`).length&&(0,F.jsxs)(`div`,{className:`px-2`,style:{color:`var(--c-text3)`},children:[` ... `,(n||``).split(`
|
|
60
|
-
`).length-12,` more lines`]})]})}function NT({args:e}){if(!e||Object.keys(e).length===0)return null;if(e.old_string||e.new_string||e.old_text||e.new_text||e.search||e.replace)return(0,F.jsx)(MT,{args:e});let t=e.file_path||e.TargetFile||e.filePath||e.path||null,n=e.CommandLine||e.command||null,r=e.Query||e.query||e.search_term||null,i=e.Url||e.url||null;return(0,F.jsxs)(`div`,{className:`mt-1.5 text-[10px] font-mono overflow-x-auto`,style:{background:`var(--c-code-bg)`,border:`1px solid var(--c-border)`},children:[t&&(0,F.jsxs)(`div`,{className:`px-2 py-0.5`,style:{color:`var(--c-text)`},children:[`file: `,t]}),n&&(0,F.jsxs)(`div`,{className:`px-2 py-0.5`,style:{color:`var(--c-text)`},children:[`cmd: `,n]}),r&&(0,F.jsxs)(`div`,{className:`px-2 py-0.5`,style:{color:`var(--c-text)`},children:[`query: `,r]}),i&&(0,F.jsxs)(`div`,{className:`px-2 py-0.5`,style:{color:`var(--c-text)`},children:[`url: `,i]}),!t&&!n&&!r&&!i&&(0,F.jsx)(`pre`,{className:`px-2 py-1 whitespace-pre-wrap break-all`,style:{color:`var(--c-text2)`},children:JSON.stringify(e,null,2)})]})}function PT({name:e,args:t,detail:n}){let[r,i]=(0,S.useState)(!1),a=n&&Object.keys(n).length>0;return(0,F.jsxs)(`div`,{className:`my-1 px-2.5 py-1.5 text-[11px]`,style:{background:`var(--c-code-bg)`,border:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 cursor-pointer`,onClick:()=>a&&i(!r),children:[a?r?(0,F.jsx)(Cr,{size:10,style:{color:`#a78bfa`}}):(0,F.jsx)(wr,{size:10,style:{color:`#a78bfa`}}):(0,F.jsx)(ai,{size:10,style:{color:`#a78bfa`}}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-white)`},children:e}),t!==e&&!a&&(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text2)`},children:t}),a&&(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text2)`},children:jT(e,n)})]}),r&&a&&(0,F.jsx)(NT,{args:n})]})}function FT({name:e,preview:t}){let[n,r]=(0,S.useState)(!1),i=t.length>120||t.startsWith(`{`)||t.includes(`contentId`),a=i?`${e} completed`:t.substring(0,120);return(0,F.jsxs)(`div`,{className:`my-1 px-2.5 py-1.5 text-[11px]`,style:{background:`var(--c-code-bg)`,border:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 cursor-pointer`,onClick:()=>t&&r(!n),children:[(0,F.jsx)(Er,{size:10,style:{color:`#34d399`}}),(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text)`},children:a}),i&&t&&(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:n?`[-]`:`[+]`})]}),n&&(0,F.jsx)(`pre`,{className:`mt-1 text-[10px] overflow-x-auto whitespace-pre-wrap break-all`,style:{color:`var(--c-text2)`},children:t})]})}function IT({content:e,toolCallDetails:t}){let n=AT(e),r=0;return n.map((e,n)=>{if(e.type===`tool-call`){let i=t?t.find(n=>n.name===e.name&&t.indexOf(n)>=r):null;return i&&(r=t.indexOf(i)+1),(0,F.jsx)(PT,{name:e.name,args:e.args,detail:i?.args},n)}return e.type===`tool-result`?(0,F.jsx)(FT,{name:e.name,preview:e.preview},n):(0,F.jsx)(`div`,{className:`md-body`,children:(0,F.jsx)(wS,{remarkPlugins:[OT],children:e.value})},n)})}var LT=56,RT=52,zT=20,BT=6,VT=5,HT=8,UT=80;function WT(e){if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;return r>0?`${n}h ${r}m`:`${n}h`}function GT(e,t,n){return e+(t-e)*Math.max(0,Math.min(1,n))}function KT(e){return`rgb(${Math.round(GT(52,239,e))},${Math.round(GT(211,68,e))},${Math.round(GT(153,68,e))})`}function qT(e,t,n){let r=new Date(t).getTime(),i=new Date(n).getTime(),a=Math.max(i-r,1),o=VT*60*1e3,s=Math.max(1,Math.ceil(a/o)),c=Array.from({length:s},(e,t)=>({label:`${t*VT}m`,tokens:0,messageIndices:[]}));return e.forEach((t,n)=>{let i=(t.inputTokens||0)+(t.outputTokens||0),l=r+n/Math.max(e.length-1,1)*a,u=Math.min(Math.floor((l-r)/o),s-1);c[u].tokens+=i,c[u].messageIndices.push(n)}),c}function JT(e){let t=Math.max(1,Math.ceil(e.length/HT)),n=Array.from({length:t},()=>({label:``,tokens:0,messageIndices:[]}));return e.forEach((e,r)=>{let i=typeof e.content==`string`?e.content.length:0,a=Math.round(i/4),o=Math.min(Math.floor(r/HT),t-1);n[o].tokens+=a,n[o].messageIndices.push(r)}),n}function YT({messages:e,createdAt:t,lastUpdatedAt:n,onScrollToMessage:r}){let[i,a]=(0,S.useState)(!0),[o,s]=(0,S.useState)(null),c=(0,S.useRef)(null),l=(0,S.useMemo)(()=>e?e.some(e=>(e.inputTokens||0)+(e.outputTokens||0)>0):!1,[e]),u=(0,S.useMemo)(()=>!e||e.length===0?[]:l?qT(e,t,n):JT(e),[e,t,n,l]),d=(0,S.useMemo)(()=>Math.max(...u.map(e=>e.tokens),1),[u]),f=(0,S.useMemo)(()=>u.reduce((e,t)=>e+t.tokens,0),[u]),p=(0,S.useMemo)(()=>{if(l&&t&&n){let e=new Date(n).getTime()-new Date(t).getTime();if(e>0)return WT(e)}return f>0?`~`+WT(f/UT*1e3):null},[l,t,n,f]),m=(0,S.useCallback)(e=>{e.messageIndices.length>0&&r&&r(e.messageIndices[0])},[r]);if(!e||e.length===0||f===0)return null;let h=zT*2+Math.max((u.length-1)*RT,0),g=LT+BT*2+(l?16:4),_=u.map((e,t)=>{let n=zT+t*RT,r=e.tokens/d;return{x:n,y:BT+LT-r*LT,ratio:r,bucket:e}}),v=_.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `),y=_.length>0?`${v} L ${_[_.length-1].x} ${BT+LT} L ${_[0].x} ${BT+LT} Z`:``;return(0,F.jsxs)(`div`,{className:`shrink-0`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`button`,{onClick:()=>a(e=>!e),className:`flex items-center gap-2 w-full px-4 py-1.5 text-[11px] transition hover:bg-[var(--c-bg3)]`,style:{color:`var(--c-text2)`},children:[(0,F.jsx)(lr,{size:12,style:{color:`var(--c-accent)`}}),(0,F.jsx)(`span`,{className:`font-medium`,children:`Token Timeline`}),(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,J(f),` tokens`,l?``:`, est.`,`)`]}),p&&(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ar,{size:10}),` `,p]}),(0,F.jsx)(`span`,{className:`ml-auto`,children:i?(0,F.jsx)(Tr,{size:12}):(0,F.jsx)(Cr,{size:12})})]}),i&&(0,F.jsx)(`div`,{className:`px-2 pb-2 pt-0`,children:(0,F.jsx)(`div`,{ref:c,className:`overflow-x-auto scrollbar-thin`,style:{scrollBehavior:`smooth`},children:(0,F.jsxs)(`svg`,{width:h,height:g,style:{display:`block`,minWidth:h},children:[(0,F.jsx)(`defs`,{children:(0,F.jsxs)(`linearGradient`,{id:`tokenAreaGrad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,F.jsx)(`stop`,{offset:`0%`,stopColor:`var(--c-accent)`,stopOpacity:`0.15`}),(0,F.jsx)(`stop`,{offset:`100%`,stopColor:`var(--c-accent)`,stopOpacity:`0.02`})]})}),(0,F.jsx)(`line`,{x1:zT,y1:BT+LT,x2:zT+(u.length-1)*RT,y2:BT+LT,stroke:`var(--c-border)`,strokeWidth:`1`}),y&&(0,F.jsx)(`path`,{d:y,fill:`url(#tokenAreaGrad)`}),_.length>1&&(0,F.jsx)(`path`,{d:v,fill:`none`,stroke:`var(--c-accent)`,strokeWidth:`1.5`,strokeLinejoin:`round`}),_.map((e,t)=>{let n=o===t,r=KT(e.ratio);return(0,F.jsxs)(`g`,{style:{cursor:e.bucket.tokens>0?`pointer`:`default`},onMouseEnter:()=>s(t),onMouseLeave:()=>s(null),onClick:()=>m(e.bucket),children:[(0,F.jsx)(`circle`,{cx:e.x,cy:e.y,r:12,fill:`transparent`}),(0,F.jsx)(`circle`,{cx:e.x,cy:e.y,r:n?5:3,fill:e.bucket.tokens>0?r:`var(--c-border)`,stroke:n?`var(--c-white)`:`none`,strokeWidth:1.5,style:{transition:`r 0.15s`}}),n&&(0,F.jsx)(`line`,{x1:e.x,y1:e.y,x2:e.x,y2:BT+LT,stroke:`var(--c-text3)`,strokeWidth:`0.5`,strokeDasharray:`2,2`}),n&&e.bucket.tokens>0&&(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`rect`,{x:e.x-32,y:e.y-22,width:64,height:16,rx:3,fill:`var(--c-bg)`,stroke:`var(--c-border)`,strokeWidth:`0.5`}),(0,F.jsxs)(`text`,{x:e.x,y:e.y-11,textAnchor:`middle`,fontSize:`9`,fontFamily:`monospace`,fill:`var(--c-white)`,children:[J(e.bucket.tokens),` tok`]})]}),l&&e.bucket.label&&(0,F.jsx)(`text`,{x:e.x,y:BT+LT+12,textAnchor:`middle`,fontSize:`9`,fontFamily:`monospace`,fill:`var(--c-text3)`,children:e.bucket.label})]},t)})]})})})]})}function XT({chatId:e,onClose:t,fetchFn:n,extraHeader:r,username:i}){let[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(!0),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)(``),p=(0,S.useRef)(null),m=(0,S.useRef)(0);(0,S.useEffect)(()=>{if(!e)return;c(!0),o(null),u(null),m.current=0;let t=n||Vi;t(e).then(e=>{o(e),m.current=e?.messages?.length||0,c(!1)}).catch(e=>{u(e?.message||`Failed to load session`),c(!1)});let r=setInterval(()=>{t(e).then(e=>{e?.messages?.length!==m.current&&(m.current=e?.messages?.length||0,o(e))}).catch(()=>{})},1e4);return()=>clearInterval(r)},[e,n]),(0,S.useEffect)(()=>{!s&&a&&p.current&&(p.current.scrollTop=p.current.scrollHeight)},[s,a]),(0,S.useEffect)(()=>{f(``)},[e]);let h=(0,S.useCallback)(e=>{if(!p.current)return;let t=p.current.querySelector(`[data-msg-index="${e}"]`);t&&(t.scrollIntoView({behavior:`smooth`,block:`center`}),t.style.outline=`1.5px solid var(--c-accent)`,t.style.outlineOffset=`2px`,setTimeout(()=>{t.style.outline=`none`},1500))},[]);return e?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`fixed inset-0 z-40 transition-opacity`,style:{background:`rgba(0,0,0,0.3)`},onClick:t}),(0,F.jsxs)(`div`,{className:`fixed top-0 right-0 bottom-0 z-50 flex flex-col shadow-2xl sidebar-slide-in`,style:{width:`min(580px, 90vw)`,background:`var(--c-bg)`,borderLeft:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 shrink-0`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(`button`,{onClick:t,className:`p-1 rounded transition hover:bg-[var(--c-bg3)]`,style:{color:`var(--c-text2)`},children:(0,F.jsx)(ki,{size:14})}),a&&(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-sm font-medium truncate`,style:{color:`var(--c-white)`},children:a.name||`(untitled)`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,style:{color:`var(--c-text2)`},children:[(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:Oh(a.source)}}),q(a.source)]}),a.mode&&(0,F.jsxs)(`span`,{children:[`· `,a.mode]}),(0,F.jsx)(`span`,{children:Mh(a.createdAt)})]})]}),a&&!n&&(0,F.jsxs)(`a`,{href:`/api/chats/${encodeURIComponent(a.id)}/markdown`,download:!0,className:`flex items-center gap-1 px-2 py-1 text-[11px] transition shrink-0`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(Lr,{size:11}),` .md`]}),r]}),a?.stats&&(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2 text-[11px] shrink-0`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text2)`},children:[(0,F.jsxs)(`span`,{children:[a.stats.totalMessages,` msgs`]}),a.stats.toolCalls?.length>0&&(0,F.jsxs)(`span`,{children:[a.stats.toolCalls.length,` tools`]}),a.stats.totalInputTokens>0&&(0,F.jsxs)(`span`,{children:[J(a.stats.totalInputTokens),` in`]}),a.stats.totalOutputTokens>0&&(0,F.jsxs)(`span`,{children:[J(a.stats.totalOutputTokens),` out`]}),a.createdAt&&a.lastUpdatedAt&&(()=>{let e=new Date(a.lastUpdatedAt).getTime()-new Date(a.createdAt).getTime();if(e<=0)return null;let t=Math.floor(e/6e4);return(0,F.jsx)(`span`,{children:t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`})})(),a.stats.models?.length>0&&(0,F.jsx)(`span`,{className:`ml-auto font-mono truncate`,style:{color:`var(--c-accent)`,opacity:.7},children:[...new Set(a.stats.models)].join(`, `)})]}),a&&a.messages.length>0&&(0,F.jsx)(YT,{messages:a.messages,createdAt:a.createdAt,lastUpdatedAt:a.lastUpdatedAt,onScrollToMessage:h}),a&&a.messages.length>0&&(0,F.jsx)(`div`,{className:`shrink-0 px-4 py-2`,style:{borderBottom:`1px solid var(--c-border)`},children:(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(ui,{size:11,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,placeholder:`Filter messages...`,value:d,onChange:e=>f(e.target.value),className:`w-full pl-7 pr-3 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`}})]})}),(0,F.jsxs)(`div`,{ref:p,className:`flex-1 overflow-y-auto scrollbar-thin px-4 py-3 space-y-2`,children:[s&&(0,F.jsx)(`div`,{className:`text-[12px] py-12 text-center`,style:{color:`var(--c-text3)`},children:`Loading conversation...`}),!s&&!a&&(0,F.jsx)(`div`,{className:`text-[12px] py-12 text-center`,style:{color:`var(--c-text3)`},children:l?`Failed to load conversation: ${l}`:`Conversation not found.`}),!s&&a&&a.messages.length===0&&(0,F.jsx)(`div`,{className:`text-[12px] py-12 text-center`,style:{color:`var(--c-text3)`},children:a.encrypted?`🔒 This conversation is encrypted.`:`No messages found.`}),!s&&a&&a.messages.filter(e=>!d||e.content.toLowerCase().includes(d.toLowerCase())).map((e,t)=>{let n=kT[e.role]||kT.system,r=n.icon;return(0,F.jsxs)(`div`,{"data-msg-index":t,className:`rounded-r px-3 py-2`,style:{borderLeft:`2px solid ${n.borderColor}`,background:n.bg,transition:`outline 0.3s`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] mb-1`,style:{color:`var(--c-text2)`},children:[(0,F.jsx)(r,{size:11}),(0,F.jsx)(`span`,{className:`font-medium`,children:e.role===`user`&&(i||a?.username)?i||a.username:n.label}),e.model&&(0,F.jsxs)(`span`,{className:`font-mono`,style:{color:`var(--c-accent)`,opacity:.6},children:[`· `,e.model]})]}),(0,F.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--c-text)`},children:(0,F.jsx)(IT,{content:e.content,toolCallDetails:a.toolCallDetails||[]})})]},t)})]}),(0,F.jsx)(`div`,{className:`shrink-0 px-4 py-3`,style:{borderTop:`1px solid var(--c-border)`},children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2.5 rounded-lg`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,opacity:.5,cursor:`not-allowed`},children:[(0,F.jsx)(`span`,{className:`flex-1 text-[12px]`,style:{color:`var(--c-text3)`},children:`Message is read-only...`}),(0,F.jsx)(di,{size:13,style:{color:`var(--c-text3)`}})]})})]})]}):null}var ZT=[{key:`showEditors`,label:`Editors`,icon:yr},{key:`showCosts`,label:`Est. Costs`,icon:Ir},{key:`showHours`,label:`Peak Hours`,icon:Ar},{key:`showModels`,label:`Top Models`,icon:Nr},{key:`showTokens`,label:`Token Footer`,icon:gr}];function QT({open:e,onClose:t}){let[n,r]=(0,S.useState)({showEditors:!0,showCosts:!0,showHours:!0,showModels:!0,showTokens:!0,username:``,theme:`dark`}),[i,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)([]),f=(0,S.useRef)(null),p=(0,S.useRef)(null),m=(0,S.useCallback)(async e=>{s(!0);try{let t=await ea(e);t&&!t.startsWith(`{`)&&a(t)}catch(e){console.error(`Preview failed:`,e)}s(!1)},[]);(0,S.useEffect)(()=>{e&&(m(n),Hi().then(e=>d(e||[])).catch(()=>{}))},[e]);let h=(e,t)=>{let i={...n,[e]:t};r(i),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>m(i),300)},g=async()=>{if(i){l(!0);try{let e=new Blob([i],{type:`image/svg+xml;charset=utf-8`}),t=URL.createObjectURL(e),n=new Image;n.width=1200*2,n.height=675*2,await new Promise((e,r)=>{n.onload=e,n.onerror=r,n.src=t});let r=document.createElement(`canvas`);r.width=1200*2,r.height=675*2,r.getContext(`2d`).drawImage(n,0,0,1200*2,675*2),URL.revokeObjectURL(t),r.toBlob(e=>{if(!e)return;let t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`agentlytics.png`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),1e3)},`image/png`)}catch(e){console.error(`PNG conversion failed:`,e);let t=new Blob([i],{type:`image/svg+xml`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`agentlytics.svg`,n.click(),URL.revokeObjectURL(n.href)}l(!1)}};return e?(0,F.jsx)(`div`,{ref:p,className:`fixed inset-0 z-50 flex items-center justify-center p-4`,style:{background:`rgba(0,0,0,0.85)`,backdropFilter:`blur(8px)`},onClick:e=>e.target===p.current&&t(),children:(0,F.jsxs)(`div`,{className:`w-full relative flex flex-col`,style:{maxWidth:960,maxHeight:`90vh`,background:`var(--c-bg)`,border:`1px solid var(--c-border)`,borderRadius:12},children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(mi,{size:14,style:{color:`var(--c-accent)`}}),(0,F.jsx)(`span`,{className:`text-[13px] font-semibold`,style:{color:`var(--c-white)`},children:`Share Stats`})]}),(0,F.jsx)(`button`,{onClick:t,className:`p-1 rounded hover:opacity-70 transition`,style:{color:`var(--c-text2)`},children:(0,F.jsx)(ki,{size:16})})]}),(0,F.jsx)(`div`,{className:`flex-1 overflow-auto p-5`,style:{minHeight:0},children:(0,F.jsxs)(`div`,{className:`flex gap-5`,style:{flexDirection:`row`},children:[(0,F.jsxs)(`div`,{className:`flex-shrink-0`,style:{width:200},children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium mb-3`,style:{color:`var(--c-text2)`,textTransform:`uppercase`,letterSpacing:`0.05em`},children:`Customize`}),(0,F.jsxs)(`div`,{className:`mb-4`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium mb-2`,style:{color:`var(--c-text2)`,textTransform:`uppercase`,letterSpacing:`0.05em`},children:`Project`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md`,style:{border:`1px solid var(--c-border)`,background:`var(--c-bg)`},children:[(0,F.jsx)(Ur,{size:11,style:{color:`var(--c-text3)`}}),(0,F.jsxs)(`select`,{value:n.folder||``,onChange:e=>h(`folder`,e.target.value||void 0),className:`bg-transparent outline-none text-[12px] w-full cursor-pointer`,style:{color:`var(--c-text)`,appearance:`none`},children:[(0,F.jsx)(`option`,{value:``,children:`All Projects`}),u.map(e=>(0,F.jsxs)(`option`,{value:e.folder,children:[e.name,` (`,e.totalSessions,`)`]},e.folder))]})]})]}),(0,F.jsx)(`div`,{className:`space-y-1.5`,children:ZT.map(({key:e,label:t,icon:r})=>{let i=n[e];return(0,F.jsxs)(`button`,{onClick:()=>h(e,!i),className:`flex items-center gap-2 w-full px-2.5 py-2 rounded-md text-[12px] transition`,style:{background:i?`var(--c-accent-bg, rgba(99,102,241,0.1))`:`transparent`,border:`1px solid ${i?`var(--c-accent, #6366f1)`:`var(--c-border)`}`,color:i?`var(--c-accent, #818cf8)`:`var(--c-text2)`,opacity:i?1:.6},children:[(0,F.jsx)(r,{size:12}),t]},e)})}),(0,F.jsxs)(`div`,{className:`mt-4`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium mb-2`,style:{color:`var(--c-text2)`,textTransform:`uppercase`,letterSpacing:`0.05em`},children:`Theme`}),(0,F.jsx)(`div`,{className:`flex gap-1.5`,children:[{key:`dark`,icon:ri,label:`Dark`},{key:`light`,icon:yi,label:`Light`}].map(({key:e,icon:t,label:r})=>{let i=n.theme===e;return(0,F.jsxs)(`button`,{onClick:()=>h(`theme`,e),className:`flex items-center gap-1.5 flex-1 justify-center px-2 py-1.5 rounded-md text-[11px] transition`,style:{background:i?`var(--c-accent-bg, rgba(99,102,241,0.1))`:`transparent`,border:`1px solid ${i?`var(--c-accent, #6366f1)`:`var(--c-border)`}`,color:i?`var(--c-accent, #818cf8)`:`var(--c-text2)`,opacity:i?1:.6},children:[(0,F.jsx)(t,{size:11}),r]},e)})})]}),(0,F.jsxs)(`div`,{className:`mt-4`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium mb-2`,style:{color:`var(--c-text2)`,textTransform:`uppercase`,letterSpacing:`0.05em`},children:`Username`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md`,style:{border:`1px solid var(--c-border)`,background:`var(--c-bg)`},children:[(0,F.jsx)(Ei,{size:11,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,placeholder:`optional`,value:n.username,onChange:e=>h(`username`,e.target.value),className:`bg-transparent outline-none text-[12px] w-full`,style:{color:`var(--c-text)`}})]})]})]}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium mb-3`,style:{color:`var(--c-text2)`,textTransform:`uppercase`,letterSpacing:`0.05em`},children:`Preview`}),(0,F.jsxs)(`div`,{className:`rounded-lg overflow-hidden relative`,style:{border:`1px solid var(--c-border)`,background:`#09090f`,minHeight:200},children:[o&&(0,F.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,style:{background:`rgba(0,0,0,0.5)`,zIndex:2},children:(0,F.jsx)(`span`,{className:`text-[12px]`,style:{color:`var(--c-text2)`},children:`Generating...`})}),i&&(0,F.jsx)(`div`,{className:`w-full [&>svg]:w-full [&>svg]:h-auto [&>svg]:block`,dangerouslySetInnerHTML:{__html:i}})]})]})]})}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:`Tip: Toggle sections to customize your share card`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`button`,{onClick:()=>{if(!i)return;let e=new Blob([i],{type:`image/svg+xml`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`agentlytics.svg`,t.click(),URL.revokeObjectURL(t.href)},className:`flex items-center gap-1.5 px-3 py-1.5 text-[12px] rounded-md transition hover:opacity-80`,style:{border:`1px solid var(--c-border)`,color:`var(--c-text)`},children:[(0,F.jsx)(Lr,{size:12}),`SVG`]}),(0,F.jsxs)(`button`,{onClick:g,disabled:c,className:`flex items-center gap-1.5 px-3 py-1.5 text-[12px] rounded-md transition hover:opacity-80`,style:{border:`1px solid var(--c-border)`,color:`var(--c-text)`,opacity:c?.5:1},children:[(0,F.jsx)(Lr,{size:12}),c?`Converting...`:`PNG`]}),(0,F.jsxs)(`button`,{onClick:async()=>{await g(),window.open(`https://x.com/intent/post?text=Here's%20my%20agentic%20coding%20stats%20using%20agentlytics.io%0A%0Arun%20%60npx%20agentlytics%60%20to%20get%20yours%20%E2%9C%A8%0A%0Agithub.com%2Ff%2Fagentlytics`,`_blank`)},className:`flex items-center gap-1.5 px-3 py-1.5 text-[12px] rounded-md transition hover:opacity-80`,style:{background:`#6366f1`,color:`#fff`},children:[(0,F.jsx)(mi,{size:12}),`Share on X`]})]})]})]})}):null}function $({children:e}){return(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider mb-2`,style:{color:`var(--c-text2)`},children:e})}function $T({icon:e,title:t,children:n}){return(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[13px] font-bold`,style:{color:`var(--c-white)`},children:[e&&(0,F.jsx)(e,{size:14,style:{color:`#6366f1`}}),t]}),n]})}Lf.register(qf,wm,im,km,Nm,vp,cp,op,Yp);var eE=`JetBrains Mono, monospace`,tE=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],nE={agent:`#a855f7`,chat:`#3b82f6`,cascade:`#06b6d4`,edit:`#10b981`,copilot:`#f59e0b`,thread:`#ec4899`,opencode:`#f43f5e`,claude:`#f97316`};function rE({overview:e}){let t=dt(),[n,r]=(0,S.useState)(null),[i,a]=(0,S.useState)(null),[o,s]=(0,S.useState)(null),[c,l]=(0,S.useState)(null),[u,d]=(0,S.useState)(null),{dark:f}=tr(),[p,m]=(0,S.useState)(null),[h,g]=(0,S.useState)(!1),[_,v]=(0,S.useState)(null),[y,b]=(0,S.useState)(null),x=f?`#555`:`#999`,C=f?`rgba(255,255,255,0.04)`:`rgba(0,0,0,0.06)`,w=f?`#888`:`#555`,T={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:`right`,labels:{color:w,font:{size:10,family:eE},padding:12,usePointStyle:!0,pointStyle:`circle`}},tooltip:{bodyFont:{family:eE,size:11},titleFont:{family:eE,size:11}}}},E={x:{grid:{display:!1},ticks:{color:x,font:{size:8,family:eE}}},y:{grid:{color:C},ticks:{color:x,font:{size:8,family:eE}},beginAtZero:!0}},D={legend:{display:!1},tooltip:{bodyFont:{family:eE,size:10},titleFont:{family:eE,size:10}}};if((0,S.useEffect)(()=>{let e=jh(u),t={limit:500,named:!1,...e};if(c&&(t.editor=c),Bi(t).then(e=>{v((e.chats||[]).filter(e=>e.bubbleCount>=100).sort((e,t)=>t.bubbleCount-e.bubbleCount))}),!c){e.dateFrom||e.dateTo?zi(e).then(a):a(null),Ui(e).then(r),Ki(e).then(s),Ji(e).then(m);return}Promise.all([zi({editor:c,...e}),Ui({editor:c,...e}),Ki({editor:c,...e}),Ji({editor:c,...e})]).then(([e,t,n,i])=>{a(e),r(t),s(n),m(i)})},[c,u]),!e)return(0,F.jsx)(wa,{label:`Loading dashboard...`});let O=i||e,k=e.editors.sort((e,t)=>t.count-e.count),A=O.oldestChat&&O.newestChat?Math.max(1,Math.round((O.newestChat-O.oldestChat)/864e5)):0,j=O.byMonth.length>0?O.byMonth[O.byMonth.length-1]:null,ee=Object.entries(O.byMode).sort((e,t)=>t[1]-e[1]),te=c?k.find(e=>e.id===c):null,ne={labels:k.map(e=>q(e.id)),datasets:[{data:k.map(e=>e.count),backgroundColor:k.map(e=>Oh(e.id)),borderWidth:0,spacing:2}]},re={labels:ee.map(e=>e[0]),datasets:[{data:ee.map(e=>e[1]),backgroundColor:ee.map(e=>nE[e[0]]||`#6b7280`),borderWidth:0}]},M=O.topProjects.length>0?O.topProjects[0].count:1,N=o?.monthlyTrend,ie=N&&N.months.length>0?{labels:N.months.map(e=>e.substring(2)),datasets:N.sources.map(e=>({label:q(e),data:N.months.map(t=>N.data[t]?.[e]||0),backgroundColor:Oh(e)+`CC`,borderRadius:2}))}:null,ae=o?{labels:o.hourly.map((e,t)=>`${String(t).padStart(2,`0`)}`),datasets:[{data:o.hourly,backgroundColor:o.hourly.map((e,t)=>{let n=Math.max(...o.hourly),r=n>0?e/n:0;return r>.75?`#6366f1`:r>.5?`#818cf8`:r>.25?`#a5b4fc`:`#c7d2fe50`}),borderRadius:2}]}:null,oe=o?{labels:tE,datasets:[{data:o.weekdays,backgroundColor:o.weekdays.map((e,t)=>t===0||t===6?`#f59e0b80`:`#6366f1`),borderRadius:3}]}:null,se=o?{labels:Object.keys(o.depthBuckets),datasets:[{data:Object.values(o.depthBuckets),backgroundColor:[`#ef444460`,`#f97316`,`#f59e0b`,`#10b981`,`#06b6d4`,`#6366f1`,`#a855f7`],borderRadius:3}]}:null,ce=o?.velocity?.length>1?{labels:o.velocity.map(e=>e.month.substring(2)),datasets:[{label:`Avg msgs/session`,data:o.velocity.map(e=>e.avgMsgs),borderColor:`#6366f1`,backgroundColor:`#6366f120`,borderWidth:2,tension:.3,pointRadius:2,pointHoverRadius:4,fill:!0}]}:null,P=o?.tokens,le=P?P.input+P.cacheRead+(P.cacheWrite||0):0,ue=le>0?(P.cacheRead/le*100).toFixed(1):0,de=le>0?(P.output/le).toFixed(3):0,fe=P&&P.sessions>0&&se?(Object.values(o.depthBuckets).reduce((e,t,n)=>(Object.keys(o.depthBuckets),e+t*[1,3.5,8,15.5,35.5,75.5,150][n]),0)/P.sessions).toFixed(1):`—`;return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:Xr,title:`Dashboard`,children:(0,F.jsxs)(`div`,{className:`ml-auto flex items-center gap-3`,children:[(0,F.jsx)(Hh,{value:u,onChange:d}),(0,F.jsxs)(`button`,{onClick:()=>g(!0),className:`flex items-center gap-1.5 px-3 py-1 text-[12px] rounded-md transition hover:opacity-80`,style:{background:`#6366f1`,color:`#fff`},children:[(0,F.jsx)(mi,{size:12}),`Share Stats`]})]})}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)(`div`,{className:`flex items-center flex-wrap gap-1.5`,children:k.map(e=>{let t=c===e.id;return(0,F.jsxs)(`button`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 text-[12px] cursor-pointer transition rounded-sm`,style:{border:t?`1.5px solid ${Oh(e.id)}`:`1px solid var(--c-border)`,background:t?Oh(e.id)+`15`:`transparent`,opacity:c&&!t?.4:1,color:`var(--c-text)`},onClick:()=>l(t?null:e.id),children:[(0,F.jsx)(Gh,{source:e.id,size:14}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:q(e.id)}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-white)`},children:e.count})]},e.id)})}),c&&te&&(0,F.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,F.jsxs)(`button`,{onClick:()=>t(`/sessions?editor=${c}`),className:`flex items-center gap-1 text-[12px] px-2.5 py-1 transition`,style:{color:`var(--c-accent)`,border:`1px solid var(--c-border)`},children:[`Show Sessions `,(0,F.jsx)(fr,{size:11})]}),(0,F.jsxs)(`button`,{onClick:()=>l(null),className:`flex items-center gap-1 text-[12px] px-2.5 py-1 transition`,style:{color:`var(--c-text2)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(ki,{size:9}),` Clear`]})]})]}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`sessions`,value:J(O.totalChats),sub:te?q(te.id):`${k.length} editors`,onClick:()=>t(c?`/sessions?editor=${c}`:`/sessions`)}),(0,F.jsx)(K,{label:`projects`,value:O.topProjects.length,sub:`${A}d span`,onClick:()=>t(`/projects`)}),(0,F.jsx)(K,{label:`this month`,value:j?j.count:0,sub:j?j.month:``,onClick:()=>t(`/sessions`)}),o&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(K,{label:`avg depth`,value:fe,sub:(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,F.jsx)(ni,{size:8}),` msgs/session`]})}),(0,F.jsx)(K,{label:`tool calls`,value:J(o.totalToolCalls),sub:(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,F.jsx)(Oi,{size:8}),` total`]})})]}),P&&P.input>0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(K,{label:`tokens in`,value:J(P.input),sub:`prompt`}),(0,F.jsx)(K,{label:`tokens out`,value:J(P.output),sub:`${de}× ratio`}),(0,F.jsx)(K,{label:`cache hit`,value:`${ue}%`,sub:J(P.cacheRead)}),(0,F.jsx)(K,{label:`you wrote`,value:J(P.userChars),sub:`AI: ${J(P.assistantChars)}`})]})]}),P&&P.input>0&&(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`in tokens`,value:J(P.input),sub:`total prompt`}),(0,F.jsx)(K,{label:`out tokens`,value:J(P.output),sub:`total completion`}),(0,F.jsx)(K,{label:`cache read`,value:J(P.cacheRead),sub:`${ue}% hit rate`}),(0,F.jsx)(K,{label:`cache write`,value:J(P.cacheWrite)}),(0,F.jsx)(K,{label:`out/in ratio`,value:`${de}×`,sub:(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,F.jsx)(Ai,{size:8}),` efficiency`]})}),(0,F.jsx)(K,{label:`you wrote`,value:J(P.userChars),sub:`AI wrote ${J(P.assistantChars)}`}),(0,F.jsx)(K,{label:`est. cost`,value:p&&p.totalCost>0?kh(p.totalCost):`—`,sub:p&&p.byModel.length>0?`${p.byModel.length} model${p.byModel.length===1?``:`s`}`:void 0})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`agentic coding activity`}),(0,F.jsxs)(`div`,{className:`flex gap-4`,children:[(0,F.jsx)(`div`,{className:`min-w-0 flex-shrink-0`,children:n?(0,F.jsx)(Bh,{dailyData:n}):(0,F.jsx)(`div`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:`loading...`})}),o&&n&&(()=>{let e=n.filter(e=>e.total>0),t=e.length>0?e.reduce((e,t)=>e.total>t.total?e:t):null,r=e.reduce((e,t)=>e+t.total,0),i=e.length>0?(r/e.length).toFixed(1):0;return(0,F.jsxs)(`div`,{className:`flex-1 grid grid-cols-3 gap-3 text-[11px] min-w-0`,style:{borderLeft:`1px solid var(--c-border)`,paddingLeft:16},children:[(0,F.jsxs)(`div`,{className:`space-y-2 min-w-0`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},className:`uppercase tracking-wider mb-1`,children:`streaks`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(Vr,{size:10,className:`text-orange-400 flex-shrink-0`}),(0,F.jsxs)(`span`,{style:{color:`var(--c-white)`},className:`font-bold`,children:[o.streaks.current,`d`]}),(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`now`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 mt-0.5`,children:[(0,F.jsx)(Ai,{size:10,className:`text-yellow-400 flex-shrink-0`}),(0,F.jsxs)(`span`,{style:{color:`var(--c-white)`},className:`font-bold`,children:[o.streaks.longest,`d`]}),(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`best`})]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},className:`uppercase tracking-wider mb-1`,children:`active days`}),(0,F.jsx)(`span`,{style:{color:`var(--c-white)`},className:`font-bold`,children:o.streaks.totalDays}),(0,F.jsxs)(`span`,{className:`ml-1`,style:{color:`var(--c-text3)`},children:[i,`/day`]})]})]}),(0,F.jsxs)(`div`,{className:`space-y-2 min-w-0`,children:[t&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},className:`uppercase tracking-wider mb-1`,children:`busiest day`}),(0,F.jsx)(`div`,{style:{color:`var(--c-white)`},className:`font-bold`,children:t.day}),(0,F.jsxs)(`div`,{style:{color:`var(--c-text3)`},children:[t.total,` sessions`]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},className:`uppercase tracking-wider mb-1`,children:`peak hour`}),(0,F.jsxs)(`div`,{style:{color:`var(--c-white)`},className:`font-bold`,children:[String(o.hourly.indexOf(Math.max(...o.hourly))).padStart(2,`0`),`:00`]}),(0,F.jsxs)(`div`,{style:{color:`var(--c-text3)`},children:[Math.max(...o.hourly),` sessions`]})]})]}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},className:`uppercase tracking-wider mb-1`,children:`top modes`}),(0,F.jsx)(`div`,{className:`space-y-1`,children:ee.slice(0,5).map(([e,t])=>(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0`,style:{background:nE[e]||`#6b7280`}}),(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text)`},children:e}),(0,F.jsx)(`span`,{className:`ml-auto font-bold flex-shrink-0`,style:{color:`var(--c-white)`},children:J(t)})]},e))})]})]})})()]})]}),ie&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`monthly trend `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(sessions by editor)`})]}),(0,F.jsx)(`div`,{style:{height:200},children:(0,F.jsx)(wh,{data:ie,options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{stacked:!0,grid:{display:!1},ticks:{color:x,font:{size:8,family:eE},maxRotation:0}},y:{stacked:!0,grid:{color:C},ticks:{color:x,font:{size:8,family:eE}},beginAtZero:!0}},plugins:{legend:{position:`top`,labels:{color:w,font:{size:9,family:eE},usePointStyle:!0,pointStyle:`circle`,padding:8}},tooltip:{mode:`index`,bodyFont:{family:eE,size:10},titleFont:{family:eE,size:10}}}}})})]}),o&&(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`peak hours `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(when you code with AI)`})]}),(0,F.jsx)(`div`,{style:{height:160},children:ae&&(0,F.jsx)(wh,{data:ae,options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{grid:{display:!1},ticks:{color:x,font:{size:7,family:eE},maxRotation:0,callback:(e,t)=>t%3==0?`${String(t).padStart(2,`0`)}`:``}},y:{grid:{color:C},ticks:{color:x,font:{size:8,family:eE}},beginAtZero:!0}},plugins:D}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`weekday pattern `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(weekends highlighted)`})]}),(0,F.jsx)(`div`,{style:{height:160},children:oe&&(0,F.jsx)(wh,{data:oe,options:{responsive:!0,maintainAspectRatio:!1,scales:E,plugins:D}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`session depth `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(messages per session)`})]}),(0,F.jsx)(`div`,{style:{height:160},children:se&&(0,F.jsx)(wh,{data:se,options:{responsive:!0,maintainAspectRatio:!1,scales:E,plugins:D}})})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-2`,children:[ce?(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`conversation velocity `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(avg msgs/session)`})]}),(0,F.jsx)(`div`,{style:{height:180},children:(0,F.jsx)(Ch,{data:ce,options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{grid:{display:!1},ticks:{color:x,font:{size:8,family:eE},maxRotation:0}},y:{grid:{color:C},ticks:{color:x,font:{size:8,family:eE}},beginAtZero:!0}},plugins:D}})})]}):(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`editors`}),(0,F.jsx)(`div`,{style:{height:180},children:(0,F.jsx)(Th,{data:ne,options:{...T,cutout:`65%`}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`modes`}),(0,F.jsx)(`div`,{style:{height:180},children:(0,F.jsx)(Th,{data:re,options:{...T,cutout:`60%`}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`top projects`}),(0,F.jsx)(`div`,{className:`space-y-1 max-h-[180px] overflow-y-auto scrollbar-thin`,children:O.topProjects.slice(0,12).map(e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`div`,{className:`text-[10px] w-6 text-right`,style:{color:`var(--c-text2)`},children:e.count}),(0,F.jsx)(`div`,{className:`flex-1 h-3 rounded-sm overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full bg-accent/30 rounded-sm`,style:{width:`${(e.count/M*100).toFixed(1)}%`}})}),(0,F.jsx)(`div`,{className:`text-[10px] truncate max-w-[140px]`,style:{color:`var(--c-text2)`},title:e.fullPath,children:e.name})]},e.name))})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-2`,children:[o&&o.topModels.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`top models `,p&&p.totalCost>0&&(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,kh(p.totalCost),` est.)`]})]}),(0,F.jsx)(`div`,{className:`space-y-1`,children:o.topModels.map((e,t)=>{let n=o.topModels[0].count,r=p?.byModel?.find(t=>t.model===e.name);return(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-[10px] w-3 text-right`,style:{color:`var(--c-text3)`},children:t+1}),(0,F.jsx)(`span`,{className:`text-[9px] truncate w-28`,style:{color:`var(--c-text2)`},title:e.name,children:e.name}),(0,F.jsx)(`div`,{className:`flex-1 h-4 rounded-sm overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-sm`,style:{width:`${(e.count/n*100).toFixed(1)}%`,background:t===0?`#6366f1`:t===1?`#818cf8`:`#a5b4fc40`}})}),r?(0,F.jsx)(`span`,{className:`text-[9px] w-12 text-right`,style:{color:`#10b981`},children:kh(r.cost)}):null,(0,F.jsx)(`span`,{className:`text-[10px] w-8 text-right`,style:{color:`var(--c-text3)`},children:e.count})]},e.name)})})]}),o&&o.topTools.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`top tools `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,J(o.totalToolCalls),` total)`]})]}),(0,F.jsx)(`div`,{className:`space-y-1`,children:o.topTools.map((e,t)=>{let n=o.topTools[0].count;return(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-[10px] w-3 text-right`,style:{color:`var(--c-text3)`},children:t+1}),(0,F.jsx)(`div`,{className:`flex-1 h-4 rounded-sm overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-sm flex items-center px-1.5`,style:{width:`${(e.count/n*100).toFixed(1)}%`,background:t===0?`#10b981`:t===1?`#34d399`:`#6ee7b740`},children:(0,F.jsx)(`span`,{className:`text-[8px] truncate font-mono`,style:{color:t<2?`#fff`:`var(--c-text2)`},children:e.name})})}),(0,F.jsx)(`span`,{className:`text-[10px] w-8 text-right`,style:{color:`var(--c-text3)`},children:J(e.count)})]},e.name)})})]}),_&&_.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(wi,{size:10,className:`text-amber-400`}),`large context`,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,_.length,`)`]})]})}),(0,F.jsx)(`div`,{className:`space-y-1`,children:_.slice(0,10).map(e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1.5 py-1 rounded-sm cursor-pointer transition hover:opacity-80`,style:{background:e.bubbleCount>=500?`rgba(239,68,68,0.06)`:`rgba(245,158,11,0.06)`},onClick:()=>b(e.id),children:[(0,F.jsx)(Gh,{source:e.source,size:10}),(0,F.jsx)(`span`,{className:`text-[10px] truncate flex-1`,style:{color:`var(--c-text)`},children:e.name||`Untitled`}),(0,F.jsx)(`span`,{className:`text-[10px] font-bold flex-shrink-0`,style:{color:e.bubbleCount>=500?`#ef4444`:`#f59e0b`},children:e.bubbleCount})]},e.id))})]})]}),(0,F.jsx)(XT,{chatId:y,onClose:()=>b(null)}),(0,F.jsx)(QT,{open:h,onClose:()=>g(!1)})]})}Lf.register(qf,km,Nm,cp,op,vp,wm,im,Yp);var iE=`JetBrains Mono, monospace`;Lf.register({id:`dragSelect`,beforeEvent(e,t){let n=t.event,r=e._dragSelect||={dragging:!1,startX:0,endX:0},i=e.chartArea;if(i){if(n.type===`mousedown`&&n.x>=i.left&&n.x<=i.right&&n.y>=i.top&&n.y<=i.bottom&&(r.dragging=!0,r.startX=n.x,r.endX=n.x),n.type===`mousemove`&&r.dragging)return r.endX=Math.max(i.left,Math.min(n.x,i.right)),t.changed=!1,e.draw(),!1;if(n.type===`mouseup`&&r.dragging){r.dragging=!1,r.endX=Math.max(i.left,Math.min(n.x,i.right));let t=Math.min(r.startX,r.endX),a=Math.max(r.startX,r.endX);if(a-t>5){let n=e.scales.x,r=n.getValueForPixel(t),i=n.getValueForPixel(a),o=e.data.labels,s=o[Math.max(0,Math.round(r))],c=o[Math.min(o.length-1,Math.round(i))];e.config.options._onRangeSelect&&e.config.options._onRangeSelect(s,c)}e.draw()}}},afterDraw(e){let t=e._dragSelect;if(!t)return;let n=e.chartArea,r=e.ctx,i=e.config.options;if(i._selectionRange&&e.data.labels){let t=e.scales.x,a=e.data.labels,o=a.indexOf(i._selectionRange[0]),s=a.indexOf(i._selectionRange[1]);if(o>=0&&s>=0){let e=t.getPixelForValue(o),i=t.getPixelForValue(s);r.save(),r.fillStyle=`rgba(99,102,241,0.10)`,r.fillRect(Math.min(e,i),n.top,Math.abs(i-e),n.bottom-n.top),r.strokeStyle=`rgba(99,102,241,0.4)`,r.lineWidth=1,r.setLineDash([3,3]),r.strokeRect(Math.min(e,i),n.top,Math.abs(i-e),n.bottom-n.top),r.restore()}}if(t.dragging){let e=Math.min(t.startX,t.endX),i=Math.max(t.startX,t.endX);r.save(),r.fillStyle=`rgba(99,102,241,0.15)`,r.fillRect(e,n.top,i-e,n.bottom-n.top),r.restore()}}}),wm.positioners.belowCursor=function(e,t){return{x:t.x,y:t.y+20}};function aE({overview:e}){let{dark:t}=tr(),n=t?`#555`:`#999`,r=t?`#777`:`#555`,i=t?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`,[a,o]=(0,S.useState)([]),[s,c]=(0,S.useState)(0),[l,u]=(0,S.useState)(``),[d]=zn(),f=dt(),[p,m]=(0,S.useState)(d.get(`editor`)||``),[h,g]=(0,S.useState)(!0),[_,v]=(0,S.useState)(!1),[y,b]=(0,S.useState)(new Set),[x,C]=(0,S.useState)(null),[w,T]=(0,S.useState)(null),[E,D]=(0,S.useState)(null),O=(0,S.useRef)(null),k=(0,S.useCallback)((e,t)=>{e&&t&&C([e,t].sort())},[]);(0,S.useEffect)(()=>{g(!0),Bi({editor:p,limit:1e3,...jh(w)}).then(e=>{o(e.chats),c(e.total),g(!1)})},[p,w]);let A=l?a.filter(e=>(e.name||``).toLowerCase().includes(l.toLowerCase())||(e.folder||``).toLowerCase().includes(l.toLowerCase())||e.id.toLowerCase().includes(l.toLowerCase())):a,j=(0,S.useMemo)(()=>{if(!x)return A;let[e,t]=x,n=new Date(e).getTime(),r=new Date(t).getTime()+6*864e5;return A.filter(e=>{let t=e.lastUpdatedAt||e.createdAt;return t&&t>=n&&t<=r})},[A,x]),ee=e?.editors||[],te=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`],ne=(0,S.useMemo)(()=>{let e={},t={},n={},r=0,i=0,a=new Set;for(let o of j)o.source&&(e[o.source]=(e[o.source]||0)+1),o.topModel&&(t[o.topModel]=(t[o.topModel]||0)+1),o.mode&&(n[o.mode]=(n[o.mode]||0)+1),o.folder&&a.add(o.folder),o.bubbleCount>=500?r++:o.bubbleCount>=200&&i++;return{editorEntries:Object.entries(e).sort((e,t)=>t[1]-e[1]),modelEntries:Object.entries(t).sort((e,t)=>t[1]-e[1]).slice(0,10),modeEntries:Object.entries(n).sort((e,t)=>t[1]-e[1]),bloatCount:r,largeCount:i,projectCount:a.size}},[j]),re=(0,S.useMemo)(()=>{if(A.length===0)return null;let e={};for(let t of A){let n=t.lastUpdatedAt||t.createdAt;if(!n)continue;let r=new Date(n),i=r.getDay(),a=r.getDate()-i+(i===0?-6:1),o=new Date(r);o.setDate(a);let s=`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,`0`)}-${String(o.getDate()).padStart(2,`0`)}`;e[s]||(e[s]={});let c=t.source||`unknown`;e[s][c]=(e[s][c]||0)+1}let t=Object.keys(e).sort();return{labels:t,datasets:[...new Set(A.map(e=>e.source).filter(Boolean))].map(n=>({label:q(n),data:t.map(t=>e[t][n]||0),borderColor:Oh(n),backgroundColor:Oh(n)+`15`,borderWidth:1.5,tension:.3,pointRadius:0,pointHoverRadius:4,fill:!0}))}},[A]),M=(0,S.useMemo)(()=>{if(!_)return null;let e={};for(let t of j){let n=t.folder||`(no project)`;e[n]||(e[n]=[]),e[n].push(t)}return Object.entries(e).map(([e,t])=>({folder:e,name:e===`(no project)`?`(no project)`:e.split(`/`).pop(),items:t})).sort((e,t)=>t.items.length-e.items.length)},[j,_]);function N(e){b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}let ie=({c:e})=>(0,F.jsxs)(`tr`,{className:`cursor-pointer transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>D(e.id),children:[(0,F.jsx)(`td`,{className:`py-2 px-3`,children:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Gh,{source:e.source,size:12}),(0,F.jsx)(`span`,{className:`text-[12px]`,style:{color:`var(--c-text2)`},children:q(e.source)})]})}),(0,F.jsxs)(`td`,{className:`py-2 px-3 font-medium truncate max-w-[280px] text-[12px]`,style:{color:`var(--c-white)`},children:[e.name||(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`Untitled`}),e.encrypted&&(0,F.jsx)(`span`,{className:`ml-1.5 text-[10px] text-yellow-500/60`,children:`locked`})]}),!_&&(0,F.jsx)(`td`,{className:`py-2 px-3 truncate max-w-[160px] text-[12px]`,style:{color:`var(--c-text2)`},title:e.folder,children:e.folder?(0,F.jsx)(`span`,{className:`cursor-pointer hover:underline`,style:{color:`var(--c-accent)`},onClick:t=>{t.stopPropagation(),f(`/projects/detail?folder=${encodeURIComponent(e.folder)}`)},children:e.folder.split(`/`).pop()}):``}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-[12px]`,style:{color:`var(--c-text2)`},children:e.mode||``}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-[12px] font-mono truncate max-w-[150px]`,style:{color:`var(--c-text2)`},title:e.topModel||``,children:e.topModel||``}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-[12px]`,children:e.bubbleCount>=500?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 font-bold`,style:{color:`#ef4444`},children:[(0,F.jsx)(wi,{size:9}),e.bubbleCount]}):e.bubbleCount>=200?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 font-bold`,style:{color:`#f59e0b`},children:[(0,F.jsx)(wi,{size:9}),e.bubbleCount]}):(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:e.bubbleCount||0})}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-[12px] font-mono text-right`,style:{color:e.cost>0?`var(--c-text2)`:`var(--c-text3)`},children:e.cost>0?kh(e.cost):``}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-[12px] whitespace-nowrap`,style:{color:`var(--c-text3)`},children:Ah(e.lastUpdatedAt||e.createdAt)})]},e.id);return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:Qr,title:`Sessions`}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`sessions`,value:J(j.length),sub:j.length===s?``:`of ${J(s)}`}),(0,F.jsx)(K,{label:`projects`,value:ne.projectCount}),(0,F.jsx)(K,{label:`editors`,value:ne.editorEntries.length}),(0,F.jsx)(K,{label:`models`,value:ne.modelEntries.length}),ne.bloatCount+ne.largeCount>0&&(0,F.jsx)(K,{label:`large context`,value:ne.bloatCount+ne.largeCount,sub:ne.bloatCount>0?`${ne.bloatCount} bloated`:``})]}),j.length>0&&(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`editors`}),(0,F.jsx)(`div`,{style:{height:140},children:(0,F.jsx)(Th,{data:{labels:ne.editorEntries.map(e=>q(e[0])),datasets:[{data:ne.editorEntries.map(e=>e[1]),backgroundColor:ne.editorEntries.map(e=>Oh(e[0])),borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:r,font:{size:9,family:iE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:iE,size:10},titleFont:{family:iE,size:10}}}}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`models`}),(0,F.jsx)(`div`,{style:{height:140},children:ne.modelEntries.length>0?(0,F.jsx)(Th,{data:{labels:ne.modelEntries.map(e=>e[0]),datasets:[{data:ne.modelEntries.map(e=>e[1]),backgroundColor:te,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:r,font:{size:9,family:iE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:iE,size:10},titleFont:{family:iE,size:10}}}}}):(0,F.jsx)(`div`,{className:`text-[11px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`no model data`})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`modes`}),(0,F.jsx)(`div`,{style:{height:140},children:ne.modeEntries.length>0?(0,F.jsx)(wh,{data:{labels:ne.modeEntries.map(e=>e[0]||`unknown`),datasets:[{data:ne.modeEntries.map(e=>e[1]),backgroundColor:`#6366f1`,borderRadius:3}]},options:{responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{grid:{color:i},ticks:{color:n,font:{size:8,family:iE}}},y:{grid:{display:!1},ticks:{color:r,font:{size:9,family:iE}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:iE,size:10},titleFont:{family:iE,size:10}}}}}):(0,F.jsx)(`div`,{className:`text-[11px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`no mode data`})})]})]}),re&&re.labels.length>1&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,F.jsxs)($,{children:[`session timeline`,(0,F.jsx)(`span`,{className:`ml-2 font-normal text-[10px]`,style:{color:`var(--c-text3)`},children:`(drag to select range)`})]}),x&&(0,F.jsxs)(`button`,{onClick:()=>C(null),className:`flex items-center gap-1 text-[11px] px-2 py-0.5 transition`,style:{color:`var(--c-accent)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(ki,{size:10}),x[0],` — `,x[1]]})]}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Ch,{ref:O,data:re,options:{responsive:!0,maintainAspectRatio:!1,interaction:{mode:`index`,intersect:!1},events:[`mousemove`,`mouseout`,`click`,`touchstart`,`touchmove`,`mousedown`,`mouseup`],_onRangeSelect:k,_selectionRange:x,scales:{x:{grid:{display:!1},ticks:{color:n,font:{size:9,family:iE},maxTicksLimit:20,maxRotation:0}},y:{beginAtZero:!0,grid:{color:i},ticks:{color:n,stepSize:1,font:{size:9,family:iE}}}},plugins:{legend:{position:`top`,labels:{color:r,font:{size:9,family:iE},usePointStyle:!0,pointStyle:`circle`,padding:10}},tooltip:{position:`belowCursor`,bodyFont:{family:iE,size:10},titleFont:{family:iE,size:10}}}}})})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`select`,{value:p,onChange:e=>m(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Editors`}),ee.map(e=>(0,F.jsxs)(`option`,{value:e.id,children:[q(e.id),` (`,e.count,`)`]},e.id))]}),(0,F.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,F.jsx)(ui,{size:12,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,placeholder:`Search sessions...`,value:l,onChange:e=>u(e.target.value),className:`w-full pl-7 pr-3 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`}})]}),(0,F.jsxs)(`button`,{onClick:()=>v(!_),className:`flex items-center gap-1.5 px-3 py-1 text-[12px] transition`,style:{border:_?`1px solid var(--c-accent)`:`1px solid var(--c-border)`,color:_?`var(--c-accent)`:`var(--c-text2)`,background:_?`rgba(99,102,241,0.1)`:`transparent`},children:[_?(0,F.jsx)(Ur,{size:13}):(0,F.jsx)(Qr,{size:13}),_?`grouped`:`flat`]}),(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:h?`loading...`:`${j.length} of ${s}`}),(0,F.jsx)(`div`,{className:`ml-auto`,children:(0,F.jsx)(Hh,{value:w,onChange:T})})]}),_?(0,F.jsxs)(`div`,{className:`space-y-2`,children:[M.map(e=>{let t=y.has(e.folder),n=[...new Set(e.items.map(e=>e.source).filter(Boolean))];return(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2.5 cursor-pointer transition`,onClick:()=>N(e.folder),children:[t?(0,F.jsx)(wr,{size:13,style:{color:`var(--c-text3)`}}):(0,F.jsx)(Cr,{size:13,style:{color:`var(--c-text3)`}}),(0,F.jsx)(Ur,{size:13,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`span`,{className:`text-xs font-medium`,style:{color:`var(--c-white)`},children:e.name}),(0,F.jsx)(`span`,{className:`text-[11px] truncate max-w-[300px]`,style:{color:`var(--c-text3)`},children:e.folder!==e.name&&e.folder!==`(no project)`?e.folder:``}),(0,F.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[n.slice(0,5).map(e=>(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{background:Oh(e)},title:q(e)},e)),(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:e.items.length})]})]}),!t&&(0,F.jsx)(`table`,{className:`w-full text-sm`,children:(0,F.jsx)(`tbody`,{children:e.items.map(e=>(0,F.jsx)(ie,{c:e},e.id))})})]},e.folder)}),M.length===0&&!h&&(0,F.jsx)(`div`,{className:`text-center py-12 text-sm`,style:{color:`var(--c-text3)`},children:`no sessions found`})]}):(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`editor`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`name`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`project`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`mode`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`model`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`context`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`est. cost`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`updated`})]})}),(0,F.jsx)(`tbody`,{children:j.map(e=>(0,F.jsx)(ie,{c:e},e.id))})]}),j.length===0&&!h&&(0,F.jsx)(`div`,{className:`text-center py-12 text-sm`,style:{color:`var(--c-text3)`},children:`no sessions found`})]}),(0,F.jsx)(XT,{chatId:E,onClose:()=>D(null)})]})}Lf.register(qf,wm,im,km,Nm,vp);var oE=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`],sE=[`#10b981`,`#34d399`,`#6ee7b7`,`#a7f3d0`,`#d1fae5`,`#ecfdf5`,`#b8f0d8`,`#7ce0b8`,`#4ade80`,`#22c55e`],cE=`JetBrains Mono, monospace`,lE={"File Operations":[`read_file`,`write_to_file`,`edit`,`multi_edit`,`Read`,`Write`,`EditFile`,`edit_file`,`create_file`,`read_notebook`,`edit_notebook`],Search:[`grep_search`,`find_by_name`,`code_search`,`search`,`list_dir`,`Grep`,`Find`,`SearchFiles`,`ListDir`],Terminal:[`run_command`,`command_status`,`RunCommand`,`execute_command`,`Bash`,`bash`],Browser:[`browser_preview`,`read_url_content`,`view_content_chunk`],"AI Tools":[`mcp0_`,`mcp1_`,`mcp5_`,`mcp6_`,`skill`,`trajectory_search`]};function uE(e){let t={};for(let n of e){let e=!1;for(let[r,i]of Object.entries(lE))if(i.some(e=>n.name.startsWith(e)||n.name===e||n.name.toLowerCase().includes(e.toLowerCase()))){t[r]||(t[r]={tools:[],total:0}),t[r].tools.push(n),t[r].total+=n.count,e=!0;break}e||(t.Other||={tools:[],total:0},t.Other.tools.push(n),t.Other.total+=n.count)}return Object.entries(t).sort((e,t)=>t[1].total-e[1].total)}function dE(e,t){if(!t||typeof t!=`object`)return null;if(t.CommandLine||t.command)return t.CommandLine||t.command;if(t.file_path)return t.file_path;if(t.TargetFile)return t.TargetFile;if(t.SearchPath||t.search_path)return`${t.Query||t.query||``} in ${t.SearchPath||t.search_path||``}`;if(t.Pattern)return`${t.Pattern} in ${t.SearchDirectory||``}`;if(t.Url||t.url)return t.Url||t.url;if(t.query)return t.query;let n=Object.values(t).filter(e=>typeof e==`string`&&e.length>0);return n.length>0?n[0].substring(0,120):null}function fE(e){if(!e||typeof e!=`object`)return null;let t=e.old_string||e.old_text||e.oldText||e.search||null,n=e.new_string||e.new_text||e.newText||e.replace||null,r=e.file_path||e.TargetFile||e.filePath||e.path||null;return t!=null||n!=null?{old:t,new:n,file:r}:null}function pE({diff:e}){let t=(e.old||``).split(`
|
|
63
|
+
`).length-12,` more lines`]})]})}function NT({args:e}){if(!e||Object.keys(e).length===0)return null;if(e.old_string||e.new_string||e.old_text||e.new_text||e.search||e.replace)return(0,F.jsx)(MT,{args:e});let t=e.file_path||e.TargetFile||e.filePath||e.path||null,n=e.CommandLine||e.command||null,r=e.Query||e.query||e.search_term||null,i=e.Url||e.url||null;return(0,F.jsxs)(`div`,{className:`mt-1.5 text-[10px] font-mono overflow-x-auto`,style:{background:`var(--c-code-bg)`,border:`1px solid var(--c-border)`},children:[t&&(0,F.jsxs)(`div`,{className:`px-2 py-0.5`,style:{color:`var(--c-text)`},children:[`file: `,t]}),n&&(0,F.jsxs)(`div`,{className:`px-2 py-0.5`,style:{color:`var(--c-text)`},children:[`cmd: `,n]}),r&&(0,F.jsxs)(`div`,{className:`px-2 py-0.5`,style:{color:`var(--c-text)`},children:[`query: `,r]}),i&&(0,F.jsxs)(`div`,{className:`px-2 py-0.5`,style:{color:`var(--c-text)`},children:[`url: `,i]}),!t&&!n&&!r&&!i&&(0,F.jsx)(`pre`,{className:`px-2 py-1 whitespace-pre-wrap break-all`,style:{color:`var(--c-text2)`},children:JSON.stringify(e,null,2)})]})}function PT({name:e,args:t,detail:n}){let[r,i]=(0,S.useState)(!1),a=n&&Object.keys(n).length>0;return(0,F.jsxs)(`div`,{className:`my-1 px-2.5 py-1.5 text-[11px]`,style:{background:`var(--c-code-bg)`,border:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 cursor-pointer`,onClick:()=>a&&i(!r),children:[a?r?(0,F.jsx)(Cr,{size:10,style:{color:`#a78bfa`}}):(0,F.jsx)(wr,{size:10,style:{color:`#a78bfa`}}):(0,F.jsx)(ai,{size:10,style:{color:`#a78bfa`}}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-white)`},children:e}),t!==e&&!a&&(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text2)`},children:t}),a&&(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text2)`},children:jT(e,n)})]}),r&&a&&(0,F.jsx)(NT,{args:n})]})}function FT({name:e,preview:t}){let[n,r]=(0,S.useState)(!1),i=t.length>120||t.startsWith(`{`)||t.includes(`contentId`),a=i?`${e} completed`:t.substring(0,120);return(0,F.jsxs)(`div`,{className:`my-1 px-2.5 py-1.5 text-[11px]`,style:{background:`var(--c-code-bg)`,border:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 cursor-pointer`,onClick:()=>t&&r(!n),children:[(0,F.jsx)(Er,{size:10,style:{color:`#34d399`}}),(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text)`},children:a}),i&&t&&(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:n?`[-]`:`[+]`})]}),n&&(0,F.jsx)(`pre`,{className:`mt-1 text-[10px] overflow-x-auto whitespace-pre-wrap break-all`,style:{color:`var(--c-text2)`},children:t})]})}function IT({content:e,toolCallDetails:t}){let n=AT(e),r=0;return n.map((e,n)=>{if(e.type===`tool-call`){let i=t?t.find(n=>n.name===e.name&&t.indexOf(n)>=r):null;return i&&(r=t.indexOf(i)+1),(0,F.jsx)(PT,{name:e.name,args:e.args,detail:i?.args},n)}return e.type===`tool-result`?(0,F.jsx)(FT,{name:e.name,preview:e.preview},n):(0,F.jsx)(`div`,{className:`md-body`,children:(0,F.jsx)(wS,{remarkPlugins:[OT],children:e.value})},n)})}var LT=56,RT=52,zT=20,BT=6,VT=5,HT=8,UT=80;function WT(e){if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;return r>0?`${n}h ${r}m`:`${n}h`}function GT(e,t,n){return e+(t-e)*Math.max(0,Math.min(1,n))}function KT(e){return`rgb(${Math.round(GT(52,239,e))},${Math.round(GT(211,68,e))},${Math.round(GT(153,68,e))})`}function qT(e,t,n){let r=new Date(t).getTime(),i=new Date(n).getTime(),a=Math.max(i-r,1),o=VT*60*1e3,s=Math.max(1,Math.ceil(a/o)),c=Array.from({length:s},(e,t)=>({label:`${t*VT}m`,tokens:0,messageIndices:[]}));return e.forEach((t,n)=>{let i=(t.inputTokens||0)+(t.outputTokens||0),l=r+n/Math.max(e.length-1,1)*a,u=Math.min(Math.floor((l-r)/o),s-1);c[u].tokens+=i,c[u].messageIndices.push(n)}),c}function JT(e){let t=Math.max(1,Math.ceil(e.length/HT)),n=Array.from({length:t},()=>({label:``,tokens:0,messageIndices:[]}));return e.forEach((e,r)=>{let i=typeof e.content==`string`?e.content.length:0,a=Math.round(i/4),o=Math.min(Math.floor(r/HT),t-1);n[o].tokens+=a,n[o].messageIndices.push(r)}),n}function YT({messages:e,createdAt:t,lastUpdatedAt:n,onScrollToMessage:r}){let[i,a]=(0,S.useState)(!0),[o,s]=(0,S.useState)(null),c=(0,S.useRef)(null),l=(0,S.useMemo)(()=>e?e.some(e=>(e.inputTokens||0)+(e.outputTokens||0)>0):!1,[e]),u=(0,S.useMemo)(()=>!e||e.length===0?[]:l?qT(e,t,n):JT(e),[e,t,n,l]),d=(0,S.useMemo)(()=>Math.max(...u.map(e=>e.tokens),1),[u]),f=(0,S.useMemo)(()=>u.reduce((e,t)=>e+t.tokens,0),[u]),p=(0,S.useMemo)(()=>{if(l&&t&&n){let e=new Date(n).getTime()-new Date(t).getTime();if(e>0)return WT(e)}return f>0?`~`+WT(f/UT*1e3):null},[l,t,n,f]),m=(0,S.useCallback)(e=>{e.messageIndices.length>0&&r&&r(e.messageIndices[0])},[r]);if(!e||e.length===0||f===0)return null;let h=zT*2+Math.max((u.length-1)*RT,0),g=LT+BT*2+(l?16:4),_=u.map((e,t)=>{let n=zT+t*RT,r=e.tokens/d;return{x:n,y:BT+LT-r*LT,ratio:r,bucket:e}}),v=_.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `),y=_.length>0?`${v} L ${_[_.length-1].x} ${BT+LT} L ${_[0].x} ${BT+LT} Z`:``;return(0,F.jsxs)(`div`,{className:`shrink-0`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`button`,{onClick:()=>a(e=>!e),className:`flex items-center gap-2 w-full px-4 py-1.5 text-[11px] transition hover:bg-[var(--c-bg3)]`,style:{color:`var(--c-text2)`},children:[(0,F.jsx)(lr,{size:12,style:{color:`var(--c-accent)`}}),(0,F.jsx)(`span`,{className:`font-medium`,children:`Token Timeline`}),(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,J(f),` tokens`,l?``:`, est.`,`)`]}),p&&(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ar,{size:10}),` `,p]}),(0,F.jsx)(`span`,{className:`ml-auto`,children:i?(0,F.jsx)(Tr,{size:12}):(0,F.jsx)(Cr,{size:12})})]}),i&&(0,F.jsx)(`div`,{className:`px-2 pb-2 pt-0`,children:(0,F.jsx)(`div`,{ref:c,className:`overflow-x-auto scrollbar-thin`,style:{scrollBehavior:`smooth`},children:(0,F.jsxs)(`svg`,{width:h,height:g,style:{display:`block`,minWidth:h},children:[(0,F.jsx)(`defs`,{children:(0,F.jsxs)(`linearGradient`,{id:`tokenAreaGrad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,F.jsx)(`stop`,{offset:`0%`,stopColor:`var(--c-accent)`,stopOpacity:`0.15`}),(0,F.jsx)(`stop`,{offset:`100%`,stopColor:`var(--c-accent)`,stopOpacity:`0.02`})]})}),(0,F.jsx)(`line`,{x1:zT,y1:BT+LT,x2:zT+(u.length-1)*RT,y2:BT+LT,stroke:`var(--c-border)`,strokeWidth:`1`}),y&&(0,F.jsx)(`path`,{d:y,fill:`url(#tokenAreaGrad)`}),_.length>1&&(0,F.jsx)(`path`,{d:v,fill:`none`,stroke:`var(--c-accent)`,strokeWidth:`1.5`,strokeLinejoin:`round`}),_.map((e,t)=>{let n=o===t,r=KT(e.ratio);return(0,F.jsxs)(`g`,{style:{cursor:e.bucket.tokens>0?`pointer`:`default`},onMouseEnter:()=>s(t),onMouseLeave:()=>s(null),onClick:()=>m(e.bucket),children:[(0,F.jsx)(`circle`,{cx:e.x,cy:e.y,r:12,fill:`transparent`}),(0,F.jsx)(`circle`,{cx:e.x,cy:e.y,r:n?5:3,fill:e.bucket.tokens>0?r:`var(--c-border)`,stroke:n?`var(--c-white)`:`none`,strokeWidth:1.5,style:{transition:`r 0.15s`}}),n&&(0,F.jsx)(`line`,{x1:e.x,y1:e.y,x2:e.x,y2:BT+LT,stroke:`var(--c-text3)`,strokeWidth:`0.5`,strokeDasharray:`2,2`}),n&&e.bucket.tokens>0&&(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`rect`,{x:e.x-32,y:e.y-22,width:64,height:16,rx:3,fill:`var(--c-bg)`,stroke:`var(--c-border)`,strokeWidth:`0.5`}),(0,F.jsxs)(`text`,{x:e.x,y:e.y-11,textAnchor:`middle`,fontSize:`9`,fontFamily:`monospace`,fill:`var(--c-white)`,children:[J(e.bucket.tokens),` tok`]})]}),l&&e.bucket.label&&(0,F.jsx)(`text`,{x:e.x,y:BT+LT+12,textAnchor:`middle`,fontSize:`9`,fontFamily:`monospace`,fill:`var(--c-text3)`,children:e.bucket.label})]},t)})]})})})]})}function XT({chatId:e,onClose:t,fetchFn:n,extraHeader:r,username:i}){let[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(!0),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)(``),p=(0,S.useRef)(null),m=(0,S.useRef)(0);(0,S.useEffect)(()=>{if(!e)return;c(!0),o(null),u(null),m.current=0;let t=n||Vi;t(e).then(e=>{o(e),m.current=e?.messages?.length||0,c(!1)}).catch(e=>{u(e?.message||`Failed to load session`),c(!1)});let r=setInterval(()=>{t(e).then(e=>{e?.messages?.length!==m.current&&(m.current=e?.messages?.length||0,o(e))}).catch(()=>{})},1e4);return()=>clearInterval(r)},[e,n]),(0,S.useEffect)(()=>{!s&&a&&p.current&&(p.current.scrollTop=p.current.scrollHeight)},[s,a]),(0,S.useEffect)(()=>{f(``)},[e]);let h=(0,S.useCallback)(e=>{if(!p.current)return;let t=p.current.querySelector(`[data-msg-index="${e}"]`);t&&(t.scrollIntoView({behavior:`smooth`,block:`center`}),t.style.outline=`1.5px solid var(--c-accent)`,t.style.outlineOffset=`2px`,setTimeout(()=>{t.style.outline=`none`},1500))},[]);return e?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`fixed inset-0 z-40 transition-opacity`,style:{background:`rgba(0,0,0,0.3)`},onClick:t}),(0,F.jsxs)(`div`,{className:`fixed top-0 right-0 bottom-0 z-50 flex flex-col shadow-2xl sidebar-slide-in`,style:{width:`min(580px, 90vw)`,background:`var(--c-bg)`,borderLeft:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 shrink-0`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(`button`,{onClick:t,className:`p-1 rounded transition hover:bg-[var(--c-bg3)]`,style:{color:`var(--c-text2)`},children:(0,F.jsx)(ki,{size:14})}),a&&(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-sm font-medium truncate`,style:{color:`var(--c-white)`},children:a.name||`(untitled)`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,style:{color:`var(--c-text2)`},children:[(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:Oh(a.source)}}),q(a.source)]}),a.mode&&(0,F.jsxs)(`span`,{children:[`· `,a.mode]}),(0,F.jsx)(`span`,{children:Mh(a.createdAt)})]})]}),a&&!n&&(0,F.jsxs)(`a`,{href:`/api/chats/${encodeURIComponent(a.id)}/markdown`,download:!0,className:`flex items-center gap-1 px-2 py-1 text-[11px] transition shrink-0`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(Lr,{size:11}),` .md`]}),r]}),a?.stats&&(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2 text-[11px] shrink-0`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text2)`},children:[(0,F.jsxs)(`span`,{children:[a.stats.totalMessages,` msgs`]}),a.stats.toolCalls?.length>0&&(0,F.jsxs)(`span`,{children:[a.stats.toolCalls.length,` tools`]}),a.stats.totalInputTokens>0&&(0,F.jsxs)(`span`,{children:[J(a.stats.totalInputTokens),` in`]}),a.stats.totalOutputTokens>0&&(0,F.jsxs)(`span`,{children:[J(a.stats.totalOutputTokens),` out`]}),a.createdAt&&a.lastUpdatedAt&&(()=>{let e=new Date(a.lastUpdatedAt).getTime()-new Date(a.createdAt).getTime();if(e<=0)return null;let t=Math.floor(e/6e4);return(0,F.jsx)(`span`,{children:t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`})})(),a.stats.models?.length>0&&(0,F.jsx)(`span`,{className:`ml-auto font-mono truncate`,style:{color:`var(--c-accent)`,opacity:.7},children:[...new Set(a.stats.models)].join(`, `)})]}),a&&a.messages.length>0&&(0,F.jsx)(YT,{messages:a.messages,createdAt:a.createdAt,lastUpdatedAt:a.lastUpdatedAt,onScrollToMessage:h}),a&&a.messages.length>0&&(0,F.jsx)(`div`,{className:`shrink-0 px-4 py-2`,style:{borderBottom:`1px solid var(--c-border)`},children:(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(ui,{size:11,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,placeholder:`Filter messages...`,value:d,onChange:e=>f(e.target.value),className:`w-full pl-7 pr-3 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`}})]})}),(0,F.jsxs)(`div`,{ref:p,className:`flex-1 overflow-y-auto scrollbar-thin px-4 py-3 space-y-2`,children:[s&&(0,F.jsx)(`div`,{className:`text-[12px] py-12 text-center`,style:{color:`var(--c-text3)`},children:`Loading conversation...`}),!s&&!a&&(0,F.jsx)(`div`,{className:`text-[12px] py-12 text-center`,style:{color:`var(--c-text3)`},children:l?`Failed to load conversation: ${l}`:`Conversation not found.`}),!s&&a&&a.messages.length===0&&(0,F.jsx)(`div`,{className:`text-[12px] py-12 text-center`,style:{color:`var(--c-text3)`},children:a.encrypted?`🔒 This conversation is encrypted.`:`No messages found.`}),!s&&a&&a.messages.filter(e=>!d||e.content.toLowerCase().includes(d.toLowerCase())).map((e,t)=>{let n=kT[e.role]||kT.system,r=n.icon;return(0,F.jsxs)(`div`,{"data-msg-index":t,className:`rounded-r px-3 py-2`,style:{borderLeft:`2px solid ${n.borderColor}`,background:n.bg,transition:`outline 0.3s`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] mb-1`,style:{color:`var(--c-text2)`},children:[(0,F.jsx)(r,{size:11}),(0,F.jsx)(`span`,{className:`font-medium`,children:e.role===`user`&&(i||a?.username)?i||a.username:n.label}),e.model&&(0,F.jsxs)(`span`,{className:`font-mono`,style:{color:`var(--c-accent)`,opacity:.6},children:[`· `,e.model]})]}),(0,F.jsx)(`div`,{className:`text-[12px]`,style:{color:`var(--c-text)`},children:(0,F.jsx)(IT,{content:e.content,toolCallDetails:a.toolCallDetails||[]})})]},t)})]}),(0,F.jsx)(`div`,{className:`shrink-0 px-4 py-3`,style:{borderTop:`1px solid var(--c-border)`},children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2.5 rounded-lg`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,opacity:.5,cursor:`not-allowed`},children:[(0,F.jsx)(`span`,{className:`flex-1 text-[12px]`,style:{color:`var(--c-text3)`},children:`Message is read-only...`}),(0,F.jsx)(di,{size:13,style:{color:`var(--c-text3)`}})]})})]})]}):null}var ZT=[{key:`showEditors`,label:`Editors`,icon:yr},{key:`showCosts`,label:`Est. Costs`,icon:Ir},{key:`showHours`,label:`Peak Hours`,icon:Ar},{key:`showModels`,label:`Top Models`,icon:Nr},{key:`showTokens`,label:`Token Footer`,icon:gr}];function QT({open:e,onClose:t}){let[n,r]=(0,S.useState)({showEditors:!0,showCosts:!0,showHours:!0,showModels:!0,showTokens:!0,username:``,theme:`dark`}),[i,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)([]),f=(0,S.useRef)(null),p=(0,S.useRef)(null),m=(0,S.useCallback)(async e=>{s(!0);try{let t=await ea(e);t&&!t.startsWith(`{`)&&a(t)}catch(e){console.error(`Preview failed:`,e)}s(!1)},[]);(0,S.useEffect)(()=>{e&&(m(n),Hi().then(e=>d(e||[])).catch(()=>{}))},[e]);let h=(e,t)=>{let i={...n,[e]:t};r(i),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>m(i),300)},g=async()=>{if(i){l(!0);try{let e=new Blob([i],{type:`image/svg+xml;charset=utf-8`}),t=URL.createObjectURL(e),n=new Image;n.width=1200*2,n.height=675*2,await new Promise((e,r)=>{n.onload=e,n.onerror=r,n.src=t});let r=document.createElement(`canvas`);r.width=1200*2,r.height=675*2,r.getContext(`2d`).drawImage(n,0,0,1200*2,675*2),URL.revokeObjectURL(t),r.toBlob(e=>{if(!e)return;let t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`agentlytics.png`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),1e3)},`image/png`)}catch(e){console.error(`PNG conversion failed:`,e);let t=new Blob([i],{type:`image/svg+xml`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`agentlytics.svg`,n.click(),URL.revokeObjectURL(n.href)}l(!1)}};return e?(0,F.jsx)(`div`,{ref:p,className:`fixed inset-0 z-50 flex items-center justify-center p-4`,style:{background:`rgba(0,0,0,0.85)`,backdropFilter:`blur(8px)`},onClick:e=>e.target===p.current&&t(),children:(0,F.jsxs)(`div`,{className:`w-full relative flex flex-col`,style:{maxWidth:960,maxHeight:`90vh`,background:`var(--c-bg)`,border:`1px solid var(--c-border)`,borderRadius:12},children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(mi,{size:14,style:{color:`var(--c-accent)`}}),(0,F.jsx)(`span`,{className:`text-[13px] font-semibold`,style:{color:`var(--c-white)`},children:`Share Stats`})]}),(0,F.jsx)(`button`,{onClick:t,className:`p-1 rounded hover:opacity-70 transition`,style:{color:`var(--c-text2)`},children:(0,F.jsx)(ki,{size:16})})]}),(0,F.jsx)(`div`,{className:`flex-1 overflow-auto p-5`,style:{minHeight:0},children:(0,F.jsxs)(`div`,{className:`flex gap-5`,style:{flexDirection:`row`},children:[(0,F.jsxs)(`div`,{className:`flex-shrink-0`,style:{width:200},children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium mb-3`,style:{color:`var(--c-text2)`,textTransform:`uppercase`,letterSpacing:`0.05em`},children:`Customize`}),(0,F.jsxs)(`div`,{className:`mb-4`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium mb-2`,style:{color:`var(--c-text2)`,textTransform:`uppercase`,letterSpacing:`0.05em`},children:`Project`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md`,style:{border:`1px solid var(--c-border)`,background:`var(--c-bg)`},children:[(0,F.jsx)(Ur,{size:11,style:{color:`var(--c-text3)`}}),(0,F.jsxs)(`select`,{value:n.folder||``,onChange:e=>h(`folder`,e.target.value||void 0),className:`bg-transparent outline-none text-[12px] w-full cursor-pointer`,style:{color:`var(--c-text)`,appearance:`none`},children:[(0,F.jsx)(`option`,{value:``,children:`All Projects`}),u.map(e=>(0,F.jsxs)(`option`,{value:e.folder,children:[e.name,` (`,e.totalSessions,`)`]},e.folder))]})]})]}),(0,F.jsx)(`div`,{className:`space-y-1.5`,children:ZT.map(({key:e,label:t,icon:r})=>{let i=n[e];return(0,F.jsxs)(`button`,{onClick:()=>h(e,!i),className:`flex items-center gap-2 w-full px-2.5 py-2 rounded-md text-[12px] transition`,style:{background:i?`var(--c-accent-bg, rgba(99,102,241,0.1))`:`transparent`,border:`1px solid ${i?`var(--c-accent, #6366f1)`:`var(--c-border)`}`,color:i?`var(--c-accent, #818cf8)`:`var(--c-text2)`,opacity:i?1:.6},children:[(0,F.jsx)(r,{size:12}),t]},e)})}),(0,F.jsxs)(`div`,{className:`mt-4`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium mb-2`,style:{color:`var(--c-text2)`,textTransform:`uppercase`,letterSpacing:`0.05em`},children:`Theme`}),(0,F.jsx)(`div`,{className:`flex gap-1.5`,children:[{key:`dark`,icon:ri,label:`Dark`},{key:`light`,icon:yi,label:`Light`}].map(({key:e,icon:t,label:r})=>{let i=n.theme===e;return(0,F.jsxs)(`button`,{onClick:()=>h(`theme`,e),className:`flex items-center gap-1.5 flex-1 justify-center px-2 py-1.5 rounded-md text-[11px] transition`,style:{background:i?`var(--c-accent-bg, rgba(99,102,241,0.1))`:`transparent`,border:`1px solid ${i?`var(--c-accent, #6366f1)`:`var(--c-border)`}`,color:i?`var(--c-accent, #818cf8)`:`var(--c-text2)`,opacity:i?1:.6},children:[(0,F.jsx)(t,{size:11}),r]},e)})})]}),(0,F.jsxs)(`div`,{className:`mt-4`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium mb-2`,style:{color:`var(--c-text2)`,textTransform:`uppercase`,letterSpacing:`0.05em`},children:`Username`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md`,style:{border:`1px solid var(--c-border)`,background:`var(--c-bg)`},children:[(0,F.jsx)(Ei,{size:11,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,placeholder:`optional`,value:n.username,onChange:e=>h(`username`,e.target.value),className:`bg-transparent outline-none text-[12px] w-full`,style:{color:`var(--c-text)`}})]})]})]}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium mb-3`,style:{color:`var(--c-text2)`,textTransform:`uppercase`,letterSpacing:`0.05em`},children:`Preview`}),(0,F.jsxs)(`div`,{className:`rounded-lg overflow-hidden relative`,style:{border:`1px solid var(--c-border)`,background:`#09090f`,minHeight:200},children:[o&&(0,F.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,style:{background:`rgba(0,0,0,0.5)`,zIndex:2},children:(0,F.jsx)(`span`,{className:`text-[12px]`,style:{color:`var(--c-text2)`},children:`Generating...`})}),i&&(0,F.jsx)(`div`,{className:`w-full [&>svg]:w-full [&>svg]:h-auto [&>svg]:block`,dangerouslySetInnerHTML:{__html:i}})]})]})]})}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:`Tip: Toggle sections to customize your share card`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`button`,{onClick:()=>{if(!i)return;let e=new Blob([i],{type:`image/svg+xml`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`agentlytics.svg`,t.click(),URL.revokeObjectURL(t.href)},className:`flex items-center gap-1.5 px-3 py-1.5 text-[12px] rounded-md transition hover:opacity-80`,style:{border:`1px solid var(--c-border)`,color:`var(--c-text)`},children:[(0,F.jsx)(Lr,{size:12}),`SVG`]}),(0,F.jsxs)(`button`,{onClick:g,disabled:c,className:`flex items-center gap-1.5 px-3 py-1.5 text-[12px] rounded-md transition hover:opacity-80`,style:{border:`1px solid var(--c-border)`,color:`var(--c-text)`,opacity:c?.5:1},children:[(0,F.jsx)(Lr,{size:12}),c?`Converting...`:`PNG`]}),(0,F.jsxs)(`button`,{onClick:async()=>{await g(),window.open(`https://x.com/intent/post?text=Here's%20my%20agentic%20coding%20stats%20using%20agentlytics.io%0A%0Arun%20%60npx%20agentlytics%60%20to%20get%20yours%20%E2%9C%A8%0A%0Agithub.com%2Ff%2Fagentlytics`,`_blank`)},className:`flex items-center gap-1.5 px-3 py-1.5 text-[12px] rounded-md transition hover:opacity-80`,style:{background:`#6366f1`,color:`#fff`},children:[(0,F.jsx)(mi,{size:12}),`Share on X`]})]})]})]})}):null}function $({children:e}){return(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider mb-2`,style:{color:`var(--c-text2)`},children:e})}function $T({icon:e,title:t,children:n}){return(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[13px] font-bold`,style:{color:`var(--c-white)`},children:[e&&(0,F.jsx)(e,{size:14,style:{color:`#6366f1`}}),t]}),n]})}Lf.register(qf,wm,im,km,Nm,vp,cp,op,Yp);var eE=`JetBrains Mono, monospace`,tE=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],nE={agent:`#a855f7`,chat:`#3b82f6`,cascade:`#06b6d4`,edit:`#10b981`,copilot:`#f59e0b`,thread:`#ec4899`,opencode:`#f43f5e`,claude:`#f97316`};function rE({overview:e}){let t=dt(),[n,r]=(0,S.useState)(null),[i,a]=(0,S.useState)(null),[o,s]=(0,S.useState)(null),[c,l]=(0,S.useState)(null),[u,d]=(0,S.useState)(null),{dark:f}=tr(),[p,m]=(0,S.useState)(null),[h,g]=(0,S.useState)(!1),[_,v]=(0,S.useState)(null),[y,b]=(0,S.useState)(null),x=f?`#555`:`#999`,C=f?`rgba(255,255,255,0.04)`:`rgba(0,0,0,0.06)`,w=f?`#888`:`#555`,T={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:`right`,labels:{color:w,font:{size:10,family:eE},padding:12,usePointStyle:!0,pointStyle:`circle`}},tooltip:{bodyFont:{family:eE,size:11},titleFont:{family:eE,size:11}}}},E={x:{grid:{display:!1},ticks:{color:x,font:{size:8,family:eE}}},y:{grid:{color:C},ticks:{color:x,font:{size:8,family:eE}},beginAtZero:!0}},D={legend:{display:!1},tooltip:{bodyFont:{family:eE,size:10},titleFont:{family:eE,size:10}}};if((0,S.useEffect)(()=>{let e=jh(u),t={limit:500,named:!1,...e};if(c&&(t.editor=c),Bi(t).then(e=>{v((e.chats||[]).filter(e=>e.bubbleCount>=100).sort((e,t)=>t.bubbleCount-e.bubbleCount))}),!c){e.dateFrom||e.dateTo?zi(e).then(a):a(null),Ui(e).then(r),Ki(e).then(s),Ji(e).then(m);return}Promise.all([zi({editor:c,...e}),Ui({editor:c,...e}),Ki({editor:c,...e}),Ji({editor:c,...e})]).then(([e,t,n,i])=>{a(e),r(t),s(n),m(i)})},[c,u]),!e)return(0,F.jsx)(wa,{label:`Loading dashboard...`});let O=i||e,k=e.editors.sort((e,t)=>t.count-e.count),A=O.oldestChat&&O.newestChat?Math.max(1,Math.round((O.newestChat-O.oldestChat)/864e5)):0,j=O.byMonth.length>0?O.byMonth[O.byMonth.length-1]:null,ee=Object.entries(O.byMode).sort((e,t)=>t[1]-e[1]),te=c?k.find(e=>e.id===c):null,ne={labels:k.map(e=>q(e.id)),datasets:[{data:k.map(e=>e.count),backgroundColor:k.map(e=>Oh(e.id)),borderWidth:0,spacing:2}]},re={labels:ee.map(e=>e[0]),datasets:[{data:ee.map(e=>e[1]),backgroundColor:ee.map(e=>nE[e[0]]||`#6b7280`),borderWidth:0}]},M=O.topProjects.length>0?O.topProjects[0].count:1,N=o?.monthlyTrend,ie=N&&N.months.length>0?{labels:N.months.map(e=>e.substring(2)),datasets:N.sources.map(e=>({label:q(e),data:N.months.map(t=>N.data[t]?.[e]||0),backgroundColor:Oh(e)+`CC`,borderRadius:2}))}:null,ae=o?{labels:o.hourly.map((e,t)=>`${String(t).padStart(2,`0`)}`),datasets:[{data:o.hourly,backgroundColor:o.hourly.map((e,t)=>{let n=Math.max(...o.hourly),r=n>0?e/n:0;return r>.75?`#6366f1`:r>.5?`#818cf8`:r>.25?`#a5b4fc`:`#c7d2fe50`}),borderRadius:2}]}:null,oe=o?{labels:tE,datasets:[{data:o.weekdays,backgroundColor:o.weekdays.map((e,t)=>t===0||t===6?`#f59e0b80`:`#6366f1`),borderRadius:3}]}:null,se=o?{labels:Object.keys(o.depthBuckets),datasets:[{data:Object.values(o.depthBuckets),backgroundColor:[`#ef444460`,`#f97316`,`#f59e0b`,`#10b981`,`#06b6d4`,`#6366f1`,`#a855f7`],borderRadius:3}]}:null,ce=o?.velocity?.length>1?{labels:o.velocity.map(e=>e.month.substring(2)),datasets:[{label:`Avg msgs/session`,data:o.velocity.map(e=>e.avgMsgs),borderColor:`#6366f1`,backgroundColor:`#6366f120`,borderWidth:2,tension:.3,pointRadius:2,pointHoverRadius:4,fill:!0}]}:null,P=o?.tokens,le=P?P.input+P.cacheRead+(P.cacheWrite||0):0,ue=le>0?(P.cacheRead/le*100).toFixed(1):0,de=le>0?(P.output/le).toFixed(3):0,fe=P&&P.sessions>0&&P.messages!=null?(P.messages/P.sessions).toFixed(1):`—`;return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:Xr,title:`Dashboard`,children:(0,F.jsxs)(`div`,{className:`ml-auto flex items-center gap-3`,children:[(0,F.jsx)(Hh,{value:u,onChange:d}),(0,F.jsxs)(`button`,{onClick:()=>g(!0),className:`flex items-center gap-1.5 px-3 py-1 text-[12px] rounded-md transition hover:opacity-80`,style:{background:`#6366f1`,color:`#fff`},children:[(0,F.jsx)(mi,{size:12}),`Share Stats`]})]})}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)(`div`,{className:`flex items-center flex-wrap gap-1.5`,children:k.map(e=>{let t=c===e.id;return(0,F.jsxs)(`button`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 text-[12px] cursor-pointer transition rounded-sm`,style:{border:t?`1.5px solid ${Oh(e.id)}`:`1px solid var(--c-border)`,background:t?Oh(e.id)+`15`:`transparent`,opacity:c&&!t?.4:1,color:`var(--c-text)`},onClick:()=>l(t?null:e.id),children:[(0,F.jsx)(Gh,{source:e.id,size:14}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:q(e.id)}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-white)`},children:e.count})]},e.id)})}),c&&te&&(0,F.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,F.jsxs)(`button`,{onClick:()=>t(`/sessions?editor=${c}`),className:`flex items-center gap-1 text-[12px] px-2.5 py-1 transition`,style:{color:`var(--c-accent)`,border:`1px solid var(--c-border)`},children:[`Show Sessions `,(0,F.jsx)(fr,{size:11})]}),(0,F.jsxs)(`button`,{onClick:()=>l(null),className:`flex items-center gap-1 text-[12px] px-2.5 py-1 transition`,style:{color:`var(--c-text2)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(ki,{size:9}),` Clear`]})]})]}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`sessions`,value:J(O.totalChats),sub:te?q(te.id):`${k.length} editors`,onClick:()=>t(c?`/sessions?editor=${c}`:`/sessions`)}),(0,F.jsx)(K,{label:`projects`,value:O.topProjects.length,sub:`${A}d span`,onClick:()=>t(`/projects`)}),(0,F.jsx)(K,{label:`this month`,value:j?j.count:0,sub:j?j.month:``,onClick:()=>t(`/sessions`)}),o&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(K,{label:`avg depth`,value:fe,sub:(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,F.jsx)(ni,{size:8}),` msgs/session`]})}),(0,F.jsx)(K,{label:`tool calls`,value:J(o.totalToolCalls),sub:(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,F.jsx)(Oi,{size:8}),` total`]})})]}),P&&P.input>0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(K,{label:`tokens in`,value:J(P.input),sub:`prompt`}),(0,F.jsx)(K,{label:`tokens out`,value:J(P.output),sub:`${de}× ratio`}),(0,F.jsx)(K,{label:`cache hit`,value:`${ue}%`,sub:J(P.cacheRead)}),(0,F.jsx)(K,{label:`you wrote`,value:J(P.userChars),sub:`AI: ${J(P.assistantChars)}`})]})]}),P&&P.input>0&&(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`in tokens`,value:J(P.input),sub:`total prompt`}),(0,F.jsx)(K,{label:`out tokens`,value:J(P.output),sub:`total completion`}),(0,F.jsx)(K,{label:`cache read`,value:J(P.cacheRead),sub:`${ue}% hit rate`}),(0,F.jsx)(K,{label:`cache write`,value:J(P.cacheWrite)}),(0,F.jsx)(K,{label:`out/in ratio`,value:`${de}×`,sub:(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,F.jsx)(Ai,{size:8}),` efficiency`]})}),(0,F.jsx)(K,{label:`you wrote`,value:J(P.userChars),sub:`AI wrote ${J(P.assistantChars)}`}),(0,F.jsx)(K,{label:`est. cost`,value:p&&p.totalCost>0?kh(p.totalCost):`—`,sub:p&&p.byModel.length>0?`${p.byModel.length} model${p.byModel.length===1?``:`s`}`:void 0})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`agentic coding activity`}),(0,F.jsxs)(`div`,{className:`flex gap-4`,children:[(0,F.jsx)(`div`,{className:`min-w-0 flex-shrink-0`,children:n?(0,F.jsx)(Bh,{dailyData:n}):(0,F.jsx)(`div`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:`loading...`})}),o&&n&&(()=>{let e=n.filter(e=>e.total>0),t=e.length>0?e.reduce((e,t)=>e.total>t.total?e:t):null,r=e.reduce((e,t)=>e+t.total,0),i=e.length>0?(r/e.length).toFixed(1):0;return(0,F.jsxs)(`div`,{className:`flex-1 grid grid-cols-3 gap-3 text-[11px] min-w-0`,style:{borderLeft:`1px solid var(--c-border)`,paddingLeft:16},children:[(0,F.jsxs)(`div`,{className:`space-y-2 min-w-0`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},className:`uppercase tracking-wider mb-1`,children:`streaks`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(Vr,{size:10,className:`text-orange-400 flex-shrink-0`}),(0,F.jsxs)(`span`,{style:{color:`var(--c-white)`},className:`font-bold`,children:[o.streaks.current,`d`]}),(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`now`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 mt-0.5`,children:[(0,F.jsx)(Ai,{size:10,className:`text-yellow-400 flex-shrink-0`}),(0,F.jsxs)(`span`,{style:{color:`var(--c-white)`},className:`font-bold`,children:[o.streaks.longest,`d`]}),(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`best`})]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},className:`uppercase tracking-wider mb-1`,children:`active days`}),(0,F.jsx)(`span`,{style:{color:`var(--c-white)`},className:`font-bold`,children:o.streaks.totalDays}),(0,F.jsxs)(`span`,{className:`ml-1`,style:{color:`var(--c-text3)`},children:[i,`/day`]})]})]}),(0,F.jsxs)(`div`,{className:`space-y-2 min-w-0`,children:[t&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},className:`uppercase tracking-wider mb-1`,children:`busiest day`}),(0,F.jsx)(`div`,{style:{color:`var(--c-white)`},className:`font-bold`,children:t.day}),(0,F.jsxs)(`div`,{style:{color:`var(--c-text3)`},children:[t.total,` sessions`]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},className:`uppercase tracking-wider mb-1`,children:`peak hour`}),(0,F.jsxs)(`div`,{style:{color:`var(--c-white)`},className:`font-bold`,children:[String(o.hourly.indexOf(Math.max(...o.hourly))).padStart(2,`0`),`:00`]}),(0,F.jsxs)(`div`,{style:{color:`var(--c-text3)`},children:[Math.max(...o.hourly),` sessions`]})]})]}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},className:`uppercase tracking-wider mb-1`,children:`top modes`}),(0,F.jsx)(`div`,{className:`space-y-1`,children:ee.slice(0,5).map(([e,t])=>(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0`,style:{background:nE[e]||`#6b7280`}}),(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text)`},children:e}),(0,F.jsx)(`span`,{className:`ml-auto font-bold flex-shrink-0`,style:{color:`var(--c-white)`},children:J(t)})]},e))})]})]})})()]})]}),ie&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`monthly trend `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(sessions by editor)`})]}),(0,F.jsx)(`div`,{style:{height:200},children:(0,F.jsx)(wh,{data:ie,options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{stacked:!0,grid:{display:!1},ticks:{color:x,font:{size:8,family:eE},maxRotation:0}},y:{stacked:!0,grid:{color:C},ticks:{color:x,font:{size:8,family:eE}},beginAtZero:!0}},plugins:{legend:{position:`top`,labels:{color:w,font:{size:9,family:eE},usePointStyle:!0,pointStyle:`circle`,padding:8}},tooltip:{mode:`index`,bodyFont:{family:eE,size:10},titleFont:{family:eE,size:10}}}}})})]}),o&&(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`peak hours `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(when you code with AI)`})]}),(0,F.jsx)(`div`,{style:{height:160},children:ae&&(0,F.jsx)(wh,{data:ae,options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{grid:{display:!1},ticks:{color:x,font:{size:7,family:eE},maxRotation:0,callback:(e,t)=>t%3==0?`${String(t).padStart(2,`0`)}`:``}},y:{grid:{color:C},ticks:{color:x,font:{size:8,family:eE}},beginAtZero:!0}},plugins:D}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`weekday pattern `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(weekends highlighted)`})]}),(0,F.jsx)(`div`,{style:{height:160},children:oe&&(0,F.jsx)(wh,{data:oe,options:{responsive:!0,maintainAspectRatio:!1,scales:E,plugins:D}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`session depth `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(messages per session)`})]}),(0,F.jsx)(`div`,{style:{height:160},children:se&&(0,F.jsx)(wh,{data:se,options:{responsive:!0,maintainAspectRatio:!1,scales:E,plugins:D}})})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-2`,children:[ce?(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`conversation velocity `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(avg msgs/session)`})]}),(0,F.jsx)(`div`,{style:{height:180},children:(0,F.jsx)(Ch,{data:ce,options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{grid:{display:!1},ticks:{color:x,font:{size:8,family:eE},maxRotation:0}},y:{grid:{color:C},ticks:{color:x,font:{size:8,family:eE}},beginAtZero:!0}},plugins:D}})})]}):(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`editors`}),(0,F.jsx)(`div`,{style:{height:180},children:(0,F.jsx)(Th,{data:ne,options:{...T,cutout:`65%`}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`modes`}),(0,F.jsx)(`div`,{style:{height:180},children:(0,F.jsx)(Th,{data:re,options:{...T,cutout:`60%`}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`top projects`}),(0,F.jsx)(`div`,{className:`space-y-1 max-h-[180px] overflow-y-auto scrollbar-thin`,children:O.topProjects.slice(0,12).map(e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`div`,{className:`text-[10px] w-6 text-right`,style:{color:`var(--c-text2)`},children:e.count}),(0,F.jsx)(`div`,{className:`flex-1 h-3 rounded-sm overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full bg-accent/30 rounded-sm`,style:{width:`${(e.count/M*100).toFixed(1)}%`}})}),(0,F.jsx)(`div`,{className:`text-[10px] truncate max-w-[140px]`,style:{color:`var(--c-text2)`},title:e.fullPath,children:e.name})]},e.name))})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-2`,children:[o&&o.topModels.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`top models `,p&&p.totalCost>0&&(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,kh(p.totalCost),` est.)`]})]}),(0,F.jsx)(`div`,{className:`space-y-1`,children:o.topModels.map((e,t)=>{let n=o.topModels[0].count,r=p?.byModel?.find(t=>t.model===e.name);return(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-[10px] w-3 text-right`,style:{color:`var(--c-text3)`},children:t+1}),(0,F.jsx)(`span`,{className:`text-[9px] truncate w-28`,style:{color:`var(--c-text2)`},title:e.name,children:e.name}),(0,F.jsx)(`div`,{className:`flex-1 h-4 rounded-sm overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-sm`,style:{width:`${(e.count/n*100).toFixed(1)}%`,background:t===0?`#6366f1`:t===1?`#818cf8`:`#a5b4fc40`}})}),r?(0,F.jsx)(`span`,{className:`text-[9px] w-12 text-right`,style:{color:`#10b981`},children:kh(r.cost)}):null,(0,F.jsx)(`span`,{className:`text-[10px] w-8 text-right`,style:{color:`var(--c-text3)`},children:e.count})]},e.name)})})]}),o&&o.topTools.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`top tools `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,J(o.totalToolCalls),` total)`]})]}),(0,F.jsx)(`div`,{className:`space-y-1`,children:o.topTools.map((e,t)=>{let n=o.topTools[0].count;return(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-[10px] w-3 text-right`,style:{color:`var(--c-text3)`},children:t+1}),(0,F.jsx)(`div`,{className:`flex-1 h-4 rounded-sm overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-sm flex items-center px-1.5`,style:{width:`${(e.count/n*100).toFixed(1)}%`,background:t===0?`#10b981`:t===1?`#34d399`:`#6ee7b740`},children:(0,F.jsx)(`span`,{className:`text-[8px] truncate font-mono`,style:{color:t<2?`#fff`:`var(--c-text2)`},children:e.name})})}),(0,F.jsx)(`span`,{className:`text-[10px] w-8 text-right`,style:{color:`var(--c-text3)`},children:J(e.count)})]},e.name)})})]}),_&&_.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(wi,{size:10,className:`text-amber-400`}),`large context`,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,_.length,`)`]})]})}),(0,F.jsx)(`div`,{className:`space-y-1`,children:_.slice(0,10).map(e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1.5 py-1 rounded-sm cursor-pointer transition hover:opacity-80`,style:{background:e.bubbleCount>=500?`rgba(239,68,68,0.06)`:`rgba(245,158,11,0.06)`},onClick:()=>b(e.id),children:[(0,F.jsx)(Gh,{source:e.source,size:10}),(0,F.jsx)(`span`,{className:`text-[10px] truncate flex-1`,style:{color:`var(--c-text)`},children:e.name||`Untitled`}),(0,F.jsx)(`span`,{className:`text-[10px] font-bold flex-shrink-0`,style:{color:e.bubbleCount>=500?`#ef4444`:`#f59e0b`},children:e.bubbleCount})]},e.id))})]})]}),(0,F.jsx)(XT,{chatId:y,onClose:()=>b(null)}),(0,F.jsx)(QT,{open:h,onClose:()=>g(!1)})]})}Lf.register(qf,km,Nm,cp,op,vp,wm,im,Yp);var iE=`JetBrains Mono, monospace`;Lf.register({id:`dragSelect`,beforeEvent(e,t){let n=t.event,r=e._dragSelect||={dragging:!1,startX:0,endX:0},i=e.chartArea;if(i){if(n.type===`mousedown`&&n.x>=i.left&&n.x<=i.right&&n.y>=i.top&&n.y<=i.bottom&&(r.dragging=!0,r.startX=n.x,r.endX=n.x),n.type===`mousemove`&&r.dragging)return r.endX=Math.max(i.left,Math.min(n.x,i.right)),t.changed=!1,e.draw(),!1;if(n.type===`mouseup`&&r.dragging){r.dragging=!1,r.endX=Math.max(i.left,Math.min(n.x,i.right));let t=Math.min(r.startX,r.endX),a=Math.max(r.startX,r.endX);if(a-t>5){let n=e.scales.x,r=n.getValueForPixel(t),i=n.getValueForPixel(a),o=e.data.labels,s=o[Math.max(0,Math.round(r))],c=o[Math.min(o.length-1,Math.round(i))];e.config.options._onRangeSelect&&e.config.options._onRangeSelect(s,c)}e.draw()}}},afterDraw(e){let t=e._dragSelect;if(!t)return;let n=e.chartArea,r=e.ctx,i=e.config.options;if(i._selectionRange&&e.data.labels){let t=e.scales.x,a=e.data.labels,o=a.indexOf(i._selectionRange[0]),s=a.indexOf(i._selectionRange[1]);if(o>=0&&s>=0){let e=t.getPixelForValue(o),i=t.getPixelForValue(s);r.save(),r.fillStyle=`rgba(99,102,241,0.10)`,r.fillRect(Math.min(e,i),n.top,Math.abs(i-e),n.bottom-n.top),r.strokeStyle=`rgba(99,102,241,0.4)`,r.lineWidth=1,r.setLineDash([3,3]),r.strokeRect(Math.min(e,i),n.top,Math.abs(i-e),n.bottom-n.top),r.restore()}}if(t.dragging){let e=Math.min(t.startX,t.endX),i=Math.max(t.startX,t.endX);r.save(),r.fillStyle=`rgba(99,102,241,0.15)`,r.fillRect(e,n.top,i-e,n.bottom-n.top),r.restore()}}}),wm.positioners.belowCursor=function(e,t){return{x:t.x,y:t.y+20}};function aE({overview:e}){let{dark:t}=tr(),n=t?`#555`:`#999`,r=t?`#777`:`#555`,i=t?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`,[a,o]=(0,S.useState)([]),[s,c]=(0,S.useState)(0),[l,u]=(0,S.useState)(``),[d]=zn(),f=dt(),[p,m]=(0,S.useState)(d.get(`editor`)||``),[h,g]=(0,S.useState)(!0),[_,v]=(0,S.useState)(!1),[y,b]=(0,S.useState)(new Set),[x,C]=(0,S.useState)(null),[w,T]=(0,S.useState)(null),[E,D]=(0,S.useState)(null),O=(0,S.useRef)(null),k=(0,S.useCallback)((e,t)=>{e&&t&&C([e,t].sort())},[]);(0,S.useEffect)(()=>{g(!0),Bi({editor:p,limit:1e3,...jh(w)}).then(e=>{o(e.chats),c(e.total),g(!1)})},[p,w]);let A=l?a.filter(e=>(e.name||``).toLowerCase().includes(l.toLowerCase())||(e.folder||``).toLowerCase().includes(l.toLowerCase())||e.id.toLowerCase().includes(l.toLowerCase())):a,j=(0,S.useMemo)(()=>{if(!x)return A;let[e,t]=x,n=new Date(e).getTime(),r=new Date(t).getTime()+6*864e5;return A.filter(e=>{let t=e.lastUpdatedAt||e.createdAt;return t&&t>=n&&t<=r})},[A,x]),ee=e?.editors||[],te=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`],ne=(0,S.useMemo)(()=>{let e={},t={},n={},r=0,i=0,a=new Set;for(let o of j)o.source&&(e[o.source]=(e[o.source]||0)+1),o.topModel&&(t[o.topModel]=(t[o.topModel]||0)+1),o.mode&&(n[o.mode]=(n[o.mode]||0)+1),o.folder&&a.add(o.folder),o.bubbleCount>=500?r++:o.bubbleCount>=200&&i++;return{editorEntries:Object.entries(e).sort((e,t)=>t[1]-e[1]),modelEntries:Object.entries(t).sort((e,t)=>t[1]-e[1]).slice(0,10),modeEntries:Object.entries(n).sort((e,t)=>t[1]-e[1]),bloatCount:r,largeCount:i,projectCount:a.size}},[j]),re=(0,S.useMemo)(()=>{if(A.length===0)return null;let e={};for(let t of A){let n=t.lastUpdatedAt||t.createdAt;if(!n)continue;let r=new Date(n),i=r.getDay(),a=r.getDate()-i+(i===0?-6:1),o=new Date(r);o.setDate(a);let s=`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,`0`)}-${String(o.getDate()).padStart(2,`0`)}`;e[s]||(e[s]={});let c=t.source||`unknown`;e[s][c]=(e[s][c]||0)+1}let t=Object.keys(e).sort();return{labels:t,datasets:[...new Set(A.map(e=>e.source).filter(Boolean))].map(n=>({label:q(n),data:t.map(t=>e[t][n]||0),borderColor:Oh(n),backgroundColor:Oh(n)+`15`,borderWidth:1.5,tension:.3,pointRadius:0,pointHoverRadius:4,fill:!0}))}},[A]),M=(0,S.useMemo)(()=>{if(!_)return null;let e={};for(let t of j){let n=t.folder||`(no project)`;e[n]||(e[n]=[]),e[n].push(t)}return Object.entries(e).map(([e,t])=>({folder:e,name:e===`(no project)`?`(no project)`:e.split(`/`).pop(),items:t})).sort((e,t)=>t.items.length-e.items.length)},[j,_]);function N(e){b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}let ie=({c:e})=>(0,F.jsxs)(`tr`,{className:`cursor-pointer transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>D(e.id),children:[(0,F.jsx)(`td`,{className:`py-2 px-3`,children:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Gh,{source:e.source,size:12}),(0,F.jsx)(`span`,{className:`text-[12px]`,style:{color:`var(--c-text2)`},children:q(e.source)})]})}),(0,F.jsxs)(`td`,{className:`py-2 px-3 font-medium truncate max-w-[280px] text-[12px]`,style:{color:`var(--c-white)`},children:[e.name||(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`Untitled`}),e.encrypted&&(0,F.jsx)(`span`,{className:`ml-1.5 text-[10px] text-yellow-500/60`,children:`locked`})]}),!_&&(0,F.jsx)(`td`,{className:`py-2 px-3 truncate max-w-[160px] text-[12px]`,style:{color:`var(--c-text2)`},title:e.folder,children:e.folder?(0,F.jsx)(`span`,{className:`cursor-pointer hover:underline`,style:{color:`var(--c-accent)`},onClick:t=>{t.stopPropagation(),f(`/projects/detail?folder=${encodeURIComponent(e.folder)}`)},children:e.folder.split(`/`).pop()}):``}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-[12px]`,style:{color:`var(--c-text2)`},children:e.mode||``}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-[12px] font-mono truncate max-w-[150px]`,style:{color:`var(--c-text2)`},title:e.topModel||``,children:e.topModel||``}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-[12px]`,children:e.bubbleCount>=500?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 font-bold`,style:{color:`#ef4444`},children:[(0,F.jsx)(wi,{size:9}),e.bubbleCount]}):e.bubbleCount>=200?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 font-bold`,style:{color:`#f59e0b`},children:[(0,F.jsx)(wi,{size:9}),e.bubbleCount]}):(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:e.bubbleCount||0})}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-[12px] font-mono text-right`,style:{color:e.cost>0?`var(--c-text2)`:`var(--c-text3)`},children:e.cost>0?(0,F.jsxs)(`span`,{title:e.costPartial?`partial — this session used a model with no price`:void 0,children:[kh(e.cost),e.costPartial?`*`:``]}):``}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-[12px] whitespace-nowrap`,style:{color:`var(--c-text3)`},children:Ah(e.lastUpdatedAt||e.createdAt)})]},e.id);return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:Qr,title:`Sessions`}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`sessions`,value:J(j.length),sub:j.length===s?``:`of ${J(s)}`}),(0,F.jsx)(K,{label:`projects`,value:ne.projectCount}),(0,F.jsx)(K,{label:`editors`,value:ne.editorEntries.length}),(0,F.jsx)(K,{label:`models`,value:ne.modelEntries.length}),ne.bloatCount+ne.largeCount>0&&(0,F.jsx)(K,{label:`large context`,value:ne.bloatCount+ne.largeCount,sub:ne.bloatCount>0?`${ne.bloatCount} bloated`:``})]}),j.length>0&&(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`editors`}),(0,F.jsx)(`div`,{style:{height:140},children:(0,F.jsx)(Th,{data:{labels:ne.editorEntries.map(e=>q(e[0])),datasets:[{data:ne.editorEntries.map(e=>e[1]),backgroundColor:ne.editorEntries.map(e=>Oh(e[0])),borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:r,font:{size:9,family:iE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:iE,size:10},titleFont:{family:iE,size:10}}}}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`models`}),(0,F.jsx)(`div`,{style:{height:140},children:ne.modelEntries.length>0?(0,F.jsx)(Th,{data:{labels:ne.modelEntries.map(e=>e[0]),datasets:[{data:ne.modelEntries.map(e=>e[1]),backgroundColor:te,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:r,font:{size:9,family:iE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:iE,size:10},titleFont:{family:iE,size:10}}}}}):(0,F.jsx)(`div`,{className:`text-[11px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`no model data`})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`modes`}),(0,F.jsx)(`div`,{style:{height:140},children:ne.modeEntries.length>0?(0,F.jsx)(wh,{data:{labels:ne.modeEntries.map(e=>e[0]||`unknown`),datasets:[{data:ne.modeEntries.map(e=>e[1]),backgroundColor:`#6366f1`,borderRadius:3}]},options:{responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{grid:{color:i},ticks:{color:n,font:{size:8,family:iE}}},y:{grid:{display:!1},ticks:{color:r,font:{size:9,family:iE}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:iE,size:10},titleFont:{family:iE,size:10}}}}}):(0,F.jsx)(`div`,{className:`text-[11px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`no mode data`})})]})]}),re&&re.labels.length>1&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,F.jsxs)($,{children:[`session timeline`,(0,F.jsx)(`span`,{className:`ml-2 font-normal text-[10px]`,style:{color:`var(--c-text3)`},children:`(drag to select range)`})]}),x&&(0,F.jsxs)(`button`,{onClick:()=>C(null),className:`flex items-center gap-1 text-[11px] px-2 py-0.5 transition`,style:{color:`var(--c-accent)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(ki,{size:10}),x[0],` — `,x[1]]})]}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Ch,{ref:O,data:re,options:{responsive:!0,maintainAspectRatio:!1,interaction:{mode:`index`,intersect:!1},events:[`mousemove`,`mouseout`,`click`,`touchstart`,`touchmove`,`mousedown`,`mouseup`],_onRangeSelect:k,_selectionRange:x,scales:{x:{grid:{display:!1},ticks:{color:n,font:{size:9,family:iE},maxTicksLimit:20,maxRotation:0}},y:{beginAtZero:!0,grid:{color:i},ticks:{color:n,stepSize:1,font:{size:9,family:iE}}}},plugins:{legend:{position:`top`,labels:{color:r,font:{size:9,family:iE},usePointStyle:!0,pointStyle:`circle`,padding:10}},tooltip:{position:`belowCursor`,bodyFont:{family:iE,size:10},titleFont:{family:iE,size:10}}}}})})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`select`,{value:p,onChange:e=>m(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Editors`}),ee.map(e=>(0,F.jsxs)(`option`,{value:e.id,children:[q(e.id),` (`,e.count,`)`]},e.id))]}),(0,F.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,F.jsx)(ui,{size:12,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,placeholder:`Search sessions...`,value:l,onChange:e=>u(e.target.value),className:`w-full pl-7 pr-3 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`}})]}),(0,F.jsxs)(`button`,{onClick:()=>v(!_),className:`flex items-center gap-1.5 px-3 py-1 text-[12px] transition`,style:{border:_?`1px solid var(--c-accent)`:`1px solid var(--c-border)`,color:_?`var(--c-accent)`:`var(--c-text2)`,background:_?`rgba(99,102,241,0.1)`:`transparent`},children:[_?(0,F.jsx)(Ur,{size:13}):(0,F.jsx)(Qr,{size:13}),_?`grouped`:`flat`]}),(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:h?`loading...`:`${j.length} of ${s}`}),(0,F.jsx)(`div`,{className:`ml-auto`,children:(0,F.jsx)(Hh,{value:w,onChange:T})})]}),_?(0,F.jsxs)(`div`,{className:`space-y-2`,children:[M.map(e=>{let t=y.has(e.folder),n=[...new Set(e.items.map(e=>e.source).filter(Boolean))];return(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2.5 cursor-pointer transition`,onClick:()=>N(e.folder),children:[t?(0,F.jsx)(wr,{size:13,style:{color:`var(--c-text3)`}}):(0,F.jsx)(Cr,{size:13,style:{color:`var(--c-text3)`}}),(0,F.jsx)(Ur,{size:13,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`span`,{className:`text-xs font-medium`,style:{color:`var(--c-white)`},children:e.name}),(0,F.jsx)(`span`,{className:`text-[11px] truncate max-w-[300px]`,style:{color:`var(--c-text3)`},children:e.folder!==e.name&&e.folder!==`(no project)`?e.folder:``}),(0,F.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[n.slice(0,5).map(e=>(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{background:Oh(e)},title:q(e)},e)),(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:e.items.length})]})]}),!t&&(0,F.jsx)(`table`,{className:`w-full text-sm`,children:(0,F.jsx)(`tbody`,{children:e.items.map(e=>(0,F.jsx)(ie,{c:e},e.id))})})]},e.folder)}),M.length===0&&!h&&(0,F.jsx)(`div`,{className:`text-center py-12 text-sm`,style:{color:`var(--c-text3)`},children:`no sessions found`})]}):(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`editor`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`name`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`project`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`mode`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`model`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`context`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`est. cost`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`updated`})]})}),(0,F.jsx)(`tbody`,{children:j.map(e=>(0,F.jsx)(ie,{c:e},e.id))})]}),j.length===0&&!h&&(0,F.jsx)(`div`,{className:`text-center py-12 text-sm`,style:{color:`var(--c-text3)`},children:`no sessions found`})]}),(0,F.jsx)(XT,{chatId:E,onClose:()=>D(null)})]})}Lf.register(qf,wm,im,km,Nm,vp);var oE=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`],sE=[`#10b981`,`#34d399`,`#6ee7b7`,`#a7f3d0`,`#d1fae5`,`#ecfdf5`,`#b8f0d8`,`#7ce0b8`,`#4ade80`,`#22c55e`],cE=`JetBrains Mono, monospace`,lE={"File Operations":[`read_file`,`write_to_file`,`edit`,`multi_edit`,`Read`,`Write`,`EditFile`,`edit_file`,`create_file`,`read_notebook`,`edit_notebook`],Search:[`grep_search`,`find_by_name`,`code_search`,`search`,`list_dir`,`Grep`,`Find`,`SearchFiles`,`ListDir`],Terminal:[`run_command`,`command_status`,`RunCommand`,`execute_command`,`Bash`,`bash`],Browser:[`browser_preview`,`read_url_content`,`view_content_chunk`],"AI Tools":[`mcp0_`,`mcp1_`,`mcp5_`,`mcp6_`,`skill`,`trajectory_search`]};function uE(e){let t={};for(let n of e){let e=!1;for(let[r,i]of Object.entries(lE))if(i.some(e=>n.name.startsWith(e)||n.name===e||n.name.toLowerCase().includes(e.toLowerCase()))){t[r]||(t[r]={tools:[],total:0}),t[r].tools.push(n),t[r].total+=n.count,e=!0;break}e||(t.Other||={tools:[],total:0},t.Other.tools.push(n),t.Other.total+=n.count)}return Object.entries(t).sort((e,t)=>t[1].total-e[1].total)}function dE(e,t){if(!t||typeof t!=`object`)return null;if(t.CommandLine||t.command)return t.CommandLine||t.command;if(t.file_path)return t.file_path;if(t.TargetFile)return t.TargetFile;if(t.SearchPath||t.search_path)return`${t.Query||t.query||``} in ${t.SearchPath||t.search_path||``}`;if(t.Pattern)return`${t.Pattern} in ${t.SearchDirectory||``}`;if(t.Url||t.url)return t.Url||t.url;if(t.query)return t.query;let n=Object.values(t).filter(e=>typeof e==`string`&&e.length>0);return n.length>0?n[0].substring(0,120):null}function fE(e){if(!e||typeof e!=`object`)return null;let t=e.old_string||e.old_text||e.oldText||e.search||null,n=e.new_string||e.new_text||e.newText||e.replace||null,r=e.file_path||e.TargetFile||e.filePath||e.path||null;return t!=null||n!=null?{old:t,new:n,file:r}:null}function pE({diff:e}){let t=(e.old||``).split(`
|
|
61
64
|
`).slice(0,8),n=(e.new||``).split(`
|
|
62
65
|
`).slice(0,8);return(0,F.jsxs)(`div`,{className:`mt-1 text-[10px] font-mono overflow-x-auto`,style:{border:`1px solid var(--c-border)`},children:[e.file&&(0,F.jsx)(`div`,{className:`px-2 py-0.5`,style:{background:`var(--c-code-bg)`,color:`var(--c-text2)`},children:e.file}),e.old&&t.map((e,t)=>(0,F.jsxs)(`div`,{className:`px-2`,style:{background:`rgba(248,113,113,0.07)`,color:`#f87171`},children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`,userSelect:`none`},children:`- `}),e]},`o`+t)),e.old&&t.length<(e.old||``).split(`
|
|
63
66
|
`).length&&(0,F.jsxs)(`div`,{className:`px-2`,style:{color:`var(--c-text3)`},children:[` ... `,(e.old||``).split(`
|
|
64
67
|
`).length-8,` more lines`]}),e.new&&n.map((e,t)=>(0,F.jsxs)(`div`,{className:`px-2`,style:{background:`rgba(52,211,153,0.07)`,color:`#34d399`},children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`,userSelect:`none`},children:`+ `}),e]},`n`+t)),e.new&&n.length<(e.new||``).split(`
|
|
65
68
|
`).length&&(0,F.jsxs)(`div`,{className:`px-2`,style:{color:`var(--c-text3)`},children:[` ... `,(e.new||``).split(`
|
|
66
|
-
`).length-8,` more lines`]})]})}function mE({call:e,toolName:t,index:n}){let[r,i]=(0,S.useState)(!1),a=dE(t,e.args),o=fE(e.args),s=e.folder?e.folder.split(`/`).pop():null,c=o||e.args&&Object.keys(e.args).length>0;return(0,F.jsxs)(`div`,{className:`px-2 py-1 text-[11px]`,style:{background:n%2==0?`var(--c-code-bg)`:`transparent`},children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-2 cursor-pointer`,onClick:()=>c&&i(!r),children:[(0,F.jsx)(Gh,{source:e.source,size:10}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[a&&(0,F.jsx)(`div`,{className:`font-mono truncate`,style:{color:`var(--c-white)`},title:a,children:a}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(`span`,{children:q(e.source)}),s&&(0,F.jsxs)(`span`,{children:[`· `,s]}),e.timestamp&&(0,F.jsxs)(`span`,{children:[`· `,new Date(e.timestamp).toLocaleDateString()]}),c&&(0,F.jsx)(`span`,{children:r?`▾`:`▸`})]})]})]}),r&&o&&(0,F.jsx)(pE,{diff:o}),r&&!o&&e.args&&Object.keys(e.args).length>0&&(0,F.jsx)(`pre`,{className:`mt-1 px-2 py-1 text-[10px] overflow-x-auto whitespace-pre-wrap break-all`,style:{background:`var(--c-code-bg)`,color:`var(--c-text2)`},children:JSON.stringify(e.args,null,2)})]})}function hE({toolName:e,folder:t,editor:n,dateRange:r,onClose:i}){let[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(!0),l=t?t.split(`/`).pop():null;return(0,S.useEffect)(()=>{c(!0),ta(e,{folder:t||void 0,editor:n||void 0,...jh(r)}).then(e=>{o(e),c(!1)})},[e,t,n,r]),(0,F.jsxs)(`div`,{className:`card p-3 fade-in`,style:{borderColor:`rgba(99,102,241,0.3)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(Oi,{size:12,style:{color:`var(--c-accent)`}}),(0,F.jsx)(`span`,{className:`text-xs font-bold`,style:{color:`var(--c-white)`},children:e}),(0,F.jsxs)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text2)`},children:[a?`${a.length} calls`:`...`,a&&l?` in ${l}`:``]})]}),(0,F.jsx)(`button`,{onClick:i,className:`p-0.5`,style:{color:`var(--c-text2)`},children:(0,F.jsx)(ki,{size:12})})]}),s?(0,F.jsx)(`div`,{className:`text-[11px] py-4 text-center`,style:{color:`var(--c-text3)`},children:`loading...`}):a&&a.length>0?(0,F.jsx)(`div`,{className:`max-h-[500px] overflow-y-auto scrollbar-thin space-y-0.5`,children:a.map((t,n)=>(0,F.jsx)(mE,{call:t,toolName:e,index:n},n))}):(0,F.jsx)(`div`,{className:`text-[11px] py-4 text-center`,style:{color:`var(--c-text3)`},children:`no calls found`})]})}function gE({segments:e,height:t=6}){let n=e.reduce((e,t)=>e+t.value,0);return n===0?null:(0,F.jsx)(`div`,{className:`flex w-full rounded-full overflow-hidden`,style:{height:t},children:e.filter(e=>e.value>0).map((e,t)=>(0,F.jsx)(`div`,{title:`${e.label}: ${J(e.value)}`,className:`h-full transition-all`,style:{width:`${(e.value/n*100).toFixed(1)}%`,background:e.color}},t))})}function _E({overview:e}){let[t,n]=(0,S.useState)(``),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(null),[l,u]=(0,S.useState)(!1),[d,f]=(0,S.useState)(null),[p,m]=(0,S.useState)(null),h=(0,S.useRef)(null),{dark:g}=tr(),_=g?`#a0a0a0`:`#444`,v=g?`#555`:`#999`,y=g?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`,b=g?`#9ca3af`:`#555`,x=e?.editors||[],C=e?.topProjects||[];async function w(){u(!0);let e=jh(a),[n,i]=await Promise.all([Wi({editor:t,folder:r||void 0,limit:500,...e}),Ji({editor:t,folder:r||void 0,...e})]);c(n),m(i),u(!1)}(0,S.useEffect)(()=>{w()},[t,r,a]);let T=s?.topTools?.slice(0,15)||[],E=s?.topModels?.slice(0,10)||[],D=(0,S.useMemo)(()=>{if(!s)return null;let e=s.totalInputTokens+s.totalOutputTokens+s.totalCacheRead+s.totalCacheWrite,t=s.analyzedChats>0?(s.totalMessages/s.analyzedChats).toFixed(1):0,n=s.analyzedChats>0?(s.totalToolCalls/s.analyzedChats).toFixed(1):0,r=s.totalMessages>0?Math.round(e/s.totalMessages):0,i=s.totalInputTokens+s.totalCacheRead+s.totalCacheWrite;return{totalTok:e,msgsPerSession:t,toolsPerSession:n,tokPerMsg:r,cacheHitRate:i>0?(s.totalCacheRead/i*100).toFixed(1):0,outputRatio:i>0?(s.totalOutputTokens/i).toFixed(3):0,aiVsHuman:s.totalUserChars>0?(s.totalAssistantChars/s.totalUserChars).toFixed(1):0}},[s]),O=(0,S.useMemo)(()=>T.length>0?uE(T):[],[T]);function k(e,t){if(t.length>0){let e=T[t[0].index]?.name;e&&f(e)}}return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsxs)($T,{icon:Ci,title:`Deep Analysis`,children:[(0,F.jsxs)(`select`,{value:t,onChange:e=>n(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Editors`}),x.map(e=>(0,F.jsx)(`option`,{value:e.id,children:q(e.id)},e.id))]}),(0,F.jsxs)(`select`,{value:r,onChange:e=>i(e.target.value),className:`px-2 py-1 text-[12px] outline-none max-w-[200px] truncate`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Projects`}),C.map(e=>(0,F.jsx)(`option`,{value:e.fullPath,children:e.name},e.fullPath||e.name))]}),l&&(0,F.jsx)($r,{size:11,className:`animate-spin`,style:{color:`var(--c-text3)`}}),s&&(0,F.jsxs)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text2)`},children:[s.analyzedChats,` sessions analyzed`]}),(0,F.jsx)(`div`,{className:`ml-auto`,children:(0,F.jsx)(Hh,{value:a,onChange:o})})]}),s&&D&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`sessions`,value:s.analyzedChats}),(0,F.jsx)(K,{label:`messages`,value:J(s.totalMessages),sub:`${D.msgsPerSession}/session`}),(0,F.jsx)(K,{label:`tool calls`,value:J(s.totalToolCalls),sub:`${D.toolsPerSession}/session`}),(0,F.jsx)(K,{label:`total tokens`,value:J(D.totalTok),sub:`${J(D.tokPerMsg)}/msg`}),(0,F.jsx)(K,{label:`you wrote`,value:J(s.totalUserChars),sub:`AI: ${D.aiVsHuman}\u00d7 more`}),(0,F.jsx)(K,{label:`est. cost`,value:p&&p.totalCost>0?kh(p.totalCost):`—`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`token flow`}),(0,F.jsxs)(`div`,{className:`space-y-3 mt-2`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] mb-1`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`input tokens`}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-white)`},children:J(s.totalInputTokens+s.totalCacheRead+s.totalCacheWrite)})]}),(0,F.jsx)(gE,{segments:[{label:`Fresh input`,value:s.totalInputTokens,color:`#6366f1`},{label:`Cache write`,value:s.totalCacheWrite,color:`#fbbf24`},{label:`Cache read`,value:s.totalCacheRead,color:`#34d399`}]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-[10px]`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#6366f1`}}),` fresh `,J(s.totalInputTokens)]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#fbbf24`}}),` cache write `,J(s.totalCacheWrite)]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#34d399`}}),` cache read `,J(s.totalCacheRead)]})]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] mb-1`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`output tokens`}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-white)`},children:J(s.totalOutputTokens)})]}),(0,F.jsx)(gE,{segments:[{label:`Output`,value:s.totalOutputTokens,color:`#a78bfa`}]})]}),s.totalCacheWrite>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] mb-1`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`cache write`}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-white)`},children:J(s.totalCacheWrite)})]}),(0,F.jsx)(gE,{segments:[{label:`Cache write`,value:s.totalCacheWrite,color:`#fbbf24`}]})]}),(0,F.jsxs)(`div`,{className:`pt-2`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`div`,{className:`text-[10px] mb-1`,style:{color:`var(--c-text3)`},children:`overall token distribution`}),(0,F.jsx)(gE,{height:10,segments:[{label:`Input`,value:s.totalInputTokens,color:`#6366f1`},{label:`Output`,value:s.totalOutputTokens,color:`#a78bfa`},{label:`Cache Read`,value:s.totalCacheRead,color:`#34d399`},{label:`Cache Write`,value:s.totalCacheWrite,color:`#fbbf24`}]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#6366f1`}}),` in`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#a78bfa`}}),` out`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#34d399`}}),` cache read`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#fbbf24`}}),` cache write`]})]})]})]})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`efficiency insights`}),(0,F.jsxs)(`div`,{className:`space-y-3 mt-2`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[11px] mb-1`,style:{color:`var(--c-text2)`},children:`you vs AI (characters)`}),(0,F.jsx)(gE,{height:8,segments:[{label:`You`,value:s.totalUserChars,color:`#6366f1`},{label:`AI`,value:s.totalAssistantChars,color:`#34d399`}]}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between mt-1 text-[10px]`,children:[(0,F.jsxs)(`span`,{style:{color:`#6366f1`},children:[`You: `,J(s.totalUserChars)]}),(0,F.jsxs)(`span`,{style:{color:`#34d399`},children:[`AI: `,J(s.totalAssistantChars)]})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,F.jsxs)(`div`,{className:`p-2 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ci,{size:9}),` output/input ratio`]}),(0,F.jsxs)(`div`,{className:`text-sm font-bold mt-0.5`,style:{color:`var(--c-white)`},children:[D.outputRatio,`×`]})]}),(0,F.jsxs)(`div`,{className:`p-2 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ai,{size:9}),` cache hit rate`]}),(0,F.jsxs)(`div`,{className:`text-sm font-bold mt-0.5`,style:{color:parseFloat(D.cacheHitRate)>50?`#34d399`:parseFloat(D.cacheHitRate)>20?`#fbbf24`:`var(--c-white)`},children:[D.cacheHitRate,`%`]})]}),(0,F.jsxs)(`div`,{className:`p-2 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(ni,{size:9}),` tokens per message`]}),(0,F.jsx)(`div`,{className:`text-sm font-bold mt-0.5`,style:{color:`var(--c-white)`},children:J(D.tokPerMsg)})]}),(0,F.jsxs)(`div`,{className:`p-2 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Oi,{size:9}),` tools per session`]}),(0,F.jsx)(`div`,{className:`text-sm font-bold mt-0.5`,style:{color:`var(--c-white)`},children:D.toolsPerSession})]})]}),(0,F.jsxs)(`div`,{className:`p-2 rounded-sm text-center`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsx)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:`AI amplification factor`}),(0,F.jsxs)(`div`,{className:`text-lg font-bold`,style:{color:`var(--c-accent)`},children:[D.aiVsHuman,`×`]}),(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[`AI writes `,D.aiVsHuman,`× more than you type`]})]})]})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3 lg:col-span-2`,children:[(0,F.jsxs)($,{children:[`most used tools `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(click to drill down)`})]}),(0,F.jsx)(`div`,{style:{height:Math.max(T.length*20+10,120)},children:T.length>0?(0,F.jsx)(wh,{ref:h,data:{labels:T.map(e=>e.name),datasets:[{data:T.map(e=>e.count),backgroundColor:sE.concat(oE).slice(0,T.length),borderRadius:2}]},options:{indexAxis:`y`,responsive:!0,maintainAspectRatio:!1,onClick:k,scales:{x:{grid:{color:y},ticks:{color:v,font:{size:8,family:cE}}},y:{grid:{display:!1},ticks:{color:_,font:{size:8,family:cE}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:cE,size:10},titleFont:{family:cE,size:10}}}}}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-8`,style:{color:`var(--c-text3)`},children:`no tool calls found`})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`models`}),(0,F.jsx)(`div`,{style:{height:160},children:E.length>0?(0,F.jsx)(Th,{data:{labels:E.map(e=>e.name),datasets:[{data:E.map(e=>e.count),backgroundColor:oE,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:b,font:{size:8,family:cE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:cE,size:10},titleFont:{family:cE,size:10}}}}}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-8`,style:{color:`var(--c-text3)`},children:`no model data`})}),O.length>0&&(0,F.jsxs)(`div`,{className:`mt-3 pt-3`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider mb-2`,style:{color:`var(--c-text3)`},children:`tool categories`}),(0,F.jsx)(`div`,{className:`space-y-1.5`,children:O.map(([e,{tools:t,total:n}])=>(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,F.jsx)(`span`,{className:`truncate flex-1`,style:{color:`var(--c-text2)`},children:e}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-white)`},children:n}),(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,t.length,`)`]})]},e))})]})]})]}),d&&(0,F.jsx)(hE,{toolName:d,folder:r,editor:t,dateRange:a,onClose:()=>f(null)})]})]})}Lf.register(km,Nm,vp,wm,im);var vE=`JetBrains Mono, monospace`;function yE({label:e,a:t,b:n,colorA:r,colorB:i}){let a=parseFloat(t)||0,o=parseFloat(n)||0,s=Math.max(a,o,1);return(0,F.jsxs)(`div`,{className:`grid grid-cols-[1fr_100px_100px] gap-x-3 items-center py-0.5`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(`div`,{className:`text-[11px]`,style:{color:`var(--c-text2)`},children:e}),(0,F.jsxs)(`div`,{className:`text-right`,children:[(0,F.jsx)(`span`,{className:`text-[12px] font-mono font-medium`,style:{color:`var(--c-white)`},children:typeof t==`number`?J(t):t}),(0,F.jsx)(`div`,{className:`h-1 rounded-full mt-0.5 ml-auto`,style:{background:r,width:`${(a/s*100).toFixed(0)}%`}})]}),(0,F.jsxs)(`div`,{className:`text-right`,children:[(0,F.jsx)(`span`,{className:`text-[12px] font-mono font-medium`,style:{color:`var(--c-white)`},children:typeof n==`number`?J(n):n}),(0,F.jsx)(`div`,{className:`h-1 rounded-full mt-0.5 ml-auto`,style:{background:i,width:`${(o/s*100).toFixed(0)}%`}})]})]})}function bE({titleA:e,titleB:t,colorA:n,colorB:r,itemsA:i,itemsB:a,limit:o=8}){return(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h4`,{className:`text-[11px] font-medium uppercase tracking-wider mb-1`,style:{color:n},children:e}),(0,F.jsxs)(`div`,{className:`space-y-0.5`,children:[i.slice(0,o).map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between text-[11px] py-0.5`,children:[(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text)`},children:e.name}),(0,F.jsx)(`span`,{className:`font-mono ml-2`,style:{color:`var(--c-text3)`},children:e.count})]},e.name)),i.length===0&&(0,F.jsx)(`div`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:`none`})]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h4`,{className:`text-[11px] font-medium uppercase tracking-wider mb-1`,style:{color:r},children:t}),(0,F.jsxs)(`div`,{className:`space-y-0.5`,children:[a.slice(0,o).map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between text-[11px] py-0.5`,children:[(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text)`},children:e.name}),(0,F.jsx)(`span`,{className:`font-mono ml-2`,style:{color:`var(--c-text3)`},children:e.count})]},e.name)),a.length===0&&(0,F.jsx)(`div`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:`none`})]})]})]})}function xE({overview:e}){let t=e?.editors||[],[n,r]=(0,S.useState)(t[0]?.id||``),[i,a]=(0,S.useState)(t[1]?.id||``),[o,s]=(0,S.useState)(null),[c,l]=(0,S.useState)(!1),{dark:u}=tr(),d=u?`#888`:`#555`;async function f(){if(!n||!i)return;l(!0);let[e,t,r,a]=await Promise.all([Wi({editor:n,limit:500}),Wi({editor:i,limit:500}),Bi({editor:n,limit:1e3}),Bi({editor:i,limit:1e3})]);s({deepA:e,deepB:t,chatsA:r,chatsB:a}),l(!1)}(0,S.useEffect)(()=>{n&&i&&f()},[n,i]);let p=Oh(n),m=Oh(i),h=q(n),g=q(i),_=(e,t)=>t?(e/t).toFixed(1):`0`,v=(e,t)=>t?(e/t*100).toFixed(0)+`%`:`0%`,y=o?[{label:`Sessions`,a:o.chatsA.total,b:o.chatsB.total},{label:`Messages`,a:o.deepA.totalMessages,b:o.deepB.totalMessages},{label:`Tool Calls`,a:o.deepA.totalToolCalls,b:o.deepB.totalToolCalls},{label:`Input Tokens`,a:o.deepA.totalInputTokens,b:o.deepB.totalInputTokens},{label:`Output Tokens`,a:o.deepA.totalOutputTokens,b:o.deepB.totalOutputTokens},{label:`Cache Read`,a:o.deepA.totalCacheRead,b:o.deepB.totalCacheRead}]:[],b=o?[{label:`Avg Msgs / Session`,a:_(o.deepA.totalMessages,o.deepA.analyzedChats),b:_(o.deepB.totalMessages,o.deepB.analyzedChats)},{label:`Avg Tools / Session`,a:_(o.deepA.totalToolCalls,o.deepA.analyzedChats),b:_(o.deepB.totalToolCalls,o.deepB.analyzedChats)},{label:`Avg Tokens / Session`,a:_(o.deepA.totalInputTokens+o.deepA.totalOutputTokens,o.deepA.analyzedChats),b:_(o.deepB.totalInputTokens+o.deepB.totalOutputTokens,o.deepB.analyzedChats)},{label:`Output / Input Ratio`,a:_(o.deepA.totalOutputTokens,o.deepA.totalInputTokens||1),b:_(o.deepB.totalOutputTokens,o.deepB.totalInputTokens||1)},{label:`Tools / Message`,a:_(o.deepA.totalToolCalls,o.deepA.totalMessages||1),b:_(o.deepB.totalToolCalls,o.deepB.totalMessages||1)},{label:`Cache Hit Rate`,a:v(o.deepA.totalCacheRead,o.deepA.totalInputTokens),b:v(o.deepB.totalCacheRead,o.deepB.totalInputTokens)}]:[],x=[`Sessions`,`Messages`,`Tool Calls`],C=o?[o.chatsA.total,o.deepA.totalMessages,o.deepA.totalToolCalls]:[],w=o?[o.chatsB.total,o.deepB.totalMessages,o.deepB.totalToolCalls]:[],T={labels:x,datasets:[{label:h,data:C,backgroundColor:p+`99`,borderRadius:2},{label:g,data:w,backgroundColor:m+`99`,borderRadius:2}]},E=o?{labels:[`Input`,`Output`,`Cache Read`],datasets:[{label:h,data:[o.deepA.totalInputTokens,o.deepA.totalOutputTokens,o.deepA.totalCacheRead],backgroundColor:p+`99`,borderRadius:2},{label:g,data:[o.deepB.totalInputTokens,o.deepB.totalOutputTokens,o.deepB.totalCacheRead],backgroundColor:m+`99`,borderRadius:2}]}:null,D={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{labels:{color:d,font:{size:9,family:vE},usePointStyle:!0,pointStyle:`circle`,padding:8}},tooltip:{bodyFont:{family:vE,size:10},titleFont:{family:vE,size:10}}},scales:{x:{grid:{display:!1},ticks:{color:d,font:{size:9,family:vE}}},y:{grid:{color:u?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`},ticks:{color:d,font:{size:9,family:vE}}}}};return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsxs)($T,{icon:ur,title:`Compare`,children:[(0,F.jsx)(`select`,{value:n,onChange:e=>r(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:t.map(e=>(0,F.jsx)(`option`,{value:e.id,children:q(e.id)},e.id))}),(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`vs`}),(0,F.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:t.map(e=>(0,F.jsx)(`option`,{value:e.id,children:q(e.id)},e.id))}),c&&(0,F.jsx)($r,{size:11,className:`animate-spin`,style:{color:`var(--c-text3)`}})]}),o&&(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider`,style:{color:`var(--c-text2)`},children:`totals`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px]`,children:[(0,F.jsxs)(`span`,{style:{color:p},children:[`● `,h]}),(0,F.jsxs)(`span`,{style:{color:m},children:[`● `,g]})]})]}),y.map(e=>(0,F.jsx)(yE,{label:e.label,a:e.a,b:e.b,colorA:p,colorB:m},e.label))]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider mb-1.5`,style:{color:`var(--c-text2)`},children:`efficiency`}),b.map(e=>(0,F.jsx)(yE,{label:e.label,a:e.a,b:e.b,colorA:p,colorB:m},e.label))]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider mb-2`,style:{color:`var(--c-text2)`},children:`usage`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(wh,{data:T,options:D})})]}),E&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider mb-2`,style:{color:`var(--c-text2)`},children:`tokens`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(wh,{data:E,options:D})})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider mb-2`,style:{color:`var(--c-text2)`},children:`top tools`}),(0,F.jsx)(bE,{titleA:h,titleB:g,colorA:p,colorB:m,itemsA:o.deepA.topTools,itemsB:o.deepB.topTools,limit:10})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider mb-2`,style:{color:`var(--c-text2)`},children:`models`}),(0,F.jsx)(bE,{titleA:h,titleB:g,colorA:p,colorB:m,itemsA:o.deepA.topModels,itemsB:o.deepB.topModels,limit:8})]})]})]})]})}Lf.register(qf,wm,im,km,Nm,vp);var SE=`JetBrains Mono, monospace`,CE=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`];function wE({overview:e}){let{dark:t}=tr(),n=t?`#888`:`#555`,r=t?`#555`:`#999`,i=t?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`,[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(``),[l,u]=(0,S.useState)(``),[d,f]=(0,S.useState)(null),[p,m]=(0,S.useState)(null),h=dt(),g=e?.editors||[];if((0,S.useEffect)(()=>{let e=jh(d);Promise.all([Hi(e),Ji(e)]).then(([e,t])=>{o(e),m(t)})},[d]),!a)return(0,F.jsx)(wa,{label:`Loading projects...`});let _=a.filter(e=>!(l&&!e.editors[l]||s&&!e.folder.toLowerCase().includes(s.toLowerCase())&&!e.name.toLowerCase().includes(s.toLowerCase()))),v=a.reduce((e,t)=>e+t.totalSessions,0),y=a.reduce((e,t)=>e+t.totalMessages,0),b=a.reduce((e,t)=>e+t.totalInputTokens+t.totalOutputTokens,0),x=Math.max(...a.map(e=>e.totalSessions),1),C={},w={};for(let e of a){for(let t of e.topModels)C[t.name]=(C[t.name]||0)+t.count;for(let[t,n]of Object.entries(e.editors))w[t]=(w[t]||0)+n}let T=Object.entries(C).sort((e,t)=>t[1]-e[1]).slice(0,8),E=Object.entries(w).sort((e,t)=>t[1]-e[1]),D=a.slice(0,10);return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:Ur,title:`Projects`}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`projects`,value:a.length}),(0,F.jsx)(K,{label:`sessions`,value:J(v),onClick:()=>h(`/sessions`)}),(0,F.jsx)(K,{label:`messages`,value:J(y)}),(0,F.jsx)(K,{label:`tokens`,value:J(b)}),(0,F.jsx)(K,{label:`est. cost`,value:p&&p.totalCost>0?kh(p.totalCost):`—`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`top projects `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`by sessions`})]}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(wh,{data:{labels:D.map(e=>e.name),datasets:[{data:D.map(e=>e.totalSessions),backgroundColor:`#6366f1`,borderRadius:3}]},options:{responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{grid:{color:i},ticks:{color:r,font:{size:8,family:SE}}},y:{grid:{display:!1},ticks:{color:n,font:{size:8,family:SE},callback:(e,t)=>D[t]?.name?.length>16?D[t].name.slice(0,15)+`…`:D[t]?.name}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:SE,size:10},titleFont:{family:SE,size:10}}}}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`editors`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Th,{data:{labels:E.map(e=>q(e[0])),datasets:[{data:E.map(e=>e[1]),backgroundColor:E.map(e=>Oh(e[0])),borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:n,font:{size:9,family:SE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:SE,size:10},titleFont:{family:SE,size:10}}}}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`models`}),(0,F.jsx)(`div`,{style:{height:160},children:T.length>0?(0,F.jsx)(Th,{data:{labels:T.map(e=>e[0]),datasets:[{data:T.map(e=>e[1]),backgroundColor:CE,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:n,font:{size:9,family:SE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:SE,size:10},titleFont:{family:SE,size:10}}}}}):(0,F.jsx)(`div`,{className:`text-xs text-center py-12`,style:{color:`var(--c-text3)`},children:`no model data`})})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Editors`}),g.map(e=>(0,F.jsx)(`option`,{value:e.id,children:q(e.id)},e.id))]}),(0,F.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,F.jsx)(ui,{size:12,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,placeholder:`Search projects...`,value:s,onChange:e=>c(e.target.value),className:`w-full pl-7 pr-3 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`}})]}),(0,F.jsx)(`div`,{className:`ml-auto`,children:(0,F.jsx)(Hh,{value:d,onChange:f})})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:_.map(e=>{let t=Object.entries(e.editors).sort((e,t)=>t[1]-e[1]),n=e.totalInputTokens+e.totalOutputTokens,r=e.topModels[0];return(0,F.jsxs)(`div`,{className:`card p-3 cursor-pointer transition hover:opacity-90 flex flex-col gap-2.5`,onClick:()=>h(`/projects/detail?folder=${encodeURIComponent(e.folder)}`),children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0`,children:[(0,F.jsx)(Ur,{size:14,className:`flex-shrink-0 mt-0.5`,style:{color:`var(--c-accent)`}}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[12px] font-bold truncate`,style:{color:`var(--c-white)`},children:e.name}),(0,F.jsx)(`div`,{className:`text-[10px] truncate`,style:{color:`var(--c-text3)`},children:e.folder})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:t.slice(0,4).map(([e])=>(0,F.jsx)(Gh,{source:e,size:12},e))})]}),(0,F.jsx)(`div`,{className:`w-full h-1 rounded-full overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${(e.totalSessions/x*100).toFixed(1)}%`,background:`var(--c-accent)`}})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(ni,{size:9,style:{color:`var(--c-text3)`}}),(0,F.jsxs)(`span`,{style:{color:`var(--c-text2)`},children:[e.totalSessions,` sessions`]}),(0,F.jsxs)(`span`,{className:`ml-auto font-bold`,style:{color:`var(--c-white)`},children:[J(e.totalMessages),` msgs`]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(Oi,{size:9,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`tools`}),(0,F.jsx)(`span`,{className:`ml-auto font-bold`,style:{color:`var(--c-white)`},children:J(e.totalToolCalls)})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(Nr,{size:9,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text2)`},children:r?r.name:`—`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`tok`}),(0,F.jsx)(`span`,{className:`ml-auto font-bold`,style:{color:n>0?`var(--c-white)`:`var(--c-text3)`},children:n>0?J(n):`—`})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 pt-1 text-[10px]`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`div`,{className:`flex items-center gap-1.5 flex-1 min-w-0`,children:t.map(([e,t])=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 truncate`,children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0`,style:{background:Oh(e)}}),(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:q(e)}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-text2)`},children:t})]},e))}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(vr,{size:8}),(0,F.jsx)(`span`,{children:Ah(e.lastSeen)})]})]})]},e.folder)})}),_.length===0&&(0,F.jsx)(`div`,{className:`text-center py-12 text-sm`,style:{color:`var(--c-text3)`},children:`no projects found`})]})}var TE={"A+":`#22c55e`,A:`#22c55e`,"B+":`#4ade80`,B:`#4ade80`,"C+":`#facc15`,C:`#facc15`,"D+":`#f97316`,D:`#f97316`,F:`#ef4444`},EE={"Repo Hygiene":_r,"Grounding Docs":Br,Testing:Hr,"Agent Configs":hr,"AI Context":ei,"Prompts & Skills":si,MCP:oi,"AI Dependencies":ii,"AI Deps":ii};function DE({missing:e}){let[t,n]=(0,S.useState)(!1),r=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(!t)return;let e=e=>{r.current&&!r.current.contains(e.target)&&n(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[t]);let i=e.filter(e=>e.weight>0),a=i.length>0?i:e.slice(0,5);return a.length===0?null:(0,F.jsxs)(`span`,{ref:r,className:`relative flex-shrink-0`,children:[(0,F.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n(!t)},className:`flex items-center justify-center w-4 h-4 rounded-full transition hover:opacity-80`,style:{color:`var(--c-text3)`,background:`var(--c-bg3)`},children:(0,F.jsx)(Jr,{size:10})}),t&&(0,F.jsxs)(`div`,{className:`absolute right-0 top-6 z-50 w-64 p-2.5 rounded shadow-lg`,style:{background:`var(--c-bg)`,border:`1px solid var(--c-border)`,boxShadow:`0 4px 24px rgba(0,0,0,0.3)`},children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium mb-1.5`,style:{color:`var(--c-white)`},children:`How to improve`}),(0,F.jsx)(`div`,{className:`space-y-1`,children:a.map(e=>(0,F.jsxs)(`div`,{className:`text-[11px]`,style:{color:`var(--c-text2)`},children:[(0,F.jsxs)(`span`,{style:{color:`var(--c-text)`},children:[`+ `,e.label]}),e.weight>0&&(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[` (`,e.weight,`pt)`]})]},e.id))})]})]})}function OE({folder:e}){console.log(`AiAuditCard rendering, folder:`,e);let[t,n]=(0,S.useState)(null),[r,i]=(0,S.useState)(!1),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(new Set),l=async()=>{if(e){i(!0),o(null);try{let t=await na(e);if(t.error)throw Error(t.error);n(t)}catch(e){o(e.message)}i(!1)}};if((0,S.useEffect)(()=>{console.log(`AiAuditCard useEffect triggered, folder:`,e),l()},[e]),r)return(0,F.jsx)(`div`,{className:`card p-4`,children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)($r,{size:14,className:`animate-spin`,style:{color:`var(--c-accent)`}}),(0,F.jsx)(`span`,{className:`text-[12px]`,style:{color:`var(--c-text2)`},children:`Running AI readiness audit...`})]})});if(a)return(0,F.jsx)(`div`,{className:`card p-4`,children:(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(wi,{size:14,style:{color:`#ef4444`}}),(0,F.jsxs)(`span`,{className:`text-[12px]`,style:{color:`var(--c-text2)`},children:[`Audit failed: `,a]})]}),(0,F.jsxs)(`button`,{onClick:l,className:`flex items-center gap-1.5 px-2.5 py-1 text-[11px] rounded transition hover:opacity-80`,style:{color:`var(--c-text2)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(li,{size:10}),`Retry`]})]})});if(!t)return null;let u=TE[t.grade]||`var(--c-text2)`,d=t.sections||{},f=t.findings||[],p={};for(let e of f){let t=e.section||`Other`;p[t]||(p[t]=[]),p[t].push(e)}return(0,F.jsxs)(`div`,{className:`card p-4 space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(hi,{size:16,style:{color:u}}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)($,{children:`ai readiness audit`}),(0,F.jsxs)(`div`,{className:`text-[10px] -mt-1.5`,style:{color:`var(--c-text3)`},children:[`powered by `,(0,F.jsx)(`code`,{style:{fontFamily:`JetBrains Mono, monospace`},children:`npx check-ai`})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[(0,F.jsxs)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:[t.checks?.passed||0,`/`,t.checks?.total||0,` checks · `,t.points?.earned||0,`/`,t.points?.max||0,` pts`]}),(0,F.jsx)(`button`,{onClick:l,className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded transition hover:opacity-80`,style:{color:`var(--c-text2)`,border:`1px solid var(--c-border)`},children:(0,F.jsx)(li,{size:10})})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(`div`,{className:`w-11 h-11 rounded-lg flex items-center justify-center text-base font-black flex-shrink-0`,style:{background:`${u}15`,color:u,border:`1.5px solid ${u}30`},children:t.grade}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,F.jsx)(`span`,{className:`text-base font-bold`,style:{color:`var(--c-white)`},children:t.score}),(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:`/10`}),(0,F.jsx)(`span`,{className:`text-[11px] ml-1`,style:{color:`var(--c-text2)`},children:t.label})]}),(0,F.jsx)(`div`,{className:`w-full h-2 rounded-full overflow-hidden mt-1`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${((t.score||0)/10*100).toFixed(1)}%`,background:u}})})]})]}),(0,F.jsx)(`div`,{children:Object.entries(d).map(([e,t])=>{let n=EE[e]||Br,r=p[e]||[],i=r.filter(e=>e.found),a=r.filter(e=>!e.found),o=t.pct||0,l=o>=70?`#22c55e`:o>=40?`#facc15`:o>0?`#f97316`:`var(--c-text3)`,u=[];for(let e of i)e.detail?u.push(e.detail):e.matchedPath?u.push(e.matchedPath):e.matches&&e.matches.length>0?u.push(e.matches.join(`, `)):u.push(e.label);let d=u.length>0?u.slice(0,3).join(` · `)+(u.length>3?` …`:``):`none detected`,f=s.has(e);return(0,F.jsxs)(`div`,{style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5 py-2 cursor-pointer transition hover:bg-[var(--c-bg3)]`,onClick:()=>c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),children:[f?(0,F.jsx)(Cr,{size:12,style:{color:`var(--c-text3)`,flexShrink:0}}):(0,F.jsx)(wr,{size:12,style:{color:`var(--c-text3)`,flexShrink:0}}),(0,F.jsx)(n,{size:14,style:{color:`var(--c-text3)`,flexShrink:0}}),(0,F.jsx)(`span`,{className:`text-[12px] font-medium w-32 flex-shrink-0`,style:{color:`var(--c-white)`},children:e}),(0,F.jsx)(`span`,{className:`text-[11px] flex-1 truncate`,style:{color:i.length>0?`var(--c-text2)`:`var(--c-text3)`},children:d}),(0,F.jsxs)(`span`,{className:`text-[11px] flex-shrink-0`,style:{color:`var(--c-text3)`},children:[i.length,`/`,r.length]}),(0,F.jsx)(`div`,{className:`w-20 h-2 rounded-full overflow-hidden flex-shrink-0`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${o}%`,background:l}})}),(0,F.jsxs)(`span`,{className:`text-[11px] w-9 text-right font-bold flex-shrink-0`,style:{color:l},children:[o,`%`]}),a.length>0&&(0,F.jsx)(DE,{missing:a})]}),f&&i.length>0&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-0.5 pb-2 pl-12`,children:i.map(e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px] py-0.5`,children:[(0,F.jsx)(Dr,{size:10,style:{color:`#22c55e`,flexShrink:0}}),(0,F.jsx)(`span`,{style:{color:`var(--c-text)`},children:e.label}),e.matchedPath&&(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:e.matchedPath}),e.detail&&(0,F.jsxs)(`span`,{style:{color:`var(--c-text2)`},children:[`— `,e.detail]})]},e.id))})]},e)})})]})}Lf.register(qf,wm,im,km,Nm,vp);var kE=`JetBrains Mono, monospace`,AE=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`],jE=[`#10b981`,`#34d399`,`#6ee7b7`,`#a7f3d0`,`#d1fae5`,`#ecfdf5`,`#b8f0d8`,`#7ce0b8`,`#4ade80`,`#22c55e`];function ME(){let[e]=zn(),t=dt(),n=e.get(`folder`),{dark:r}=tr(),i=r?`#888`:`#555`,a=r?`#555`:`#999`,o=r?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`,[s,c]=(0,S.useState)(null),[l,u]=(0,S.useState)([]),[d,f]=(0,S.useState)(!0),[p,m]=(0,S.useState)(``),[h,g]=(0,S.useState)(null),[_,v]=(0,S.useState)(null),[y,b]=(0,S.useState)(null);(0,S.useEffect)(()=>{n&&(f(!0),Promise.all([Hi(),Bi({folder:n,limit:1e3}),Ji({folder:n})]).then(([e,t,r])=>{let i=e.find(e=>e.folder===n);c(i||null),u(t.chats||[]),v(r),i&&b(new Set(Object.keys(i.editors))),f(!1)}))},[n]);let x=(0,S.useMemo)(()=>y?l.filter(e=>y.has(e.source)):l,[l,y]),C=(0,S.useMemo)(()=>{if(!p)return x;let e=p.toLowerCase();return x.filter(t=>t.name&&t.name.toLowerCase().includes(e)||t.topModel&&t.topModel.toLowerCase().includes(e)||t.source&&t.source.toLowerCase().includes(e))},[x,p]),w=e=>{b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};if(!n)return(0,F.jsx)(`div`,{className:`text-sm py-12 text-center`,style:{color:`var(--c-text3)`},children:`no project specified`});if(d)return(0,F.jsx)(wa,{label:`Loading project...`});if(!s)return(0,F.jsx)(`div`,{className:`text-sm py-12 text-center`,style:{color:`var(--c-text3)`},children:`project not found`});let T=Object.entries(s.editors).sort((e,t)=>t[1]-e[1]),E=!y||y.size===T.length,D=x.length,O={},k={};for(let e of x)O[e.source]=(O[e.source]||0)+1,e.topModel&&(k[e.topModel]=(k[e.topModel]||0)+1);let A=Object.entries(k).sort((e,t)=>t[1]-e[1]).slice(0,10),j=Math.max(...Object.values(O),1),ee=s.totalInputTokens+s.totalOutputTokens,te=s.totalInputTokens>0?(s.totalOutputTokens/s.totalInputTokens).toFixed(1):`0`,ne=E?s.totalSessions:D,re=E&&s.totalSessions>0?(s.totalMessages/s.totalSessions).toFixed(1):0;return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsxs)(`div`,{className:`card p-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`button`,{onClick:()=>t(`/projects`),className:`flex items-center gap-1 text-[12px] transition mt-0.5 flex-shrink-0`,style:{color:`var(--c-text3)`},children:(0,F.jsx)(dr,{size:12})}),(0,F.jsx)(Ur,{size:18,className:`flex-shrink-0 mt-0.5`,style:{color:`var(--c-accent)`}}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`h1`,{className:`text-sm font-bold truncate`,style:{color:`var(--c-white)`},children:s.name}),(0,F.jsx)(`div`,{className:`text-[11px] truncate`,style:{color:`var(--c-text3)`},children:s.folder})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-1.5 flex-shrink-0`,children:T.map(([e])=>(0,F.jsx)(Gh,{source:e,size:14},e))})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4 mt-3 pt-3 text-[11px]`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(vr,{size:9}),(0,F.jsx)(`span`,{children:Ah(s.firstSeen)}),(0,F.jsx)(`span`,{children:`→`}),(0,F.jsx)(`span`,{children:Ah(s.lastSeen)})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-1.5 ml-auto`,children:T.map(([e,t])=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:Oh(e)}}),(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:q(e)}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-text2)`},children:t})]},e))})]})]}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`sessions`,value:ne,sub:E?``:`filtered`}),(0,F.jsx)(K,{label:`messages`,value:J(s.totalMessages),sub:`${re} avg/session`}),(0,F.jsx)(K,{label:`tool calls`,value:J(s.totalToolCalls),sub:(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,F.jsx)(Oi,{size:8}),` invocations`]})}),(0,F.jsx)(K,{label:`tokens`,value:J(ee),sub:`${te}\u00d7 out/in`}),s.totalCacheRead>0&&(0,F.jsx)(K,{label:`cache read`,value:J(s.totalCacheRead),sub:`write: ${J(s.totalCacheWrite)}`}),(0,F.jsx)(K,{label:`you wrote`,value:J(s.totalUserChars),sub:`AI: ${J(s.totalAssistantChars)}`}),(0,F.jsx)(K,{label:`est. cost`,value:_&&_.totalCost>0?kh(_.totalCost):`—`,sub:_&&_.byModel.length>0?`${_.byModel.length} model${_.byModel.length===1?``:`s`}`:void 0})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`editors`}),(0,F.jsx)(`div`,{className:`space-y-1.5 mt-1`,children:T.map(([e,t])=>{let n=y?y.has(e):!0,r=O[e]||0;return(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>w(e),className:`accent-[var(--c-accent)] w-3 h-3 flex-shrink-0 cursor-pointer`}),(0,F.jsx)(Gh,{source:e,size:11}),(0,F.jsx)(`span`,{className:`text-[11px] truncate flex-1 cursor-pointer select-none`,onClick:()=>w(e),style:{color:n?`var(--c-text2)`:`var(--c-text3)`,opacity:n?1:.4},children:q(e)}),(0,F.jsx)(`div`,{className:`w-16 h-3 rounded-sm overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-sm transition-all`,style:{width:`${(r/j*100).toFixed(0)}%`,background:n?Oh(e):`var(--c-text3)`,opacity:n?1:.2}})}),(0,F.jsx)(`span`,{className:`text-[11px] w-6 text-right font-bold`,style:{color:n?`var(--c-white)`:`var(--c-text3)`,opacity:n?1:.4},children:r})]},e)})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`models`}),A.length>0?(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Th,{data:{labels:A.map(e=>e[0]),datasets:[{data:A.map(e=>e[1]),backgroundColor:AE,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:i,font:{size:8,family:kE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:kE,size:10},titleFont:{family:kE,size:10}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`no model data`})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`top tools `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,J(s.totalToolCalls),`)`]})]}),s.topTools.length>0?(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(wh,{data:{labels:s.topTools.map(e=>e.name),datasets:[{data:s.topTools.map(e=>e.count),backgroundColor:jE.slice(0,s.topTools.length),borderRadius:2}]},options:{responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{grid:{color:o},ticks:{color:a,font:{size:8,family:kE}}},y:{grid:{display:!1},ticks:{color:i,font:{size:8,family:kE}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:kE,size:10},titleFont:{family:kE,size:10}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`no tool data`})]})]}),console.log(`Rendering AiAuditCard, folder:`,n),(0,F.jsx)(OE,{folder:n}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,F.jsxs)($,{children:[`sessions `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,C.length,E?``:` of ${l.length}`,`)`]})]}),(0,F.jsxs)(`div`,{className:`relative max-w-xs flex-1`,children:[(0,F.jsx)(ui,{size:11,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,placeholder:`filter sessions...`,value:p,onChange:e=>m(e.target.value),className:`w-full pl-7 pr-3 py-1 text-[12px] outline-none rounded-sm`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`}})]})]}),(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`editor`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`name`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`mode`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`model`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`context`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`est. cost`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`updated`})]})}),(0,F.jsx)(`tbody`,{children:C.map(e=>(0,F.jsxs)(`tr`,{className:`cursor-pointer transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>g(e.id),children:[(0,F.jsx)(`td`,{className:`py-2 px-3`,children:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Gh,{source:e.source,size:12}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:q(e.source)})]})}),(0,F.jsxs)(`td`,{className:`py-2 px-3 font-medium truncate max-w-[280px]`,style:{color:`var(--c-white)`},children:[e.name||(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`Untitled`}),e.encrypted&&(0,F.jsx)(`span`,{className:`ml-1.5 text-[10px] text-yellow-500/60`,children:`locked`})]}),(0,F.jsx)(`td`,{className:`py-2 px-3`,style:{color:`var(--c-text2)`},children:e.mode||``}),(0,F.jsx)(`td`,{className:`py-2 px-3 font-mono truncate max-w-[150px]`,style:{color:`var(--c-text2)`},title:e.topModel||``,children:e.topModel||``}),(0,F.jsx)(`td`,{className:`py-2 px-3`,children:e.bubbleCount>=500?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 font-bold`,style:{color:`#ef4444`},children:[(0,F.jsx)(wi,{size:9}),e.bubbleCount,` msgs`]}):e.bubbleCount>=100?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 font-bold`,style:{color:`#f59e0b`},children:[(0,F.jsx)(wi,{size:9}),e.bubbleCount,` msgs`]}):(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[e.bubbleCount||0,` msgs`]})}),(0,F.jsx)(`td`,{className:`py-2 px-3 font-mono text-right`,style:{color:e.cost>0?`var(--c-text2)`:`var(--c-text3)`},children:e.cost>0?kh(e.cost):``}),(0,F.jsx)(`td`,{className:`py-2 px-3 whitespace-nowrap`,style:{color:`var(--c-text3)`},children:Ah(e.lastUpdatedAt||e.createdAt)})]},e.id))})]}),C.length===0&&(0,F.jsx)(`div`,{className:`text-center py-8 text-sm`,style:{color:`var(--c-text3)`},children:`no sessions found`})]})]}),(0,F.jsx)(XT,{chatId:h,onClose:()=>g(null)})]})}Lf.register(qf,km,Nm,cp,op,vp,wm,im,Yp);var NE=`JetBrains Mono, monospace`,PE=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`,`#2dd4bf`,`#38bdf8`,`#60a5fa`,`#a3e635`];function FE({overview:e}){let{dark:t}=tr(),n=dt(),r=t?`#555`:`#999`,i=t?`#777`:`#555`,a=t?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`,[o,s]=(0,S.useState)(null),[c,l]=(0,S.useState)(!0),[u,d]=(0,S.useState)(``),[f,p]=(0,S.useState)(null),[m,h]=(0,S.useState)(null),g=e?.editors||[];if((0,S.useEffect)(()=>{l(!0),qi({editor:u,...jh(f)}).then(e=>{s(e),l(!1)}).catch(()=>l(!1))},[u,f]),!o)return(0,F.jsx)(wa,{label:`Loading cost data...`});let{totalCost:_,byModel:v,byEditor:y,byProject:b,monthly:x,topSessions:C,summary:w,unknownModels:T}=o,E=v.length>0?{labels:v.slice(0,10).map(e=>e.model),datasets:[{data:v.slice(0,10).map(e=>Math.round(e.cost*100)/100),backgroundColor:PE,borderWidth:0}]}:null,D=y.length>0?{labels:y.map(e=>q(e.editor)),datasets:[{data:y.map(e=>Math.round(e.cost*100)/100),backgroundColor:y.map(e=>Oh(e.editor)),borderWidth:0}]}:null,O=x.length>1?{labels:x.map(e=>e.month),datasets:[{label:`Cost ($)`,data:x.map(e=>e.cost),borderColor:`#6366f1`,backgroundColor:`rgba(99,102,241,0.1)`,borderWidth:2,tension:.3,pointRadius:3,pointHoverRadius:5,fill:!0}]}:null,k=b.length>0?{labels:b.slice(0,10).map(e=>e.name),datasets:[{data:b.slice(0,10).map(e=>Math.round(e.cost*100)/100),backgroundColor:`#818cf8`,borderRadius:3}]}:null,A={responsive:!0,maintainAspectRatio:!1,cutout:`55%`,plugins:{legend:{position:`right`,labels:{color:i,font:{size:9,family:NE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:NE,size:10},titleFont:{family:NE,size:10},callbacks:{label:e=>` ${e.label}: $${e.raw.toFixed(2)}`}}}};return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsxs)($T,{icon:Ir,title:`Cost Analysis`,children:[(0,F.jsxs)(`select`,{value:u,onChange:e=>d(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Editors`}),g.map(e=>(0,F.jsxs)(`option`,{value:e.id,children:[q(e.id),` (`,e.count,`)`]},e.id))]}),(0,F.jsx)(`div`,{className:`ml-auto`,children:(0,F.jsx)(Hh,{value:f,onChange:p})})]}),(0,F.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-2 text-[11px] rounded`,style:{background:`rgba(234,179,8,0.06)`,border:`1px solid rgba(234,179,8,0.15)`,color:`#ca8a04`},children:[(0,F.jsx)(wi,{size:12,className:`mt-0.5 shrink-0`}),(0,F.jsxs)(`span`,{children:[`These are `,(0,F.jsx)(`strong`,{children:`estimates`}),` based on public API list prices. Actual costs may be lower if you use discounted plans, commitments, prompt caching, batching, or provider credits. Token counts for some editors are approximated from character counts (~4 chars/token).`]})]}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`total est. cost`,value:kh(_),sub:`all models`}),(0,F.jsx)(K,{label:`avg / session`,value:kh(w.avgPerSession),sub:`${J(w.totalSessions)} sessions`}),(0,F.jsx)(K,{label:`avg / day`,value:kh(w.avgPerDay),sub:`${w.totalDays} days`}),(0,F.jsx)(K,{label:`models`,value:v.length,sub:T.length>0?`${T.length} unknown`:`all priced`}),(0,F.jsx)(K,{label:`top model`,value:v[0]?.model||`—`,sub:v[0]?kh(v[0].cost):``}),(0,F.jsx)(K,{label:`top editor`,value:y[0]?q(y[0].editor):`—`,sub:y[0]?kh(y[0].cost):``})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3 lg:col-span-2`,children:[(0,F.jsx)($,{children:`cost by model`}),E?(0,F.jsx)(`div`,{style:{height:220},children:(0,F.jsx)(wh,{data:{labels:v.slice(0,12).map(e=>e.model),datasets:[{data:v.slice(0,12).map(e=>Math.round(e.cost*100)/100),backgroundColor:PE,borderRadius:3}]},options:{responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{grid:{color:a},ticks:{color:r,font:{size:9,family:NE},callback:e=>`$`+e}},y:{grid:{display:!1},ticks:{color:i,font:{size:9,family:NE}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:NE,size:10},titleFont:{family:NE,size:10},callbacks:{label:e=>` $${e.raw.toFixed(2)}`}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`no cost data`})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`cost by editor`}),D?(0,F.jsx)(`div`,{style:{height:220},children:(0,F.jsx)(Th,{data:D,options:A})}):(0,F.jsx)(`div`,{className:`text-[11px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`no cost data`})]})]}),O&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`monthly cost trend`}),(0,F.jsx)(`div`,{style:{height:180},children:(0,F.jsx)(Ch,{data:O,options:{responsive:!0,maintainAspectRatio:!1,interaction:{mode:`index`,intersect:!1},scales:{x:{grid:{display:!1},ticks:{color:r,font:{size:9,family:NE},maxRotation:0,maxTicksLimit:12}},y:{beginAtZero:!0,grid:{color:a},ticks:{color:r,font:{size:9,family:NE},callback:e=>`$`+e}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:NE,size:10},titleFont:{family:NE,size:10},callbacks:{label:e=>` $${e.raw.toFixed(2)} (${x[e.dataIndex]?.sessions||0} sessions)`}}}}})})]}),k&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`cost by project (top 10)`}),(0,F.jsx)(`div`,{style:{height:220},children:(0,F.jsx)(wh,{data:k,options:{responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{grid:{color:a},ticks:{color:r,font:{size:9,family:NE},callback:e=>`$`+e}},y:{grid:{display:!1},ticks:{color:i,font:{size:9,family:NE}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:NE,size:10},titleFont:{family:NE,size:10},callbacks:{label:e=>` $${e.raw.toFixed(2)}`}}}}})})]}),(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsx)(`div`,{className:`px-3 py-2`,style:{borderBottom:`1px solid var(--c-border)`},children:(0,F.jsx)($,{children:`model breakdown`})}),(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`model`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`input tokens`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`output tokens`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`cache read`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`cache write`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`est. cost`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`% of total`})]})}),(0,F.jsx)(`tbody`,{children:v.map((e,t)=>(0,F.jsxs)(`tr`,{style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`td`,{className:`py-2 px-3 font-mono font-medium`,style:{color:`var(--c-white)`},children:[(0,F.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full mr-1.5`,style:{background:PE[t%PE.length]}}),e.model]}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono`,style:{color:`var(--c-text2)`},children:J(e.inputTokens)}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono`,style:{color:`var(--c-text2)`},children:J(e.outputTokens)}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono`,style:{color:`var(--c-text3)`},children:e.cacheRead>0?J(e.cacheRead):`—`}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono`,style:{color:`var(--c-text3)`},children:e.cacheWrite>0?J(e.cacheWrite):`—`}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono font-medium`,style:{color:`var(--c-white)`},children:kh(e.cost)}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono`,style:{color:`var(--c-text3)`},children:_>0?(e.cost/_*100).toFixed(1)+`%`:`—`})]},e.model))})]}),v.length===0&&(0,F.jsx)(`div`,{className:`text-center py-8 text-sm`,style:{color:`var(--c-text3)`},children:`no model cost data`})]}),C.length>0&&(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsx)(`div`,{className:`px-3 py-2`,style:{borderBottom:`1px solid var(--c-border)`},children:(0,F.jsx)($,{children:`most expensive sessions`})}),(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`editor`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`name`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`project`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`model`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`msgs`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`est. cost`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`date`})]})}),(0,F.jsx)(`tbody`,{children:C.slice(0,30).map(e=>(0,F.jsxs)(`tr`,{className:`cursor-pointer transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>h(e.id),children:[(0,F.jsx)(`td`,{className:`py-2 px-3`,children:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Gh,{source:e.source,size:12}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:q(e.source)})]})}),(0,F.jsx)(`td`,{className:`py-2 px-3 font-medium truncate max-w-[200px]`,style:{color:`var(--c-white)`},children:e.name||(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`Untitled`})}),(0,F.jsx)(`td`,{className:`py-2 px-3 truncate max-w-[140px]`,style:{color:`var(--c-text2)`},title:e.folder,children:e.folder?(0,F.jsx)(`span`,{className:`cursor-pointer hover:underline`,style:{color:`var(--c-accent)`},onClick:t=>{t.stopPropagation(),n(`/projects/detail?folder=${encodeURIComponent(e.folder)}`)},children:e.folder.split(`/`).pop()}):``}),(0,F.jsx)(`td`,{className:`py-2 px-3 font-mono truncate max-w-[140px]`,style:{color:`var(--c-text2)`},title:e.model,children:e.model}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right`,style:{color:`var(--c-text3)`},children:e.messages}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono font-medium`,style:{color:`var(--c-white)`},children:kh(e.cost)}),(0,F.jsx)(`td`,{className:`py-2 px-3 whitespace-nowrap`,style:{color:`var(--c-text3)`},children:Ah(e.lastUpdatedAt)})]},e.id))})]})]}),T.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[(0,F.jsx)(wi,{size:11,className:`inline mr-1`,style:{color:`#f59e0b`}}),`unpriced models (`,T.length,`)`]}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-2`,children:T.map(e=>(0,F.jsx)(`span`,{className:`text-[11px] px-2 py-0.5 font-mono`,style:{background:`rgba(245,158,11,0.08)`,color:`#f59e0b`,border:`1px solid rgba(245,158,11,0.2)`},children:e},e))})]}),(0,F.jsx)(XT,{chatId:m,onClose:()=>h(null)})]})}Lf.register(qf,wm,im,km,Nm,vp,cp,op,Yp);var IE=[{label:`Sessions per editor`,sql:`SELECT source, count() AS count FROM {{sessions_v}} AS c GROUP BY source ORDER BY count DESC`},{label:`Top 10 projects`,sql:`SELECT project, count() AS sessions, sum(total_msgs) AS messages FROM {{sessions_v}} AS c WHERE project != '' GROUP BY project ORDER BY sessions DESC LIMIT 10`},{label:`Messages per day`,sql:`SELECT toDate(ts) AS day, count() AS count FROM {{messages}} GROUP BY day ORDER BY day`},{label:`Top models`,sql:`SELECT model, count() AS count FROM {{messages}} WHERE model NOT IN ('', '<synthetic>') GROUP BY model ORDER BY count DESC LIMIT 10`},{label:`Top tools`,sql:`SELECT tool_name, count() AS count FROM {{tool_calls}} GROUP BY tool_name ORDER BY count DESC LIMIT 15`},{label:`Token usage by editor`,sql:`SELECT source, sum(input_tokens) AS input_tokens, sum(output_tokens) AS output_tokens FROM {{sessions_v}} AS c GROUP BY source ORDER BY input_tokens DESC`},{label:`Sessions by mode`,sql:`SELECT mode, count() AS count FROM {{sessions_v}} AS c WHERE mode != '' GROUP BY mode ORDER BY count DESC`},{label:`Hourly distribution`,sql:`SELECT toHour(ts) AS hour, count() AS count FROM {{messages}} GROUP BY hour ORDER BY hour`},{label:`Full-text search`,sql:`SELECT session_id, user_id, any(source) AS source, count() AS hits FROM {{messages}} WHERE text_ngram LIKE '%clickhouse%' GROUP BY session_id, user_id ORDER BY hits DESC LIMIT 10`}],LE=[{label:`Sessions per editor`,sql:`SELECT source, count() AS count FROM chats GROUP BY source ORDER BY count DESC`},{label:`Top 10 projects`,sql:`SELECT folder, count() AS sessions, sum(bubble_count) AS messages FROM chats WHERE folder IS NOT NULL GROUP BY folder ORDER BY sessions DESC LIMIT 10`},{label:`Messages per day`,sql:`SELECT toDate(toDateTime(intDiv(created_at, 1000))) AS day, count() AS count FROM chats WHERE created_at IS NOT NULL GROUP BY day ORDER BY day`},{label:`Top models`,sql:`SELECT model, count() AS count FROM messages WHERE model IS NOT NULL GROUP BY model ORDER BY count DESC LIMIT 10`},{label:`Top tools`,sql:`SELECT tool_name, count() AS count FROM tool_calls GROUP BY tool_name ORDER BY count DESC LIMIT 15`},{label:`Token usage by editor`,sql:`SELECT c.source AS source, sum(cs.total_input_tokens) AS input_tokens, sum(cs.total_output_tokens) AS output_tokens FROM chat_stats AS cs JOIN chats AS c ON c.id = cs.chat_id GROUP BY c.source ORDER BY input_tokens DESC`},{label:`Sessions by mode`,sql:`SELECT mode, count() AS count FROM chats WHERE mode IS NOT NULL GROUP BY mode ORDER BY count DESC`},{label:`Hourly distribution`,sql:`SELECT toHour(toDateTime(intDiv(created_at, 1000))) AS hour, count() AS count FROM chats WHERE created_at IS NOT NULL GROUP BY hour ORDER BY hour`}];function RE(e,t){return e.replace(/\{\{([a-z_]+)\}\}/g,(e,n)=>t[n]??e)}function zE(){let{dark:e}=tr(),[t,n]=(0,S.useState)(`loading`),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(null),[l,u]=(0,S.useState)(!1),[d,f]=(0,S.useState)(null),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)(`bar`),[_,v]=(0,S.useState)(null),y=(0,S.useRef)(null);(0,S.useEffect)(()=>{$i().then(e=>{f(e);let t=e?.tables,r=e?.rooms,a=r?.sessions?IE.map(e=>({...e,sql:RE(e.sql,r)})):Array.isArray(t)&&t.includes(`chats`)?LE:null;n(a),a&&i(e=>e===``||e===IE[0].sql||e===LE[0].sql?a[0].sql:e)}).catch(()=>n(null))},[]);let b=async()=>{if(!r.trim()||l)return;u(!0),c(null),o(null);let e=performance.now();try{let t=await Qi(r.trim());v((performance.now()-e).toFixed(0)),t.error?c(t.error):o(t)}catch(e){c(e.message),v(null)}u(!1)},x=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),b())},C=()=>{if(!a)return;let e=a.columns.join(` `),t=a.rows.map(e=>a.columns.map(t=>e[t]??``).join(` `));navigator.clipboard.writeText([e,...t].join(`
|
|
69
|
+
`).length-8,` more lines`]})]})}function mE({call:e,toolName:t,index:n}){let[r,i]=(0,S.useState)(!1),a=dE(t,e.args),o=fE(e.args),s=e.folder?e.folder.split(`/`).pop():null,c=o||e.args&&Object.keys(e.args).length>0;return(0,F.jsxs)(`div`,{className:`px-2 py-1 text-[11px]`,style:{background:n%2==0?`var(--c-code-bg)`:`transparent`},children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-2 cursor-pointer`,onClick:()=>c&&i(!r),children:[(0,F.jsx)(Gh,{source:e.source,size:10}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[a&&(0,F.jsx)(`div`,{className:`font-mono truncate`,style:{color:`var(--c-white)`},title:a,children:a}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(`span`,{children:q(e.source)}),s&&(0,F.jsxs)(`span`,{children:[`· `,s]}),e.timestamp&&(0,F.jsxs)(`span`,{children:[`· `,new Date(e.timestamp).toLocaleDateString()]}),c&&(0,F.jsx)(`span`,{children:r?`▾`:`▸`})]})]})]}),r&&o&&(0,F.jsx)(pE,{diff:o}),r&&!o&&e.args&&Object.keys(e.args).length>0&&(0,F.jsx)(`pre`,{className:`mt-1 px-2 py-1 text-[10px] overflow-x-auto whitespace-pre-wrap break-all`,style:{background:`var(--c-code-bg)`,color:`var(--c-text2)`},children:JSON.stringify(e.args,null,2)})]})}function hE({toolName:e,folder:t,editor:n,dateRange:r,onClose:i}){let[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(!0),l=t?t.split(`/`).pop():null;return(0,S.useEffect)(()=>{c(!0),ta(e,{folder:t||void 0,editor:n||void 0,...jh(r)}).then(e=>{o(e),c(!1)})},[e,t,n,r]),(0,F.jsxs)(`div`,{className:`card p-3 fade-in`,style:{borderColor:`rgba(99,102,241,0.3)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(Oi,{size:12,style:{color:`var(--c-accent)`}}),(0,F.jsx)(`span`,{className:`text-xs font-bold`,style:{color:`var(--c-white)`},children:e}),(0,F.jsxs)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text2)`},children:[a?`${a.length} calls`:`...`,a&&l?` in ${l}`:``]})]}),(0,F.jsx)(`button`,{onClick:i,className:`p-0.5`,style:{color:`var(--c-text2)`},children:(0,F.jsx)(ki,{size:12})})]}),s?(0,F.jsx)(`div`,{className:`text-[11px] py-4 text-center`,style:{color:`var(--c-text3)`},children:`loading...`}):a&&a.length>0?(0,F.jsx)(`div`,{className:`max-h-[500px] overflow-y-auto scrollbar-thin space-y-0.5`,children:a.map((t,n)=>(0,F.jsx)(mE,{call:t,toolName:e,index:n},n))}):(0,F.jsx)(`div`,{className:`text-[11px] py-4 text-center`,style:{color:`var(--c-text3)`},children:`no calls found`})]})}function gE({segments:e,height:t=6}){let n=e.reduce((e,t)=>e+t.value,0);return n===0?null:(0,F.jsx)(`div`,{className:`flex w-full rounded-full overflow-hidden`,style:{height:t},children:e.filter(e=>e.value>0).map((e,t)=>(0,F.jsx)(`div`,{title:`${e.label}: ${J(e.value)}`,className:`h-full transition-all`,style:{width:`${(e.value/n*100).toFixed(1)}%`,background:e.color}},t))})}function _E({overview:e}){let[t,n]=(0,S.useState)(``),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(null),[l,u]=(0,S.useState)(!1),[d,f]=(0,S.useState)(null),[p,m]=(0,S.useState)(null),h=(0,S.useRef)(null),{dark:g}=tr(),_=g?`#a0a0a0`:`#444`,v=g?`#555`:`#999`,y=g?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`,b=g?`#9ca3af`:`#555`,x=e?.editors||[],C=e?.topProjects||[];async function w(){u(!0);let e=jh(a),[n,i]=await Promise.all([Wi({editor:t,folder:r||void 0,limit:500,...e}),Ji({editor:t,folder:r||void 0,...e})]);c(n),m(i),u(!1)}(0,S.useEffect)(()=>{w()},[t,r,a]);let T=s?.topTools?.slice(0,15)||[],E=s?.topModels?.slice(0,10)||[],D=(0,S.useMemo)(()=>{if(!s)return null;let e=s.totalInputTokens+s.totalOutputTokens+s.totalCacheRead+s.totalCacheWrite,t=s.analyzedChats>0?(s.totalMessages/s.analyzedChats).toFixed(1):0,n=s.analyzedChats>0?(s.totalToolCalls/s.analyzedChats).toFixed(1):0,r=s.totalMessages>0?Math.round(e/s.totalMessages):0,i=s.totalInputTokens+s.totalCacheRead+s.totalCacheWrite;return{totalTok:e,msgsPerSession:t,toolsPerSession:n,tokPerMsg:r,cacheHitRate:i>0?(s.totalCacheRead/i*100).toFixed(1):0,outputRatio:i>0?(s.totalOutputTokens/i).toFixed(3):0,aiVsHuman:s.totalUserChars>0?(s.totalAssistantChars/s.totalUserChars).toFixed(1):0}},[s]),O=(0,S.useMemo)(()=>T.length>0?uE(T):[],[T]);function k(e,t){if(t.length>0){let e=T[t[0].index]?.name;e&&f(e)}}return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsxs)($T,{icon:Ci,title:`Deep Analysis`,children:[(0,F.jsxs)(`select`,{value:t,onChange:e=>n(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Editors`}),x.map(e=>(0,F.jsx)(`option`,{value:e.id,children:q(e.id)},e.id))]}),(0,F.jsxs)(`select`,{value:r,onChange:e=>i(e.target.value),className:`px-2 py-1 text-[12px] outline-none max-w-[200px] truncate`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Projects`}),C.map(e=>(0,F.jsx)(`option`,{value:e.fullPath,children:e.name},e.fullPath||e.name))]}),l&&(0,F.jsx)($r,{size:11,className:`animate-spin`,style:{color:`var(--c-text3)`}}),s&&(0,F.jsxs)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text2)`},children:[s.analyzedChats,` sessions analyzed`]}),(0,F.jsx)(`div`,{className:`ml-auto`,children:(0,F.jsx)(Hh,{value:a,onChange:o})})]}),s&&D&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`sessions`,value:s.analyzedChats}),(0,F.jsx)(K,{label:`messages`,value:J(s.totalMessages),sub:`${D.msgsPerSession}/session`}),(0,F.jsx)(K,{label:`tool calls`,value:J(s.totalToolCalls),sub:`${D.toolsPerSession}/session`}),(0,F.jsx)(K,{label:`total tokens`,value:J(D.totalTok),sub:`${J(D.tokPerMsg)}/msg`}),(0,F.jsx)(K,{label:`you wrote`,value:J(s.totalUserChars),sub:`AI: ${D.aiVsHuman}\u00d7 more`}),(0,F.jsx)(K,{label:`est. cost`,value:p&&p.totalCost>0?kh(p.totalCost):`—`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`token flow`}),(0,F.jsxs)(`div`,{className:`space-y-3 mt-2`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] mb-1`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`input tokens`}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-white)`},children:J(s.totalInputTokens+s.totalCacheRead+s.totalCacheWrite)})]}),(0,F.jsx)(gE,{segments:[{label:`Fresh input`,value:s.totalInputTokens,color:`#6366f1`},{label:`Cache write`,value:s.totalCacheWrite,color:`#fbbf24`},{label:`Cache read`,value:s.totalCacheRead,color:`#34d399`}]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-[10px]`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#6366f1`}}),` fresh `,J(s.totalInputTokens)]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#fbbf24`}}),` cache write `,J(s.totalCacheWrite)]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#34d399`}}),` cache read `,J(s.totalCacheRead)]})]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] mb-1`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`output tokens`}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-white)`},children:J(s.totalOutputTokens)})]}),(0,F.jsx)(gE,{segments:[{label:`Output`,value:s.totalOutputTokens,color:`#a78bfa`}]})]}),s.totalCacheWrite>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] mb-1`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`cache write`}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-white)`},children:J(s.totalCacheWrite)})]}),(0,F.jsx)(gE,{segments:[{label:`Cache write`,value:s.totalCacheWrite,color:`#fbbf24`}]})]}),(0,F.jsxs)(`div`,{className:`pt-2`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`div`,{className:`text-[10px] mb-1`,style:{color:`var(--c-text3)`},children:`overall token distribution`}),(0,F.jsx)(gE,{height:10,segments:[{label:`Input`,value:s.totalInputTokens,color:`#6366f1`},{label:`Output`,value:s.totalOutputTokens,color:`#a78bfa`},{label:`Cache Read`,value:s.totalCacheRead,color:`#34d399`},{label:`Cache Write`,value:s.totalCacheWrite,color:`#fbbf24`}]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#6366f1`}}),` in`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#a78bfa`}}),` out`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#34d399`}}),` cache read`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#fbbf24`}}),` cache write`]})]})]})]})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`efficiency insights`}),(0,F.jsxs)(`div`,{className:`space-y-3 mt-2`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[11px] mb-1`,style:{color:`var(--c-text2)`},children:`you vs AI (characters)`}),(0,F.jsx)(gE,{height:8,segments:[{label:`You`,value:s.totalUserChars,color:`#6366f1`},{label:`AI`,value:s.totalAssistantChars,color:`#34d399`}]}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between mt-1 text-[10px]`,children:[(0,F.jsxs)(`span`,{style:{color:`#6366f1`},children:[`You: `,J(s.totalUserChars)]}),(0,F.jsxs)(`span`,{style:{color:`#34d399`},children:[`AI: `,J(s.totalAssistantChars)]})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,F.jsxs)(`div`,{className:`p-2 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ci,{size:9}),` output/input ratio`]}),(0,F.jsxs)(`div`,{className:`text-sm font-bold mt-0.5`,style:{color:`var(--c-white)`},children:[D.outputRatio,`×`]})]}),(0,F.jsxs)(`div`,{className:`p-2 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ai,{size:9}),` cache hit rate`]}),(0,F.jsxs)(`div`,{className:`text-sm font-bold mt-0.5`,style:{color:parseFloat(D.cacheHitRate)>50?`#34d399`:parseFloat(D.cacheHitRate)>20?`#fbbf24`:`var(--c-white)`},children:[D.cacheHitRate,`%`]})]}),(0,F.jsxs)(`div`,{className:`p-2 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(ni,{size:9}),` tokens per message`]}),(0,F.jsx)(`div`,{className:`text-sm font-bold mt-0.5`,style:{color:`var(--c-white)`},children:J(D.tokPerMsg)})]}),(0,F.jsxs)(`div`,{className:`p-2 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Oi,{size:9}),` tools per session`]}),(0,F.jsx)(`div`,{className:`text-sm font-bold mt-0.5`,style:{color:`var(--c-white)`},children:D.toolsPerSession})]})]}),(0,F.jsxs)(`div`,{className:`p-2 rounded-sm text-center`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsx)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:`AI amplification factor`}),(0,F.jsxs)(`div`,{className:`text-lg font-bold`,style:{color:`var(--c-accent)`},children:[D.aiVsHuman,`×`]}),(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[`AI writes `,D.aiVsHuman,`× more than you type`]})]})]})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3 lg:col-span-2`,children:[(0,F.jsxs)($,{children:[`most used tools `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(click to drill down)`})]}),(0,F.jsx)(`div`,{style:{height:Math.max(T.length*20+10,120)},children:T.length>0?(0,F.jsx)(wh,{ref:h,data:{labels:T.map(e=>e.name),datasets:[{data:T.map(e=>e.count),backgroundColor:sE.concat(oE).slice(0,T.length),borderRadius:2}]},options:{indexAxis:`y`,responsive:!0,maintainAspectRatio:!1,onClick:k,scales:{x:{grid:{color:y},ticks:{color:v,font:{size:8,family:cE}}},y:{grid:{display:!1},ticks:{color:_,font:{size:8,family:cE}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:cE,size:10},titleFont:{family:cE,size:10}}}}}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-8`,style:{color:`var(--c-text3)`},children:`no tool calls found`})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`models`}),(0,F.jsx)(`div`,{style:{height:160},children:E.length>0?(0,F.jsx)(Th,{data:{labels:E.map(e=>e.name),datasets:[{data:E.map(e=>e.count),backgroundColor:oE,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:b,font:{size:8,family:cE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:cE,size:10},titleFont:{family:cE,size:10}}}}}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-8`,style:{color:`var(--c-text3)`},children:`no model data`})}),O.length>0&&(0,F.jsxs)(`div`,{className:`mt-3 pt-3`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider mb-2`,style:{color:`var(--c-text3)`},children:`tool categories`}),(0,F.jsx)(`div`,{className:`space-y-1.5`,children:O.map(([e,{tools:t,total:n}])=>(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,F.jsx)(`span`,{className:`truncate flex-1`,style:{color:`var(--c-text2)`},children:e}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-white)`},children:n}),(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,t.length,`)`]})]},e))})]})]})]}),d&&(0,F.jsx)(hE,{toolName:d,folder:r,editor:t,dateRange:a,onClose:()=>f(null)})]})]})}Lf.register(km,Nm,vp,wm,im);var vE=`JetBrains Mono, monospace`;function yE({label:e,a:t,b:n,colorA:r,colorB:i}){let a=parseFloat(t)||0,o=parseFloat(n)||0,s=Math.max(a,o,1);return(0,F.jsxs)(`div`,{className:`grid grid-cols-[1fr_100px_100px] gap-x-3 items-center py-0.5`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(`div`,{className:`text-[11px]`,style:{color:`var(--c-text2)`},children:e}),(0,F.jsxs)(`div`,{className:`text-right`,children:[(0,F.jsx)(`span`,{className:`text-[12px] font-mono font-medium`,style:{color:`var(--c-white)`},children:typeof t==`number`?J(t):t}),(0,F.jsx)(`div`,{className:`h-1 rounded-full mt-0.5 ml-auto`,style:{background:r,width:`${(a/s*100).toFixed(0)}%`}})]}),(0,F.jsxs)(`div`,{className:`text-right`,children:[(0,F.jsx)(`span`,{className:`text-[12px] font-mono font-medium`,style:{color:`var(--c-white)`},children:typeof n==`number`?J(n):n}),(0,F.jsx)(`div`,{className:`h-1 rounded-full mt-0.5 ml-auto`,style:{background:i,width:`${(o/s*100).toFixed(0)}%`}})]})]})}function bE({titleA:e,titleB:t,colorA:n,colorB:r,itemsA:i,itemsB:a,limit:o=8}){return(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h4`,{className:`text-[11px] font-medium uppercase tracking-wider mb-1`,style:{color:n},children:e}),(0,F.jsxs)(`div`,{className:`space-y-0.5`,children:[i.slice(0,o).map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between text-[11px] py-0.5`,children:[(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text)`},children:e.name}),(0,F.jsx)(`span`,{className:`font-mono ml-2`,style:{color:`var(--c-text3)`},children:e.count})]},e.name)),i.length===0&&(0,F.jsx)(`div`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:`none`})]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h4`,{className:`text-[11px] font-medium uppercase tracking-wider mb-1`,style:{color:r},children:t}),(0,F.jsxs)(`div`,{className:`space-y-0.5`,children:[a.slice(0,o).map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between text-[11px] py-0.5`,children:[(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text)`},children:e.name}),(0,F.jsx)(`span`,{className:`font-mono ml-2`,style:{color:`var(--c-text3)`},children:e.count})]},e.name)),a.length===0&&(0,F.jsx)(`div`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:`none`})]})]})]})}function xE({overview:e}){let t=e?.editors||[],[n,r]=(0,S.useState)(t[0]?.id||``),[i,a]=(0,S.useState)(t[1]?.id||``),[o,s]=(0,S.useState)(null),[c,l]=(0,S.useState)(!1),{dark:u}=tr(),d=u?`#888`:`#555`;async function f(){if(!n||!i)return;l(!0);let[e,t,r,a]=await Promise.all([Wi({editor:n,limit:500}),Wi({editor:i,limit:500}),Bi({editor:n,limit:1e3}),Bi({editor:i,limit:1e3})]);s({deepA:e,deepB:t,chatsA:r,chatsB:a}),l(!1)}(0,S.useEffect)(()=>{n&&i&&f()},[n,i]);let p=Oh(n),m=Oh(i),h=q(n),g=q(i),_=(e,t)=>t?(e/t).toFixed(1):`0`,v=(e,t)=>t?(e/t*100).toFixed(0)+`%`:`0%`,y=o?[{label:`Sessions`,a:o.chatsA.total,b:o.chatsB.total},{label:`Messages`,a:o.deepA.totalMessages,b:o.deepB.totalMessages},{label:`Tool Calls`,a:o.deepA.totalToolCalls,b:o.deepB.totalToolCalls},{label:`Input Tokens`,a:o.deepA.totalInputTokens,b:o.deepB.totalInputTokens},{label:`Output Tokens`,a:o.deepA.totalOutputTokens,b:o.deepB.totalOutputTokens},{label:`Cache Read`,a:o.deepA.totalCacheRead,b:o.deepB.totalCacheRead}]:[],b=o?[{label:`Avg Msgs / Session`,a:_(o.deepA.totalMessages,o.deepA.analyzedChats),b:_(o.deepB.totalMessages,o.deepB.analyzedChats)},{label:`Avg Tools / Session`,a:_(o.deepA.totalToolCalls,o.deepA.analyzedChats),b:_(o.deepB.totalToolCalls,o.deepB.analyzedChats)},{label:`Avg Tokens / Session`,a:_(o.deepA.totalInputTokens+o.deepA.totalOutputTokens,o.deepA.analyzedChats),b:_(o.deepB.totalInputTokens+o.deepB.totalOutputTokens,o.deepB.analyzedChats)},{label:`Output / Input Ratio`,a:_(o.deepA.totalOutputTokens,o.deepA.totalInputTokens||1),b:_(o.deepB.totalOutputTokens,o.deepB.totalInputTokens||1)},{label:`Tools / Message`,a:_(o.deepA.totalToolCalls,o.deepA.totalMessages||1),b:_(o.deepB.totalToolCalls,o.deepB.totalMessages||1)},{label:`Cache Hit Rate`,a:v(o.deepA.totalCacheRead,o.deepA.totalInputTokens),b:v(o.deepB.totalCacheRead,o.deepB.totalInputTokens)}]:[],x=[`Sessions`,`Messages`,`Tool Calls`],C=o?[o.chatsA.total,o.deepA.totalMessages,o.deepA.totalToolCalls]:[],w=o?[o.chatsB.total,o.deepB.totalMessages,o.deepB.totalToolCalls]:[],T={labels:x,datasets:[{label:h,data:C,backgroundColor:p+`99`,borderRadius:2},{label:g,data:w,backgroundColor:m+`99`,borderRadius:2}]},E=o?{labels:[`Input`,`Output`,`Cache Read`],datasets:[{label:h,data:[o.deepA.totalInputTokens,o.deepA.totalOutputTokens,o.deepA.totalCacheRead],backgroundColor:p+`99`,borderRadius:2},{label:g,data:[o.deepB.totalInputTokens,o.deepB.totalOutputTokens,o.deepB.totalCacheRead],backgroundColor:m+`99`,borderRadius:2}]}:null,D={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{labels:{color:d,font:{size:9,family:vE},usePointStyle:!0,pointStyle:`circle`,padding:8}},tooltip:{bodyFont:{family:vE,size:10},titleFont:{family:vE,size:10}}},scales:{x:{grid:{display:!1},ticks:{color:d,font:{size:9,family:vE}}},y:{grid:{color:u?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`},ticks:{color:d,font:{size:9,family:vE}}}}};return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsxs)($T,{icon:ur,title:`Compare`,children:[(0,F.jsx)(`select`,{value:n,onChange:e=>r(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:t.map(e=>(0,F.jsx)(`option`,{value:e.id,children:q(e.id)},e.id))}),(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`vs`}),(0,F.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:t.map(e=>(0,F.jsx)(`option`,{value:e.id,children:q(e.id)},e.id))}),c&&(0,F.jsx)($r,{size:11,className:`animate-spin`,style:{color:`var(--c-text3)`}})]}),o&&(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider`,style:{color:`var(--c-text2)`},children:`totals`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px]`,children:[(0,F.jsxs)(`span`,{style:{color:p},children:[`● `,h]}),(0,F.jsxs)(`span`,{style:{color:m},children:[`● `,g]})]})]}),y.map(e=>(0,F.jsx)(yE,{label:e.label,a:e.a,b:e.b,colorA:p,colorB:m},e.label))]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider mb-1.5`,style:{color:`var(--c-text2)`},children:`efficiency`}),b.map(e=>(0,F.jsx)(yE,{label:e.label,a:e.a,b:e.b,colorA:p,colorB:m},e.label))]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider mb-2`,style:{color:`var(--c-text2)`},children:`usage`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(wh,{data:T,options:D})})]}),E&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider mb-2`,style:{color:`var(--c-text2)`},children:`tokens`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(wh,{data:E,options:D})})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider mb-2`,style:{color:`var(--c-text2)`},children:`top tools`}),(0,F.jsx)(bE,{titleA:h,titleB:g,colorA:p,colorB:m,itemsA:o.deepA.topTools,itemsB:o.deepB.topTools,limit:10})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)(`h3`,{className:`text-[11px] font-medium uppercase tracking-wider mb-2`,style:{color:`var(--c-text2)`},children:`models`}),(0,F.jsx)(bE,{titleA:h,titleB:g,colorA:p,colorB:m,itemsA:o.deepA.topModels,itemsB:o.deepB.topModels,limit:8})]})]})]})]})}Lf.register(qf,wm,im,km,Nm,vp);var SE=`JetBrains Mono, monospace`,CE=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`];function wE({overview:e}){let{dark:t}=tr(),n=t?`#888`:`#555`,r=t?`#555`:`#999`,i=t?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`,[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(``),[l,u]=(0,S.useState)(``),[d,f]=(0,S.useState)(null),[p,m]=(0,S.useState)(null),h=dt(),g=e?.editors||[];if((0,S.useEffect)(()=>{let e=jh(d);Promise.all([Hi(e),Ji(e)]).then(([e,t])=>{o(e),m(t)})},[d]),!a)return(0,F.jsx)(wa,{label:`Loading projects...`});let _=a.filter(e=>!(l&&!e.editors[l]||s&&!e.folder.toLowerCase().includes(s.toLowerCase())&&!e.name.toLowerCase().includes(s.toLowerCase()))),v=a.reduce((e,t)=>e+t.totalSessions,0),y=a.reduce((e,t)=>e+t.totalMessages,0),b=a.reduce((e,t)=>e+t.totalInputTokens+t.totalOutputTokens,0),x=Math.max(...a.map(e=>e.totalSessions),1),C={},w={};for(let e of a){for(let t of e.topModels)C[t.name]=(C[t.name]||0)+t.count;for(let[t,n]of Object.entries(e.editors))w[t]=(w[t]||0)+n}let T=Object.entries(C).sort((e,t)=>t[1]-e[1]).slice(0,8),E=Object.entries(w).sort((e,t)=>t[1]-e[1]),D=a.slice(0,10);return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:Ur,title:`Projects`}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`projects`,value:a.length}),(0,F.jsx)(K,{label:`sessions`,value:J(v),onClick:()=>h(`/sessions`)}),(0,F.jsx)(K,{label:`messages`,value:J(y)}),(0,F.jsx)(K,{label:`tokens`,value:J(b)}),(0,F.jsx)(K,{label:`est. cost`,value:p&&p.totalCost>0?kh(p.totalCost):`—`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`top projects `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`by sessions`})]}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(wh,{data:{labels:D.map(e=>e.name),datasets:[{data:D.map(e=>e.totalSessions),backgroundColor:`#6366f1`,borderRadius:3}]},options:{responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{grid:{color:i},ticks:{color:r,font:{size:8,family:SE}}},y:{grid:{display:!1},ticks:{color:n,font:{size:8,family:SE},callback:(e,t)=>D[t]?.name?.length>16?D[t].name.slice(0,15)+`…`:D[t]?.name}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:SE,size:10},titleFont:{family:SE,size:10}}}}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`editors`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Th,{data:{labels:E.map(e=>q(e[0])),datasets:[{data:E.map(e=>e[1]),backgroundColor:E.map(e=>Oh(e[0])),borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:n,font:{size:9,family:SE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:SE,size:10},titleFont:{family:SE,size:10}}}}})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`models`}),(0,F.jsx)(`div`,{style:{height:160},children:T.length>0?(0,F.jsx)(Th,{data:{labels:T.map(e=>e[0]),datasets:[{data:T.map(e=>e[1]),backgroundColor:CE,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:n,font:{size:9,family:SE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:SE,size:10},titleFont:{family:SE,size:10}}}}}):(0,F.jsx)(`div`,{className:`text-xs text-center py-12`,style:{color:`var(--c-text3)`},children:`no model data`})})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Editors`}),g.map(e=>(0,F.jsx)(`option`,{value:e.id,children:q(e.id)},e.id))]}),(0,F.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,F.jsx)(ui,{size:12,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,placeholder:`Search projects...`,value:s,onChange:e=>c(e.target.value),className:`w-full pl-7 pr-3 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`}})]}),(0,F.jsx)(`div`,{className:`ml-auto`,children:(0,F.jsx)(Hh,{value:d,onChange:f})})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:_.map(e=>{let t=Object.entries(e.editors).sort((e,t)=>t[1]-e[1]),n=e.totalInputTokens+e.totalOutputTokens,r=e.topModels[0];return(0,F.jsxs)(`div`,{className:`card p-3 cursor-pointer transition hover:opacity-90 flex flex-col gap-2.5`,onClick:()=>h(`/projects/detail?folder=${encodeURIComponent(e.folder)}`),children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0`,children:[(0,F.jsx)(Ur,{size:14,className:`flex-shrink-0 mt-0.5`,style:{color:`var(--c-accent)`}}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[12px] font-bold truncate`,style:{color:`var(--c-white)`},children:e.name}),(0,F.jsx)(`div`,{className:`text-[10px] truncate`,style:{color:`var(--c-text3)`},children:e.folder})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:t.slice(0,4).map(([e])=>(0,F.jsx)(Gh,{source:e,size:12},e))})]}),(0,F.jsx)(`div`,{className:`w-full h-1 rounded-full overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${(e.totalSessions/x*100).toFixed(1)}%`,background:`var(--c-accent)`}})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(ni,{size:9,style:{color:`var(--c-text3)`}}),(0,F.jsxs)(`span`,{style:{color:`var(--c-text2)`},children:[e.totalSessions,` sessions`]}),(0,F.jsxs)(`span`,{className:`ml-auto font-bold`,style:{color:`var(--c-white)`},children:[J(e.totalMessages),` msgs`]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(Oi,{size:9,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`tools`}),(0,F.jsx)(`span`,{className:`ml-auto font-bold`,style:{color:`var(--c-white)`},children:J(e.totalToolCalls)})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(Nr,{size:9,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`span`,{className:`truncate`,style:{color:`var(--c-text2)`},children:r?r.name:`—`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`tok`}),(0,F.jsx)(`span`,{className:`ml-auto font-bold`,style:{color:n>0?`var(--c-white)`:`var(--c-text3)`},children:n>0?J(n):`—`})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 pt-1 text-[10px]`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`div`,{className:`flex items-center gap-1.5 flex-1 min-w-0`,children:t.map(([e,t])=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 truncate`,children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0`,style:{background:Oh(e)}}),(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:q(e)}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-text2)`},children:t})]},e))}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(vr,{size:8}),(0,F.jsx)(`span`,{children:Ah(e.lastSeen)})]})]})]},e.folder)})}),_.length===0&&(0,F.jsx)(`div`,{className:`text-center py-12 text-sm`,style:{color:`var(--c-text3)`},children:`no projects found`})]})}var TE={"A+":`#22c55e`,A:`#22c55e`,"B+":`#4ade80`,B:`#4ade80`,"C+":`#facc15`,C:`#facc15`,"D+":`#f97316`,D:`#f97316`,F:`#ef4444`},EE={"Repo Hygiene":_r,"Grounding Docs":Br,Testing:Hr,"Agent Configs":hr,"AI Context":ei,"Prompts & Skills":si,MCP:oi,"AI Dependencies":ii,"AI Deps":ii};function DE({missing:e}){let[t,n]=(0,S.useState)(!1),r=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(!t)return;let e=e=>{r.current&&!r.current.contains(e.target)&&n(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[t]);let i=e.filter(e=>e.weight>0),a=i.length>0?i:e.slice(0,5);return a.length===0?null:(0,F.jsxs)(`span`,{ref:r,className:`relative flex-shrink-0`,children:[(0,F.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n(!t)},className:`flex items-center justify-center w-4 h-4 rounded-full transition hover:opacity-80`,style:{color:`var(--c-text3)`,background:`var(--c-bg3)`},children:(0,F.jsx)(Jr,{size:10})}),t&&(0,F.jsxs)(`div`,{className:`absolute right-0 top-6 z-50 w-64 p-2.5 rounded shadow-lg`,style:{background:`var(--c-bg)`,border:`1px solid var(--c-border)`,boxShadow:`0 4px 24px rgba(0,0,0,0.3)`},children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium mb-1.5`,style:{color:`var(--c-white)`},children:`How to improve`}),(0,F.jsx)(`div`,{className:`space-y-1`,children:a.map(e=>(0,F.jsxs)(`div`,{className:`text-[11px]`,style:{color:`var(--c-text2)`},children:[(0,F.jsxs)(`span`,{style:{color:`var(--c-text)`},children:[`+ `,e.label]}),e.weight>0&&(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[` (`,e.weight,`pt)`]})]},e.id))})]})]})}function OE({folder:e}){console.log(`AiAuditCard rendering, folder:`,e);let[t,n]=(0,S.useState)(null),[r,i]=(0,S.useState)(!1),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(new Set),l=async()=>{if(e){i(!0),o(null);try{let t=await na(e);if(t.error)throw Error(t.error);n(t)}catch(e){o(e.message)}i(!1)}};if((0,S.useEffect)(()=>{console.log(`AiAuditCard useEffect triggered, folder:`,e),l()},[e]),r)return(0,F.jsx)(`div`,{className:`card p-4`,children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)($r,{size:14,className:`animate-spin`,style:{color:`var(--c-accent)`}}),(0,F.jsx)(`span`,{className:`text-[12px]`,style:{color:`var(--c-text2)`},children:`Running AI readiness audit...`})]})});if(a)return(0,F.jsx)(`div`,{className:`card p-4`,children:(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(wi,{size:14,style:{color:`#ef4444`}}),(0,F.jsxs)(`span`,{className:`text-[12px]`,style:{color:`var(--c-text2)`},children:[`Audit failed: `,a]})]}),(0,F.jsxs)(`button`,{onClick:l,className:`flex items-center gap-1.5 px-2.5 py-1 text-[11px] rounded transition hover:opacity-80`,style:{color:`var(--c-text2)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(li,{size:10}),`Retry`]})]})});if(!t)return null;let u=TE[t.grade]||`var(--c-text2)`,d=t.sections||{},f=t.findings||[],p={};for(let e of f){let t=e.section||`Other`;p[t]||(p[t]=[]),p[t].push(e)}return(0,F.jsxs)(`div`,{className:`card p-4 space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(hi,{size:16,style:{color:u}}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)($,{children:`ai readiness audit`}),(0,F.jsxs)(`div`,{className:`text-[10px] -mt-1.5`,style:{color:`var(--c-text3)`},children:[`powered by `,(0,F.jsx)(`code`,{style:{fontFamily:`JetBrains Mono, monospace`},children:`npx check-ai`})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[(0,F.jsxs)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:[t.checks?.passed||0,`/`,t.checks?.total||0,` checks · `,t.points?.earned||0,`/`,t.points?.max||0,` pts`]}),(0,F.jsx)(`button`,{onClick:l,className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded transition hover:opacity-80`,style:{color:`var(--c-text2)`,border:`1px solid var(--c-border)`},children:(0,F.jsx)(li,{size:10})})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(`div`,{className:`w-11 h-11 rounded-lg flex items-center justify-center text-base font-black flex-shrink-0`,style:{background:`${u}15`,color:u,border:`1.5px solid ${u}30`},children:t.grade}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,F.jsx)(`span`,{className:`text-base font-bold`,style:{color:`var(--c-white)`},children:t.score}),(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:`/10`}),(0,F.jsx)(`span`,{className:`text-[11px] ml-1`,style:{color:`var(--c-text2)`},children:t.label})]}),(0,F.jsx)(`div`,{className:`w-full h-2 rounded-full overflow-hidden mt-1`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${((t.score||0)/10*100).toFixed(1)}%`,background:u}})})]})]}),(0,F.jsx)(`div`,{children:Object.entries(d).map(([e,t])=>{let n=EE[e]||Br,r=p[e]||[],i=r.filter(e=>e.found),a=r.filter(e=>!e.found),o=t.pct||0,l=o>=70?`#22c55e`:o>=40?`#facc15`:o>0?`#f97316`:`var(--c-text3)`,u=[];for(let e of i)e.detail?u.push(e.detail):e.matchedPath?u.push(e.matchedPath):e.matches&&e.matches.length>0?u.push(e.matches.join(`, `)):u.push(e.label);let d=u.length>0?u.slice(0,3).join(` · `)+(u.length>3?` …`:``):`none detected`,f=s.has(e);return(0,F.jsxs)(`div`,{style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5 py-2 cursor-pointer transition hover:bg-[var(--c-bg3)]`,onClick:()=>c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),children:[f?(0,F.jsx)(Cr,{size:12,style:{color:`var(--c-text3)`,flexShrink:0}}):(0,F.jsx)(wr,{size:12,style:{color:`var(--c-text3)`,flexShrink:0}}),(0,F.jsx)(n,{size:14,style:{color:`var(--c-text3)`,flexShrink:0}}),(0,F.jsx)(`span`,{className:`text-[12px] font-medium w-32 flex-shrink-0`,style:{color:`var(--c-white)`},children:e}),(0,F.jsx)(`span`,{className:`text-[11px] flex-1 truncate`,style:{color:i.length>0?`var(--c-text2)`:`var(--c-text3)`},children:d}),(0,F.jsxs)(`span`,{className:`text-[11px] flex-shrink-0`,style:{color:`var(--c-text3)`},children:[i.length,`/`,r.length]}),(0,F.jsx)(`div`,{className:`w-20 h-2 rounded-full overflow-hidden flex-shrink-0`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${o}%`,background:l}})}),(0,F.jsxs)(`span`,{className:`text-[11px] w-9 text-right font-bold flex-shrink-0`,style:{color:l},children:[o,`%`]}),a.length>0&&(0,F.jsx)(DE,{missing:a})]}),f&&i.length>0&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-0.5 pb-2 pl-12`,children:i.map(e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px] py-0.5`,children:[(0,F.jsx)(Dr,{size:10,style:{color:`#22c55e`,flexShrink:0}}),(0,F.jsx)(`span`,{style:{color:`var(--c-text)`},children:e.label}),e.matchedPath&&(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:e.matchedPath}),e.detail&&(0,F.jsxs)(`span`,{style:{color:`var(--c-text2)`},children:[`— `,e.detail]})]},e.id))})]},e)})})]})}Lf.register(qf,wm,im,km,Nm,vp);var kE=`JetBrains Mono, monospace`,AE=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`],jE=[`#10b981`,`#34d399`,`#6ee7b7`,`#a7f3d0`,`#d1fae5`,`#ecfdf5`,`#b8f0d8`,`#7ce0b8`,`#4ade80`,`#22c55e`];function ME(){let[e]=zn(),t=dt(),n=e.get(`folder`),{dark:r}=tr(),i=r?`#888`:`#555`,a=r?`#555`:`#999`,o=r?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`,[s,c]=(0,S.useState)(null),[l,u]=(0,S.useState)([]),[d,f]=(0,S.useState)(!0),[p,m]=(0,S.useState)(``),[h,g]=(0,S.useState)(null),[_,v]=(0,S.useState)(null),[y,b]=(0,S.useState)(null);(0,S.useEffect)(()=>{n&&(f(!0),Promise.all([Hi(),Bi({folder:n,limit:1e3}),Ji({folder:n})]).then(([e,t,r])=>{let i=e.find(e=>e.folder===n);c(i||null),u(t.chats||[]),v(r),i&&b(new Set(Object.keys(i.editors))),f(!1)}))},[n]);let x=(0,S.useMemo)(()=>y?l.filter(e=>y.has(e.source)):l,[l,y]),C=(0,S.useMemo)(()=>{if(!p)return x;let e=p.toLowerCase();return x.filter(t=>t.name&&t.name.toLowerCase().includes(e)||t.topModel&&t.topModel.toLowerCase().includes(e)||t.source&&t.source.toLowerCase().includes(e))},[x,p]),w=e=>{b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};if(!n)return(0,F.jsx)(`div`,{className:`text-sm py-12 text-center`,style:{color:`var(--c-text3)`},children:`no project specified`});if(d)return(0,F.jsx)(wa,{label:`Loading project...`});if(!s)return(0,F.jsx)(`div`,{className:`text-sm py-12 text-center`,style:{color:`var(--c-text3)`},children:`project not found`});let T=Object.entries(s.editors).sort((e,t)=>t[1]-e[1]),E=!y||y.size===T.length,D=x.length,O={},k={};for(let e of x)O[e.source]=(O[e.source]||0)+1,e.topModel&&(k[e.topModel]=(k[e.topModel]||0)+1);let A=Object.entries(k).sort((e,t)=>t[1]-e[1]).slice(0,10),j=Math.max(...Object.values(O),1),ee=s.totalInputTokens+s.totalOutputTokens,te=s.totalInputTokens>0?(s.totalOutputTokens/s.totalInputTokens).toFixed(1):`0`,ne=E?s.totalSessions:D,re=E&&s.totalSessions>0?(s.totalMessages/s.totalSessions).toFixed(1):0;return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsxs)(`div`,{className:`card p-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`button`,{onClick:()=>t(`/projects`),className:`flex items-center gap-1 text-[12px] transition mt-0.5 flex-shrink-0`,style:{color:`var(--c-text3)`},children:(0,F.jsx)(dr,{size:12})}),(0,F.jsx)(Ur,{size:18,className:`flex-shrink-0 mt-0.5`,style:{color:`var(--c-accent)`}}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`h1`,{className:`text-sm font-bold truncate`,style:{color:`var(--c-white)`},children:s.name}),(0,F.jsx)(`div`,{className:`text-[11px] truncate`,style:{color:`var(--c-text3)`},children:s.folder})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-1.5 flex-shrink-0`,children:T.map(([e])=>(0,F.jsx)(Gh,{source:e,size:14},e))})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4 mt-3 pt-3 text-[11px]`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(vr,{size:9}),(0,F.jsx)(`span`,{children:Ah(s.firstSeen)}),(0,F.jsx)(`span`,{children:`→`}),(0,F.jsx)(`span`,{children:Ah(s.lastSeen)})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-1.5 ml-auto`,children:T.map(([e,t])=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:Oh(e)}}),(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:q(e)}),(0,F.jsx)(`span`,{className:`font-bold`,style:{color:`var(--c-text2)`},children:t})]},e))})]})]}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`sessions`,value:ne,sub:E?``:`filtered`}),(0,F.jsx)(K,{label:`messages`,value:J(s.totalMessages),sub:`${re} avg/session`}),(0,F.jsx)(K,{label:`tool calls`,value:J(s.totalToolCalls),sub:(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,F.jsx)(Oi,{size:8}),` invocations`]})}),(0,F.jsx)(K,{label:`tokens`,value:J(ee),sub:`${te}\u00d7 out/in`}),s.totalCacheRead>0&&(0,F.jsx)(K,{label:`cache read`,value:J(s.totalCacheRead),sub:`write: ${J(s.totalCacheWrite)}`}),(0,F.jsx)(K,{label:`you wrote`,value:J(s.totalUserChars),sub:`AI: ${J(s.totalAssistantChars)}`}),(0,F.jsx)(K,{label:`est. cost`,value:_&&_.totalCost>0?kh(_.totalCost):`—`,sub:_&&_.byModel.length>0?`${_.byModel.length} model${_.byModel.length===1?``:`s`}`:void 0})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`editors`}),(0,F.jsx)(`div`,{className:`space-y-1.5 mt-1`,children:T.map(([e,t])=>{let n=y?y.has(e):!0,r=O[e]||0;return(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>w(e),className:`accent-[var(--c-accent)] w-3 h-3 flex-shrink-0 cursor-pointer`}),(0,F.jsx)(Gh,{source:e,size:11}),(0,F.jsx)(`span`,{className:`text-[11px] truncate flex-1 cursor-pointer select-none`,onClick:()=>w(e),style:{color:n?`var(--c-text2)`:`var(--c-text3)`,opacity:n?1:.4},children:q(e)}),(0,F.jsx)(`div`,{className:`w-16 h-3 rounded-sm overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-sm transition-all`,style:{width:`${(r/j*100).toFixed(0)}%`,background:n?Oh(e):`var(--c-text3)`,opacity:n?1:.2}})}),(0,F.jsx)(`span`,{className:`text-[11px] w-6 text-right font-bold`,style:{color:n?`var(--c-white)`:`var(--c-text3)`,opacity:n?1:.4},children:r})]},e)})})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`models`}),A.length>0?(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Th,{data:{labels:A.map(e=>e[0]),datasets:[{data:A.map(e=>e[1]),backgroundColor:AE,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:i,font:{size:8,family:kE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:kE,size:10},titleFont:{family:kE,size:10}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`no model data`})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`top tools `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,J(s.totalToolCalls),`)`]})]}),s.topTools.length>0?(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(wh,{data:{labels:s.topTools.map(e=>e.name),datasets:[{data:s.topTools.map(e=>e.count),backgroundColor:jE.slice(0,s.topTools.length),borderRadius:2}]},options:{responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{grid:{color:o},ticks:{color:a,font:{size:8,family:kE}}},y:{grid:{display:!1},ticks:{color:i,font:{size:8,family:kE}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:kE,size:10},titleFont:{family:kE,size:10}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`no tool data`})]})]}),console.log(`Rendering AiAuditCard, folder:`,n),(0,F.jsx)(OE,{folder:n}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,F.jsxs)($,{children:[`sessions `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,C.length,E?``:` of ${l.length}`,`)`]})]}),(0,F.jsxs)(`div`,{className:`relative max-w-xs flex-1`,children:[(0,F.jsx)(ui,{size:11,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,placeholder:`filter sessions...`,value:p,onChange:e=>m(e.target.value),className:`w-full pl-7 pr-3 py-1 text-[12px] outline-none rounded-sm`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`}})]})]}),(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`editor`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`name`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`mode`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`model`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`context`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`est. cost`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`updated`})]})}),(0,F.jsx)(`tbody`,{children:C.map(e=>(0,F.jsxs)(`tr`,{className:`cursor-pointer transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>g(e.id),children:[(0,F.jsx)(`td`,{className:`py-2 px-3`,children:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Gh,{source:e.source,size:12}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:q(e.source)})]})}),(0,F.jsxs)(`td`,{className:`py-2 px-3 font-medium truncate max-w-[280px]`,style:{color:`var(--c-white)`},children:[e.name||(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`Untitled`}),e.encrypted&&(0,F.jsx)(`span`,{className:`ml-1.5 text-[10px] text-yellow-500/60`,children:`locked`})]}),(0,F.jsx)(`td`,{className:`py-2 px-3`,style:{color:`var(--c-text2)`},children:e.mode||``}),(0,F.jsx)(`td`,{className:`py-2 px-3 font-mono truncate max-w-[150px]`,style:{color:`var(--c-text2)`},title:e.topModel||``,children:e.topModel||``}),(0,F.jsx)(`td`,{className:`py-2 px-3`,children:e.bubbleCount>=500?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 font-bold`,style:{color:`#ef4444`},children:[(0,F.jsx)(wi,{size:9}),e.bubbleCount,` msgs`]}):e.bubbleCount>=100?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 font-bold`,style:{color:`#f59e0b`},children:[(0,F.jsx)(wi,{size:9}),e.bubbleCount,` msgs`]}):(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[e.bubbleCount||0,` msgs`]})}),(0,F.jsx)(`td`,{className:`py-2 px-3 font-mono text-right`,style:{color:e.cost>0?`var(--c-text2)`:`var(--c-text3)`},children:e.cost>0?kh(e.cost):``}),(0,F.jsx)(`td`,{className:`py-2 px-3 whitespace-nowrap`,style:{color:`var(--c-text3)`},children:Ah(e.lastUpdatedAt||e.createdAt)})]},e.id))})]}),C.length===0&&(0,F.jsx)(`div`,{className:`text-center py-8 text-sm`,style:{color:`var(--c-text3)`},children:`no sessions found`})]})]}),(0,F.jsx)(XT,{chatId:h,onClose:()=>g(null)})]})}Lf.register(qf,km,Nm,cp,op,vp,wm,im,Yp);var NE=`JetBrains Mono, monospace`,PE=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`,`#2dd4bf`,`#38bdf8`,`#60a5fa`,`#a3e635`];function FE({overview:e}){let{dark:t}=tr(),n=dt(),r=t?`#555`:`#999`,i=t?`#777`:`#555`,a=t?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`,[o,s]=(0,S.useState)(null),[c,l]=(0,S.useState)(!0),[u,d]=(0,S.useState)(``),[f,p]=(0,S.useState)(null),[m,h]=(0,S.useState)(null),g=e?.editors||[];if((0,S.useEffect)(()=>{l(!0),qi({editor:u,...jh(f)}).then(e=>{s(e),l(!1)}).catch(()=>l(!1))},[u,f]),!o)return(0,F.jsx)(wa,{label:`Loading cost data...`});let{totalCost:_,byModel:v,byEditor:y,byProject:b,monthly:x,topSessions:C,summary:w,unknownModels:T}=o,E=v.length>0?{labels:v.slice(0,10).map(e=>e.model),datasets:[{data:v.slice(0,10).map(e=>Math.round(e.cost*100)/100),backgroundColor:PE,borderWidth:0}]}:null,D=y.length>0?{labels:y.map(e=>q(e.editor)),datasets:[{data:y.map(e=>Math.round(e.cost*100)/100),backgroundColor:y.map(e=>Oh(e.editor)),borderWidth:0}]}:null,O=x.length>1?{labels:x.map(e=>e.month),datasets:[{label:`Cost ($)`,data:x.map(e=>e.cost),borderColor:`#6366f1`,backgroundColor:`rgba(99,102,241,0.1)`,borderWidth:2,tension:.3,pointRadius:3,pointHoverRadius:5,fill:!0}]}:null,k=b.length>0?{labels:b.slice(0,10).map(e=>e.name),datasets:[{data:b.slice(0,10).map(e=>Math.round(e.cost*100)/100),backgroundColor:`#818cf8`,borderRadius:3}]}:null,A={responsive:!0,maintainAspectRatio:!1,cutout:`55%`,plugins:{legend:{position:`right`,labels:{color:i,font:{size:9,family:NE},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:NE,size:10},titleFont:{family:NE,size:10},callbacks:{label:e=>` ${e.label}: $${e.raw.toFixed(2)}`}}}};return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsxs)($T,{icon:Ir,title:`Cost Analysis`,children:[(0,F.jsxs)(`select`,{value:u,onChange:e=>d(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Editors`}),g.map(e=>(0,F.jsxs)(`option`,{value:e.id,children:[q(e.id),` (`,e.count,`)`]},e.id))]}),(0,F.jsx)(`div`,{className:`ml-auto`,children:(0,F.jsx)(Hh,{value:f,onChange:p})})]}),(0,F.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-2 text-[11px] rounded`,style:{background:`rgba(234,179,8,0.06)`,border:`1px solid rgba(234,179,8,0.15)`,color:`#ca8a04`},children:[(0,F.jsx)(wi,{size:12,className:`mt-0.5 shrink-0`}),(0,F.jsxs)(`span`,{children:[`These are `,(0,F.jsx)(`strong`,{children:`estimates`}),` based on public API list prices. Actual costs may be lower if you use discounted plans, commitments, prompt caching, batching, or provider credits. Token counts for some editors are approximated from character counts (~4 chars/token).`]})]}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`total est. cost`,value:kh(_),sub:`all models`}),(0,F.jsx)(K,{label:`avg / session`,value:kh(w.avgPerSession),sub:`${J(w.totalSessions)} sessions`}),(0,F.jsx)(K,{label:`avg / day`,value:kh(w.avgPerDay),sub:`${w.totalDays} days`}),(0,F.jsx)(K,{label:`models`,value:v.length,sub:T.length>0?`${T.length} unknown`:`all priced`}),(0,F.jsx)(K,{label:`top model`,value:v[0]?.model||`—`,sub:v[0]?kh(v[0].cost):``}),(0,F.jsx)(K,{label:`top editor`,value:y[0]?q(y[0].editor):`—`,sub:y[0]?kh(y[0].cost):``})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3 lg:col-span-2`,children:[(0,F.jsx)($,{children:`cost by model`}),E?(0,F.jsx)(`div`,{style:{height:220},children:(0,F.jsx)(wh,{data:{labels:v.slice(0,12).map(e=>e.model),datasets:[{data:v.slice(0,12).map(e=>Math.round(e.cost*100)/100),backgroundColor:PE,borderRadius:3}]},options:{responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{grid:{color:a},ticks:{color:r,font:{size:9,family:NE},callback:e=>`$`+e}},y:{grid:{display:!1},ticks:{color:i,font:{size:9,family:NE}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:NE,size:10},titleFont:{family:NE,size:10},callbacks:{label:e=>` $${e.raw.toFixed(2)}`}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`no cost data`})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`cost by editor`}),D?(0,F.jsx)(`div`,{style:{height:220},children:(0,F.jsx)(Th,{data:D,options:A})}):(0,F.jsx)(`div`,{className:`text-[11px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`no cost data`})]})]}),O&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`monthly cost trend`}),(0,F.jsx)(`div`,{style:{height:180},children:(0,F.jsx)(Ch,{data:O,options:{responsive:!0,maintainAspectRatio:!1,interaction:{mode:`index`,intersect:!1},scales:{x:{grid:{display:!1},ticks:{color:r,font:{size:9,family:NE},maxRotation:0,maxTicksLimit:12}},y:{beginAtZero:!0,grid:{color:a},ticks:{color:r,font:{size:9,family:NE},callback:e=>`$`+e}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:NE,size:10},titleFont:{family:NE,size:10},callbacks:{label:e=>` $${e.raw.toFixed(2)} (${x[e.dataIndex]?.sessions||0} sessions)`}}}}})})]}),k&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`cost by project (top 10)`}),(0,F.jsx)(`div`,{style:{height:220},children:(0,F.jsx)(wh,{data:k,options:{responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{grid:{color:a},ticks:{color:r,font:{size:9,family:NE},callback:e=>`$`+e}},y:{grid:{display:!1},ticks:{color:i,font:{size:9,family:NE}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:NE,size:10},titleFont:{family:NE,size:10},callbacks:{label:e=>` $${e.raw.toFixed(2)}`}}}}})})]}),(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsx)(`div`,{className:`px-3 py-2`,style:{borderBottom:`1px solid var(--c-border)`},children:(0,F.jsx)($,{children:`model breakdown`})}),(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`model`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`input tokens`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`output tokens`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`cache read`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`cache write`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`est. cost`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`% of total`})]})}),(0,F.jsx)(`tbody`,{children:v.map((e,t)=>(0,F.jsxs)(`tr`,{style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`td`,{className:`py-2 px-3 font-mono font-medium`,style:{color:`var(--c-white)`},children:[(0,F.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full mr-1.5`,style:{background:PE[t%PE.length]}}),e.model]}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono`,style:{color:`var(--c-text2)`},children:J(e.inputTokens)}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono`,style:{color:`var(--c-text2)`},children:J(e.outputTokens)}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono`,style:{color:`var(--c-text3)`},children:e.cacheRead>0?J(e.cacheRead):`—`}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono`,style:{color:`var(--c-text3)`},children:e.cacheWrite>0?J(e.cacheWrite):`—`}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono font-medium`,style:{color:`var(--c-white)`},children:kh(e.cost)}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono`,style:{color:`var(--c-text3)`},children:_>0?(e.cost/_*100).toFixed(1)+`%`:`—`})]},e.model))})]}),v.length===0&&(0,F.jsx)(`div`,{className:`text-center py-8 text-sm`,style:{color:`var(--c-text3)`},children:`no model cost data`})]}),C.length>0&&(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsx)(`div`,{className:`px-3 py-2`,style:{borderBottom:`1px solid var(--c-border)`},children:(0,F.jsx)($,{children:`most expensive sessions`})}),(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`editor`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`name`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`project`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`model`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`msgs`}),(0,F.jsx)(`th`,{className:`text-right py-2 px-3 font-medium`,children:`est. cost`}),(0,F.jsx)(`th`,{className:`text-left py-2 px-3 font-medium`,children:`date`})]})}),(0,F.jsx)(`tbody`,{children:C.slice(0,30).map(e=>(0,F.jsxs)(`tr`,{className:`cursor-pointer transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>h(e.id),children:[(0,F.jsx)(`td`,{className:`py-2 px-3`,children:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Gh,{source:e.source,size:12}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:q(e.source)})]})}),(0,F.jsx)(`td`,{className:`py-2 px-3 font-medium truncate max-w-[200px]`,style:{color:`var(--c-white)`},children:e.name||(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`Untitled`})}),(0,F.jsx)(`td`,{className:`py-2 px-3 truncate max-w-[140px]`,style:{color:`var(--c-text2)`},title:e.folder,children:e.folder?(0,F.jsx)(`span`,{className:`cursor-pointer hover:underline`,style:{color:`var(--c-accent)`},onClick:t=>{t.stopPropagation(),n(`/projects/detail?folder=${encodeURIComponent(e.folder)}`)},children:e.folder.split(`/`).pop()}):``}),(0,F.jsx)(`td`,{className:`py-2 px-3 font-mono truncate max-w-[140px]`,style:{color:`var(--c-text2)`},title:e.model,children:e.model}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right`,style:{color:`var(--c-text3)`},children:e.messages}),(0,F.jsx)(`td`,{className:`py-2 px-3 text-right font-mono font-medium`,style:{color:`var(--c-white)`},children:kh(e.cost)}),(0,F.jsx)(`td`,{className:`py-2 px-3 whitespace-nowrap`,style:{color:`var(--c-text3)`},children:Ah(e.lastUpdatedAt)})]},e.id))})]})]}),T.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[(0,F.jsx)(wi,{size:11,className:`inline mr-1`,style:{color:`#f59e0b`}}),`unpriced models (`,T.length,`)`]}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-2`,children:T.map(e=>(0,F.jsx)(`span`,{className:`text-[11px] px-2 py-0.5 font-mono`,style:{background:`rgba(245,158,11,0.08)`,color:`#f59e0b`,border:`1px solid rgba(245,158,11,0.2)`},children:e},e))})]}),(0,F.jsx)(XT,{chatId:m,onClose:()=>h(null)})]})}Lf.register(qf,wm,im,km,Nm,vp,cp,op,Yp);var IE=[{label:`Sessions per editor`,sql:`SELECT source, count() AS count FROM {{sessions_v}} AS c GROUP BY source ORDER BY count DESC`},{label:`Top 10 projects`,sql:`SELECT project, count() AS sessions, sum(total_msgs) AS messages FROM {{sessions_v}} AS c WHERE project != '' GROUP BY project ORDER BY sessions DESC LIMIT 10`},{label:`Messages per day`,sql:`SELECT toDate(ts) AS day, count() AS count FROM {{messages}} GROUP BY day ORDER BY day`},{label:`Top models`,sql:`SELECT model, count() AS count FROM {{messages}} WHERE model NOT IN ('', '<synthetic>') GROUP BY model ORDER BY count DESC LIMIT 10`},{label:`Top tools`,sql:`SELECT tool_name, count() AS count FROM {{tool_calls}} GROUP BY tool_name ORDER BY count DESC LIMIT 15`},{label:`Token usage by editor`,sql:`SELECT source, sum(input_tokens) AS input_tokens, sum(output_tokens) AS output_tokens FROM {{sessions_v}} AS c GROUP BY source ORDER BY input_tokens DESC`},{label:`Sessions by mode`,sql:`SELECT mode, count() AS count FROM {{sessions_v}} AS c WHERE mode != '' GROUP BY mode ORDER BY count DESC`},{label:`Hourly distribution`,sql:`SELECT toHour(ts) AS hour, count() AS count FROM {{messages}} GROUP BY hour ORDER BY hour`},{label:`Full-text search`,sql:`SELECT session_id, user_id, any(source) AS source, count() AS hits FROM {{messages}} WHERE text_ngram LIKE '%clickhouse%' GROUP BY session_id, user_id ORDER BY hits DESC LIMIT 10`}];function LE(e,t){return e.replace(/\{\{([a-z_]+)\}\}/g,(e,n)=>t[n]??e)}function RE(){let{dark:e}=tr(),[t,n]=(0,S.useState)(`loading`),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(null),[l,u]=(0,S.useState)(!1),[d,f]=(0,S.useState)(null),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)(`bar`),[_,v]=(0,S.useState)(null),y=(0,S.useRef)(null);(0,S.useEffect)(()=>{$i().then(e=>{f(e);let t=e?.rooms,r=t?.sessions?IE.map(e=>({...e,sql:LE(e.sql,t)})):null;n(r),r&&i(e=>e===``||e===IE[0].sql?r[0].sql:e)}).catch(()=>n(null))},[]);let b=async()=>{if(!r.trim()||l)return;u(!0),c(null),o(null);let e=performance.now();try{let t=await Qi(r.trim());v((performance.now()-e).toFixed(0)),t.error?c(t.error):o(t)}catch(e){c(e.message),v(null)}u(!1)},x=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),b())},C=()=>{if(!a)return;let e=a.columns.join(` `),t=a.rows.map(e=>a.columns.map(t=>e[t]??``).join(` `));navigator.clipboard.writeText([e,...t].join(`
|
|
67
70
|
`))},w=()=>{if(!a)return;let e=e=>{let t=String(e??``);return t.includes(`,`)||t.includes(`"`)||t.includes(`
|
|
68
71
|
`)?`"${t.replace(/"/g,`""`)}"`:t},t=a.columns.map(e).join(`,`),n=a.rows.map(t=>a.columns.map(n=>e(t[n])).join(`,`)),r=new Blob([t+`
|
|
69
72
|
`+n.join(`
|
|
70
|
-
`)],{type:`text/csv`}),i=URL.createObjectURL(r),o=document.createElement(`a`);o.href=i,o.download=`query-results.csv`,o.click(),URL.revokeObjectURL(i)},T=(0,S.useMemo)(()=>{if(!a||a.columns.length<2||a.rows.length===0)return null;let e=a.columns,t=e.find(e=>a.rows.every(t=>typeof t[e]==`string`||t[e]===null))||e[0],n=e.filter(e=>e!==t&&a.rows.some(t=>typeof t[e]==`number`));if(n.length===0)return null;let r=a.rows.map(e=>String(e[t]??``)),i=[`#6366f1`,`#f59e0b`,`#06b6d4`,`#10b981`,`#f97316`,`#ec4899`,`#8b5cf6`,`#3b82f6`,`#ef4444`,`#14b8a6`];return{labels:r,datasets:n.map((e,t)=>({label:e,data:a.rows.map(t=>t[e]??0),backgroundColor:h===`doughnut`?i.slice(0,r.length):i[t%i.length]+`99`,borderColor:i[t%i.length],borderWidth:h===`line`?2:1,borderRadius:h===`bar`?4:0,tension:.3,fill:h===`line`,pointRadius:h===`line`?3:0}))}},[a,h]),E={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:T?.datasets?.length>1||h===`doughnut`,labels:{color:e?`#ccc`:`#555`,font:{size:11}}},tooltip:{backgroundColor:e?`#1e1e2e`:`#fff`,titleColor:e?`#fff`:`#111`,bodyColor:e?`#ccc`:`#555`,borderColor:e?`#333`:`#ddd`,borderWidth:1}},scales:h===`doughnut`?void 0:{x:{ticks:{color:e?`#888`:`#666`,font:{size:10},maxRotation:45},grid:{color:e?`#ffffff08`:`#00000008`}},y:{ticks:{color:e?`#888`:`#666`,font:{size:10}},grid:{color:e?`#ffffff08`:`#00000008`}}}},D={color:`var(--c-text)`},O={color:`var(--c-text2)`},k={background:`var(--c-card)`,border:`1px solid var(--c-border)`};return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsxs)($T,{icon:Fr,title:`SQL Viewer`,children:[(0,F.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5`,style:{color:`var(--c-text3)`,background:`var(--c-bg3)`},children:`cache.db`}),(0,F.jsx)(`div`,{className:`ml-auto`,children:(0,F.jsxs)(`button`,{onClick:()=>m(!p),className:`flex items-center gap-1 text-[11px] px-2 py-1 transition hover:bg-[var(--c-card)]`,style:{color:`var(--c-text2)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(bi,{size:11}),`Schema`,(0,F.jsx)(Cr,{size:10,className:`transition ${p?`rotate-180`:``}`})]})})]}),p&&d&&(0,F.jsx)(`div`,{className:`rounded-lg p-3 space-y-2 text-[12px]`,style:k,children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:d.tables.map(e=>(0,F.jsxs)(`div`,{className:`min-w-[180px]`,children:[(0,F.jsx)(`div`,{className:`font-semibold mb-1`,style:D,children:e}),(0,F.jsx)(`div`,{className:`space-y-0.5`,children:d.schema[e]?.map(e=>(0,F.jsxs)(`div`,{className:`flex gap-2`,style:O,children:[(0,F.jsx)(`span`,{style:D,children:e.name}),(0,F.jsx)(`span`,{className:`text-[11px] opacity-60`,children:e.type}),e.pk?(0,F.jsx)(`span`,{className:`text-[10px] px-1 rounded`,style:{background:`#6366f133`,color:`#6366f1`},children:`PK`}):null]},e.name))})]},e))})}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t===`loading`?(0,F.jsx)(`span`,{className:`text-[11px]`,style:O,children:`loading examples…`}):t===null?(0,F.jsx)(`span`,{className:`text-[11px]`,style:O,children:`examples unavailable — could not determine the schema from /api/schema`}):t.map((e,t)=>(0,F.jsx)(`button`,{onClick:()=>i(e.sql),className:`text-[11px] px-2 py-0.5 rounded transition hover:bg-[var(--c-card)]`,style:{...O,border:`1px solid var(--c-border)`},children:e.label},t))}),(0,F.jsxs)(`div`,{className:`rounded-lg overflow-hidden`,style:k,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(`span`,{className:`text-[11px] font-mono`,style:O,children:`SQL`}),(0,F.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,F.jsx)(`span`,{className:`text-[11px]`,style:O,children:`⌘+Enter to run`})})]}),(0,F.jsx)(`textarea`,{ref:y,value:r,onChange:e=>i(e.target.value),onKeyDown:x,spellCheck:!1,className:`w-full p-3 text-[12px] font-mono resize-y outline-none`,style:{background:`transparent`,color:`var(--c-text)`,minHeight:80,maxHeight:300},rows:4}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`button`,{onClick:b,disabled:l||!r.trim(),className:`flex items-center gap-1.5 px-3 py-1 text-[12px] font-medium rounded transition`,style:{background:`#6366f1`,color:`#fff`,opacity:l?.5:1},children:[(0,F.jsx)(ai,{size:11}),l?`Running...`:`Run Query`]}),_&&a&&(0,F.jsxs)(`span`,{className:`text-[11px]`,style:O,children:[a.count,` row`,a.count===1?``:`s`,` in `,_,`ms`]}),a&&(0,F.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,F.jsx)(`button`,{onClick:C,className:`p-1 rounded hover:bg-[var(--c-bg2)] transition`,style:O,title:`Copy to clipboard`,children:(0,F.jsx)(Mr,{size:12})}),(0,F.jsx)(`button`,{onClick:w,className:`p-1 rounded hover:bg-[var(--c-bg2)] transition`,style:O,title:`Download CSV`,children:(0,F.jsx)(Lr,{size:12})})]})]})]}),s&&(0,F.jsx)(`div`,{className:`rounded-lg px-3 py-2 text-[12px]`,style:{background:`#ef444420`,border:`1px solid #ef444440`,color:`#ef4444`},children:s}),a&&a.rows.length>0&&(0,F.jsx)(`div`,{className:`rounded-lg overflow-hidden`,style:k,children:(0,F.jsx)(`div`,{className:`overflow-x-auto`,style:{maxHeight:400},children:(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,style:{borderCollapse:`collapse`},children:[(0,F.jsx)(`thead`,{children:(0,F.jsx)(`tr`,{style:{borderBottom:`1px solid var(--c-border)`},children:a.columns.map(e=>(0,F.jsx)(`th`,{className:`text-left px-3 py-1.5 font-semibold sticky top-0`,style:{...D,background:`var(--c-card)`},children:e},e))})}),(0,F.jsx)(`tbody`,{children:a.rows.map((e,t)=>(0,F.jsx)(`tr`,{className:`hover:bg-[var(--c-bg2)] transition`,style:{borderBottom:`1px solid var(--c-border)`},children:a.columns.map(t=>(0,F.jsx)(`td`,{className:`px-3 py-1 font-mono`,style:O,children:
|
|
73
|
+
`)],{type:`text/csv`}),i=URL.createObjectURL(r),o=document.createElement(`a`);o.href=i,o.download=`query-results.csv`,o.click(),URL.revokeObjectURL(i)},T=(0,S.useMemo)(()=>{if(!a||a.columns.length<2||a.rows.length===0)return null;let e=a.columns,t=e.find(e=>a.rows.every(t=>typeof t[e]==`string`||t[e]===null))||e[0],n=e.filter(e=>e!==t&&a.rows.some(t=>typeof t[e]==`number`));if(n.length===0)return null;let r=a.rows.map(e=>String(e[t]??``)),i=[`#6366f1`,`#f59e0b`,`#06b6d4`,`#10b981`,`#f97316`,`#ec4899`,`#8b5cf6`,`#3b82f6`,`#ef4444`,`#14b8a6`];return{labels:r,datasets:n.map((e,t)=>({label:e,data:a.rows.map(t=>t[e]??0),backgroundColor:h===`doughnut`?i.slice(0,r.length):i[t%i.length]+`99`,borderColor:i[t%i.length],borderWidth:h===`line`?2:1,borderRadius:h===`bar`?4:0,tension:.3,fill:h===`line`,pointRadius:h===`line`?3:0}))}},[a,h]),E={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:T?.datasets?.length>1||h===`doughnut`,labels:{color:e?`#ccc`:`#555`,font:{size:11}}},tooltip:{backgroundColor:e?`#1e1e2e`:`#fff`,titleColor:e?`#fff`:`#111`,bodyColor:e?`#ccc`:`#555`,borderColor:e?`#333`:`#ddd`,borderWidth:1}},scales:h===`doughnut`?void 0:{x:{ticks:{color:e?`#888`:`#666`,font:{size:10},maxRotation:45},grid:{color:e?`#ffffff08`:`#00000008`}},y:{ticks:{color:e?`#888`:`#666`,font:{size:10}},grid:{color:e?`#ffffff08`:`#00000008`}}}},D={color:`var(--c-text)`},O={color:`var(--c-text2)`},k={background:`var(--c-card)`,border:`1px solid var(--c-border)`};return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsxs)($T,{icon:Fr,title:`SQL Viewer`,children:[(0,F.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5`,style:{color:`var(--c-text3)`,background:`var(--c-bg3)`},children:`cache.db`}),(0,F.jsx)(`div`,{className:`ml-auto`,children:(0,F.jsxs)(`button`,{onClick:()=>m(!p),className:`flex items-center gap-1 text-[11px] px-2 py-1 transition hover:bg-[var(--c-card)]`,style:{color:`var(--c-text2)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(bi,{size:11}),`Schema`,(0,F.jsx)(Cr,{size:10,className:`transition ${p?`rotate-180`:``}`})]})})]}),p&&d&&(0,F.jsx)(`div`,{className:`rounded-lg p-3 space-y-2 text-[12px]`,style:k,children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:d.tables.map(e=>(0,F.jsxs)(`div`,{className:`min-w-[180px]`,children:[(0,F.jsx)(`div`,{className:`font-semibold mb-1`,style:D,children:e}),(0,F.jsx)(`div`,{className:`space-y-0.5`,children:d.schema[e]?.map(e=>(0,F.jsxs)(`div`,{className:`flex gap-2`,style:O,children:[(0,F.jsx)(`span`,{style:D,children:e.name}),(0,F.jsx)(`span`,{className:`text-[11px] opacity-60`,children:e.type}),e.pk?(0,F.jsx)(`span`,{className:`text-[10px] px-1 rounded`,style:{background:`#6366f133`,color:`#6366f1`},children:`PK`}):null]},e.name))})]},e))})}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t===`loading`?(0,F.jsx)(`span`,{className:`text-[11px]`,style:O,children:`loading examples…`}):t===null?(0,F.jsx)(`span`,{className:`text-[11px]`,style:O,children:`examples unavailable — could not determine the schema from /api/schema`}):t.map((e,t)=>(0,F.jsx)(`button`,{onClick:()=>i(e.sql),className:`text-[11px] px-2 py-0.5 rounded transition hover:bg-[var(--c-card)]`,style:{...O,border:`1px solid var(--c-border)`},children:e.label},t))}),(0,F.jsxs)(`div`,{className:`rounded-lg overflow-hidden`,style:k,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(`span`,{className:`text-[11px] font-mono`,style:O,children:`SQL`}),(0,F.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,F.jsx)(`span`,{className:`text-[11px]`,style:O,children:`⌘+Enter to run`})})]}),(0,F.jsx)(`textarea`,{ref:y,value:r,onChange:e=>i(e.target.value),onKeyDown:x,spellCheck:!1,className:`w-full p-3 text-[12px] font-mono resize-y outline-none`,style:{background:`transparent`,color:`var(--c-text)`,minHeight:80,maxHeight:300},rows:4}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`button`,{onClick:b,disabled:l||!r.trim(),className:`flex items-center gap-1.5 px-3 py-1 text-[12px] font-medium rounded transition`,style:{background:`#6366f1`,color:`#fff`,opacity:l?.5:1},children:[(0,F.jsx)(ai,{size:11}),l?`Running...`:`Run Query`]}),_&&a&&(0,F.jsxs)(`span`,{className:`text-[11px]`,style:O,children:[a.count,` row`,a.count===1?``:`s`,` in `,_,`ms`]}),a&&(0,F.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,F.jsx)(`button`,{onClick:C,className:`p-1 rounded hover:bg-[var(--c-bg2)] transition`,style:O,title:`Copy to clipboard`,children:(0,F.jsx)(Mr,{size:12})}),(0,F.jsx)(`button`,{onClick:w,className:`p-1 rounded hover:bg-[var(--c-bg2)] transition`,style:O,title:`Download CSV`,children:(0,F.jsx)(Lr,{size:12})})]})]})]}),s&&(0,F.jsx)(`div`,{className:`rounded-lg px-3 py-2 text-[12px]`,style:{background:`#ef444420`,border:`1px solid #ef444440`,color:`#ef4444`},children:s}),a&&a.rows.length>0&&(0,F.jsx)(`div`,{className:`rounded-lg overflow-hidden`,style:k,children:(0,F.jsx)(`div`,{className:`overflow-x-auto`,style:{maxHeight:400},children:(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,style:{borderCollapse:`collapse`},children:[(0,F.jsx)(`thead`,{children:(0,F.jsx)(`tr`,{style:{borderBottom:`1px solid var(--c-border)`},children:a.columns.map(e=>(0,F.jsx)(`th`,{className:`text-left px-3 py-1.5 font-semibold sticky top-0`,style:{...D,background:`var(--c-card)`},children:e},e))})}),(0,F.jsx)(`tbody`,{children:a.rows.map((e,t)=>(0,F.jsx)(`tr`,{className:`hover:bg-[var(--c-bg2)] transition`,style:{borderBottom:`1px solid var(--c-border)`},children:a.columns.map(t=>(0,F.jsx)(`td`,{className:`px-3 py-1 font-mono`,style:O,children:zE(e[t])},t))},t))})]})})}),a&&a.rows.length===0&&(0,F.jsx)(`div`,{className:`rounded-lg px-3 py-6 text-center text-[12px]`,style:{...k,...O},children:`Query returned 0 rows`}),T&&(0,F.jsxs)(`div`,{className:`rounded-lg p-4`,style:k,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,F.jsx)(`span`,{className:`text-[12px] font-semibold`,style:D,children:`Visualization`}),(0,F.jsx)(`div`,{className:`flex gap-0.5 ml-2`,style:{border:`1px solid var(--c-border)`,borderRadius:6},children:[{type:`bar`,icon:yr},{type:`line`,icon:br},{type:`doughnut`,icon:xr}].map(({type:e,icon:t})=>(0,F.jsx)(`button`,{onClick:()=>g(e),className:`p-1.5 transition`,style:{background:h===e?`var(--c-bg2)`:`transparent`,color:h===e?`var(--c-white)`:`var(--c-text3)`,borderRadius:4},children:(0,F.jsx)(t,{size:12})},e))})]}),(0,F.jsxs)(`div`,{style:{height:h===`doughnut`?280:260},children:[h===`bar`&&(0,F.jsx)(wh,{data:T,options:E}),h===`line`&&(0,F.jsx)(Ch,{data:T,options:E}),h===`doughnut`&&(0,F.jsx)(Th,{data:T,options:E})]})]})]})}function zE(e){if(e==null)return(0,F.jsx)(`span`,{className:`opacity-30`,children:`NULL`});if(typeof e==`number`)return e.toLocaleString();let t=String(e);return t.length>120?t.substring(0,120)+`…`:t}var BE=`JetBrains Mono, monospace`;function VE(e){return e<1024?e+` B`:e<1024*1024?(e/1024).toFixed(1)+` KB`:(e/(1024*1024)).toFixed(1)+` MB`}function HE(e){return e?new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`2-digit`,minute:`2-digit`}):``}function UE(e){return e?Math.round(e.length/4):0}function WE(e){return e<1e3?String(e):e<1e6?(e/1e3).toFixed(1)+`k`:(e/1e6).toFixed(2)+`M`}function GE(e){let t=e/1e6*3;return t<.001?`<$0.001`:t<.01?`$`+t.toFixed(4):`$`+t.toFixed(3)}function KE(e){if(!e)return`text`;let t=e.toLowerCase();return t.endsWith(`.json`)?`json`:t.endsWith(`.md`)||t.endsWith(`.mdc`)?`markdown`:t.endsWith(`.yaml`)||t.endsWith(`.yml`)?`yaml`:`text`}function qE({content:e}){let t;try{t=JSON.parse(e)}catch{return(0,F.jsx)(`pre`,{className:`text-[12px] whitespace-pre-wrap break-words leading-relaxed`,style:{color:`#ef4444`,fontFamily:BE},children:`Invalid JSON`})}let n=JSON.stringify(t,null,2);return(0,F.jsx)(`pre`,{className:`text-[12px] whitespace-pre-wrap break-words leading-relaxed`,style:{fontFamily:BE},children:n.split(`
|
|
71
74
|
`).map((e,t)=>{let n=[],r=e,i=r.match(/^(\s*)"([^"]+)"(:)/);i&&(n.push((0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:i[1]},`i${t}`)),n.push((0,F.jsxs)(`span`,{style:{color:`#818cf8`},children:[`"`,i[2],`"`]},`k${t}`)),n.push((0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`:`},`c${t}`)),r=r.slice(i[0].length));let a=r.match(/^(\s*)"([^"]*)"(.*)/);if(a)n.push((0,F.jsx)(`span`,{children:a[1]},`sp${t}`)),n.push((0,F.jsxs)(`span`,{style:{color:`#22c55e`},children:[`"`,a[2],`"`]},`v${t}`)),n.push((0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:a[3]},`r${t}`));else{let e=r.match(/^(\s*)(true|false|null|-?\d+\.?\d*)(.*)?/);e?(n.push((0,F.jsx)(`span`,{children:e[1]},`sp${t}`)),n.push((0,F.jsx)(`span`,{style:{color:e[2]===`null`?`#ef4444`:e[2]===`true`||e[2]===`false`?`#f59e0b`:`#22d3ee`},children:e[2]},`v${t}`)),n.push((0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:e[3]||``},`r${t}`))):n.push((0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:r},`x${t}`))}return(0,F.jsxs)(`span`,{children:[n,`
|
|
72
|
-
`]},t)})})}function
|
|
73
|
-
`);for(let e=0;e<r.length;e++){let t=r[e].match(/^(\w[\w-]*):\s*(.*)/);if(t){let i=t[1],a=t[2].replace(/^["']|["']$/g,``).trim();if(a)n.push([i,a]);else{let t=[];for(;e+1<r.length&&/^\s+-\s/.test(r[e+1]);){e++;let n=r[e].replace(/^\s+-\s*/,``),i=n.match(/^\[([ xX])\]\s*(.*)/);if(i)t.push({type:`checkbox`,checked:i[1]!==` `,text:i[2]});else{let i=n.match(/^(\w[\w-]*):\s*(.*)/);if(i){let n={[i[1]]:i[2].replace(/^["']|["']$/g,``)};for(;e+1<r.length&&/^\s{4,}\w/.test(r[e+1])&&!/^\s+-/.test(r[e+1]);){e++;let t=r[e].trim().match(/^(\w[\w-]*):\s*(.*)/);t&&(n[t[1]]=t[2].replace(/^["']|["']$/g,``))}t.push({type:`object`,data:n})}else t.push({type:`text`,text:n})}}n.push([i,t.length?t:``])}}}return{frontmatter:n.length?n:null,body:t[2]}}var XE={completed:{bg:`rgba(34,197,94,0.12)`,color:`#22c55e`,icon:`✓`},in_progress:{bg:`rgba(99,102,241,0.12)`,color:`#818cf8`,icon:`◐`},pending:{bg:`rgba(250,204,21,0.12)`,color:`#facc15`,icon:`○`},blocked:{bg:`rgba(239,68,68,0.12)`,color:`#ef4444`,icon:`✕`}};function ZE({val:e}){return typeof e==`string`?(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:e}):Array.isArray(e)?e.some(e=>e.type===`object`)?(0,F.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4,width:`100%`},children:e.map((e,t)=>{if(e.type!==`object`)return(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:e.text||``},t);let n=e.data,r=(n.status||``).toLowerCase().replace(/\s+/g,`_`),i=XE[r]||XE.pending,a=r===`completed`;return(0,F.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`3px 0`},children:[(0,F.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:16,height:16,borderRadius:3,flexShrink:0,background:i.bg,color:i.color,fontSize:10,fontWeight:700},children:i.icon}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`,opacity:a?.55:1,textDecoration:a?`line-through`:`none`,flex:1},children:n.content||n.title||n.name||n.id||JSON.stringify(n)}),n.status&&(0,F.jsx)(`span`,{style:{fontSize:10,padding:`1px 6px`,borderRadius:3,background:i.bg,color:i.color,flexShrink:0},children:n.status})]},t)})}):(0,F.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:e.map((e,t)=>(0,F.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:6,color:`var(--c-text2)`,cursor:`default`},children:[e.type===`checkbox`?(0,F.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:14,height:14,borderRadius:3,flexShrink:0,border:e.checked?`none`:`1.5px solid var(--c-text3)`,background:e.checked?`#6366f1`:`transparent`,color:`#fff`,fontSize:10,lineHeight:1},children:e.checked?`✓`:``}):(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`•`}),(0,F.jsx)(`span`,{style:{textDecoration:e.checked?`line-through`:`none`,opacity:e.checked?.5:1},children:e.text})]},t))}):null}function QE({content:e}){let{frontmatter:t,body:n}=YE(e);return(0,F.jsxs)(`div`,{className:`artifact-markdown`,style:{color:`var(--c-text)`,fontSize:14,lineHeight:1.7,maxWidth:720,margin:`0 auto`},children:[t&&(0,F.jsx)(`div`,{style:{background:`var(--c-bg)`,border:`1px solid var(--c-border)`,borderRadius:6,padding:`10px 14px`,marginBottom:16,fontSize:12,fontFamily:VE},children:t.map(([e,t],n)=>(0,F.jsxs)(`div`,{style:{display:`flex`,gap:8,padding:`3px 0`,alignItems:Array.isArray(t)?`flex-start`:`center`},children:[(0,F.jsx)(`span`,{style:{color:`#818cf8`,minWidth:100,flexShrink:0,paddingTop:Array.isArray(t)?1:0},children:e}),(0,F.jsx)(ZE,{val:t})]},n))}),(0,F.jsx)(wS,{remarkPlugins:[OT],components:{h1:({children:e})=>(0,F.jsx)(`h1`,{style:{fontSize:22,fontWeight:700,margin:`0 0 12px 0`,paddingBottom:8,borderBottom:`1px solid var(--c-border)`,color:`var(--c-white)`},children:e}),h2:({children:e})=>(0,F.jsx)(`h2`,{style:{fontSize:18,fontWeight:600,margin:`20px 0 8px 0`,paddingBottom:6,borderBottom:`1px solid var(--c-border)`,color:`var(--c-white)`},children:e}),h3:({children:e})=>(0,F.jsx)(`h3`,{style:{fontSize:15,fontWeight:600,margin:`16px 0 6px 0`,color:`var(--c-white)`},children:e}),h4:({children:e})=>(0,F.jsx)(`h4`,{style:{fontSize:14,fontWeight:600,margin:`12px 0 4px 0`,color:`var(--c-white)`},children:e}),p:({children:e})=>(0,F.jsx)(`p`,{style:{margin:`0 0 10px 0`},children:e}),ul:({children:e})=>(0,F.jsx)(`ul`,{style:{margin:`0 0 10px 0`,paddingLeft:24,listStyleType:`disc`},children:e}),ol:({children:e})=>(0,F.jsx)(`ol`,{style:{margin:`0 0 10px 0`,paddingLeft:24,listStyleType:`decimal`},children:e}),li:({children:e,className:t})=>{let n=t===`task-list-item`;return(0,F.jsx)(`li`,{style:{margin:`2px 0`,listStyleType:n?`none`:void 0,marginLeft:n?-20:0},children:e})},input:({type:e,checked:t})=>e===`checkbox`?(0,F.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:15,height:15,borderRadius:3,marginRight:6,verticalAlign:-2,flexShrink:0,border:t?`none`:`1.5px solid var(--c-text3)`,background:t?`#6366f1`:`transparent`,color:`#fff`,fontSize:10},children:t?`✓`:``}):null,pre:({children:e})=>(0,F.jsx)(`pre`,{style:{background:`var(--c-bg)`,border:`1px solid var(--c-border)`,borderRadius:6,padding:12,margin:`8px 0 12px 0`,overflow:`auto`,fontFamily:VE,fontSize:12,color:`var(--c-text)`,lineHeight:1.6},children:e}),code:({node:e,children:t})=>e?.position&&e.position.start.line!==e.position.end.line?(0,F.jsx)(`code`,{children:t}):(0,F.jsx)(`code`,{style:{background:`var(--c-bg3)`,padding:`1px 5px`,borderRadius:4,fontFamily:VE,fontSize:12,color:`#818cf8`},children:t}),blockquote:({children:e})=>(0,F.jsx)(`blockquote`,{style:{borderLeft:`3px solid #6366f1`,paddingLeft:12,margin:`8px 0`,color:`var(--c-text2)`,fontStyle:`italic`},children:e}),table:({children:e})=>(0,F.jsx)(`div`,{style:{overflow:`auto`,margin:`8px 0 12px 0`},children:(0,F.jsx)(`table`,{style:{borderCollapse:`collapse`,width:`100%`,fontSize:13},children:e})}),thead:({children:e})=>(0,F.jsx)(`thead`,{style:{borderBottom:`2px solid var(--c-border)`},children:e}),th:({children:e})=>(0,F.jsx)(`th`,{style:{textAlign:`left`,padding:`6px 12px`,fontWeight:600,color:`var(--c-white)`},children:e}),td:({children:e})=>(0,F.jsx)(`td`,{style:{padding:`5px 12px`,borderBottom:`1px solid var(--c-border)`},children:e}),a:({href:e,children:t})=>(0,F.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,style:{color:`#818cf8`,textDecoration:`underline`,textUnderlineOffset:2},children:t}),hr:()=>(0,F.jsx)(`hr`,{style:{border:`none`,borderTop:`1px solid var(--c-border)`,margin:`16px 0`}}),strong:({children:e})=>(0,F.jsx)(`strong`,{style:{color:`var(--c-white)`,fontWeight:600},children:e}),img:({src:e,alt:t})=>(0,F.jsx)(`img`,{src:e,alt:t,style:{maxWidth:`100%`,borderRadius:6,margin:`8px 0`}})},children:n})]})}function $E({content:e,fileName:t,viewRaw:n}){if(n)return(0,F.jsx)(`pre`,{className:`text-[12px] whitespace-pre-wrap break-words leading-relaxed`,style:{color:`var(--c-text)`,fontFamily:VE},children:e});let r=qE(t);return r===`json`?(0,F.jsx)(JE,{content:e}):r===`markdown`?(0,F.jsx)(QE,{content:e}):(0,F.jsx)(`pre`,{className:`text-[12px] whitespace-pre-wrap break-words leading-relaxed`,style:{color:`var(--c-text)`,fontFamily:VE},children:e})}function eD(){let[e,t]=(0,S.useState)(null),[n,r]=(0,S.useState)(``),[i,a]=(0,S.useState)(new Set),[o,s]=(0,S.useState)(new Set),[c,l]=(0,S.useState)(null),[u,d]=(0,S.useState)(null),[f,p]=(0,S.useState)(!1),[m,h]=(0,S.useState)(!1);(0,S.useEffect)(()=>{ia().then(e=>{t(e),e&&e.length>0&&(a(new Set([e[0].folder])),e[0].editors.length>0&&s(new Set([e[0].folder+`::`+e[0].editors[0].editor])))})},[]);let g=async e=>{l(e),h(!1),p(!0);try{d(await aa(e.path))}catch{d({error:`Failed to load file content`})}p(!1)},_=e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},v=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};if(!e)return(0,F.jsx)(wa,{label:`Scanning project artifacts...`});let y=e.filter(e=>{if(!n)return!0;let t=n.toLowerCase();return e.name.toLowerCase().includes(t)||e.folder.toLowerCase().includes(t)?!0:e.editors.some(e=>e.label.toLowerCase().includes(t)||e.files.some(e=>e.name.toLowerCase().includes(t)))}),b=e.reduce((e,t)=>e+t.totalArtifacts,0),x=e.length,C=new Set;for(let t of e)for(let e of t.editors)C.add(e.editor);return(0,F.jsxs)(`div`,{className:`h-full`,children:[(0,F.jsx)(`div`,{className:`px-4 py-3`,style:{borderBottom:`1px solid var(--c-border)`},children:(0,F.jsxs)($T,{icon:ii,title:`Artifacts`,children:[(0,F.jsxs)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:[b,` artifacts · `,x,` projects · `,C.size,` editors`]}),(0,F.jsxs)(`div`,{className:`ml-auto relative`,children:[(0,F.jsx)(ui,{size:12,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,placeholder:`Search artifacts...`,value:n,onChange:e=>r(e.target.value),className:`pl-7 pr-3 py-1 text-[12px] outline-none w-[200px]`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,color:`var(--c-text)`}})]})]})}),y.length===0?(0,F.jsx)(`div`,{className:`text-sm py-12 text-center`,style:{color:`var(--c-text3)`},children:n?`No artifacts match your search`:`No AI artifacts found in any project folders`}):null,(0,F.jsxs)(`div`,{className:`flex`,style:{height:`calc(100vh - 130px)`},children:[(0,F.jsxs)(`div`,{className:`w-[340px] shrink-0 flex flex-col`,style:{background:`var(--c-card)`,borderRight:`1px solid var(--c-border)`},children:[(0,F.jsx)(`div`,{className:`px-3 py-2 text-[11px] font-semibold uppercase tracking-wider`,style:{color:`var(--c-text3)`,borderBottom:`1px solid var(--c-border)`},children:`Project Tree`}),(0,F.jsx)(`div`,{className:`overflow-y-auto flex-1`,children:y.map(e=>{let t=i.has(e.folder);return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`button`,{onClick:()=>_(e.folder),className:`w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-[var(--c-bg3)] transition`,style:{borderBottom:`1px solid var(--c-border)`},children:[t?(0,F.jsx)(Cr,{size:12,style:{color:`var(--c-text3)`}}):(0,F.jsx)(wr,{size:12,style:{color:`var(--c-text3)`}}),(0,F.jsx)(Ur,{size:13,style:{color:`#6366f1`}}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`text-[12px] font-medium truncate`,style:{color:`var(--c-white)`},children:e.name}),(0,F.jsx)(`div`,{className:`text-[10px] truncate`,style:{color:`var(--c-text3)`,fontFamily:VE},children:e.folder})]}),(0,F.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded`,style:{background:`rgba(99,102,241,0.12)`,color:`#818cf8`},children:e.totalArtifacts})]}),t&&e.editors.map(t=>{let n=e.folder+`::`+t.editor,r=o.has(n);return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`button`,{onClick:()=>v(n),className:`w-full flex items-center gap-2 pl-7 pr-3 py-1.5 text-left hover:bg-[var(--c-bg3)] transition`,children:[r?(0,F.jsx)(Cr,{size:10,style:{color:`var(--c-text3)`}}):(0,F.jsx)(wr,{size:10,style:{color:`var(--c-text3)`}}),t.editor===`_general`?(0,F.jsx)(Br,{size:12,style:{color:`var(--c-text2)`}}):(0,F.jsx)(Gh,{source:t.editor,size:12}),(0,F.jsx)(`span`,{className:`text-[11px] font-medium`,style:{color:t.editor===`_general`?`var(--c-text2)`:Oh(t.editor)},children:t.editor===`_general`?t.label:q(t.editor)}),(0,F.jsx)(`span`,{className:`text-[10px] ml-auto`,style:{color:`var(--c-text3)`},children:t.files.length})]}),r&&t.files.map(e=>(0,F.jsxs)(`button`,{onClick:()=>g(e),className:`w-full flex items-center gap-2 pl-12 pr-3 py-1.5 text-left hover:bg-[var(--c-bg3)] transition`,style:{background:c?.path===e.path?`var(--c-bg3)`:`transparent`,borderLeft:c?.path===e.path?`2px solid #6366f1`:`2px solid transparent`},children:[(0,F.jsx)(Br,{size:11,style:{color:`var(--c-text3)`}}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`text-[11px] truncate`,style:{color:`var(--c-text)`,fontFamily:VE},children:e.relativePath}),(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[HE(e.size),` · `,e.lines,` lines`]})]})]},e.path))]},n)})]},e.folder)})})]}),(0,F.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,style:{background:`var(--c-card)`},children:c?(0,F.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2.5`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(Br,{size:14,style:{color:`#6366f1`}}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[12px] font-medium`,style:{color:`var(--c-white)`,fontFamily:VE},children:c.relativePath}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(`span`,{children:HE(c.size)}),(0,F.jsxs)(`span`,{children:[c.lines,` lines`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(Ar,{size:9}),UE(c.modifiedAt)]})]})]}),u?.content&&(()=>{let e=WE(u.content);return(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] px-2 py-0.5 rounded`,style:{background:`rgba(99,102,241,0.08)`,border:`1px solid rgba(99,102,241,0.15)`,color:`#818cf8`},children:[(0,F.jsx)(Ti,{size:9}),GE(e),` tokens`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] px-2 py-0.5 rounded`,style:{background:`rgba(34,197,94,0.08)`,border:`1px solid rgba(34,197,94,0.15)`,color:`#22c55e`},children:[(0,F.jsx)(Ir,{size:9}),KE(e)]})]})})(),(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] px-2 py-0.5 rounded`,style:{background:`${Oh(c.editor)}15`,color:Oh(c.editor)},children:[c.editor!==`_general`&&(0,F.jsx)(Gh,{source:c.editor,size:11}),c.editorLabel]}),(0,F.jsxs)(`button`,{onClick:()=>h(e=>!e),className:`flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium transition`,style:{background:m?`rgba(99,102,241,0.15)`:`var(--c-bg3)`,color:m?`#818cf8`:`var(--c-text2)`,border:`1px solid `+(m?`rgba(99,102,241,0.3)`:`var(--c-border)`)},title:m?`Switch to rendered view`:`Switch to raw view`,children:[m?(0,F.jsx)(zr,{size:12}):(0,F.jsx)(jr,{size:12}),m?`Rendered`:`Raw`]}),(0,F.jsx)(`button`,{onClick:()=>{l(null),d(null)},className:`p-1 rounded hover:bg-[var(--c-bg3)] transition`,style:{color:`var(--c-text3)`},children:(0,F.jsx)(ki,{size:14})})]}),(0,F.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:f?(0,F.jsx)(`div`,{className:`text-[12px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`Loading...`}):u?.error?(0,F.jsx)(`div`,{className:`text-[12px] py-8 text-center`,style:{color:`#ef4444`},children:u.error}):u?.content?(0,F.jsx)($E,{content:u.content,fileName:c.name,viewRaw:m}):null})]}):(0,F.jsx)(`div`,{className:`flex items-center justify-center flex-1 text-[13px]`,style:{color:`var(--c-text3)`},children:(0,F.jsxs)(`div`,{className:`text-center`,children:[(0,F.jsx)(ii,{size:32,className:`mx-auto mb-3 opacity-30`}),(0,F.jsx)(`div`,{children:`Select an artifact to view its contents`}),(0,F.jsx)(`div`,{className:`text-[11px] mt-1 opacity-60`,children:`Click any file in the sidebar tree`})]})})})]})]})}function tD(){let[e,t]=(0,S.useState)(null),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(!0),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(``),[u,d]=(0,S.useState)(!1);if((0,S.useEffect)(()=>{Promise.all([Yi(),Zi()]).then(([e,n])=>{t(e),r(n),a(!1)}).catch(()=>a(!1))},[]),i||!e)return(0,F.jsx)(wa,{label:`Loading settings...`});let f=e.hiddenProjects||[],p=async e=>{s(!0),t(await Xi({hiddenProjects:f.includes(e)?f.filter(t=>t!==e):[...f,e]})),s(!1)},m=[...n.filter(e=>{if(!c)return!0;let t=c.toLowerCase();return e.folder.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)})].sort((e,t)=>e.name.localeCompare(t.name)),h=!!e.allowSubscriptionAccess;return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:pi,title:`Settings`}),(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`px-3 py-2 flex items-center justify-between`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)($,{children:[h?(0,F.jsx)(hi,{size:11,className:`inline mr-1`}):(0,F.jsx)(gi,{size:11,className:`inline mr-1`}),`subscription access`]}),(0,F.jsx)(`button`,{onClick:()=>d(!0),disabled:o,className:`text-[11px] px-2 py-0.5 rounded transition`,style:{background:h?`rgba(34,197,94,0.08)`:`rgba(239,68,68,0.08)`,color:h?`#22c55e`:`#ef4444`,border:`1px solid ${h?`rgba(34,197,94,0.15)`:`rgba(239,68,68,0.15)`}`},children:h?`Enabled`:`Disabled`})]}),(0,F.jsxs)(`div`,{className:`text-[11px] px-3 py-2`,style:{color:`var(--c-text3)`},children:[`When enabled, Agentlytics reads locally stored auth tokens (Keychain, SQLite, config files) to show your plan and usage info for each editor. Tokens are kept in-memory only and `,(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`never sent to any third-party service`}),`.`]})]}),(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`px-3 py-2 flex items-center justify-between`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)($,{children:[(0,F.jsx)(Ur,{size:11,className:`inline mr-1`}),`projects (`,n.length,`)`]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f.length>0&&(0,F.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5`,style:{background:`rgba(239,68,68,0.08)`,color:`#ef4444`,border:`1px solid rgba(239,68,68,0.15)`},children:[f.length,` hidden`]}),(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(ui,{size:11,className:`absolute left-2 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:`Filter projects...`,className:`pl-6 pr-2 py-1 text-[11px] outline-none w-[180px]`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`}})]})]})]}),(0,F.jsx)(`div`,{className:`text-[11px] px-3 py-1.5`,style:{color:`var(--c-text3)`,borderBottom:`1px solid var(--c-border)`,background:`var(--c-bg3)`},children:`Hidden projects are excluded from all dashboard stats, sessions, costs, and analytics.`}),m.map(e=>(0,F.jsx)(rD,{project:e,hidden:f.includes(e.folder),onToggle:p,saving:o},e.folder)),m.length===0&&(0,F.jsx)(`div`,{className:`text-center py-6 text-[12px]`,style:{color:`var(--c-text3)`},children:`no projects match filter`})]}),u&&(0,F.jsx)(nD,{enabling:!h,saving:o,onConfirm:async()=>{s(!0),t(await Xi({allowSubscriptionAccess:!h})),s(!1),d(!1)},onCancel:()=>d(!1)})]})}function nD({enabling:e,saving:t,onConfirm:n,onCancel:r}){return(0,F.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,style:{background:`rgba(0,0,0,0.6)`},onClick:r,children:(0,F.jsxs)(`div`,{className:`card w-[420px] mx-4`,onClick:e=>e.stopPropagation(),style:{background:`var(--c-bg2)`,border:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-medium`,style:{color:`var(--c-white)`},children:[(0,F.jsx)(wi,{size:14,style:{color:e?`#fbbf24`:`#ef4444`}}),e?`Enable`:`Disable`,` Subscription Access`]}),(0,F.jsx)(`button`,{onClick:r,className:`p-1 rounded hover:bg-[var(--c-bg3)]`,style:{color:`var(--c-text3)`},children:(0,F.jsx)(ki,{size:14})})]}),(0,F.jsx)(`div`,{className:`px-4 py-3 text-[11px] space-y-2`,style:{color:`var(--c-text2)`},children:e?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{children:`This will allow Agentlytics to read locally stored auth tokens from:`}),(0,F.jsxs)(`ul`,{className:`space-y-1 pl-3`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(`li`,{children:`Claude Code – macOS Keychain / Linux secret-tool`}),(0,F.jsx)(`li`,{children:`Cursor – local SQLite (state.vscdb)`}),(0,F.jsx)(`li`,{children:`Copilot / VS Code – ~/.config/github-copilot/apps.json`}),(0,F.jsx)(`li`,{children:`Codex – local auth.json (JWT decode only)`}),(0,F.jsx)(`li`,{children:`Devin – local SQLite (state.vscdb)`})]}),(0,F.jsxs)(`p`,{style:{color:`var(--c-text2)`},children:[`Tokens are kept `,(0,F.jsx)(`strong`,{children:`in-memory only`}),` and never sent to any third-party service.`]})]}):(0,F.jsx)(`p`,{children:`This will stop Agentlytics from reading any local auth tokens. Subscription and plan details will no longer be collected.`})}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2 px-4 py-3`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`button`,{onClick:r,className:`text-[11px] px-3 py-1 rounded transition`,style:{color:`var(--c-text3)`,border:`1px solid var(--c-border)`},children:`Cancel`}),(0,F.jsx)(`button`,{onClick:n,disabled:t,className:`text-[11px] px-3 py-1 rounded transition font-medium`,style:{background:e?`rgba(34,197,94,0.12)`:`rgba(239,68,68,0.12)`,color:e?`#22c55e`:`#ef4444`,border:`1px solid ${e?`rgba(34,197,94,0.2)`:`rgba(239,68,68,0.2)`}`},children:t?`Saving...`:e?`Yes, enable`:`Yes, disable`})]})]})})}function rD({project:e,hidden:t,onToggle:n,saving:r}){let i=Object.entries(e.editors||{}).sort((e,t)=>t[1]-e[1]);return(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 transition`,style:{borderBottom:`1px solid var(--c-border)`,opacity:t?.5:1},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,children:[(0,F.jsx)(`button`,{onClick:()=>n(e.folder),disabled:r,className:`shrink-0 p-1 rounded transition hover:bg-[var(--c-bg)]`,style:{color:t?`#ef4444`:`var(--c-text3)`,border:`1px solid var(--c-border)`},title:t?`Show this project`:`Hide this project`,children:t?(0,F.jsx)(Rr,{size:12}):(0,F.jsx)(zr,{size:12})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`text-[12px] font-medium truncate`,style:{color:t?`var(--c-text3)`:`var(--c-white)`},children:e.name}),(0,F.jsx)(`div`,{className:`text-[10px] truncate`,style:{color:`var(--c-text3)`},title:e.folder,children:e.folder})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:i.slice(0,3).map(([e,t])=>(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Gh,{source:e,size:10}),t]},e))}),(0,F.jsx)(`div`,{className:`text-[11px] font-mono shrink-0`,style:{color:`var(--c-text2)`},children:J(e.totalSessions)}),(0,F.jsx)(`div`,{className:`text-[10px] shrink-0 w-[80px] text-right`,style:{color:`var(--c-text3)`},children:Ah(e.lastSeen)})]})}function iD({value:e,max:t=100,color:n,label:r}){let i=t>0?Math.min(e/t*100,100):0;return(0,F.jsxs)(`div`,{children:[r&&(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text2)`},children:r}),(0,F.jsxs)(`span`,{className:`text-[10px] font-mono`,style:{color:`var(--c-white)`},children:[typeof e==`number`?e.toFixed(1):e,`%`]})]}),(0,F.jsx)(`div`,{className:`h-1.5 w-full`,style:{background:`var(--c-bg3)`},children:(0,F.jsx)(`div`,{className:`h-full transition-all duration-500`,style:{width:`${i}%`,background:n||`#6366f1`}})})]})}function aD({date:e}){if(!e)return null;let t=new Date(e)-new Date;if(t<=0)return(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:`expired`});let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>24?(0,F.jsxs)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[`resets in `,Math.floor(n/24),`d `,n%24,`h`]}):(0,F.jsxs)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[`resets in `,n,`h `,r,`m`]})}function oD({name:e}){if(!e)return null;let t=(e||``).toLowerCase(),n=`rgba(99,102,241,0.12)`,r=`#818cf8`;return t.includes(`pro`)&&(n=`rgba(168,85,247,0.12)`,r=`#a855f7`),(t.includes(`max`)||t.includes(`ultra`))&&(n=`rgba(234,179,8,0.12)`,r=`#eab308`),t.includes(`plus`)&&(n=`rgba(34,197,94,0.12)`,r=`#22c55e`),t.includes(`free`)&&(n=`rgba(107,114,128,0.12)`,r=`#6b7280`),(0,F.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-wider px-2 py-0.5`,style:{background:n,color:r},children:e})}function sD({label:e,enabled:t}){return(0,F.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5`,style:{background:t?`rgba(34,197,94,0.08)`:`rgba(107,114,128,0.06)`,color:t?`#22c55e`:`var(--c-text3)`,border:`1px solid ${t?`rgba(34,197,94,0.15)`:`var(--c-border)`}`},children:e})}function cD({data:e}){let t=e.usage||{},n=Object.keys(t);return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(oD,{name:e.plan?.name}),e.plan?.status&&(0,F.jsxs)(`span`,{className:`text-[10px]`,style:{color:e.plan.status===`active`?`#22c55e`:`var(--c-text3)`},children:[`● `,e.plan.status]}),e.plan?.isYearlyPlan&&(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:`yearly`})]}),e.startOfMonth&&(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ar,{size:9,className:`inline mr-1`}),`billing started `,new Date(e.startOfMonth).toLocaleDateString()]}),n.length>0&&(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(`div`,{className:`text-[10px] font-medium`,style:{color:`var(--c-text2)`},children:`model usage`}),n.map(e=>{let n=t[e];return n.maxRequestUsage&&Math.round(n.numRequests/n.maxRequestUsage*100),(0,F.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,F.jsx)(`span`,{className:`font-mono`,style:{color:`var(--c-white)`},children:e}),(0,F.jsxs)(`span`,{style:{color:`var(--c-text2)`},children:[n.numRequests,n.maxRequestUsage?` / ${n.maxRequestUsage}`:``,` requests`]})]},e)})]})]})}function lD({data:e}){let t=e.usage||{},n=e.billingCycle||{};return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(oD,{name:e.plan?.name}),e.user?.name&&(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:e.user.name})]}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[t.promptCredits&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex justify-between text-[10px] mb-0.5`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`prompt credits`}),(0,F.jsxs)(`span`,{className:`font-mono`,style:{color:`var(--c-white)`},children:[t.promptCredits.remaining,` / `,t.promptCredits.allocated]})]}),(0,F.jsx)(iD,{value:t.promptCredits.allocated>0?t.promptCredits.remaining/t.promptCredits.allocated*100:0,color:`#06b6d4`})]}),t.flexCredits&&t.flexCredits.allocated>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex justify-between text-[10px] mb-0.5`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`flex credits`}),(0,F.jsxs)(`span`,{className:`font-mono`,style:{color:`var(--c-white)`},children:[t.flexCredits.remaining,` / `,t.flexCredits.allocated]})]}),(0,F.jsx)(iD,{value:t.flexCredits.allocated>0?t.flexCredits.remaining/t.flexCredits.allocated*100:0,color:`#a78bfa`})]}),t.totalRemainingCredits!=null&&(0,F.jsxs)(`div`,{className:`flex items-center justify-between pt-1`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`span`,{className:`text-[10px] font-medium`,style:{color:`var(--c-text2)`},children:`total remaining`}),(0,F.jsx)(`span`,{className:`text-[13px] font-bold font-mono`,style:{color:`var(--c-white)`},children:t.totalRemainingCredits})]})]}),(n.start||n.end)&&(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ar,{size:9,className:`inline mr-1`}),n.start&&new Date(n.start).toLocaleDateString(),` → `,n.end&&new Date(n.end).toLocaleDateString()]}),e.features&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.entries(e.features).map(([e,t])=>(0,F.jsx)(sD,{label:e.replace(/([A-Z])/g,` $1`).trim(),enabled:t},e))})]})}function uD({data:e}){let t=e.usage||{};return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsx)(oD,{name:e.plan?.name}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[t.fiveHour&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(iD,{value:t.fiveHour.utilization,color:t.fiveHour.utilization>80?`#ef4444`:`#f97316`,label:`5-hour limit`}),(0,F.jsx)(aD,{date:t.fiveHour.resetsAt})]}),t.sevenDay&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(iD,{value:t.sevenDay.utilization,color:t.sevenDay.utilization>80?`#ef4444`:`#f97316`,label:`7-day limit`}),(0,F.jsx)(aD,{date:t.sevenDay.resetsAt})]}),t.sevenDaySonnet&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(iD,{value:t.sevenDaySonnet.utilization,color:`#a78bfa`,label:`7-day Sonnet`}),(0,F.jsx)(aD,{date:t.sevenDaySonnet.resetsAt})]}),t.sevenDayOpus&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(iD,{value:t.sevenDayOpus.utilization,color:`#c084fc`,label:`7-day Opus`}),(0,F.jsx)(aD,{date:t.sevenDayOpus.resetsAt})]})]}),e.extraUsage&&(0,F.jsxs)(`div`,{className:`text-[10px] flex items-center gap-1.5`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ai,{size:9}),`extra usage: `,e.extraUsage.isEnabled?(0,F.jsxs)(`span`,{style:{color:`#22c55e`},children:[`enabled`,e.extraUsage.utilization==null?``:` (${e.extraUsage.utilization}% used)`]}):(0,F.jsx)(`span`,{children:`disabled`})]})]})}function dD({data:e}){return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(oD,{name:e.plan?.name}),e.plan?.individual&&(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:`individual`})]}),e.user?.login&&(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[`@`,e.user.login]}),e.features&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.entries(e.features).map(([e,t])=>(0,F.jsx)(sD,{label:e.replace(/([A-Z])/g,` $1`).trim(),enabled:t},e))}),e.limits?.quotas&&(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text2)`},children:[(0,F.jsx)(_i,{size:9,className:`inline mr-1`}),`quotas: `,JSON.stringify(e.limits.quotas),e.limits.resetDate&&(0,F.jsxs)(`span`,{children:[` (resets `,new Date(e.limits.resetDate).toLocaleDateString(),`)`]})]})]})}function fD({data:e}){let t=e.plan||{};return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(oD,{name:t.name}),e.authMode&&(0,F.jsxs)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[`via `,e.authMode]})]}),e.user?.email&&(0,F.jsx)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:e.user.email}),(t.subscriptionStart||t.subscriptionEnd)&&(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ar,{size:9,className:`inline mr-1`}),t.subscriptionStart&&new Date(t.subscriptionStart).toLocaleDateString(),` → `,t.subscriptionEnd&&new Date(t.subscriptionEnd).toLocaleDateString()]})]})}function pD({data:e}){return(0,F.jsxs)(`div`,{className:`space-y-2`,children:[e.plan?.name&&(0,F.jsx)(oD,{name:e.plan.name}),e.user&&(0,F.jsx)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:e.user.email||e.user.login||e.user.name||e.user.id||``}),(0,F.jsx)(`pre`,{className:`text-[10px] overflow-auto p-2`,style:{background:`var(--c-bg3)`,color:`var(--c-text2)`,maxHeight:120},children:JSON.stringify(e,null,2)})]})}function mD({data:e}){let[t,n]=(0,S.useState)(!1),r=e.source,i=Oh(r),a=q(r),o=()=>{switch(r){case`cursor`:return(0,F.jsx)(cD,{data:e});case`devin`:case`devin-next`:case`antigravity`:return(0,F.jsx)(lD,{data:e});case`claude-code`:return(0,F.jsx)(uD,{data:e});case`vscode`:case`vscode-insiders`:return(0,F.jsx)(dD,{data:e});case`copilot-cli`:return(0,F.jsx)(dD,{data:e});case`codex`:return(0,F.jsx)(fD,{data:e});default:return(0,F.jsx)(pD,{data:e})}},s=e.models||[];return(0,F.jsxs)(`div`,{className:`card p-4 space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(Gh,{source:r,size:20}),(0,F.jsx)(`span`,{className:`text-[13px] font-bold`,style:{color:`var(--c-white)`},children:a})]}),(0,F.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:i}})]}),o(),s.length>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`button`,{onClick:()=>n(!t),className:`flex items-center gap-1 text-[10px] transition hover:opacity-80`,style:{color:`var(--c-text2)`},children:[t?(0,F.jsx)(Tr,{size:10}):(0,F.jsx)(Cr,{size:10}),s.length,` models`]}),t&&(0,F.jsx)(`div`,{className:`mt-2 space-y-1`,children:s.map((e,t)=>(0,F.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] py-0.5`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(`span`,{style:{color:`var(--c-white)`},children:e.label||e.model}),e.remainingFraction!=null&&(0,F.jsxs)(`span`,{className:`font-mono`,style:{color:e.remainingFraction>.5?`#22c55e`:e.remainingFraction>.2?`#eab308`:`#ef4444`},children:[(e.remainingFraction*100).toFixed(0),`%`]})]},t))})]})]})}function hD(){let[e,t]=(0,S.useState)(null),[n,r]=(0,S.useState)(!0),[i,a]=(0,S.useState)(null),o=()=>{r(!0),a(null),ra().then(e=>{t(e),r(!1)}).catch(e=>{a(e.message),r(!1)})};return(0,S.useEffect)(()=>{o()},[]),(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsxs)($T,{icon:Pr,title:`Subscriptions`,children:[(0,F.jsxs)(`button`,{onClick:o,disabled:n,className:`flex items-center gap-1 px-2 py-0.5 text-[11px] transition hover:bg-[var(--c-card)]`,style:{color:`var(--c-text2)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(li,{size:10,className:n?`animate-spin`:``}),`Refresh`]}),e&&(0,F.jsxs)(`span`,{className:`text-[11px] ml-auto`,style:{color:`var(--c-text3)`},children:[e.length,` subscription`,e.length===1?``:`s`,` detected`]})]}),n&&!e&&(0,F.jsx)(wa,{label:`Loading subscriptions...`}),i&&(0,F.jsx)(`div`,{className:`text-[12px] px-3 py-2`,style:{background:`rgba(239,68,68,0.08)`,border:`1px solid rgba(239,68,68,0.15)`,color:`#ef4444`},children:i}),e&&e.length===0&&(0,F.jsx)(`div`,{className:`text-sm py-12 text-center`,style:{color:`var(--c-text3)`},children:`No subscriptions detected. Make sure your editors are installed and logged in.`}),e&&e.length>0&&(0,F.jsx)(`div`,{className:`grid gap-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(340px, 1fr))`},children:e.map((e,t)=>(0,F.jsx)(mD,{data:e},e.source+`-`+t))})]})}Lf.register(qf,wm,im,km,Nm,vp);var gD=`JetBrains Mono, monospace`,_D=[`#6366f1`,`#22c55e`,`#f59e0b`,`#ec4899`,`#3b82f6`,`#a855f7`,`#14b8a6`,`#f43f5e`,`#84cc16`,`#06b6d4`,`#e879f9`,`#fb923c`];function vD({server:e,matchedTools:t}){let[n,r]=(0,S.useState)(!1),i=t||[],a=i.reduce((e,t)=>e+t.count,0),o=e.tools||[],s=o.length>0||i.length>0;return(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`button`,{onClick:()=>s&&r(!n),className:`w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-[var(--c-bg3)] transition`,children:[(0,F.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6`,style:{background:`${Oh(e.editor)}15`},children:(0,F.jsx)(fi,{size:11,style:{color:Oh(e.editor)}})}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`text-[12px] font-semibold truncate`,style:{color:`var(--c-white)`},children:e.name}),(0,F.jsx)(`span`,{className:`text-[10px] px-1 py-px`,style:{background:e.scope===`global`?`rgba(99,102,241,0.12)`:`rgba(34,197,94,0.12)`,color:e.scope===`global`?`#818cf8`:`#22c55e`},children:e.scope}),(0,F.jsx)(`span`,{className:`text-[10px] px-1 py-px`,style:{background:e.transport===`stdio`?`rgba(234,179,8,0.12)`:`rgba(59,130,246,0.12)`,color:e.transport===`stdio`?`#eab308`:`#3b82f6`},children:e.transport}),e.disabled&&(0,F.jsx)(`span`,{className:`text-[10px] px-1 py-px`,style:{background:`rgba(239,68,68,0.12)`,color:`#ef4444`},children:`disabled`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mt-px`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Gh,{source:e.editor,size:10}),e.editorLabel]}),e.command&&(0,F.jsxs)(`span`,{className:`text-[10px] truncate`,style:{color:`var(--c-text3)`,fontFamily:gD},children:[e.command,` `,(e.args||[]).slice(0,2).join(` `)]}),e.url&&(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] truncate`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Kr,{size:9}),e.url]})]})]}),(0,F.jsxs)(`div`,{className:`text-right shrink-0`,children:[a>0&&(0,F.jsx)(`div`,{className:`text-[12px] font-semibold`,style:{color:`var(--c-white)`},children:J(a)}),(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[o.length>0?`${o.length} tools`:`offline`,i.length>0?` · ${i.length} matched`:``]})]}),s?n?(0,F.jsx)(Cr,{size:12,style:{color:`var(--c-text3)`}}):(0,F.jsx)(wr,{size:12,style:{color:`var(--c-text3)`}}):(0,F.jsx)(`div`,{className:`w-3`})]}),n&&s&&(0,F.jsxs)(`div`,{className:`px-3 pb-2 pt-1`,style:{borderTop:`1px solid var(--c-border)`},children:[o.length>0&&(0,F.jsxs)(`div`,{className:`mb-1.5`,children:[(0,F.jsxs)(`div`,{className:`text-[10px] font-medium mb-0.5`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Oi,{size:9,className:`inline mr-0.5`}),`Available (`,o.length,`)`]}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-0.5`,children:o.map(e=>(0,F.jsx)(`span`,{className:`text-[10px] px-1 py-px`,style:{background:`var(--c-bg3)`,color:`var(--c-text3)`,fontFamily:gD},children:e},e))})]}),i.length>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`text-[10px] font-medium mb-0.5`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(qr,{size:9,className:`inline mr-0.5`}),`Matched Calls`]}),(0,F.jsx)(`div`,{className:`space-y-0.5`,children:i.map(e=>(0,F.jsxs)(`div`,{className:`flex items-center justify-between py-0.5 px-1.5`,style:{background:`var(--c-bg3)`},children:[(0,F.jsx)(`span`,{className:`text-[10px] truncate`,style:{fontFamily:gD,color:`var(--c-text)`},children:e.name}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0 ml-2`,children:[(0,F.jsxs)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[e.sessionCount,`s`]}),(0,F.jsx)(`span`,{className:`text-[11px] font-semibold`,style:{color:`var(--c-white)`},children:J(e.count)})]})]},e.name))})]})]})]})}function yD(){let e=dt(),[t,n]=(0,S.useState)(null),[r,i]=(0,S.useState)(!0),[a,o]=(0,S.useState)(``),[s,c]=(0,S.useState)(`servers`),[l,u]=(0,S.useState)(``),[d,f]=(0,S.useState)(``),{dark:p}=tr(),m=p?`#a0a0a0`:`#444`,h=p?`#555`:`#999`,g=p?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`,_=p?`#9ca3af`:`#555`;(0,S.useEffect)(()=>{oa().then(e=>{n(e),i(!1)}).catch(()=>i(!1))},[]);let v=(0,S.useMemo)(()=>{if(!t)return[];let e=a.toLowerCase();return t.servers.filter(t=>!e||t.name.toLowerCase().includes(e)||t.editor.toLowerCase().includes(e)||(t.command||``).toLowerCase().includes(e))},[t,a]),y=(0,S.useMemo)(()=>{if(!t)return{};let e={};for(let[n,r]of Object.entries(t.matchedTools||{}))for(let t of r)e[t.name]=n;return e},[t]),b=(0,S.useMemo)(()=>{if(!t)return{projects:[],servers:[]};let e=new Set,n=new Set;for(let r of t.toolCalls){for(let t of r.folders||[])e.add(t);let t=y[r.name];t?n.add(t):n.add(`__builtin__`)}return{projects:[...e].sort((e,t)=>e.split(`/`).pop().localeCompare(t.split(`/`).pop())),servers:[...n].filter(e=>e!==`__builtin__`).sort(),hasBuiltIn:n.has(`__builtin__`)}},[t,y]),x=(0,S.useMemo)(()=>{if(!t)return[];let e=a.toLowerCase();return t.toolCalls.filter(t=>!(e&&!t.name.toLowerCase().includes(e)||l&&!(t.folders||[]).includes(l)||d===`__builtin__`&&y[t.name]||d&&d!==`__builtin__`&&y[t.name]!==d))},[t,a,l,d,y]),C=(0,S.useMemo)(()=>{if(!t)return[];let e=a.toLowerCase();return t.topSessions.filter(t=>!e||(t.name||``).toLowerCase().includes(e)||t.source.toLowerCase().includes(e)||(t.folder||``).toLowerCase().includes(e))},[t,a]),w=(0,S.useMemo)(()=>{let e={};for(let t of v)e[t.editor]||(e[t.editor]=[]),e[t.editor].push(t);return e},[v]),T=(0,S.useMemo)(()=>{if(!t)return null;let e={};for(let n of t.servers){let r=(t.matchedTools[n.name]||[]).reduce((e,t)=>e+t.count,0);r!==0&&(e[n.name]||(e[n.name]={}),e[n.name][n.editor]=(e[n.name][n.editor]||0)+r)}let n=Object.entries(e).map(([e,t])=>({name:e,byEditor:t,total:Object.values(t).reduce((e,t)=>e+t,0)})).sort((e,t)=>t.total-e.total).slice(0,10);if(n.length===0)return null;let r=[...new Set(n.flatMap(e=>Object.keys(e.byEditor)))];return{labels:n.map(e=>e.name),datasets:r.map(e=>({label:q(e),data:n.map(t=>t.byEditor[e]||0),backgroundColor:Oh(e)+`CC`,borderRadius:2}))}},[t]),E=(0,S.useMemo)(()=>t?t.servers.filter(e=>(t.matchedTools[e.name]||[]).length===0):[],[t]),D=(0,S.useMemo)(()=>{if(!t)return[];let e=[];for(let[n,r]of Object.entries(t.matchedTools))for(let t of r)e.push({...t,server:n});return e.sort((e,t)=>t.count-e.count).slice(0,12)},[t]),O=(0,S.useMemo)(()=>{if(!t)return[];let e=new Set;for(let n of Object.values(t.matchedTools))for(let t of n)e.add(t.name);let n=[];for(let r of t.servers){let t=r.tools||[];if(t.length!==0)for(let i of t)e.has(i)||n.push({name:i,server:r.name,editor:r.editor})}return n},[t]),k=(0,S.useMemo)(()=>{if(!t)return null;let e={};for(let n of t.servers){let t=q(n.editor);e[t]=(e[t]||0)+1}let n=Object.entries(e).sort((e,t)=>t[1]-e[1]);return n.length===0?null:{labels:n.map(e=>e[0]),colors:n.map(e=>{let n=t.servers.find(t=>q(t.editor)===e[0]);return n?Oh(n.editor):`#666`}),values:n.map(e=>e[1])}},[t]),A=(0,S.useMemo)(()=>{if(!t)return null;let e={};for(let n of t.servers)e[n.transport]=(e[n.transport]||0)+1;let n=Object.entries(e).sort((e,t)=>t[1]-e[1]);if(n.length===0)return null;let r={stdio:`#eab308`,http:`#3b82f6`,sse:`#a855f7`};return{labels:n.map(e=>e[0]),colors:n.map(e=>r[e[0]]||`#666`),values:n.map(e=>e[1])}},[t]);if(r)return(0,F.jsx)(wa,{label:`Loading MCP data...`});if(!t)return(0,F.jsx)(`div`,{className:`text-center py-20 text-[13px]`,style:{color:`var(--c-text3)`},children:`Failed to load MCP data`});let{summary:j,matchedTools:ee}=t,te=[{id:`servers`,label:`Servers`,count:t.servers.length},{id:`tools`,label:`Tools`,count:t.toolCalls.length},{id:`sessions`,label:`Sessions`,count:t.topSessions.length}];return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:oi,title:`MCPs`}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`servers`,value:j.totalServers,sub:`${j.editorsWithServers.length} editors`}),(0,F.jsx)(K,{label:`unique tools`,value:J(j.uniqueTools)}),(0,F.jsx)(K,{label:`tool calls`,value:J(j.totalToolCalls)}),(0,F.jsx)(K,{label:`sessions`,value:J(j.sessionsWithTools)}),(0,F.jsx)(K,{label:`matched`,value:Object.values(ee).reduce((e,t)=>e+t.length,0),sub:`${Object.keys(ee).length} servers`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`most used servers `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(by editor)`})]}),T?(0,F.jsx)(`div`,{style:{height:Math.max(T.labels.length*22+10,80)},children:(0,F.jsx)(wh,{data:T,options:{indexAxis:`y`,responsive:!0,maintainAspectRatio:!1,scales:{x:{stacked:!0,grid:{color:g},ticks:{color:h,font:{size:9,family:gD}}},y:{stacked:!0,grid:{display:!1},ticks:{color:m,font:{size:9,family:gD}}}},plugins:{legend:{position:`top`,labels:{color:_,font:{size:9,family:gD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{mode:`index`,bodyFont:{family:gD,size:10},titleFont:{family:gD,size:10}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-6`,style:{color:`var(--c-text3)`},children:`No MCP server usage`})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`most used tools`}),D.length>0?(0,F.jsx)(`div`,{style:{height:Math.max(D.length*22+10,80)},children:(0,F.jsx)(wh,{data:{labels:D.map(e=>e.name),datasets:[{data:D.map(e=>e.count),backgroundColor:_D.slice(0,D.length),borderRadius:2}]},options:{indexAxis:`y`,responsive:!0,maintainAspectRatio:!1,scales:{x:{grid:{color:g},ticks:{color:h,font:{size:9,family:gD}}},y:{grid:{display:!1},ticks:{color:m,font:{size:9,family:gD}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:gD,size:10},titleFont:{family:gD,size:10},callbacks:{afterLabel:e=>`Server: ${D[e.dataIndex]?.server||`?`}`}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-6`,style:{color:`var(--c-text3)`},children:`No MCP tool usage`})]}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`servers by editor`}),k?(0,F.jsx)(`div`,{style:{height:110},children:(0,F.jsx)(Th,{data:{labels:k.labels,datasets:[{data:k.values,backgroundColor:k.colors,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`55%`,plugins:{legend:{position:`right`,labels:{color:_,font:{size:9,family:gD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:gD,size:10},titleFont:{family:gD,size:10}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-4`,style:{color:`var(--c-text3)`},children:`no data`})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`servers by transport`}),A?(0,F.jsx)(`div`,{style:{height:90},children:(0,F.jsx)(Th,{data:{labels:A.labels,datasets:[{data:A.values,backgroundColor:A.colors,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`55%`,plugins:{legend:{position:`right`,labels:{color:_,font:{size:9,family:gD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:gD,size:10},titleFont:{family:gD,size:10}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-4`,style:{color:`var(--c-text3)`},children:`no data`})]})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`never used servers `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,E.length,`)`]})]}),E.length>0?(0,F.jsx)(`div`,{className:`space-y-0.5 max-h-[160px] overflow-y-auto scrollbar-thin`,children:E.map((e,t)=>(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 py-0.5 px-1.5`,style:{background:`var(--c-bg3)`},children:[(0,F.jsx)(pr,{size:9,style:{color:`#ef4444`,opacity:.5}}),(0,F.jsx)(`span`,{className:`text-[10px] font-medium truncate`,style:{color:`var(--c-text)`},children:e.name}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1 ml-auto shrink-0`,children:[(0,F.jsx)(Gh,{source:e.editor,size:10}),(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:e.editorLabel})]}),e.disabled&&(0,F.jsx)(`span`,{className:`text-[9px] px-0.5`,style:{background:`rgba(239,68,68,0.12)`,color:`#ef4444`},children:`off`})]},`${e.name}-${e.editor}-${t}`))}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-4`,style:{color:`var(--c-text3)`},children:`All servers have been used`})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`never used tools `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,O.length,`)`]})]}),O.length>0?(0,F.jsx)(`div`,{className:`space-y-0.5 max-h-[160px] overflow-y-auto scrollbar-thin`,children:O.map((e,t)=>(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 py-0.5 px-1.5`,style:{background:`var(--c-bg3)`},children:[(0,F.jsx)(pr,{size:9,style:{color:`#f59e0b`,opacity:.5}}),(0,F.jsx)(`span`,{className:`text-[10px] truncate`,style:{fontFamily:gD,color:`var(--c-text)`},children:e.name}),(0,F.jsx)(`span`,{className:`ml-auto shrink-0 text-[10px] px-1 py-px`,style:{background:`rgba(99,102,241,0.12)`,color:`#818cf8`},children:e.server})]},`${e.name}-${e.server}-${t}`))}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-4`,style:{color:`var(--c-text3)`},children:`All queried tools have been used`})]})]}),t.projectMcps&&t.projectMcps.length>0&&(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsx)(`div`,{className:`px-3 py-2`,style:{borderBottom:`1px solid var(--c-border)`},children:(0,F.jsxs)($,{children:[`MCP servers by project `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,t.projectMcps.length,`)`]})]})}),(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`project`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`config`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`servers`}),(0,F.jsx)(`th`,{className:`text-right px-3 py-2 font-medium`,children:`mcp calls`})]})}),(0,F.jsx)(`tbody`,{children:t.projectMcps.map(t=>t.configs.map((n,r)=>(0,F.jsxs)(`tr`,{className:`transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,children:[r===0?(0,F.jsx)(`td`,{className:`px-3 py-2`,rowSpan:t.configs.length,children:(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5 cursor-pointer hover:underline`,style:{color:`var(--c-accent)`},onClick:()=>e(`/projects/detail?folder=${encodeURIComponent(t.folder)}`),children:[(0,F.jsx)(Ur,{size:11}),(0,F.jsx)(`span`,{className:`font-medium truncate max-w-[200px]`,children:t.name})]})}):null,(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(Gh,{source:n.editor,size:12}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:n.file})]})}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.serverNames.map(e=>(0,F.jsxs)(`span`,{className:`text-[11px] px-1.5 py-px`,style:{background:ee[e]?`rgba(99,102,241,0.12)`:`var(--c-bg3)`,color:ee[e]?`#818cf8`:`var(--c-text2)`},children:[(0,F.jsx)(oi,{size:8,className:`inline mr-0.5`}),e,ee[e]&&(0,F.jsx)(`span`,{className:`ml-1 opacity-60`,children:ee[e].reduce((e,t)=>e+t.count,0)})]},e))})}),r===0?(0,F.jsx)(`td`,{className:`px-3 py-2 text-right`,rowSpan:t.configs.length,children:t.mcpToolCalls>0?(0,F.jsx)(`span`,{className:`font-semibold`,style:{color:`var(--c-white)`},children:J(t.mcpToolCalls)}):(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`—`})}):null]},`${t.folder}-${n.file}`)))})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(`div`,{className:`flex gap-0.5`,children:te.map(e=>(0,F.jsxs)(`button`,{onClick:()=>c(e.id),className:`px-2.5 py-1 text-[12px] transition`,style:{background:s===e.id?`var(--c-card)`:`transparent`,color:s===e.id?`var(--c-white)`:`var(--c-text3)`,border:s===e.id?`1px solid var(--c-border)`:`1px solid transparent`},children:[e.label,` `,(0,F.jsx)(`span`,{className:`opacity-40 ml-0.5`,children:e.count})]},e.id))}),(0,F.jsx)(`div`,{className:`flex-1`}),s===`tools`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,color:`var(--c-text)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Projects`}),b.projects.map(e=>(0,F.jsx)(`option`,{value:e,children:e.split(`/`).pop()},e))]}),(0,F.jsxs)(`select`,{value:d,onChange:e=>f(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,color:`var(--c-text)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Servers`}),b.hasBuiltIn&&(0,F.jsx)(`option`,{value:`__builtin__`,children:`built-in`}),b.servers.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]})]}),(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(ui,{size:12,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`Search...`,className:`pl-7 pr-3 py-1 text-[12px] outline-none w-[180px]`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,color:`var(--c-text)`}})]})]}),s===`servers`&&(0,F.jsx)(`div`,{children:v.length===0?(0,F.jsxs)(`div`,{className:`text-center py-12 text-[12px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(fi,{size:24,className:`mx-auto mb-2 opacity-30`}),(0,F.jsx)(`div`,{children:`No MCP servers detected`}),(0,F.jsx)(`div`,{className:`text-[10px] mt-0.5 opacity-60`,children:`Configure MCP servers in your editors`})]}):Object.entries(w).map(([e,t])=>(0,F.jsxs)(`div`,{className:`mb-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1`,children:[(0,F.jsx)(Gh,{source:e,size:13}),(0,F.jsx)(`span`,{className:`text-[12px] font-semibold`,style:{color:`var(--c-white)`},children:q(e)}),(0,F.jsxs)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:[`(`,t.length,`)`]})]}),(0,F.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,F.jsx)(vD,{server:e,matchedTools:ee[e.name]},`${e.name}-${e.editor}-${e.scope}`))})]},e))}),s===`tools`&&(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`tool`}),(0,F.jsx)(`th`,{className:`text-right px-3 py-2 font-medium`,children:`calls`}),(0,F.jsx)(`th`,{className:`text-right px-3 py-2 font-medium`,children:`sessions`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`editors`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`server`})]})}),(0,F.jsx)(`tbody`,{children:x.slice(0,100).map((e,t)=>{let n=y[e.name];return(0,F.jsxs)(`tr`,{className:`transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,children:[(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsx)(`span`,{style:{fontFamily:gD,color:`var(--c-white)`},children:e.name})}),(0,F.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,F.jsx)(`span`,{className:`font-semibold`,style:{color:`var(--c-white)`},children:J(e.count)})}),(0,F.jsx)(`td`,{className:`px-3 py-2 text-right`,style:{color:`var(--c-text2)`},children:e.sessionCount}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsx)(`div`,{className:`flex items-center gap-1`,children:e.editors.map(e=>(0,F.jsx)(`span`,{className:`inline-flex items-center gap-0.5`,children:(0,F.jsx)(Gh,{source:e,size:12})},e))})}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:n?(0,F.jsxs)(`span`,{className:`text-[11px] px-1.5 py-px`,style:{background:`rgba(99,102,241,0.12)`,color:`#818cf8`},children:[(0,F.jsx)(oi,{size:9,className:`inline mr-0.5`}),n]}):(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text2)`},children:`built-in`})})]},e.name)})})]}),x.length>100&&(0,F.jsxs)(`div`,{className:`px-3 py-1 text-[10px] text-center`,style:{color:`var(--c-text3)`,background:`var(--c-card)`},children:[`Showing 100 of `,x.length]})]}),s===`sessions`&&(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`session`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`editor`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`project`}),(0,F.jsx)(`th`,{className:`text-right px-3 py-2 font-medium`,children:`calls`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`top tools`})]})}),(0,F.jsx)(`tbody`,{children:C.map((t,n)=>{let r=Object.entries(t.tools).sort((e,t)=>t[1]-e[1]).slice(0,3);return(0,F.jsxs)(`tr`,{className:`transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,children:[(0,F.jsx)(`td`,{className:`px-3 py-2 max-w-[220px] font-medium`,children:(0,F.jsx)(`span`,{className:`truncate block`,style:{color:`var(--c-white)`},children:t.name||(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`,fontStyle:`italic`},children:`Untitled`})})}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(Gh,{source:t.source,size:12}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:q(t.source)})]})}),(0,F.jsx)(`td`,{className:`px-3 py-2 truncate max-w-[160px]`,title:t.folder,children:t.folder?(0,F.jsx)(`span`,{className:`cursor-pointer hover:underline`,style:{color:`var(--c-accent)`},onClick:n=>{n.stopPropagation(),e(`/projects/detail?folder=${encodeURIComponent(t.folder)}`)},children:t.folder.split(/[/\\]/).pop()}):(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`—`})}),(0,F.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,F.jsx)(`span`,{className:`font-semibold`,style:{color:`var(--c-white)`},children:J(t.totalToolCalls)})}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsx)(`div`,{className:`flex gap-0.5 flex-wrap`,children:r.map(([e,t])=>(0,F.jsxs)(`span`,{className:`text-[10px] px-1 py-px`,style:{background:`var(--c-bg3)`,color:`var(--c-text2)`,fontFamily:gD},children:[e,` `,(0,F.jsxs)(`span`,{style:{opacity:.5},children:[`×`,t]})]},e))})})]},t.composerId)})})]}),t.topSessions.length===0&&(0,F.jsx)(`div`,{className:`text-center py-8 text-[11px]`,style:{color:`var(--c-text3)`},children:`No sessions with tool calls`})]})]})}function bD({source:e,showLabel:t=!1,size:n=8}){return(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Gh,{source:e,size:n}),t&&(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text)`},children:q(e)})]})}function xD(e){return e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``}function SD({onSessionClick:e}){let[t,n]=(0,S.useState)([]),r=(0,S.useRef)(null);(0,S.useEffect)(()=>{let e=()=>{va({limit:80}).then(e=>{Array.isArray(e)&&n(e)}).catch(()=>{})};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[]);let i=Date.now(),a=[],o=null;for(let e of t){let t=i-e.lastUpdatedAt,n;n=t<3e5?`Just now`:t<36e5?`${Math.floor(t/6e4)} min ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:new Date(e.lastUpdatedAt).toLocaleDateString(),(!o||o.label!==n)&&(o={label:n,items:[]},a.push(o)),o.items.push(e)}return(0,F.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2.5 shrink-0`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(ci,{size:12,style:{color:`#22c55e`}}),(0,F.jsx)(`span`,{className:`text-[12px] font-medium uppercase tracking-wider`,style:{color:`var(--c-text2)`},children:`Live Feed`}),(0,F.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full pulse-dot ml-auto`,style:{background:`#22c55e`}})]}),(0,F.jsxs)(`div`,{ref:r,className:`flex-1 overflow-y-auto scrollbar-thin`,children:[t.length===0&&(0,F.jsx)(`div`,{className:`text-[12px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`No recent activity`}),a.map((t,n)=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`sticky top-0 px-3 py-1.5 text-[10px] font-medium uppercase tracking-wider`,style:{background:`var(--c-bg)`,color:`var(--c-text3)`,borderBottom:`1px solid var(--c-border)`},children:t.label}),t.items.map(t=>(0,F.jsxs)(`div`,{className:`px-3 py-2.5 cursor-pointer transition hover:bg-[var(--c-card)]`,style:{borderBottom:`1px solid var(--c-border)`},onClick:()=>e&&e(t.id,t.username),children:[(0,F.jsx)(`div`,{className:`text-[12px] font-medium truncate mb-1`,style:{color:`var(--c-white)`},children:t.name||`Untitled`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1`,children:[(0,F.jsx)(`span`,{className:`text-[10px] font-medium px-1 py-0.5 shrink-0 truncate max-w-[120px]`,style:{background:`rgba(99,102,241,0.12)`,color:`#818cf8`},title:t.username,children:t.username}),(0,F.jsx)(bD,{source:t.source,size:6}),(0,F.jsx)(`span`,{className:`text-[10px] truncate`,style:{color:`var(--c-text2)`},children:q(t.source)}),(0,F.jsx)(`span`,{className:`text-[10px] ml-auto shrink-0`,style:{color:`var(--c-text3)`},children:xD(t.lastUpdatedAt)})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px]`,style:{color:`var(--c-text3)`},children:[t.totalMessages>0&&(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,F.jsx)(ni,{size:8}),` `,t.totalMessages]}),t.folder&&(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5 truncate`,children:[(0,F.jsx)(Ur,{size:8}),` `,t.folder.split(`/`).pop()]}),t.mode&&(0,F.jsx)(`span`,{className:`px-1 py-0`,style:{background:`rgba(168,85,247,0.1)`,color:`#a855f7`},children:t.mode}),t.models?.[0]&&(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5 ml-auto truncate`,style:{color:`#818cf8`},children:[(0,F.jsx)(Nr,{size:8}),` `,t.models[0]]})]})]},`${t.id}-${t.username}`))]},n))]})]})}Lf.register(qf,wm,im,km,Nm,vp);var CD=`JetBrains Mono, monospace`,wD=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`],TD=[`#6366f1`,`#8b5cf6`,`#a855f7`,`#c084fc`,`#d8b4fe`,`#e879f9`,`#f472b6`,`#fb7185`];function ED({segments:e,height:t=6}){let n=e.reduce((e,t)=>e+t.value,0);return n===0?null:(0,F.jsx)(`div`,{className:`flex w-full rounded-full overflow-hidden`,style:{height:t},children:e.filter(e=>e.value>0).map((e,t)=>(0,F.jsx)(`div`,{title:`${e.label}: ${J(e.value)}`,className:`h-full transition-all`,style:{width:`${(e.value/n*100).toFixed(1)}%`,background:e.color}},t))})}function DD({userList:e,userColorMap:t,selectedUser:n}){let[r,i]=(0,S.useState)(new Set),a=dt(),{projectGroups:o,ungrouped:s}=(0,S.useMemo)(()=>{let t={},n=new Set;for(let r of e){let e=r.sharedProjects||[];if(e.length===0){n.add(r.username);continue}for(let i of e){let e=typeof i==`string`?i:i.name||i;t[e]||(t[e]=[]),t[e].push(r),n.add(r.username)}}let r=e.filter(e=>!(e.sharedProjects?.length>0));return{projectGroups:Object.entries(t).sort((e,t)=>t[1].length-e[1].length),ungrouped:r}},[e]),c=e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},l=({u:r})=>{e.indexOf(r);let i=t[r.username]||`#6366f1`,o=Object.entries(r.editors||{}).sort((e,t)=>t[1]-e[1]);return(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1.5 cursor-pointer transition rounded-sm`,style:{background:n===r.username?`rgba(99,102,241,0.12)`:`transparent`},onMouseEnter:e=>{n!==r.username&&(e.currentTarget.style.background=`var(--c-bg3)`)},onMouseLeave:e=>{n!==r.username&&(e.currentTarget.style.background=`transparent`)},onClick:()=>a(`/relay/user/${r.username}`),children:[(0,F.jsx)(`div`,{className:`w-5 h-5 flex items-center justify-center text-[8px] font-bold rounded-sm flex-shrink-0`,style:{background:`${i}20`,color:i},children:r.username.charAt(0).toUpperCase()}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium truncate`,style:{color:`var(--c-white)`},children:r.username}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[8px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsxs)(`span`,{children:[r.sessions,`s`]}),(0,F.jsx)(`span`,{children:`·`}),(0,F.jsxs)(`span`,{children:[J(r.totalMessages),`m`]})]}),o.length>0&&(0,F.jsx)(`div`,{className:`flex items-center gap-1 mt-0.5`,children:o.slice(0,4).map(([e])=>(0,F.jsx)(Gh,{source:e,size:9},e))})]})]})};return(0,F.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2.5 shrink-0`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(Di,{size:12,style:{color:`var(--c-accent)`}}),(0,F.jsx)(`span`,{className:`text-[12px] font-medium uppercase tracking-wider`,style:{color:`var(--c-text2)`},children:`Team`}),(0,F.jsx)(`span`,{className:`text-[10px] ml-auto`,style:{color:`var(--c-text3)`},children:e.length})]}),(0,F.jsxs)(`div`,{className:`flex-1 overflow-y-auto scrollbar-thin py-1`,children:[o.map(([e,t])=>{let n=r.has(e),i=e.split(`/`).pop();return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1.5 cursor-pointer transition`,onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>c(e),children:[n?(0,F.jsx)(wr,{size:10,style:{color:`var(--c-text3)`}}):(0,F.jsx)(Cr,{size:10,style:{color:`var(--c-text3)`}}),(0,F.jsx)(Ur,{size:10,style:{color:`#818cf8`}}),(0,F.jsx)(`span`,{className:`text-[11px] font-medium truncate flex-1`,style:{color:`var(--c-text2)`},title:e,children:i}),(0,F.jsx)(`span`,{className:`text-[8px]`,style:{color:`var(--c-text3)`},children:t.length})]}),!n&&(0,F.jsx)(`div`,{className:`pl-3`,children:t.map(t=>(0,F.jsx)(l,{u:t},`${e}-${t.username}`))})]},e)}),s.length>0&&(0,F.jsxs)(`div`,{children:[o.length>0&&(0,F.jsx)(`div`,{className:`px-2 py-1.5 text-[10px] uppercase tracking-wider`,style:{color:`var(--c-text3)`},children:`unassigned`}),(0,F.jsx)(`div`,{className:o.length>0?`pl-1`:``,children:s.map(e=>(0,F.jsx)(l,{u:e},e.username))})]}),e.length===0&&(0,F.jsx)(`div`,{className:`text-[11px] py-6 text-center`,style:{color:`var(--c-text3)`},children:`No team members yet`})]}),e.length>=2&&(0,F.jsx)(OD,{userList:e})]})}function OD({userList:e}){let[t,n]=(0,S.useState)(``),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(null),[l,u]=(0,S.useState)(!1);return(0,F.jsxs)(`div`,{className:`shrink-0 px-2 py-2`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 cursor-pointer text-[10px] uppercase tracking-wider`,style:{color:`var(--c-text3)`},onClick:()=>u(!l),children:[l?(0,F.jsx)(Cr,{size:9}):(0,F.jsx)(wr,{size:9}),(0,F.jsx)(ti,{size:9}),(0,F.jsx)(`span`,{children:`merge users`})]}),l&&(0,F.jsxs)(`div`,{className:`mt-2 space-y-1.5`,children:[(0,F.jsxs)(`select`,{value:t,onChange:e=>n(e.target.value),className:`w-full text-[11px] px-1.5 py-1 outline-none rounded-sm`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`from...`}),e.filter(e=>e.username!==r).map(e=>(0,F.jsx)(`option`,{value:e.username,children:e.username},e.username))]}),(0,F.jsxs)(`select`,{value:r,onChange:e=>i(e.target.value),className:`w-full text-[11px] px-1.5 py-1 outline-none rounded-sm`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`into...`}),e.filter(e=>e.username!==t).map(e=>(0,F.jsx)(`option`,{value:e.username,children:e.username},e.username))]}),(0,F.jsx)(`button`,{disabled:!t||!r||a,onClick:async()=>{if(confirm(`Merge "${t}" → "${r}"? Cannot undo.`)){o(!0),c(null);try{c(await ya(t,r)),n(``),i(``)}catch(e){c({error:e.message})}o(!1)}},className:`w-full text-[11px] px-2 py-1 font-medium transition rounded-sm`,style:{background:t&&r?`rgba(239,68,68,0.15)`:`var(--c-bg3)`,color:t&&r?`#ef4444`:`var(--c-text3)`,border:`1px solid var(--c-border)`,cursor:!t||!r||a?`not-allowed`:`pointer`,opacity:!t||!r||a?.5:1},children:a?`Merging...`:`Merge`}),s&&(0,F.jsx)(`div`,{className:`text-[10px]`,style:{color:s.error?`#ef4444`:`#22c55e`},children:s.error?`Error: ${s.error}`:`Merged!`})]})]})}function kD(){let e=dt(),[t,n]=(0,S.useState)(null),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)(null),{dark:p}=tr(),m=p?`#888`:`#555`,h=p?`rgba(255,255,255,0.04)`:`rgba(0,0,0,0.06)`,g=p?`#555`:`#999`,_=p?`#888`:`#555`;(0,S.useEffect)(()=>{ha().then(n);let e=setInterval(()=>ha().then(n),15e3);return()=>clearInterval(e)},[]);let v=async e=>{if(e.preventDefault(),r.trim()){c(!0);try{o(await _a(r.trim(),{limit:30}))}catch{o([])}c(!1)}},y=t?.users||[],b=(0,S.useMemo)(()=>{let e={};return y.forEach((t,n)=>{e[t.username]=TD[n%TD.length]}),e},[y]);if(!t)return(0,F.jsx)(wa,{label:`Loading relay data...`});let x=t.editors||[],C=t.topModels||[],w=(t.totalInputTokens||0)+(t.totalOutputTokens||0),T=t.totalSessions>0?(t.totalMessages/t.totalSessions).toFixed(1):0,E=t.totalSessions>0?Math.round(w/t.totalSessions):0,D=y.length>0?Math.max(...y.map(e=>e.sessions)):1,O=(e,t)=>{u(e),f(t)},k=`calc(100vh - 42px)`;return(0,F.jsxs)(`div`,{className:`fade-in flex`,style:{height:k},children:[(0,F.jsx)(`div`,{className:`hidden lg:flex flex-col w-[250px] shrink-0 sticky top-[42px] self-start`,style:{height:k,borderRight:`1px solid var(--c-border)`,background:`var(--c-bg)`},children:(0,F.jsx)(DD,{userList:y,userColorMap:b,selectedUser:d,onUserClick:t=>e(`/relay/user/${t}`)})}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-y-auto p-4 space-y-3`,children:[(0,F.jsx)($T,{icon:Di,title:`Team Relay`}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`team members`,value:t.totalUsers}),(0,F.jsx)(K,{label:`sessions`,value:J(t.totalSessions),sub:`${T} msgs/session`}),(0,F.jsx)(K,{label:`active users`,value:t.activeUsers}),(0,F.jsx)(K,{label:`projects`,value:t.totalProjects}),(0,F.jsx)(K,{label:`messages`,value:J(t.totalMessages)}),(0,F.jsx)(K,{label:`tokens`,value:J(w),sub:`${J(E)}/session`})]}),w>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,F.jsx)($,{children:`team token usage`}),(0,F.jsxs)(`span`,{className:`text-[11px] font-bold`,style:{color:`var(--c-white)`},children:[J(w),` total`]})]}),(0,F.jsx)(ED,{height:10,segments:[{label:`Input`,value:t.totalInputTokens,color:`#6366f1`},{label:`Output`,value:t.totalOutputTokens,color:`#a78bfa`}]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4 mt-1.5 text-[10px]`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#6366f1`}}),` input `,J(t.totalInputTokens)]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#a78bfa`}}),` output `,J(t.totalOutputTokens)]})]}),y.length>1&&(0,F.jsxs)(`div`,{className:`mt-3 pt-2`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`div`,{className:`text-[10px] mb-1.5`,style:{color:`var(--c-text3)`},children:`per-user contribution`}),(0,F.jsx)(ED,{height:8,segments:y.map(e=>({label:e.username,value:e.totalInputTokens+e.totalOutputTokens,color:b[e.username]}))}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-3 mt-1 text-[10px]`,children:y.map(e=>(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:b[e.username]}}),e.username]},e.username))})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-3 gap-3`,children:[x.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`editors`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Th,{data:{labels:x.map(e=>q(e.source)),datasets:[{data:x.map(e=>e.count),backgroundColor:x.map(e=>Oh(e.source)),borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:m,font:{size:9,family:CD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:CD,size:10},titleFont:{family:CD,size:10}}}}})})]}),C.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`models`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Th,{data:{labels:C.slice(0,10).map(e=>e.name),datasets:[{data:C.slice(0,10).map(e=>e.count),backgroundColor:wD,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:m,font:{size:8,family:CD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:CD,size:10},titleFont:{family:CD,size:10}}}}})})]}),y.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`sessions per user`}),(0,F.jsx)(`div`,{style:{height:Math.max(120,y.length*28)},children:(0,F.jsx)(wh,{data:{labels:y.map(e=>e.username),datasets:[{data:y.map(e=>e.sessions),backgroundColor:y.map(e=>b[e.username]),borderRadius:2}]},options:{responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,plugins:{legend:{display:!1},tooltip:{bodyFont:{family:CD,size:10},titleFont:{family:CD,size:10}}},scales:{x:{grid:{color:h},ticks:{color:g,font:{size:8,family:CD}},beginAtZero:!0},y:{grid:{display:!1},ticks:{color:_,font:{size:9,family:CD}}}}}})})]})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`search across team`}),(0,F.jsxs)(`form`,{onSubmit:v,className:`flex gap-2 mt-1`,children:[(0,F.jsxs)(`div`,{className:`relative flex-1`,children:[(0,F.jsx)(ui,{size:11,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),placeholder:`Search messages, files, topics across all users...`,className:`w-full pl-7 pr-3 py-1.5 text-[12px] outline-none rounded-sm`,style:{background:`var(--c-bg3)`,color:`var(--c-white)`,border:`1px solid var(--c-border)`}})]}),(0,F.jsx)(`button`,{type:`submit`,disabled:s,className:`px-3 py-1.5 text-[11px] font-medium transition rounded-sm`,style:{background:`var(--c-card)`,border:`1px solid var(--c-border)`,color:`var(--c-white)`},children:s?`Searching...`:`Search`})]}),a&&(0,F.jsx)(`div`,{className:`mt-3 max-h-[300px] overflow-y-auto scrollbar-thin`,children:a.length===0?(0,F.jsx)(`div`,{className:`text-[12px] py-2`,style:{color:`var(--c-text3)`},children:`No results found`}):(0,F.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,F.jsx)(`tbody`,{children:a.map((e,t)=>(0,F.jsxs)(`tr`,{className:`cursor-pointer transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>{u(e.chatId),f(e.username)},children:[(0,F.jsx)(`td`,{className:`py-2 px-2 w-[80px]`,children:(0,F.jsx)(`span`,{className:`text-[10px] font-medium px-1.5 py-0.5`,style:{background:`rgba(99,102,241,0.15)`,color:`#818cf8`},children:e.username})}),(0,F.jsx)(`td`,{className:`py-2 px-2 w-[24px]`,children:(0,F.jsx)(Gh,{source:e.source,size:11})}),(0,F.jsxs)(`td`,{className:`py-2 px-2`,children:[(0,F.jsx)(`div`,{className:`text-[11px] truncate`,style:{color:`var(--c-text3)`},children:e.chatName}),(0,F.jsx)(`div`,{className:`text-[11px] line-clamp-1 mt-0.5`,style:{color:`var(--c-text)`},children:e.content})]}),(0,F.jsx)(`td`,{className:`py-2 px-2 text-[10px] whitespace-nowrap`,style:{color:`var(--c-text3)`},children:e.role})]},t))})})})]}),(0,F.jsx)($,{children:`team overview`}),(0,F.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3`,children:y.map(t=>{let n=t.totalInputTokens+t.totalOutputTokens,r=b[t.username],i=Object.entries(t.editors||{}).sort((e,t)=>t[1]-e[1]);return(0,F.jsxs)(`div`,{className:`card p-3 cursor-pointer transition hover:opacity-90`,onClick:()=>e(`/relay/user/${t.username}`),children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,F.jsx)(`div`,{className:`w-7 h-7 flex items-center justify-center text-[12px] font-bold rounded-sm flex-shrink-0`,style:{background:`${r}20`,color:r},children:t.username.charAt(0).toUpperCase()}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[12px] font-bold truncate`,style:{color:`var(--c-white)`},children:t.username}),(0,F.jsx)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:t.lastActive?Ah(t.lastActive):`No activity`})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-0.5 flex-shrink-0`,children:i.slice(0,3).map(([e])=>(0,F.jsx)(Gh,{source:e,size:11},e))})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-4 gap-1 text-center mb-2`,children:[[t.sessions,`sessions`],[J(t.totalMessages),`messages`],[t.projects,`projects`],[J(n),`tokens`]].map(([e,t])=>(0,F.jsxs)(`div`,{className:`p-1 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsx)(`div`,{className:`text-[11px] font-bold`,style:{color:`var(--c-white)`},children:e}),(0,F.jsx)(`div`,{className:`text-[7px]`,style:{color:`var(--c-text3)`},children:t})]},t))}),(0,F.jsx)(`div`,{className:`h-1.5 rounded-full overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${(t.sessions/D*100).toFixed(0)}%`,background:r}})}),t.topModels&&t.topModels.length>0&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1.5`,children:t.topModels.slice(0,2).map(e=>(0,F.jsx)(`span`,{className:`text-[8px] px-1.5 py-0.5 rounded-sm`,style:{background:`rgba(99,102,241,0.08)`,color:`#818cf8`},children:e.name},e.name))})]},t.username)})}),y.length===0&&(0,F.jsxs)(`div`,{className:`card p-8 text-center`,children:[(0,F.jsx)(Di,{size:32,className:`mx-auto mb-3`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`div`,{className:`text-[12px] font-medium mb-1`,style:{color:`var(--c-white)`},children:`No team members yet`}),(0,F.jsx)(`div`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:`Share the join command with your team to start collecting data`})]})]}),(0,F.jsx)(`div`,{className:`hidden xl:flex flex-col w-[300px] shrink-0 sticky top-[42px] self-start`,style:{height:k,borderLeft:`1px solid var(--c-border)`,background:`var(--c-bg)`},children:(0,F.jsx)(SD,{onSessionClick:O})}),(0,F.jsx)(XT,{chatId:l,onClose:()=>{u(null),f(null)},fetchFn:d?e=>ba(e,d):void 0,username:d,extraHeader:d?(0,F.jsx)(`span`,{className:`text-[11px] font-medium px-1.5 py-0.5 shrink-0`,style:{background:`rgba(99,102,241,0.15)`,color:`#818cf8`},children:d}):null})]})}Lf.register(qf,wm,im,km,Nm,vp);var AD=`JetBrains Mono, monospace`,jD=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`];function MD({segments:e,height:t=6}){let n=e.reduce((e,t)=>e+t.value,0);return n===0?null:(0,F.jsx)(`div`,{className:`flex w-full rounded-full overflow-hidden`,style:{height:t},children:e.filter(e=>e.value>0).map((e,t)=>(0,F.jsx)(`div`,{title:`${e.label}: ${J(e.value)}`,className:`h-full transition-all`,style:{width:`${(e.value/n*100).toFixed(1)}%`,background:e.color}},t))})}function ND({sessions:e,projects:t,selectedChat:n,onSelectChat:r}){let[i,a]=(0,S.useState)(new Set),o=e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},s=(0,S.useMemo)(()=>{let t={},n=[];for(let r of e)r.folder?(t[r.folder]||(t[r.folder]=[]),t[r.folder].push(r)):n.push(r);return{sorted:Object.entries(t).sort((e,t)=>t[1].length-e[1].length),noProject:n}},[e]),c=({s:e})=>(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1.5 cursor-pointer transition rounded-sm`,style:{background:n===e.id?`rgba(99,102,241,0.12)`:`transparent`},onMouseEnter:t=>{n!==e.id&&(t.currentTarget.style.background=`var(--c-bg3)`)},onMouseLeave:t=>{n!==e.id&&(t.currentTarget.style.background=`transparent`)},onClick:()=>r(e.id),children:[(0,F.jsx)(Gh,{source:e.source,size:10}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium truncate`,style:{color:`var(--c-white)`},children:e.name||`Untitled`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[8px]`,style:{color:`var(--c-text3)`},children:[e.totalMessages>0&&(0,F.jsxs)(`span`,{children:[e.totalMessages,`m`]}),e.totalMessages>0&&e.lastUpdatedAt&&(0,F.jsx)(`span`,{children:`·`}),e.lastUpdatedAt&&(0,F.jsx)(`span`,{children:Ah(e.lastUpdatedAt)})]})]})]});return(0,F.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2.5 shrink-0`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(qr,{size:12,style:{color:`var(--c-accent)`}}),(0,F.jsx)(`span`,{className:`text-[12px] font-medium uppercase tracking-wider`,style:{color:`var(--c-text2)`},children:`Sessions`}),(0,F.jsx)(`span`,{className:`text-[10px] ml-auto`,style:{color:`var(--c-text3)`},children:e.length})]}),(0,F.jsxs)(`div`,{className:`flex-1 overflow-y-auto scrollbar-thin py-1`,children:[s.sorted.map(([e,t])=>{let n=i.has(e),r=e.split(`/`).pop();return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1.5 cursor-pointer transition`,onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>o(e),children:[n?(0,F.jsx)(wr,{size:10,style:{color:`var(--c-text3)`}}):(0,F.jsx)(Cr,{size:10,style:{color:`var(--c-text3)`}}),(0,F.jsx)(Ur,{size:10,style:{color:`#818cf8`}}),(0,F.jsx)(`span`,{className:`text-[11px] font-medium truncate flex-1`,style:{color:`var(--c-text2)`},title:e,children:r}),(0,F.jsx)(`span`,{className:`text-[8px]`,style:{color:`var(--c-text3)`},children:t.length})]}),!n&&(0,F.jsx)(`div`,{className:`pl-3`,children:t.map(e=>(0,F.jsx)(c,{s:e},e.id))})]},e)}),s.noProject.length>0&&(0,F.jsxs)(`div`,{children:[s.sorted.length>0&&(0,F.jsx)(`div`,{className:`px-2 py-1.5 text-[10px] uppercase tracking-wider`,style:{color:`var(--c-text3)`},children:`no project`}),(0,F.jsx)(`div`,{className:s.sorted.length>0?`pl-1`:``,children:s.noProject.map(e=>(0,F.jsx)(c,{s:e},e.id))})]})]})]})}function PD(){let{username:e}=pt(),t=dt(),[n,r]=(0,S.useState)(null),[i,a]=(0,S.useState)(null),{dark:o}=tr(),s=o?`#888`:`#555`,c=o?`rgba(255,255,255,0.04)`:`rgba(0,0,0,0.06)`,l=o?`#555`:`#999`;(0,S.useEffect)(()=>{e&&ga(e,{limit:200}).then(r)},[e]);let u=(0,S.useCallback)(t=>ba(t,e),[e]);if(!n)return(0,F.jsx)(`div`,{className:`text-sm py-12 text-center`,style:{color:`var(--c-text2)`},children:`loading...`});let d=n.length,f=n.reduce((e,t)=>e+(t.totalMessages||0),0),p=n.reduce((e,t)=>e+(t.totalInputTokens||0),0),m=n.reduce((e,t)=>e+(t.totalOutputTokens||0),0),h=p+m,g=d>0?(f/d).toFixed(1):0,_=d>0?Math.round(h/d):0,v={};for(let e of n)e.source&&(v[e.source]=(v[e.source]||0)+1);let y=Object.entries(v).sort((e,t)=>t[1]-e[1]),b={};for(let e of n)e.folder&&(b[e.folder]||(b[e.folder]={count:0,lastActive:0,messages:0,tokens:0}),b[e.folder].count++,b[e.folder].messages+=e.totalMessages||0,b[e.folder].tokens+=(e.totalInputTokens||0)+(e.totalOutputTokens||0),e.lastUpdatedAt>b[e.folder].lastActive&&(b[e.folder].lastActive=e.lastUpdatedAt));let x=Object.entries(b).sort((e,t)=>t[1].count-e[1].count),C=x.length>0?Math.max(...x.map(([,e])=>e.count)):1,w={};for(let e of n)if(e.models)for(let t of e.models)w[t]=(w[t]||0)+1;let T=Object.entries(w).sort((e,t)=>t[1]-e[1]).slice(0,10),E={};for(let e of n)if(e.toolCalls)for(let t of e.toolCalls)E[t]=(E[t]||0)+1;let D=Object.entries(E).sort((e,t)=>t[1]-e[1]).slice(0,15),O={};for(let e of n){let t=new Date(e.lastUpdatedAt||e.createdAt).toISOString().slice(0,10);O[t]=(O[t]||0)+1}let k=Object.entries(O).sort((e,t)=>e[0].localeCompare(t[0])).slice(-14),A=e=>{a(e)},j=`calc(100vh - 42px)`;return(0,F.jsxs)(`div`,{className:`fade-in flex`,style:{height:j},children:[(0,F.jsx)(`div`,{className:`hidden lg:flex flex-col w-[250px] shrink-0 sticky top-[42px] self-start`,style:{height:j,borderRight:`1px solid var(--c-border)`,background:`var(--c-bg)`},children:(0,F.jsx)(ND,{sessions:n,projects:x,selectedChat:i,onSelectChat:a})}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-y-auto p-4 space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(`button`,{onClick:()=>t(`/`),className:`p-1.5 transition hover:bg-[var(--c-card)] rounded-sm`,style:{border:`1px solid var(--c-border)`,color:`var(--c-text2)`},children:(0,F.jsx)(dr,{size:14})}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsx)(`div`,{className:`w-9 h-9 flex items-center justify-center text-[14px] font-bold rounded-sm`,style:{background:`rgba(99,102,241,0.15)`,color:`#818cf8`},children:e.charAt(0).toUpperCase()}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[14px] font-bold`,style:{color:`var(--c-white)`},children:e}),(0,F.jsx)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:y.map(([e])=>(0,F.jsx)(Gh,{source:e,size:11},e))})]})]})]}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`sessions`,value:d}),(0,F.jsx)(K,{label:`messages`,value:J(f),sub:`${g}/session`}),(0,F.jsx)(K,{label:`editors`,value:y.length}),(0,F.jsx)(K,{label:`projects`,value:x.length}),(0,F.jsx)(K,{label:`tokens`,value:J(h),sub:`${J(_)}/session`}),(0,F.jsx)(K,{label:`models`,value:T.length})]}),h>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,F.jsx)($,{children:`token usage`}),(0,F.jsxs)(`span`,{className:`text-[11px] font-bold`,style:{color:`var(--c-white)`},children:[J(h),` total`]})]}),(0,F.jsx)(MD,{height:10,segments:[{label:`Input`,value:p,color:`#6366f1`},{label:`Output`,value:m,color:`#a78bfa`}]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4 mt-1.5 text-[10px]`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#6366f1`}}),` input `,J(p)]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#a78bfa`}}),` output `,J(m)]})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-3`,children:[y.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`editors`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Th,{data:{labels:y.map(([e])=>q(e)),datasets:[{data:y.map(([,e])=>e),backgroundColor:y.map(([e])=>Oh(e)),borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:s,font:{size:9,family:AD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:AD,size:10},titleFont:{family:AD,size:10}}}}})})]}),T.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`models`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Th,{data:{labels:T.map(([e])=>e),datasets:[{data:T.map(([,e])=>e),backgroundColor:jD,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:s,font:{size:8,family:AD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:AD,size:10},titleFont:{family:AD,size:10}}}}})})]})]}),k.length>1&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`daily activity (last 14 days)`}),(0,F.jsx)(`div`,{style:{height:120},children:(0,F.jsx)(wh,{data:{labels:k.map(([e])=>e.slice(5)),datasets:[{data:k.map(([,e])=>e),backgroundColor:`#6366f1`,borderRadius:2}]},options:{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{bodyFont:{family:AD,size:10},titleFont:{family:AD,size:10}}},scales:{x:{grid:{display:!1},ticks:{color:l,font:{size:8,family:AD}}},y:{grid:{color:c},ticks:{color:l,font:{size:8,family:AD},stepSize:1},beginAtZero:!0}}}})})]}),x.length>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)($,{children:`projects`}),(0,F.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2 mt-2`,children:x.map(([e,t])=>(0,F.jsxs)(`div`,{className:`card px-3 py-2.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5`,children:[(0,F.jsx)(Ur,{size:11,style:{color:`#818cf8`}}),(0,F.jsx)(`span`,{className:`text-[12px] font-medium truncate`,style:{color:`var(--c-white)`},children:e.split(`/`).pop()})]}),(0,F.jsx)(`div`,{className:`text-[8px] truncate mb-2`,style:{color:`var(--c-text3)`},children:e}),(0,F.jsxs)(`div`,{className:`grid grid-cols-3 gap-1 text-center mb-1.5`,children:[(0,F.jsxs)(`div`,{className:`p-1 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsx)(`div`,{className:`text-[11px] font-bold`,style:{color:`var(--c-white)`},children:t.count}),(0,F.jsx)(`div`,{className:`text-[7px]`,style:{color:`var(--c-text3)`},children:`sessions`})]}),(0,F.jsxs)(`div`,{className:`p-1 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsx)(`div`,{className:`text-[11px] font-bold`,style:{color:`var(--c-white)`},children:J(t.messages)}),(0,F.jsx)(`div`,{className:`text-[7px]`,style:{color:`var(--c-text3)`},children:`messages`})]}),(0,F.jsxs)(`div`,{className:`p-1 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsx)(`div`,{className:`text-[11px] font-bold`,style:{color:`var(--c-white)`},children:J(t.tokens)}),(0,F.jsx)(`div`,{className:`text-[7px]`,style:{color:`var(--c-text3)`},children:`tokens`})]})]}),(0,F.jsx)(`div`,{className:`h-1.5 rounded-full overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${(t.count/C*100).toFixed(0)}%`,background:`#6366f1`}})}),(0,F.jsx)(`div`,{className:`text-[8px] mt-1`,style:{color:`var(--c-text3)`},children:Ah(t.lastActive)})]},e))})]}),D.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`top tools`}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1`,children:D.map(([e,t])=>(0,F.jsxs)(`span`,{className:`text-[10px] px-2 py-1 rounded-sm`,style:{background:`var(--c-code-bg)`,color:`var(--c-text2)`},children:[e,` `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`×`,t]})]},e))})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`recent sessions`}),(0,F.jsx)(`div`,{className:`max-h-[400px] overflow-y-auto scrollbar-thin`,children:(0,F.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,F.jsx)(`tbody`,{children:n.slice(0,50).map(e=>(0,F.jsxs)(`tr`,{className:`cursor-pointer transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>a(e.id),children:[(0,F.jsx)(`td`,{className:`py-2 px-2 w-[24px]`,children:(0,F.jsx)(Gh,{source:e.source,size:11})}),(0,F.jsxs)(`td`,{className:`py-2 px-2`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium truncate`,style:{color:`var(--c-white)`},children:e.name||`Untitled`}),(0,F.jsx)(`div`,{className:`text-[10px] truncate`,style:{color:`var(--c-text3)`},children:e.folder?e.folder.split(`/`).pop():``})]}),(0,F.jsx)(`td`,{className:`py-2 px-2 text-[10px] whitespace-nowrap`,style:{color:`var(--c-text3)`},children:e.totalMessages>0&&(0,F.jsxs)(`span`,{children:[e.totalMessages,`m`]})}),(0,F.jsx)(`td`,{className:`py-2 px-2`,children:e.mode&&(0,F.jsx)(`span`,{className:`text-[8px] px-1.5 py-0.5 rounded-sm`,style:{background:`rgba(168,85,247,0.1)`,color:`#a855f7`},children:e.mode})}),(0,F.jsx)(`td`,{className:`py-2 px-2 text-[10px] whitespace-nowrap text-right`,style:{color:`var(--c-text3)`},children:Ah(e.lastUpdatedAt)})]},e.id))})})})]})]}),(0,F.jsx)(`div`,{className:`hidden xl:flex flex-col w-[300px] shrink-0 sticky top-[42px] self-start`,style:{height:j,borderLeft:`1px solid var(--c-border)`,background:`var(--c-bg)`},children:(0,F.jsx)(SD,{onSessionClick:A})}),(0,F.jsx)(XT,{chatId:i,onClose:()=>a(null),fetchFn:u,username:e,extraHeader:(0,F.jsx)(`span`,{className:`text-[11px] font-medium px-1.5 py-0.5 shrink-0`,style:{background:`rgba(99,102,241,0.15)`,color:`#818cf8`},children:e})})]})}Lf.register(qf,wm,im,km,Nm,vp);var FD=`JetBrains Mono, monospace`;function ID(e){if(!e)return`—`;let t=Date.now()-e,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<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function LD(e){return e===`completed`?`#22c55e`:e===`executing`?`#f59e0b`:`var(--c-text3)`}function RD({value:e,total:t,color:n=`#6366f1`}){return(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`flex-1 h-1 rounded-full overflow-hidden`,style:{background:`var(--c-bg3)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${t>0?Math.round(e/t*100):0}%`,background:n}})}),(0,F.jsxs)(`span`,{className:`text-[10px] tabular-nums`,style:{color:`var(--c-text3)`,fontFamily:FD,minWidth:36},children:[e,`/`,t]})]})}function zD({title:e,subtitle:t,content:n,loading:r,onClose:i}){let a=(0,S.useRef)(null);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`fixed inset-0 z-40 transition-opacity`,style:{background:`rgba(0,0,0,0.3)`},onClick:i}),(0,F.jsxs)(`div`,{className:`fixed top-0 right-0 bottom-0 z-50 flex flex-col shadow-2xl sidebar-slide-in cursor-default`,style:{width:`min(620px, 92vw)`,background:`var(--c-bg)`,borderLeft:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 shrink-0`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(`button`,{onClick:i,className:`p-1 rounded transition hover:bg-[var(--c-bg3)]`,style:{color:`var(--c-text2)`},children:(0,F.jsx)(ki,{size:14})}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[13px] font-semibold`,style:{color:`var(--c-white)`},children:e}),t&&(0,F.jsx)(`div`,{className:`text-[11px] capitalize`,style:{color:`var(--c-text2)`,fontFamily:FD},children:t})]})]}),(0,F.jsxs)(`div`,{ref:a,className:`flex-1 overflow-y-auto scrollbar-thin px-4 py-3`,children:[r&&(0,F.jsx)(`div`,{className:`text-[12px] py-12 text-center`,style:{color:`var(--c-text3)`},children:`Loading…`}),!r&&n===null&&(0,F.jsx)(`div`,{className:`text-[12px] py-12 text-center`,style:{color:`var(--c-text3)`},children:`File not found.`}),!r&&n!==null&&(0,F.jsx)(`pre`,{className:`text-[11px] leading-relaxed whitespace-pre-wrap break-words`,style:{color:`var(--c-text)`,fontFamily:FD},children:n})]})]})]})}var BD={mode:`Mode`,model_profile:`Model profile`,granularity:`Granularity`,parallelization:`Parallelization`,commit_docs:`Commit docs`},VD={research:`Research`,plan_check:`Plan check`,verifier:`Verifier`,nyquist_validation:`Nyquist`,auto_advance:`Auto advance`,ui_phase:`UI phase`,skip_discuss:`Skip discuss`};function HD({folder:e,anchor:t,onClose:n}){let[r,i]=(0,S.useState)(void 0),a=(0,S.useRef)(null);(0,S.useEffect)(()=>{da(e).then(i).catch(()=>i(null))},[e]),(0,S.useEffect)(()=>{function e(e){a.current&&!a.current.contains(e.target)&&n()}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]);let o=t?t.bottom+6:0,s=t?window.innerWidth-t.right:0;function c(e){return e===!0?(0,F.jsx)(`span`,{style:{color:`#22c55e`},children:`on`}):e===!1?(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`off`}):(0,F.jsx)(`span`,{style:{color:`var(--c-white)`},children:String(e)})}return(0,F.jsxs)(`div`,{ref:a,className:`p-3 shadow-xl text-[11px]`,style:{position:`fixed`,top:o,right:s,zIndex:9999,width:240,background:`var(--c-bg)`,border:`1px solid var(--c-border)`,boxShadow:`0 8px 32px rgba(0,0,0,0.4)`},onClick:e=>e.stopPropagation(),children:[r===void 0&&(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},children:`Loading…`}),r===null&&(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},children:`No config.json found.`}),r&&(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(`div`,{className:`space-y-1`,children:Object.entries(BD).map(([e,t])=>e in r?(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:t}),c(r[e])]},e):null)}),r.workflow&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`border-t pt-2`,style:{borderColor:`var(--c-border)`,color:`var(--c-text3)`},children:`workflow`}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1`,children:Object.entries(VD).map(([e,t])=>e in r.workflow?(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-1`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:t}),c(r.workflow[e])]},e):null)})]})]})]})}function UD({phase:e,tokenData:t,onOpenFile:n}){let r=e.total_tasks??0,i=e.completed_tasks??0,a=!!e.has_plan,o=!!e.has_research,s=!!e.has_verification,c=e.status??`planned`;return(0,F.jsxs)(`div`,{className:`flex items-center px-3 py-2 border-b text-[12px] hover:bg-[var(--c-bg3)] transition`,style:{borderColor:`var(--c-border)`,gap:0},children:[(0,F.jsx)(`div`,{style:{width:28,flexShrink:0},children:(0,F.jsx)(c===`completed`?Dr:c===`executing`?$r:kr,{size:12,style:{color:LD(c)},className:c===`executing`?`animate-spin`:``})}),(0,F.jsx)(`div`,{style:{width:32,flexShrink:0},children:(0,F.jsx)(`span`,{className:`text-[10px] font-bold tabular-nums`,style:{color:`var(--c-text3)`,fontFamily:FD},children:e.phase_number??`?`})}),(0,F.jsx)(`div`,{className:`flex-1 min-w-0 pr-3`,children:(0,F.jsx)(`span`,{className:`block truncate capitalize text-[12px]`,style:{color:`var(--c-white)`},children:e.phase_name})}),(0,F.jsx)(`div`,{style:{width:100,flexShrink:0,paddingRight:12},children:r>0?(0,F.jsx)(RD,{value:i,total:r,color:LD(c)}):null}),(0,F.jsxs)(`div`,{style:{width:88,flexShrink:0},className:`flex items-center gap-1`,children:[a&&(0,F.jsxs)(`button`,{onClick:()=>n(e,`plan`),className:`flex items-center gap-1 px-1.5 py-px text-[10px] transition hover:opacity-80 cursor-pointer`,style:{background:`rgba(99,102,241,0.12)`,color:`#818cf8`},title:`View PLAN.md`,children:[(0,F.jsx)(Br,{size:9}),`plan`]}),o&&(0,F.jsx)(`button`,{onClick:()=>n(e,`research`),className:`px-1 py-px transition hover:opacity-80 cursor-pointer`,style:{background:`rgba(245,158,11,0.1)`,color:`#f59e0b`},title:`View RESEARCH.md`,children:(0,F.jsx)(mr,{size:9})}),s&&(0,F.jsx)(`button`,{onClick:()=>n(e,`verification`),className:`px-1 py-px transition hover:opacity-80 cursor-pointer`,style:{background:`rgba(34,197,94,0.1)`,color:`#22c55e`},title:`View VERIFICATION.md`,children:(0,F.jsx)(hi,{size:9})})]}),(0,F.jsx)(`div`,{style:{width:64,flexShrink:0,textAlign:`right`},children:t&&t.cost>0?(0,F.jsx)(`span`,{className:`text-[10px] tabular-nums`,style:{color:`var(--c-text2)`,fontFamily:FD},children:kh(t.cost)}):null}),(0,F.jsx)(`div`,{style:{width:56,flexShrink:0,textAlign:`right`},children:(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:ID(e.last_modified)})})]})}function WD(e){return e.total_phases===0?`var(--c-border)`:e.completed_phases===e.total_phases?`#22c55e`:e.completed_phases>0?`#f59e0b`:`var(--c-border)`}function GD({project:e,isExpanded:t,onToggle:n,onOpenFile:r,onOpenConfig:i,onOpenState:a}){let[o,s]=(0,S.useState)(null),[c,l]=(0,S.useState)(null),u=(0,S.useRef)(null),d=(0,S.useRef)(null),f=e.total_phases>0?Math.round(e.completed_phases/e.total_phases*100):0,p=e.total_phases-e.completed_phases;return(0,S.useEffect)(()=>{t&&o===null&&(ca(e.folder).then(s),fa(e.folder).then(e=>{let t={};for(let n of e)t[n.id]=n;l(t)}).catch(()=>l({})))},[t,o,e.folder]),(0,F.jsxs)(`div`,{className:`card overflow-hidden`,style:{borderLeft:`2px solid ${WD(e)}`},children:[(0,F.jsxs)(`div`,{className:`flex items-center w-full px-3 py-3`,style:{gap:0},children:[(0,F.jsx)(`button`,{onClick:n,className:`flex items-center justify-center hover:bg-[var(--c-bg3)] transition rounded cursor-pointer`,style:{width:24,height:24,flexShrink:0,color:`var(--c-text3)`},children:t?(0,F.jsx)(Cr,{size:13}):(0,F.jsx)(wr,{size:13})}),(0,F.jsxs)(`button`,{onClick:n,className:`flex-1 min-w-0 text-left px-2 cursor-pointer`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-[13px] font-semibold truncate`,style:{color:`var(--c-white)`},children:e.name}),e.milestone&&(0,F.jsx)(`span`,{className:`text-[10px] px-1.5 py-px shrink-0`,style:{background:`rgba(99,102,241,0.12)`,color:`#818cf8`},children:e.milestone})]}),(0,F.jsx)(`div`,{className:`text-[10px] truncate mt-0.5`,style:{color:`var(--c-text3)`,fontFamily:FD},children:e.folder})]}),(0,F.jsx)(`div`,{style:{width:36,flexShrink:0,textAlign:`right`},children:(0,F.jsxs)(`span`,{className:`text-[11px] font-bold tabular-nums`,style:{color:f===100?`#22c55e`:f>0?`#f59e0b`:`var(--c-text3)`,fontFamily:FD},children:[f,`%`]})}),(0,F.jsx)(`div`,{style:{width:112,flexShrink:0,padding:`0 10px`},children:(0,F.jsx)(RD,{value:e.completed_phases,total:e.total_phases,color:f===100?`#22c55e`:`#6366f1`})}),(0,F.jsxs)(`div`,{style:{width:80,flexShrink:0},className:`flex items-center gap-1`,children:[e.completed_phases>0&&(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] px-1.5 py-px`,style:{background:`rgba(34,197,94,0.08)`,color:`#22c55e`},children:[(0,F.jsx)(Dr,{size:9}),` `,e.completed_phases]}),p>0&&(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] px-1.5 py-px`,style:{background:`rgba(255,255,255,0.04)`,color:`var(--c-text3)`},children:[(0,F.jsx)(kr,{size:9}),` `,p]})]}),(0,F.jsxs)(`div`,{style:{width:52,flexShrink:0},className:`flex items-center gap-2`,children:[e.todos>0&&(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},title:`Todos / Seeds`,children:[(0,F.jsx)(Zr,{size:10}),` `,e.todos]}),e.notes>0&&(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},title:`Quick tasks`,children:[(0,F.jsx)(vi,{size:10}),` `,e.notes]})]}),(0,F.jsx)(`div`,{style:{width:60,flexShrink:0,textAlign:`right`},children:(0,F.jsx)(`span`,{className:`text-[11px] tabular-nums`,style:{color:e.total_cost>0?`#a78bfa`:`var(--c-text3)`,fontFamily:FD},children:e.total_cost>0?kh(e.total_cost):`—`})}),(0,F.jsx)(`div`,{style:{width:56,flexShrink:0,textAlign:`right`},children:(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:ID(e.last_modified)})}),(0,F.jsxs)(`div`,{style:{width:52,flexShrink:0},className:`flex items-center justify-end gap-0.5`,onClick:e=>e.stopPropagation(),children:[(0,F.jsx)(`button`,{ref:d,onClick:()=>a(e.folder,e.name),className:`p-1 rounded transition hover:bg-[var(--c-bg3)] cursor-pointer`,style:{color:`var(--c-text3)`},title:`View STATE.md`,children:(0,F.jsx)(Yr,{size:13})}),(0,F.jsx)(`button`,{ref:u,onClick:()=>i(e.folder,u.current?.getBoundingClientRect()),className:`p-1 rounded transition hover:bg-[var(--c-bg3)] cursor-pointer`,style:{color:`var(--c-text3)`},title:`GSD config`,children:(0,F.jsx)(Or,{size:13})})]})]}),t&&(0,F.jsxs)(`div`,{className:`border-t`,style:{borderColor:`var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center px-3 py-1 text-[10px]`,style:{background:`var(--c-bg2)`,color:`var(--c-text3)`,gap:0},children:[(0,F.jsx)(`div`,{style:{width:28,flexShrink:0}}),(0,F.jsx)(`div`,{style:{width:32,flexShrink:0},children:`#`}),(0,F.jsx)(`div`,{className:`flex-1 pr-3`,children:`phase`}),(0,F.jsx)(`div`,{style:{width:100,flexShrink:0,paddingRight:12},children:`plans`}),(0,F.jsx)(`div`,{style:{width:88,flexShrink:0},children:`artifacts`}),(0,F.jsx)(`div`,{style:{width:64,flexShrink:0,textAlign:`right`},children:`est. cost`}),(0,F.jsx)(`div`,{style:{width:56,flexShrink:0,textAlign:`right`},children:`updated`})]}),o===null?(0,F.jsx)(`div`,{className:`px-4 py-3 text-[12px]`,style:{color:`var(--c-text3)`},children:`Loading phases…`}):o.length===0?(0,F.jsx)(`div`,{className:`px-4 py-3 text-[12px]`,style:{color:`var(--c-text3)`},children:`No phases found.`}):o.map(t=>(0,F.jsx)(UD,{phase:t,tokenData:c?.[t.id]??null,onOpenFile:(t,n)=>r(t,e.folder,n)},t.id))]})]})}function KD(){let{dark:e}=tr(),[t,n]=(0,S.useState)(null),[r,i]=(0,S.useState)(null),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(null),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)(null),[p,m]=(0,S.useState)(!0),h=e?`#888`:`#555`,g=e?`#555`:`#999`,_=e?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`;(0,S.useEffect)(()=>{Promise.all([sa(),ua()]).then(([e,t])=>{n(e),i(t),m(!1),o({totalCost:(e||[]).reduce((e,t)=>e+(t.total_cost||0),0)})}).catch(()=>m(!1))},[]);function v(e,t){f(n=>n?.folder===e?null:{folder:e,anchor:t})}function y(e,t,n){let r=e.id?.split(`::`)?.[1]||``,i=e.phase_name??e.name??``;u({title:{plan:`PLAN.md`,research:`RESEARCH.md`,verification:`VERIFICATION.md`,summary:`SUMMARY.md`}[n]??n.toUpperCase()+`.md`,subtitle:i,content:null,loading:!0}),n===`plan`?la(t,r).then(e=>u(t=>t?{...t,content:e?.content??null,loading:!1}:null)).catch(()=>u(e=>e?{...e,loading:!1}:null)):pa(t,n,r).then(e=>u(t=>t?{...t,content:e?.content??null,loading:!1}:null)).catch(()=>u(e=>e?{...e,loading:!1}:null))}function b(e,t){u({title:`STATE.md`,subtitle:t,content:null,loading:!0}),pa(e,`state`).then(e=>u(t=>t?{...t,content:e?.content??null,loading:!1}:null)).catch(()=>u(e=>e?{...e,loading:!1}:null))}if(p)return(0,F.jsx)(wa,{label:`Loading GSD projects...`});if(!t||t.length===0)return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:xi,title:`GSD Workflow`}),(0,F.jsxs)(`div`,{className:`card p-8 text-center space-y-3`,children:[(0,F.jsx)(xi,{size:32,style:{color:`var(--c-text3)`,margin:`0 auto`}}),(0,F.jsx)(`div`,{className:`text-[14px] font-semibold`,style:{color:`var(--c-white)`},children:`No GSD projects found`}),(0,F.jsxs)(`div`,{className:`text-[12px] max-w-sm mx-auto`,style:{color:`var(--c-text2)`},children:[`GSD (Get Shit Done) is a structured AI workflow system that stores project plans and phases inside a `,(0,F.jsx)(`code`,{style:{fontFamily:FD},children:`.planning/`}),` directory. Run a data scan after initializing a GSD project and it will appear here.`]})]})]});let x=r&&r.totalPhases>0?Math.round(r.completedPhases/r.totalPhases*100):0,C={completed:r?.completedPhases??0,executing:r?.executingPhases??0,planned:r?.plannedPhases??0},w={labels:[`Completed`,`Executing`,`Planned`],datasets:[{data:[C.completed,C.executing,C.planned],backgroundColor:[`#22c55e`,`#f59e0b`,`rgba(255,255,255,0.08)`],borderWidth:0}]},T=[...t].sort((e,t)=>t.total_phases-e.total_phases).slice(0,8),E={labels:T.map(e=>e.name.length>16?e.name.slice(0,15)+`…`:e.name),datasets:[{label:`Completed`,data:T.map(e=>e.completed_phases),backgroundColor:`#22c55e`,borderRadius:2},{label:`Remaining`,data:T.map(e=>e.total_phases-e.completed_phases),backgroundColor:`rgba(99,102,241,0.3)`,borderRadius:2}]},D={responsive:!0,maintainAspectRatio:!1,cutout:`72%`,plugins:{legend:{display:!1},tooltip:{bodyFont:{family:FD,size:10},titleFont:{family:FD,size:10}}}},O={responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{stacked:!0,grid:{color:_},ticks:{color:g,font:{size:8,family:FD}}},y:{stacked:!0,grid:{display:!1},ticks:{color:h,font:{size:8,family:FD}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:FD,size:10},titleFont:{family:FD,size:10}}}};return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:xi,title:`GSD Workflow`}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`projects`,value:r?.totalProjects??t.length}),(0,F.jsx)(K,{label:`total phases`,value:r?.totalPhases??`—`}),(0,F.jsx)(K,{label:`completed`,value:r?.completedPhases??`—`}),(0,F.jsx)(K,{label:`completion`,value:r?.totalPhases>0?`${x}%`:`—`}),(0,F.jsx)(K,{label:`total cost`,value:a?kh(a.totalCost):`—`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`phase status`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,F.jsx)(`div`,{style:{height:110,width:110,flexShrink:0},children:(0,F.jsx)(Th,{data:w,options:D})}),(0,F.jsx)(`div`,{className:`space-y-2 text-[11px]`,children:[{label:`Completed`,count:C.completed,color:`#22c55e`},{label:`Executing`,count:C.executing,color:`#f59e0b`},{label:`Planned`,count:C.planned,color:`var(--c-text3)`}].map(({label:e,count:t,color:n})=>(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:n}}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:e}),(0,F.jsx)(`span`,{className:`ml-auto font-bold tabular-nums`,style:{color:n,fontFamily:FD},children:t})]},e))})]})]}),(0,F.jsxs)(`div`,{className:`card p-3 lg:col-span-2`,children:[(0,F.jsxs)($,{children:[`projects `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`by phases`})]}),(0,F.jsx)(`div`,{style:{height:130},children:(0,F.jsx)(wh,{data:E,options:O})}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm`,style:{background:`#22c55e`}}),` Completed`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm`,style:{background:`rgba(99,102,241,0.3)`}}),` Remaining`]})]})]})]}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)($,{children:`projects`}),t.map(e=>(0,F.jsx)(GD,{project:e,isExpanded:s===e.folder,onToggle:()=>c(t=>t===e.folder?null:e.folder),onOpenFile:y,onOpenConfig:v,onOpenState:b},e.folder))]}),d&&(0,F.jsx)(HD,{folder:d.folder,anchor:d.anchor,onClose:()=>f(null)}),l&&(0,F.jsx)(zD,{title:l.title,subtitle:l.subtitle,content:l.content,loading:l.loading,onClose:()=>u(null)})]})}function qD({icon:e,label:t,items:n}){let[r,i]=(0,S.useState)(!1),a=ct(),o=n.some(e=>e.to===a.pathname),s=(0,S.useRef)(null);return(0,F.jsxs)(`div`,{className:`relative`,onMouseEnter:()=>{clearTimeout(s.current),i(!0)},onMouseLeave:()=>{s.current=setTimeout(()=>i(!1),150)},children:[(0,F.jsxs)(`button`,{className:`flex items-center gap-1.5 px-2.5 py-1 text-[12px] rounded transition ${o?`bg-[var(--c-card)] text-[var(--c-white)]`:`text-[var(--c-text2)] hover:text-[var(--c-white)]`}`,children:[(0,F.jsx)(e,{size:12}),t,(0,F.jsx)(Cr,{size:10,style:{opacity:.5}})]}),r&&(0,F.jsx)(`div`,{className:`absolute top-full left-0 mt-1 py-1 rounded shadow-lg min-w-[160px] z-[100]`,style:{background:`var(--c-bg)`,border:`1px solid var(--c-border)`},children:n.map(({to:e,icon:t,label:n})=>(0,F.jsxs)(Mn,{to:e,onClick:()=>i(!1),className:({isActive:e})=>`flex items-center gap-2 px-3 py-1.5 text-[12px] transition ${e?`bg-[var(--c-bg3)] text-[var(--c-white)]`:`text-[var(--c-text2)] hover:text-[var(--c-white)] hover:bg-[var(--c-bg3)]`}`,children:[(0,F.jsx)(t,{size:12}),n]},e))})]})}function JD(){let[e,t]=(0,S.useState)(null),[n,r]=(0,S.useState)(null),{live:i,toggle:a}=Sa(),[o,s]=(0,S.useState)(null),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(!!Mi()),f=(0,S.useRef)(null),{dark:p,toggle:m}=tr(),[h,g]=(0,S.useState)(!1),[_,v]=(0,S.useState)(!1);(0,S.useEffect)(()=>{Fi(()=>d(!1))},[]),(0,S.useEffect)(()=>{ma().then(e=>{s(e.mode||`local`),l(!!e.auth)})},[]);let y=(0,S.useCallback)(()=>{zi().then(t).catch(()=>{})},[]);(0,S.useEffect)(()=>{o===`local`&&y()},[o]);let b=(0,S.useCallback)(async e=>{await Gi(e),t(await zi())},[]);(0,S.useEffect)(()=>(i&&o===`local`?f.current=setInterval(()=>{b().catch(()=>{})},6e4):(f.current&&clearInterval(f.current),f.current=null),()=>{f.current&&clearInterval(f.current)}),[i,o,b]);let x=async()=>{r({scanned:0,total:0});try{await b(e=>r({scanned:e.scanned,total:e.total}))}catch(e){console.error(e)}r(null)},C=o===`relay`,w=C&&c&&!u,T=ct().pathname===`/artifacts`,E=C?[{to:`/`,icon:Di,label:`Team`}]:[{to:`/`,icon:lr,label:`Dashboard`},{to:`/sessions`,icon:ni,label:`Sessions`},{to:`/projects`,icon:Ur,label:`Projects`},{icon:Ir,label:`Costs`,children:[{to:`/costs`,icon:Ir,label:`Cost Analysis`},{to:`/subscriptions`,icon:Pr,label:`Subscriptions`}]},{icon:yr,label:`Insights`,children:[{to:`/analysis`,icon:yr,label:`Deep Analysis`},{to:`/compare`,icon:Wr,label:`Compare`}]},{to:`/artifacts`,icon:ii,label:`Artifacts`},{to:`/gsd`,icon:xi,label:`GSD`},{to:`/mcps`,icon:oi,label:`MCPs`},{to:`/sql`,icon:Fr,label:`SQL`}];return w?(0,F.jsx)(Ta,{onSuccess:()=>d(!0)}):(0,F.jsxs)(`div`,{className:`min-h-screen`,children:[(0,F.jsxs)(`header`,{className:`border-b px-4 py-1.5 flex items-center gap-3 sticky top-0 z-50 backdrop-blur-xl`,style:{borderColor:`var(--c-border)`,background:`var(--c-header)`},children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-bold tracking-tight`,style:{color:`var(--c-white)`},children:[(0,F.jsx)(Ca,{size:18}),`Agentlytics`,C&&(0,F.jsx)(`span`,{className:`ml-1.5 text-[10px] font-medium px-1.5 py-0.5`,style:{background:`rgba(99,102,241,0.15)`,color:`#818cf8`},children:`relay`})]}),(0,F.jsx)(`nav`,{className:`flex gap-0.5 ml-2`,children:E.map(e=>e.children?(0,F.jsx)(qD,{icon:e.icon,label:e.label,items:e.children},e.label):(0,F.jsxs)(Mn,{to:e.to,end:e.to===`/`,className:({isActive:e})=>`flex items-center gap-1.5 px-2.5 py-1 text-[12px] rounded transition ${e?`bg-[var(--c-card)] text-[var(--c-white)]`:`text-[var(--c-text2)] hover:text-[var(--c-white)]`}`,children:[(0,F.jsx)(e.icon,{size:12}),e.label]},e.to))}),(0,F.jsxs)(`div`,{className:`ml-auto flex items-center gap-3`,children:[!C&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{onClick:a,className:`flex items-center gap-1.5 px-2 py-0.5 text-[11px] transition`,style:{color:i?`#22c55e`:`var(--c-text3)`,border:i?`1px solid rgba(34,197,94,0.3)`:`1px solid var(--c-border)`,background:i?`rgba(34,197,94,0.08)`:`transparent`},title:i?`Disable live refresh`:`Enable live refresh (every 60s)`,children:[(0,F.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${i?`pulse-dot`:``}`,style:{background:i?`#22c55e`:`var(--c-text3)`}}),`Live`]}),(0,F.jsxs)(`button`,{onClick:x,disabled:!!n,className:`flex items-center gap-1 px-2 py-0.5 text-[11px] rounded transition hover:bg-[var(--c-card)]`,style:{color:`var(--c-text2)`,border:`1px solid var(--c-border)`},title:`Clear cache and rescan all editors`,children:[(0,F.jsx)(li,{size:10,className:n?`animate-spin`:``}),n?`Refetching (${n.scanned}/${n.total})...`:`Refetch`]}),(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text2)`},children:e?`${e.totalChats} sessions`:`...`})]}),C&&(0,F.jsxs)(`button`,{onClick:()=>{g(!0),v(!1)},className:`flex items-center gap-1.5 px-2 py-0.5 text-[11px] transition hover:bg-[var(--c-card)]`,style:{color:`#818cf8`,border:`1px solid var(--c-border)`},title:`MCP Connection`,children:[(0,F.jsx)(oi,{size:10}),`Connect`]}),(0,F.jsx)(Mn,{to:`/settings`,className:`p-1 rounded transition hover:bg-[var(--c-card)]`,style:({isActive:e})=>({color:e?`#6366f1`:`var(--c-text2)`}),title:`Settings`,children:(0,F.jsx)(pi,{size:13})}),(0,F.jsx)(`button`,{onClick:m,className:`p-1 rounded transition hover:bg-[var(--c-card)]`,style:{color:`var(--c-text2)`},title:p?`Light mode`:`Dark mode`,children:p?(0,F.jsx)(yi,{size:13}):(0,F.jsx)(ri,{size:13})})]})]}),n&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-1.5 text-[12px]`,style:{background:`rgba(234,179,8,0.08)`,borderBottom:`1px solid rgba(234,179,8,0.15)`,color:`#ca8a04`},children:[(0,F.jsx)(wi,{size:12}),(0,F.jsx)(`span`,{children:`Devin, Devin Next, and Antigravity require their app to be running during refetch — otherwise their sessions won't be detected.`})]}),(0,F.jsx)(`main`,{className:C?`px-0`:T?`p-0 overflow-hidden`:`p-4 max-w-[1400px] mx-auto`,children:o===null?(0,F.jsx)(wa,{label:`Loading...`}):C?(0,F.jsxs)(zt,{children:[(0,F.jsx)(Lt,{path:`/`,element:(0,F.jsx)(kD,{})}),(0,F.jsx)(Lt,{path:`/relay`,element:(0,F.jsx)(kD,{})}),(0,F.jsx)(Lt,{path:`/relay/user/:username`,element:(0,F.jsx)(PD,{})})]}):(0,F.jsxs)(zt,{children:[(0,F.jsx)(Lt,{path:`/`,element:(0,F.jsx)(rE,{overview:e})}),(0,F.jsx)(Lt,{path:`/projects`,element:(0,F.jsx)(wE,{overview:e})}),(0,F.jsx)(Lt,{path:`/projects/detail`,element:(0,F.jsx)(ME,{})}),(0,F.jsx)(Lt,{path:`/sessions`,element:(0,F.jsx)(aE,{overview:e})}),(0,F.jsx)(Lt,{path:`/costs`,element:(0,F.jsx)(FE,{overview:e})}),(0,F.jsx)(Lt,{path:`/analysis`,element:(0,F.jsx)(_E,{overview:e})}),(0,F.jsx)(Lt,{path:`/compare`,element:(0,F.jsx)(xE,{overview:e})}),(0,F.jsx)(Lt,{path:`/subscriptions`,element:(0,F.jsx)(hD,{})}),(0,F.jsx)(Lt,{path:`/artifacts`,element:(0,F.jsx)(eD,{})}),(0,F.jsx)(Lt,{path:`/mcps`,element:(0,F.jsx)(yD,{})}),(0,F.jsx)(Lt,{path:`/sql`,element:(0,F.jsx)(zE,{})}),(0,F.jsx)(Lt,{path:`/gsd`,element:(0,F.jsx)(KD,{})}),(0,F.jsx)(Lt,{path:`/settings`,element:(0,F.jsx)(tD,{})})]})}),(0,F.jsxs)(`footer`,{className:`border-t mt-8 px-4 py-3 flex items-center justify-between text-[11px]${T?` hidden`:``}`,style:{borderColor:`var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsxs)(`a`,{href:`https://github.com/f/agentlytics`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 hover:text-[var(--c-text)] transition`,children:[(0,F.jsx)(Gr,{size:11}),(0,F.jsx)(`span`,{children:`GitHub`})]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(Si,{size:11}),(0,F.jsx)(`code`,{style:{fontFamily:`JetBrains Mono, monospace`},children:`npx agentlytics`})]})]}),(0,F.jsxs)(`span`,{children:[`built by `,(0,F.jsx)(`a`,{href:`https://github.com/f`,target:`_blank`,rel:`noopener noreferrer`,className:`hover:text-[var(--c-text)] transition`,style:{color:`var(--c-text2)`},children:`fkadev`})]})]}),h&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`fixed inset-0 z-[60]`,style:{background:`rgba(0,0,0,0.5)`},onClick:()=>g(!1)}),(0,F.jsxs)(`div`,{className:`fixed z-[70] w-[440px] max-w-[90vw] p-5 rounded shadow-2xl`,style:{top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,background:`var(--c-bg)`,border:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,F.jsxs)(`div`,{className:`text-[13px] font-bold`,style:{color:`var(--c-white)`},children:[(0,F.jsx)(oi,{size:13,className:`inline mr-1.5`,style:{color:`#818cf8`}}),`Connection Config`]}),(0,F.jsx)(`button`,{onClick:()=>g(!1),className:`text-[18px] leading-none px-1 hover:opacity-70 transition`,style:{color:`var(--c-text3)`},children:`×`})]}),(0,F.jsx)(`div`,{className:`text-[12px] font-medium mb-1.5`,style:{color:`var(--c-white)`},children:`MCP Config`}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:`Add to your AI client's MCP settings`}),(0,F.jsx)(`button`,{onClick:()=>{let e=localStorage.getItem(`agentlytics_relay_token`),t={url:`${window.location.origin}/mcp`};e&&(t.headers={Authorization:`Bearer ${e}`});let n=JSON.stringify({mcpServers:{agentlytics:t}},null,2);navigator.clipboard.writeText(n),v(!0),setTimeout(()=>v(!1),2e3)},className:`flex items-center gap-1 px-1.5 py-0.5 text-[10px] transition hover:bg-[var(--c-bg3)]`,style:{border:`1px solid var(--c-border)`,color:_?`#22c55e`:`var(--c-text2)`},children:_?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Sr,{size:9}),` Copied`]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Mr,{size:9}),` Copy`]})})]}),(0,F.jsx)(`pre`,{className:`text-[11px] px-3 py-2 overflow-x-auto mb-4`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,color:`var(--c-text)`,fontFamily:`JetBrains Mono, monospace`,lineHeight:1.6},children:localStorage.getItem(`agentlytics_relay_token`)?`{\n "mcpServers": {\n "agentlytics": {\n "url": "${window.location.origin}/mcp",\n "headers": { "Authorization": "Bearer ${localStorage.getItem(`agentlytics_relay_token`)}" }\n }\n }\n}`:`{\n "mcpServers": {\n "agentlytics": {\n "url": "${window.location.origin}/mcp"\n }\n }\n}`}),(0,F.jsx)(`div`,{className:`text-[12px] font-medium mb-1.5`,style:{color:`var(--c-white)`},children:`Team Sharing`}),(0,F.jsx)(`div`,{className:`text-[10px] mb-1`,style:{color:`var(--c-text3)`},children:`Relay join is not supported in memhouse — team sharing is kernel-based. Each member owns their own rooms and shares by granting SELECT on them. See mem-house/delivery/kernel-install.md.`}),(0,F.jsx)(`pre`,{className:`text-[11px] px-3 py-2 overflow-x-auto`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,color:`var(--c-text)`,fontFamily:`JetBrains Mono, monospace`,lineHeight:1.6},children:`# each member ships with their own credential:
|
|
75
|
+
`]},t)})})}function JE(e){let t=e.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);if(!t)return{frontmatter:null,body:e};let n=[],r=t[1].split(`
|
|
76
|
+
`);for(let e=0;e<r.length;e++){let t=r[e].match(/^(\w[\w-]*):\s*(.*)/);if(t){let i=t[1],a=t[2].replace(/^["']|["']$/g,``).trim();if(a)n.push([i,a]);else{let t=[];for(;e+1<r.length&&/^\s+-\s/.test(r[e+1]);){e++;let n=r[e].replace(/^\s+-\s*/,``),i=n.match(/^\[([ xX])\]\s*(.*)/);if(i)t.push({type:`checkbox`,checked:i[1]!==` `,text:i[2]});else{let i=n.match(/^(\w[\w-]*):\s*(.*)/);if(i){let n={[i[1]]:i[2].replace(/^["']|["']$/g,``)};for(;e+1<r.length&&/^\s{4,}\w/.test(r[e+1])&&!/^\s+-/.test(r[e+1]);){e++;let t=r[e].trim().match(/^(\w[\w-]*):\s*(.*)/);t&&(n[t[1]]=t[2].replace(/^["']|["']$/g,``))}t.push({type:`object`,data:n})}else t.push({type:`text`,text:n})}}n.push([i,t.length?t:``])}}}return{frontmatter:n.length?n:null,body:t[2]}}var YE={completed:{bg:`rgba(34,197,94,0.12)`,color:`#22c55e`,icon:`✓`},in_progress:{bg:`rgba(99,102,241,0.12)`,color:`#818cf8`,icon:`◐`},pending:{bg:`rgba(250,204,21,0.12)`,color:`#facc15`,icon:`○`},blocked:{bg:`rgba(239,68,68,0.12)`,color:`#ef4444`,icon:`✕`}};function XE({val:e}){return typeof e==`string`?(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:e}):Array.isArray(e)?e.some(e=>e.type===`object`)?(0,F.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4,width:`100%`},children:e.map((e,t)=>{if(e.type!==`object`)return(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:e.text||``},t);let n=e.data,r=(n.status||``).toLowerCase().replace(/\s+/g,`_`),i=YE[r]||YE.pending,a=r===`completed`;return(0,F.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`3px 0`},children:[(0,F.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:16,height:16,borderRadius:3,flexShrink:0,background:i.bg,color:i.color,fontSize:10,fontWeight:700},children:i.icon}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`,opacity:a?.55:1,textDecoration:a?`line-through`:`none`,flex:1},children:n.content||n.title||n.name||n.id||JSON.stringify(n)}),n.status&&(0,F.jsx)(`span`,{style:{fontSize:10,padding:`1px 6px`,borderRadius:3,background:i.bg,color:i.color,flexShrink:0},children:n.status})]},t)})}):(0,F.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:e.map((e,t)=>(0,F.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:6,color:`var(--c-text2)`,cursor:`default`},children:[e.type===`checkbox`?(0,F.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:14,height:14,borderRadius:3,flexShrink:0,border:e.checked?`none`:`1.5px solid var(--c-text3)`,background:e.checked?`#6366f1`:`transparent`,color:`#fff`,fontSize:10,lineHeight:1},children:e.checked?`✓`:``}):(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`•`}),(0,F.jsx)(`span`,{style:{textDecoration:e.checked?`line-through`:`none`,opacity:e.checked?.5:1},children:e.text})]},t))}):null}function ZE({content:e}){let{frontmatter:t,body:n}=JE(e);return(0,F.jsxs)(`div`,{className:`artifact-markdown`,style:{color:`var(--c-text)`,fontSize:14,lineHeight:1.7,maxWidth:720,margin:`0 auto`},children:[t&&(0,F.jsx)(`div`,{style:{background:`var(--c-bg)`,border:`1px solid var(--c-border)`,borderRadius:6,padding:`10px 14px`,marginBottom:16,fontSize:12,fontFamily:BE},children:t.map(([e,t],n)=>(0,F.jsxs)(`div`,{style:{display:`flex`,gap:8,padding:`3px 0`,alignItems:Array.isArray(t)?`flex-start`:`center`},children:[(0,F.jsx)(`span`,{style:{color:`#818cf8`,minWidth:100,flexShrink:0,paddingTop:Array.isArray(t)?1:0},children:e}),(0,F.jsx)(XE,{val:t})]},n))}),(0,F.jsx)(wS,{remarkPlugins:[OT],components:{h1:({children:e})=>(0,F.jsx)(`h1`,{style:{fontSize:22,fontWeight:700,margin:`0 0 12px 0`,paddingBottom:8,borderBottom:`1px solid var(--c-border)`,color:`var(--c-white)`},children:e}),h2:({children:e})=>(0,F.jsx)(`h2`,{style:{fontSize:18,fontWeight:600,margin:`20px 0 8px 0`,paddingBottom:6,borderBottom:`1px solid var(--c-border)`,color:`var(--c-white)`},children:e}),h3:({children:e})=>(0,F.jsx)(`h3`,{style:{fontSize:15,fontWeight:600,margin:`16px 0 6px 0`,color:`var(--c-white)`},children:e}),h4:({children:e})=>(0,F.jsx)(`h4`,{style:{fontSize:14,fontWeight:600,margin:`12px 0 4px 0`,color:`var(--c-white)`},children:e}),p:({children:e})=>(0,F.jsx)(`p`,{style:{margin:`0 0 10px 0`},children:e}),ul:({children:e})=>(0,F.jsx)(`ul`,{style:{margin:`0 0 10px 0`,paddingLeft:24,listStyleType:`disc`},children:e}),ol:({children:e})=>(0,F.jsx)(`ol`,{style:{margin:`0 0 10px 0`,paddingLeft:24,listStyleType:`decimal`},children:e}),li:({children:e,className:t})=>{let n=t===`task-list-item`;return(0,F.jsx)(`li`,{style:{margin:`2px 0`,listStyleType:n?`none`:void 0,marginLeft:n?-20:0},children:e})},input:({type:e,checked:t})=>e===`checkbox`?(0,F.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:15,height:15,borderRadius:3,marginRight:6,verticalAlign:-2,flexShrink:0,border:t?`none`:`1.5px solid var(--c-text3)`,background:t?`#6366f1`:`transparent`,color:`#fff`,fontSize:10},children:t?`✓`:``}):null,pre:({children:e})=>(0,F.jsx)(`pre`,{style:{background:`var(--c-bg)`,border:`1px solid var(--c-border)`,borderRadius:6,padding:12,margin:`8px 0 12px 0`,overflow:`auto`,fontFamily:BE,fontSize:12,color:`var(--c-text)`,lineHeight:1.6},children:e}),code:({node:e,children:t})=>e?.position&&e.position.start.line!==e.position.end.line?(0,F.jsx)(`code`,{children:t}):(0,F.jsx)(`code`,{style:{background:`var(--c-bg3)`,padding:`1px 5px`,borderRadius:4,fontFamily:BE,fontSize:12,color:`#818cf8`},children:t}),blockquote:({children:e})=>(0,F.jsx)(`blockquote`,{style:{borderLeft:`3px solid #6366f1`,paddingLeft:12,margin:`8px 0`,color:`var(--c-text2)`,fontStyle:`italic`},children:e}),table:({children:e})=>(0,F.jsx)(`div`,{style:{overflow:`auto`,margin:`8px 0 12px 0`},children:(0,F.jsx)(`table`,{style:{borderCollapse:`collapse`,width:`100%`,fontSize:13},children:e})}),thead:({children:e})=>(0,F.jsx)(`thead`,{style:{borderBottom:`2px solid var(--c-border)`},children:e}),th:({children:e})=>(0,F.jsx)(`th`,{style:{textAlign:`left`,padding:`6px 12px`,fontWeight:600,color:`var(--c-white)`},children:e}),td:({children:e})=>(0,F.jsx)(`td`,{style:{padding:`5px 12px`,borderBottom:`1px solid var(--c-border)`},children:e}),a:({href:e,children:t})=>(0,F.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,style:{color:`#818cf8`,textDecoration:`underline`,textUnderlineOffset:2},children:t}),hr:()=>(0,F.jsx)(`hr`,{style:{border:`none`,borderTop:`1px solid var(--c-border)`,margin:`16px 0`}}),strong:({children:e})=>(0,F.jsx)(`strong`,{style:{color:`var(--c-white)`,fontWeight:600},children:e}),img:({src:e,alt:t})=>(0,F.jsx)(`img`,{src:e,alt:t,style:{maxWidth:`100%`,borderRadius:6,margin:`8px 0`}})},children:n})]})}function QE({content:e,fileName:t,viewRaw:n}){if(n)return(0,F.jsx)(`pre`,{className:`text-[12px] whitespace-pre-wrap break-words leading-relaxed`,style:{color:`var(--c-text)`,fontFamily:BE},children:e});let r=KE(t);return r===`json`?(0,F.jsx)(qE,{content:e}):r===`markdown`?(0,F.jsx)(ZE,{content:e}):(0,F.jsx)(`pre`,{className:`text-[12px] whitespace-pre-wrap break-words leading-relaxed`,style:{color:`var(--c-text)`,fontFamily:BE},children:e})}function $E(){let[e,t]=(0,S.useState)(null),[n,r]=(0,S.useState)(``),[i,a]=(0,S.useState)(new Set),[o,s]=(0,S.useState)(new Set),[c,l]=(0,S.useState)(null),[u,d]=(0,S.useState)(null),[f,p]=(0,S.useState)(!1),[m,h]=(0,S.useState)(!1);(0,S.useEffect)(()=>{ia().then(e=>{t(e),e&&e.length>0&&(a(new Set([e[0].folder])),e[0].editors.length>0&&s(new Set([e[0].folder+`::`+e[0].editors[0].editor])))})},[]);let g=async e=>{l(e),h(!1),p(!0);try{d(await aa(e.path))}catch{d({error:`Failed to load file content`})}p(!1)},_=e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},v=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};if(!e)return(0,F.jsx)(wa,{label:`Scanning project artifacts...`});let y=e.filter(e=>{if(!n)return!0;let t=n.toLowerCase();return e.name.toLowerCase().includes(t)||e.folder.toLowerCase().includes(t)?!0:e.editors.some(e=>e.label.toLowerCase().includes(t)||e.files.some(e=>e.name.toLowerCase().includes(t)))}),b=e.reduce((e,t)=>e+t.totalArtifacts,0),x=e.length,C=new Set;for(let t of e)for(let e of t.editors)C.add(e.editor);return(0,F.jsxs)(`div`,{className:`h-full`,children:[(0,F.jsx)(`div`,{className:`px-4 py-3`,style:{borderBottom:`1px solid var(--c-border)`},children:(0,F.jsxs)($T,{icon:ii,title:`Artifacts`,children:[(0,F.jsxs)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:[b,` artifacts · `,x,` projects · `,C.size,` editors`]}),(0,F.jsxs)(`div`,{className:`ml-auto relative`,children:[(0,F.jsx)(ui,{size:12,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,placeholder:`Search artifacts...`,value:n,onChange:e=>r(e.target.value),className:`pl-7 pr-3 py-1 text-[12px] outline-none w-[200px]`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,color:`var(--c-text)`}})]})]})}),y.length===0?(0,F.jsx)(`div`,{className:`text-sm py-12 text-center`,style:{color:`var(--c-text3)`},children:n?`No artifacts match your search`:`No AI artifacts found in any project folders`}):null,(0,F.jsxs)(`div`,{className:`flex`,style:{height:`calc(100vh - 130px)`},children:[(0,F.jsxs)(`div`,{className:`w-[340px] shrink-0 flex flex-col`,style:{background:`var(--c-card)`,borderRight:`1px solid var(--c-border)`},children:[(0,F.jsx)(`div`,{className:`px-3 py-2 text-[11px] font-semibold uppercase tracking-wider`,style:{color:`var(--c-text3)`,borderBottom:`1px solid var(--c-border)`},children:`Project Tree`}),(0,F.jsx)(`div`,{className:`overflow-y-auto flex-1`,children:y.map(e=>{let t=i.has(e.folder);return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`button`,{onClick:()=>_(e.folder),className:`w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-[var(--c-bg3)] transition`,style:{borderBottom:`1px solid var(--c-border)`},children:[t?(0,F.jsx)(Cr,{size:12,style:{color:`var(--c-text3)`}}):(0,F.jsx)(wr,{size:12,style:{color:`var(--c-text3)`}}),(0,F.jsx)(Ur,{size:13,style:{color:`#6366f1`}}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`text-[12px] font-medium truncate`,style:{color:`var(--c-white)`},children:e.name}),(0,F.jsx)(`div`,{className:`text-[10px] truncate`,style:{color:`var(--c-text3)`,fontFamily:BE},children:e.folder})]}),(0,F.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded`,style:{background:`rgba(99,102,241,0.12)`,color:`#818cf8`},children:e.totalArtifacts})]}),t&&e.editors.map(t=>{let n=e.folder+`::`+t.editor,r=o.has(n);return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`button`,{onClick:()=>v(n),className:`w-full flex items-center gap-2 pl-7 pr-3 py-1.5 text-left hover:bg-[var(--c-bg3)] transition`,children:[r?(0,F.jsx)(Cr,{size:10,style:{color:`var(--c-text3)`}}):(0,F.jsx)(wr,{size:10,style:{color:`var(--c-text3)`}}),t.editor===`_general`?(0,F.jsx)(Br,{size:12,style:{color:`var(--c-text2)`}}):(0,F.jsx)(Gh,{source:t.editor,size:12}),(0,F.jsx)(`span`,{className:`text-[11px] font-medium`,style:{color:t.editor===`_general`?`var(--c-text2)`:Oh(t.editor)},children:t.editor===`_general`?t.label:q(t.editor)}),(0,F.jsx)(`span`,{className:`text-[10px] ml-auto`,style:{color:`var(--c-text3)`},children:t.files.length})]}),r&&t.files.map(e=>(0,F.jsxs)(`button`,{onClick:()=>g(e),className:`w-full flex items-center gap-2 pl-12 pr-3 py-1.5 text-left hover:bg-[var(--c-bg3)] transition`,style:{background:c?.path===e.path?`var(--c-bg3)`:`transparent`,borderLeft:c?.path===e.path?`2px solid #6366f1`:`2px solid transparent`},children:[(0,F.jsx)(Br,{size:11,style:{color:`var(--c-text3)`}}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`text-[11px] truncate`,style:{color:`var(--c-text)`,fontFamily:BE},children:e.relativePath}),(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[VE(e.size),` · `,e.lines,` lines`]})]})]},e.path))]},n)})]},e.folder)})})]}),(0,F.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,style:{background:`var(--c-card)`},children:c?(0,F.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2.5`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(Br,{size:14,style:{color:`#6366f1`}}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[12px] font-medium`,style:{color:`var(--c-white)`,fontFamily:BE},children:c.relativePath}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(`span`,{children:VE(c.size)}),(0,F.jsxs)(`span`,{children:[c.lines,` lines`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(Ar,{size:9}),HE(c.modifiedAt)]})]})]}),u?.content&&(()=>{let e=UE(u.content);return(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] px-2 py-0.5 rounded`,style:{background:`rgba(99,102,241,0.08)`,border:`1px solid rgba(99,102,241,0.15)`,color:`#818cf8`},children:[(0,F.jsx)(Ti,{size:9}),WE(e),` tokens`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] px-2 py-0.5 rounded`,style:{background:`rgba(34,197,94,0.08)`,border:`1px solid rgba(34,197,94,0.15)`,color:`#22c55e`},children:[(0,F.jsx)(Ir,{size:9}),GE(e)]})]})})(),(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] px-2 py-0.5 rounded`,style:{background:`${Oh(c.editor)}15`,color:Oh(c.editor)},children:[c.editor!==`_general`&&(0,F.jsx)(Gh,{source:c.editor,size:11}),c.editorLabel]}),(0,F.jsxs)(`button`,{onClick:()=>h(e=>!e),className:`flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium transition`,style:{background:m?`rgba(99,102,241,0.15)`:`var(--c-bg3)`,color:m?`#818cf8`:`var(--c-text2)`,border:`1px solid `+(m?`rgba(99,102,241,0.3)`:`var(--c-border)`)},title:m?`Switch to rendered view`:`Switch to raw view`,children:[m?(0,F.jsx)(zr,{size:12}):(0,F.jsx)(jr,{size:12}),m?`Rendered`:`Raw`]}),(0,F.jsx)(`button`,{onClick:()=>{l(null),d(null)},className:`p-1 rounded hover:bg-[var(--c-bg3)] transition`,style:{color:`var(--c-text3)`},children:(0,F.jsx)(ki,{size:14})})]}),(0,F.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:f?(0,F.jsx)(`div`,{className:`text-[12px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`Loading...`}):u?.error?(0,F.jsx)(`div`,{className:`text-[12px] py-8 text-center`,style:{color:`#ef4444`},children:u.error}):u?.content?(0,F.jsx)(QE,{content:u.content,fileName:c.name,viewRaw:m}):null})]}):(0,F.jsx)(`div`,{className:`flex items-center justify-center flex-1 text-[13px]`,style:{color:`var(--c-text3)`},children:(0,F.jsxs)(`div`,{className:`text-center`,children:[(0,F.jsx)(ii,{size:32,className:`mx-auto mb-3 opacity-30`}),(0,F.jsx)(`div`,{children:`Select an artifact to view its contents`}),(0,F.jsx)(`div`,{className:`text-[11px] mt-1 opacity-60`,children:`Click any file in the sidebar tree`})]})})})]})]})}function eD(){let[e,t]=(0,S.useState)(null),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(!0),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(``),[u,d]=(0,S.useState)(!1);if((0,S.useEffect)(()=>{Promise.all([Yi(),Zi()]).then(([e,n])=>{t(e),r(n),a(!1)}).catch(()=>a(!1))},[]),i||!e)return(0,F.jsx)(wa,{label:`Loading settings...`});let f=e.hiddenProjects||[],p=async e=>{s(!0),t(await Xi({hiddenProjects:f.includes(e)?f.filter(t=>t!==e):[...f,e]})),s(!1)},m=[...n.filter(e=>{if(!c)return!0;let t=c.toLowerCase();return e.folder.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)})].sort((e,t)=>e.name.localeCompare(t.name)),h=!!e.allowSubscriptionAccess;return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:pi,title:`Settings`}),(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`px-3 py-2 flex items-center justify-between`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)($,{children:[h?(0,F.jsx)(hi,{size:11,className:`inline mr-1`}):(0,F.jsx)(gi,{size:11,className:`inline mr-1`}),`subscription access`]}),(0,F.jsx)(`button`,{onClick:()=>d(!0),disabled:o,className:`text-[11px] px-2 py-0.5 rounded transition`,style:{background:h?`rgba(34,197,94,0.08)`:`rgba(239,68,68,0.08)`,color:h?`#22c55e`:`#ef4444`,border:`1px solid ${h?`rgba(34,197,94,0.15)`:`rgba(239,68,68,0.15)`}`},children:h?`Enabled`:`Disabled`})]}),(0,F.jsxs)(`div`,{className:`text-[11px] px-3 py-2`,style:{color:`var(--c-text3)`},children:[`When enabled, Agentlytics reads locally stored auth tokens (Keychain, SQLite, config files) to show your plan and usage info for each editor. Tokens are kept in-memory only and `,(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`never sent to any third-party service`}),`.`]})]}),(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`px-3 py-2 flex items-center justify-between`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)($,{children:[(0,F.jsx)(Ur,{size:11,className:`inline mr-1`}),`projects (`,n.length,`)`]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f.length>0&&(0,F.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5`,style:{background:`rgba(239,68,68,0.08)`,color:`#ef4444`,border:`1px solid rgba(239,68,68,0.15)`},children:[f.length,` hidden`]}),(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(ui,{size:11,className:`absolute left-2 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:`Filter projects...`,className:`pl-6 pr-2 py-1 text-[11px] outline-none w-[180px]`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`}})]})]})]}),(0,F.jsx)(`div`,{className:`text-[11px] px-3 py-1.5`,style:{color:`var(--c-text3)`,borderBottom:`1px solid var(--c-border)`,background:`var(--c-bg3)`},children:`Hidden projects are excluded from all dashboard stats, sessions, costs, and analytics.`}),m.map(e=>(0,F.jsx)(nD,{project:e,hidden:f.includes(e.folder),onToggle:p,saving:o},e.folder)),m.length===0&&(0,F.jsx)(`div`,{className:`text-center py-6 text-[12px]`,style:{color:`var(--c-text3)`},children:`no projects match filter`})]}),u&&(0,F.jsx)(tD,{enabling:!h,saving:o,onConfirm:async()=>{s(!0),t(await Xi({allowSubscriptionAccess:!h})),s(!1),d(!1)},onCancel:()=>d(!1)})]})}function tD({enabling:e,saving:t,onConfirm:n,onCancel:r}){return(0,F.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,style:{background:`rgba(0,0,0,0.6)`},onClick:r,children:(0,F.jsxs)(`div`,{className:`card w-[420px] mx-4`,onClick:e=>e.stopPropagation(),style:{background:`var(--c-bg2)`,border:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-medium`,style:{color:`var(--c-white)`},children:[(0,F.jsx)(wi,{size:14,style:{color:e?`#fbbf24`:`#ef4444`}}),e?`Enable`:`Disable`,` Subscription Access`]}),(0,F.jsx)(`button`,{onClick:r,className:`p-1 rounded hover:bg-[var(--c-bg3)]`,style:{color:`var(--c-text3)`},children:(0,F.jsx)(ki,{size:14})})]}),(0,F.jsx)(`div`,{className:`px-4 py-3 text-[11px] space-y-2`,style:{color:`var(--c-text2)`},children:e?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{children:`This will allow Agentlytics to read locally stored auth tokens from:`}),(0,F.jsxs)(`ul`,{className:`space-y-1 pl-3`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(`li`,{children:`Claude Code – macOS Keychain / Linux secret-tool`}),(0,F.jsx)(`li`,{children:`Cursor – local SQLite (state.vscdb)`}),(0,F.jsx)(`li`,{children:`Copilot / VS Code – ~/.config/github-copilot/apps.json`}),(0,F.jsx)(`li`,{children:`Codex – local auth.json (JWT decode only)`}),(0,F.jsx)(`li`,{children:`Devin – local SQLite (state.vscdb)`})]}),(0,F.jsxs)(`p`,{style:{color:`var(--c-text2)`},children:[`Tokens are kept `,(0,F.jsx)(`strong`,{children:`in-memory only`}),` and never sent to any third-party service.`]})]}):(0,F.jsx)(`p`,{children:`This will stop Agentlytics from reading any local auth tokens. Subscription and plan details will no longer be collected.`})}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2 px-4 py-3`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`button`,{onClick:r,className:`text-[11px] px-3 py-1 rounded transition`,style:{color:`var(--c-text3)`,border:`1px solid var(--c-border)`},children:`Cancel`}),(0,F.jsx)(`button`,{onClick:n,disabled:t,className:`text-[11px] px-3 py-1 rounded transition font-medium`,style:{background:e?`rgba(34,197,94,0.12)`:`rgba(239,68,68,0.12)`,color:e?`#22c55e`:`#ef4444`,border:`1px solid ${e?`rgba(34,197,94,0.2)`:`rgba(239,68,68,0.2)`}`},children:t?`Saving...`:e?`Yes, enable`:`Yes, disable`})]})]})})}function nD({project:e,hidden:t,onToggle:n,saving:r}){let i=Object.entries(e.editors||{}).sort((e,t)=>t[1]-e[1]);return(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 transition`,style:{borderBottom:`1px solid var(--c-border)`,opacity:t?.5:1},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,children:[(0,F.jsx)(`button`,{onClick:()=>n(e.folder),disabled:r,className:`shrink-0 p-1 rounded transition hover:bg-[var(--c-bg)]`,style:{color:t?`#ef4444`:`var(--c-text3)`,border:`1px solid var(--c-border)`},title:t?`Show this project`:`Hide this project`,children:t?(0,F.jsx)(Rr,{size:12}):(0,F.jsx)(zr,{size:12})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`text-[12px] font-medium truncate`,style:{color:t?`var(--c-text3)`:`var(--c-white)`},children:e.name}),(0,F.jsx)(`div`,{className:`text-[10px] truncate`,style:{color:`var(--c-text3)`},title:e.folder,children:e.folder})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:i.slice(0,3).map(([e,t])=>(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Gh,{source:e,size:10}),t]},e))}),(0,F.jsx)(`div`,{className:`text-[11px] font-mono shrink-0`,style:{color:`var(--c-text2)`},children:J(e.totalSessions)}),(0,F.jsx)(`div`,{className:`text-[10px] shrink-0 w-[80px] text-right`,style:{color:`var(--c-text3)`},children:Ah(e.lastSeen)})]})}function rD({value:e,max:t=100,color:n,label:r}){let i=t>0?Math.min(e/t*100,100):0;return(0,F.jsxs)(`div`,{children:[r&&(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text2)`},children:r}),(0,F.jsxs)(`span`,{className:`text-[10px] font-mono`,style:{color:`var(--c-white)`},children:[typeof e==`number`?e.toFixed(1):e,`%`]})]}),(0,F.jsx)(`div`,{className:`h-1.5 w-full`,style:{background:`var(--c-bg3)`},children:(0,F.jsx)(`div`,{className:`h-full transition-all duration-500`,style:{width:`${i}%`,background:n||`#6366f1`}})})]})}function iD({date:e}){if(!e)return null;let t=new Date(e)-new Date;if(t<=0)return(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:`expired`});let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>24?(0,F.jsxs)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[`resets in `,Math.floor(n/24),`d `,n%24,`h`]}):(0,F.jsxs)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[`resets in `,n,`h `,r,`m`]})}function aD({name:e}){if(!e)return null;let t=(e||``).toLowerCase(),n=`rgba(99,102,241,0.12)`,r=`#818cf8`;return t.includes(`pro`)&&(n=`rgba(168,85,247,0.12)`,r=`#a855f7`),(t.includes(`max`)||t.includes(`ultra`))&&(n=`rgba(234,179,8,0.12)`,r=`#eab308`),t.includes(`plus`)&&(n=`rgba(34,197,94,0.12)`,r=`#22c55e`),t.includes(`free`)&&(n=`rgba(107,114,128,0.12)`,r=`#6b7280`),(0,F.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-wider px-2 py-0.5`,style:{background:n,color:r},children:e})}function oD({label:e,enabled:t}){return(0,F.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5`,style:{background:t?`rgba(34,197,94,0.08)`:`rgba(107,114,128,0.06)`,color:t?`#22c55e`:`var(--c-text3)`,border:`1px solid ${t?`rgba(34,197,94,0.15)`:`var(--c-border)`}`},children:e})}function sD({data:e}){let t=e.usage||{},n=Object.keys(t);return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(aD,{name:e.plan?.name}),e.plan?.status&&(0,F.jsxs)(`span`,{className:`text-[10px]`,style:{color:e.plan.status===`active`?`#22c55e`:`var(--c-text3)`},children:[`● `,e.plan.status]}),e.plan?.isYearlyPlan&&(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:`yearly`})]}),e.startOfMonth&&(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ar,{size:9,className:`inline mr-1`}),`billing started `,new Date(e.startOfMonth).toLocaleDateString()]}),n.length>0&&(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(`div`,{className:`text-[10px] font-medium`,style:{color:`var(--c-text2)`},children:`model usage`}),n.map(e=>{let n=t[e];return n.maxRequestUsage&&Math.round(n.numRequests/n.maxRequestUsage*100),(0,F.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,F.jsx)(`span`,{className:`font-mono`,style:{color:`var(--c-white)`},children:e}),(0,F.jsxs)(`span`,{style:{color:`var(--c-text2)`},children:[n.numRequests,n.maxRequestUsage?` / ${n.maxRequestUsage}`:``,` requests`]})]},e)})]})]})}function cD({data:e}){let t=e.usage||{},n=e.billingCycle||{};return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(aD,{name:e.plan?.name}),e.user?.name&&(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:e.user.name})]}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[t.promptCredits&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex justify-between text-[10px] mb-0.5`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`prompt credits`}),(0,F.jsxs)(`span`,{className:`font-mono`,style:{color:`var(--c-white)`},children:[t.promptCredits.remaining,` / `,t.promptCredits.allocated]})]}),(0,F.jsx)(rD,{value:t.promptCredits.allocated>0?t.promptCredits.remaining/t.promptCredits.allocated*100:0,color:`#06b6d4`})]}),t.flexCredits&&t.flexCredits.allocated>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex justify-between text-[10px] mb-0.5`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:`flex credits`}),(0,F.jsxs)(`span`,{className:`font-mono`,style:{color:`var(--c-white)`},children:[t.flexCredits.remaining,` / `,t.flexCredits.allocated]})]}),(0,F.jsx)(rD,{value:t.flexCredits.allocated>0?t.flexCredits.remaining/t.flexCredits.allocated*100:0,color:`#a78bfa`})]}),t.totalRemainingCredits!=null&&(0,F.jsxs)(`div`,{className:`flex items-center justify-between pt-1`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`span`,{className:`text-[10px] font-medium`,style:{color:`var(--c-text2)`},children:`total remaining`}),(0,F.jsx)(`span`,{className:`text-[13px] font-bold font-mono`,style:{color:`var(--c-white)`},children:t.totalRemainingCredits})]})]}),(n.start||n.end)&&(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ar,{size:9,className:`inline mr-1`}),n.start&&new Date(n.start).toLocaleDateString(),` → `,n.end&&new Date(n.end).toLocaleDateString()]}),e.features&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.entries(e.features).map(([e,t])=>(0,F.jsx)(oD,{label:e.replace(/([A-Z])/g,` $1`).trim(),enabled:t},e))})]})}function lD({data:e}){let t=e.usage||{};return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsx)(aD,{name:e.plan?.name}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[t.fiveHour&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(rD,{value:t.fiveHour.utilization,color:t.fiveHour.utilization>80?`#ef4444`:`#f97316`,label:`5-hour limit`}),(0,F.jsx)(iD,{date:t.fiveHour.resetsAt})]}),t.sevenDay&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(rD,{value:t.sevenDay.utilization,color:t.sevenDay.utilization>80?`#ef4444`:`#f97316`,label:`7-day limit`}),(0,F.jsx)(iD,{date:t.sevenDay.resetsAt})]}),t.sevenDaySonnet&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(rD,{value:t.sevenDaySonnet.utilization,color:`#a78bfa`,label:`7-day Sonnet`}),(0,F.jsx)(iD,{date:t.sevenDaySonnet.resetsAt})]}),t.sevenDayOpus&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(rD,{value:t.sevenDayOpus.utilization,color:`#c084fc`,label:`7-day Opus`}),(0,F.jsx)(iD,{date:t.sevenDayOpus.resetsAt})]})]}),e.extraUsage&&(0,F.jsxs)(`div`,{className:`text-[10px] flex items-center gap-1.5`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ai,{size:9}),`extra usage: `,e.extraUsage.isEnabled?(0,F.jsxs)(`span`,{style:{color:`#22c55e`},children:[`enabled`,e.extraUsage.utilization==null?``:` (${e.extraUsage.utilization}% used)`]}):(0,F.jsx)(`span`,{children:`disabled`})]})]})}function uD({data:e}){return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(aD,{name:e.plan?.name}),e.plan?.individual&&(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:`individual`})]}),e.user?.login&&(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[`@`,e.user.login]}),e.features&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.entries(e.features).map(([e,t])=>(0,F.jsx)(oD,{label:e.replace(/([A-Z])/g,` $1`).trim(),enabled:t},e))}),e.limits?.quotas&&(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text2)`},children:[(0,F.jsx)(_i,{size:9,className:`inline mr-1`}),`quotas: `,JSON.stringify(e.limits.quotas),e.limits.resetDate&&(0,F.jsxs)(`span`,{children:[` (resets `,new Date(e.limits.resetDate).toLocaleDateString(),`)`]})]})]})}function dD({data:e}){let t=e.plan||{};return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(aD,{name:t.name}),e.authMode&&(0,F.jsxs)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[`via `,e.authMode]})]}),e.user?.email&&(0,F.jsx)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:e.user.email}),(t.subscriptionStart||t.subscriptionEnd)&&(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Ar,{size:9,className:`inline mr-1`}),t.subscriptionStart&&new Date(t.subscriptionStart).toLocaleDateString(),` → `,t.subscriptionEnd&&new Date(t.subscriptionEnd).toLocaleDateString()]})]})}function fD({data:e}){return(0,F.jsxs)(`div`,{className:`space-y-2`,children:[e.plan?.name&&(0,F.jsx)(aD,{name:e.plan.name}),e.user&&(0,F.jsx)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:e.user.email||e.user.login||e.user.name||e.user.id||``}),(0,F.jsx)(`pre`,{className:`text-[10px] overflow-auto p-2`,style:{background:`var(--c-bg3)`,color:`var(--c-text2)`,maxHeight:120},children:JSON.stringify(e,null,2)})]})}function pD({data:e}){let[t,n]=(0,S.useState)(!1),r=e.source,i=Oh(r),a=q(r),o=()=>{switch(r){case`cursor`:return(0,F.jsx)(sD,{data:e});case`devin`:case`devin-next`:case`antigravity`:return(0,F.jsx)(cD,{data:e});case`claude-code`:return(0,F.jsx)(lD,{data:e});case`vscode`:case`vscode-insiders`:return(0,F.jsx)(uD,{data:e});case`copilot-cli`:return(0,F.jsx)(uD,{data:e});case`codex`:return(0,F.jsx)(dD,{data:e});default:return(0,F.jsx)(fD,{data:e})}},s=e.models||[];return(0,F.jsxs)(`div`,{className:`card p-4 space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(Gh,{source:r,size:20}),(0,F.jsx)(`span`,{className:`text-[13px] font-bold`,style:{color:`var(--c-white)`},children:a})]}),(0,F.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:i}})]}),o(),s.length>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`button`,{onClick:()=>n(!t),className:`flex items-center gap-1 text-[10px] transition hover:opacity-80`,style:{color:`var(--c-text2)`},children:[t?(0,F.jsx)(Tr,{size:10}):(0,F.jsx)(Cr,{size:10}),s.length,` models`]}),t&&(0,F.jsx)(`div`,{className:`mt-2 space-y-1`,children:s.map((e,t)=>(0,F.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] py-0.5`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(`span`,{style:{color:`var(--c-white)`},children:e.label||e.model}),e.remainingFraction!=null&&(0,F.jsxs)(`span`,{className:`font-mono`,style:{color:e.remainingFraction>.5?`#22c55e`:e.remainingFraction>.2?`#eab308`:`#ef4444`},children:[(e.remainingFraction*100).toFixed(0),`%`]})]},t))})]})]})}function mD(){let[e,t]=(0,S.useState)(null),[n,r]=(0,S.useState)(!0),[i,a]=(0,S.useState)(null),o=()=>{r(!0),a(null),ra().then(e=>{t(e),r(!1)}).catch(e=>{a(e.message),r(!1)})};return(0,S.useEffect)(()=>{o()},[]),(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsxs)($T,{icon:Pr,title:`Subscriptions`,children:[(0,F.jsxs)(`button`,{onClick:o,disabled:n,className:`flex items-center gap-1 px-2 py-0.5 text-[11px] transition hover:bg-[var(--c-card)]`,style:{color:`var(--c-text2)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(li,{size:10,className:n?`animate-spin`:``}),`Refresh`]}),e&&(0,F.jsxs)(`span`,{className:`text-[11px] ml-auto`,style:{color:`var(--c-text3)`},children:[e.length,` subscription`,e.length===1?``:`s`,` detected`]})]}),n&&!e&&(0,F.jsx)(wa,{label:`Loading subscriptions...`}),i&&(0,F.jsx)(`div`,{className:`text-[12px] px-3 py-2`,style:{background:`rgba(239,68,68,0.08)`,border:`1px solid rgba(239,68,68,0.15)`,color:`#ef4444`},children:i}),e&&e.length===0&&(0,F.jsx)(`div`,{className:`text-sm py-12 text-center`,style:{color:`var(--c-text3)`},children:`No subscriptions detected. Make sure your editors are installed and logged in.`}),e&&e.length>0&&(0,F.jsx)(`div`,{className:`grid gap-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(340px, 1fr))`},children:e.map((e,t)=>(0,F.jsx)(pD,{data:e},e.source+`-`+t))})]})}Lf.register(qf,wm,im,km,Nm,vp);var hD=`JetBrains Mono, monospace`,gD=[`#6366f1`,`#22c55e`,`#f59e0b`,`#ec4899`,`#3b82f6`,`#a855f7`,`#14b8a6`,`#f43f5e`,`#84cc16`,`#06b6d4`,`#e879f9`,`#fb923c`];function _D({server:e,matchedTools:t}){let[n,r]=(0,S.useState)(!1),i=t||[],a=i.reduce((e,t)=>e+t.count,0),o=e.tools||[],s=o.length>0||i.length>0;return(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`button`,{onClick:()=>s&&r(!n),className:`w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-[var(--c-bg3)] transition`,children:[(0,F.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6`,style:{background:`${Oh(e.editor)}15`},children:(0,F.jsx)(fi,{size:11,style:{color:Oh(e.editor)}})}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`text-[12px] font-semibold truncate`,style:{color:`var(--c-white)`},children:e.name}),(0,F.jsx)(`span`,{className:`text-[10px] px-1 py-px`,style:{background:e.scope===`global`?`rgba(99,102,241,0.12)`:`rgba(34,197,94,0.12)`,color:e.scope===`global`?`#818cf8`:`#22c55e`},children:e.scope}),(0,F.jsx)(`span`,{className:`text-[10px] px-1 py-px`,style:{background:e.transport===`stdio`?`rgba(234,179,8,0.12)`:`rgba(59,130,246,0.12)`,color:e.transport===`stdio`?`#eab308`:`#3b82f6`},children:e.transport}),e.disabled&&(0,F.jsx)(`span`,{className:`text-[10px] px-1 py-px`,style:{background:`rgba(239,68,68,0.12)`,color:`#ef4444`},children:`disabled`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mt-px`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Gh,{source:e.editor,size:10}),e.editorLabel]}),e.command&&(0,F.jsxs)(`span`,{className:`text-[10px] truncate`,style:{color:`var(--c-text3)`,fontFamily:hD},children:[e.command,` `,(e.args||[]).slice(0,2).join(` `)]}),e.url&&(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] truncate`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Kr,{size:9}),e.url]})]})]}),(0,F.jsxs)(`div`,{className:`text-right shrink-0`,children:[a>0&&(0,F.jsx)(`div`,{className:`text-[12px] font-semibold`,style:{color:`var(--c-white)`},children:J(a)}),(0,F.jsxs)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[o.length>0?`${o.length} tools`:`offline`,i.length>0?` · ${i.length} matched`:``]})]}),s?n?(0,F.jsx)(Cr,{size:12,style:{color:`var(--c-text3)`}}):(0,F.jsx)(wr,{size:12,style:{color:`var(--c-text3)`}}):(0,F.jsx)(`div`,{className:`w-3`})]}),n&&s&&(0,F.jsxs)(`div`,{className:`px-3 pb-2 pt-1`,style:{borderTop:`1px solid var(--c-border)`},children:[o.length>0&&(0,F.jsxs)(`div`,{className:`mb-1.5`,children:[(0,F.jsxs)(`div`,{className:`text-[10px] font-medium mb-0.5`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(Oi,{size:9,className:`inline mr-0.5`}),`Available (`,o.length,`)`]}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-0.5`,children:o.map(e=>(0,F.jsx)(`span`,{className:`text-[10px] px-1 py-px`,style:{background:`var(--c-bg3)`,color:`var(--c-text3)`,fontFamily:hD},children:e},e))})]}),i.length>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`text-[10px] font-medium mb-0.5`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(qr,{size:9,className:`inline mr-0.5`}),`Matched Calls`]}),(0,F.jsx)(`div`,{className:`space-y-0.5`,children:i.map(e=>(0,F.jsxs)(`div`,{className:`flex items-center justify-between py-0.5 px-1.5`,style:{background:`var(--c-bg3)`},children:[(0,F.jsx)(`span`,{className:`text-[10px] truncate`,style:{fontFamily:hD,color:`var(--c-text)`},children:e.name}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0 ml-2`,children:[(0,F.jsxs)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:[e.sessionCount,`s`]}),(0,F.jsx)(`span`,{className:`text-[11px] font-semibold`,style:{color:`var(--c-white)`},children:J(e.count)})]})]},e.name))})]})]})]})}function vD(){let e=dt(),[t,n]=(0,S.useState)(null),[r,i]=(0,S.useState)(!0),[a,o]=(0,S.useState)(``),[s,c]=(0,S.useState)(`servers`),[l,u]=(0,S.useState)(``),[d,f]=(0,S.useState)(``),{dark:p}=tr(),m=p?`#a0a0a0`:`#444`,h=p?`#555`:`#999`,g=p?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`,_=p?`#9ca3af`:`#555`;(0,S.useEffect)(()=>{oa().then(e=>{n(e),i(!1)}).catch(()=>i(!1))},[]);let v=(0,S.useMemo)(()=>{if(!t)return[];let e=a.toLowerCase();return t.servers.filter(t=>!e||t.name.toLowerCase().includes(e)||t.editor.toLowerCase().includes(e)||(t.command||``).toLowerCase().includes(e))},[t,a]),y=(0,S.useMemo)(()=>{if(!t)return{};let e={};for(let[n,r]of Object.entries(t.matchedTools||{}))for(let t of r)e[t.name]=n;return e},[t]),b=(0,S.useMemo)(()=>{if(!t)return{projects:[],servers:[]};let e=new Set,n=new Set;for(let r of t.toolCalls){for(let t of r.folders||[])e.add(t);let t=y[r.name];t?n.add(t):n.add(`__builtin__`)}return{projects:[...e].sort((e,t)=>e.split(`/`).pop().localeCompare(t.split(`/`).pop())),servers:[...n].filter(e=>e!==`__builtin__`).sort(),hasBuiltIn:n.has(`__builtin__`)}},[t,y]),x=(0,S.useMemo)(()=>{if(!t)return[];let e=a.toLowerCase();return t.toolCalls.filter(t=>!(e&&!t.name.toLowerCase().includes(e)||l&&!(t.folders||[]).includes(l)||d===`__builtin__`&&y[t.name]||d&&d!==`__builtin__`&&y[t.name]!==d))},[t,a,l,d,y]),C=(0,S.useMemo)(()=>{if(!t)return[];let e=a.toLowerCase();return t.topSessions.filter(t=>!e||(t.name||``).toLowerCase().includes(e)||t.source.toLowerCase().includes(e)||(t.folder||``).toLowerCase().includes(e))},[t,a]),w=(0,S.useMemo)(()=>{let e={};for(let t of v)e[t.editor]||(e[t.editor]=[]),e[t.editor].push(t);return e},[v]),T=(0,S.useMemo)(()=>{if(!t)return null;let e={};for(let n of t.servers){let r=(t.matchedTools[n.name]||[]).reduce((e,t)=>e+t.count,0);r!==0&&(e[n.name]||(e[n.name]={}),e[n.name][n.editor]=(e[n.name][n.editor]||0)+r)}let n=Object.entries(e).map(([e,t])=>({name:e,byEditor:t,total:Object.values(t).reduce((e,t)=>e+t,0)})).sort((e,t)=>t.total-e.total).slice(0,10);if(n.length===0)return null;let r=[...new Set(n.flatMap(e=>Object.keys(e.byEditor)))];return{labels:n.map(e=>e.name),datasets:r.map(e=>({label:q(e),data:n.map(t=>t.byEditor[e]||0),backgroundColor:Oh(e)+`CC`,borderRadius:2}))}},[t]),E=(0,S.useMemo)(()=>t?t.servers.filter(e=>(t.matchedTools[e.name]||[]).length===0):[],[t]),D=(0,S.useMemo)(()=>{if(!t)return[];let e=[];for(let[n,r]of Object.entries(t.matchedTools))for(let t of r)e.push({...t,server:n});return e.sort((e,t)=>t.count-e.count).slice(0,12)},[t]),O=(0,S.useMemo)(()=>{if(!t)return[];let e=new Set;for(let n of Object.values(t.matchedTools))for(let t of n)e.add(t.name);let n=[];for(let r of t.servers){let t=r.tools||[];if(t.length!==0)for(let i of t)e.has(i)||n.push({name:i,server:r.name,editor:r.editor})}return n},[t]),k=(0,S.useMemo)(()=>{if(!t)return null;let e={};for(let n of t.servers){let t=q(n.editor);e[t]=(e[t]||0)+1}let n=Object.entries(e).sort((e,t)=>t[1]-e[1]);return n.length===0?null:{labels:n.map(e=>e[0]),colors:n.map(e=>{let n=t.servers.find(t=>q(t.editor)===e[0]);return n?Oh(n.editor):`#666`}),values:n.map(e=>e[1])}},[t]),A=(0,S.useMemo)(()=>{if(!t)return null;let e={};for(let n of t.servers)e[n.transport]=(e[n.transport]||0)+1;let n=Object.entries(e).sort((e,t)=>t[1]-e[1]);if(n.length===0)return null;let r={stdio:`#eab308`,http:`#3b82f6`,sse:`#a855f7`};return{labels:n.map(e=>e[0]),colors:n.map(e=>r[e[0]]||`#666`),values:n.map(e=>e[1])}},[t]);if(r)return(0,F.jsx)(wa,{label:`Loading MCP data...`});if(!t)return(0,F.jsx)(`div`,{className:`text-center py-20 text-[13px]`,style:{color:`var(--c-text3)`},children:`Failed to load MCP data`});let{summary:j,matchedTools:ee}=t,te=[{id:`servers`,label:`Servers`,count:t.servers.length},{id:`tools`,label:`Tools`,count:t.toolCalls.length},{id:`sessions`,label:`Sessions`,count:t.topSessions.length}];return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:oi,title:`MCPs`}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`servers`,value:j.totalServers,sub:`${j.editorsWithServers.length} editors`}),(0,F.jsx)(K,{label:`unique tools`,value:J(j.uniqueTools)}),(0,F.jsx)(K,{label:`tool calls`,value:J(j.totalToolCalls)}),(0,F.jsx)(K,{label:`sessions`,value:J(j.sessionsWithTools)}),(0,F.jsx)(K,{label:`matched`,value:Object.values(ee).reduce((e,t)=>e+t.length,0),sub:`${Object.keys(ee).length} servers`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`most used servers `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`(by editor)`})]}),T?(0,F.jsx)(`div`,{style:{height:Math.max(T.labels.length*22+10,80)},children:(0,F.jsx)(wh,{data:T,options:{indexAxis:`y`,responsive:!0,maintainAspectRatio:!1,scales:{x:{stacked:!0,grid:{color:g},ticks:{color:h,font:{size:9,family:hD}}},y:{stacked:!0,grid:{display:!1},ticks:{color:m,font:{size:9,family:hD}}}},plugins:{legend:{position:`top`,labels:{color:_,font:{size:9,family:hD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{mode:`index`,bodyFont:{family:hD,size:10},titleFont:{family:hD,size:10}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-6`,style:{color:`var(--c-text3)`},children:`No MCP server usage`})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`most used tools`}),D.length>0?(0,F.jsx)(`div`,{style:{height:Math.max(D.length*22+10,80)},children:(0,F.jsx)(wh,{data:{labels:D.map(e=>e.name),datasets:[{data:D.map(e=>e.count),backgroundColor:gD.slice(0,D.length),borderRadius:2}]},options:{indexAxis:`y`,responsive:!0,maintainAspectRatio:!1,scales:{x:{grid:{color:g},ticks:{color:h,font:{size:9,family:hD}}},y:{grid:{display:!1},ticks:{color:m,font:{size:9,family:hD}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:hD,size:10},titleFont:{family:hD,size:10},callbacks:{afterLabel:e=>`Server: ${D[e.dataIndex]?.server||`?`}`}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-6`,style:{color:`var(--c-text3)`},children:`No MCP tool usage`})]}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`servers by editor`}),k?(0,F.jsx)(`div`,{style:{height:110},children:(0,F.jsx)(Th,{data:{labels:k.labels,datasets:[{data:k.values,backgroundColor:k.colors,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`55%`,plugins:{legend:{position:`right`,labels:{color:_,font:{size:9,family:hD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:hD,size:10},titleFont:{family:hD,size:10}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-4`,style:{color:`var(--c-text3)`},children:`no data`})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`servers by transport`}),A?(0,F.jsx)(`div`,{style:{height:90},children:(0,F.jsx)(Th,{data:{labels:A.labels,datasets:[{data:A.values,backgroundColor:A.colors,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`55%`,plugins:{legend:{position:`right`,labels:{color:_,font:{size:9,family:hD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:hD,size:10},titleFont:{family:hD,size:10}}}}})}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-4`,style:{color:`var(--c-text3)`},children:`no data`})]})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-2`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`never used servers `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,E.length,`)`]})]}),E.length>0?(0,F.jsx)(`div`,{className:`space-y-0.5 max-h-[160px] overflow-y-auto scrollbar-thin`,children:E.map((e,t)=>(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 py-0.5 px-1.5`,style:{background:`var(--c-bg3)`},children:[(0,F.jsx)(pr,{size:9,style:{color:`#ef4444`,opacity:.5}}),(0,F.jsx)(`span`,{className:`text-[10px] font-medium truncate`,style:{color:`var(--c-text)`},children:e.name}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1 ml-auto shrink-0`,children:[(0,F.jsx)(Gh,{source:e.editor,size:10}),(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:e.editorLabel})]}),e.disabled&&(0,F.jsx)(`span`,{className:`text-[9px] px-0.5`,style:{background:`rgba(239,68,68,0.12)`,color:`#ef4444`},children:`off`})]},`${e.name}-${e.editor}-${t}`))}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-4`,style:{color:`var(--c-text3)`},children:`All servers have been used`})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)($,{children:[`never used tools `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,O.length,`)`]})]}),O.length>0?(0,F.jsx)(`div`,{className:`space-y-0.5 max-h-[160px] overflow-y-auto scrollbar-thin`,children:O.map((e,t)=>(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 py-0.5 px-1.5`,style:{background:`var(--c-bg3)`},children:[(0,F.jsx)(pr,{size:9,style:{color:`#f59e0b`,opacity:.5}}),(0,F.jsx)(`span`,{className:`text-[10px] truncate`,style:{fontFamily:hD,color:`var(--c-text)`},children:e.name}),(0,F.jsx)(`span`,{className:`ml-auto shrink-0 text-[10px] px-1 py-px`,style:{background:`rgba(99,102,241,0.12)`,color:`#818cf8`},children:e.server})]},`${e.name}-${e.server}-${t}`))}):(0,F.jsx)(`div`,{className:`text-[11px] text-center py-4`,style:{color:`var(--c-text3)`},children:`All queried tools have been used`})]})]}),t.projectMcps&&t.projectMcps.length>0&&(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsx)(`div`,{className:`px-3 py-2`,style:{borderBottom:`1px solid var(--c-border)`},children:(0,F.jsxs)($,{children:[`MCP servers by project `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`(`,t.projectMcps.length,`)`]})]})}),(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`project`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`config`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`servers`}),(0,F.jsx)(`th`,{className:`text-right px-3 py-2 font-medium`,children:`mcp calls`})]})}),(0,F.jsx)(`tbody`,{children:t.projectMcps.map(t=>t.configs.map((n,r)=>(0,F.jsxs)(`tr`,{className:`transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,children:[r===0?(0,F.jsx)(`td`,{className:`px-3 py-2`,rowSpan:t.configs.length,children:(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5 cursor-pointer hover:underline`,style:{color:`var(--c-accent)`},onClick:()=>e(`/projects/detail?folder=${encodeURIComponent(t.folder)}`),children:[(0,F.jsx)(Ur,{size:11}),(0,F.jsx)(`span`,{className:`font-medium truncate max-w-[200px]`,children:t.name})]})}):null,(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(Gh,{source:n.editor,size:12}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:n.file})]})}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.serverNames.map(e=>(0,F.jsxs)(`span`,{className:`text-[11px] px-1.5 py-px`,style:{background:ee[e]?`rgba(99,102,241,0.12)`:`var(--c-bg3)`,color:ee[e]?`#818cf8`:`var(--c-text2)`},children:[(0,F.jsx)(oi,{size:8,className:`inline mr-0.5`}),e,ee[e]&&(0,F.jsx)(`span`,{className:`ml-1 opacity-60`,children:ee[e].reduce((e,t)=>e+t.count,0)})]},e))})}),r===0?(0,F.jsx)(`td`,{className:`px-3 py-2 text-right`,rowSpan:t.configs.length,children:t.mcpToolCalls>0?(0,F.jsx)(`span`,{className:`font-semibold`,style:{color:`var(--c-white)`},children:J(t.mcpToolCalls)}):(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`—`})}):null]},`${t.folder}-${n.file}`)))})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(`div`,{className:`flex gap-0.5`,children:te.map(e=>(0,F.jsxs)(`button`,{onClick:()=>c(e.id),className:`px-2.5 py-1 text-[12px] transition`,style:{background:s===e.id?`var(--c-card)`:`transparent`,color:s===e.id?`var(--c-white)`:`var(--c-text3)`,border:s===e.id?`1px solid var(--c-border)`:`1px solid transparent`},children:[e.label,` `,(0,F.jsx)(`span`,{className:`opacity-40 ml-0.5`,children:e.count})]},e.id))}),(0,F.jsx)(`div`,{className:`flex-1`}),s===`tools`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,color:`var(--c-text)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Projects`}),b.projects.map(e=>(0,F.jsx)(`option`,{value:e,children:e.split(`/`).pop()},e))]}),(0,F.jsxs)(`select`,{value:d,onChange:e=>f(e.target.value),className:`px-2 py-1 text-[12px] outline-none`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,color:`var(--c-text)`},children:[(0,F.jsx)(`option`,{value:``,children:`All Servers`}),b.hasBuiltIn&&(0,F.jsx)(`option`,{value:`__builtin__`,children:`built-in`}),b.servers.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]})]}),(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(ui,{size:12,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`Search...`,className:`pl-7 pr-3 py-1 text-[12px] outline-none w-[180px]`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,color:`var(--c-text)`}})]})]}),s===`servers`&&(0,F.jsx)(`div`,{children:v.length===0?(0,F.jsxs)(`div`,{className:`text-center py-12 text-[12px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(fi,{size:24,className:`mx-auto mb-2 opacity-30`}),(0,F.jsx)(`div`,{children:`No MCP servers detected`}),(0,F.jsx)(`div`,{className:`text-[10px] mt-0.5 opacity-60`,children:`Configure MCP servers in your editors`})]}):Object.entries(w).map(([e,t])=>(0,F.jsxs)(`div`,{className:`mb-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1`,children:[(0,F.jsx)(Gh,{source:e,size:13}),(0,F.jsx)(`span`,{className:`text-[12px] font-semibold`,style:{color:`var(--c-white)`},children:q(e)}),(0,F.jsxs)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:[`(`,t.length,`)`]})]}),(0,F.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,F.jsx)(_D,{server:e,matchedTools:ee[e.name]},`${e.name}-${e.editor}-${e.scope}`))})]},e))}),s===`tools`&&(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`tool`}),(0,F.jsx)(`th`,{className:`text-right px-3 py-2 font-medium`,children:`calls`}),(0,F.jsx)(`th`,{className:`text-right px-3 py-2 font-medium`,children:`sessions`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`editors`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`server`})]})}),(0,F.jsx)(`tbody`,{children:x.slice(0,100).map((e,t)=>{let n=y[e.name];return(0,F.jsxs)(`tr`,{className:`transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,children:[(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsx)(`span`,{style:{fontFamily:hD,color:`var(--c-white)`},children:e.name})}),(0,F.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,F.jsx)(`span`,{className:`font-semibold`,style:{color:`var(--c-white)`},children:J(e.count)})}),(0,F.jsx)(`td`,{className:`px-3 py-2 text-right`,style:{color:`var(--c-text2)`},children:e.sessionCount}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsx)(`div`,{className:`flex items-center gap-1`,children:e.editors.map(e=>(0,F.jsx)(`span`,{className:`inline-flex items-center gap-0.5`,children:(0,F.jsx)(Gh,{source:e,size:12})},e))})}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:n?(0,F.jsxs)(`span`,{className:`text-[11px] px-1.5 py-px`,style:{background:`rgba(99,102,241,0.12)`,color:`#818cf8`},children:[(0,F.jsx)(oi,{size:9,className:`inline mr-0.5`}),n]}):(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text2)`},children:`built-in`})})]},e.name)})})]}),x.length>100&&(0,F.jsxs)(`div`,{className:`px-3 py-1 text-[10px] text-center`,style:{color:`var(--c-text3)`,background:`var(--c-card)`},children:[`Showing 100 of `,x.length]})]}),s===`sessions`&&(0,F.jsxs)(`div`,{className:`card overflow-hidden`,children:[(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider`,style:{borderBottom:`1px solid var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`session`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`editor`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`project`}),(0,F.jsx)(`th`,{className:`text-right px-3 py-2 font-medium`,children:`calls`}),(0,F.jsx)(`th`,{className:`text-left px-3 py-2 font-medium`,children:`top tools`})]})}),(0,F.jsx)(`tbody`,{children:C.map((t,n)=>{let r=Object.entries(t.tools).sort((e,t)=>t[1]-e[1]).slice(0,3);return(0,F.jsxs)(`tr`,{className:`transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,children:[(0,F.jsx)(`td`,{className:`px-3 py-2 max-w-[220px] font-medium`,children:(0,F.jsx)(`span`,{className:`truncate block`,style:{color:`var(--c-white)`},children:t.name||(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`,fontStyle:`italic`},children:`Untitled`})})}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(Gh,{source:t.source,size:12}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:q(t.source)})]})}),(0,F.jsx)(`td`,{className:`px-3 py-2 truncate max-w-[160px]`,title:t.folder,children:t.folder?(0,F.jsx)(`span`,{className:`cursor-pointer hover:underline`,style:{color:`var(--c-accent)`},onClick:n=>{n.stopPropagation(),e(`/projects/detail?folder=${encodeURIComponent(t.folder)}`)},children:t.folder.split(/[/\\]/).pop()}):(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`—`})}),(0,F.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,F.jsx)(`span`,{className:`font-semibold`,style:{color:`var(--c-white)`},children:J(t.totalToolCalls)})}),(0,F.jsx)(`td`,{className:`px-3 py-2`,children:(0,F.jsx)(`div`,{className:`flex gap-0.5 flex-wrap`,children:r.map(([e,t])=>(0,F.jsxs)(`span`,{className:`text-[10px] px-1 py-px`,style:{background:`var(--c-bg3)`,color:`var(--c-text2)`,fontFamily:hD},children:[e,` `,(0,F.jsxs)(`span`,{style:{opacity:.5},children:[`×`,t]})]},e))})})]},t.composerId)})})]}),t.topSessions.length===0&&(0,F.jsx)(`div`,{className:`text-center py-8 text-[11px]`,style:{color:`var(--c-text3)`},children:`No sessions with tool calls`})]})]})}function yD({source:e,showLabel:t=!1,size:n=8}){return(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Gh,{source:e,size:n}),t&&(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text)`},children:q(e)})]})}function bD(e){return e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``}function xD({onSessionClick:e}){let[t,n]=(0,S.useState)([]),r=(0,S.useRef)(null);(0,S.useEffect)(()=>{let e=()=>{va({limit:80}).then(e=>{Array.isArray(e)&&n(e)}).catch(()=>{})};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[]);let i=Date.now(),a=[],o=null;for(let e of t){let t=i-e.lastUpdatedAt,n;n=t<3e5?`Just now`:t<36e5?`${Math.floor(t/6e4)} min ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:new Date(e.lastUpdatedAt).toLocaleDateString(),(!o||o.label!==n)&&(o={label:n,items:[]},a.push(o)),o.items.push(e)}return(0,F.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2.5 shrink-0`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(ci,{size:12,style:{color:`#22c55e`}}),(0,F.jsx)(`span`,{className:`text-[12px] font-medium uppercase tracking-wider`,style:{color:`var(--c-text2)`},children:`Live Feed`}),(0,F.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full pulse-dot ml-auto`,style:{background:`#22c55e`}})]}),(0,F.jsxs)(`div`,{ref:r,className:`flex-1 overflow-y-auto scrollbar-thin`,children:[t.length===0&&(0,F.jsx)(`div`,{className:`text-[12px] py-8 text-center`,style:{color:`var(--c-text3)`},children:`No recent activity`}),a.map((t,n)=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`sticky top-0 px-3 py-1.5 text-[10px] font-medium uppercase tracking-wider`,style:{background:`var(--c-bg)`,color:`var(--c-text3)`,borderBottom:`1px solid var(--c-border)`},children:t.label}),t.items.map(t=>(0,F.jsxs)(`div`,{className:`px-3 py-2.5 cursor-pointer transition hover:bg-[var(--c-card)]`,style:{borderBottom:`1px solid var(--c-border)`},onClick:()=>e&&e(t.id,t.username),children:[(0,F.jsx)(`div`,{className:`text-[12px] font-medium truncate mb-1`,style:{color:`var(--c-white)`},children:t.name||`Untitled`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1`,children:[(0,F.jsx)(`span`,{className:`text-[10px] font-medium px-1 py-0.5 shrink-0 truncate max-w-[120px]`,style:{background:`rgba(99,102,241,0.12)`,color:`#818cf8`},title:t.username,children:t.username}),(0,F.jsx)(yD,{source:t.source,size:6}),(0,F.jsx)(`span`,{className:`text-[10px] truncate`,style:{color:`var(--c-text2)`},children:q(t.source)}),(0,F.jsx)(`span`,{className:`text-[10px] ml-auto shrink-0`,style:{color:`var(--c-text3)`},children:bD(t.lastUpdatedAt)})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px]`,style:{color:`var(--c-text3)`},children:[t.totalMessages>0&&(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,F.jsx)(ni,{size:8}),` `,t.totalMessages]}),t.folder&&(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5 truncate`,children:[(0,F.jsx)(Ur,{size:8}),` `,t.folder.split(`/`).pop()]}),t.mode&&(0,F.jsx)(`span`,{className:`px-1 py-0`,style:{background:`rgba(168,85,247,0.1)`,color:`#a855f7`},children:t.mode}),t.models?.[0]&&(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5 ml-auto truncate`,style:{color:`#818cf8`},children:[(0,F.jsx)(Nr,{size:8}),` `,t.models[0]]})]})]},`${t.id}-${t.username}`))]},n))]})]})}Lf.register(qf,wm,im,km,Nm,vp);var SD=`JetBrains Mono, monospace`,CD=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`],wD=[`#6366f1`,`#8b5cf6`,`#a855f7`,`#c084fc`,`#d8b4fe`,`#e879f9`,`#f472b6`,`#fb7185`];function TD({segments:e,height:t=6}){let n=e.reduce((e,t)=>e+t.value,0);return n===0?null:(0,F.jsx)(`div`,{className:`flex w-full rounded-full overflow-hidden`,style:{height:t},children:e.filter(e=>e.value>0).map((e,t)=>(0,F.jsx)(`div`,{title:`${e.label}: ${J(e.value)}`,className:`h-full transition-all`,style:{width:`${(e.value/n*100).toFixed(1)}%`,background:e.color}},t))})}function ED({userList:e,userColorMap:t,selectedUser:n}){let[r,i]=(0,S.useState)(new Set),a=dt(),{projectGroups:o,ungrouped:s}=(0,S.useMemo)(()=>{let t={},n=new Set;for(let r of e){let e=r.sharedProjects||[];if(e.length===0){n.add(r.username);continue}for(let i of e){let e=typeof i==`string`?i:i.name||i;t[e]||(t[e]=[]),t[e].push(r),n.add(r.username)}}let r=e.filter(e=>!(e.sharedProjects?.length>0));return{projectGroups:Object.entries(t).sort((e,t)=>t[1].length-e[1].length),ungrouped:r}},[e]),c=e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},l=({u:r})=>{e.indexOf(r);let i=t[r.username]||`#6366f1`,o=Object.entries(r.editors||{}).sort((e,t)=>t[1]-e[1]);return(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1.5 cursor-pointer transition rounded-sm`,style:{background:n===r.username?`rgba(99,102,241,0.12)`:`transparent`},onMouseEnter:e=>{n!==r.username&&(e.currentTarget.style.background=`var(--c-bg3)`)},onMouseLeave:e=>{n!==r.username&&(e.currentTarget.style.background=`transparent`)},onClick:()=>a(`/relay/user/${r.username}`),children:[(0,F.jsx)(`div`,{className:`w-5 h-5 flex items-center justify-center text-[8px] font-bold rounded-sm flex-shrink-0`,style:{background:`${i}20`,color:i},children:r.username.charAt(0).toUpperCase()}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium truncate`,style:{color:`var(--c-white)`},children:r.username}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[8px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsxs)(`span`,{children:[r.sessions,`s`]}),(0,F.jsx)(`span`,{children:`·`}),(0,F.jsxs)(`span`,{children:[J(r.totalMessages),`m`]})]}),o.length>0&&(0,F.jsx)(`div`,{className:`flex items-center gap-1 mt-0.5`,children:o.slice(0,4).map(([e])=>(0,F.jsx)(Gh,{source:e,size:9},e))})]})]})};return(0,F.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2.5 shrink-0`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(Di,{size:12,style:{color:`var(--c-accent)`}}),(0,F.jsx)(`span`,{className:`text-[12px] font-medium uppercase tracking-wider`,style:{color:`var(--c-text2)`},children:`Team`}),(0,F.jsx)(`span`,{className:`text-[10px] ml-auto`,style:{color:`var(--c-text3)`},children:e.length})]}),(0,F.jsxs)(`div`,{className:`flex-1 overflow-y-auto scrollbar-thin py-1`,children:[o.map(([e,t])=>{let n=r.has(e),i=e.split(`/`).pop();return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1.5 cursor-pointer transition`,onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>c(e),children:[n?(0,F.jsx)(wr,{size:10,style:{color:`var(--c-text3)`}}):(0,F.jsx)(Cr,{size:10,style:{color:`var(--c-text3)`}}),(0,F.jsx)(Ur,{size:10,style:{color:`#818cf8`}}),(0,F.jsx)(`span`,{className:`text-[11px] font-medium truncate flex-1`,style:{color:`var(--c-text2)`},title:e,children:i}),(0,F.jsx)(`span`,{className:`text-[8px]`,style:{color:`var(--c-text3)`},children:t.length})]}),!n&&(0,F.jsx)(`div`,{className:`pl-3`,children:t.map(t=>(0,F.jsx)(l,{u:t},`${e}-${t.username}`))})]},e)}),s.length>0&&(0,F.jsxs)(`div`,{children:[o.length>0&&(0,F.jsx)(`div`,{className:`px-2 py-1.5 text-[10px] uppercase tracking-wider`,style:{color:`var(--c-text3)`},children:`unassigned`}),(0,F.jsx)(`div`,{className:o.length>0?`pl-1`:``,children:s.map(e=>(0,F.jsx)(l,{u:e},e.username))})]}),e.length===0&&(0,F.jsx)(`div`,{className:`text-[11px] py-6 text-center`,style:{color:`var(--c-text3)`},children:`No team members yet`})]}),e.length>=2&&(0,F.jsx)(DD,{userList:e})]})}function DD({userList:e}){let[t,n]=(0,S.useState)(``),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(null),[l,u]=(0,S.useState)(!1);return(0,F.jsxs)(`div`,{className:`shrink-0 px-2 py-2`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 cursor-pointer text-[10px] uppercase tracking-wider`,style:{color:`var(--c-text3)`},onClick:()=>u(!l),children:[l?(0,F.jsx)(Cr,{size:9}):(0,F.jsx)(wr,{size:9}),(0,F.jsx)(ti,{size:9}),(0,F.jsx)(`span`,{children:`merge users`})]}),l&&(0,F.jsxs)(`div`,{className:`mt-2 space-y-1.5`,children:[(0,F.jsxs)(`select`,{value:t,onChange:e=>n(e.target.value),className:`w-full text-[11px] px-1.5 py-1 outline-none rounded-sm`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`from...`}),e.filter(e=>e.username!==r).map(e=>(0,F.jsx)(`option`,{value:e.username,children:e.username},e.username))]}),(0,F.jsxs)(`select`,{value:r,onChange:e=>i(e.target.value),className:`w-full text-[11px] px-1.5 py-1 outline-none rounded-sm`,style:{background:`var(--c-bg3)`,color:`var(--c-text)`,border:`1px solid var(--c-border)`},children:[(0,F.jsx)(`option`,{value:``,children:`into...`}),e.filter(e=>e.username!==t).map(e=>(0,F.jsx)(`option`,{value:e.username,children:e.username},e.username))]}),(0,F.jsx)(`button`,{disabled:!t||!r||a,onClick:async()=>{if(confirm(`Merge "${t}" → "${r}"? Cannot undo.`)){o(!0),c(null);try{c(await ya(t,r)),n(``),i(``)}catch(e){c({error:e.message})}o(!1)}},className:`w-full text-[11px] px-2 py-1 font-medium transition rounded-sm`,style:{background:t&&r?`rgba(239,68,68,0.15)`:`var(--c-bg3)`,color:t&&r?`#ef4444`:`var(--c-text3)`,border:`1px solid var(--c-border)`,cursor:!t||!r||a?`not-allowed`:`pointer`,opacity:!t||!r||a?.5:1},children:a?`Merging...`:`Merge`}),s&&(0,F.jsx)(`div`,{className:`text-[10px]`,style:{color:s.error?`#ef4444`:`#22c55e`},children:s.error?`Error: ${s.error}`:`Merged!`})]})]})}function OD(){let e=dt(),[t,n]=(0,S.useState)(null),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)(null),{dark:p}=tr(),m=p?`#888`:`#555`,h=p?`rgba(255,255,255,0.04)`:`rgba(0,0,0,0.06)`,g=p?`#555`:`#999`,_=p?`#888`:`#555`;(0,S.useEffect)(()=>{ha().then(n);let e=setInterval(()=>ha().then(n),15e3);return()=>clearInterval(e)},[]);let v=async e=>{if(e.preventDefault(),r.trim()){c(!0);try{o(await _a(r.trim(),{limit:30}))}catch{o([])}c(!1)}},y=t?.users||[],b=(0,S.useMemo)(()=>{let e={};return y.forEach((t,n)=>{e[t.username]=wD[n%wD.length]}),e},[y]);if(!t)return(0,F.jsx)(wa,{label:`Loading relay data...`});let x=t.editors||[],C=t.topModels||[],w=(t.totalInputTokens||0)+(t.totalOutputTokens||0),T=t.totalSessions>0?(t.totalMessages/t.totalSessions).toFixed(1):0,E=t.totalSessions>0?Math.round(w/t.totalSessions):0,D=y.length>0?Math.max(...y.map(e=>e.sessions)):1,O=(e,t)=>{u(e),f(t)},k=`calc(100vh - 42px)`;return(0,F.jsxs)(`div`,{className:`fade-in flex`,style:{height:k},children:[(0,F.jsx)(`div`,{className:`hidden lg:flex flex-col w-[250px] shrink-0 sticky top-[42px] self-start`,style:{height:k,borderRight:`1px solid var(--c-border)`,background:`var(--c-bg)`},children:(0,F.jsx)(ED,{userList:y,userColorMap:b,selectedUser:d,onUserClick:t=>e(`/relay/user/${t}`)})}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-y-auto p-4 space-y-3`,children:[(0,F.jsx)($T,{icon:Di,title:`Team Relay`}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`team members`,value:t.totalUsers}),(0,F.jsx)(K,{label:`sessions`,value:J(t.totalSessions),sub:`${T} msgs/session`}),(0,F.jsx)(K,{label:`active users`,value:t.activeUsers}),(0,F.jsx)(K,{label:`projects`,value:t.totalProjects}),(0,F.jsx)(K,{label:`messages`,value:J(t.totalMessages)}),(0,F.jsx)(K,{label:`tokens`,value:J(w),sub:`${J(E)}/session`})]}),w>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,F.jsx)($,{children:`team token usage`}),(0,F.jsxs)(`span`,{className:`text-[11px] font-bold`,style:{color:`var(--c-white)`},children:[J(w),` total`]})]}),(0,F.jsx)(TD,{height:10,segments:[{label:`Input`,value:t.totalInputTokens,color:`#6366f1`},{label:`Output`,value:t.totalOutputTokens,color:`#a78bfa`}]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4 mt-1.5 text-[10px]`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#6366f1`}}),` input `,J(t.totalInputTokens)]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#a78bfa`}}),` output `,J(t.totalOutputTokens)]})]}),y.length>1&&(0,F.jsxs)(`div`,{className:`mt-3 pt-2`,style:{borderTop:`1px solid var(--c-border)`},children:[(0,F.jsx)(`div`,{className:`text-[10px] mb-1.5`,style:{color:`var(--c-text3)`},children:`per-user contribution`}),(0,F.jsx)(TD,{height:8,segments:y.map(e=>({label:e.username,value:e.totalInputTokens+e.totalOutputTokens,color:b[e.username]}))}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-3 mt-1 text-[10px]`,children:y.map(e=>(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,style:{color:`var(--c-text3)`},children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:b[e.username]}}),e.username]},e.username))})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-3 gap-3`,children:[x.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`editors`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Th,{data:{labels:x.map(e=>q(e.source)),datasets:[{data:x.map(e=>e.count),backgroundColor:x.map(e=>Oh(e.source)),borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:m,font:{size:9,family:SD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:SD,size:10},titleFont:{family:SD,size:10}}}}})})]}),C.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`models`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Th,{data:{labels:C.slice(0,10).map(e=>e.name),datasets:[{data:C.slice(0,10).map(e=>e.count),backgroundColor:CD,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:m,font:{size:8,family:SD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:SD,size:10},titleFont:{family:SD,size:10}}}}})})]}),y.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`sessions per user`}),(0,F.jsx)(`div`,{style:{height:Math.max(120,y.length*28)},children:(0,F.jsx)(wh,{data:{labels:y.map(e=>e.username),datasets:[{data:y.map(e=>e.sessions),backgroundColor:y.map(e=>b[e.username]),borderRadius:2}]},options:{responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,plugins:{legend:{display:!1},tooltip:{bodyFont:{family:SD,size:10},titleFont:{family:SD,size:10}}},scales:{x:{grid:{color:h},ticks:{color:g,font:{size:8,family:SD}},beginAtZero:!0},y:{grid:{display:!1},ticks:{color:_,font:{size:9,family:SD}}}}}})})]})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`search across team`}),(0,F.jsxs)(`form`,{onSubmit:v,className:`flex gap-2 mt-1`,children:[(0,F.jsxs)(`div`,{className:`relative flex-1`,children:[(0,F.jsx)(ui,{size:11,className:`absolute left-2.5 top-1/2 -translate-y-1/2`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),placeholder:`Search messages, files, topics across all users...`,className:`w-full pl-7 pr-3 py-1.5 text-[12px] outline-none rounded-sm`,style:{background:`var(--c-bg3)`,color:`var(--c-white)`,border:`1px solid var(--c-border)`}})]}),(0,F.jsx)(`button`,{type:`submit`,disabled:s,className:`px-3 py-1.5 text-[11px] font-medium transition rounded-sm`,style:{background:`var(--c-card)`,border:`1px solid var(--c-border)`,color:`var(--c-white)`},children:s?`Searching...`:`Search`})]}),a&&(0,F.jsx)(`div`,{className:`mt-3 max-h-[300px] overflow-y-auto scrollbar-thin`,children:a.length===0?(0,F.jsx)(`div`,{className:`text-[12px] py-2`,style:{color:`var(--c-text3)`},children:`No results found`}):(0,F.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,F.jsx)(`tbody`,{children:a.map((e,t)=>(0,F.jsxs)(`tr`,{className:`cursor-pointer transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>{u(e.chatId),f(e.username)},children:[(0,F.jsx)(`td`,{className:`py-2 px-2 w-[80px]`,children:(0,F.jsx)(`span`,{className:`text-[10px] font-medium px-1.5 py-0.5`,style:{background:`rgba(99,102,241,0.15)`,color:`#818cf8`},children:e.username})}),(0,F.jsx)(`td`,{className:`py-2 px-2 w-[24px]`,children:(0,F.jsx)(Gh,{source:e.source,size:11})}),(0,F.jsxs)(`td`,{className:`py-2 px-2`,children:[(0,F.jsx)(`div`,{className:`text-[11px] truncate`,style:{color:`var(--c-text3)`},children:e.chatName}),(0,F.jsx)(`div`,{className:`text-[11px] line-clamp-1 mt-0.5`,style:{color:`var(--c-text)`},children:e.content})]}),(0,F.jsx)(`td`,{className:`py-2 px-2 text-[10px] whitespace-nowrap`,style:{color:`var(--c-text3)`},children:e.role})]},t))})})})]}),(0,F.jsx)($,{children:`team overview`}),(0,F.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3`,children:y.map(t=>{let n=t.totalInputTokens+t.totalOutputTokens,r=b[t.username],i=Object.entries(t.editors||{}).sort((e,t)=>t[1]-e[1]);return(0,F.jsxs)(`div`,{className:`card p-3 cursor-pointer transition hover:opacity-90`,onClick:()=>e(`/relay/user/${t.username}`),children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,F.jsx)(`div`,{className:`w-7 h-7 flex items-center justify-center text-[12px] font-bold rounded-sm flex-shrink-0`,style:{background:`${r}20`,color:r},children:t.username.charAt(0).toUpperCase()}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[12px] font-bold truncate`,style:{color:`var(--c-white)`},children:t.username}),(0,F.jsx)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:t.lastActive?Ah(t.lastActive):`No activity`})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-0.5 flex-shrink-0`,children:i.slice(0,3).map(([e])=>(0,F.jsx)(Gh,{source:e,size:11},e))})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-4 gap-1 text-center mb-2`,children:[[t.sessions,`sessions`],[J(t.totalMessages),`messages`],[t.projects,`projects`],[J(n),`tokens`]].map(([e,t])=>(0,F.jsxs)(`div`,{className:`p-1 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsx)(`div`,{className:`text-[11px] font-bold`,style:{color:`var(--c-white)`},children:e}),(0,F.jsx)(`div`,{className:`text-[7px]`,style:{color:`var(--c-text3)`},children:t})]},t))}),(0,F.jsx)(`div`,{className:`h-1.5 rounded-full overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${(t.sessions/D*100).toFixed(0)}%`,background:r}})}),t.topModels&&t.topModels.length>0&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1.5`,children:t.topModels.slice(0,2).map(e=>(0,F.jsx)(`span`,{className:`text-[8px] px-1.5 py-0.5 rounded-sm`,style:{background:`rgba(99,102,241,0.08)`,color:`#818cf8`},children:e.name},e.name))})]},t.username)})}),y.length===0&&(0,F.jsxs)(`div`,{className:`card p-8 text-center`,children:[(0,F.jsx)(Di,{size:32,className:`mx-auto mb-3`,style:{color:`var(--c-text3)`}}),(0,F.jsx)(`div`,{className:`text-[12px] font-medium mb-1`,style:{color:`var(--c-white)`},children:`No team members yet`}),(0,F.jsx)(`div`,{className:`text-[11px]`,style:{color:`var(--c-text3)`},children:`Share the join command with your team to start collecting data`})]})]}),(0,F.jsx)(`div`,{className:`hidden xl:flex flex-col w-[300px] shrink-0 sticky top-[42px] self-start`,style:{height:k,borderLeft:`1px solid var(--c-border)`,background:`var(--c-bg)`},children:(0,F.jsx)(xD,{onSessionClick:O})}),(0,F.jsx)(XT,{chatId:l,onClose:()=>{u(null),f(null)},fetchFn:d?e=>ba(e,d):void 0,username:d,extraHeader:d?(0,F.jsx)(`span`,{className:`text-[11px] font-medium px-1.5 py-0.5 shrink-0`,style:{background:`rgba(99,102,241,0.15)`,color:`#818cf8`},children:d}):null})]})}Lf.register(qf,wm,im,km,Nm,vp);var kD=`JetBrains Mono, monospace`,AD=[`#6366f1`,`#a78bfa`,`#818cf8`,`#c084fc`,`#e879f9`,`#f472b6`,`#fb7185`,`#f87171`,`#fbbf24`,`#34d399`];function jD({segments:e,height:t=6}){let n=e.reduce((e,t)=>e+t.value,0);return n===0?null:(0,F.jsx)(`div`,{className:`flex w-full rounded-full overflow-hidden`,style:{height:t},children:e.filter(e=>e.value>0).map((e,t)=>(0,F.jsx)(`div`,{title:`${e.label}: ${J(e.value)}`,className:`h-full transition-all`,style:{width:`${(e.value/n*100).toFixed(1)}%`,background:e.color}},t))})}function MD({sessions:e,projects:t,selectedChat:n,onSelectChat:r}){let[i,a]=(0,S.useState)(new Set),o=e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},s=(0,S.useMemo)(()=>{let t={},n=[];for(let r of e)r.folder?(t[r.folder]||(t[r.folder]=[]),t[r.folder].push(r)):n.push(r);return{sorted:Object.entries(t).sort((e,t)=>t[1].length-e[1].length),noProject:n}},[e]),c=({s:e})=>(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1.5 cursor-pointer transition rounded-sm`,style:{background:n===e.id?`rgba(99,102,241,0.12)`:`transparent`},onMouseEnter:t=>{n!==e.id&&(t.currentTarget.style.background=`var(--c-bg3)`)},onMouseLeave:t=>{n!==e.id&&(t.currentTarget.style.background=`transparent`)},onClick:()=>r(e.id),children:[(0,F.jsx)(Gh,{source:e.source,size:10}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium truncate`,style:{color:`var(--c-white)`},children:e.name||`Untitled`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[8px]`,style:{color:`var(--c-text3)`},children:[e.totalMessages>0&&(0,F.jsxs)(`span`,{children:[e.totalMessages,`m`]}),e.totalMessages>0&&e.lastUpdatedAt&&(0,F.jsx)(`span`,{children:`·`}),e.lastUpdatedAt&&(0,F.jsx)(`span`,{children:Ah(e.lastUpdatedAt)})]})]})]});return(0,F.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2.5 shrink-0`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(qr,{size:12,style:{color:`var(--c-accent)`}}),(0,F.jsx)(`span`,{className:`text-[12px] font-medium uppercase tracking-wider`,style:{color:`var(--c-text2)`},children:`Sessions`}),(0,F.jsx)(`span`,{className:`text-[10px] ml-auto`,style:{color:`var(--c-text3)`},children:e.length})]}),(0,F.jsxs)(`div`,{className:`flex-1 overflow-y-auto scrollbar-thin py-1`,children:[s.sorted.map(([e,t])=>{let n=i.has(e),r=e.split(`/`).pop();return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1.5 cursor-pointer transition`,onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>o(e),children:[n?(0,F.jsx)(wr,{size:10,style:{color:`var(--c-text3)`}}):(0,F.jsx)(Cr,{size:10,style:{color:`var(--c-text3)`}}),(0,F.jsx)(Ur,{size:10,style:{color:`#818cf8`}}),(0,F.jsx)(`span`,{className:`text-[11px] font-medium truncate flex-1`,style:{color:`var(--c-text2)`},title:e,children:r}),(0,F.jsx)(`span`,{className:`text-[8px]`,style:{color:`var(--c-text3)`},children:t.length})]}),!n&&(0,F.jsx)(`div`,{className:`pl-3`,children:t.map(e=>(0,F.jsx)(c,{s:e},e.id))})]},e)}),s.noProject.length>0&&(0,F.jsxs)(`div`,{children:[s.sorted.length>0&&(0,F.jsx)(`div`,{className:`px-2 py-1.5 text-[10px] uppercase tracking-wider`,style:{color:`var(--c-text3)`},children:`no project`}),(0,F.jsx)(`div`,{className:s.sorted.length>0?`pl-1`:``,children:s.noProject.map(e=>(0,F.jsx)(c,{s:e},e.id))})]})]})]})}function ND(){let{username:e}=pt(),t=dt(),[n,r]=(0,S.useState)(null),[i,a]=(0,S.useState)(null),{dark:o}=tr(),s=o?`#888`:`#555`,c=o?`rgba(255,255,255,0.04)`:`rgba(0,0,0,0.06)`,l=o?`#555`:`#999`;(0,S.useEffect)(()=>{e&&ga(e,{limit:200}).then(r)},[e]);let u=(0,S.useCallback)(t=>ba(t,e),[e]);if(!n)return(0,F.jsx)(`div`,{className:`text-sm py-12 text-center`,style:{color:`var(--c-text2)`},children:`loading...`});let d=n.length,f=n.reduce((e,t)=>e+(t.totalMessages||0),0),p=n.reduce((e,t)=>e+(t.totalInputTokens||0),0),m=n.reduce((e,t)=>e+(t.totalOutputTokens||0),0),h=p+m,g=d>0?(f/d).toFixed(1):0,_=d>0?Math.round(h/d):0,v={};for(let e of n)e.source&&(v[e.source]=(v[e.source]||0)+1);let y=Object.entries(v).sort((e,t)=>t[1]-e[1]),b={};for(let e of n)e.folder&&(b[e.folder]||(b[e.folder]={count:0,lastActive:0,messages:0,tokens:0}),b[e.folder].count++,b[e.folder].messages+=e.totalMessages||0,b[e.folder].tokens+=(e.totalInputTokens||0)+(e.totalOutputTokens||0),e.lastUpdatedAt>b[e.folder].lastActive&&(b[e.folder].lastActive=e.lastUpdatedAt));let x=Object.entries(b).sort((e,t)=>t[1].count-e[1].count),C=x.length>0?Math.max(...x.map(([,e])=>e.count)):1,w={};for(let e of n)if(e.models)for(let t of e.models)w[t]=(w[t]||0)+1;let T=Object.entries(w).sort((e,t)=>t[1]-e[1]).slice(0,10),E={};for(let e of n)if(e.toolCalls)for(let t of e.toolCalls)E[t]=(E[t]||0)+1;let D=Object.entries(E).sort((e,t)=>t[1]-e[1]).slice(0,15),O={};for(let e of n){let t=new Date(e.lastUpdatedAt||e.createdAt).toISOString().slice(0,10);O[t]=(O[t]||0)+1}let k=Object.entries(O).sort((e,t)=>e[0].localeCompare(t[0])).slice(-14),A=e=>{a(e)},j=`calc(100vh - 42px)`;return(0,F.jsxs)(`div`,{className:`fade-in flex`,style:{height:j},children:[(0,F.jsx)(`div`,{className:`hidden lg:flex flex-col w-[250px] shrink-0 sticky top-[42px] self-start`,style:{height:j,borderRight:`1px solid var(--c-border)`,background:`var(--c-bg)`},children:(0,F.jsx)(MD,{sessions:n,projects:x,selectedChat:i,onSelectChat:a})}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-y-auto p-4 space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(`button`,{onClick:()=>t(`/`),className:`p-1.5 transition hover:bg-[var(--c-card)] rounded-sm`,style:{border:`1px solid var(--c-border)`,color:`var(--c-text2)`},children:(0,F.jsx)(dr,{size:14})}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsx)(`div`,{className:`w-9 h-9 flex items-center justify-center text-[14px] font-bold rounded-sm`,style:{background:`rgba(99,102,241,0.15)`,color:`#818cf8`},children:e.charAt(0).toUpperCase()}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[14px] font-bold`,style:{color:`var(--c-white)`},children:e}),(0,F.jsx)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:y.map(([e])=>(0,F.jsx)(Gh,{source:e,size:11},e))})]})]})]}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`sessions`,value:d}),(0,F.jsx)(K,{label:`messages`,value:J(f),sub:`${g}/session`}),(0,F.jsx)(K,{label:`editors`,value:y.length}),(0,F.jsx)(K,{label:`projects`,value:x.length}),(0,F.jsx)(K,{label:`tokens`,value:J(h),sub:`${J(_)}/session`}),(0,F.jsx)(K,{label:`models`,value:T.length})]}),h>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,F.jsx)($,{children:`token usage`}),(0,F.jsxs)(`span`,{className:`text-[11px] font-bold`,style:{color:`var(--c-white)`},children:[J(h),` total`]})]}),(0,F.jsx)(jD,{height:10,segments:[{label:`Input`,value:p,color:`#6366f1`},{label:`Output`,value:m,color:`#a78bfa`}]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4 mt-1.5 text-[10px]`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#6366f1`}}),` input `,J(p)]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-sm`,style:{background:`#a78bfa`}}),` output `,J(m)]})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-3`,children:[y.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`editors`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Th,{data:{labels:y.map(([e])=>q(e)),datasets:[{data:y.map(([,e])=>e),backgroundColor:y.map(([e])=>Oh(e)),borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:s,font:{size:9,family:kD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:kD,size:10},titleFont:{family:kD,size:10}}}}})})]}),T.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`models`}),(0,F.jsx)(`div`,{style:{height:160},children:(0,F.jsx)(Th,{data:{labels:T.map(([e])=>e),datasets:[{data:T.map(([,e])=>e),backgroundColor:AD,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`60%`,plugins:{legend:{position:`right`,labels:{color:s,font:{size:8,family:kD},usePointStyle:!0,pointStyle:`circle`,padding:6}},tooltip:{bodyFont:{family:kD,size:10},titleFont:{family:kD,size:10}}}}})})]})]}),k.length>1&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`daily activity (last 14 days)`}),(0,F.jsx)(`div`,{style:{height:120},children:(0,F.jsx)(wh,{data:{labels:k.map(([e])=>e.slice(5)),datasets:[{data:k.map(([,e])=>e),backgroundColor:`#6366f1`,borderRadius:2}]},options:{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{bodyFont:{family:kD,size:10},titleFont:{family:kD,size:10}}},scales:{x:{grid:{display:!1},ticks:{color:l,font:{size:8,family:kD}}},y:{grid:{color:c},ticks:{color:l,font:{size:8,family:kD},stepSize:1},beginAtZero:!0}}}})})]}),x.length>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)($,{children:`projects`}),(0,F.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2 mt-2`,children:x.map(([e,t])=>(0,F.jsxs)(`div`,{className:`card px-3 py-2.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5`,children:[(0,F.jsx)(Ur,{size:11,style:{color:`#818cf8`}}),(0,F.jsx)(`span`,{className:`text-[12px] font-medium truncate`,style:{color:`var(--c-white)`},children:e.split(`/`).pop()})]}),(0,F.jsx)(`div`,{className:`text-[8px] truncate mb-2`,style:{color:`var(--c-text3)`},children:e}),(0,F.jsxs)(`div`,{className:`grid grid-cols-3 gap-1 text-center mb-1.5`,children:[(0,F.jsxs)(`div`,{className:`p-1 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsx)(`div`,{className:`text-[11px] font-bold`,style:{color:`var(--c-white)`},children:t.count}),(0,F.jsx)(`div`,{className:`text-[7px]`,style:{color:`var(--c-text3)`},children:`sessions`})]}),(0,F.jsxs)(`div`,{className:`p-1 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsx)(`div`,{className:`text-[11px] font-bold`,style:{color:`var(--c-white)`},children:J(t.messages)}),(0,F.jsx)(`div`,{className:`text-[7px]`,style:{color:`var(--c-text3)`},children:`messages`})]}),(0,F.jsxs)(`div`,{className:`p-1 rounded-sm`,style:{background:`var(--c-code-bg)`},children:[(0,F.jsx)(`div`,{className:`text-[11px] font-bold`,style:{color:`var(--c-white)`},children:J(t.tokens)}),(0,F.jsx)(`div`,{className:`text-[7px]`,style:{color:`var(--c-text3)`},children:`tokens`})]})]}),(0,F.jsx)(`div`,{className:`h-1.5 rounded-full overflow-hidden`,style:{background:`var(--c-code-bg)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${(t.count/C*100).toFixed(0)}%`,background:`#6366f1`}})}),(0,F.jsx)(`div`,{className:`text-[8px] mt-1`,style:{color:`var(--c-text3)`},children:Ah(t.lastActive)})]},e))})]}),D.length>0&&(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`top tools`}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1`,children:D.map(([e,t])=>(0,F.jsxs)(`span`,{className:`text-[10px] px-2 py-1 rounded-sm`,style:{background:`var(--c-code-bg)`,color:`var(--c-text2)`},children:[e,` `,(0,F.jsxs)(`span`,{style:{color:`var(--c-text3)`},children:[`×`,t]})]},e))})]}),(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`recent sessions`}),(0,F.jsx)(`div`,{className:`max-h-[400px] overflow-y-auto scrollbar-thin`,children:(0,F.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,F.jsx)(`tbody`,{children:n.slice(0,50).map(e=>(0,F.jsxs)(`tr`,{className:`cursor-pointer transition`,style:{borderBottom:`1px solid var(--c-border)`},onMouseEnter:e=>e.currentTarget.style.background=`var(--c-bg3)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,onClick:()=>a(e.id),children:[(0,F.jsx)(`td`,{className:`py-2 px-2 w-[24px]`,children:(0,F.jsx)(Gh,{source:e.source,size:11})}),(0,F.jsxs)(`td`,{className:`py-2 px-2`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium truncate`,style:{color:`var(--c-white)`},children:e.name||`Untitled`}),(0,F.jsx)(`div`,{className:`text-[10px] truncate`,style:{color:`var(--c-text3)`},children:e.folder?e.folder.split(`/`).pop():``})]}),(0,F.jsx)(`td`,{className:`py-2 px-2 text-[10px] whitespace-nowrap`,style:{color:`var(--c-text3)`},children:e.totalMessages>0&&(0,F.jsxs)(`span`,{children:[e.totalMessages,`m`]})}),(0,F.jsx)(`td`,{className:`py-2 px-2`,children:e.mode&&(0,F.jsx)(`span`,{className:`text-[8px] px-1.5 py-0.5 rounded-sm`,style:{background:`rgba(168,85,247,0.1)`,color:`#a855f7`},children:e.mode})}),(0,F.jsx)(`td`,{className:`py-2 px-2 text-[10px] whitespace-nowrap text-right`,style:{color:`var(--c-text3)`},children:Ah(e.lastUpdatedAt)})]},e.id))})})})]})]}),(0,F.jsx)(`div`,{className:`hidden xl:flex flex-col w-[300px] shrink-0 sticky top-[42px] self-start`,style:{height:j,borderLeft:`1px solid var(--c-border)`,background:`var(--c-bg)`},children:(0,F.jsx)(xD,{onSessionClick:A})}),(0,F.jsx)(XT,{chatId:i,onClose:()=>a(null),fetchFn:u,username:e,extraHeader:(0,F.jsx)(`span`,{className:`text-[11px] font-medium px-1.5 py-0.5 shrink-0`,style:{background:`rgba(99,102,241,0.15)`,color:`#818cf8`},children:e})})]})}Lf.register(qf,wm,im,km,Nm,vp);var PD=`JetBrains Mono, monospace`;function FD(e){if(!e)return`—`;let t=Date.now()-e,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<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function ID(e){return e===`completed`?`#22c55e`:e===`executing`?`#f59e0b`:`var(--c-text3)`}function LD({value:e,total:t,color:n=`#6366f1`}){return(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`flex-1 h-1 rounded-full overflow-hidden`,style:{background:`var(--c-bg3)`},children:(0,F.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${t>0?Math.round(e/t*100):0}%`,background:n}})}),(0,F.jsxs)(`span`,{className:`text-[10px] tabular-nums`,style:{color:`var(--c-text3)`,fontFamily:PD,minWidth:36},children:[e,`/`,t]})]})}function RD({title:e,subtitle:t,content:n,loading:r,onClose:i}){let a=(0,S.useRef)(null);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`fixed inset-0 z-40 transition-opacity`,style:{background:`rgba(0,0,0,0.3)`},onClick:i}),(0,F.jsxs)(`div`,{className:`fixed top-0 right-0 bottom-0 z-50 flex flex-col shadow-2xl sidebar-slide-in cursor-default`,style:{width:`min(620px, 92vw)`,background:`var(--c-bg)`,borderLeft:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 shrink-0`,style:{borderBottom:`1px solid var(--c-border)`},children:[(0,F.jsx)(`button`,{onClick:i,className:`p-1 rounded transition hover:bg-[var(--c-bg3)]`,style:{color:`var(--c-text2)`},children:(0,F.jsx)(ki,{size:14})}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[13px] font-semibold`,style:{color:`var(--c-white)`},children:e}),t&&(0,F.jsx)(`div`,{className:`text-[11px] capitalize`,style:{color:`var(--c-text2)`,fontFamily:PD},children:t})]})]}),(0,F.jsxs)(`div`,{ref:a,className:`flex-1 overflow-y-auto scrollbar-thin px-4 py-3`,children:[r&&(0,F.jsx)(`div`,{className:`text-[12px] py-12 text-center`,style:{color:`var(--c-text3)`},children:`Loading…`}),!r&&n===null&&(0,F.jsx)(`div`,{className:`text-[12px] py-12 text-center`,style:{color:`var(--c-text3)`},children:`File not found.`}),!r&&n!==null&&(0,F.jsx)(`pre`,{className:`text-[11px] leading-relaxed whitespace-pre-wrap break-words`,style:{color:`var(--c-text)`,fontFamily:PD},children:n})]})]})]})}var zD={mode:`Mode`,model_profile:`Model profile`,granularity:`Granularity`,parallelization:`Parallelization`,commit_docs:`Commit docs`},BD={research:`Research`,plan_check:`Plan check`,verifier:`Verifier`,nyquist_validation:`Nyquist`,auto_advance:`Auto advance`,ui_phase:`UI phase`,skip_discuss:`Skip discuss`};function VD({folder:e,anchor:t,onClose:n}){let[r,i]=(0,S.useState)(void 0),a=(0,S.useRef)(null);(0,S.useEffect)(()=>{da(e).then(i).catch(()=>i(null))},[e]),(0,S.useEffect)(()=>{function e(e){a.current&&!a.current.contains(e.target)&&n()}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]);let o=t?t.bottom+6:0,s=t?window.innerWidth-t.right:0;function c(e){return e===!0?(0,F.jsx)(`span`,{style:{color:`#22c55e`},children:`on`}):e===!1?(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`off`}):(0,F.jsx)(`span`,{style:{color:`var(--c-white)`},children:String(e)})}return(0,F.jsxs)(`div`,{ref:a,className:`p-3 shadow-xl text-[11px]`,style:{position:`fixed`,top:o,right:s,zIndex:9999,width:240,background:`var(--c-bg)`,border:`1px solid var(--c-border)`,boxShadow:`0 8px 32px rgba(0,0,0,0.4)`},onClick:e=>e.stopPropagation(),children:[r===void 0&&(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},children:`Loading…`}),r===null&&(0,F.jsx)(`div`,{style:{color:`var(--c-text3)`},children:`No config.json found.`}),r&&(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(`div`,{className:`space-y-1`,children:Object.entries(zD).map(([e,t])=>e in r?(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:t}),c(r[e])]},e):null)}),r.workflow&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`border-t pt-2`,style:{borderColor:`var(--c-border)`,color:`var(--c-text3)`},children:`workflow`}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1`,children:Object.entries(BD).map(([e,t])=>e in r.workflow?(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-1`,children:[(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:t}),c(r.workflow[e])]},e):null)})]})]})]})}function HD({phase:e,tokenData:t,onOpenFile:n}){let r=e.total_tasks??0,i=e.completed_tasks??0,a=!!e.has_plan,o=!!e.has_research,s=!!e.has_verification,c=e.status??`planned`;return(0,F.jsxs)(`div`,{className:`flex items-center px-3 py-2 border-b text-[12px] hover:bg-[var(--c-bg3)] transition`,style:{borderColor:`var(--c-border)`,gap:0},children:[(0,F.jsx)(`div`,{style:{width:28,flexShrink:0},children:(0,F.jsx)(c===`completed`?Dr:c===`executing`?$r:kr,{size:12,style:{color:ID(c)},className:c===`executing`?`animate-spin`:``})}),(0,F.jsx)(`div`,{style:{width:32,flexShrink:0},children:(0,F.jsx)(`span`,{className:`text-[10px] font-bold tabular-nums`,style:{color:`var(--c-text3)`,fontFamily:PD},children:e.phase_number??`?`})}),(0,F.jsx)(`div`,{className:`flex-1 min-w-0 pr-3`,children:(0,F.jsx)(`span`,{className:`block truncate capitalize text-[12px]`,style:{color:`var(--c-white)`},children:e.phase_name})}),(0,F.jsx)(`div`,{style:{width:100,flexShrink:0,paddingRight:12},children:r>0?(0,F.jsx)(LD,{value:i,total:r,color:ID(c)}):null}),(0,F.jsxs)(`div`,{style:{width:88,flexShrink:0},className:`flex items-center gap-1`,children:[a&&(0,F.jsxs)(`button`,{onClick:()=>n(e,`plan`),className:`flex items-center gap-1 px-1.5 py-px text-[10px] transition hover:opacity-80 cursor-pointer`,style:{background:`rgba(99,102,241,0.12)`,color:`#818cf8`},title:`View PLAN.md`,children:[(0,F.jsx)(Br,{size:9}),`plan`]}),o&&(0,F.jsx)(`button`,{onClick:()=>n(e,`research`),className:`px-1 py-px transition hover:opacity-80 cursor-pointer`,style:{background:`rgba(245,158,11,0.1)`,color:`#f59e0b`},title:`View RESEARCH.md`,children:(0,F.jsx)(mr,{size:9})}),s&&(0,F.jsx)(`button`,{onClick:()=>n(e,`verification`),className:`px-1 py-px transition hover:opacity-80 cursor-pointer`,style:{background:`rgba(34,197,94,0.1)`,color:`#22c55e`},title:`View VERIFICATION.md`,children:(0,F.jsx)(hi,{size:9})})]}),(0,F.jsx)(`div`,{style:{width:64,flexShrink:0,textAlign:`right`},children:t&&t.cost>0?(0,F.jsx)(`span`,{className:`text-[10px] tabular-nums`,style:{color:`var(--c-text2)`,fontFamily:PD},children:kh(t.cost)}):null}),(0,F.jsx)(`div`,{style:{width:56,flexShrink:0,textAlign:`right`},children:(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:FD(e.last_modified)})})]})}function UD(e){return e.total_phases===0?`var(--c-border)`:e.completed_phases===e.total_phases?`#22c55e`:e.completed_phases>0?`#f59e0b`:`var(--c-border)`}function WD({project:e,isExpanded:t,onToggle:n,onOpenFile:r,onOpenConfig:i,onOpenState:a}){let[o,s]=(0,S.useState)(null),[c,l]=(0,S.useState)(null),u=(0,S.useRef)(null),d=(0,S.useRef)(null),f=e.total_phases>0?Math.round(e.completed_phases/e.total_phases*100):0,p=e.total_phases-e.completed_phases;return(0,S.useEffect)(()=>{t&&o===null&&(ca(e.folder).then(s),fa(e.folder).then(e=>{let t={};for(let n of e)t[n.id]=n;l(t)}).catch(()=>l({})))},[t,o,e.folder]),(0,F.jsxs)(`div`,{className:`card overflow-hidden`,style:{borderLeft:`2px solid ${UD(e)}`},children:[(0,F.jsxs)(`div`,{className:`flex items-center w-full px-3 py-3`,style:{gap:0},children:[(0,F.jsx)(`button`,{onClick:n,className:`flex items-center justify-center hover:bg-[var(--c-bg3)] transition rounded cursor-pointer`,style:{width:24,height:24,flexShrink:0,color:`var(--c-text3)`},children:t?(0,F.jsx)(Cr,{size:13}):(0,F.jsx)(wr,{size:13})}),(0,F.jsxs)(`button`,{onClick:n,className:`flex-1 min-w-0 text-left px-2 cursor-pointer`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-[13px] font-semibold truncate`,style:{color:`var(--c-white)`},children:e.name}),e.milestone&&(0,F.jsx)(`span`,{className:`text-[10px] px-1.5 py-px shrink-0`,style:{background:`rgba(99,102,241,0.12)`,color:`#818cf8`},children:e.milestone})]}),(0,F.jsx)(`div`,{className:`text-[10px] truncate mt-0.5`,style:{color:`var(--c-text3)`,fontFamily:PD},children:e.folder})]}),(0,F.jsx)(`div`,{style:{width:36,flexShrink:0,textAlign:`right`},children:(0,F.jsxs)(`span`,{className:`text-[11px] font-bold tabular-nums`,style:{color:f===100?`#22c55e`:f>0?`#f59e0b`:`var(--c-text3)`,fontFamily:PD},children:[f,`%`]})}),(0,F.jsx)(`div`,{style:{width:112,flexShrink:0,padding:`0 10px`},children:(0,F.jsx)(LD,{value:e.completed_phases,total:e.total_phases,color:f===100?`#22c55e`:`#6366f1`})}),(0,F.jsxs)(`div`,{style:{width:80,flexShrink:0},className:`flex items-center gap-1`,children:[e.completed_phases>0&&(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] px-1.5 py-px`,style:{background:`rgba(34,197,94,0.08)`,color:`#22c55e`},children:[(0,F.jsx)(Dr,{size:9}),` `,e.completed_phases]}),p>0&&(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] px-1.5 py-px`,style:{background:`rgba(255,255,255,0.04)`,color:`var(--c-text3)`},children:[(0,F.jsx)(kr,{size:9}),` `,p]})]}),(0,F.jsxs)(`div`,{style:{width:52,flexShrink:0},className:`flex items-center gap-2`,children:[e.todos>0&&(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},title:`Todos / Seeds`,children:[(0,F.jsx)(Zr,{size:10}),` `,e.todos]}),e.notes>0&&(0,F.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px]`,style:{color:`var(--c-text3)`},title:`Quick tasks`,children:[(0,F.jsx)(vi,{size:10}),` `,e.notes]})]}),(0,F.jsx)(`div`,{style:{width:60,flexShrink:0,textAlign:`right`},children:(0,F.jsx)(`span`,{className:`text-[11px] tabular-nums`,style:{color:e.total_cost>0?`#a78bfa`:`var(--c-text3)`,fontFamily:PD},children:e.total_cost>0?kh(e.total_cost):`—`})}),(0,F.jsx)(`div`,{style:{width:56,flexShrink:0,textAlign:`right`},children:(0,F.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:FD(e.last_modified)})}),(0,F.jsxs)(`div`,{style:{width:52,flexShrink:0},className:`flex items-center justify-end gap-0.5`,onClick:e=>e.stopPropagation(),children:[(0,F.jsx)(`button`,{ref:d,onClick:()=>a(e.folder,e.name),className:`p-1 rounded transition hover:bg-[var(--c-bg3)] cursor-pointer`,style:{color:`var(--c-text3)`},title:`View STATE.md`,children:(0,F.jsx)(Yr,{size:13})}),(0,F.jsx)(`button`,{ref:u,onClick:()=>i(e.folder,u.current?.getBoundingClientRect()),className:`p-1 rounded transition hover:bg-[var(--c-bg3)] cursor-pointer`,style:{color:`var(--c-text3)`},title:`GSD config`,children:(0,F.jsx)(Or,{size:13})})]})]}),t&&(0,F.jsxs)(`div`,{className:`border-t`,style:{borderColor:`var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center px-3 py-1 text-[10px]`,style:{background:`var(--c-bg2)`,color:`var(--c-text3)`,gap:0},children:[(0,F.jsx)(`div`,{style:{width:28,flexShrink:0}}),(0,F.jsx)(`div`,{style:{width:32,flexShrink:0},children:`#`}),(0,F.jsx)(`div`,{className:`flex-1 pr-3`,children:`phase`}),(0,F.jsx)(`div`,{style:{width:100,flexShrink:0,paddingRight:12},children:`plans`}),(0,F.jsx)(`div`,{style:{width:88,flexShrink:0},children:`artifacts`}),(0,F.jsx)(`div`,{style:{width:64,flexShrink:0,textAlign:`right`},children:`est. cost`}),(0,F.jsx)(`div`,{style:{width:56,flexShrink:0,textAlign:`right`},children:`updated`})]}),o===null?(0,F.jsx)(`div`,{className:`px-4 py-3 text-[12px]`,style:{color:`var(--c-text3)`},children:`Loading phases…`}):o.length===0?(0,F.jsx)(`div`,{className:`px-4 py-3 text-[12px]`,style:{color:`var(--c-text3)`},children:`No phases found.`}):o.map(t=>(0,F.jsx)(HD,{phase:t,tokenData:c?.[t.id]??null,onOpenFile:(t,n)=>r(t,e.folder,n)},t.id))]})]})}function GD(){let{dark:e}=tr(),[t,n]=(0,S.useState)(null),[r,i]=(0,S.useState)(null),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(null),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)(null),[p,m]=(0,S.useState)(!0),h=e?`#888`:`#555`,g=e?`#555`:`#999`,_=e?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.06)`;(0,S.useEffect)(()=>{Promise.all([sa(),ua()]).then(([e,t])=>{n(e),i(t),m(!1),o({totalCost:(e||[]).reduce((e,t)=>e+(t.total_cost||0),0)})}).catch(()=>m(!1))},[]);function v(e,t){f(n=>n?.folder===e?null:{folder:e,anchor:t})}function y(e,t,n){let r=e.id?.split(`::`)?.[1]||``,i=e.phase_name??e.name??``;u({title:{plan:`PLAN.md`,research:`RESEARCH.md`,verification:`VERIFICATION.md`,summary:`SUMMARY.md`}[n]??n.toUpperCase()+`.md`,subtitle:i,content:null,loading:!0}),n===`plan`?la(t,r).then(e=>u(t=>t?{...t,content:e?.content??null,loading:!1}:null)).catch(()=>u(e=>e?{...e,loading:!1}:null)):pa(t,n,r).then(e=>u(t=>t?{...t,content:e?.content??null,loading:!1}:null)).catch(()=>u(e=>e?{...e,loading:!1}:null))}function b(e,t){u({title:`STATE.md`,subtitle:t,content:null,loading:!0}),pa(e,`state`).then(e=>u(t=>t?{...t,content:e?.content??null,loading:!1}:null)).catch(()=>u(e=>e?{...e,loading:!1}:null))}if(p)return(0,F.jsx)(wa,{label:`Loading GSD projects...`});if(!t||t.length===0)return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:xi,title:`GSD Workflow`}),(0,F.jsxs)(`div`,{className:`card p-8 text-center space-y-3`,children:[(0,F.jsx)(xi,{size:32,style:{color:`var(--c-text3)`,margin:`0 auto`}}),(0,F.jsx)(`div`,{className:`text-[14px] font-semibold`,style:{color:`var(--c-white)`},children:`No GSD projects found`}),(0,F.jsxs)(`div`,{className:`text-[12px] max-w-sm mx-auto`,style:{color:`var(--c-text2)`},children:[`GSD (Get Shit Done) is a structured AI workflow system that stores project plans and phases inside a `,(0,F.jsx)(`code`,{style:{fontFamily:PD},children:`.planning/`}),` directory. Run a data scan after initializing a GSD project and it will appear here.`]})]})]});let x=r&&r.totalPhases>0?Math.round(r.completedPhases/r.totalPhases*100):0,C={completed:r?.completedPhases??0,executing:r?.executingPhases??0,planned:r?.plannedPhases??0},w={labels:[`Completed`,`Executing`,`Planned`],datasets:[{data:[C.completed,C.executing,C.planned],backgroundColor:[`#22c55e`,`#f59e0b`,`rgba(255,255,255,0.08)`],borderWidth:0}]},T=[...t].sort((e,t)=>t.total_phases-e.total_phases).slice(0,8),E={labels:T.map(e=>e.name.length>16?e.name.slice(0,15)+`…`:e.name),datasets:[{label:`Completed`,data:T.map(e=>e.completed_phases),backgroundColor:`#22c55e`,borderRadius:2},{label:`Remaining`,data:T.map(e=>e.total_phases-e.completed_phases),backgroundColor:`rgba(99,102,241,0.3)`,borderRadius:2}]},D={responsive:!0,maintainAspectRatio:!1,cutout:`72%`,plugins:{legend:{display:!1},tooltip:{bodyFont:{family:PD,size:10},titleFont:{family:PD,size:10}}}},O={responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{stacked:!0,grid:{color:_},ticks:{color:g,font:{size:8,family:PD}}},y:{stacked:!0,grid:{display:!1},ticks:{color:h,font:{size:8,family:PD}}}},plugins:{legend:{display:!1},tooltip:{bodyFont:{family:PD,size:10},titleFont:{family:PD,size:10}}}};return(0,F.jsxs)(`div`,{className:`fade-in space-y-3`,children:[(0,F.jsx)($T,{icon:xi,title:`GSD Workflow`}),(0,F.jsxs)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(90px, 1fr))`},children:[(0,F.jsx)(K,{label:`projects`,value:r?.totalProjects??t.length}),(0,F.jsx)(K,{label:`total phases`,value:r?.totalPhases??`—`}),(0,F.jsx)(K,{label:`completed`,value:r?.completedPhases??`—`}),(0,F.jsx)(K,{label:`completion`,value:r?.totalPhases>0?`${x}%`:`—`}),(0,F.jsx)(K,{label:`total cost`,value:a?kh(a.totalCost):`—`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`card p-3`,children:[(0,F.jsx)($,{children:`phase status`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,F.jsx)(`div`,{style:{height:110,width:110,flexShrink:0},children:(0,F.jsx)(Th,{data:w,options:D})}),(0,F.jsx)(`div`,{className:`space-y-2 text-[11px]`,children:[{label:`Completed`,count:C.completed,color:`#22c55e`},{label:`Executing`,count:C.executing,color:`#f59e0b`},{label:`Planned`,count:C.planned,color:`var(--c-text3)`}].map(({label:e,count:t,color:n})=>(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:n}}),(0,F.jsx)(`span`,{style:{color:`var(--c-text2)`},children:e}),(0,F.jsx)(`span`,{className:`ml-auto font-bold tabular-nums`,style:{color:n,fontFamily:PD},children:t})]},e))})]})]}),(0,F.jsxs)(`div`,{className:`card p-3 lg:col-span-2`,children:[(0,F.jsxs)($,{children:[`projects `,(0,F.jsx)(`span`,{style:{color:`var(--c-text3)`},children:`by phases`})]}),(0,F.jsx)(`div`,{style:{height:130},children:(0,F.jsx)(wh,{data:E,options:O})}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 text-[10px]`,style:{color:`var(--c-text3)`},children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm`,style:{background:`#22c55e`}}),` Completed`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm`,style:{background:`rgba(99,102,241,0.3)`}}),` Remaining`]})]})]})]}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)($,{children:`projects`}),t.map(e=>(0,F.jsx)(WD,{project:e,isExpanded:s===e.folder,onToggle:()=>c(t=>t===e.folder?null:e.folder),onOpenFile:y,onOpenConfig:v,onOpenState:b},e.folder))]}),d&&(0,F.jsx)(VD,{folder:d.folder,anchor:d.anchor,onClose:()=>f(null)}),l&&(0,F.jsx)(RD,{title:l.title,subtitle:l.subtitle,content:l.content,loading:l.loading,onClose:()=>u(null)})]})}function KD({icon:e,label:t,items:n}){let[r,i]=(0,S.useState)(!1),a=ct(),o=n.some(e=>e.to===a.pathname),s=(0,S.useRef)(null);return(0,F.jsxs)(`div`,{className:`relative`,onMouseEnter:()=>{clearTimeout(s.current),i(!0)},onMouseLeave:()=>{s.current=setTimeout(()=>i(!1),150)},children:[(0,F.jsxs)(`button`,{className:`flex items-center gap-1.5 px-2.5 py-1 text-[12px] rounded transition ${o?`bg-[var(--c-card)] text-[var(--c-white)]`:`text-[var(--c-text2)] hover:text-[var(--c-white)]`}`,children:[(0,F.jsx)(e,{size:12}),t,(0,F.jsx)(Cr,{size:10,style:{opacity:.5}})]}),r&&(0,F.jsx)(`div`,{className:`absolute top-full left-0 mt-1 py-1 rounded shadow-lg min-w-[160px] z-[100]`,style:{background:`var(--c-bg)`,border:`1px solid var(--c-border)`},children:n.map(({to:e,icon:t,label:n})=>(0,F.jsxs)(Mn,{to:e,onClick:()=>i(!1),className:({isActive:e})=>`flex items-center gap-2 px-3 py-1.5 text-[12px] transition ${e?`bg-[var(--c-bg3)] text-[var(--c-white)]`:`text-[var(--c-text2)] hover:text-[var(--c-white)] hover:bg-[var(--c-bg3)]`}`,children:[(0,F.jsx)(t,{size:12}),n]},e))})]})}function qD(){let[e,t]=(0,S.useState)(null),[n,r]=(0,S.useState)(null),{live:i,toggle:a}=Sa(),[o,s]=(0,S.useState)(null),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(!!Mi()),f=(0,S.useRef)(null),{dark:p,toggle:m}=tr(),[h,g]=(0,S.useState)(!1),[_,v]=(0,S.useState)(!1);(0,S.useEffect)(()=>{Fi(()=>d(!1))},[]),(0,S.useEffect)(()=>{ma().then(e=>{s(e.mode||`local`),l(!!e.auth)})},[]);let y=(0,S.useCallback)(()=>{zi().then(t).catch(()=>{})},[]);(0,S.useEffect)(()=>{o===`local`&&y()},[o]);let b=(0,S.useCallback)(async e=>{await Gi(e),t(await zi())},[]);(0,S.useEffect)(()=>(i&&o===`local`?f.current=setInterval(()=>{b().catch(()=>{})},6e4):(f.current&&clearInterval(f.current),f.current=null),()=>{f.current&&clearInterval(f.current)}),[i,o,b]);let x=async()=>{r({scanned:0,total:0});try{await b(e=>r({scanned:e.scanned,total:e.total}))}catch(e){console.error(e)}r(null)},C=o===`relay`,w=C&&c&&!u,T=ct().pathname===`/artifacts`,E=C?[{to:`/`,icon:Di,label:`Team`}]:[{to:`/`,icon:lr,label:`Dashboard`},{to:`/sessions`,icon:ni,label:`Sessions`},{to:`/projects`,icon:Ur,label:`Projects`},{icon:Ir,label:`Costs`,children:[{to:`/costs`,icon:Ir,label:`Cost Analysis`},{to:`/subscriptions`,icon:Pr,label:`Subscriptions`}]},{icon:yr,label:`Insights`,children:[{to:`/analysis`,icon:yr,label:`Deep Analysis`},{to:`/compare`,icon:Wr,label:`Compare`}]},{to:`/artifacts`,icon:ii,label:`Artifacts`},{to:`/gsd`,icon:xi,label:`GSD`},{to:`/mcps`,icon:oi,label:`MCPs`},{to:`/sql`,icon:Fr,label:`SQL`}];return w?(0,F.jsx)(Ta,{onSuccess:()=>d(!0)}):(0,F.jsxs)(`div`,{className:`min-h-screen`,children:[(0,F.jsxs)(`header`,{className:`border-b px-4 py-1.5 flex items-center gap-3 sticky top-0 z-50 backdrop-blur-xl`,style:{borderColor:`var(--c-border)`,background:`var(--c-header)`},children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-bold tracking-tight`,style:{color:`var(--c-white)`},children:[(0,F.jsx)(Ca,{size:18}),`Agentlytics`,C&&(0,F.jsx)(`span`,{className:`ml-1.5 text-[10px] font-medium px-1.5 py-0.5`,style:{background:`rgba(99,102,241,0.15)`,color:`#818cf8`},children:`relay`})]}),(0,F.jsx)(`nav`,{className:`flex gap-0.5 ml-2`,children:E.map(e=>e.children?(0,F.jsx)(KD,{icon:e.icon,label:e.label,items:e.children},e.label):(0,F.jsxs)(Mn,{to:e.to,end:e.to===`/`,className:({isActive:e})=>`flex items-center gap-1.5 px-2.5 py-1 text-[12px] rounded transition ${e?`bg-[var(--c-card)] text-[var(--c-white)]`:`text-[var(--c-text2)] hover:text-[var(--c-white)]`}`,children:[(0,F.jsx)(e.icon,{size:12}),e.label]},e.to))}),(0,F.jsxs)(`div`,{className:`ml-auto flex items-center gap-3`,children:[!C&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{onClick:a,className:`flex items-center gap-1.5 px-2 py-0.5 text-[11px] transition`,style:{color:i?`#22c55e`:`var(--c-text3)`,border:i?`1px solid rgba(34,197,94,0.3)`:`1px solid var(--c-border)`,background:i?`rgba(34,197,94,0.08)`:`transparent`},title:i?`Disable live refresh`:`Enable live refresh (every 60s)`,children:[(0,F.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${i?`pulse-dot`:``}`,style:{background:i?`#22c55e`:`var(--c-text3)`}}),`Live`]}),(0,F.jsxs)(`button`,{onClick:x,disabled:!!n,className:`flex items-center gap-1 px-2 py-0.5 text-[11px] rounded transition hover:bg-[var(--c-card)]`,style:{color:`var(--c-text2)`,border:`1px solid var(--c-border)`},title:`Clear cache and rescan all editors`,children:[(0,F.jsx)(li,{size:10,className:n?`animate-spin`:``}),n?`Refetching (${n.scanned}/${n.total})...`:`Refetch`]}),(0,F.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--c-text2)`},children:e?`${e.totalChats} sessions`:`...`})]}),C&&(0,F.jsxs)(`button`,{onClick:()=>{g(!0),v(!1)},className:`flex items-center gap-1.5 px-2 py-0.5 text-[11px] transition hover:bg-[var(--c-card)]`,style:{color:`#818cf8`,border:`1px solid var(--c-border)`},title:`MCP Connection`,children:[(0,F.jsx)(oi,{size:10}),`Connect`]}),(0,F.jsx)(Mn,{to:`/settings`,className:`p-1 rounded transition hover:bg-[var(--c-card)]`,style:({isActive:e})=>({color:e?`#6366f1`:`var(--c-text2)`}),title:`Settings`,children:(0,F.jsx)(pi,{size:13})}),(0,F.jsx)(`button`,{onClick:m,className:`p-1 rounded transition hover:bg-[var(--c-card)]`,style:{color:`var(--c-text2)`},title:p?`Light mode`:`Dark mode`,children:p?(0,F.jsx)(yi,{size:13}):(0,F.jsx)(ri,{size:13})})]})]}),n&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-1.5 text-[12px]`,style:{background:`rgba(234,179,8,0.08)`,borderBottom:`1px solid rgba(234,179,8,0.15)`,color:`#ca8a04`},children:[(0,F.jsx)(wi,{size:12}),(0,F.jsx)(`span`,{children:`Devin, Devin Next, and Antigravity require their app to be running during refetch — otherwise their sessions won't be detected.`})]}),(0,F.jsx)(`main`,{className:C?`px-0`:T?`p-0 overflow-hidden`:`p-4 max-w-[1400px] mx-auto`,children:o===null?(0,F.jsx)(wa,{label:`Loading...`}):C?(0,F.jsxs)(zt,{children:[(0,F.jsx)(Lt,{path:`/`,element:(0,F.jsx)(OD,{})}),(0,F.jsx)(Lt,{path:`/relay`,element:(0,F.jsx)(OD,{})}),(0,F.jsx)(Lt,{path:`/relay/user/:username`,element:(0,F.jsx)(ND,{})})]}):(0,F.jsxs)(zt,{children:[(0,F.jsx)(Lt,{path:`/`,element:(0,F.jsx)(rE,{overview:e})}),(0,F.jsx)(Lt,{path:`/projects`,element:(0,F.jsx)(wE,{overview:e})}),(0,F.jsx)(Lt,{path:`/projects/detail`,element:(0,F.jsx)(ME,{})}),(0,F.jsx)(Lt,{path:`/sessions`,element:(0,F.jsx)(aE,{overview:e})}),(0,F.jsx)(Lt,{path:`/costs`,element:(0,F.jsx)(FE,{overview:e})}),(0,F.jsx)(Lt,{path:`/analysis`,element:(0,F.jsx)(_E,{overview:e})}),(0,F.jsx)(Lt,{path:`/compare`,element:(0,F.jsx)(xE,{overview:e})}),(0,F.jsx)(Lt,{path:`/subscriptions`,element:(0,F.jsx)(mD,{})}),(0,F.jsx)(Lt,{path:`/artifacts`,element:(0,F.jsx)($E,{})}),(0,F.jsx)(Lt,{path:`/mcps`,element:(0,F.jsx)(vD,{})}),(0,F.jsx)(Lt,{path:`/sql`,element:(0,F.jsx)(RE,{})}),(0,F.jsx)(Lt,{path:`/gsd`,element:(0,F.jsx)(GD,{})}),(0,F.jsx)(Lt,{path:`/settings`,element:(0,F.jsx)(eD,{})})]})}),(0,F.jsxs)(`footer`,{className:`border-t mt-8 px-4 py-3 flex items-center justify-between text-[11px]${T?` hidden`:``}`,style:{borderColor:`var(--c-border)`,color:`var(--c-text3)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsxs)(`a`,{href:`https://github.com/f/agentlytics`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 hover:text-[var(--c-text)] transition`,children:[(0,F.jsx)(Gr,{size:11}),(0,F.jsx)(`span`,{children:`GitHub`})]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(Si,{size:11}),(0,F.jsx)(`code`,{style:{fontFamily:`JetBrains Mono, monospace`},children:`npx agentlytics`})]})]}),(0,F.jsxs)(`span`,{children:[`built by `,(0,F.jsx)(`a`,{href:`https://github.com/f`,target:`_blank`,rel:`noopener noreferrer`,className:`hover:text-[var(--c-text)] transition`,style:{color:`var(--c-text2)`},children:`fkadev`})]})]}),h&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`fixed inset-0 z-[60]`,style:{background:`rgba(0,0,0,0.5)`},onClick:()=>g(!1)}),(0,F.jsxs)(`div`,{className:`fixed z-[70] w-[440px] max-w-[90vw] p-5 rounded shadow-2xl`,style:{top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,background:`var(--c-bg)`,border:`1px solid var(--c-border)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,F.jsxs)(`div`,{className:`text-[13px] font-bold`,style:{color:`var(--c-white)`},children:[(0,F.jsx)(oi,{size:13,className:`inline mr-1.5`,style:{color:`#818cf8`}}),`Connection Config`]}),(0,F.jsx)(`button`,{onClick:()=>g(!1),className:`text-[18px] leading-none px-1 hover:opacity-70 transition`,style:{color:`var(--c-text3)`},children:`×`})]}),(0,F.jsx)(`div`,{className:`text-[12px] font-medium mb-1.5`,style:{color:`var(--c-white)`},children:`MCP Config`}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`div`,{className:`text-[10px]`,style:{color:`var(--c-text3)`},children:`Add to your AI client's MCP settings`}),(0,F.jsx)(`button`,{onClick:()=>{let e=localStorage.getItem(`agentlytics_relay_token`),t={url:`${window.location.origin}/mcp`};e&&(t.headers={Authorization:`Bearer ${e}`});let n=JSON.stringify({mcpServers:{agentlytics:t}},null,2);navigator.clipboard.writeText(n),v(!0),setTimeout(()=>v(!1),2e3)},className:`flex items-center gap-1 px-1.5 py-0.5 text-[10px] transition hover:bg-[var(--c-bg3)]`,style:{border:`1px solid var(--c-border)`,color:_?`#22c55e`:`var(--c-text2)`},children:_?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Sr,{size:9}),` Copied`]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Mr,{size:9}),` Copy`]})})]}),(0,F.jsx)(`pre`,{className:`text-[11px] px-3 py-2 overflow-x-auto mb-4`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,color:`var(--c-text)`,fontFamily:`JetBrains Mono, monospace`,lineHeight:1.6},children:localStorage.getItem(`agentlytics_relay_token`)?`{\n "mcpServers": {\n "agentlytics": {\n "url": "${window.location.origin}/mcp",\n "headers": { "Authorization": "Bearer ${localStorage.getItem(`agentlytics_relay_token`)}" }\n }\n }\n}`:`{\n "mcpServers": {\n "agentlytics": {\n "url": "${window.location.origin}/mcp"\n }\n }\n}`}),(0,F.jsx)(`div`,{className:`text-[12px] font-medium mb-1.5`,style:{color:`var(--c-white)`},children:`Team Sharing`}),(0,F.jsx)(`div`,{className:`text-[10px] mb-1`,style:{color:`var(--c-text3)`},children:`Relay join is not supported in memhouse — team sharing is kernel-based. Each member owns their own rooms and shares by granting SELECT on them. See memhouse/delivery/kernel-install.md.`}),(0,F.jsx)(`pre`,{className:`text-[11px] px-3 py-2 overflow-x-auto`,style:{background:`var(--c-bg3)`,border:`1px solid var(--c-border)`,color:`var(--c-text)`,fontFamily:`JetBrains Mono, monospace`,lineHeight:1.6},children:`# each member ships with their own credential:
|
|
74
77
|
MEMHOUSE_URL=<realm-url> MEMHOUSE_USER=<member> MEMHOUSE_PASSWORD=<credential> \\
|
|
75
|
-
memhouse ship --loop`})]})]})]})}Qn.createRoot(document.getElementById(`root`)).render((0,F.jsx)(S.StrictMode,{children:(0,F.jsx)(er,{children:(0,F.jsx)(kn,{children:(0,F.jsx)(
|
|
78
|
+
memhouse ship --loop`})]})]})]})}Qn.createRoot(document.getElementById(`root`)).render((0,F.jsx)(S.StrictMode,{children:(0,F.jsx)(er,{children:(0,F.jsx)(kn,{children:(0,F.jsx)(qD,{})})})}));
|