@sigmashake/ssg 0.28.1 → 0.29.1
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/package.json +6 -6
- package/public/assets/app.css +1 -1
- package/public/assets/app.js +8 -8
package/public/assets/app.js
CHANGED
|
@@ -6,17 +6,17 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
6
6
|
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{be=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ye(n):``}function Se(e,t){switch(e.tag){case 26:case 27:case 5:return ye(e.type);case 16:return ye(`Lazy`);case 13:return e.child!==t&&t!==null?ye(`Suspense Fallback`):ye(`Suspense`);case 19:return ye(`SuspenseList`);case 0:case 15:return xe(e.type,!1);case 11:return xe(e.type.render,!1);case 1:return xe(e.type,!0);case 31:return ye(`Activity`);default:return``}}function Ce(e){try{var t=``,n=null;do t+=Se(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
7
|
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,F=t.unstable_UserBlockingPriority,Me=t.unstable_NormalPriority,Ne=t.unstable_LowPriority,Pe=t.unstable_IdlePriority,Fe=t.log,Ie=t.unstable_setDisableYieldValue,Le=null,Re=null;function ze(e){if(typeof Fe==`function`&&Ie(e),Re&&typeof Re.setStrictMode==`function`)try{Re.setStrictMode(Le,e)}catch{}}var Be=Math.clz32?Math.clz32:Ue,Ve=Math.log,He=Math.LN2;function Ue(e){return e>>>=0,e===0?32:31-(Ve(e)/He|0)|0}var We=256,Ge=262144,Ke=4194304;function qe(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 Je(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=qe(n))):i=qe(o):i=qe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=qe(n))):i=qe(o)):i=qe(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 Ye(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Xe(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 Ze(){var e=Ke;return Ke<<=1,!(Ke&62914560)&&(Ke=4194304),e}function Qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function $e(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function et(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-Be(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&&tt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function tt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Be(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function nt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Be(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function rt(e,t){var n=t&-t;return n=n&42?1:it(n),(n&(e.suspendedLanes|t))===0?n:0}function it(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 at(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ot(){var e=A.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function st(e,t){var n=A.p;try{return A.p=e,t()}finally{A.p=n}}var ct=Math.random().toString(36).slice(2),lt=`__reactFiber$`+ct,ut=`__reactProps$`+ct,dt=`__reactContainer$`+ct,ft=`__reactEvents$`+ct,pt=`__reactListeners$`+ct,mt=`__reactHandles$`+ct,ht=`__reactResources$`+ct,gt=`__reactMarker$`+ct;function _t(e){delete e[lt],delete e[ut],delete e[ft],delete e[pt],delete e[mt]}function vt(e){var t=e[lt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[dt]||n[lt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[lt])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function yt(e){if(e=e[lt]||e[dt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function bt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function xt(e){var t=e[ht];return t||=e[ht]={hoistableStyles:new Map,hoistableScripts:new Map},t}function St(e){e[gt]=!0}var Ct=new Set,wt={};function Tt(e,t){Et(e,t),Et(e+`Capture`,t)}function Et(e,t){for(wt[e]=t,e=0;e<t.length;e++)Ct.add(t[e])}var Dt=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]*$`),Ot={},kt={};function At(e){return we.call(kt,e)?!0:we.call(Ot,e)?!1:Dt.test(e)?kt[e]=!0:(Ot[e]=!0,!1)}function jt(e,t,n){if(At(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 Mt(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 Nt(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 Pt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Ft(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function It(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 Lt(e){if(!e._valueTracker){var t=Ft(e)?`checked`:`value`;e._valueTracker=It(e,t,``+e[t])}}function Rt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Ft(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function zt(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 Bt=/[\n"\\]/g;function Vt(e){return e.replace(Bt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Ht(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=``+Pt(t)):e.value!==``+Pt(t)&&(e.value=``+Pt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Wt(e,o,Pt(n)):Wt(e,o,Pt(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=``+Pt(s):e.removeAttribute(`name`)}function Ut(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)){Lt(e);return}n=n==null?``:``+Pt(n),t=t==null?n:``+Pt(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),Lt(e)}function Wt(e,t,n){t===`number`&&zt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Gt(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=``+Pt(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 Kt(e,t,n){if(t!=null&&(t=``+Pt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Pt(n)}function qt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(oe(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Pt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Lt(e)}function Jt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yt=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 Xt(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||Yt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Zt(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&&Xt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Xt(e,o,t[o])}function Qt(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 $t=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`]]),en=/^[\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 tn(e){return en.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function nn(){}var rn=null;function an(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var on=null,sn=null;function cn(e){var t=yt(e);if(t&&(e=t.stateNode)){var n=e[ut]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Ht(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="`+Vt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[ut]||null;if(!a)throw Error(i(90));Ht(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&&Rt(r)}break a;case`textarea`:Kt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Gt(e,!!n.multiple,t,!1)}}}var ln=!1;function un(e,t,n){if(ln)return e(t,n);ln=!0;try{return e(t)}finally{if(ln=!1,(on!==null||sn!==null)&&(vu(),on&&(t=on,e=sn,sn=on=null,cn(t),e)))for(t=0;t<e.length;t++)cn(e[t])}}function dn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[ut]||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 fn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),pn=!1;if(fn)try{var mn={};Object.defineProperty(mn,`passive`,{get:function(){pn=!0}}),window.addEventListener(`test`,mn,mn),window.removeEventListener(`test`,mn,mn)}catch{pn=!1}var hn=null,gn=null,_n=null;function vn(){if(_n)return _n;var e,t=gn,n=t.length,r,i=`value`in hn?hn.value:hn.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 _n=i.slice(e,1<r?1-r:void 0)}function yn(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 bn(){return!0}function xn(){return!1}function Sn(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)?bn:xn,this.isPropagationStopped=xn,this}return h(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=bn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=bn)},persist:function(){},isPersistent:bn}),t}var Cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wn=Sn(Cn),Tn=h({},Cn,{view:0,detail:0}),En=Sn(Tn),I,Dn,On,kn=h({},Tn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zn,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!==On&&(On&&e.type===`mousemove`?(I=e.screenX-On.screenX,Dn=e.screenY-On.screenY):Dn=I=0,On=e),I)},movementY:function(e){return`movementY`in e?e.movementY:Dn}}),An=Sn(kn),jn=Sn(h({},kn,{dataTransfer:0})),Mn=Sn(h({},Tn,{relatedTarget:0})),Nn=Sn(h({},Cn,{animationName:0,elapsedTime:0,pseudoElement:0})),Pn=Sn(h({},Cn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Fn=Sn(h({},Cn,{data:0})),In={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},L={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`},Ln={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Rn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ln[e])?!!t[e]:!1}function zn(){return Rn}var Bn=Sn(h({},Tn,{key:function(e){if(e.key){var t=In[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=yn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?L[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zn,charCode:function(e){return e.type===`keypress`?yn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?yn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Vn=Sn(h({},kn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Hn=Sn(h({},Tn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zn})),Un=Sn(h({},Cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),R=Sn(h({},kn,{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})),Wn=Sn(h({},Cn,{newState:0,oldState:0})),Gn=[9,13,27,32],Kn=fn&&`CompositionEvent`in window,qn=null;fn&&`documentMode`in document&&(qn=document.documentMode);var Jn=fn&&`TextEvent`in window&&!qn,Yn=fn&&(!Kn||qn&&8<qn&&11>=qn),Xn=` `,Zn=!1;function Qn(e,t){switch(e){case`keyup`:return Gn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function $n(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var er=!1;function tr(e,t){switch(e){case`compositionend`:return $n(t);case`keypress`:return t.which===32?(Zn=!0,Xn):null;case`textInput`:return e=t.data,e===Xn&&Zn?null:e;default:return null}}function nr(e,t){if(er)return e===`compositionend`||!Kn&&Qn(e,t)?(e=vn(),_n=gn=hn=null,er=!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 Yn&&t.locale!==`ko`?null:t.data;default:return null}}var rr={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 ir(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!rr[e.type]:t===`textarea`}function ar(e,t,n,r){on?sn?sn.push(r):sn=[r]:on=r,t=Td(t,`onChange`),0<t.length&&(n=new wn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var or=null,sr=null;function z(e){vd(e,0)}function cr(e){if(Rt(bt(e)))return e}function lr(e,t){if(e===`change`)return t}var ur=!1;if(fn){var dr;if(fn){var B=`oninput`in document;if(!B){var fr=document.createElement(`div`);fr.setAttribute(`oninput`,`return;`),B=typeof fr.oninput==`function`}dr=B}else dr=!1;ur=dr&&(!document.documentMode||9<document.documentMode)}function V(){or&&(or.detachEvent(`onpropertychange`,H),sr=or=null)}function H(e){if(e.propertyName===`value`&&cr(sr)){var t=[];ar(t,sr,e,an(e)),un(z,t)}}function U(e,t,n){e===`focusin`?(V(),or=t,sr=n,or.attachEvent(`onpropertychange`,H)):e===`focusout`&&V()}function pr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return cr(sr)}function mr(e,t){if(e===`click`)return cr(t)}function hr(e,t){if(e===`input`||e===`change`)return cr(t)}function gr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var W=typeof Object.is==`function`?Object.is:gr;function _r(e,t){if(W(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)||!W(e[i],t[i]))return!1}return!0}function vr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function yr(e,t){var n=vr(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=vr(n)}}function br(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?br(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=zt(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=zt(e.document)}return t}function Sr(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 Cr=fn&&`documentMode`in document&&11>=document.documentMode,wr=null,Tr=null,Er=null,Dr=!1;function Or(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Dr||wr==null||wr!==zt(r)||(r=wr,`selectionStart`in r&&Sr(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}),Er&&_r(Er,r)||(Er=r,r=Td(Tr,`onSelect`),0<r.length&&(t=new wn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=wr)))}function kr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ar={animationend:kr(`Animation`,`AnimationEnd`),animationiteration:kr(`Animation`,`AnimationIteration`),animationstart:kr(`Animation`,`AnimationStart`),transitionrun:kr(`Transition`,`TransitionRun`),transitionstart:kr(`Transition`,`TransitionStart`),transitioncancel:kr(`Transition`,`TransitionCancel`),transitionend:kr(`Transition`,`TransitionEnd`)},jr={},Mr={};fn&&(Mr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ar.animationend.animation,delete Ar.animationiteration.animation,delete Ar.animationstart.animation),`TransitionEvent`in window||delete Ar.transitionend.transition);function Nr(e){if(jr[e])return jr[e];if(!Ar[e])return e;var t=Ar[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Mr)return jr[e]=t[n];return e}var Pr=Nr(`animationend`),Fr=Nr(`animationiteration`),Ir=Nr(`animationstart`),Lr=Nr(`transitionrun`),Rr=Nr(`transitionstart`),zr=Nr(`transitioncancel`),Br=Nr(`transitionend`),Vr=new Map,Hr=`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(` `);Hr.push(`scrollEnd`);function Ur(e,t){Vr.set(e,t),Tt(t,[e])}var Wr=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)},Gr=[],Kr=0,qr=0;function Jr(){for(var e=Kr,t=qr=Kr=0;t<e;){var n=Gr[t];Gr[t++]=null;var r=Gr[t];Gr[t++]=null;var i=Gr[t];Gr[t++]=null;var a=Gr[t];if(Gr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Zr(n,i,a)}}function Yr(e,t,n,r){Gr[Kr++]=e,Gr[Kr++]=t,Gr[Kr++]=n,Gr[Kr++]=r,qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Xr(e,t,n,r){return Yr(e,t,n,r),Qr(e)}function G(e,t){return Yr(e,null,null,t),Qr(e)}function Zr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Be(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Qr(e){if(50<lu)throw lu=0,uu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var $r={};function ei(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(e,t,n,r){return new ei(e,t,n,r)}function ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ri(e,t){var n=e.alternate;return n===null?(n=ti(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ii(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ai(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ni(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,ue.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case te:return e=ti(31,n,t,a),e.elementType=te,e.lanes=o,e;case y:return oi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ti(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ti(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ti(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case ee:s=14;break a;case D:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ti(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function oi(e,t,n,r){return e=ti(7,e,r,t),e.lanes=n,e}function si(e,t,n){return e=ti(6,e,null,t),e.lanes=n,e}function ci(e){var t=ti(18,null,null,0);return t.stateNode=e,t}function li(e,t,n){return t=ti(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ui=new WeakMap;function di(e,t){if(typeof e==`object`&&e){var n=ui.get(e);return n===void 0?(t={value:e,source:t,stack:Ce(t)},ui.set(e,t),t):n}return{value:e,source:t,stack:Ce(t)}}var fi=[],pi=0,mi=null,hi=0,gi=[],_i=0,vi=null,yi=1,bi=``;function xi(e,t){fi[pi++]=hi,fi[pi++]=mi,mi=e,hi=t}function Si(e,t,n){gi[_i++]=yi,gi[_i++]=bi,gi[_i++]=vi,vi=e;var r=yi;e=bi;var i=32-Be(r)-1;r&=~(1<<i),n+=1;var a=32-Be(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,yi=1<<32-Be(t)+i|n<<i|r,bi=a+e}else yi=1<<a|n<<i|r,bi=e}function Ci(e){e.return!==null&&(xi(e,1),Si(e,1,0))}function wi(e){for(;e===mi;)mi=fi[--pi],fi[pi]=null,hi=fi[--pi],fi[pi]=null;for(;e===vi;)vi=gi[--_i],gi[_i]=null,bi=gi[--_i],gi[_i]=null,yi=gi[--_i],gi[_i]=null}function Ti(e,t){gi[_i++]=yi,gi[_i++]=bi,gi[_i++]=vi,yi=t.id,bi=t.overflow,vi=e}var Ei=null,Di=null,K=!1,Oi=null,ki=!1,Ai=Error(i(519));function ji(e){throw Li(di(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ai}function Mi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[lt]=e,t[ut]=r,n){case`dialog`:$(`cancel`,t),$(`close`,t);break;case`iframe`:case`object`:case`embed`:$(`load`,t);break;case`video`:case`audio`:for(n=0;n<gd.length;n++)$(gd[n],t);break;case`source`:$(`error`,t);break;case`img`:case`image`:case`link`:$(`error`,t),$(`load`,t);break;case`details`:$(`toggle`,t);break;case`input`:$(`invalid`,t),Ut(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$(`invalid`,t);break;case`textarea`:$(`invalid`,t),qt(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||jd(t.textContent,n)?(r.popover!=null&&($(`beforetoggle`,t),$(`toggle`,t)),r.onScroll!=null&&$(`scroll`,t),r.onScrollEnd!=null&&$(`scrollend`,t),r.onClick!=null&&(t.onclick=nn),t=!0):t=!1,t||ji(e,!0)}function Ni(e){for(Ei=e.return;Ei;)switch(Ei.tag){case 5:case 31:case 13:ki=!1;return;case 27:case 3:ki=!0;return;default:Ei=Ei.return}}function Pi(e){if(e!==Ei)return!1;if(!K)return Ni(e),K=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Ud(e.type,e.memoizedProps)),n=!n),n&&Di&&ji(e),Ni(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Di=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Di=uf(e)}else t===27?(t=Di,Zd(e.type)?(e=lf,lf=null,Di=e):Di=t):Di=Ei?cf(e.stateNode.nextSibling):null;return!0}function Fi(){Di=Ei=null,K=!1}function Ii(){var e=Oi;return e!==null&&(Yl===null?Yl=e:Yl.push.apply(Yl,e),Oi=null),e}function Li(e){Oi===null?Oi=[e]:Oi.push(e)}var Ri=j(null),zi=null,Bi=null;function Vi(e,t,n){N(Ri,t._currentValue),t._currentValue=n}function Hi(e){e._currentValue=Ri.current,M(Ri)}function Ui(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 Wi(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),Ui(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),Ui(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Gi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;W(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=[Qf]:e.push(Qf))}a=a.return}e!==null&&Wi(t,e,n,r),t.flags|=262144}function Ki(e){for(e=e.firstContext;e!==null;){if(!W(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function qi(e){zi=e,Bi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ji(e){return Xi(zi,e)}function Yi(e,t){return zi===null&&qi(e),Xi(e,t)}function Xi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Bi===null){if(e===null)throw Error(i(308));Bi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Bi=Bi.next=t;return n}var Zi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Qi=t.unstable_scheduleCallback,$i=t.unstable_NormalPriority,ea={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ta(){return{controller:new Zi,data:new Map,refCount:0}}function na(e){e.refCount--,e.refCount===0&&Qi($i,function(){e.controller.abort()})}var ra=null,ia=0,aa=0,oa=null;function sa(e,t){if(ra===null){var n=ra=[];ia=0,aa=ud(),oa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ia++,t.then(ca,ca),t}function ca(){if(--ia===0&&ra!==null){oa!==null&&(oa.status=`fulfilled`);var e=ra;ra=null,aa=0,oa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function la(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ua=k.S;k.S=function(e,t){Ql=ke(),typeof t==`object`&&t&&typeof t.then==`function`&&sa(e,t),ua!==null&&ua(e,t)};var da=j(null);function fa(){var e=da.current;return e===null?Il.pooledCache:e}function pa(e,t){t===null?N(da,da.current):N(da,t.pool)}function ma(){var e=fa();return e===null?null:{parent:ea._currentValue,pool:e}}var ha=Error(i(460)),ga=Error(i(474)),_a=Error(i(542)),va={then:function(){}};function ya(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ba(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(nn,nn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e;default:if(typeof t.status==`string`)t.then(nn,nn);else{if(e=Il,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e}throw Sa=t,ha}}function xa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Sa=e,ha):e}}var Sa=null;function Ca(){if(Sa===null)throw Error(i(459));var e=Sa;return Sa=null,e}function wa(e){if(e===ha||e===_a)throw Error(i(483))}var Ta=null,Ea=0;function Da(e){var t=Ea;return Ea+=1,Ta===null&&(Ta=[]),ba(Ta,e,t)}function Oa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ka(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Aa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ri(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=si(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===D&&xa(i)===t.type)?(t=a(t,n.props),Oa(t,n),t.return=e,t):(t=ai(n.type,n.key,n.props,null,e.mode,r),Oa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=li(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=oi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=si(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ai(t.type,t.key,t.props,null,e.mode,n),Oa(n,t),n.return=e,n;case v:return t=li(t,e.mode,n),t.return=e,t;case D:return t=xa(t),f(e,t,n)}if(oe(t)||re(t))return t=oi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Da(t),n);if(t.$$typeof===C)return f(e,Yi(e,t),n);ka(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case D:return n=xa(n),p(e,t,n,r)}if(oe(n)||re(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Da(n),r);if(n.$$typeof===C)return p(e,t,Yi(e,n),r);ka(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case D:return r=xa(r),m(e,t,n,r,i)}if(oe(r)||re(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Da(r),i);if(r.$$typeof===C)return m(e,t,n,Yi(t,r),i);ka(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),K&&xi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return K&&xi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),K&&xi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),K&&xi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return K&&xi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),K&&xi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===D&&xa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Oa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=oi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ai(o.type,o.key,o.props,null,e.mode,c),Oa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=li(o,e.mode,c),c.return=e,e=c}return s(e);case D:return o=xa(o),b(e,r,o,c)}if(oe(o))return h(e,r,o,c);if(re(o)){if(l=re(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Da(o),c);if(o.$$typeof===C)return b(e,r,Yi(e,o),c);ka(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=si(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ea=0;var i=b(e,t,n,r);return Ta=null,i}catch(t){if(t===ha||t===_a)throw t;var a=ti(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ja=Aa(!0),Ma=Aa(!1),Na=!1;function Pa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ia(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function La(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Y&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Qr(e),Zr(e,null,n),t}return Yr(e,r,t,n),Qr(e)}function Ra(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nt(e,n)}}function za(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ba=!1;function Va(){if(Ba){var e=oa;if(e!==null)throw e}}function Ha(e,t,n,r){Ba=!1;var i=e.updateQueue;Na=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Z&f)===f:(r&f)===f){f!==0&&f===aa&&(Ba=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Na=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ul|=o,e.lanes=o,e.memoizedState=d}}function Ua(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Wa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ua(n[e],t)}var Ga=j(null),Ka=j(0);function qa(e,t){e=Vl,N(Ka,e),N(Ga,t),Vl=e|t.baseLanes}function Ja(){N(Ka,Vl),N(Ga,Ga.current)}function Ya(){Vl=Ka.current,M(Ga),M(Ka)}var Xa=j(null),Za=null;function Qa(e){var t=e.alternate;N(ro,ro.current&1),N(Xa,e),Za===null&&(t===null||Ga.current!==null||t.memoizedState!==null)&&(Za=e)}function $a(e){N(ro,ro.current),N(Xa,e),Za===null&&(Za=e)}function eo(e){e.tag===22?(N(ro,ro.current),N(Xa,e),Za===null&&(Za=e)):to(e)}function to(){N(ro,ro.current),N(Xa,Xa.current)}function no(e){M(Xa),Za===e&&(Za=null),M(ro)}var ro=j(0);function io(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ao=0,q=null,J=null,oo=null,so=!1,co=!1,lo=!1,uo=0,fo=0,po=null,mo=0;function ho(){throw Error(i(321))}function go(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!W(e[n],t[n]))return!1;return!0}function _o(e,t,n,r,i,a){return ao=a,q=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?Ps:Fs,lo=!1,a=n(r,i),lo=!1,co&&(a=yo(t,n,r,i)),vo(e),a}function vo(e){k.H=Ns;var t=J!==null&&J.next!==null;if(ao=0,oo=J=q=null,so=!1,fo=0,po=null,t)throw Error(i(300));e===null||Qs||(e=e.dependencies,e!==null&&Ki(e)&&(Qs=!0))}function yo(e,t,n,r){q=e;var a=0;do{if(co&&(po=null),fo=0,co=!1,25<=a)throw Error(i(301));if(a+=1,oo=J=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}k.H=Is,o=t(n,r)}while(co);return o}function bo(){var e=k.H,t=e.useState()[0];return t=typeof t.then==`function`?Do(t):t,e=e.useState()[0],(J===null?null:J.memoizedState)!==e&&(q.flags|=1024),t}function xo(){var e=uo!==0;return uo=0,e}function So(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Co(e){if(so){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}so=!1}ao=0,oo=J=q=null,co=!1,fo=uo=0,po=null}function wo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return oo===null?q.memoizedState=oo=e:oo=oo.next=e,oo}function To(){if(J===null){var e=q.alternate;e=e===null?null:e.memoizedState}else e=J.next;var t=oo===null?q.memoizedState:oo.next;if(t!==null)oo=t,J=e;else{if(e===null)throw q.alternate===null?Error(i(467)):Error(i(310));J=e,e={memoizedState:J.memoizedState,baseState:J.baseState,baseQueue:J.baseQueue,queue:J.queue,next:null},oo===null?q.memoizedState=oo=e:oo=oo.next=e}return oo}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Do(e){var t=fo;return fo+=1,po===null&&(po=[]),e=ba(po,e,t),t=q,(oo===null?t.memoizedState:oo.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?Ps:Fs),e}function Oo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Do(e);if(e.$$typeof===C)return Ji(e)}throw Error(i(438,String(e)))}function ko(e){var t=null,n=q.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=q.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=Eo(),q.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]=ne;return t.index++,n}function Ao(e,t){return typeof t==`function`?t(e):t}function jo(e){return Mo(To(),J,e)}function Mo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ao&f)===f:(Z&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===aa&&(d=!0);else if((ao&p)===p){u=u.next,p===aa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,q.lanes|=p,Ul|=p;f=u.action,lo&&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,q.lanes|=f,Ul|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!W(o,e.memoizedState)&&(Qs=!0,d&&(n=oa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function No(e){var t=To(),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);W(o,t.memoizedState)||(Qs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Po(e,t,n){var r=q,a=To(),o=K;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!W((J||a).memoizedState,n);if(s&&(a.memoizedState=n,Qs=!0),a=a.queue,as(Lo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||oo!==null&&oo.memoizedState.tag&1){if(r.flags|=2048,es(9,{destroy:void 0},Io.bind(null,r,a,n,t),null),Il===null)throw Error(i(349));o||ao&127||Fo(r,t,n)}return n}function Fo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=q.updateQueue,t===null?(t=Eo(),q.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Io(e,t,n,r){t.value=n,t.getSnapshot=r,Ro(t)&&zo(e)}function Lo(e,t,n){return n(function(){Ro(t)&&zo(e)})}function Ro(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!W(e,n)}catch{return!0}}function zo(e){var t=G(e,2);t!==null&&pu(t,e,2)}function Bo(e){var t=wo();if(typeof e==`function`){var n=e;if(e=n(),lo){ze(!0);try{n()}finally{ze(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:e},t}function Vo(e,t,n,r){return e.baseState=n,Mo(e,J,typeof r==`function`?r:Ao)}function Ho(e,t,n,r,a){if(As(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)}};k.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Uo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Uo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=k.T,o={};k.T=o;try{var s=n(i,r),c=k.S;c!==null&&c(o,s),Wo(e,t,s)}catch(n){Ko(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),k.T=a}}else try{a=n(i,r),Wo(e,t,a)}catch(n){Ko(e,t,n)}}function Wo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Go(e,t,n)},function(n){return Ko(e,t,n)}):Go(e,t,n)}function Go(e,t,n){t.status=`fulfilled`,t.value=n,qo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Uo(e,n)))}function Ko(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,qo(t),t=t.next;while(t!==r)}e.action=null}function qo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Jo(e,t){return t}function Yo(e,t){if(K){var n=Il.formState;if(n!==null){a:{var r=q;if(K){if(Di){b:{for(var i=Di,a=ki;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Di=cf(i.nextSibling),r=i.data===`F!`;break a}}ji(r)}r=!1}r&&(t=n[0])}}return n=wo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jo,lastRenderedState:t},n.queue=r,n=Ds.bind(null,q,r),r.dispatch=n,r=Bo(!1),a=ks.bind(null,q,!1,r.queue),r=wo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ho.bind(null,q,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Xo(e){return Zo(To(),J,e)}function Zo(e,t,n){if(t=Mo(e,t,Jo)[0],e=jo(Ao)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Do(t)}catch(e){throw e===ha?_a:e}else r=t;t=To();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(q.flags|=2048,es(9,{destroy:void 0},Qo.bind(null,i,n),null)),[r,a,e]}function Qo(e,t){e.action=t}function $o(e){var t=To(),n=J;if(n!==null)return Zo(t,n,e);To(),t=t.memoizedState,n=To();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function es(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=q.updateQueue,t===null&&(t=Eo(),q.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 ts(){return To().memoizedState}function ns(e,t,n,r){var i=wo();q.flags|=e,i.memoizedState=es(1|t,{destroy:void 0},n,r===void 0?null:r)}function rs(e,t,n,r){var i=To();r=r===void 0?null:r;var a=i.memoizedState.inst;J!==null&&r!==null&&go(r,J.memoizedState.deps)?i.memoizedState=es(t,a,n,r):(q.flags|=e,i.memoizedState=es(1|t,a,n,r))}function is(e,t){ns(8390656,8,e,t)}function as(e,t){rs(2048,8,e,t)}function os(e){q.flags|=4;var t=q.updateQueue;if(t===null)t=Eo(),q.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ss(e){var t=To().memoizedState;return os({ref:t,nextImpl:e}),function(){if(Y&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function cs(e,t){return rs(4,2,e,t)}function ls(e,t){return rs(4,4,e,t)}function us(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 ds(e,t,n){n=n==null?null:n.concat([e]),rs(4,4,us.bind(null,t,e),n)}function fs(){}function ps(e,t){var n=To();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&go(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ms(e,t){var n=To();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&go(t,r[1]))return r[0];if(r=e(),lo){ze(!0);try{e()}finally{ze(!1)}}return n.memoizedState=[r,t],r}function hs(e,t,n){return n===void 0||ao&1073741824&&!(Z&261930)?e.memoizedState=t:(e.memoizedState=n,e=fu(),q.lanes|=e,Ul|=e,n)}function gs(e,t,n,r){return W(n,t)?n:Ga.current===null?!(ao&42)||ao&1073741824&&!(Z&261930)?(Qs=!0,e.memoizedState=n):(e=fu(),q.lanes|=e,Ul|=e,t):(e=hs(e,n,r),W(e,t)||(Qs=!0),e)}function _s(e,t,n,r,i){var a=A.p;A.p=a!==0&&8>a?a:8;var o=k.T,s={};k.T=s,ks(e,!1,t,n);try{var c=i(),l=k.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Os(e,t,la(c,r),du(e)):Os(e,t,r,du(e))}catch(n){Os(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{A.p=a,o!==null&&s.types!==null&&(o.types=s.types),k.T=o}}function vs(){}function ys(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=bs(e).queue;_s(e,a,t,se,n===null?vs:function(){return xs(e),n(r)})}function bs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:se},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function xs(e){var t=bs(e);t.next===null&&(t=e.alternate.memoizedState),Os(e,t.next.queue,{},du())}function Ss(){return Ji(Qf)}function Cs(){return To().memoizedState}function ws(){return To().memoizedState}function Ts(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=du();e=Ia(n);var r=La(t,e,n);r!==null&&(pu(r,t,n),Ra(r,t,n)),t={cache:ta()},e.payload=t;return}t=t.return}}function Es(e,t,n){var r=du();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},As(e)?js(t,n):(n=Xr(e,t,n,r),n!==null&&(pu(n,e,r),Ms(n,t,r)))}function Ds(e,t,n){Os(e,t,n,du())}function Os(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(As(e))js(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,W(s,o))return Yr(e,t,i,0),Il===null&&Jr(),!1}catch{}if(n=Xr(e,t,i,r),n!==null)return pu(n,e,r),Ms(n,t,r),!0}return!1}function ks(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},As(e)){if(t)throw Error(i(479))}else t=Xr(e,n,r,2),t!==null&&pu(t,e,2)}function As(e){var t=e.alternate;return e===q||t!==null&&t===q}function js(e,t){co=so=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ms(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nt(e,n)}}var Ns={readContext:Ji,use:Oo,useCallback:ho,useContext:ho,useEffect:ho,useImperativeHandle:ho,useLayoutEffect:ho,useInsertionEffect:ho,useMemo:ho,useReducer:ho,useRef:ho,useState:ho,useDebugValue:ho,useDeferredValue:ho,useTransition:ho,useSyncExternalStore:ho,useId:ho,useHostTransitionStatus:ho,useFormState:ho,useActionState:ho,useOptimistic:ho,useMemoCache:ho,useCacheRefresh:ho};Ns.useEffectEvent=ho;var Ps={readContext:Ji,use:Oo,useCallback:function(e,t){return wo().memoizedState=[e,t===void 0?null:t],e},useContext:Ji,useEffect:is,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ns(4194308,4,us.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ns(4194308,4,e,t)},useInsertionEffect:function(e,t){ns(4,2,e,t)},useMemo:function(e,t){var n=wo();t=t===void 0?null:t;var r=e();if(lo){ze(!0);try{e()}finally{ze(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=wo();if(n!==void 0){var i=n(t);if(lo){ze(!0);try{n(t)}finally{ze(!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=Es.bind(null,q,e),[r.memoizedState,e]},useRef:function(e){var t=wo();return e={current:e},t.memoizedState=e},useState:function(e){e=Bo(e);var t=e.queue,n=Ds.bind(null,q,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:fs,useDeferredValue:function(e,t){return hs(wo(),e,t)},useTransition:function(){var e=Bo(!1);return e=_s.bind(null,q,e.queue,!0,!1),wo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=q,a=wo();if(K){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Il===null)throw Error(i(349));Z&127||Fo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,is(Lo.bind(null,r,o,e),[e]),r.flags|=2048,es(9,{destroy:void 0},Io.bind(null,r,o,n,t),null),n},useId:function(){var e=wo(),t=Il.identifierPrefix;if(K){var n=bi,r=yi;n=(r&~(1<<32-Be(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=uo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=mo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ss,useFormState:Yo,useActionState:Yo,useOptimistic:function(e){var t=wo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ks.bind(null,q,!0,n),n.dispatch=t,[e,t]},useMemoCache:ko,useCacheRefresh:function(){return wo().memoizedState=Ts.bind(null,q)},useEffectEvent:function(e){var t=wo(),n={impl:e};return t.memoizedState=n,function(){if(Y&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Fs={readContext:Ji,use:Oo,useCallback:ps,useContext:Ji,useEffect:as,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:jo,useRef:ts,useState:function(){return jo(Ao)},useDebugValue:fs,useDeferredValue:function(e,t){return gs(To(),J.memoizedState,e,t)},useTransition:function(){var e=jo(Ao)[0],t=To().memoizedState;return[typeof e==`boolean`?e:Do(e),t]},useSyncExternalStore:Po,useId:Cs,useHostTransitionStatus:Ss,useFormState:Xo,useActionState:Xo,useOptimistic:function(e,t){return Vo(To(),J,e,t)},useMemoCache:ko,useCacheRefresh:ws};Fs.useEffectEvent=ss;var Is={readContext:Ji,use:Oo,useCallback:ps,useContext:Ji,useEffect:as,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:No,useRef:ts,useState:function(){return No(Ao)},useDebugValue:fs,useDeferredValue:function(e,t){var n=To();return J===null?hs(n,e,t):gs(n,J.memoizedState,e,t)},useTransition:function(){var e=No(Ao)[0],t=To().memoizedState;return[typeof e==`boolean`?e:Do(e),t]},useSyncExternalStore:Po,useId:Cs,useHostTransitionStatus:Ss,useFormState:$o,useActionState:$o,useOptimistic:function(e,t){var n=To();return J===null?(n.baseState=e,[e,n.queue.dispatch]):Vo(n,J,e,t)},useMemoCache:ko,useCacheRefresh:ws};Is.useEffectEvent=ss;function Ls(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Rs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=du(),i=Ia(r);i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(pu(t,e,r),Ra(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=du(),i=Ia(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(pu(t,e,r),Ra(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=du(),r=Ia(n);r.tag=2,t!=null&&(r.callback=t),t=La(e,r,n),t!==null&&(pu(t,e,n),Ra(t,e,n))}};function zs(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?!_r(n,r)||!_r(i,a):!0}function Bs(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&&Rs.enqueueReplaceState(t,t.state,null)}function Vs(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=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Hs(e){Wr(e)}function Us(e){console.error(e)}function Ws(e){Wr(e)}function Gs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ks(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 qs(e,t,n){return n=Ia(n),n.tag=3,n.payload={element:null},n.callback=function(){Gs(e,t)},n}function Js(e){return e=Ia(e),e.tag=3,e}function Ys(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(){Ks(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ks(t,n,r),typeof i!=`function`&&(tu===null?tu=new Set([this]):tu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Xs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Gi(t,n,a,!0),n=Xa.current,n!==null){switch(n.tag){case 31:case 13:return Za===null?Tu():n.alternate===null&&Hl===0&&(Hl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===va?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Wu(e,r,a)),!1;case 22:return n.flags|=65536,r===va?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Wu(e,r,a)),!1}throw Error(i(435,n.tag))}return Wu(e,r,a),Tu(),!1}if(K)return t=Xa.current,t===null?(r!==Ai&&(t=Error(i(423),{cause:r}),Li(di(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=di(r,n),a=qs(e.stateNode,r,a),za(e,a),Hl!==4&&(Hl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ai&&(e=Error(i(422),{cause:r}),Li(di(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=di(o,n),Jl===null?Jl=[o]:Jl.push(o),Hl!==4&&(Hl=2),t===null)return!0;r=di(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=qs(n.stateNode,r,e),za(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(tu===null||!tu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Js(a),Ys(a,e,n,r),za(n,a),!1}n=n.return}while(n!==null);return!1}var Zs=Error(i(461)),Qs=!1;function $s(e,t,n,r){t.child=e===null?Ma(t,null,n,r):ja(t,e.child,n,r)}function ec(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return qi(t),r=_o(e,t,n,o,a,i),s=xo(),e!==null&&!Qs?(So(e,t,i),wc(e,t,i)):(K&&s&&Ci(t),t.flags|=1,$s(e,t,r,i),t.child)}function tc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ni(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,nc(e,t,a,r,i)):(e=ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Tc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?_r:n,n(o,r)&&e.ref===t.ref)return wc(e,t,i)}return t.flags|=1,e=ri(a,r),e.ref=t.ref,e.return=t,t.child=e}function nc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(_r(a,r)&&e.ref===t.ref)if(Qs=!1,t.pendingProps=r=a,Tc(e,i))e.flags&131072&&(Qs=!0);else return t.lanes=e.lanes,wc(e,t,i)}return uc(e,t,n,r,i)}function rc(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 ac(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pa(t,a===null?null:a.cachePool),a===null?Ja():qa(t,a),eo(t);else return r=t.lanes=536870912,ac(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&pa(t,null),Ja(),to(t)):(pa(t,a.cachePool),qa(t,a),to(t),t.memoizedState=null);return $s(e,t,i,n),t.child}function ic(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ac(e,t,n,r,i){var a=fa();return a=a===null?null:{parent:ea._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&pa(t,null),Ja(),eo(t),e!==null&&Gi(e,t,r,!0),t.childLanes=i,null}function oc(e,t){return t=yc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function sc(e,t,n){return ja(t,e.child,null,n),e=oc(t,t.pendingProps),e.flags|=2,no(t),t.memoizedState=null,e}function cc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(K){if(r.mode===`hidden`)return e=oc(t,r),t.lanes=536870912,ic(null,e);if($a(t),(e=Di)?(e=rf(e,ki),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vi===null?null:{id:yi,overflow:bi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,Ei=t,Di=null)):e=null,e===null)throw ji(t);return t.lanes=536870912,null}return oc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if($a(t),a)if(t.flags&256)t.flags&=-257,t=sc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(Qs||Gi(e,t,n,!1),a=(n&e.childLanes)!==0,Qs||a){if(r=Il,r!==null&&(s=rt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,G(e,s),pu(r,e,s),Zs;Tu(),t=sc(e,t,n)}else e=o.treeContext,Di=cf(s.nextSibling),Ei=t,K=!0,Oi=null,ki=!1,e!==null&&Ti(t,e),t=oc(t,r),t.flags|=4096;return t}return e=ri(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function lc(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 uc(e,t,n,r,i){return qi(t),n=_o(e,t,n,r,void 0,i),r=xo(),e!==null&&!Qs?(So(e,t,i),wc(e,t,i)):(K&&r&&Ci(t),t.flags|=1,$s(e,t,n,i),t.child)}function dc(e,t,n,r,i,a){return qi(t),t.updateQueue=null,n=yo(t,r,n,i),vo(e),r=xo(),e!==null&&!Qs?(So(e,t,a),wc(e,t,a)):(K&&r&&Ci(t),t.flags|=1,$s(e,t,n,a),t.child)}function fc(e,t,n,r,i){if(qi(t),t.stateNode===null){var a=$r,o=n.contextType;typeof o==`object`&&o&&(a=Ji(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Rs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Pa(t),o=n.contextType,a.context=typeof o==`object`&&o?Ji(o):$r,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ls(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&&Rs.enqueueReplaceState(a,a.state,null),Ha(t,r,a,i),Va(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Vs(n,s);a.props=c;var l=a.context,u=n.contextType;o=$r,typeof u==`object`&&u&&(o=Ji(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Bs(t,a,r,o),Na=!1;var f=t.memoizedState;a.state=f,Ha(t,r,a,i),Va(),l=t.memoizedState,s||f!==l||Na?(typeof d==`function`&&(Ls(t,n,d,r),l=t.memoizedState),(c=Na||zs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Fa(e,t),o=t.memoizedProps,u=Vs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=$r,typeof l==`object`&&l&&(c=Ji(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Bs(t,a,r,c),Na=!1,f=t.memoizedState,a.state=f,Ha(t,r,a,i),Va();var p=t.memoizedState;o!==d||f!==p||Na||e!==null&&e.dependencies!==null&&Ki(e.dependencies)?(typeof s==`function`&&(Ls(t,n,s,r),p=t.memoizedState),(u=Na||zs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ki(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,lc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ja(t,e.child,null,i),t.child=ja(t,null,n,i)):$s(e,t,n,i),t.memoizedState=a.state,e=t.child):e=wc(e,t,i),e}function pc(e,t,n,r){return Fi(),t.flags|=256,$s(e,t,n,r),t.child}var mc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hc(e){return{baseLanes:e,cachePool:ma()}}function gc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Kl),e}function _c(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(ro.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(K){if(a?Qa(t):to(t),(e=Di)?(e=rf(e,ki),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vi===null?null:{id:yi,overflow:bi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,Ei=t,Di=null)):e=null,e===null)throw ji(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(to(t),a=t.mode,c=yc({mode:`hidden`,children:c},a),r=oi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(null,r)):(Qa(t),vc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Qa(t),t.flags&=-257,t=bc(e,t,n)):t.memoizedState===null?(to(t),c=r.fallback,a=t.mode,r=yc({mode:`visible`,children:r.children},a),c=oi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,ja(t,e.child,null,n),r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,t=ic(null,r)):(to(t),t.child=e.child,t.flags|=128,t=null);else if(Qa(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Li({value:r,source:null,stack:null}),t=bc(e,t,n)}else if(Qs||Gi(e,t,n,!1),s=(n&e.childLanes)!==0,Qs||s){if(s=Il,s!==null&&(r=rt(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,G(e,r),pu(s,e,r),Zs;af(c)||Tu(),t=bc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Di=cf(c.nextSibling),Ei=t,K=!0,Oi=null,ki=!1,e!==null&&Ti(t,e),t=vc(t,r.children),t.flags|=4096);return t}return a?(to(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ri(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=oi(c,a,n,null),c.flags|=2):c=ri(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ic(null,r),r=t.child,c=e.child.memoizedState,c===null?c=hc(n):(a=c.cachePool,a===null?a=ma():(l=ea._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(e.child,r)):(Qa(t),n=e.child,e=n.sibling,n=ri(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function vc(e,t){return t=yc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function yc(e,t){return e=ti(22,e,null,t),e.lanes=0,e}function bc(e,t,n){return ja(t,e.child,null,n),e=vc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ui(e.return,t,n)}function Sc(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 Cc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ro.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,N(ro,o),$s(e,t,r,n),r=K?hi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xc(e,n,t);else if(e.tag===19)xc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&io(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Sc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&io(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Sc(t,!0,n,null,a,r);break;case`together`:Sc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function wc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ul|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Gi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ri(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ri(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Tc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Ki(e))):!0}function Ec(e,t,n){switch(t.tag){case 3:pe(t,t.stateNode.containerInfo),Vi(t,ea,e.memoizedState.cache),Fi();break;case 27:case 5:he(t);break;case 4:pe(t,t.stateNode.containerInfo);break;case 10:Vi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,$a(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Qa(t),e=wc(e,t,n),e===null?null:e.sibling):_c(e,t,n):(Qa(t),t.flags|=128,null);Qa(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Gi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Cc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),N(ro,ro.current),r)break;return null;case 22:return t.lanes=0,rc(e,t,n,t.pendingProps);case 24:Vi(t,ea,e.memoizedState.cache)}return wc(e,t,n)}function Dc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Qs=!0;else{if(!Tc(e,n)&&!(t.flags&128))return Qs=!1,Ec(e,t,n);Qs=!!(e.flags&131072)}else Qs=!1,K&&t.flags&1048576&&Si(t,hi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=xa(t.elementType),t.type=e,typeof e==`function`)ni(e)?(r=Vs(e,r),t.tag=1,t=fc(null,t,e,r,n)):(t.tag=0,t=uc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=ec(null,t,e,r,n);break a}else if(a===ee){t.tag=14,t=tc(null,t,e,r,n);break a}}throw t=ae(e)||e,Error(i(306,t,``))}}return t;case 0:return uc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Vs(r,t.pendingProps),fc(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,Fa(e,t),Ha(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Vi(t,ea,r),r!==o.cache&&Wi(t,[ea],n,!0),Va(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=pc(e,t,r,n);break a}else if(r!==a){a=di(Error(i(424)),t),Li(a),t=pc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Di=cf(e.firstChild),Ei=t,K=!0,Oi=null,ki=!0,n=Ma(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Fi(),r===a){t=wc(e,t,n);break a}$s(e,t,r,n)}t=t.child}return t;case 26:return lc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:K||(n=t.type,e=t.pendingProps,r=Bd(de.current).createElement(n),r[lt]=t,r[ut]=e,Pd(r,n,e),St(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return he(t),e===null&&K&&(r=t.stateNode=ff(t.type,t.pendingProps,de.current),Ei=t,ki=!0,a=Di,Zd(t.type)?(lf=a,Di=cf(r.firstChild)):Di=a),$s(e,t,t.pendingProps.children,n),lc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&K&&((a=r=Di)&&(r=tf(r,t.type,t.pendingProps,ki),r===null?a=!1:(t.stateNode=r,Ei=t,Di=cf(r.firstChild),ki=!1,a=!0)),a||ji(t)),he(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Ud(a,o)?r=null:s!==null&&Ud(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=_o(e,t,bo,null,null,n),Qf._currentValue=a),lc(e,t),$s(e,t,r,n),t.child;case 6:return e===null&&K&&((e=n=Di)&&(n=nf(n,t.pendingProps,ki),n===null?e=!1:(t.stateNode=n,Ei=t,Di=null,e=!0)),e||ji(t)),null;case 13:return _c(e,t,n);case 4:return pe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ja(t,null,r,n):$s(e,t,r,n),t.child;case 11:return ec(e,t,t.type,t.pendingProps,n);case 7:return $s(e,t,t.pendingProps,n),t.child;case 8:return $s(e,t,t.pendingProps.children,n),t.child;case 12:return $s(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Vi(t,t.type,r.value),$s(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,qi(t),a=Ji(a),r=r(a),t.flags|=1,$s(e,t,r,n),t.child;case 14:return tc(e,t,t.type,t.pendingProps,n);case 15:return nc(e,t,t.type,t.pendingProps,n);case 19:return Cc(e,t,n);case 31:return cc(e,t,n);case 22:return rc(e,t,n,t.pendingProps);case 24:return qi(t),r=Ji(ea),e===null?(a=fa(),a===null&&(a=Il,o=ta(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Pa(t),Vi(t,ea,a)):((e.lanes&n)!==0&&(Fa(e,t),Ha(t,null,null,n),Va()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Vi(t,ea,r),r!==a.cache&&Wi(t,[ea],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Vi(t,ea,r))),$s(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Oc(e){e.flags|=4}function kc(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(Su())e.flags|=8192;else throw Sa=va,ga}else e.flags&=-16777217}function Ac(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t))if(Su())e.flags|=8192;else throw Sa=va,ga}function jc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ze(),e.lanes|=t,ql|=t)}function Mc(e,t){if(!K)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 Nc(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 Pc(e,t,n){var r=t.pendingProps;switch(wi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nc(t),null;case 1:return Nc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Hi(ea),me(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Pi(t)?Oc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ii())),Nc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Oc(t),o===null?(Nc(t),kc(t,a,null,r,n)):(Nc(t),Ac(t,o))):o?o===e.memoizedState?(Nc(t),t.flags&=-16777217):(Oc(t),Nc(t),Ac(t,o)):(e=e.memoizedProps,e!==r&&Oc(t),Nc(t),kc(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&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}e=ue.current,Pi(t)?Mi(t,e):(e=ff(a,r,n),t.stateNode=e,Oc(t))}return Nc(t),null;case 5:if(ge(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}if(o=ue.current,Pi(t))Mi(t,o);else{var s=Bd(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[lt]=t,o[ut]=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(Pd(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&&Oc(t)}}return Nc(t),kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=de.current,Pi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ei,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[lt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||ji(t,!0)}else e=Bd(e).createTextNode(r),e[lt]=t,t.stateNode=e}return Nc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Pi(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[lt]=t}else Fi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),e=!1}else n=Ii(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(no(t),t):(no(t),null);if(t.flags&128)throw Error(i(558))}return Nc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Pi(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[lt]=t}else Fi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),a=!1}else a=Ii(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(no(t),t):(no(t),null)}return no(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),jc(t,t.updateQueue),Nc(t),null);case 4:return me(),e===null&&xd(t.stateNode.containerInfo),Nc(t),null;case 10:return Hi(t.type),Nc(t),null;case 19:if(M(ro),r=t.memoizedState,r===null)return Nc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Mc(r,!1);else{if(Hl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=io(e),o!==null){for(t.flags|=128,Mc(r,!1),e=o.updateQueue,t.updateQueue=e,jc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ii(n,e),n=n.sibling;return N(ro,ro.current&1|2),K&&xi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ke()>$l&&(t.flags|=128,a=!0,Mc(r,!1),t.lanes=4194304)}else{if(!a)if(e=io(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,jc(t,e),Mc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!K)return Nc(t),null}else 2*ke()-r.renderingStartTime>$l&&n!==536870912&&(t.flags|=128,a=!0,Mc(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?(Nc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ke(),e.sibling=null,n=ro.current,N(ro,a?n&1|2:n&1),K&&xi(t,r.treeForkCount),e);case 22:case 23:return no(t),Ya(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Nc(t),t.subtreeFlags&6&&(t.flags|=8192)):Nc(t),n=t.updateQueue,n!==null&&jc(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&&M(da),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Hi(ea),Nc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Fc(e,t){switch(wi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hi(ea),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(no(t),t.alternate===null)throw Error(i(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(no(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(ro),null;case 4:return me(),null;case 10:return Hi(t.type),null;case 22:case 23:return no(t),Ya(),e!==null&&M(da),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Hi(ea),null;case 25:return null;default:return null}}function Ic(e,t){switch(wi(t),t.tag){case 3:Hi(ea),me();break;case 26:case 27:case 5:ge(t);break;case 4:me();break;case 31:t.memoizedState!==null&&no(t);break;case 13:no(t);break;case 19:M(ro);break;case 10:Hi(t.type);break;case 22:case 23:no(t),Ya(),e!==null&&M(da);break;case 24:Hi(ea)}}function Lc(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){Uu(t,t.return,e)}}function Rc(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){Uu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Uu(t,t.return,e)}}function zc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Wa(t,n)}catch(t){Uu(e,e.return,t)}}}function Bc(e,t,n){n.props=Vs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function Vc(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){Uu(e,t,n)}}function Hc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Uu(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){Uu(e,t,n)}else n.current=null}function Uc(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){Uu(e,e.return,t)}}function Wc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[ut]=t}catch(t){Uu(e,e.return,t)}}function Gc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Gc(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&&Zd(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 qc(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=nn));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(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&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[lt]=e,t[ut]=n}catch(t){Uu(e,e.return,t)}}var Xc=!1,Zc=!1,Qc=!1,$c=typeof WeakSet==`function`?WeakSet:Set,el=null;function tl(e,t){if(e=e.containerInfo,Rd=sp,e=xr(e),Sr(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(zd={focusedElem:e,selectionRange:n},sp=!1,el=t;el!==null;)if(t=el,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,el=e;else for(;el!==null;){switch(t=el,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=Vs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Uu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(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,el=e;break}el=t.return}}function nl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:_l(e,n),r&4&&Lc(5,n);break;case 1:if(_l(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Uu(n,n.return,e)}else{var i=Vs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Uu(n,n.return,e)}}r&64&&zc(n),r&512&&Vc(n,n.return);break;case 3:if(_l(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Wa(e,t)}catch(e){Uu(n,n.return,e)}}break;case 27:t===null&&r&4&&Yc(n);case 26:case 5:_l(e,n),t===null&&r&4&&Uc(n),r&512&&Vc(n,n.return);break;case 12:_l(e,n);break;case 31:_l(e,n),r&4&&cl(e,n);break;case 13:_l(e,n),r&4&&ll(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qu.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Xc,!r){t=t!==null&&t.memoizedState!==null||Zc,i=Xc;var a=Zc;Xc=r,(Zc=t)&&!a?yl(e,n,(n.subtreeFlags&8772)!=0):_l(e,n),Xc=i,Zc=a}break;case 30:break;default:_l(e,n)}}function rl(e){var t=e.alternate;t!==null&&(e.alternate=null,rl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&_t(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 il=null,al=!1;function ol(e,t,n){for(n=n.child;n!==null;)sl(e,t,n),n=n.sibling}function sl(e,t,n){if(Re&&typeof Re.onCommitFiberUnmount==`function`)try{Re.onCommitFiberUnmount(Le,n)}catch{}switch(n.tag){case 26:Zc||Hc(n,t),ol(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Zc||Hc(n,t);var r=il,i=al;Zd(n.type)&&(il=n.stateNode,al=!1),ol(e,t,n),pf(n.stateNode),il=r,al=i;break;case 5:Zc||Hc(n,t);case 6:if(r=il,i=al,il=null,ol(e,t,n),il=r,al=i,il!==null)if(al)try{(il.nodeType===9?il.body:il.nodeName===`HTML`?il.ownerDocument.body:il).removeChild(n.stateNode)}catch(e){Uu(n,t,e)}else try{il.removeChild(n.stateNode)}catch(e){Uu(n,t,e)}break;case 18:il!==null&&(al?(e=il,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(il,n.stateNode));break;case 4:r=il,i=al,il=n.stateNode.containerInfo,al=!0,ol(e,t,n),il=r,al=i;break;case 0:case 11:case 14:case 15:Rc(2,n,t),Zc||Rc(4,n,t),ol(e,t,n);break;case 1:Zc||(Hc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Bc(n,t,r)),ol(e,t,n);break;case 21:ol(e,t,n);break;case 22:Zc=(r=Zc)||n.memoizedState!==null,ol(e,t,n),Zc=r;break;default:ol(e,t,n)}}function cl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Uu(t,t.return,e)}}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Uu(t,t.return,e)}}function ul(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $c),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $c),t;default:throw Error(i(435,e.tag))}}function dl(e,t){var n=ul(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ju.bind(null,e,t);t.then(r,r)}})}function fl(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(Zd(c.type)){il=c.stateNode,al=!1;break a}break;case 5:il=c.stateNode,al=!1;break a;case 3:case 4:il=c.stateNode.containerInfo,al=!0;break a}c=c.return}if(il===null)throw Error(i(160));sl(o,s,a),il=null,al=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ml(t,e),t=t.sibling}var pl=null;function ml(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fl(t,e),hl(e),r&4&&(Rc(3,e,e.return),Lc(3,e),Rc(5,e,e.return));break;case 1:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),r&64&&Xc&&(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=pl;if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(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[gt]||o[lt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Pd(o,r,n),o[lt]=e,St(o),r=o;break a;case`link`:var s=Vf(`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),Pd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Vf(`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),Pd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[lt]=e,St(o),r=o}e.stateNode=r}else Hf(a,e.type,e.stateNode);else e.stateNode=If(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Hf(a,e.type,e.stateNode):If(a,r,e.memoizedProps))}break;case 27:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),n!==null&&r&4&&Wc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),e.flags&32){a=e.stateNode;try{Jt(a,``)}catch(t){Uu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Wc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Qc=!0);break;case 6:if(fl(t,e),hl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Uu(e,e.return,t)}}break;case 3:if(Bf=null,a=pl,pl=gf(t.containerInfo),fl(t,e),pl=a,hl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Uu(e,e.return,t)}Qc&&(Qc=!1,gl(e));break;case 4:r=pl,pl=gf(e.stateNode.containerInfo),fl(t,e),hl(e),pl=r;break;case 12:fl(t,e),hl(e);break;case 31:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 13:fl(t,e),hl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Zl=ke()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Xc,d=Zc;if(Xc=u||a,Zc=d||l,fl(t,e),Zc=d,Xc=u,hl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Xc||Zc||vl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Uu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Uu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?$d(m,!0):$d(l.stateNode,!1)}catch(e){Uu(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,dl(e,n))));break;case 19:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 30:break;case 21:break;default:fl(t,e),hl(e)}}function hl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Gc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Jc(e,Kc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Jt(o,``),n.flags&=-33),Jc(e,Kc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;qc(e,Kc(e),s);break;default:throw Error(i(161))}}catch(t){Uu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function gl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;gl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function _l(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)nl(e,t.alternate,t),t=t.sibling}function vl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Rc(4,t,t.return),vl(t);break;case 1:Hc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Bc(t,t.return,n),vl(t);break;case 27:pf(t.stateNode);case 26:case 5:Hc(t,t.return),vl(t);break;case 22:t.memoizedState===null&&vl(t);break;case 30:vl(t);break;default:vl(t)}e=e.sibling}}function yl(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:yl(i,a,n),Lc(4,a);break;case 1:if(yl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Uu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ua(c[i],s)}catch(e){Uu(r,r.return,e)}}n&&o&64&&zc(a),Vc(a,a.return);break;case 27:Yc(a);case 26:case 5:yl(i,a,n),n&&r===null&&o&4&&Uc(a),Vc(a,a.return);break;case 12:yl(i,a,n);break;case 31:yl(i,a,n),n&&o&4&&cl(i,a);break;case 13:yl(i,a,n),n&&o&4&&ll(i,a);break;case 22:a.memoizedState===null&&yl(i,a,n),Vc(a,a.return);break;case 30:break;default:yl(i,a,n)}t=t.sibling}}function bl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&na(n))}function xl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e))}function Sl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Cl(e,t,n,r),t=t.sibling}function Cl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Sl(e,t,n,r),i&2048&&Lc(9,t);break;case 1:Sl(e,t,n,r);break;case 3:Sl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e)));break;case 12:if(i&2048){Sl(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){Uu(t,t.return,e)}}else Sl(e,t,n,r);break;case 31:Sl(e,t,n,r);break;case 13:Sl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Sl(e,t,n,r):(a._visibility|=2,wl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Sl(e,t,n,r):Tl(e,t),i&2048&&bl(o,t);break;case 24:Sl(e,t,n,r),i&2048&&xl(t.alternate,t);break;default:Sl(e,t,n,r)}}function wl(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:wl(a,o,s,c,i),Lc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,wl(a,o,s,c,i)):u._visibility&2?wl(a,o,s,c,i):Tl(a,o),i&&l&2048&&bl(o.alternate,o);break;case 24:wl(a,o,s,c,i),i&&l&2048&&xl(o.alternate,o);break;default:wl(a,o,s,c,i)}t=t.sibling}}function Tl(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:Tl(n,r),i&2048&&bl(r.alternate,r);break;case 24:Tl(n,r),i&2048&&xl(r.alternate,r);break;default:Tl(n,r)}t=t.sibling}}var El=8192;function Dl(e,t,n){if(e.subtreeFlags&El)for(e=e.child;e!==null;)Ol(e,t,n),e=e.sibling}function Ol(e,t,n){switch(e.tag){case 26:Dl(e,t,n),e.flags&El&&e.memoizedState!==null&&Gf(n,pl,e.memoizedState,e.memoizedProps);break;case 5:Dl(e,t,n);break;case 3:case 4:var r=pl;pl=gf(e.stateNode.containerInfo),Dl(e,t,n),pl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=El,El=16777216,Dl(e,t,n),El=r):Dl(e,t,n));break;default:Dl(e,t,n)}}function kl(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 Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];el=r,Nl(r,e)}kl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jl(e),e=e.sibling}function jl(e){switch(e.tag){case 0:case 11:case 15:Al(e),e.flags&2048&&Rc(9,e,e.return);break;case 3:Al(e);break;case 12:Al(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ml(e)):Al(e);break;default:Al(e)}}function Ml(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];el=r,Nl(r,e)}kl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Rc(8,t,t.return),Ml(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ml(t));break;default:Ml(t)}e=e.sibling}}function Nl(e,t){for(;el!==null;){var n=el;switch(n.tag){case 0:case 11:case 15:Rc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:na(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,el=r;else a:for(n=e;el!==null;){r=el;var i=r.sibling,a=r.return;if(rl(r),r===n){el=null;break a}if(i!==null){i.return=a,el=i;break a}el=a}}}var Pl={getCacheForType:function(e){var t=Ji(ea),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ji(ea).controller.signal}},Fl=typeof WeakMap==`function`?WeakMap:Map,Y=0,Il=null,X=null,Z=0,Q=0,Ll=null,Rl=!1,zl=!1,Bl=!1,Vl=0,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=null,Yl=null,Xl=!1,Zl=0,Ql=0,$l=1/0,eu=null,tu=null,nu=0,ru=null,iu=null,au=0,ou=0,su=null,cu=null,lu=0,uu=null;function du(){return Y&2&&Z!==0?Z&-Z:k.T===null?ot():ud()}function fu(){if(Kl===0)if(!(Z&536870912)||K){var e=Ge;Ge<<=1,!(Ge&3932160)&&(Ge=262144),Kl=e}else Kl=536870912;return e=Xa.current,e!==null&&(e.flags|=32),Kl}function pu(e,t,n){(e===Il&&(Q===2||Q===9)||e.cancelPendingCommit!==null)&&(bu(e,0),_u(e,Z,Kl,!1)),$e(e,n),(!(Y&2)||e!==Il)&&(e===Il&&(!(Y&2)&&(Wl|=n),Hl===4&&_u(e,Z,Kl,!1)),nd(e))}function mu(e,t,n){if(Y&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ye(e,t),a=r?Ou(e,t):Eu(e,t,!0),o=r;do{if(a===0){zl&&!r&&_u(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!gu(n)){a=Eu(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=Jl;var l=c.current.memoizedState.isDehydrated;if(l&&(bu(c,s).flags|=256),s=Eu(c,s,!1),s!==2){if(Bl&&!l){c.errorRecoveryDisabledLanes|=o,Wl|=o,a=4;break a}o=Yl,Yl=a,o!==null&&(Yl===null?Yl=o:Yl.push.apply(Yl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){bu(e,0),_u(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:_u(r,t,Kl,!Rl);break a;case 2:Yl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Zl+300-ke(),10<a)){if(_u(r,t,Kl,!Rl),Je(r,0,!0)!==0)break a;au=t,r.timeoutHandle=Kd(hu.bind(null,r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,o,`Throttled`,-0,0),a);break a}hu(r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,o,null,-0,0)}}break}while(1);nd(e)}function hu(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:nn},Ol(t,a,d);var m=(a&62914560)===a?Zl-ke():(a&4194048)===a?Ql-ke():0;if(m=qf(d,m),m!==null){au=a,e.cancelPendingCommit=m(Fu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),_u(e,a,o,!l);return}}Fu(e,t,a,n,r,i,o,s,c)}function gu(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(!W(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 _u(e,t,n,r){t&=~Gl,t&=~Wl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Be(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&tt(e,n,t)}function vu(){return Y&6?!0:(rd(0,!1),!1)}function yu(){if(X!==null){if(Q===0)var e=X.return;else e=X,Bi=zi=null,Co(e),Ta=null,Ea=0,e=X;for(;e!==null;)Ic(e.alternate,e),e=e.return;X=null}}function bu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),au=0,yu(),Il=e,X=n=ri(e.current,null),Z=t,Q=0,Ll=null,Rl=!1,zl=Ye(e,t),Bl=!1,ql=Kl=Gl=Wl=Ul=Hl=0,Yl=Jl=null,Xl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Be(r),a=1<<i;t|=e[i],r&=~a}return Vl=t,Jr(),n}function xu(e,t){q=null,k.H=Ns,t===ha||t===_a?(t=Ca(),Q=3):t===ga?(t=Ca(),Q=4):Q=t===Zs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Ll=t,X===null&&(Hl=1,Gs(e,di(t,e.current)))}function Su(){var e=Xa.current;return e===null?!0:(Z&4194048)===Z?Za===null:(Z&62914560)===Z||Z&536870912?e===Za:!1}function Cu(){var e=k.H;return k.H=Ns,e===null?Ns:e}function wu(){var e=k.A;return k.A=Pl,e}function Tu(){Hl=4,Rl||(Z&4194048)!==Z&&Xa.current!==null||(zl=!0),!(Ul&134217727)&&!(Wl&134217727)||Il===null||_u(Il,Z,Kl,!1)}function Eu(e,t,n){var r=Y;Y|=2;var i=Cu(),a=wu();(Il!==e||Z!==t)&&(eu=null,bu(e,t)),t=!1;var o=Hl;a:do try{if(Q!==0&&X!==null){var s=X,c=Ll;switch(Q){case 8:yu(),o=6;break a;case 3:case 2:case 9:case 6:Xa.current===null&&(t=!0);var l=Q;if(Q=0,Ll=null,Mu(e,s,c,l),n&&zl){o=0;break a}break;default:l=Q,Q=0,Ll=null,Mu(e,s,c,l)}}Du(),o=Hl;break}catch(t){xu(e,t)}while(1);return t&&e.shellSuspendCounter++,Bi=zi=null,Y=r,k.H=i,k.A=a,X===null&&(Il=null,Z=0,Jr()),o}function Du(){for(;X!==null;)Au(X)}function Ou(e,t){var n=Y;Y|=2;var r=Cu(),a=wu();Il!==e||Z!==t?(eu=null,$l=ke()+500,bu(e,t)):zl=Ye(e,t);a:do try{if(Q!==0&&X!==null){t=X;var o=Ll;b:switch(Q){case 1:Q=0,Ll=null,Mu(e,t,o,1);break;case 2:case 9:if(ya(o)){Q=0,Ll=null,ju(t);break}t=function(){Q!==2&&Q!==9||Il!==e||(Q=7),nd(e)},o.then(t,t);break a;case 3:Q=7;break a;case 4:Q=5;break a;case 7:ya(o)?(Q=0,Ll=null,ju(t)):(Q=0,Ll=null,Mu(e,t,o,7));break;case 5:var s=null;switch(X.tag){case 26:s=X.memoizedState;case 5:case 27:var c=X;if(s?Wf(s):c.stateNode.complete){Q=0,Ll=null;var l=c.sibling;if(l!==null)X=l;else{var u=c.return;u===null?X=null:(X=u,Nu(u))}break b}}Q=0,Ll=null,Mu(e,t,o,5);break;case 6:Q=0,Ll=null,Mu(e,t,o,6);break;case 8:yu(),Hl=6;break a;default:throw Error(i(462))}}ku();break}catch(t){xu(e,t)}while(1);return Bi=zi=null,k.H=r,k.A=a,Y=n,X===null?(Il=null,Z=0,Jr(),Hl):0}function ku(){for(;X!==null&&!De();)Au(X)}function Au(e){var t=Dc(e.alternate,e,Vl);e.memoizedProps=e.pendingProps,t===null?Nu(e):X=t}function ju(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=dc(n,t,t.pendingProps,t.type,void 0,Z);break;case 11:t=dc(n,t,t.pendingProps,t.type.render,t.ref,Z);break;case 5:Co(t);default:Ic(n,t),t=X=ii(t,Vl),t=Dc(n,t,Vl)}e.memoizedProps=e.pendingProps,t===null?Nu(e):X=t}function Mu(e,t,n,r){Bi=zi=null,Co(t),Ta=null,Ea=0;var i=t.return;try{if(Xs(e,i,t,n,Z)){Hl=1,Gs(e,di(n,e.current)),X=null;return}}catch(t){if(i!==null)throw X=i,t;Hl=1,Gs(e,di(n,e.current)),X=null;return}t.flags&32768?(K||r===1?e=!0:zl||Z&536870912?e=!1:(Rl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Xa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Pu(t,e)):Nu(t)}function Nu(e){var t=e;do{if(t.flags&32768){Pu(t,Rl);return}e=t.return;var n=Pc(t.alternate,t,Vl);if(n!==null){X=n;return}if(t=t.sibling,t!==null){X=t;return}X=t=e}while(t!==null);Hl===0&&(Hl=5)}function Pu(e,t){do{var n=Fc(e.alternate,e);if(n!==null){n.flags&=32767,X=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){X=e;return}X=e=n}while(e!==null);Hl=6,X=null}function Fu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Bu();while(nu!==0);if(Y&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=qr,et(e,n,o,s,c,l),e===Il&&(X=Il=null,Z=0),iu=t,ru=e,au=n,ou=o,su=a,cu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yu(Me,function(){return Vu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=k.T,k.T=null,a=A.p,A.p=2,s=Y,Y|=4;try{tl(e,t,n)}finally{Y=s,A.p=a,k.T=r}}nu=1,Iu(),Lu(),Ru()}}function Iu(){if(nu===1){nu=0;var e=ru,t=iu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=k.T,k.T=null;var r=A.p;A.p=2;var i=Y;Y|=4;try{ml(t,e);var a=zd,o=xr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&br(s.ownerDocument.documentElement,s)){if(c!==null&&Sr(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 _=yr(s,h),v=yr(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}}sp=!!Rd,zd=Rd=null}finally{Y=i,A.p=r,k.T=n}}e.current=t,nu=2}}function Lu(){if(nu===2){nu=0;var e=ru,t=iu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=k.T,k.T=null;var r=A.p;A.p=2;var i=Y;Y|=4;try{nl(e,t.alternate,t)}finally{Y=i,A.p=r,k.T=n}}nu=3}}function Ru(){if(nu===4||nu===3){nu=0,Oe();var e=ru,t=iu,n=au,r=cu;t.subtreeFlags&10256||t.flags&10256?nu=5:(nu=0,iu=ru=null,zu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(tu=null),at(n),t=t.stateNode,Re&&typeof Re.onCommitFiberRoot==`function`)try{Re.onCommitFiberRoot(Le,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=k.T,i=A.p,A.p=2,k.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{k.T=t,A.p=i}}au&3&&Bu(),nd(e),i=e.pendingLanes,n&261930&&i&42?e===uu?lu++:(lu=0,uu=e):lu=0,rd(0,!1)}}function zu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,na(t)))}function Bu(){return Iu(),Lu(),Ru(),Vu()}function Vu(){if(nu!==5)return!1;var e=ru,t=ou;ou=0;var n=at(au),r=k.T,a=A.p;try{A.p=32>n?32:n,k.T=null,n=su,su=null;var o=ru,s=au;if(nu=0,iu=ru=null,au=0,Y&6)throw Error(i(331));var c=Y;if(Y|=4,jl(o.current),Cl(o,o.current,s,n),Y=c,rd(0,!1),Re&&typeof Re.onPostCommitFiberRoot==`function`)try{Re.onPostCommitFiberRoot(Le,o)}catch{}return!0}finally{A.p=a,k.T=r,zu(e,t)}}function Hu(e,t,n){t=di(n,t),t=qs(e.stateNode,t,2),e=La(e,t,2),e!==null&&($e(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(tu===null||!tu.has(r))){e=di(n,e),n=Js(2),r=La(t,n,2),r!==null&&(Ys(n,r,t,e),$e(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fl;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)||(Bl=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Il===e&&(Z&n)===n&&(Hl===4||Hl===3&&(Z&62914560)===Z&&300>ke()-Zl?!(Y&2)&&bu(e,0):Gl|=n,ql===Z&&(ql=0)),nd(e)}function Ku(e,t){t===0&&(t=Ze()),e=G(e,t),e!==null&&($e(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(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),Ku(e,n)}function Yu(e,t){return Te(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;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-Be(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=Z,a=Je(r,r===Il?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ye(r,a)||(n=!0,cd(r,a));r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=ke(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}nu!==0&&nu!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Be(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Xe(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Il,n=Z,n=Je(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Q===2||Q===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ee(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ye(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ee(r),at(n)){case 2:case 8:n=F;break;case 32:n=Me;break;case 268435456:n=Pe;break;default:n=Me}return r=sd.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 sd(e,t){if(nu!==0&&nu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Bu()&&e.callbackNode!==n)return null;var r=Z;return r=Je(e,e===Il?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(mu(e,r,t),od(e,ke()),e.callbackNode!=null&&e.callbackNode===n?sd.bind(null,e):null)}function cd(e,t){if(Bu())return null;mu(e,t,!0)}function ld(){Yd(function(){Y&6?Te(je,id):ad()})}function ud(){if(td===0){var e=aa;e===0&&(e=We,We<<=1,!(We&261888)&&(We=256)),td=e}return td}function dd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:tn(``+e)}function fd(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 pd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=dd((i[ut]||null).action),o=r.submitter;o&&(t=(t=o[ut]||null)?dd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new wn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(td!==0){var e=o?fd(i,o):new FormData(i);ys(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?fd(i,o):new FormData(i),ys(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var md=0;md<Hr.length;md++){var hd=Hr[md];Ur(hd.toLowerCase(),`on`+(hd[0].toUpperCase()+hd.slice(1)))}Ur(Pr,`onAnimationEnd`),Ur(Fr,`onAnimationIteration`),Ur(Ir,`onAnimationStart`),Ur(`dblclick`,`onDoubleClick`),Ur(`focusin`,`onFocus`),Ur(`focusout`,`onBlur`),Ur(Lr,`onTransitionRun`),Ur(Rr,`onTransitionStart`),Ur(zr,`onTransitionCancel`),Ur(Br,`onTransitionEnd`),Et(`onMouseEnter`,[`mouseout`,`mouseover`]),Et(`onMouseLeave`,[`mouseout`,`mouseover`]),Et(`onPointerEnter`,[`pointerout`,`pointerover`]),Et(`onPointerLeave`,[`pointerout`,`pointerover`]),Tt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Tt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Tt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Tt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Tt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Tt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var gd=`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(` `),_d=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(gd));function vd(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){Wr(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){Wr(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[ft];n===void 0&&(n=t[ft]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,Ct.forEach(function(t){t!==`selectionchange`&&(_d.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!pn||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 Cd(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=vt(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}un(function(){var r=a,i=an(n),s=[];a:{var c=Vr.get(e);if(c!==void 0){var l=wn,u=e;switch(e){case`keypress`:if(yn(n)===0)break a;case`keydown`:case`keyup`:l=Bn;break;case`focusin`:u=`focus`,l=Mn;break;case`focusout`:u=`blur`,l=Mn;break;case`beforeblur`:case`afterblur`:l=Mn;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=An;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=jn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Hn;break;case Pr:case Fr:case Ir:l=Nn;break;case Br:l=Un;break;case`scroll`:case`scrollend`:l=En;break;case`wheel`:l=R;break;case`copy`:case`cut`:case`paste`:l=Pn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Vn;break;case`toggle`:case`beforetoggle`:l=Wn}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=dn(m,p),g!=null&&d.push(wd(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!==rn&&(u=n.relatedTarget||n.fromElement)&&(vt(u)||u[dt]))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?vt(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=An,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Vn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:bt(l),h=u==null?c:bt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,vt(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=Ed,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&&Dd(s,c,l,d,!1),u!==null&&f!==null&&Dd(s,f,u,d,!0)}}a:{if(c=r?bt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=lr;else if(ir(c))if(ur)v=hr;else{v=pr;var y=U}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Qt(r.elementType)&&(v=lr):v=mr;if(v&&=v(e,r)){ar(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Wt(c,`number`,c.value)}switch(y=r?bt(r):window,e){case`focusin`:(ir(y)||y.contentEditable===`true`)&&(wr=y,Tr=r,Er=null);break;case`focusout`:Er=Tr=wr=null;break;case`mousedown`:Dr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Dr=!1,Or(s,n,i);break;case`selectionchange`:if(Cr)break;case`keydown`:case`keyup`:Or(s,n,i)}var b;if(Kn)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 er?Qn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Yn&&n.locale!==`ko`&&(er||x!==`onCompositionStart`?x===`onCompositionEnd`&&er&&(b=vn()):(hn=i,gn=`value`in hn?hn.value:hn.textContent,er=!0)),y=Td(r,x),0<y.length&&(x=new Fn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=$n(n),b!==null&&(x.data=b)))),(b=Jn?tr(e,n):nr(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new Fn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),pd(s,e,r,n,i)}vd(s,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(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=dn(e,n),i!=null&&r.unshift(wd(e,i,a)),i=dn(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(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=dn(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=dn(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
|
|
9
|
-
`).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Jt(e,``+r);break;case`className`:Mt(e,`class`,r);break;case`tabIndex`:Mt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Mt(e,n,r);break;case`style`:Zt(e,r,o);break;case`data`:if(t!==`object`){Mt(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=tn(``+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`&&Md(e,t,`name`,a.name,a,null),Md(e,t,`formEncType`,a.formEncType,a,null),Md(e,t,`formMethod`,a.formMethod,a,null),Md(e,t,`formTarget`,a.formTarget,a,null)):(Md(e,t,`encType`,a.encType,a,null),Md(e,t,`method`,a.method,a,null),Md(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=tn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`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=tn(``+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`:$(`beforetoggle`,e),$(`toggle`,e),jt(e,`popover`,r);break;case`xlinkActuate`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:jt(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=$t.get(n)||n,jt(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:Zt(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`?Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Jt(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!wt.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[ut]||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,``):jt(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`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:Md(e,t,o,s,n,null)}}a&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:$(`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:Md(e,t,r,d,n,null)}}Ut(e,o,c,l,u,s,a,!1);return;case`select`:for(a in $(`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:Md(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Gt(e,!!r,n,!0):Gt(e,!!r,t,!1);return;case`textarea`:for(s in $(`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:Md(e,t,s,c,n,null)}qt(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:Md(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<gd.length;r++)$(gd[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`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:Md(e,t,u,r,n,null)}return;default:if(Qt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(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)||Md(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&&Md(e,t,p,m,r,f)}}Ht(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)||Md(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&&Md(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Gt(e,!!n,n?[]:``,!1):Gt(e,!!n,t,!0)):Gt(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:Md(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&&Md(e,t,s,a,r,o)}Kt(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:Md(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:Md(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)&&Md(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:Md(e,t,u,p,r,m)}return;default:if(Qt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(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||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(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||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){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&&Id(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&&Id(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 Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(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 Hd(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 Ud(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 Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e===Wd?!1:(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(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),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[gt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(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 ef(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`:ef(n),_t(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(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[gt])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=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(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 cf(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 lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(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 ff(e,t,n){switch(t=Bd(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 pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);_t(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=A.d;A.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=vu();return e||t}function yf(e){var t=yt(e);t!==null&&t.tag===5&&t.type===`form`?xs(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Vt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),St(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Vt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Vt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Vt(n.imageSizes)+`"]`)):i+=`[href="`+Vt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),St(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Vt(r)+`"][href="`+Vt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),St(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=xt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);St(c),Pd(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,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=xt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),St(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=xt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),St(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=de.current)?gf(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=Af(n.href),n=xt(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=Af(n.href);var o=xt(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(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.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},mf.set(e,n),o||Nf(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=Pf(n),n=xt(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 Af(e){return`href="`+Vt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(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}),Pd(t,`link`,n),St(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Vt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Vt(n.href)+`"]`);if(r)return t.instance=r,St(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),St(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,St(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),St(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,St(a),a):(r=n,(a=mf.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),St(a),Pd(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,Lf(r,n.precedence,e));return t.instance}function Lf(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 Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,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[gt]||a[lt]||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 Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(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 Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(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=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,St(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),St(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(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=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.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=Jf.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 Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function $f(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=Qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qe(0),this.hiddenUpdates=Qe(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 ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ti(3,null,null,t),e.current=a,a.stateNode=e,t=ta(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Pa(a),e}function tp(e){return e?(e=$r,e):$r}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ia(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=La(e,r,t),n!==null&&(pu(n,e,t),Ra(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=G(e,67108864);t!==null&&pu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=du();t=it(t);var n=G(e,t);n!==null&&pu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=2,up(e,t,n,r)}finally{A.p=a,k.T=i}}function lp(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=8,up(e,t,n,r)}finally{A.p=a,k.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=yt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=qe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Be(o);s.entanglements[1]|=c,o&=~c}nd(a),!(Y&6)&&($l=ke()+500,rd(0,!1))}}break;case 31:case 13:s=G(a,2),s!==null&&pu(s,a,2),vu(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=an(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=vt(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 fp=e,null}function mp(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 F:return 8;case Me:case Ne:return 32;case Pe:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`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 Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(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=yt(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=vt(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,st(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,st(e.priority,function(){op(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 Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);rn=r,n.target.dispatchEvent(r),rn=null}else return t=yt(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=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(pp(r||n)===null)continue;break}var a=yt(n);a!==null&&(e.splice(t,3),t-=3,ys(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.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[ut]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[ut]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){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 Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,du(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),vu(),t[dt]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=ot();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.4`)throw Error(i(527,Lp,`19.2.4`));A.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=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:k,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Le=zp.inject(Rp),Re=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Hs,s=Us,c=Ws;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=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[dt]=t.current,xd(e),new Fp(t)}})),g=c(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=h()}))(),1),_=c(u(),1),v=500,y=3e3,b=1e3,x=3e4,S=Object.freeze({counters:Object.freeze({}),latestBurst:null,burstRing:Object.freeze([]),burstSeq:0,connectionSeq:0,connected:!1,reconnectAttempts:0,lastErrorAt:null,reconnectDelayMs:b}),C=new Set,w={},T=[],E=!1,ee=!1,D=null,te=null,ne=null,O=!1,re=typeof localStorage<`u`&&localStorage.getItem(`DEBUG_SSE`)===`1`;function ie(e,t){re&&(t?console.debug(`[ssg-sse] ${e}`,t):console.debug(`[ssg-sse] ${e}`))}function ae(){O||(O=!0,queueMicrotask(oe))}function oe(){O=!1;let e=Object.keys(w),t=T,n=E,r=D!==null||te!==null||ne!==null;if(e.length===0&&t.length===0&&!n&&!r)return;let i=S.counters;if(e.length>0){let t={...S.counters};for(let n of e)t[n]=(t[n]??0)+(w[n]??0);i=Object.freeze(t),w={}}let a=S.burstRing,o=S.latestBurst,s=S.burstSeq;if(t.length>0){let e=S.burstRing.length+t.length>v?[...S.burstRing,...t].slice(-v):[...S.burstRing,...t];a=Object.freeze(e),o=t[t.length-1]??o,s=S.burstSeq+t.length,T=[]}let c=S.connected,l=S.connectionSeq;n&&(c=ee,l=S.connectionSeq+1,E=!1);let u=S.reconnectAttempts,d=S.lastErrorAt,f=S.reconnectDelayMs;D!==null&&(u=D,D=null),te!==null&&(d=te,te=null),ne!==null&&(f=ne,ne=null),S=Object.freeze({counters:i,latestBurst:o,burstRing:a,burstSeq:s,connectionSeq:l,connected:c,reconnectAttempts:u,lastErrorAt:d,reconnectDelayMs:f});for(let e of C)e()}var k=null,A=0,se=new Set,ce=new Map,le=null,j=b,M=null;function N(e,t){if(e===`eval-burst`){try{let e=JSON.parse(t.data);Array.isArray(e?.bursts)&&(T.push(...e.bursts),ae())}catch{}return}w[e]=(w[e]??0)+1,ae()}function ue(e){if(!k||ce.has(e))return;let t=t=>N(e,t);k.addEventListener(e,t),ce.set(e,t)}var P=0,de=0,fe=2e3;function pe(){if(k)return;ie(`opening EventSource`,{url:`/api/events`}),de=Date.now();let e=new EventSource(`/api/events`);k=e,ce.clear();for(let e of se)ue(e);e.onopen=()=>{let e=S.lastErrorAt!==null;j=b,P=0,D=0,ne=b,E=!0,ee=!0,ae(),e&&Ce(`reconnect`),ie(`connected`)},e.onerror=()=>{e.close(),k=null,ce.clear(),E=!0,ee=!1,te=Date.now(),ae(),P===0&&Date.now()-de<fe?ie(`first-open interrupted (page-load race) — reconnect in ${j}ms`):console.warn(`[ssg-sse] EventSource error — reconnect in ${j}ms (attempt ${P+1})`),A>0&&(le=setTimeout(()=>{le=null,A>0&&pe()},j),P++,D=P,j=Math.min(j*2,x),ne=j,ae())}}function me(){le&&=(clearTimeout(le),null),k?.close(),k=null,ce.clear(),j=b,P=0,D=0,ne=b,E=!0,ee=!1,ae()}typeof document<`u`&&document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&A!==0&&(k||(le&&=(clearTimeout(le),null),ie(`visibilitychange → reconnecting`),pe()))});function he(){for(let e of se)e!==`eval-burst`&&(w[e]=(w[e]??0)+1);ae()}function ge(e){return C.add(e),()=>{C.delete(e)}}function _e(){return S}var ve=200,ye=1e4;function be(){let e=new Date;return e.setHours(0,0,0,0),e.getTime()}var xe=0,Se=null;function Ce(e){let t=Date.now();if(t-xe<ye){ie(`hydrate skipped (cooldown)`,{reason:e});return}if(Se)return;let n=S.burstRing.length>0?S.burstRing[S.burstRing.length-1].ts_ms+1:be(),r=e===`reconnect`?n:be(),i=t;if(r>=i)return;xe=t;let a=new AbortController;Se=a,ie(`hydrate start`,{reason:e,since:r,until:i,ringLen:S.burstRing.length}),fetch(`/api/json/graph/backfill?since_ms=${r}&until_ms=${i}&limit=${ve}`,{signal:a.signal,credentials:`same-origin`}).then(e=>e.ok?e.json():null).then(t=>{if(!t||!Array.isArray(t.bursts)||t.bursts.length===0){ie(`hydrate empty`,{reason:e});return}T.push(...t.bursts),ae(),ie(`hydrate merged`,{reason:e,count:t.bursts.length})}).catch(t=>{t.name!==`AbortError`&&console.warn(`[ssg-sse] ring hydration failed (${e})`,t)}).finally(()=>{Se=null})}function we(e){for(let t of e)se.add(t),ue(t);return A++,A===1&&(Ce(`initial`),pe(),M=setInterval(he,y)),()=>{A--,A===0&&(me(),M&&=(clearInterval(M),null))}}var Te=Object.freeze([`eval-burst`,`counters-updated`]);function Ee(){(0,_.useEffect)(()=>we(Te),[])}function De(){return Ee(),(0,_.useSyncExternalStore)(ge,_e).latestBurst}function Oe(){return Ee(),(0,_.useSyncExternalStore)(ge,_e).burstRing}function ke(){return Ee(),(0,_.useSyncExternalStore)(ge,_e).burstSeq}function Ae(){let e=document.querySelector(`meta[name="ssg-csrf"]`)?.content??``;return e?{"X-SigmaShake-Token":e}:{}}function je(e){let t=(0,_.useSyncExternalStore)(ge,_e),n=e.join(`,`);(0,_.useEffect)(()=>we(e),[n]);let r=(0,_.useRef)({});return(0,_.useMemo)(()=>{let n={},i=!1;for(let a of e){let e=t.counters[a]??0;n[a]=e,r.current[a]!==e&&(i=!0)}return!i&&Object.keys(r.current).length===e.length?r.current:(r.current=n,n)},[t,n])}function F(e,t=[]){let[n,r]=(0,_.useState)({data:null,loading:!0,error:null}),[i,a]=(0,_.useState)(0),o=(0,_.useRef)(null),s=(0,_.useCallback)(()=>{a(e=>e+1)},[]);return(0,_.useEffect)(()=>{let t=new AbortController;return o.current=t,r(e=>({...e,loading:!0,error:null})),fetch(e,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{t.signal.aborted||r({data:e,loading:!1,error:null})}).catch(e=>{if(t.signal.aborted)return;let n=e instanceof Error?e.message:String(e);r(e=>({...e,loading:!1,error:n}))}),()=>{t.abort()}},[e,i,...t]),{...n,refetch:s}}var Me=e=>e,Ne=e=>({in:t=>t**+e,out:t=>1-(1-t)**e,inOut:t=>t<.5?(2*t)**e/2:1-(-2*t+2)**e/2}),Pe=Ne(2),Fe=Ne(3),Ie=Ne(4),Le=Ne(5),Re={in:e=>1-Math.cos(e*Math.PI/2),out:e=>Math.sin(e*Math.PI/2),inOut:e=>-(Math.cos(Math.PI*e)-1)/2},ze={in:e=>e===0?0:2**(10*e-10),out:e=>e===1?1:1-2**(-10*e),inOut:e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2},Be={in:e=>1-Math.sqrt(1-e**2),out:e=>Math.sqrt(1-(e-1)**2),inOut:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2};function Ve(e=1.70158){let t=e;return e=>e*e*((t+1)*e-t)}function He(e=1.70158){let t=e;return e=>{let n=e-1;return n*n*((t+1)*n+t)+1}}function Ue(e=1.70158){let t=e*1.525;return e=>e<.5?(2*e)**2*((t+1)*2*e-t)/2:((2*e-2)**2*((t+1)*(e*2-2)+t)+2)/2}function We(e=1,t=.3){let n=Math.max(e,1),r=Math.max(t,.08),i=r/(Math.PI*2)*Math.asin(1/n);return e=>e===0?0:e===1?1:n*2**(-10*e)*Math.sin((e-i)*(Math.PI*2)/r)+1}function Ge(e=1,t=.3){let n=Math.max(e,1),r=Math.max(t,.08),i=r/(Math.PI*2)*Math.asin(1/n);return e=>e===0?0:e===1?1:-(n*2**(10*(e-1))*Math.sin((e-1-i)*(Math.PI*2)/r))}function Ke(e=1,t=.45){let n=Math.max(e,1),r=Math.max(t,.08),i=r/(Math.PI*2)*Math.asin(1/n);return e=>{if(e===0)return 0;if(e===1)return 1;let t=e*2;return t<1?-.5*(n*2**(10*(t-1))*Math.sin((t-1-i)*(Math.PI*2)/r)):n*2**(-10*(t-1))*Math.sin((t-1-i)*(Math.PI*2)/r)*.5+1}}var qe=7.5625,Je=2.75,Ye=e=>{if(e<1/Je)return qe*e*e;if(e<2/Je){let t=e-1.5/Je;return qe*t*t+.75}if(e<2.5/Je){let t=e-2.25/Je;return qe*t*t+.9375}let t=e-2.625/Je;return qe*t*t+.984375},Xe=e=>1-Ye(1-e),Ze=e=>e<.5?(1-Ye(1-2*e))/2:(1+Ye(2*e-1))/2;function Qe(e){let t=Math.max(1,Math.floor(e));return e=>e>=1?1:e<=0?0:Math.floor(e*t)/t}function $e(e,t,n,r){let i=3*e,a=3*(n-e)-i,o=1-i-a,s=3*t,c=3*(r-t)-s,l=1-s-c,u=e=>((o*e+a)*e+i)*e,d=e=>((l*e+c)*e+s)*e,f=e=>(3*o*e+2*a)*e+i,p=e=>{let t=e;for(let n=0;n<8;n++){let n=u(t)-e;if(Math.abs(n)<1e-5)return t;let r=f(t);if(Math.abs(r)<1e-6)break;t-=n/r}let n=0,r=1;for(t=e;n<r;){let i=u(t);if(Math.abs(i-e)<1e-5)return t;e>i?n=t:r=t,t=(n+r)/2}return t};return e=>e<=0?0:e>=1?1:d(p(e))}function et(e={}){let t=Math.max(1,e.stiffness??100),n=Math.max(0,e.damping??10),r=Math.max(.01,e.mass??1),i=e.velocity??0,a=Math.sqrt(t/r),o=n/(2*Math.sqrt(t*r)),s;if(o<1){let e=a*Math.sqrt(1-o*o),t=(o*a+-i)/e;s=n=>1-Math.exp(-o*a*n)*(1*Math.cos(e*n)+t*Math.sin(e*n))}else if(o===1){let e=a+-i;s=t=>1-Math.exp(-a*t)*(1+e*t)}else{let e=Math.sqrt(o*o-1),t=-a*(o-e),n=-a*(o+e),r=(n- -i)/(n-t),c=1-r;s=e=>1-(r*Math.exp(t*e)+c*Math.exp(n*e))}let c=400;for(let e=16;e<=4e3;e+=16){let t=s(e/1e3);if(Math.abs(1-t)<.005){let t=s((e-16)/1e3);if(Math.abs(1-t)<.005){c=e;break}}c=e}let l=c/1e3;return{duration:c,fn:e=>s(Math.max(0,Math.min(1,e))*l)}}var tt={linear:Me,inQuad:Pe.in,outQuad:Pe.out,inOutQuad:Pe.inOut,inCubic:Fe.in,outCubic:Fe.out,inOutCubic:Fe.inOut,inQuart:Ie.in,outQuart:Ie.out,inOutQuart:Ie.inOut,inQuint:Le.in,outQuint:Le.out,inOutQuint:Le.inOut,inSine:Re.in,outSine:Re.out,inOutSine:Re.inOut,inExpo:ze.in,outExpo:ze.out,inOutExpo:ze.inOut,inCirc:Be.in,outCirc:Be.out,inOutCirc:Be.inOut,inBack:Ve(),outBack:He(),inOutBack:Ue(),inElastic:Ge(),outElastic:We(),inOutElastic:Ke(),inBounce:Xe,outBounce:Ye,inOutBounce:Ze};function nt(e){if(typeof e==`function`)return e;if(e===void 0)return tt.outCubic;let t=tt[e];if(t)return t;let n=e.match(/^(\w+)\(([^)]*)\)$/);if(n){let e=n[1],t=n[2].split(`,`).map(e=>parseFloat(e.trim())).filter(e=>!Number.isNaN(e));switch(e){case`outElastic`:return We(t[0],t[1]);case`inElastic`:return Ge(t[0],t[1]);case`inOutElastic`:return Ke(t[0],t[1]);case`outBack`:return He(t[0]);case`inBack`:return Ve(t[0]);case`inOutBack`:return Ue(t[0]);case`steps`:return Qe(t[0]??4);case`cubicBezier`:return t.length>=4?$e(t[0],t[1],t[2],t[3]):tt.outCubic;default:return tt.outCubic}}return tt.outCubic}function rt(e,t){if(t<=1||e===void 0||e===`first`)return 0;if(e===`last`)return t-1;if(e===`center`)return(t-1)/2;let n=Math.floor(e);return n<0?0:n>t-1?t-1:n}function it(e,t={}){let n=t.start??0,r=t.direction===`reverse`;return(i,a)=>{if(a<=0)return n;let o=rt(t.from,a),s=Math.abs(i-o),c=Math.max(o,a-1-o),l=c===0?0:s/c,u=r?1-l:l,d;if(Array.isArray(e)){let[t,n]=e;d=t+u*(n-t)}else d=(r?c-s:s)*e;return n+d}}var at=new Set,ot=0;function st(){ot===0&&(typeof requestAnimationFrame>`u`||(ot=requestAnimationFrame(ct)))}function ct(e){for(let t of at){let n=t.state;if(!(!n.playing||n.completed)){if(n.lastFrame<0?n.deltaTime=0:n.deltaTime=Math.max(0,e-n.lastFrame),n.lastFrame=e,n.currentTime=Math.max(0,e-n.playStartAt),n.duration>0)for(;n.currentTime>=n.duration;){let e=n.loop===!0?1/0:typeof n.loop==`number`?Math.max(1,n.loop):1;if(n.iterationCount+1>=e){n.currentTime=n.duration,n.completed=!0,n.playing=!1,n.onUpdate?.(t.self),n.onComplete?.(t.self);break}n.currentTime-=n.duration,n.playStartAt+=n.duration,n.iterationCount+=1,n.onLoop?.(t.self)}n.completed||n.onUpdate?.(t.self)}}for(let e of[...at])e.state.completed&&at.delete(e);if(at.size===0){ot=0;return}ot=requestAnimationFrame(ct)}function lt(e={}){let t={duration:e.duration??0,loop:e.loop??!1,onUpdate:e.onUpdate,onComplete:e.onComplete,onLoop:e.onLoop,currentTime:0,deltaTime:0,iterationCount:0,completed:!1,playing:!1,lastFrame:-1,playStartAt:-1},n={play(){if(!(t.completed||t.playing)){if(pt()){t.playing=!0,t.lastFrame=-1,t.onUpdate?.(n),t.duration>0&&t.loop===!1?(t.currentTime=t.duration,t.completed=!0,t.playing=!1,t.onUpdate?.(n),t.onComplete?.(n)):t.playing=!1;return}t.playing=!0,t.playStartAt=(typeof performance<`u`?performance.now():Date.now())-t.currentTime,t.lastFrame=-1,at.add({state:t,self:n}),st()}},pause(){t.playing&&(t.playing=!1,t.lastFrame=-1)},cancel(){t.playing=!1,t.completed=!0,t.lastFrame=-1;for(let e of at)if(e.state===t){at.delete(e);break}},seek(e){if(t.completed)return;let n=t.duration>0?Math.max(0,Math.min(t.duration,e)):Math.max(0,e);t.currentTime=n,t.playStartAt=(typeof performance<`u`?performance.now():Date.now())-n,t.lastFrame=-1},get currentTime(){return t.currentTime},get deltaTime(){return t.deltaTime},get iterationCount(){return t.iterationCount},get progress(){return t.duration>0?Math.max(0,Math.min(1,t.currentTime/t.duration)):NaN},get completed(){return t.completed},get playing(){return t.playing}};return e.autoplay!==!1&&n.play(),n}var ut=new Set([`duration`,`delay`,`ease`,`loop`,`alternate`,`onBegin`,`onUpdate`,`onComplete`]);function dt(e){if(typeof e==`number`||typeof e==`string`)return e;if(Array.isArray(e)&&e.length===2){let[t,n]=e;if((typeof t==`number`||typeof t==`string`)&&(typeof n==`number`||typeof n==`string`))return[t,n]}return null}function ft(e){return e?typeof e==`string`?typeof document>`u`?[]:Array.from(document.querySelectorAll(e)):e instanceof Element?[e]:`length`in e?Array.from(e):[]:[]}function pt(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var mt=/^(-?\d*\.?\d+)([a-z%]*)$/i;function ht(e){if(typeof e==`number`)return{value:e,unit:``};let t=e.trim().match(mt);return t?{value:parseFloat(t[1]),unit:t[2]??``}:{value:0,unit:``}}function gt(e){return e.unit===``?`${e.value}`:`${e.value}${e.unit}`}var _t=new Set([`translate`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`]),vt=new WeakMap;function yt(e){let t=vt.get(e);return t||(t={values:{}},vt.set(e,t)),t}function bt(e){let t=[];for(let[n,r]of Object.entries(e.values)){let e=r.unit||(n.startsWith(`rotate`)||n.startsWith(`skew`)?`deg`:n.startsWith(`translate`)?`px`:``);t.push(`${n}(${r.value}${e})`)}return t.join(` `)}function xt(e,t,n){if(_t.has(t)){let r=yt(e);r.values[t]=n,e.style.transform=bt(r);return}if(t===`opacity`){e.style.opacity=`${n.value}`;return}e.style.setProperty(t,gt(n))}function St(e,t){return _t.has(t)?yt(e).values[t]||{value:t.startsWith(`scale`)?1:0,unit:``}:ht(e.style.getPropertyValue(t)||(typeof window<`u`?window.getComputedStyle(e).getPropertyValue(t):``)||(t===`opacity`?`1`:`0`))}function Ct(e,t,n){return e+(t-e)*n}function wt(e,t,n){return e===void 0?0:typeof e==`number`?e:e(t,n)}function Tt(e){if(e&&typeof e==`object`&&`spring`in e){let t=et(e.spring);return{ease:t.fn,duration:t.duration}}return{ease:nt(e),duration:null}}var Et=0,Dt=new Set;function Ot(e){for(let t of Dt){if(t.done||e<t.start)continue;let{target:n,options:r}=t,i=e-t.start,a=Math.max(1,n.duration),o=r.loop??!1,s=r.alternate===!0,c=o===!0?1/0:typeof o==`number`?Math.max(1,o):1,l=Math.floor(i/a),u=(i-l*a)/a,d=s&&l%2==1?1-u:u;if(l>=c){for(let e of n.props)xt(n.el,e.name,kt(e.from,e.to,s&&c%2==0?0:1));r.onUpdate?.(1,n.el,n.index),r.onComplete?.(n.el,n.index),t.done=!0;continue}for(let e of n.props){let t=e.ease(Math.max(0,Math.min(1,d)));n.el!==null&&xt(n.el,e.name,kt(e.from,e.to,t))}n.el!==null&&r.onUpdate?.(d,n.el,n.index)}for(let e of[...Dt])e.done&&Dt.delete(e);if(Dt.size===0){Et=0;return}Et=requestAnimationFrame(Ot)}function kt(e,t,n){let r=e.unit||t.unit;return{value:Ct(e.value,t.value,n),unit:r}}function At(){Et===0&&(typeof requestAnimationFrame>`u`||(Et=requestAnimationFrame(Ot)))}function jt(e,t){let n=ft(e),r=n.length,i=Object.keys(t).filter(e=>!ut.has(e)),a=pt(),{ease:o,duration:s}=Tt(t.ease),c=t.duration??s??400,l=[],u=[],d=typeof performance<`u`?performance.now():Date.now(),f=(e,n)=>{let a=[];for(let n of i){let r=t[n];if(r===void 0)continue;let i=dt(r);if(i===null)continue;let s,c;Array.isArray(i)?(s=ht(i[0]),c=ht(i[1])):(s=St(e,n),c=ht(i)),a.push({name:n,from:s,to:c,ease:o})}return{el:e,index:n,props:a,duration:c,delay:wt(t.delay,n,r)}};if(n.length===0)return{cancel:()=>{},finished:Promise.resolve(),get done(){return!0}};let p=!1;for(let e=0;e<n.length;e++){let r=n[e],i=f(r,e),o=d+i.delay;if(t.onBegin?.(r,e),a){for(let e of i.props)xt(r,e.name,e.to);t.onUpdate?.(1,r,e),t.onComplete?.(r,e),u.push(Promise.resolve());continue}for(let e of i.props)xt(r,e.name,e.from);let s={target:i,start:o,options:t,done:!1};l.push(s),Dt.add(s),u.push(new Promise(e=>{let n=t.onComplete,r=(t,r)=>{try{n?.(t,r)}finally{e()}};s.options={...t,onComplete:r}}))}return At(),{cancel(){if(!p){p=!0;for(let e of l)e.done=!0,Dt.delete(e)}},finished:Promise.all(u).then(()=>void 0),get done(){return p||l.every(e=>e.done)}}}function Mt(e={}){let t=(0,_.useRef)(null),n=(0,_.useRef)(!1),r=(0,_.useCallback)(()=>{if(n.current)return;let r=t.current;if(!r)return;let i=r.querySelectorAll(`[data-reveal]`);if(i.length===0)return;if(n.current=!0,pt()){i.forEach(e=>{e.style.opacity=`1`,e.style.transform=``});return}let a=e.staggerMs??40,o=e.maxStaggerMs??320,s=Math.min(a,Math.max(10,o/i.length)),c=e.translateY??14,l=e.durationMs??520,u=e.from??`center`;i.forEach(e=>{e.style.opacity=`0`,e.style.transform=`translateY(${c}px)`,e.style.willChange=`transform, opacity`}),jt(Array.from(i),{opacity:[0,1],translateY:[c,0],duration:l,ease:`outBack(1.2)`,delay:it(s,{from:u}),onComplete:e=>{e.style.willChange=``}})},[e.staggerMs,e.maxStaggerMs,e.durationMs,e.translateY,e.from]);return(0,_.useEffect)(()=>{let n=t.current;if(!n)return;if(typeof IntersectionObserver>`u`){r();return}let i=!1,a=new IntersectionObserver(e=>{for(let t of e)if(t.isIntersecting&&!i){r(),a.disconnect();return}},{threshold:.08});a.observe(n);let o=n.querySelectorAll(`[data-reveal]`);if(!pt()){let t=e.translateY??14;o.forEach(e=>{e.style.opacity=`0`,e.style.transform=`translateY(${t}px)`})}let s=n.getBoundingClientRect();return s.top<(window.innerHeight||document.documentElement.clientHeight)&&s.bottom>0&&(r(),a.disconnect()),()=>{i=!0,a.disconnect()}},[r,e.translateY]),t}function Nt(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Nt(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Pt(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Nt(e))&&(r&&(r+=` `),r+=t);return r}var Ft=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,It=Pt,Lt=(e,t)=>n=>{if(t?.variants==null)return It(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Ft(t)||Ft(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return It(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Rt=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},zt=(e,t)=>({classGroupId:e,validator:t}),Bt=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Vt=`-`,Ht=[],Ut=`arbitrary..`,Wt=e=>{let t=qt(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Kt(e);let n=e.split(Vt);return Gt(n,n[0]===``&&n.length>1?1:0,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Rt(i,t):t:i||Ht}return n[e]||Ht}}},Gt=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Gt(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Vt):e.slice(t).join(Vt),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Kt=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Ut+r:void 0})(),qt=e=>{let{theme:t,classGroups:n}=e;return Jt(n,t)},Jt=(e,t)=>{let n=Bt();for(let r in e){let i=e[r];Yt(i,n,r,t)}return n},Yt=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Xt(i,t,n,r)}},Xt=(e,t,n,r)=>{if(typeof e==`string`){Zt(e,t,n);return}if(typeof e==`function`){Qt(e,t,n,r);return}$t(e,t,n,r)},Zt=(e,t,n)=>{let r=e===``?t:en(t,e);r.classGroupId=n},Qt=(e,t,n,r)=>{if(tn(e)){Yt(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(zt(n,e))},$t=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Yt(o,en(t,a),n,r)}},en=(e,t)=>{let n=e,r=t.split(Vt),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Bt(),n.nextPart.set(t,i)),n=i}return n},tn=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,nn=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},rn=`!`,an=`:`,on=[],sn=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),cn=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===an){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(rn)?(c=s.slice(0,-1),l=!0):s.startsWith(rn)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return sn(t,l,c,u)};if(t){let e=t+an,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):sn(on,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ln=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},un=e=>({cache:nn(e.cacheSize),parseClassName:cn(e),sortModifiers:ln(e),...Wt(e)}),dn=/\s+/,fn=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(dn),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+rn:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},pn=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=mn(n))&&(i&&(i+=` `),i+=r);return i},mn=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=mn(e[r]))&&(n&&(n+=` `),n+=t);return n},hn=(e,...t)=>{let n,r,i,a,o=o=>(n=un(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=fn(e,n);return i(e,a),a};return a=o,(...e)=>a(pn(...e))},gn=[],_n=e=>{let t=t=>t[e]||gn;return t.isThemeGetter=!0,t},vn=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,yn=/^\((?:(\w[\w-]*):)?(.+)\)$/i,bn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,xn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Sn=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Cn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Tn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,En=e=>bn.test(e),I=e=>!!e&&!Number.isNaN(Number(e)),Dn=e=>!!e&&Number.isInteger(Number(e)),On=e=>e.endsWith(`%`)&&I(e.slice(0,-1)),kn=e=>xn.test(e),An=()=>!0,jn=e=>Sn.test(e)&&!Cn.test(e),Mn=()=>!1,Nn=e=>wn.test(e),Pn=e=>Tn.test(e),Fn=e=>!L(e)&&!R(e),In=e=>Zn(e,tr,Mn),L=e=>vn.test(e),Ln=e=>Zn(e,nr,jn),Rn=e=>Zn(e,rr,I),zn=e=>Zn(e,ar,An),Bn=e=>Zn(e,ir,Mn),Vn=e=>Zn(e,$n,Mn),Hn=e=>Zn(e,er,Pn),Un=e=>Zn(e,or,Nn),R=e=>yn.test(e),Wn=e=>Qn(e,nr),Gn=e=>Qn(e,ir),Kn=e=>Qn(e,$n),qn=e=>Qn(e,tr),Jn=e=>Qn(e,er),Yn=e=>Qn(e,or,!0),Xn=e=>Qn(e,ar,!0),Zn=(e,t,n)=>{let r=vn.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Qn=(e,t,n=!1)=>{let r=yn.exec(e);return r?r[1]?t(r[1]):n:!1},$n=e=>e===`position`||e===`percentage`,er=e=>e===`image`||e===`url`,tr=e=>e===`length`||e===`size`||e===`bg-size`,nr=e=>e===`length`,rr=e=>e===`number`,ir=e=>e===`family-name`,ar=e=>e===`number`||e===`weight`,or=e=>e===`shadow`,sr=hn(()=>{let e=_n(`color`),t=_n(`font`),n=_n(`text`),r=_n(`font-weight`),i=_n(`tracking`),a=_n(`leading`),o=_n(`breakpoint`),s=_n(`container`),c=_n(`spacing`),l=_n(`radius`),u=_n(`shadow`),d=_n(`inset-shadow`),f=_n(`text-shadow`),p=_n(`drop-shadow`),m=_n(`blur`),h=_n(`perspective`),g=_n(`aspect`),_=_n(`ease`),v=_n(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),R,L],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[R,L,c],T=()=>[En,`full`,`auto`,...w()],E=()=>[Dn,`none`,`subgrid`,R,L],ee=()=>[`auto`,{span:[`full`,Dn,R,L]},Dn,R,L],D=()=>[Dn,`auto`,R,L],te=()=>[`auto`,`min`,`max`,`fr`,R,L],ne=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],O=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],re=()=>[`auto`,...w()],ie=()=>[En,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ae=()=>[En,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],oe=()=>[En,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],k=()=>[e,R,L],A=()=>[...b(),Kn,Vn,{position:[R,L]}],se=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ce=()=>[`auto`,`cover`,`contain`,qn,In,{size:[R,L]}],le=()=>[On,Wn,Ln],j=()=>[``,`none`,`full`,l,R,L],M=()=>[``,I,Wn,Ln],N=()=>[`solid`,`dashed`,`dotted`,`double`],ue=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],P=()=>[I,On,Kn,Vn],de=()=>[``,`none`,m,R,L],fe=()=>[`none`,I,R,L],pe=()=>[`none`,I,R,L],me=()=>[I,R,L],he=()=>[En,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[kn],breakpoint:[kn],color:[An],container:[kn],"drop-shadow":[kn],ease:[`in`,`out`,`in-out`],font:[Fn],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[kn],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[kn],shadow:[kn],spacing:[`px`,I],text:[kn],"text-shadow":[kn],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,En,L,R,g]}],container:[`container`],columns:[{columns:[I,L,R,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Dn,`auto`,R,L]}],basis:[{basis:[En,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[I,En,`auto`,`initial`,`none`,L]}],grow:[{grow:[``,I,R,L]}],shrink:[{shrink:[``,I,R,L]}],order:[{order:[Dn,`first`,`last`,`none`,R,L]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ne(),`normal`]}],"justify-items":[{"justify-items":[...O(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...O()]}],"align-content":[{content:[`normal`,...ne()]}],"align-items":[{items:[...O(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...O(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...O(),`baseline`]}],"place-self":[{"place-self":[`auto`,...O()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:re()}],mx:[{mx:re()}],my:[{my:re()}],ms:[{ms:re()}],me:[{me:re()}],mbs:[{mbs:re()}],mbe:[{mbe:re()}],mt:[{mt:re()}],mr:[{mr:re()}],mb:[{mb:re()}],ml:[{ml:re()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ie()}],"inline-size":[{inline:[`auto`,...ae()]}],"min-inline-size":[{"min-inline":[`auto`,...ae()]}],"max-inline-size":[{"max-inline":[`none`,...ae()]}],"block-size":[{block:[`auto`,...oe()]}],"min-block-size":[{"min-block":[`auto`,...oe()]}],"max-block-size":[{"max-block":[`none`,...oe()]}],w:[{w:[s,`screen`,...ie()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ie()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ie()]}],h:[{h:[`screen`,`lh`,...ie()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ie()]}],"max-h":[{"max-h":[`screen`,`lh`,...ie()]}],"font-size":[{text:[`base`,n,Wn,Ln]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Xn,zn]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,On,L]}],"font-family":[{font:[Gn,Bn,t]}],"font-features":[{"font-features":[L]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,R,L]}],"line-clamp":[{"line-clamp":[I,`none`,R,Rn]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,R,L]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,R,L]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...N(),`wavy`]}],"text-decoration-thickness":[{decoration:[I,`from-font`,`auto`,R,Ln]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[I,`auto`,R,L]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,R,L]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,R,L]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:A()}],"bg-repeat":[{bg:se()}],"bg-size":[{bg:ce()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Dn,R,L],radial:[``,R,L],conic:[Dn,R,L]},Jn,Hn]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:j()}],"rounded-s":[{"rounded-s":j()}],"rounded-e":[{"rounded-e":j()}],"rounded-t":[{"rounded-t":j()}],"rounded-r":[{"rounded-r":j()}],"rounded-b":[{"rounded-b":j()}],"rounded-l":[{"rounded-l":j()}],"rounded-ss":[{"rounded-ss":j()}],"rounded-se":[{"rounded-se":j()}],"rounded-ee":[{"rounded-ee":j()}],"rounded-es":[{"rounded-es":j()}],"rounded-tl":[{"rounded-tl":j()}],"rounded-tr":[{"rounded-tr":j()}],"rounded-br":[{"rounded-br":j()}],"rounded-bl":[{"rounded-bl":j()}],"border-w":[{border:M()}],"border-w-x":[{"border-x":M()}],"border-w-y":[{"border-y":M()}],"border-w-s":[{"border-s":M()}],"border-w-e":[{"border-e":M()}],"border-w-bs":[{"border-bs":M()}],"border-w-be":[{"border-be":M()}],"border-w-t":[{"border-t":M()}],"border-w-r":[{"border-r":M()}],"border-w-b":[{"border-b":M()}],"border-w-l":[{"border-l":M()}],"divide-x":[{"divide-x":M()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":M()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...N(),`hidden`,`none`]}],"divide-style":[{divide:[...N(),`hidden`,`none`]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-bs":[{"border-bs":k()}],"border-color-be":[{"border-be":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...N(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[I,R,L]}],"outline-w":[{outline:[``,I,Wn,Ln]}],"outline-color":[{outline:k()}],shadow:[{shadow:[``,`none`,u,Yn,Un]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":[`none`,d,Yn,Un]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:M()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[I,Ln]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":M()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":[`none`,f,Yn,Un]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[I,R,L]}],"mix-blend":[{"mix-blend":[...ue(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ue()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[I]}],"mask-image-linear-from-pos":[{"mask-linear-from":P()}],"mask-image-linear-to-pos":[{"mask-linear-to":P()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":P()}],"mask-image-t-to-pos":[{"mask-t-to":P()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":P()}],"mask-image-r-to-pos":[{"mask-r-to":P()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":P()}],"mask-image-b-to-pos":[{"mask-b-to":P()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":P()}],"mask-image-l-to-pos":[{"mask-l-to":P()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":P()}],"mask-image-x-to-pos":[{"mask-x-to":P()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":P()}],"mask-image-y-to-pos":[{"mask-y-to":P()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[R,L]}],"mask-image-radial-from-pos":[{"mask-radial-from":P()}],"mask-image-radial-to-pos":[{"mask-radial-to":P()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[I]}],"mask-image-conic-from-pos":[{"mask-conic-from":P()}],"mask-image-conic-to-pos":[{"mask-conic-to":P()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:A()}],"mask-repeat":[{mask:se()}],"mask-size":[{mask:ce()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,R,L]}],filter:[{filter:[``,`none`,R,L]}],blur:[{blur:de()}],brightness:[{brightness:[I,R,L]}],contrast:[{contrast:[I,R,L]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Yn,Un]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:[``,I,R,L]}],"hue-rotate":[{"hue-rotate":[I,R,L]}],invert:[{invert:[``,I,R,L]}],saturate:[{saturate:[I,R,L]}],sepia:[{sepia:[``,I,R,L]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,R,L]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[I,R,L]}],"backdrop-contrast":[{"backdrop-contrast":[I,R,L]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,I,R,L]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[I,R,L]}],"backdrop-invert":[{"backdrop-invert":[``,I,R,L]}],"backdrop-opacity":[{"backdrop-opacity":[I,R,L]}],"backdrop-saturate":[{"backdrop-saturate":[I,R,L]}],"backdrop-sepia":[{"backdrop-sepia":[``,I,R,L]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,R,L]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[I,`initial`,R,L]}],ease:[{ease:[`linear`,`initial`,_,R,L]}],delay:[{delay:[I,R,L]}],animate:[{animate:[`none`,v,R,L]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,R,L]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:fe()}],"rotate-x":[{"rotate-x":fe()}],"rotate-y":[{"rotate-y":fe()}],"rotate-z":[{"rotate-z":fe()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":[`scale-3d`],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[R,L,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:he()}],"translate-x":[{"translate-x":he()}],"translate-y":[{"translate-y":he()}],"translate-z":[{"translate-z":he()}],"translate-none":[`translate-none`],accent:[{accent:k()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,R,L]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,R,L]}],fill:[{fill:[`none`,...k()]}],"stroke-w":[{stroke:[I,Wn,Ln,Rn]}],stroke:[{stroke:[`none`,...k()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function z(...e){return sr(Pt(e))}function cr(e){let t=Math.max(0,Math.floor((Date.now()-e*1e3)/1e3));if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}function lr(e){return new Date(e*1e3).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function ur(e,t){try{let e=JSON.parse(t);if(!e||typeof e!=`object`)return t;for(let t of[`command`,`CommandLine`,`Input`,`query`,`Task`,`Prompt`])if(typeof e[t]==`string`&&e[t].length>0)return e[t];for(let t of[`file_path`,`path`,`TargetFile`,`AbsolutePath`,`SearchPath`,`DirectoryPath`,`Url`,`ImageName`])if(typeof e[t]==`string`&&e[t].length>0)return e[t];for(let t of Object.values(e))if(typeof t==`string`&&t.length>0)return t;return``}catch{return t}}var dr=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})),B=o(((e,t)=>{t.exports=dr()}))(),fr=Lt(`flex flex-col min-h-0 overflow-hidden rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)]`,{variants:{variant:{default:``,interactive:`hover:border-[var(--color-line-2)] hover:bg-[var(--color-surface-2)] transition-colors cursor-pointer`,flush:`bg-transparent border-[var(--color-line-0)]`}},defaultVariants:{variant:`default`}});function V({className:e,variant:t,...n}){return(0,B.jsx)(`div`,{className:z(fr({variant:t,className:e})),...n})}function H({className:e,...t}){return(0,B.jsx)(`div`,{className:z(`flex items-center justify-between gap-2 px-3 pt-2 pb-1 shrink-0`,e),...t})}function U({className:e,...t}){return(0,B.jsx)(`div`,{className:z(`px-3 py-3 flex-1 min-h-0 overflow-auto`,e),...t})}var pr=Lt(`inline-flex items-center gap-1 rounded-sm px-1.5 py-0.5 text-[10px] font-mono font-medium leading-none tracking-wide uppercase border whitespace-nowrap`,{variants:{variant:{green:`bg-emerald-500/8 text-emerald-300 border-emerald-500/25`,red:`bg-red-500/8 text-red-300 border-red-500/25`,amber:`bg-amber-500/10 text-amber-300 border-amber-500/30`,blue:`bg-sky-500/8 text-sky-300 border-sky-500/25`,gray:`bg-[var(--color-surface-2)] text-[var(--color-fg-3)] border-[var(--color-line-1)]`,purple:`bg-violet-500/8 text-violet-300 border-violet-500/25`,outline:`bg-transparent text-[var(--color-fg-3)] border-[var(--color-line-1)]`}},defaultVariants:{variant:`outline`}});function mr({className:e,variant:t,...n}){return(0,B.jsx)(`span`,{className:z(pr({variant:t,className:e})),...n})}var hr=Lt(`relative inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-sm text-xs font-medium tracking-wide transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--color-brand)] focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--color-surface-0)] disabled:pointer-events-none disabled:opacity-40 cursor-pointer overflow-hidden`,{variants:{variant:{primary:`bg-[var(--color-brand)] text-black hover:bg-[var(--color-brand-hover)]`,secondary:`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] hover:border-[var(--color-line-2)] hover:bg-[var(--color-surface-2)]`,ghost:`text-[var(--color-fg-2)] hover:text-[var(--color-fg-0)] hover:bg-[var(--color-surface-2)] border border-transparent`,danger:`bg-red-500/5 border border-red-500/30 text-red-300 hover:border-red-500/60 hover:bg-red-500/10 hover:text-red-200`},size:{sm:`h-6 px-2`,md:`h-8 px-3`,icon:`h-7 w-7 p-0`}},defaultVariants:{variant:`primary`,size:`md`}});function gr(e,t){if(pt())return;let n=e.getBoundingClientRect(),r=Math.hypot(n.width,n.height),i=document.createElement(`span`);i.style.position=`absolute`,i.style.left=`${t.clientX-n.left-r/2}px`,i.style.top=`${t.clientY-n.top-r/2}px`,i.style.width=`${r}px`,i.style.height=`${r}px`,i.style.borderRadius=`50%`,i.style.pointerEvents=`none`,i.style.background=`currentColor`,i.style.opacity=`0.22`,i.style.transform=`scale(0)`,i.style.mixBlendMode=`screen`,e.appendChild(i),jt(i,{scale:[0,1],opacity:[.22,0],duration:540,ease:`outExpo`,onComplete:()=>{i.remove()}})}var W=_.forwardRef(({className:e,variant:t,size:n,onMouseDown:r,onClick:i,...a},o)=>(0,B.jsx)(`button`,{ref:o,className:z(hr({variant:t,size:n,className:e})),onMouseDown:e=>{gr(e.currentTarget,e),r?.(e)},onClick:i,...a}));W.displayName=`Button`;var _r=e=>Math.round(e).toLocaleString(void 0,{useGrouping:!0});function vr(e,t){if(e===`cubic`)return{ease:Fe.out,durationMs:t};if(e===`elastic`)return{ease:We(1.05,.45),durationMs:t};let n=et({stiffness:180,damping:22,mass:1});return{ease:n.fn,durationMs:n.duration}}function yr({value:e,duration:t=320,format:n=_r,curve:r=`spring`,className:i}){let[a,o]=(0,_.useState)(e),s=(0,_.useRef)(e),c=(0,_.useRef)(e),l=(0,_.useRef)(0),u=(0,_.useRef)(null),d=(0,_.useRef)(pt());return(0,_.useEffect)(()=>{if(c.current===e)return;if(d.current){c.current=e,s.current=e,o(e);return}s.current=a,c.current=e,l.current=performance.now(),u.current!==null&&cancelAnimationFrame(u.current);let{ease:n,durationMs:i}=vr(r,t),f=e=>{let t=Math.min(1,(e-l.current)/i),r=n(t);o(s.current+(c.current-s.current)*r),t<1?u.current=requestAnimationFrame(f):u.current=null};return u.current=requestAnimationFrame(f),()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null)}},[e,t,r]),(0,B.jsx)(`span`,{className:z(`tabular-nums`,i),children:n(a)})}function br({data:e,width:t=80,height:n=24,color:r=`#38bdf8`,threshold:i,maxValue:a}){if(e.length<2)return(0,B.jsx)(`svg`,{width:t,height:n,className:`shrink-0`,children:(0,B.jsx)(`line`,{x1:0,y1:n/2,x2:t,y2:n/2,stroke:`var(--color-line-2)`,strokeWidth:1})});let o=a??Math.max(...e,1),s=t-2,c=n-2,l=e.map((t,n)=>{let r=1+n/(e.length-1)*s,i=1+c-t/o*c;return`${r.toFixed(1)},${i.toFixed(1)}`}),u=i===void 0?null:1+c-Math.min(i,o)/o*c;return(0,B.jsxs)(`svg`,{width:t,height:n,className:`shrink-0`,children:[(0,B.jsx)(`polyline`,{points:l.join(` `),fill:`none`,stroke:r,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`}),u!==null&&(0,B.jsx)(`line`,{x1:1,y1:u,x2:t-1,y2:u,stroke:`var(--color-brand)`,strokeWidth:1,strokeDasharray:`3,2`,opacity:.7})]})}function xr(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Sr({value:e,samples:t,maxValue:n,width:r=320,height:i=64,windowMs:a=6e4,color:o=`var(--color-brand)`,fillColor:s=`rgba(245, 158, 11, 0.12)`,className:c}){let l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useRef)([]),f=(0,_.useRef)(t??null),p=(0,_.useRef)(e??0),m=(0,_.useRef)(xr());return(0,_.useEffect)(()=>{f.current=t??null},[t]),(0,_.useEffect)(()=>{t===void 0&&e!==void 0&&e!==p.current&&(p.current=e,d.current.push({ts:Date.now(),v:e}),d.current.length>600&&d.current.splice(0,d.current.length-600))},[e,t]),(0,_.useEffect)(()=>{let e=0,t=!1,o=()=>{let s=Date.now(),c=s-a,h;if(f.current){let e=f.current;h=[];for(let t of e)t.ts>=c&&h.push(t)}else{let e=d.current;for(;e.length>1&&e[1].ts<c;)e.shift();(e.length===0||e[e.length-1].ts<s-200)&&e.push({ts:s,v:p.current}),h=e.filter(e=>e.ts>=c)}if(h.length<2)l.current&&l.current.setAttribute(`points`,``),u.current&&u.current.setAttribute(`points`,``);else{let e=n??Math.max(1,...h.map(e=>e.v)),t=[];for(let n of h){let o=(n.ts-c)/a*r,s=i-n.v/e*(i-2)-1;t.push(`${o.toFixed(1)},${s.toFixed(1)}`)}let o=t.join(` `);if(l.current&&l.current.setAttribute(`points`,o),u.current){let e=t[0].split(`,`),n=t[t.length-1].split(`,`),r=`${e[0]},${i} ${o} ${n[0]},${i}`;u.current.setAttribute(`points`,r)}}t||(e=m.current?window.setTimeout(o,500):requestAnimationFrame(o))};return e=m.current?window.setTimeout(o,500):requestAnimationFrame(o),()=>{t=!0,m.current?clearTimeout(e):cancelAnimationFrame(e)}},[r,i,a,n]),(0,B.jsxs)(`svg`,{width:`100%`,height:i,viewBox:`0 0 ${r} ${i}`,className:z(`block`,c),preserveAspectRatio:`none`,children:[(0,B.jsx)(`polygon`,{ref:u,fill:s,stroke:`none`}),(0,B.jsx)(`polyline`,{ref:l,fill:`none`,stroke:o,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`})]})}var Cr=Lt(`hero-metric relative flex flex-col gap-2 rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] px-4 py-3 overflow-hidden`,{variants:{tone:{neutral:`hero-metric--neutral`,amber:`hero-metric--amber`,green:`hero-metric--green`,red:`hero-metric--red`,blue:`hero-metric--blue`,purple:`hero-metric--purple`,gray:`hero-metric--gray`}},defaultVariants:{tone:`neutral`}}),wr={neutral:`var(--color-fg-1)`,amber:`var(--color-brand)`,green:`#34d399`,red:`#f87171`,blue:`#38bdf8`,purple:`#a78bfa`,gray:`var(--color-fg-3)`},Tr={neutral:`rgba(214, 215, 217, 0.10)`,amber:`rgba(245, 158, 11, 0.14)`,green:`rgba(52, 211, 153, 0.14)`,red:`rgba(248, 113, 113, 0.14)`,blue:`rgba(56, 189, 248, 0.14)`,purple:`rgba(167, 139, 250, 0.14)`,gray:`rgba(110, 112, 118, 0.10)`},Er={neutral:`text-[var(--color-fg-0)]`,amber:`text-amber-300`,green:`text-emerald-300`,red:`text-red-300`,blue:`text-sky-300`,purple:`text-violet-300`,gray:`text-[var(--color-fg-2)]`},Dr=1e3,Or=.35;function kr(e,t,n){let r=Date.now(),i=r-n,a=Math.max(2,Math.floor(n/Dr)),o=Array(a).fill(0);for(let n of e){if(t&&!t(n)||n.ts_ms<i||n.ts_ms>r)continue;let e=a-1-Math.floor((r-n.ts_ms)/Dr);e>=0&&e<a&&o[e]++}let s=Array(a),c=o[0];for(let e=0;e<a;e++)c=Or*o[e]+(1-Or)*c,s[e]={ts:i+(e+1)*Dr,v:c};return s}function Ar({label:e,value:t,series:n,burstRing:r,filter:i,sparkWindowMs:a=6e4,sub:o,tone:s,format:c,className:l,...u}){let d=s??`neutral`,f=wr[d]??wr.neutral,p=Tr[d]??Tr.neutral,m=Er[d]??Er.neutral,h=(0,_.useRef)(null),g=(0,_.useRef)(t);(0,_.useEffect)(()=>{if(g.current===t)return;g.current=t;let e=h.current;e&&jt(e,{"--tick":[0,1],duration:160,ease:`outCubic`,onComplete:()=>{jt(e,{"--tick":[1,0],duration:520,ease:`outElastic(1, 0.6)`,onComplete:e=>{e.style.removeProperty(`--tick`)}})}})},[t]);let v=(0,_.useMemo)(()=>r?kr(r,i,a):null,[r,i,a]),y=v!==null,b=!y&&n&&n.length>=2;return(0,B.jsxs)(`div`,{ref:h,className:z(Cr({tone:s,className:l})),...u,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:e}),o?(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:o}):null]}),(0,B.jsxs)(`div`,{className:`flex items-end justify-between gap-3`,children:[(0,B.jsx)(yr,{value:t,format:c,className:z(`text-[2.4rem] leading-none font-semibold tracking-tight`,m)}),y?(0,B.jsx)(Sr,{samples:v,width:108,height:36,windowMs:a,color:f,fillColor:p,className:`shrink-0`}):b?(0,B.jsx)(br,{data:n,width:96,height:28,color:f}):null]})]})}var jr=135,Mr=405,Nr=Mr-jr,Pr=`#34d399`,Fr=`#f59e0b`,Ir=`#ef4444`;function Lr(e,t,n,r){let i=(r-90)*(Math.PI/180);return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}function Rr(e,t,n,r,i){let a=Lr(e,t,n,r),o=Lr(e,t,n,i),s=i-r>180?1:0;return`M ${a.x.toFixed(2)} ${a.y.toFixed(2)} A ${n} ${n} 0 ${s} 1 ${o.x.toFixed(2)} ${o.y.toFixed(2)}`}function zr(e,t){return jr+Math.max(0,Math.min(1,e/Math.max(t,1e-9)))*Nr}function Br(e,t,n){return e+(t-e)*n}function Vr(e){let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]}function Hr(e,t,n){let[r,i,a]=Vr(e),[o,s,c]=Vr(t);return`rgb(${Math.round(Br(r,o,n))},${Math.round(Br(i,s,n))},${Math.round(Br(a,c,n))})`}function Ur(e,t,n){let r=.04;return e<t-r?Pr:e<t+r?Hr(Pr,Fr,(e-(t-r))/(r*2)):e<n-r?Fr:e<n+r?Hr(Fr,Ir,(e-(n-r))/(r*2)):Ir}function Wr(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Gr=0;function Kr(){return Gr=Gr+1|0,Gr.toString(36)}function qr(){if(typeof crypto<`u`&&crypto.getRandomValues){let e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]/4294967296*Math.PI*2}return 0}function Jr({value:e,max:t,warnAt:n=.7,critAt:r=.9,marker50:i,marker99:a,label:o,display:s,displayFormat:c,scaleLabels:l,mode:u=`needle`,size:d=180,className:f,revLights:p=!0,revLightCount:m=20}){let h=Math.ceil(u===`needle`&&l!==void 0?d*.2:d*.08),g=-h,v=-h,y=d+h*2,b=d+h*2,x=d/2,S=d/2,C=d*.42,w=Math.max(0,Math.min(1,e/Math.max(t,1e-9))),T=(0,_.useMemo)(()=>Rr(x,S,C,jr,Mr),[x,S,C]),E=(0,_.useMemo)(()=>Rr(x,S,C-8,jr,Mr),[x,S,C]),ee=jr+n*Nr,D=jr+r*Nr,te=(0,_.useMemo)(()=>Rr(x,S,C,jr,ee),[x,S,C,ee]),ne=(0,_.useMemo)(()=>Rr(x,S,C,ee,D),[x,S,C,ee,D]),O=(0,_.useMemo)(()=>Rr(x,S,C,D,Mr),[x,S,C,D]),re=(0,_.useMemo)(()=>Rr(x,S,C-14,300,420),[x,S,C]),ie=jr+w*Nr,ae=(0,_.useMemo)(()=>Rr(x,S,C,jr,Math.max(jr+.01,ie)),[x,S,C,ie]),oe=Ur(w,n,r),k=(0,_.useMemo)(()=>Kr(),[]),A=`lgf-${k}`,se=`lgfn-${k}`,ce=`lgb-${k}`,le=`lgd-${k}`,j=`lgh-${k}`,M=`lgg-${k}`,N=`lgl-${k}`,ue=(0,_.useMemo)(()=>{if(u!==`needle`)return[];let e=[];for(let t=0;t<=10;t++)e.push(jr+t/10*Nr);return e},[u]),P=(0,_.useMemo)(()=>{if(u!==`needle`)return[];let e=[];for(let t=0;t<=40;t++)t%4!=0&&e.push(jr+t/40*Nr);return e},[u]),de=(0,_.useRef)(null),fe=(0,_.useRef)(null),pe=(0,_.useRef)(null),me=(0,_.useRef)(null),he=(0,_.useRef)(null),ge=(0,_.useRef)(null),_e=(0,_.useRef)(null),ve=(0,_.useRef)(null),ye=(0,_.useRef)([]),be=(0,_.useRef)(e),xe=(0,_.useRef)(t),Se=(0,_.useRef)(n),Ce=(0,_.useRef)(r);(0,_.useEffect)(()=>{be.current=e,xe.current=t,Se.current=n,Ce.current=r},[e,t,n,r]);let we=(0,_.useMemo)(()=>{if(!p||u!==`needle`)return[];let e=Math.max(4,m),t=C-11,n=[];for(let r=0;r<e;r++){let i=jr+(r+.5)/e*Nr;n.push(Lr(x,S,t,i))}return n},[p,m,u,x,S,C]);ye.current.length!==we.length&&(ye.current.length=we.length);let Te=x+C-6,Ee=x+d*.04,De=Math.max(2,d*.016),Oe=`${Te},${S} ${Ee},${S-De} ${Ee},${S+De}`,ke=x-d*.04,Ae=x-C*.24,je=Math.max(1.4,d*.012),F=`${Ae},${S} ${ke},${S-je} ${ke},${S+je}`,Me=d*.48,Ne=d*.17,Pe=x-Me/2,Fe=S+d*.16,Ie=Fe+Ne*.68;return(0,_.useEffect)(()=>{let e=Wr(),t=0,n=!1,r=performance.now(),i=qr(),a=qr(),o=qr(),s=be.current,l=0,d=be.current,f=0,m=be.current,h=g=>{let _=(g-r)/1e3;r=g;let v=Math.min(.04,Math.max(.001,_)),y=be.current,b=xe.current,w=Se.current,T=Ce.current,E=Math.max(b,1e-9),ee=y;if(!e&&u===`needle`){let e=Math.max(0,Math.min(1,s/E)),t=g/1e3,n=(E*.004+E*.016*e*e)*(Math.sin(t*8.7+i)*.46+Math.sin(t*14.3+a)*.31+Math.sin(t*23.7+o)*.23);ee=Math.max(0,Math.min(b,y+n))}if(e)s=y,d=y,m=y,l=0,f=0;else{let e=v/2;for(let t=0;t<2;t++){let t=-210*(s-ee)-22*l;l+=t*e,s+=l*e;let n=-55*(d-s)-13*f;f+=n*e,d+=f*e}let t=1-Math.exp(-v*8);m+=(y-m)*t,Math.abs(m-y)<E*1e-5&&(m=y)}let D=Math.max(0,Math.min(1,s/Math.max(b,1e-9))),te=jr+D*Nr,ne=jr+Math.max(0,Math.min(1,d/Math.max(b,1e-9)))*Nr,O=Ur(D,w,T);if(de.current&&de.current.setAttribute(`transform`,`rotate(${(te-90).toFixed(3)} ${x} ${S})`),fe.current&&fe.current.setAttribute(`fill`,O),pe.current&&pe.current.setAttribute(`fill`,O),me.current&&me.current.setAttribute(`stroke`,O),he.current&&he.current.setAttribute(`transform`,`rotate(${(ne-90).toFixed(3)} ${x} ${S})`),ge.current&&ge.current.setAttribute(`fill`,O),_e.current&&c&&(_e.current.textContent=c(m)),ve.current&&u===`ring`){let e=Math.max(jr+.01,te);ve.current.setAttribute(`d`,Rr(x,S,C,jr,e)),ve.current.setAttribute(`stroke`,O)}if(p&&u===`needle`){let e=ye.current,t=e.length;if(t>0){let n=1/t;for(let r=0;r<t;r++){let i=e[r];if(!i)continue;let a=(r+.5)/t,o=D-a,s=Math.max(0,Math.min(1,.5+o/n));i.setAttribute(`fill`,Ur(a,w,T)),i.setAttribute(`opacity`,s.toFixed(3))}}}n||(t=requestAnimationFrame(h))};return t=requestAnimationFrame(h),()=>{n=!0,cancelAnimationFrame(t)}},[x,S,C,u,p,c]),(0,B.jsxs)(`div`,{className:z(`flex flex-col items-center justify-center gap-1 min-h-0 min-w-0`,f),children:[(0,B.jsxs)(`svg`,{width:y,height:b,viewBox:`${g} ${v} ${y} ${b}`,preserveAspectRatio:`xMidYMid meet`,className:`block max-w-full max-h-full min-h-0`,children:[(0,B.jsxs)(`defs`,{children:[(0,B.jsxs)(`filter`,{id:A,x:`-40%`,y:`-40%`,width:`180%`,height:`180%`,children:[(0,B.jsx)(`feGaussianBlur`,{stdDeviation:`1.2`,result:`blur`}),(0,B.jsxs)(`feMerge`,{children:[(0,B.jsx)(`feMergeNode`,{in:`blur`}),(0,B.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,B.jsxs)(`filter`,{id:se,x:`-60%`,y:`-60%`,width:`220%`,height:`220%`,children:[(0,B.jsx)(`feGaussianBlur`,{stdDeviation:`2.2`,result:`nb`}),(0,B.jsxs)(`feMerge`,{children:[(0,B.jsx)(`feMergeNode`,{in:`nb`}),(0,B.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,B.jsxs)(`radialGradient`,{id:ce,cx:`50%`,cy:`32%`,r:`80%`,children:[(0,B.jsx)(`stop`,{offset:`0%`,stopColor:`#4e535d`}),(0,B.jsx)(`stop`,{offset:`55%`,stopColor:`#2a2e36`}),(0,B.jsx)(`stop`,{offset:`100%`,stopColor:`#0b0d11`})]}),(0,B.jsxs)(`radialGradient`,{id:le,cx:`50%`,cy:`45%`,r:`75%`,children:[(0,B.jsx)(`stop`,{offset:`0%`,stopColor:`#1b1f27`}),(0,B.jsx)(`stop`,{offset:`80%`,stopColor:`#0a0c10`}),(0,B.jsx)(`stop`,{offset:`100%`,stopColor:`#05060a`})]}),(0,B.jsxs)(`radialGradient`,{id:j,cx:`40%`,cy:`30%`,r:`70%`,children:[(0,B.jsx)(`stop`,{offset:`0%`,stopColor:`#f4f5f8`}),(0,B.jsx)(`stop`,{offset:`45%`,stopColor:`#aab1bd`}),(0,B.jsx)(`stop`,{offset:`100%`,stopColor:`#1c1f26`})]}),(0,B.jsxs)(`linearGradient`,{id:M,x1:`50%`,y1:`0%`,x2:`50%`,y2:`100%`,children:[(0,B.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`0.22`}),(0,B.jsx)(`stop`,{offset:`100%`,stopColor:`#ffffff`,stopOpacity:`0`})]}),(0,B.jsxs)(`linearGradient`,{id:N,x1:`50%`,y1:`0%`,x2:`50%`,y2:`100%`,children:[(0,B.jsx)(`stop`,{offset:`0%`,stopColor:`#0a0c11`}),(0,B.jsx)(`stop`,{offset:`100%`,stopColor:`#15181f`})]})]}),u===`needle`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`circle`,{cx:x,cy:S,r:C+12,fill:`url(#${ce})`,stroke:`#000`,strokeOpacity:.55,strokeWidth:1}),(0,B.jsx)(`circle`,{cx:x,cy:S,r:C+5,fill:`none`,stroke:`#0a0c11`,strokeWidth:1}),(0,B.jsx)(`circle`,{cx:x,cy:S,r:C-2,fill:`url(#${le})`})]}):null,(0,B.jsx)(`path`,{d:T,fill:`none`,stroke:`var(--color-line-1)`,strokeWidth:u===`ring`?12:3,strokeLinecap:`round`,opacity:u===`ring`?1:.35}),u===`needle`?(0,B.jsx)(`path`,{d:E,fill:`none`,stroke:`var(--color-line-0)`,strokeWidth:1,strokeLinecap:`round`,opacity:.55}):null,u===`needle`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:te,fill:`none`,stroke:Pr,strokeWidth:5,strokeLinecap:`round`,opacity:.78}),(0,B.jsx)(`path`,{d:ne,fill:`none`,stroke:Fr,strokeWidth:5,strokeLinecap:`round`,opacity:.82}),(0,B.jsx)(`path`,{d:O,fill:`none`,stroke:Ir,strokeWidth:5,strokeLinecap:`round`,opacity:.9}),P.map((e,t)=>{let n=Lr(x,S,C-4,e),r=Lr(x,S,C+2,e);return(0,B.jsx)(`line`,{x1:n.x,y1:n.y,x2:r.x,y2:r.y,stroke:`var(--color-fg-4)`,strokeWidth:.9,strokeLinecap:`round`,opacity:.7},`mi-${t}`)}),ue.map((e,t)=>{let n=Lr(x,S,C-8,e),r=Lr(x,S,C+4,e);return(0,B.jsx)(`line`,{x1:n.x,y1:n.y,x2:r.x,y2:r.y,stroke:`var(--color-fg-2)`,strokeWidth:1.8,strokeLinecap:`round`},`ma-${t}`)}),p?we.map((e,t)=>(0,B.jsx)(`circle`,{ref:e=>{ye.current[t]=e},cx:e.x,cy:e.y,r:Math.max(1.6,d*.013),fill:Pr,opacity:0,filter:`url(#${A})`},t)):null,i===void 0?null:(0,B.jsx)(Yr,{cx:x,cy:S,r:C,angle:zr(i,t),emphasis:!0}),a===void 0?null:(0,B.jsx)(Yr,{cx:x,cy:S,r:C,angle:zr(a,t),emphasis:!0}),l?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Xr,{cx:x,cy:S,r:C,angle:ee,text:l(n),size:d}),(0,B.jsx)(Xr,{cx:x,cy:S,r:C,angle:D,text:l(r),size:d}),(0,B.jsx)(Xr,{cx:x,cy:S,r:C,angle:Mr,text:l(1),size:d})]}):null,(0,B.jsx)(`path`,{d:re,fill:`none`,stroke:`url(#${M})`,strokeWidth:d*.14,strokeLinecap:`butt`}),c||s!==void 0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`rect`,{x:Pe,y:Fe,width:Me,height:Ne,rx:d*.022,ry:d*.022,fill:`url(#${N})`,stroke:`#242a33`,strokeWidth:1}),(0,B.jsx)(`rect`,{x:Pe+1,y:Fe+1,width:Me-2,height:1,fill:`#ffffff`,opacity:.08})]}):null,(0,B.jsx)(`g`,{ref:he,opacity:.28,children:(0,B.jsx)(`polygon`,{ref:ge,points:Oe,fill:oe,filter:`url(#${se})`})}),(0,B.jsxs)(`g`,{ref:de,children:[(0,B.jsx)(`polygon`,{ref:fe,points:Oe,fill:oe,stroke:`#05070a`,strokeWidth:.6,filter:`url(#${se})`}),(0,B.jsx)(`polygon`,{ref:pe,points:F,fill:oe,opacity:.7})]}),(0,B.jsx)(`circle`,{cx:x,cy:S,r:d*.06,fill:`url(#${j})`,stroke:`#06080c`,strokeWidth:1}),(0,B.jsx)(`circle`,{ref:me,cx:x,cy:S,r:d*.036,fill:`#0a0c11`,stroke:oe,strokeWidth:1.4}),(0,B.jsx)(`circle`,{cx:x,cy:S,r:d*.012,fill:`#f5f7fb`,opacity:.9})]}):(0,B.jsx)(`path`,{ref:ve,d:ae,fill:`none`,stroke:oe,strokeWidth:12,strokeLinecap:`round`}),u===`needle`&&(c||s!==void 0)?c?(0,B.jsx)(`text`,{ref:_e,x,y:Ie,textAnchor:`middle`,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:d*.1,fontWeight:600,fill:`#e8ecf3`,children:c(e)}):(0,B.jsx)(`text`,{x,y:Ie,textAnchor:`middle`,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:d*.1,fontWeight:600,fill:`#e8ecf3`,children:s}):c?(0,B.jsx)(`text`,{ref:_e,x,y:S+4,textAnchor:`middle`,className:`font-mono tabular-nums`,fontSize:d*.13,fill:`var(--color-fg-0)`,children:c(e)}):s===void 0?null:(0,B.jsx)(`text`,{x,y:S+4,textAnchor:`middle`,className:`font-mono tabular-nums`,fontSize:d*.13,fill:`var(--color-fg-0)`,children:s})]}),o?(0,B.jsx)(`span`,{className:`overline shrink-0 tracking-[0.12em] uppercase`,children:o}):null]})}function Yr({cx:e,cy:t,r:n,angle:r,emphasis:i=!1}){let a=Lr(e,t,n-(i?10:6),r),o=Lr(e,t,n+(i?8:6),r);return(0,B.jsx)(`line`,{x1:a.x,y1:a.y,x2:o.x,y2:o.y,stroke:i?`var(--color-fg-1)`:`var(--color-fg-2)`,strokeWidth:i?2:1.5,strokeLinecap:`round`})}function Xr({cx:e,cy:t,r:n,angle:r,text:i,size:a}){let o=Lr(e,t,n+Math.max(16,a*.1),r),s=r>=135&&r<215?`end`:r>=325?`start`:`middle`;return(0,B.jsx)(`text`,{x:o.x,y:o.y,textAnchor:s,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:a*.062,fontWeight:600,fill:`var(--color-fg-2)`,stroke:`var(--color-bg-0)`,strokeWidth:3,paintOrder:`stroke`,children:i})}var G={containerPaddingY:24,containerPaddingX:24,topToTrendGap:12,scatterHeaderH:18,scatterLegendH:16,scatterInnerGap:8,trendRowH:28,trendRowGap:6,trendTopPad:9,scatterAbsoluteMin:60,scatterAcceptableMin:70,gaugeFootprintFactor:1.36,gaugeAbsoluteMin:84,gaugeAbsoluteMax:240};function Zr(e,t,n=200){let r=Math.max(0,Math.floor(e)),i=Math.max(0,Math.floor(t)),a=Math.max(0,r-G.containerPaddingX),o=Math.max(0,i-G.containerPaddingY),s=o-(G.trendRowH*3+G.trendRowGap*2+G.trendTopPad+G.topToTrendGap),c=s-G.scatterHeaderH-G.scatterLegendH-G.scatterInnerGap>=G.scatterAcceptableMin,l=c?s:o,u=l-G.scatterHeaderH-G.scatterLegendH-G.scatterInnerGap,d=u>=G.scatterAbsoluteMin,f=u>=G.scatterAbsoluteMin&&l>=140,p=Math.floor(l/G.gaugeFootprintFactor),m=Math.floor(a*.45/G.gaugeFootprintFactor),h=Math.max(G.gaugeAbsoluteMin,Math.min(G.gaugeAbsoluteMax,n,p,m)),g=Math.ceil(h*G.gaugeFootprintFactor+8),_=l-(d?G.scatterHeaderH:0)-(f?G.scatterLegendH:0)-G.scatterInnerGap;return{gaugeSize:h,gaugeColumnMaxWidth:g,scatterMinHeight:Math.max(G.scatterAbsoluteMin,Math.min(160,_)),showTrendRows:c,showScatterHeader:d,showLegend:f,variant:o>=480?`wide`:o>=300?`normal`:`compact`}}var Qr={allow:`#34d399`,block:`#ef4444`,ask:`#f59e0b`,log:`#a78bfa`,force:`#38bdf8`,shadow:`#6e7076`};function $r(e){return!Number.isFinite(e)||e<=0?`—`:e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:`${(e/1e6).toFixed(2)} ms`}function ei({latency:e,bursts:t,gaugeMaxMs:n=10,windowMs:r=3e4,trendWindowSec:i=60,gaugeSize:a=200,compact:o=!1,className:s}){let c=e?e.p50_ns/1e6:0,l=e?e.p95_ns/1e6:0,u=e?e.p99_ns/1e6:0,d=(0,_.useRef)(null),[f,p]=(0,_.useState)((0,_.useMemo)(()=>Zr(a*2,a*2,a),[a]));(0,_.useEffect)(()=>{let e=d.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=0,r=0,i=e=>{let t=Math.round(e.width),i=Math.round(e.height);t===n&&i===r||(n=t,r=i,p(Zr(t,i,a)))};i(e.getBoundingClientRect());let o=new ResizeObserver(e=>{let n=e[0];n&&(t&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{i(n.contentRect)}))});return o.observe(e),()=>{t&&cancelAnimationFrame(t),o.disconnect()}},[a]);let m=(0,_.useRef)(null),h=(0,_.useRef)([]),g=(0,_.useRef)(0);(0,_.useEffect)(()=>{if(t.length===0)return;let e=h.current,n=g.current,i=n;for(let r of t)r.ts_ms<=n||(e.push({ts:r.ts_ms,durationNs:r.duration_ns,color:Qr[r.decision]??`#6e7076`}),r.ts_ms>i&&(i=r.ts_ms));g.current=i;let a=Date.now()-r*2;for(;e.length&&e[0].ts<a;)e.shift()},[t,r]),(0,_.useEffect)(()=>{let e=m.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let i=0,a=!1,o=0,s=0,c=0,l=8e3,u=.25,d=1e3,f=n*1e6,p=Math.log10(d),g=Math.log10(f),_=()=>{let n=window.devicePixelRatio||1,m=e.clientWidth,v=e.clientHeight;if(m===0||v===0){a||(i=requestAnimationFrame(_));return}(m!==s||v!==c||n!==o)&&(e.width=Math.floor(m*n),e.height=Math.floor(v*n),t.setTransform(n,0,0,n,0,0),s=m,c=v,o=n),t.clearRect(0,0,m,v),t.strokeStyle=`rgba(110, 112, 118, 0.18)`,t.lineWidth=1,t.setLineDash([2,4]);let y=[{ns:1e5,label:`100µs`},{ns:1e6,label:`1ms`},{ns:1e7,label:`10ms`}];t.font=`9px ui-monospace, SFMono-Regular, Menlo, monospace`,t.textBaseline=`middle`,t.fillStyle=`rgba(110, 112, 118, 0.7)`;for(let e of y){if(e.ns<d||e.ns>f)continue;let n=v-(Math.log10(e.ns)-p)/(g-p)*v;t.beginPath(),t.moveTo(0,n),t.lineTo(m-28,n),t.stroke(),t.fillText(e.label,m-26,n)}t.setLineDash([]);let b=Date.now(),x=b-r,S=h.current;for(;S.length&&S[0].ts<x;)S.shift();t.globalCompositeOperation=`source-over`;for(let e of S){let n=(e.ts-x)/r*m,i=Math.max(d,Math.min(f,e.durationNs)),a=v-(Math.log10(i)-p)/(g-p)*v,o=b-e.ts,s;if(o<=l)s=1-o/l*(1-u);else{let e=r-l;s=e>0?Math.max(0,u*(1-(o-l)/e)):0}s<=0||(t.globalAlpha=s,t.fillStyle=e.color,t.beginPath(),t.arc(n,a,2.5,0,Math.PI*2),t.fill())}t.globalAlpha=1,t.fillStyle=`rgba(110, 112, 118, 0.55)`,t.font=`9px ui-monospace, SFMono-Regular, Menlo, monospace`,t.textBaseline=`bottom`,t.textAlign=`left`,t.fillText(`← ${Math.round(r/1e3)} s ago`,4,v-2),t.textAlign=`right`,t.fillText(`now →`,m-4,v-2),t.textAlign=`left`,a||(i=requestAnimationFrame(_))};return i=requestAnimationFrame(_),()=>{a=!0,cancelAnimationFrame(i)}},[r,n]);let v=(0,_.useRef)({p50:[],p95:[],p99:[]});(0,_.useEffect)(()=>{if(!e)return;let t=v.current,n=Date.now(),r=n-i*1e3,a=(e,t)=>{let i=t/1e6;for(e.length===0&&e.push({ts:r,v:i}),e.push({ts:n,v:i});e.length>1&&e[0].ts<r;)e.shift()};a(t.p50,e.p50_ns),a(t.p95,e.p95_ns),a(t.p99,e.p99_ns)},[e,i]);let y=(0,_.useMemo)(()=>{let e=v.current;return{p50:[...e.p50],p95:[...e.p95],p99:[...e.p99]}},[e]);return(0,B.jsxs)(`div`,{ref:d,"data-lt-variant":f.variant,className:z(`flex h-full min-h-0 flex-col gap-3 overflow-hidden rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] p-3`,s),children:[(0,B.jsxs)(`div`,{className:z(`grid gap-3 min-h-0 flex-1`,`grid-cols-[auto_1fr]`),children:[(0,B.jsx)(`div`,{className:`flex items-stretch justify-center overflow-hidden min-h-0 min-w-0`,style:{maxWidth:f.gaugeColumnMaxWidth},children:(0,B.jsx)(Jr,{value:l,max:n,warnAt:Math.min(.85,.5/n),critAt:Math.min(.92,2/n),marker50:c,marker99:u,displayFormat:e=>$r(e*1e6),scaleLabels:f.gaugeSize>=130?e=>$r(e*n*1e6):void 0,size:f.gaugeSize,label:`p95 latency`})}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0 min-h-0 flex-1`,children:[f.showScatterHeader?(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 shrink-0 min-w-0`,children:[(0,B.jsx)(`span`,{className:`overline truncate min-w-0`,children:`live trace · 30 s scatter`}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] shrink min-w-0 truncate text-right`,children:[h.current.length,` live · log-Y`]})]}):null,f.showLegend?(0,B.jsx)(`div`,{className:`shrink-0`,children:(0,B.jsx)(ti,{})}):null,(0,B.jsx)(`canvas`,{ref:m,"data-testid":`latency-scatter-canvas`,className:`block w-full flex-1 min-h-0 rounded-sm bg-[var(--color-surface-0)] border border-[var(--color-line-0)]`,style:{minHeight:f.scatterMinHeight}})]})]}),f.showTrendRows?(0,B.jsxs)(`div`,{"data-testid":`latency-trend-rows`,className:`grid grid-cols-1 gap-1.5 pt-2 border-t border-[var(--color-line-0)]`,children:[(0,B.jsx)(ni,{label:`p50 · median`,value:$r(e?.p50_ns??0),color:`#34d399`,fill:`rgba(52, 211, 153, 0.14)`,samples:y.p50,windowMs:i*1e3}),(0,B.jsx)(ni,{label:`p95 · 95th`,value:$r(e?.p95_ns??0),color:`#38bdf8`,fill:`rgba(56, 189, 248, 0.14)`,samples:y.p95,windowMs:i*1e3}),(0,B.jsx)(ni,{label:`p99 · 99th`,value:$r(e?.p99_ns??0),color:`#6366f1`,fill:`rgba(99, 102, 241, 0.14)`,samples:y.p99,windowMs:i*1e3})]}):null]})}function ti(){return(0,B.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[{key:`allow`,color:Qr.allow},{key:`ask`,color:Qr.ask},{key:`block`,color:Qr.block},{key:`force`,color:Qr.force},{key:`log`,color:Qr.log},{key:`shadow`,color:Qr.shadow}].map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full`,style:{background:e.color}}),(0,B.jsx)(`span`,{className:`uppercase tracking-wide`,children:e.key})]},e.key))})}function ni({label:e,value:t,color:n,fill:r,samples:i,windowMs:a}){return(0,B.jsxs)(`div`,{className:`grid grid-cols-[72px_minmax(0,1fr)_92px] items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`overline text-right truncate min-w-0`,children:e}),(0,B.jsx)(Sr,{samples:i,width:1200,height:28,windowMs:a,color:n,fillColor:r,className:`w-full h-7`}),(0,B.jsx)(`span`,{className:`text-[11px] font-mono tabular-nums text-right truncate min-w-0`,style:{color:n},title:t,children:t})]})}function ri({counters:e,className:t,showLegend:n=!0}){let r=[{key:`allow`,label:`Allow`,value:e.allow,color:`#34d399`,textClass:`text-emerald-300`},{key:`ask`,label:`Ask`,value:e.ask,color:`#f59e0b`,textClass:`text-amber-300`},{key:`block`,label:`Block`,value:e.block,color:`#ef4444`,textClass:`text-red-300`},{key:`force`,label:`Force`,value:e.force,color:`#38bdf8`,textClass:`text-sky-300`},{key:`log`,label:`Log`,value:e.log,color:`#a78bfa`,textClass:`text-violet-300`},{key:`shadow`,label:`Shadow`,value:e.shadow,color:`#6e7076`,textClass:`text-[var(--color-fg-3)]`}],i=r.reduce((e,t)=>e+t.value,0),a=(0,_.useRef)(null),o=(0,_.useRef)({});return(0,_.useEffect)(()=>{let e=a.current;if(!e)return;let t=e.querySelectorAll(`[data-seg]`);if(t.length===0)return;let n=pt();t.forEach(e=>{let t=e.dataset.seg,a=r.find(e=>e.key===t);if(!a)return;let s=i===0?0:a.value/i*100,c=o.current[t]??0;if(n||Math.abs(c-s)<.01)e.style.width=`${s}%`;else{let t=s>c?`outExpo`:`outElastic(1.02, 0.4)`;jt(e,{width:[`${c}%`,`${s}%`],duration:480,ease:t})}o.current[t]=s})},[e,i]),(0,B.jsxs)(`div`,{className:z(`flex flex-col gap-2`,t),children:[(0,B.jsx)(`div`,{ref:a,className:`flex h-3 w-full overflow-hidden rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-2)]`,children:i===0?(0,B.jsx)(`div`,{className:`w-full bg-[var(--color-surface-3)]`}):r.map(e=>(0,B.jsx)(`div`,{"data-seg":e.key,style:{width:`${i===0?0:e.value/i*100}%`,background:e.color}},e.key))}),n?(0,B.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-[11px] font-mono`,children:r.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2 min-w-0`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,B.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-sm`,style:{background:e.color}}),(0,B.jsx)(`span`,{className:z(`uppercase tracking-wide truncate`,e.textClass),children:e.label})]}),(0,B.jsx)(yr,{value:e.value,className:`shrink-0 tabular-nums text-[var(--color-fg-1)]`})]},e.key))}):null]})}function ii(e){return e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m ${Math.floor(e%60)}s`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`}function ai(e,t){if(t===void 0||t<=0)return`var(--color-brand)`;let n=e/t;return n>=.9?`#ef4444`:n>=.7?`#f59e0b`:`#34d399`}function oi(e){return e===`#ef4444`?`rgba(239, 68, 68, 0.14)`:e===`#f59e0b`?`rgba(245, 158, 11, 0.14)`:e===`#34d399`?`rgba(52, 211, 153, 0.14)`:e===`#a78bfa`?`rgba(167, 139, 250, 0.14)`:`rgba(245, 158, 11, 0.12)`}function si(e,t){if(e.length===0)return[];let n=Date.now(),r=t/Math.max(1,e.length),i=Array(e.length);for(let t=0;t<e.length;t++)i[t]={ts:n-(e.length-1-t)*r,v:e[t]};return i}function ci({cpuPct:e,cpuSeries:t,cpuLimit:n,memMb:r,memSeries:i,memLimit:a,heapUsedMb:o,heapTotalMb:s,heapSeries:c,uptimeSec:l,className:u}){let d=6e4,f=ai(e,n),p=ai(r,a),m=`#a78bfa`,h=(0,_.useMemo)(()=>si(t,d),[t]),g=(0,_.useMemo)(()=>si(i,d),[i]),v=(0,_.useMemo)(()=>si(c,d),[c]),y=(0,_.useRef)([]);(0,_.useEffect)(()=>{let e=y.current.filter(e=>!!e);if(e.length===0)return;e.forEach(e=>{e.style.opacity=`0`,e.style.transform=`translateY(28px) scale(0.94)`});let t=jt(e,{translateY:[28,0],scale:[.94,1],opacity:[0,1],duration:720,delay:it(140),ease:`outBack(1.25)`,onComplete:e=>{e.style.transform=``}});return()=>t.cancel()},[]);let b=n!==void 0&&n>0&&e>=n*.9,x=a!==void 0&&a>0&&r>=a*.9;return(0,B.jsx)(`div`,{className:z(`rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] p-3`,u),children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:[(0,B.jsx)(li,{registerRef:e=>y.current[0]=e,label:`CPU`,color:f,fill:oi(f),pulse:b,valueNode:(0,B.jsxs)(`span`,{children:[(0,B.jsx)(yr,{value:e,format:e=>e.toFixed(1),className:`text-[var(--color-fg-0)]`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-base`,children:`%`})]}),subText:n?`limit ${n}%`:void 0,samples:h,maxValue:100,windowMs:d}),(0,B.jsx)(li,{registerRef:e=>y.current[1]=e,label:`Memory`,color:p,fill:oi(p),pulse:x,valueNode:(0,B.jsxs)(`span`,{children:[(0,B.jsx)(yr,{value:r,format:e=>e.toFixed(0),className:`text-[var(--color-fg-0)]`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-base`,children:`MB`})]}),subText:a?`limit ${a} MB`:void 0,samples:g,maxValue:a?a*1.1:void 0,windowMs:d}),(0,B.jsx)(li,{registerRef:e=>y.current[2]=e,label:`Heap`,color:m,fill:oi(m),valueNode:(0,B.jsxs)(`span`,{children:[(0,B.jsx)(yr,{value:o,format:e=>e.toFixed(0),className:`text-[var(--color-fg-0)]`}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-base`,children:[`/ `,s.toFixed(0),` MB`]})]}),subText:s>0?`${(o/s*100).toFixed(0)}% used`:void 0,samples:v,maxValue:s>0?s:void 0,windowMs:d}),(0,B.jsx)(li,{registerRef:e=>y.current[3]=e,label:`Uptime`,color:`var(--color-fg-2)`,fill:`rgba(214, 215, 217, 0.04)`,valueNode:(0,B.jsx)(`span`,{className:`text-[var(--color-fg-0)] tabular-nums`,children:ii(l)}),subText:`since daemon start`})]})})}function li({label:e,valueNode:t,subText:n,color:r,fill:i,samples:a,maxValue:o,windowMs:s,pulse:c,registerRef:l}){let u=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!c||!u.current)return;let e=!1,t=null,n=()=>{e||!u.current||(t=jt(u.current,{"--breach":[0,1],duration:420,ease:`outCubic`,onComplete:()=>{e||!u.current||(t=jt(u.current,{"--breach":[1,0],duration:560,ease:`outCubic`,onComplete:()=>{e||n()}}))}}))};return n(),()=>{e=!0,t?.cancel();let n=u.current;n&&n.style.removeProperty(`--breach`)}},[c]),(0,B.jsxs)(`div`,{ref:e=>{u.current=e,l(e)},className:`flex flex-col gap-2 rounded-sm border bg-[var(--color-surface-0)] border-[var(--color-line-1)] px-4 py-3 min-h-[140px] system-pulse__tile`,"data-breach":c?`true`:void 0,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:e}),n?(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:n}):null]}),(0,B.jsx)(`span`,{className:`text-[1.9rem] leading-none font-semibold tracking-tight font-mono`,style:{color:r},children:t}),a&&a.length>=2?(0,B.jsx)(`div`,{className:`mt-auto`,children:(0,B.jsx)(Sr,{samples:a,width:320,height:64,windowMs:s??6e4,color:r,fillColor:i,maxValue:o,className:`w-full`})}):(0,B.jsx)(`div`,{className:`mt-auto h-[64px] flex items-end`,children:(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`— no series —`})})]})}var ui=Lt(`relative font-mono text-[11px] overflow-hidden border bg-[var(--color-surface-1)] border-[var(--color-line-1)] rounded-sm`,{variants:{density:{compact:``,roomy:`text-[12px]`}},defaultVariants:{density:`compact`}}),di={allow:`#34d399`,block:`#ef4444`,ask:`#f59e0b`,log:`#a78bfa`,force:`#38bdf8`,shadow:`#6e7076`},fi={allow:`text-emerald-300`,block:`text-red-300`,ask:`text-amber-300`,log:`text-violet-300`,force:`text-sky-300`,shadow:`text-[var(--color-fg-3)]`};function pi(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function mi(e){return e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:e<1e9?`${(e/1e6).toFixed(2)} ms`:`${(e/1e9).toFixed(2)} s`}function hi(e){return e.variant===`raw`?(0,B.jsx)(_i,{...e}):(0,B.jsx)(gi,{...e})}function gi({bursts:e,windowSize:t=60,filterDecision:n,filterClient:r,className:i,density:a,height:o=260}){let[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),u=(0,_.useMemo)(()=>{let i=e;n&&(i=i.filter(e=>e.decision===n)),r&&(i=i.filter(e=>e.client===r));let a=i.slice(-t),o=Array(a.length);for(let e=0;e<a.length;e++)o[e]=a[a.length-1-e];return o},[e,n,r,t]);s?l.current===null&&(l.current=u):l.current=null;let d=s&&l.current?l.current:u,f=(0,_.useRef)(null),p=(0,_.useRef)(0);return(0,_.useLayoutEffect)(()=>{if(s)return;let e=d[0];if(!e||e.ts_ms===p.current)return;p.current=e.ts_ms;let t=f.current;t&&(pt()||jt(t,{translateX:[-10,0],opacity:[0,1],duration:220,ease:`outExpo`}))},[d,s]),(0,B.jsxs)(`div`,{className:z(ui({density:a,className:i})),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,B.jsx)(`div`,{className:`overflow-auto`,style:{height:o},children:d.length===0?(0,B.jsx)(`div`,{className:`px-3 py-4 text-[var(--color-fg-4)]`,children:`— waiting for events —`}):d.map((e,t)=>(0,B.jsxs)(`div`,{ref:t===0?f:void 0,className:`telemetry-row grid items-center gap-2 px-3 py-1 border-b border-[var(--color-line-0)] last:border-b-0 hover:bg-[var(--color-surface-2)]`,style:{gridTemplateColumns:`90px 56px 1fr 1fr 80px 90px`,borderLeft:`3px solid ${di[e.decision]??`#666`}`},children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:pi(e.ts_ms)}),(0,B.jsx)(`span`,{className:z(`uppercase tracking-wide font-medium`,fi[e.decision]??`text-[var(--color-fg-2)]`),children:e.decision}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,children:e.tool||`—`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)] truncate`,children:e.rule_id??`—`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums text-right`,children:mi(e.duration_ns)}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate text-right`,children:e.client})]},`${e.ts_ms}-${t}`))}),s?(0,B.jsx)(vi,{}):null]})}function _i({lines:e,windowSize:t=300,className:n,density:r,height:i=260}){let[a,o]=(0,_.useState)(!1),s=(0,_.useRef)(null),c=(0,_.useMemo)(()=>{let n=e.slice(-t),r=Array(n.length);for(let e=0;e<n.length;e++)r[e]=n[n.length-1-e];return r},[e,t]);a?s.current===null&&(s.current=c):s.current=null;let l=a&&s.current?s.current:c;return(0,B.jsxs)(`div`,{className:z(ui({density:r,className:n})),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[(0,B.jsx)(`div`,{className:`overflow-auto px-3 py-2 leading-relaxed text-[var(--color-fg-2)] whitespace-pre`,style:{height:i},children:l.length===0?(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`— empty —`}):l.map((e,t)=>(0,B.jsx)(`div`,{className:`hover:bg-[var(--color-surface-2)]`,children:e},`${t}-${e.length}`))}),a?(0,B.jsx)(vi,{}):null]})}function vi(){return(0,B.jsx)(`span`,{className:`absolute top-1 right-2 text-[10px] uppercase tracking-wider font-mono text-[var(--color-brand)] bg-[var(--color-surface-0)] px-1.5 py-0.5 border border-[var(--color-brand)]/40 rounded-sm`,children:`paused`})}var yi=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),bi=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),xi=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Si=e=>{let t=xi(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ci={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`},wi=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Ti=(0,_.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,_.createElement)(`svg`,{ref:c,...Ci,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:yi(`lucide`,i),...!a&&!wi(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,_.createElement)(e,t)),...Array.isArray(a)?a:[a]])),Ei=(e,t)=>{let n=(0,_.forwardRef)(({className:n,...r},i)=>(0,_.createElement)(Ti,{ref:i,iconNode:t,className:yi(`lucide-${bi(Si(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Si(e),n},Di=Ei(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),K=Ei(`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`}]]),Oi=Ei(`grip-horizontal`,[[`circle`,{cx:`12`,cy:`9`,r:`1`,key:`124mty`}],[`circle`,{cx:`19`,cy:`9`,r:`1`,key:`1ruzo2`}],[`circle`,{cx:`5`,cy:`9`,r:`1`,key:`1a8b28`}],[`circle`,{cx:`12`,cy:`15`,r:`1`,key:`1e56xg`}],[`circle`,{cx:`19`,cy:`15`,r:`1`,key:`1a92ep`}],[`circle`,{cx:`5`,cy:`15`,r:`1`,key:`5r1jwy`}]]),ki=Ei(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Ai=Ei(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),ji=Ei(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Mi=Ei(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Ni=Ei(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Pi=Ei(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Fi=[`hero-metrics`,`graph`,`latency-trace`,`throughput`,`decision-mix`,`telemetry-feed`,`system-pulse`,`pending-approvals`,`recent-blocks`],Ii={"hero-metrics":`Hero metrics`,graph:`Graph intelligence`,"latency-trace":`Latency trace`,throughput:`Throughput`,"decision-mix":`Decision mix`,"telemetry-feed":`Telemetry feed`,"system-pulse":`System pulse`,"pending-approvals":`Pending approvals`,"recent-blocks":`Recent blocks`},Li={"hero-metrics":{minW:6,minH:1,defaultW:12,defaultH:1},graph:{minW:4,minH:3,defaultW:8,defaultH:5},"latency-trace":{minW:4,minH:3,defaultW:8,defaultH:4},throughput:{minW:2,minH:2,defaultW:4,defaultH:2},"decision-mix":{minW:2,minH:2,defaultW:4,defaultH:2},"telemetry-feed":{minW:6,minH:3,defaultW:12,defaultH:4},"system-pulse":{minW:4,minH:3,defaultW:12,defaultH:3},"pending-approvals":{minW:3,minH:2,defaultW:6,defaultH:3},"recent-blocks":{minW:3,minH:2,defaultW:6,defaultH:3}};function Ri({panel:e,isEditing:t,children:n,drag:r}){let i=(0,_.useRef)(null),a={gridColumn:`${e.x+1} / span ${e.w}`,gridRow:`${e.y+1} / span ${e.h}`};return(0,B.jsxs)(`div`,{ref:i,className:`grid-panel ${t?`grid-panel--edit`:``}`,style:a,role:t?`region`:void 0,"aria-label":t?Ii[e.id]:void 0,tabIndex:t?0:void 0,onKeyDown:t?t=>r.onPanelKeyDown(t,e.id):void 0,"data-panel-id":e.id,children:[t&&(0,B.jsx)(`button`,{type:`button`,className:`grid-panel__drag-handle`,title:`Drag ${Ii[e.id]} (or Arrow keys)`,"aria-label":`Drag ${Ii[e.id]}`,onPointerDown:t=>{let n=i.current;n&&r.onDragPointerDown(t,e.id,n)},children:(0,B.jsx)(Oi,{size:12,strokeWidth:2})}),(0,B.jsx)(`div`,{className:`grid-panel__content`,"data-reveal":t?void 0:``,children:n}),t&&(0,B.jsx)(`button`,{type:`button`,className:`grid-panel__resize-handle`,title:`Resize ${Ii[e.id]} (or Shift+Arrow keys)`,"aria-label":`Resize ${Ii[e.id]}`,onPointerDown:t=>{let n=i.current;n&&r.onResizePointerDown(t,e.id,n)},children:(0,B.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,"aria-hidden":!0,children:[(0,B.jsx)(`path`,{d:`M10 0 L10 10 L0 10 Z`,fill:`currentColor`,fillOpacity:`0.4`}),(0,B.jsx)(`path`,{d:`M3 10 L10 3 M6 10 L10 6 M9 10 L10 9`,stroke:`currentColor`,strokeWidth:`0.8`,fill:`none`})]})})]})}var zi=(0,_.memo)(Ri);function Bi(e){let t=getComputedStyle(e),n=e.getBoundingClientRect(),r=parseFloat(t.rowGap||t.gap||`0`)||0,i=r*11;return{cellWidthPx:(n.width-i)/12+r,cellHeightPx:72+r}}function Vi(e){let t=(0,_.useRef)(null),n=(0,_.useRef)(e);n.current=e;let r=(0,_.useCallback)(()=>{let e=t.current;if(e){e.element.style.transform=``,e.element.style.width=``,e.element.style.height=``,e.element.style.zIndex=``,e.element.classList.remove(`grid-panel--dragging`),e.element.classList.remove(`grid-panel--resizing`);try{e.element.releasePointerCapture(e.pointerId)}catch{}t.current=null}},[]);(0,_.useEffect)(()=>{function e(e){let n=t.current;if(!n||e.pointerId!==n.pointerId)return;let r=e.clientX-n.startPointerX,i=e.clientY-n.startPointerY;if(n.mode===`drag`)n.element.style.transform=`translate3d(${r}px, ${i}px, 0)`;else{let e=Li[n.startPanel.id],t=e.minW*n.cellWidthPx-n.cellWidthPx+40,a=e.minH*n.cellHeightPx-n.cellHeightPx+40,o=Math.max(t,n.startRectW+r),s=Math.max(a,n.startRectH+i);n.element.style.width=`${o}px`,n.element.style.height=`${s}px`}}function i(e,t,n){let r=Li[e.startPanel.id];if(e.mode===`drag`){let r=Math.round(t/e.cellWidthPx),i=Math.round(n/e.cellHeightPx),a=e.startPanel.x+r,o=e.startPanel.y+i;return a<0&&(a=0),a+e.startPanel.w>12&&(a=12-e.startPanel.w),o<0&&(o=0),{id:e.id,x:a,y:o,w:e.startPanel.w,h:e.startPanel.h}}let i=Math.round(t/e.cellWidthPx),a=Math.round(n/e.cellHeightPx),o=e.startPanel.w+i,s=e.startPanel.h+a;return o<r.minW&&(o=r.minW),s<r.minH&&(s=r.minH),e.startPanel.x+o>12&&(o=12-e.startPanel.x),{id:e.id,x:e.startPanel.x,y:e.startPanel.y,w:o,h:s}}function a(e){let a=t.current;if(!a||e.pointerId!==a.pointerId)return;let o=i(a,e.clientX-a.startPointerX,e.clientY-a.startPointerY);r(),o.x===a.startPanel.x&&o.y===a.startPanel.y&&o.w===a.startPanel.w&&o.h===a.startPanel.h||n.current.onCommit(o)}function o(e){let n=t.current;!n||e.pointerId!==n.pointerId||r()}function s(e){e.key===`Escape`&&t.current&&r()}function c(){document.visibilityState===`hidden`&&t.current&&r()}return document.addEventListener(`pointermove`,e),document.addEventListener(`pointerup`,a),document.addEventListener(`pointercancel`,o),document.addEventListener(`keydown`,s),document.addEventListener(`visibilitychange`,c),()=>{document.removeEventListener(`pointermove`,e),document.removeEventListener(`pointerup`,a),document.removeEventListener(`pointercancel`,o),document.removeEventListener(`keydown`,s),document.removeEventListener(`visibilitychange`,c),t.current&&r()}},[r]);let i=(0,_.useCallback)((e,r,i,a)=>{if(!n.current.enabled||t.current)return;let o=n.current.getPanel(r),s=n.current.gridRef.current;if(!o||!s)return;e.preventDefault(),e.stopPropagation();let{cellWidthPx:c,cellHeightPx:l}=Bi(s),u=i.getBoundingClientRect();t.current={id:r,mode:a,startPointerX:e.clientX,startPointerY:e.clientY,startPanel:o,element:i,cellWidthPx:c,cellHeightPx:l,pointerId:e.pointerId,startRectW:u.width,startRectH:u.height},i.classList.add(a===`drag`?`grid-panel--dragging`:`grid-panel--resizing`),i.style.zIndex=`10`;try{i.setPointerCapture(e.pointerId)}catch{}},[]);return{onDragPointerDown:(0,_.useCallback)((e,t,n)=>i(e,t,n,`drag`),[i]),onResizePointerDown:(0,_.useCallback)((e,t,n)=>i(e,t,n,`resize`),[i]),onPanelKeyDown:(0,_.useCallback)((e,t)=>{if(!n.current.enabled)return;let r=n.current.getPanel(t);if(!r)return;let i=e.shiftKey,a=0,o=0;switch(e.key){case`ArrowLeft`:a=-1;break;case`ArrowRight`:a=1;break;case`ArrowUp`:o=-1;break;case`ArrowDown`:o=1;break;default:return}e.preventDefault(),e.stopPropagation();let s=Li[t];if(i){let e=r.w+a,i=r.h+o;if(e<s.minW&&(e=s.minW),i<s.minH&&(i=s.minH),r.x+e>12&&(e=12-r.x),e===r.w&&i===r.h)return;n.current.onCommit({id:t,x:r.x,y:r.y,w:e,h:i})}else{let e=r.x+a,i=r.y+o;if(e<0&&(e=0),e+r.w>12&&(e=12-r.w),i<0&&(i=0),e===r.x&&i===r.y)return;n.current.onCommit({id:t,x:e,y:i,w:r.w,h:r.h})}},[]),isGesturing:(0,_.useCallback)(()=>t.current!==null,[])}}function Hi(e,t){return e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y}function Ui(e){return{id:e.id,x:e.x,y:e.y,w:e.w,h:e.h}}function Wi(e,t){let n=[Ui(e)],r=t.map(Ui);r.sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y);for(let e of r){for(;;){let t=!1;for(let r of n)if(Hi(e,r)){let n=r.y+r.h;n>e.y&&(e.y=n,t=!0)}if(!t)break}n.push(e)}return n}function Gi(e){if(e.length===0)return[];let t=[...e].map(Ui).sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y),n=[];for(let e of t){let t=!0;for(;t;){t=!1;for(let r of n)Hi(e,r)&&(e.y=r.y+r.h,t=!0)}n.push(e)}return n}function Ki(e,t,n){let r=e.findIndex(e=>e.id===t);if(r===-1)return{panels:e.map(Ui)};let i=Wi({id:e[r].id,x:n.x,y:n.y,w:n.w,h:n.h},e.filter((e,t)=>t!==r)),a=new Map(i.map(e=>[e.id,e]));return{panels:Gi(e.map(e=>a.get(e.id)).filter(Boolean))}}function qi({panels:e,isEditing:t,renderers:n,onPanelsChange:r}){let i=(0,_.useRef)(null),a=(0,_.useRef)(e);a.current=e;let o=(0,_.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n);return t},[e]),s=Vi({gridRef:i,getPanel:(0,_.useCallback)(e=>o.get(e),[o]),onCommit:(0,_.useCallback)(e=>{let t=a.current,{panels:n}=Ki(t,e.id,{x:e.x,y:e.y,w:e.w,h:e.h});r(n)},[r]),enabled:t});return(0,B.jsx)(`div`,{ref:i,className:`grid-layout ${t?`grid-layout--editing`:``}`,"aria-live":t?`polite`:void 0,children:e.map(e=>(0,B.jsx)(zi,{panel:e,isEditing:t,drag:s,children:n[e.id]()},e.id))})}function Ji({manager:e,isEditing:t,onToggleEditing:n}){let{config:r,activeLayout:i,canAddUserLayout:a,saveError:o,selectLayout:s,saveAs:c,renameActive:l,deleteLayout:u,resetActive:d,exportConfig:f,importConfig:p}=e,[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(``),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(i.name),[T,E]=(0,_.useState)(!1),[ee,D]=(0,_.useState)(!1),te=(0,_.useRef)(null);(0,_.useEffect)(()=>{w(i.name)},[i.name]),(0,_.useEffect)(()=>{o&&h(o)},[o]),(0,_.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>h(null),4e3);return()=>clearTimeout(e)},[m]);function ne(){y.trim()&&(c(y.trim()),b(``),v(!1),h(`Saved "${y.trim()}"`))}function O(){C.trim()&&(l(C.trim()),S(!1),h(`Renamed`))}function re(){let e=i.name;u(i.id),D(!1),h(`Deleted "${e}"`)}function ie(){d(),E(!1),h(`Reset to default`)}function ae(){let e=f(),t=new Blob([e],{type:`application/json`}),n=URL.createObjectURL(t),r=new Date().toISOString().slice(0,10),i=document.createElement(`a`);i.href=n,i.download=`ssg-layout-${r}.json`,i.click(),URL.revokeObjectURL(n),h(`Layout exported`)}function oe(e){let t=e.target.files?.[0];e.target.value=``,t&&t.text().then(e=>{h(p(e).message)}).catch(()=>h(`Import failed: could not read file`))}return(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,B.jsx)(`span`,{className:`overline shrink-0`,children:`layout`}),(0,B.jsxs)(`select`,{value:r.activeLayoutId,onChange:e=>s(e.target.value),className:`bg-[var(--color-surface-2)] border border-[var(--color-line-1)] rounded-sm px-2 py-1 text-[11px] font-mono text-[var(--color-fg-1)] hover:border-[var(--color-line-2)] focus:outline-none focus:ring-1 focus:ring-[var(--color-brand)] cursor-pointer`,"aria-label":`Select layout`,children:[(0,B.jsx)(`optgroup`,{label:`Built-in`,children:r.layouts.filter(e=>e.builtIn).map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.name},e.id))}),r.layouts.some(e=>!e.builtIn)&&(0,B.jsx)(`optgroup`,{label:`Your layouts`,children:r.layouts.filter(e=>!e.builtIn).map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),i.builtIn&&(0,B.jsx)(`span`,{className:`chip text-[var(--color-fg-3)]`,title:`Built-in preset`,children:`built-in`})]}),(0,B.jsx)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:t?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(W,{variant:`secondary`,size:`sm`,onClick:()=>v(!0),disabled:!a,title:a?`Save the current arrangement as a new preset`:`Layout limit reached — delete one first`,children:[(0,B.jsx)(ji,{size:11,strokeWidth:2.25}),`Save as`]}),!i.builtIn&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:()=>{w(i.name),S(!0)},children:[(0,B.jsx)(ki,{size:11,strokeWidth:2.25}),`Rename`]}),(0,B.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:()=>D(!0),children:[(0,B.jsx)(Mi,{size:11,strokeWidth:2.25}),`Delete`]})]}),(0,B.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:()=>E(!0),title:`Replace the current layout with the Default preset`,children:[(0,B.jsx)(Ai,{size:11,strokeWidth:2.25}),`Reset`]}),(0,B.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:ae,title:`Download current layouts as JSON`,children:[(0,B.jsx)(K,{size:11,strokeWidth:2.25}),`Export`]}),(0,B.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:()=>te.current?.click(),title:`Load layouts from a JSON file`,children:[(0,B.jsx)(Ni,{size:11,strokeWidth:2.25}),`Import`]}),(0,B.jsx)(`input`,{ref:te,type:`file`,accept:`application/json,.json`,onChange:oe,className:`hidden`,"aria-hidden":!0}),(0,B.jsxs)(W,{variant:`primary`,size:`sm`,onClick:()=>n(!1),children:[(0,B.jsx)(Di,{size:11,strokeWidth:2.5}),`Done`]})]}):(0,B.jsxs)(W,{variant:`secondary`,size:`sm`,onClick:()=>n(!0),children:[(0,B.jsx)(ki,{size:11,strokeWidth:2.25}),`Edit layout`]})}),g&&(0,B.jsx)(Yi,{title:`Save layout as`,value:y,placeholder:`My dashboard`,onChange:b,onConfirm:ne,onCancel:()=>{v(!1),b(``)},confirmLabel:`Save`}),x&&(0,B.jsx)(Yi,{title:`Rename layout`,value:C,placeholder:i.name,onChange:w,onConfirm:O,onCancel:()=>S(!1),confirmLabel:`Rename`}),T&&(0,B.jsx)(Xi,{title:`Reset this layout?`,body:`The current arrangement will be replaced with the Default preset. Saved layouts are not affected.`,confirmLabel:`Reset`,onConfirm:ie,onCancel:()=>E(!1),destructive:!1}),ee&&(0,B.jsx)(Xi,{title:`Delete "${i.name}"?`,body:`This layout will be removed. You can always recreate it via Save as.`,confirmLabel:`Delete`,onConfirm:re,onCancel:()=>D(!1),destructive:!0}),m&&(0,B.jsx)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 -translate-x-1/2 z-50 rounded-sm border border-[var(--color-line-2)] bg-[var(--color-surface-3)] px-3 py-2 text-[11px] font-mono text-[var(--color-fg-1)] shadow-lg`,children:m})]})}function Yi({title:e,value:t,placeholder:n,onChange:r,onConfirm:i,onCancel:a,confirmLabel:o}){return(0,B.jsx)(`div`,{role:`dialog`,"aria-modal":!0,"aria-label":e,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:a,children:(0,B.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`w-80 rounded-sm border border-[var(--color-line-2)] bg-[var(--color-surface-2)] p-4`,children:[(0,B.jsx)(`div`,{className:`overline mb-2`,children:e}),(0,B.jsx)(`input`,{value:t,onChange:e=>r(e.target.value),placeholder:n,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&i(),e.key===`Escape`&&a()},className:`w-full bg-[var(--color-surface-1)] border border-[var(--color-line-1)] rounded-sm px-2 py-1.5 text-[13px] font-mono text-[var(--color-fg-1)] focus:outline-none focus:border-[var(--color-brand)]`}),(0,B.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,B.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:a,children:[(0,B.jsx)(Pi,{size:11,strokeWidth:2.25}),`Cancel`]}),(0,B.jsx)(W,{variant:`primary`,size:`sm`,onClick:i,children:o})]})]})})}function Xi({title:e,body:t,confirmLabel:n,destructive:r,onConfirm:i,onCancel:a}){return(0,B.jsx)(`div`,{role:`dialog`,"aria-modal":!0,"aria-label":e,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:a,children:(0,B.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`w-96 rounded-sm border border-[var(--color-line-2)] bg-[var(--color-surface-2)] p-4`,children:[(0,B.jsx)(`div`,{className:`overline mb-2`,children:e}),(0,B.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:t}),(0,B.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),(0,B.jsx)(W,{variant:r?`danger`:`primary`,size:`sm`,onClick:i,children:n})]})]})})}var Zi={default:`builtin-default`,focusLatency:`builtin-focus-latency`,focusApprovals:`builtin-focus-approvals`,compact:`builtin-compact`},Qi={id:Zi.default,name:`Default`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:1},{id:`graph`,x:0,y:1,w:8,h:5},{id:`latency-trace`,x:8,y:1,w:4,h:3},{id:`throughput`,x:8,y:4,w:2,h:2},{id:`decision-mix`,x:10,y:4,w:2,h:2},{id:`telemetry-feed`,x:0,y:6,w:12,h:3},{id:`system-pulse`,x:0,y:9,w:12,h:3},{id:`pending-approvals`,x:0,y:12,w:6,h:3},{id:`recent-blocks`,x:6,y:12,w:6,h:3}]},$i={id:Zi.focusLatency,name:`Focus · Latency`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:1},{id:`latency-trace`,x:0,y:1,w:8,h:5},{id:`graph`,x:8,y:1,w:4,h:5},{id:`throughput`,x:0,y:6,w:6,h:2},{id:`decision-mix`,x:6,y:6,w:6,h:2},{id:`system-pulse`,x:0,y:8,w:12,h:3},{id:`telemetry-feed`,x:0,y:11,w:12,h:3},{id:`pending-approvals`,x:0,y:14,w:6,h:2},{id:`recent-blocks`,x:6,y:14,w:6,h:2}]},ea={id:Zi.focusApprovals,name:`Focus · Approvals`,builtIn:!0,panels:[{id:`pending-approvals`,x:0,y:0,w:8,h:4},{id:`graph`,x:8,y:0,w:4,h:4},{id:`recent-blocks`,x:0,y:4,w:12,h:3},{id:`hero-metrics`,x:0,y:7,w:12,h:1},{id:`latency-trace`,x:0,y:8,w:6,h:3},{id:`telemetry-feed`,x:6,y:8,w:6,h:3},{id:`system-pulse`,x:0,y:11,w:12,h:3},{id:`throughput`,x:0,y:14,w:6,h:2},{id:`decision-mix`,x:6,y:14,w:6,h:2}]},ta={id:Zi.compact,name:`Compact`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:1},{id:`graph`,x:0,y:1,w:8,h:3},{id:`latency-trace`,x:8,y:1,w:4,h:3},{id:`system-pulse`,x:0,y:4,w:12,h:3},{id:`throughput`,x:0,y:7,w:4,h:2},{id:`decision-mix`,x:4,y:7,w:4,h:2},{id:`telemetry-feed`,x:0,y:9,w:12,h:3},{id:`pending-approvals`,x:0,y:12,w:6,h:2},{id:`recent-blocks`,x:6,y:12,w:6,h:2}]},na=Object.freeze([Qi,$i,ea,ta]);function ra(){return na.map(e=>({...e,panels:e.panels.map(e=>({...e}))}))}function ia(){return{version:1,activeLayoutId:Zi.default,layouts:ra()}}function aa(e){return Object.values(Zi).includes(e)}var oa=new Set(Fi),sa=new Set(na.map(e=>e.id));function ca(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function la(e,t,n,r){if(typeof e!=`number`||!Number.isFinite(e))return r;let i=Math.floor(e);return i<t?t:i>n?n:i}function ua(e,t){let n=(typeof e==`string`?e:``).replace(/[\u0000-\u001F\u007F]/g,``).trim();return n.length===0?t:n.slice(0,40)}function da(e){let t=e.find(e=>e.id===`system-pulse`);if(!t||t.h>=3)return e;let n=3-t.h,r=t.y+t.h;return e.map(e=>e.id===`system-pulse`?{...e,h:3}:e.y>=r?{...e,y:e.y+n}:e)}function fa(e){for(let t=0;t<e.length;t++){let n=e[t];for(let r=t+1;r<e.length;r++){let t=e[r];if(n.x<t.x+t.w&&n.x+n.w>t.x&&n.y<t.y+t.h&&n.y+n.h>t.y)return!0}}return!1}function pa(e){if(!ca(e))return null;let{id:t}=e;if(typeof t!=`string`||!oa.has(t))return null;let n=t,r=Li[n],i=la(e.x,0,11,0),a=la(e.w,r.minW,12,r.defaultW);return{id:n,x:i+a>12?12-a:i,y:la(e.y,0,999,0),w:a,h:la(e.h,r.minH,99,r.defaultH)}}function ma(e,t){if(!ca(e))return{layout:null,droppedPanels:0};let n=typeof e.id==`string`&&e.id.length>0?e.id:null;if(!n)return{layout:null,droppedPanels:0};let r=ua(e.name,t),i=sa.has(n),a=e.panels;if(!Array.isArray(a))return{layout:null,droppedPanels:0};let o=new Set,s=[],c=0;for(let e of a){let t=pa(e);if(!t){c+=1;continue}if(o.has(t.id)){c+=1;continue}o.add(t.id),s.push(t)}return s.length===0?{layout:null,droppedPanels:c}:{layout:{id:n,name:r,builtIn:i,panels:da(s)},droppedPanels:c}}function ha(e){if(!ca(e)||e.version!==1)return{config:ia(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0};let t=e.layouts;if(!Array.isArray(t)||t.length===0)return{config:ia(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0};let n=[],r=0,i=0,a=0;for(let e of t){let{layout:t,droppedPanels:o}=ma(e,`Layout ${n.length+1}`);if(r+=o,t){if(!t.builtIn){if(i>=12){a+=1;continue}i+=1}n.push(t)}}if(n.length===0)return{config:ia(),droppedPanels:r,prunedLayouts:a,fellBackToDefault:!0};let o=new Set(n.map(e=>e.id));for(let e of na)o.has(e.id)||n.push({...e,panels:e.panels.map(e=>({...e}))});let s=new Map(na.map(e=>[e.id,e])),c=0,l=0;for(let e=0;e<n.length;e++){let t=n[e],r=s.get(t.id);if(!r)continue;if(fa(t.panels)){n[e]={...r,panels:r.panels.map(e=>({...e}))},l+=1;continue}let i=new Set(t.panels.map(e=>e.id)),a=r.panels.filter(e=>!i.has(e.id));if(a.length===0)continue;let o=t.panels.reduce((e,t)=>Math.max(e,t.y+t.h),0);for(let e of a)t.panels.push({id:e.id,x:0,y:o,w:e.w,h:e.h}),o+=e.h,c+=1}let u=e.activeLayoutId;return{config:{version:1,activeLayoutId:typeof u==`string`&&n.some(e=>e.id===u)?u:na[0].id,layouts:n},droppedPanels:r,prunedLayouts:a,fellBackToDefault:!1,backfilledPanels:c,refreshedBuiltins:l}}var ga=`ssg:dashboard-layout:v1`,_a=300;function va(){if(typeof localStorage>`u`)return null;try{let e=`__ssg_probe__`;return localStorage.setItem(e,`1`),localStorage.removeItem(e),localStorage}catch{return null}}var ya;function ba(){return ya===void 0&&(ya=va()),ya}function xa(){let e=ba();if(!e)return{config:ia(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!1};let t=null;try{t=e.getItem(ga)}catch{t=null}if(t===null)return{config:ia(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!1};let n=null;try{n=JSON.parse(t)}catch{return{config:ia(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0}}return ha(n)}var Sa=null,Ca=null,wa=null;function Ta(e){return wa=e,()=>{wa===e&&(wa=null)}}function Ea(e){wa?wa(e):typeof console<`u`&&console.warn(`[ssg-layout]`,e)}function Da(){if(Ca=null,!Sa)return;let e=ba();if(!e){Sa=null;return}let t=Sa;Sa=null;try{e.setItem(ga,JSON.stringify(t))}catch(e){e instanceof Error&&e.name===`QuotaExceededError`?Ea(`Layout storage full — save skipped`):Ea(`Layout save failed: ${e instanceof Error?e.message:String(e)}`)}}function Oa(e){Sa=e,Ca===null&&(Ca=setTimeout(Da,_a))}function ka(e){Sa=e,Ca!==null&&(clearTimeout(Ca),Ca=null),Da()}function Aa(e){let t=0;for(let n of e.layouts)n.builtIn||(t+=1);return t}function ja(e){return e.map(e=>({...e}))}function Ma(){return`user-`+Math.random().toString(16).slice(2,11)}function Na(){let[e,t]=(0,_.useState)(()=>xa().config),[n,r]=(0,_.useState)(null);(0,_.useEffect)(()=>Ta(e=>r(e)),[]),(0,_.useEffect)(()=>{Oa(e)},[e]);let i=e.layouts.find(t=>t.id===e.activeLayoutId)??e.layouts[0]??ra()[0],a=Aa(e)<12,o=(0,_.useCallback)(e=>{t(t=>t.layouts.some(t=>t.id===e)?{...t,activeLayoutId:e}:t)},[]),s=(0,_.useCallback)(e=>{t(t=>{let n=t.activeLayoutId;return{...t,layouts:t.layouts.map(t=>t.id===n?{...t,panels:ja(e)}:t)}})},[]),c=(0,_.useCallback)(e=>{let n=e.trim();n&&t(e=>{if(Aa(e)>=12)return e;let t=e.layouts.find(t=>t.id===e.activeLayoutId)??e.layouts[0];if(!t)return e;let r={id:Ma(),name:n,builtIn:!1,panels:ja(t.panels)};return{...e,activeLayoutId:r.id,layouts:[...e.layouts,r]}})},[]),l=(0,_.useCallback)(e=>{let n=e.trim();n&&t(e=>({...e,layouts:e.layouts.map(t=>t.id===e.activeLayoutId&&!t.builtIn?{...t,name:n}:t)}))},[]),u=(0,_.useCallback)(e=>{t(t=>{let n=t.layouts.find(t=>t.id===e);if(!n||n.builtIn)return t;let r=t.layouts.filter(t=>t.id!==e),i=t.activeLayoutId===e?r[0]?.id??na[0].id:t.activeLayoutId;return{...t,activeLayoutId:i,layouts:r}})},[]),d=(0,_.useCallback)(()=>{t(e=>{let t=e.layouts.find(t=>t.id===e.activeLayoutId);if(!t)return e;let n=aa(t.id)?na.find(e=>e.id===t.id):na[0];return n?{...e,layouts:e.layouts.map(e=>e.id===t.id?{...e,panels:ja(n.panels)}:e)}:e})},[]),f=(0,_.useCallback)(()=>JSON.stringify(e,null,2),[e]),p=(0,_.useCallback)(e=>{let n;try{n=JSON.parse(e)}catch{return{ok:!1,message:`Import failed: not valid JSON`}}let r=ha(n);if(r.fellBackToDefault)return{ok:!1,message:`Import rejected: schema invalid, no changes applied`};t(r.config),ka(r.config);let i=[`Layout imported`];return r.droppedPanels>0&&i.push(`${r.droppedPanels} unrecognized panel(s) dropped`),r.prunedLayouts>0&&i.push(`${r.prunedLayouts} excess layout(s) pruned`),{ok:!0,message:i.join(` · `)}},[]);return(0,_.useEffect)(()=>{e.layouts.length===0&&t(ia())},[e.layouts.length]),{config:e,activeLayout:i,canAddUserLayout:a,saveError:n,selectLayout:o,updateActivePanels:s,saveAs:c,renameActive:l,deleteLayout:u,resetActive:d,exportConfig:f,importConfig:p}}var Pa=Object.freeze({allow:`#22c55e`,block:`#ef4444`,ask:`#f59e0b`,log:`#60a5fa`,force:`#a855f7`,shadow:`#6b7280`}),Fa=5*6e4,Ia=1200,La=Object.freeze({repulsion:2500,springLength:80,springStiffness:.04,damping:.85,centeringStrength:.005,sessionCohesion:.01,width:800,height:600});function Ra(e){let t=new Map;for(let n of e){let e=t.get(n.session);e?(e.x+=n.x,e.y+=n.y,e.n+=1):t.set(n.session,{x:n.x,y:n.y,n:1})}for(let e of t.values())e.x/=e.n,e.y/=e.n;return t}function za(e,t,n,r){if(e.length===0)return;let i=new Map;for(let t of e)i.set(t.id,t);let a=Ra(e),o=n.width/2,s=n.height/2;for(let t of e)t.vx*=n.damping,t.vy*=n.damping;for(let t=0;t<e.length;t++){let i=e[t];for(let a=t+1;a<e.length;a++){let t=e[a],o=i.x-t.x,s=i.y-t.y,c=o*o+s*s;c<1&&(c=1);let l=n.repulsion/c,u=Math.sqrt(c),d=o/u*l,f=s/u*l;i.vx+=d*r,i.vy+=f*r,t.vx-=d*r,t.vy-=f*r}}for(let e of t){let t=i.get(e.source),a=i.get(e.target);if(!t||!a)continue;let o=a.x-t.x,s=a.y-t.y,c=Math.sqrt(o*o+s*s)||1,l=(c-n.springLength)*n.springStiffness,u=o/c*l,d=s/c*l;t.vx+=u*r,t.vy+=d*r,a.vx-=u*r,a.vy-=d*r}for(let t of e){t.vx+=(o-t.x)*n.centeringStrength*r,t.vy+=(s-t.y)*n.centeringStrength*r;let e=a.get(t.session);e&&(t.vx+=(e.x-t.x)*n.sessionCohesion*r,t.vy+=(e.y-t.y)*n.sessionCohesion*r)}for(let t of e)t.vx>20&&(t.vx=20),t.vx<-20&&(t.vx=-20),t.vy>20&&(t.vy=20),t.vy<-20&&(t.vy=-20),t.x+=t.vx*r,t.y+=t.vy*r,t.x<20?(t.x=20,t.vx=Math.abs(t.vx)*.5):t.x>n.width-20&&(t.x=n.width-20,t.vx=-Math.abs(t.vx)*.5),t.y<20?(t.y=20,t.vy=Math.abs(t.vy)*.5):t.y>n.height-20&&(t.y=n.height-20,t.vy=-Math.abs(t.vy)*.5)}function Ba(e,t){let n=[],r=new Map;for(let t of e){let e=r.get(t.session);e?e.push(t):r.set(t.session,[t])}for(let e of r.values()){e.sort((e,t)=>e.ts_ms-t.ts_ms);for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r];a.ts_ms-i.ts_ms<=t&&n.push({source:i.id,target:a.id,kind:`session`})}}return n}function Va(e){let t=e|0;return()=>{t=t+1831565813|0;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}var Ha={"claude-code":`C`,"claude-code-ide":`C`,cursor:`>`,copilot:`H`,codex:`X`,pi:`P`,gemini:`G`,antigravity:`A`};function Ua(e){return Ha[e.toLowerCase()]??`.`}function Wa(e){let t=0;for(let n=0;n<e.length;n++)t=Math.imul(t,31)+e.charCodeAt(n)|0;return(t>>>0)%360}function Ga(e,t){for(let[n,r]of t){let{x:t,y:i,n:a}=r,o=50+Math.min(a,12)*7,s=Wa(n),c=e.createRadialGradient(t,i,0,t,i,o);c.addColorStop(0,`hsla(${s},80%,55%,0.10)`),c.addColorStop(1,`hsla(${s},80%,55%,0)`),e.fillStyle=c,e.beginPath(),e.arc(t,i,o,0,Math.PI*2),e.fill()}}var Ka={block:{spikes:4,maxR:22},force:{spikes:8,maxR:32}};function qa(e,t,n,r,i,a){let o=Ka[i];if(!o)return;let{spikes:s,maxR:c}=o,l=c*r,u=Math.max(0,1-r)*.75;if(u<=0)return;let d=Pa[i]??`#6b7280`;e.save(),e.globalAlpha=u,e.strokeStyle=d,e.lineWidth=1.5,e.translate(t,n),e.rotate(a);let f=l*.28;e.beginPath();for(let t=0;t<s;t++){let n=t/s*Math.PI*2,r=n+Math.PI/s;t===0&&e.moveTo(Math.cos(r)*f,Math.sin(r)*f),e.lineTo(Math.cos(n)*l,Math.sin(n)*l),e.lineTo(Math.cos(r)*f,Math.sin(r)*f)}e.closePath(),e.stroke(),e.restore()}function Ja(e,t,n,r,i,a,o){let s=8+a*r,c=Math.max(0,1-r)*o;c<=0||(e.save(),e.globalAlpha=c,e.fillStyle=i,e.beginPath(),e.arc(t,n,s,0,Math.PI*2),e.fill(),e.restore())}var Ya=`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,Xa=`bold 10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;function Za(e,t,n,r,i,a,o){let s=(r.split(`:`)[0]??r).slice(0,18),c=Ua(s),l=Wa(r),u=Pa[o]??`#6b7280`;e.save(),e.textAlign=`center`;let d=`[${c}] ${s}`,f=`${i.length>14?i.slice(0,14):i} · ${a}`;e.font=Xa;let p=e.measureText(d).width;e.font=Ya;let m=e.measureText(f).width,h=Math.max(p,m)+10;e.globalAlpha=.82,e.fillStyle=`hsla(${l},25%,5%,0.92)`,e.fillRect(t-h/2,n-2,h,28),e.globalAlpha=.92,e.fillStyle=`hsla(${l},78%,70%,1)`,e.font=Xa,e.fillText(d,t,n+10),e.globalAlpha=.72,e.fillStyle=u,e.font=Ya,e.fillText(f,t,n+21),e.restore()}function Qa(e,t,n,r,i,a,o){let s=r-t,c=i-n;if(Math.sqrt(s*s+c*c)<24)return;let l=Math.atan2(c,s),u=3.5,d=r-Math.cos(l)*9,f=i-Math.sin(l)*9;e.save(),e.globalAlpha=o*.85,e.fillStyle=a,e.translate(d,f),e.rotate(l),e.beginPath(),e.moveTo(0,0),e.lineTo(-6,-u),e.lineTo(-6,u),e.closePath(),e.fill(),e.restore()}var $a=240,eo=Array.from({length:$a},()=>({x:0,y:0,vx:0,vy:0,life:0,decay:.02,color:`#fff`,size:2})),to=0;function no(e,t,n,r,i=6){let a=Va(r);for(let r=0;r<i;r++){let o=to%$a;to++;let s=eo[o];if(!s)continue;let c=r/i*Math.PI*2+a()*.6,l=1.2+a()*2;s.x=e+(a()-.5)*4,s.y=t+(a()-.5)*4,s.vx=Math.cos(c)*l,s.vy=Math.sin(c)*l,s.life=1,s.decay=.016+a()*.014,s.color=n,s.size=1.5+a()*2}}function ro(e){for(let t of eo){if(t.life<=0)continue;t.x+=t.vx,t.y+=t.vy,t.vx*=.93,t.vy*=.93,t.life-=t.decay;let n=Math.max(0,t.life)*.65;n<=0||(e.globalAlpha=n,e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,Math.max(.1,t.size),0,Math.PI*2),e.fill())}e.globalAlpha=1}function io(){return{amplitude:0,startedAt:0,durationMs:0}}function ao(e,t,n){e.amplitude=t,e.startedAt=performance.now(),e.durationMs=n}function q(e,t,n){if(t.amplitude<=0)return!1;let r=performance.now()-t.startedAt;if(r>=t.durationMs)return!1;let i=t.amplitude*Math.max(0,1-r/t.durationMs);return e.translate((n()-.5)*i*2,(n()-.5)*i*2),!0}var J=420,oo=He(1.7),so=620,co=We(1.2,.5),lo=et({stiffness:90,damping:7,mass:1});function uo(e,t,n,r){let i=new Map;for(let t of e)i.set(t.id,t);let a=new Set,o=[];for(let e=0;e<t.length;e++){let s=t[e],c=s.audit_id??`${s.ts_ms}:${s.tool}:${e}`;a.add(c);let l=i.get(c);if(l)l.burst=s,l.exitingAt=void 0,o.push(l);else{let t=Va(s.ts_ms^e),i=n*.6+(t()-.5)*60,a=r/2+(t()-.5)*40,l=`${s.client}:${s.agent_id??`solo`}`;o.push({id:c,burst:s,ts_ms:s.ts_ms,session:l,x:i,y:a,vx:(t()-.5)*2,vy:(t()-.5)*2,age:0})}}let s=performance.now();for(let t of e)a.has(t.id)||(t.exitingAt??=s,s-t.exitingAt<1200&&o.push(t));return o}function fo(e){let{bursts:t,paused:n,selectedId:r,onSelect:i,burstSeq:a}=e,o=(0,_.useRef)(null),s=(0,_.useRef)([]),c=(0,_.useRef)([]),l=(0,_.useRef)({...La}),u=(0,_.useRef)(null),d=(0,_.useRef)(io()),[f,p]=(0,_.useState)({w:800,h:560});(0,_.useEffect)(()=>{let e=o.current?.parentElement;if(!e)return;let t=new ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;p({w:Math.max(40,e),h:Math.max(40,n)})}});return t.observe(e),()=>t.disconnect()},[]),(0,_.useEffect)(()=>{let e=new Map;for(let t of s.current)e.set(t.id,t);if(s.current=uo(s.current,t,f.w,f.h),c.current=Ba(s.current,12e4),l.current.width=f.w,l.current.height=f.h,!pt())for(let t=0;t<s.current.length;t++){let n=s.current[t];if(!n||e.has(n.id))continue;let r=Pa[n.burst.decision]??`#6b7280`;no(n.x,n.y,r,n.burst.ts_ms^t),n.burst.decision===`block`?ao(d.current,4,280):n.burst.decision===`force`&&ao(d.current,6,280)}},[t,f.w,f.h,a]),(0,_.useEffect)(()=>{let e=o.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let i=0,a=performance.now(),p=()=>{let o=performance.now(),m=Math.min(50,o-a);a=o;let h=Math.max(.5,Math.min(2,m/16.67)),g=s.current,_=c.current;n||za(g,_,l.current,h);for(let e of g)e.age<1&&(e.age=Math.min(1,e.age+m/J));let v=window.devicePixelRatio||1,y=f.w,b=f.h;(e.width!==y*v||e.height!==b*v)&&(e.width=y*v,e.height=b*v,e.style.width=`${y}px`,e.style.height=`${b}px`,t.scale(v,v)),t.fillStyle=`#0a0a0f`,t.fillRect(0,0,y,b);let x=t.createRadialGradient(y/2,b/2,0,y/2,b/2,Math.max(y,b)/1.2);x.addColorStop(0,`rgba(56, 189, 248, 0.06)`),x.addColorStop(1,`rgba(0, 0, 0, 0)`),t.fillStyle=x,t.fillRect(0,0,y,b);let S=pt();if(t.save(),!S){let e=Va((d.current.startedAt+o)*.01|0);q(t,d.current,e)}let C=Ra(g);if(Ga(t,C),!S){let e=new Map,n=new Map;for(let t of g)t.exitingAt??(n.set(t.session,(n.get(t.session)??0)+1),e.set(t.session,t));for(let[r,i]of C){let a=e.get(r),o=n.get(r)??0;if(!a||o===0)continue;let s=50+Math.min(i.n,12)*7;Za(t,i.x,i.y+s+8,r,a.burst.tool,o,a.burst.decision)}}let w=e=>e.exitingAt==null?1:Math.max(0,1-(o-e.exitingAt)/Ia);S||ro(t);let T=new Map;for(let e of g)T.set(e.id,e);t.lineWidth=2;for(let e=0;e<_.length;e++){let n=_[e],r=T.get(n.source),i=T.get(n.target);if(!r||!i)continue;let a=Pa[i.burst.decision]??`#6b7280`,s=Math.min(w(r),w(i));if(!(s<=0)&&(t.globalAlpha=s,t.strokeStyle=a+`aa`,t.beginPath(),t.moveTo(r.x,r.y),t.lineTo(i.x,i.y),t.stroke(),!S)){let n=(o/1800+e*.618033)%1,c=r.x+(i.x-r.x)*n,l=r.y+(i.y-r.y)*n;t.save(),t.globalAlpha=s*Math.sin(n*Math.PI)*.9,t.fillStyle=a,t.beginPath(),t.arc(c,l,2.5,0,Math.PI*2),t.fill(),t.restore(),Qa(t,r.x,r.y,i.x,i.y,a,s)}}t.globalAlpha=1;let E=new Set,ee=new Set,D=0,te=0;for(let e=g.length-1;e>=0;e--){let t=g[e];if(!(!t||t.exitingAt!=null)&&(D<20&&(E.add(t.id),D++),te<8&&(ee.add(t.id),te++),D>=20&&te>=8))break}let ne=r,O=u.current;for(let e of g){let n=w(e);if(n<=0)continue;t.globalAlpha=n;let r=Math.min(1,e.age),i=oo(r),a=(6+2*Math.min(1,e.age))*i,s=Pa[e.burst.decision]??`#6b7280`;if((e.id===ne||e.id===O)&&(t.beginPath(),t.arc(e.x,e.y,a+6,0,Math.PI*2),t.fillStyle=s+`33`,t.fill()),!S)if(e.burst.decision===`block`||e.burst.decision===`force`){let n=r;qa(t,e.x,e.y,n,e.burst.decision,o*.002)}else e.burst.decision===`allow`?Ja(t,e.x,e.y,r,`#22c55e`,14,.3):e.burst.decision===`ask`&&Ja(t,e.x,e.y,r,`#f59e0b`,14,.45);if(e.burst.decision===`block`||e.burst.decision===`force`){let n=r*J;if(n<so){let r=n/so,i=a+16*co(r),o=Math.max(0,1-r)*.75;t.beginPath(),t.arc(e.x,e.y,i,0,Math.PI*2),t.strokeStyle=s+Math.floor(o*255).toString(16).padStart(2,`0`),t.lineWidth=1.5,t.stroke()}}let c=!S&&E.has(e.id);if(c&&(t.save(),t.shadowColor=s,t.shadowBlur=18*(1-r*.5)),t.beginPath(),t.arc(e.x,e.y,Math.max(.1,a),0,Math.PI*2),t.fillStyle=s,t.fill(),c&&(t.shadowBlur=0,t.restore()),t.strokeStyle=`#00000066`,t.lineWidth=1,t.stroke(),ee.has(e.id)){t.font=`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.textAlign=`center`,t.fillStyle=s+`cc`,t.fillText(Ua(e.burst.client),e.x,e.y-a-3);let n=e.burst.tool.length>12?e.burst.tool.slice(0,12):e.burst.tool;t.fillStyle=s+`88`,t.fillText(n,e.x,e.y+a+11),t.textAlign=`left`}(e.id===ne||e.id===O)&&(t.font=`11px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.fillStyle=`#e0e7ff`,t.fillText(e.burst.tool,e.x+a+6,e.y+3))}if(t.globalAlpha=1,g.length>0&&!n){let e=null;for(let t=g.length-1;t>=0;t--)if(g[t].exitingAt==null){e=g[t];break}if(e){let n=1100,r=o%n/n,i=10+lo.fn(r)*6,a=Math.max(0,1-r)*.9,s=Math.floor(a*200).toString(16).padStart(2,`0`);t.beginPath(),t.arc(e.x,e.y,i,0,Math.PI*2),t.strokeStyle=`#38bdf8${s}`,t.lineWidth=2,t.stroke()}}t.restore(),i=requestAnimationFrame(p)};return i=requestAnimationFrame(p),()=>cancelAnimationFrame(i)},[n,r,f.w,f.h]);function m(e,t){let n=o.current;if(!n)return null;let r=n.getBoundingClientRect(),i=e-r.left,a=t-r.top,c=null,l=200;for(let e of s.current){let t=e.x-i,n=e.y-a,r=t*t+n*n;r<l&&(l=r,c=e.id)}return c}return(0,B.jsxs)(`div`,{className:`relative w-full h-full rounded-sm border border-[var(--color-line-1)] overflow-hidden bg-black`,children:[(0,B.jsx)(`canvas`,{ref:o,className:`block w-full h-full cursor-crosshair`,onMouseMove:e=>{u.current=m(e.clientX,e.clientY)},onMouseLeave:()=>{u.current=null},onClick:e=>{i(m(e.clientX,e.clientY))}}),t.length===0&&(0,B.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center pointer-events-none px-4 text-center`,children:[(0,B.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`graph · idle`}),(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] max-w-[260px]`,children:[`Each dot = one tool call an AI agent made.`,(0,B.jsx)(`br`,{}),`Color = the ssg rule decision · line = same agent's sequence.`]})]})]})}function po(e){let t=e.windowMs??3e4,n=Oe(),r=ke(),[i,a]=(0,_.useState)(null),o=Date.now()-t,s=(0,_.useMemo)(()=>n.filter(e=>e.ts_ms>=o),[n,o]),c=(0,_.useMemo)(()=>{let e=new Map;for(let t of s){let n=`${t.client}:${t.agent_id??`solo`}`,r=e.get(n);r?r.count+=1:e.set(n,{client:t.client,count:1})}return e},[s]),l=(0,_.useMemo)(()=>{let e={allow:0,block:0,ask:0,other:0};for(let t of s)t.decision===`allow`?e.allow++:t.decision===`block`||t.decision===`force`?e.block++:t.decision===`ask`?e.ask++:e.other++;return e},[s]),u=(0,_.useMemo)(()=>{let e=new Set,t=0;for(let n of s)n.rule_id&&(e.add(n.rule_id),t+=1);return{distinct:e.size,matched:t,topRule:e.values().next().value}},[s]);return(0,B.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,children:[(0,B.jsxs)(`header`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-[var(--color-line-1)]`,children:[(0,B.jsx)(`span`,{className:`overline text-[var(--color-fg-3)]`,children:`graph · live`}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[(0,B.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),s.length]}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] font-mono`,children:[(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:Pa.allow}}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.allow}),(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ml-1`,style:{background:Pa.block}}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.block}),(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ml-1`,style:{background:Pa.ask}}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.ask})]}),(0,B.jsx)(`span`,{className:`flex-1`}),(0,B.jsxs)(`span`,{className:`chip text-violet-300 border-violet-500/30`,title:`${u.matched} tool calls matched ${u.distinct} ssg ${u.distinct===1?`rule`:`rules`} in the last ${Math.round(t/1e3)}s`,children:[u.distinct,` `,u.distinct===1?`rule`:`rules`]}),(0,B.jsxs)(`span`,{className:`chip text-[var(--color-fg-3)] border-[var(--color-line-1)]`,title:c.size===0?`no active agents`:Array.from(c.entries()).map(([e,t])=>`${e}: ${t.count}`).join(`
|
|
10
|
-
`),children:[c.size,` `,c.size===1?`agent`:`agents`]}),(0,B.jsx)(`a`,{href:`/graph`,className:`text-[10px] font-mono uppercase tracking-wider text-sky-300 hover:text-sky-200`,title:`Open full /graph page`,children:`expand ↗`})]}),(0,B.jsx)(`div`,{className:`flex-1 min-h-0 relative`,children:(0,B.jsx)(fo,{bursts:s,paused:!1,selectedId:i,onSelect:a,burstSeq:r})})]})}var mo=3e4,ho=6e4,go=5e3;function _o(e){let t=Date.now(),n=e.length>0?e[e.length-1]:null;if(!n||t-n.ts_ms>go||!n)return{idle:!0,client:``,tool:``,ruleId:null,decision:``,evalsPerSec:`0.0`,allowPct:0,agents:0,topRules:[]};let r=e.filter(e=>t-e.ts_ms<=mo),i=r.filter(e=>e.decision===`allow`).length,a=r.length>0?Math.round(i/r.length*100):0,o=(r.length/(mo/1e3)).toFixed(1),s=new Set(r.map(e=>`${e.client}:${e.agent_id??`solo`}`)).size,c=e.filter(e=>t-e.ts_ms<=ho&&e.rule_id),l=new Map;for(let e of c){let t=e.rule_id;t&&l.set(t,(l.get(t)??0)+1)}let u=[...l.entries()].sort((e,t)=>t[1]-e[1]).slice(0,4).map(([e])=>e);return{idle:!1,client:n.client,tool:n.tool,ruleId:n.rule_id,decision:n.decision,evalsPerSec:o,allowPct:a,agents:s,topRules:u}}var vo={allow:`ALLOW`,block:`BLOCK`,ask:`ASK`,log:`LOG`,force:`FORCE`,shadow:`SHADOW`},yo={allow:`#22c55e`,block:`#ef4444`,ask:`#f59e0b`,log:`#60a5fa`,force:`#a855f7`,shadow:`#6b7280`};function bo({className:e}){let t=Oe(),n=ke(),r=(0,_.useRef)(-1),i=(0,_.useRef)(null),a=(0,_.useMemo)(()=>{if(r.current===n&&i.current)return i.current;r.current=n;let e=_o(t);return i.current=e,e},[t,n]),o=a.decision?yo[a.decision]??`#6b7280`:`#6b7280`,s=a.decision?vo[a.decision]??a.decision:``,c=a.client?Ua(a.client):``;return a.idle?(0,B.jsxs)(`div`,{className:z(`pointer-events-none select-none`,`flex items-center justify-center gap-2`,`px-4 py-2 rounded-sm`,`bg-[#0a0a0f]/80 backdrop-blur-sm`,`border border-[var(--color-line-1,#242424)]`,`font-mono text-[11px] text-[var(--color-fg-4,#5a6071)]`,e),children:[(0,B.jsx)(`span`,{className:`status-dot bg-[var(--color-fg-4)] pulse-soft`}),(0,B.jsx)(`span`,{className:`uppercase tracking-wider`,children:`waiting for activity`})]}):(0,B.jsxs)(`div`,{className:z(`pointer-events-none select-none`,`flex flex-col gap-1 px-4 py-2.5 rounded-sm`,`bg-[#0a0a0f]/88 backdrop-blur-sm`,`border border-[var(--color-line-1,#242424)]`,`font-mono min-w-[280px] max-w-[460px]`,e),children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-widest text-[var(--color-fg-4,#5a6071)]`,children:[(0,B.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),(0,B.jsx)(`span`,{children:`now evaluating`}),(0,B.jsxs)(`span`,{className:`ml-auto tabular-nums`,children:[a.evalsPerSec,`/s · `,a.allowPct,`% allow · `,a.agents,` `,a.agents===1?`agent`:`agents`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px] text-[var(--color-fg-0,#f5f5f5)] tracking-tight`,children:[(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)] text-[11px] tabular-nums`,children:[`[`,c,`]`]}),(0,B.jsx)(`span`,{className:`text-sky-300`,children:a.client}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`·`}),(0,B.jsx)(`span`,{className:`text-white font-semibold`,children:a.tool}),a.ruleId&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`->`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)] text-[12px]`,children:a.ruleId})]}),(0,B.jsx)(`span`,{className:`ml-auto text-[13px] font-bold tabular-nums`,style:{color:o},children:s})]}),a.topRules.length>0&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-[var(--color-fg-4)]`,children:[(0,B.jsx)(`span`,{className:`uppercase tracking-wider text-[9px]`,children:`rules`}),a.topRules.map(e=>(0,B.jsx)(`span`,{className:`px-1 py-0.5 rounded-sm bg-[var(--color-surface-2,#121212)] text-[var(--color-fg-3)]`,children:e},e))]})]})}var xo=[100,500,1e3,5e3,1e4,1e5];function So(e){return e>=1e5||e>=1e3?`${e/1e3|0}k`:String(e)}function Co(e){let t=Math.floor(e/100),n=Math.floor(t/600),r=Math.floor(t%600/10),i=t%10;return`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}.${i}`}function wo(e){let t=Math.floor(e/100);return`${Math.floor(t/10)}.${t%10}s`}function To({className:e,onMilestone:t,onRecord:n}){let[r,i]=(0,_.useState)(0),[a,o]=(0,_.useState)(0),[s,c]=(0,_.useState)(0),[l,u]=(0,_.useState)(0),[d,f]=(0,_.useState)(0),[p,m]=(0,_.useState)(0),[h,g]=(0,_.useState)(0),[v,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(!1),w=De(),T=ke(),E=Oe(),ee=(0,_.useRef)(null),D=(0,_.useRef)(0),te=(0,_.useRef)(0),ne=(0,_.useRef)(0),O=(0,_.useRef)(0),re=(0,_.useRef)(new Set);(0,_.useEffect)(()=>{if(pt()){let e=performance.now(),t=e,n=setInterval(()=>{let n=performance.now();i(n-e),o(n-t)},1e3);return ae.current=()=>{t=performance.now()},()=>{clearInterval(n),ae.current=null}}performance.now();let e=lt({onUpdate:e=>i(e.currentTime)}),t=lt({onUpdate:e=>o(e.currentTime)});return ie.current=()=>{performance.now(),t.seek(0)},()=>{e.cancel(),t.cancel(),ie.current=null}},[]);let ie=(0,_.useRef)(null),ae=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(ee.current===null){ee.current=T,D.current=T;return}if(T<=D.current)return;let e=T-D.current;D.current=T,f(n=>{let r=n+e,i=xo.find(e=>e>O.current&&r>=e);return i&&(O.current=i,y(So(i)),C(!0),t?.(),setTimeout(()=>{y(``),C(!1)},700)),r});let r=Date.now(),i=E.filter(e=>r-e.ts_ms<=6e4);m(new Set(i.map(e=>`${e.client}:${e.agent_id??`solo`}`)).size),w?.rule_id&&re.current.add(w.rule_id),g(re.current.size),w&&(w.decision===`block`?(te.current=0,c(0),ie.current?.(),ae.current?.()):(te.current+=e,te.current>ne.current&&(ne.current=te.current,u(ne.current),x(!0),n?.(),setTimeout(()=>x(!1),450)),c(te.current)))},[T,w,E,t,n]),(0,B.jsxs)(`div`,{className:z(`pointer-events-none select-none`,`flex flex-col gap-2 p-3 rounded-md`,`bg-[var(--color-bg-2,#0c0d12)]/85 backdrop-blur-sm`,`border border-[var(--color-border-1,#1c1f26)]`,`shadow-lg shadow-black/40`,`min-w-[180px] font-mono text-[11px]`,`text-[var(--color-fg-2,#9aa1ad)]`,S&&`milestone-ring`,e),"aria-label":`Live engagement counters`,children:[(0,B.jsx)(Eo,{label:`uptime`,children:(0,B.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-0,#e6e8ed)] text-[15px] tracking-tight`,children:Co(r)})}),(0,B.jsx)(Eo,{label:`evals`,children:(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(yr,{value:d,curve:`spring`,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`}),v&&(0,B.jsxs)(`span`,{className:`text-[10px] text-emerald-400 uppercase tracking-wide`,children:[`+`,v]})]})}),(0,B.jsx)(Eo,{label:`since block`,children:(0,B.jsx)(`span`,{className:`tabular-nums text-emerald-300 text-[15px]`,children:wo(a)})}),(0,B.jsx)(Eo,{label:`streak / best`,children:(0,B.jsxs)(`span`,{className:z(`tabular-nums text-[15px]`,b?`record-beat`:`text-[var(--color-fg-0,#e6e8ed)]`),children:[(0,B.jsx)(yr,{value:s,curve:`spring`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4,#5a6071)] mx-1`,children:`/`}),(0,B.jsx)(yr,{value:l,curve:`elastic`})]})}),(0,B.jsx)(Eo,{label:`agents`,children:(0,B.jsx)(yr,{value:p,curve:`spring`,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`})}),(0,B.jsx)(Eo,{label:`rules`,children:(0,B.jsx)(yr,{value:h,curve:`spring`,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`})})]})}function Eo({label:e,children:t}){return(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,B.jsx)(`span`,{className:`uppercase tracking-wider text-[10px] text-[var(--color-fg-4,#5a6071)]`,children:e}),t]})}var Do=`ssg.sfx.enabled`;function Oo(){if(typeof window>`u`)return!1;try{return window.localStorage.getItem(Do)===`true`}catch{return!1}}function ko(e){if(!(typeof window>`u`))try{window.localStorage.setItem(Do,String(e))}catch{}}function Ao(e,t,n,r,i,a,o=`sine`){try{let s=e.createOscillator(),c=e.createGain(),l=i/1e3;s.type=o,s.frequency.setValueAtTime(n,e.currentTime),s.frequency.exponentialRampToValueAtTime(Math.max(1,r),e.currentTime+l),c.gain.setValueAtTime(a,e.currentTime),c.gain.exponentialRampToValueAtTime(.001,e.currentTime+l),s.connect(c),c.connect(t),s.start(e.currentTime),s.stop(e.currentTime+l+.02)}catch{}}function jo(){let[e,t]=(0,_.useState)(Oo),n=(0,_.useRef)(null),r=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=()=>{let t=n.current;t&&(document.hidden?t.suspend().catch(()=>{}):e&&t.resume().catch(()=>{}))};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e]),{enabled:e,toggle:(0,_.useCallback)(()=>{t(e=>{let t=!e;if(ko(t),t){if(!n.current)try{let e=new AudioContext,t=e.createGain();t.gain.value=.8,t.connect(e.destination),n.current=e,r.current=t}catch{}n.current?.resume().catch(()=>{})}else n.current?.suspend().catch(()=>{});return t})},[]),play:(0,_.useCallback)(t=>{if(!e)return;let i=n.current,a=r.current;if(!(!i||!a||i.state===`suspended`))switch(t){case`block`:Ao(i,a,110,55,150,.08);break;case`force`:Ao(i,a,80,40,200,.1),Ao(i,a,160,80,200,.05,`square`);break;case`milestone`:{Ao(i,a,660,880,100,.06);let e=i,t=a;setTimeout(()=>{e.state!==`suspended`&&Ao(e,t,880,1320,100,.05)},115);break}case`record`:Ao(i,a,880,1320,350,.07);break}},[e])}}function Mo(e){return!Number.isFinite(e)||e<=0?`—`:e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:`${(e/1e6).toFixed(2)} ms`}async function No(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:Ae()})}var Po=e=>!0,Fo=e=>e.decision===`allow`,Io=e=>e.decision===`block`,Lo=e=>e.decision===`ask`,Ro=e=>e.decision===`force`,zo=e=>e.decision===`log`;function Bo(){let e=new Date;return e.setHours(0,0,0,0),e.getTime()}function Vo(){let e=je([`counters-updated`,`activity-updated`,`pending-changed`,`runtime-tick`]),t=De(),n=ke(),r=Oe(),i=jo();(0,_.useEffect)(()=>{t&&(t.decision===`block`?i.play(`block`):t.decision===`force`&&i.play(`force`))},[n]);let a=(0,_.useCallback)(()=>i.play(`milestone`),[i]),o=(0,_.useCallback)(()=>i.play(`record`),[i]),[s,c]=(0,_.useState)(()=>Bo());(0,_.useEffect)(()=>{let e=()=>{if(document.visibilityState!==`visible`)return;let e=Bo();c(t=>e===t?t:e)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let{data:l}=F(`/api/state/counters?since_ms=${s}`,[e[`counters-updated`],s]),{data:u}=F(`/api/state/runtime`,[e[`runtime-tick`]]),{data:d}=F(`/api/json/limits`,[e[`runtime-tick`]]),{data:f,refetch:p}=F(`/api/json/pending`,[e[`pending-changed`]]),{data:m}=F(`/api/json/blocked`,[e[`activity-updated`]]),h=Na(),[g,v]=(0,_.useState)(!1),y=(0,_.useMemo)(()=>{let e=l?.allow??0,n=l?.block??0,r=l?.ask??0,i=l?.log??0,a=l?.force??0,o=e+n+r+i+a,s=t?.counters.total??0;return t&&s>=o&&t?{allow:t.counters.allow,block:t.counters.block,ask:t.counters.ask,log:t.counters.log,force:t.counters.force,shadow:t.counters.shadow,total:t.counters.total}:{allow:e,block:n,ask:r,log:i,force:a,shadow:0,total:o}},[t,l]),b=(0,_.useMemo)(()=>{if(r.length===0)return 0;let e=Date.now()-1e4;return r.filter(t=>t.ts_ms>=e).length/10},[r]),x=u?.history?.cpu_pct??[],S=u?.history?.memory_rss_mb??[],C=[],w=u?.latency,T=(0,_.useMemo)(()=>({"hero-metrics":()=>(0,B.jsx)(`div`,{className:`grid-bleed rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 h-full`,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3 h-full`,children:[(0,B.jsx)(Ar,{label:`Total`,value:y.total,tone:`amber`,sub:t?Mo(t.duration_ns):void 0,burstRing:r,filter:Po}),(0,B.jsx)(Ar,{label:`Allow`,value:y.allow,tone:`green`,burstRing:r,filter:Fo}),(0,B.jsx)(Ar,{label:`Block`,value:y.block,tone:`red`,burstRing:r,filter:Io}),(0,B.jsx)(Ar,{label:`Ask`,value:y.ask,tone:`amber`,burstRing:r,filter:Lo}),(0,B.jsx)(Ar,{label:`Force`,value:y.force,tone:`blue`,burstRing:r,filter:Ro}),(0,B.jsx)(Ar,{label:`Log`,value:y.log,tone:`purple`,burstRing:r,filter:zo})]})}),graph:()=>(0,B.jsx)(po,{}),"latency-trace":()=>(0,B.jsx)(ei,{latency:w,bursts:r,gaugeMaxMs:10,windowMs:3e4,trendWindowSec:60,gaugeSize:200}),throughput:()=>(0,B.jsxs)(V,{className:`h-full`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`overline`,children:`throughput · evals/s`}),(0,B.jsxs)(mr,{variant:`blue`,children:[b.toFixed(1),`/s`]})]}),(0,B.jsxs)(U,{children:[(0,B.jsx)(Sr,{value:b,width:360,height:96,windowMs:6e4,className:`w-full`}),(0,B.jsx)(`p`,{className:`overline mt-2 text-center`,children:`60-second rolling window`})]})]}),"decision-mix":()=>(0,B.jsxs)(V,{className:`h-full`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`overline`,children:`decision mix`}),(0,B.jsx)(mr,{variant:`gray`,children:y.total.toLocaleString()})]}),(0,B.jsx)(U,{children:(0,B.jsx)(ri,{counters:{allow:y.allow,block:y.block,ask:y.ask,log:y.log,force:y.force,shadow:y.shadow}})})]}),"telemetry-feed":()=>(0,B.jsxs)(V,{variant:`flush`,className:`h-full flex flex-col`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`overline`,children:`telemetry · live · newest first`}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:[`hover to pause · scroll for history · `,r.length,` events buffered`]})]}),(0,B.jsx)(U,{className:`p-0 flex-1 min-h-0`,children:(0,B.jsx)(hi,{variant:`decision`,bursts:r,windowSize:80,height:360,className:`border-0 rounded-none`})})]}),"system-pulse":()=>(0,B.jsx)(ci,{cpuPct:u?.cpu_pct??0,cpuSeries:x,cpuLimit:d?.config.cpuLimitPct,memMb:u?.memory_rss_mb??0,memSeries:S,memLimit:d?.config.memoryLimitMb,heapUsedMb:u?.heap_used_mb??0,heapTotalMb:u?.heap_total_mb??0,heapSeries:C,uptimeSec:(u?.uptime_ms??0)/1e3}),"pending-approvals":()=>(0,B.jsxs)(V,{className:`h-full`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`overline`,children:`pending approvals`}),(0,B.jsx)(mr,{variant:f&&f.length>0?`amber`:`gray`,children:f?.length??0})]}),(0,B.jsx)(U,{children:f&&f.length>0?(0,B.jsx)(`ul`,{className:`space-y-2`,children:f.slice(0,5).map(e=>(0,B.jsxs)(`li`,{className:`flex items-center justify-between gap-2 border-b border-[var(--color-line-0)] last:border-b-0 py-1.5 text-[12px] font-mono`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`text-[var(--color-fg-1)] truncate`,children:[e.toolCall.tool,` · `,e.ruleId]}),(0,B.jsx)(`div`,{className:`text-[var(--color-fg-3)] text-[11px] truncate`,children:ur(e.toolCall.tool,JSON.stringify(e.toolCall.input??{}))})]}),(0,B.jsxs)(`div`,{className:`flex gap-1 shrink-0`,children:[(0,B.jsx)(W,{size:`sm`,variant:`primary`,onClick:()=>No(e.id,`allow`).then(p),children:`allow`}),(0,B.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>No(e.id,`block`).then(p),children:`block`})]})]},e.id))}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] py-3 text-center`,children:`— no pending approvals —`})})]}),"recent-blocks":()=>(0,B.jsxs)(V,{className:`h-full`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`overline`,children:`recent blocks & forces`}),(0,B.jsx)(mr,{variant:m&&m.length>0?`red`:`gray`,children:m?.length??0})]}),(0,B.jsx)(U,{children:m&&m.length>0?(0,B.jsx)(`ul`,{className:`space-y-1.5`,children:m.slice(0,6).map((e,t)=>(0,B.jsxs)(`li`,{className:`flex items-center gap-2 text-[12px] font-mono border-b border-[var(--color-line-0)] last:border-b-0 py-1.5`,children:[(0,B.jsx)(mr,{variant:e.decision===`force`?`amber`:`red`,children:e.decision}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate flex-1`,children:ur(e.tool,e.input)}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate text-[11px] max-w-[120px]`,children:e.rule_id??`—`})]},`${e.timestamp}-${t}`))}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] py-3 text-center`,children:`— no recent blocks —`})})]})}),[y,t,r,w,b,u,x,S,C,d,f,m,p]),E=Mt({from:`first`,translateY:22,durationMs:640,staggerMs:80,maxStaggerMs:520});return(0,B.jsxs)(`div`,{ref:g?void 0:E,className:`space-y-5`,children:[(0,B.jsx)(bo,{className:`w-full max-w-none`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`div`,{className:`flex-1`,children:(0,B.jsx)(Ji,{manager:h,isEditing:g,onToggleEditing:v})}),(0,B.jsx)(`button`,{type:`button`,onClick:i.toggle,className:`chip cursor-pointer hover:border-sky-500/50 hover:text-sky-300 transition-colors shrink-0`,title:i.enabled?`Mute stream sounds`:`Enable stream sounds`,children:i.enabled?`SFX ON`:`SFX OFF`})]}),(0,B.jsx)(qi,{panels:h.activeLayout.panels,isEditing:g,renderers:T,onPanelsChange:h.updateActivePanels}),(0,B.jsx)(To,{className:`fixed top-4 right-4 z-30`,onMilestone:a,onRecord:o})]})}function Ho({val:e}){return e==null?(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] italic font-mono text-xs`,children:`null`}):typeof e==`boolean`?(0,B.jsx)(`span`,{className:`inline-block font-mono text-[10px] font-medium uppercase tracking-wider px-1.5 py-0.5 rounded-sm border ${e?`bg-emerald-500/8 text-emerald-300 border-emerald-500/25`:`bg-red-500/8 text-red-300 border-red-500/25`}`,children:e.toString()}):typeof e==`number`?(0,B.jsx)(`span`,{className:`font-mono tabular-nums text-violet-300 text-xs`,children:e}):typeof e==`string`?e.length===0?(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] italic text-xs font-mono`,children:`empty string`}):e.length>200?(0,B.jsx)(`pre`,{className:`text-[11px] font-mono text-[var(--color-fg-1)] whitespace-pre-wrap break-all bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 max-h-40 overflow-y-auto`,children:e}):(0,B.jsx)(`span`,{className:`font-mono text-xs text-[var(--color-fg-1)] break-all`,children:e}):(0,B.jsx)(`pre`,{className:`text-[11px] font-mono text-[var(--color-fg-1)] whitespace-pre-wrap break-all bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 max-h-40 overflow-y-auto`,children:JSON.stringify(e,null,2)})}function Uo({inputJson:e}){let t=[];try{let n=JSON.parse(e);n&&typeof n==`object`&&!Array.isArray(n)&&(t=Object.entries(n))}catch{return(0,B.jsx)(`pre`,{className:`text-[11px] font-mono text-[var(--color-fg-1)] whitespace-pre-wrap break-all bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2`,children:e})}return t.length===0?(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-xs italic font-mono`,children:`no input fields`}):(0,B.jsx)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] overflow-hidden text-xs`,children:t.map(([e,t],n)=>(0,B.jsxs)(`div`,{className:`flex gap-0 ${n>0?`border-t border-[var(--color-line-0)]`:``}`,children:[(0,B.jsx)(`div`,{className:`w-40 shrink-0 px-3 py-2 bg-[var(--color-surface-0)] text-[var(--color-fg-3)] font-mono text-[11px] border-r border-[var(--color-line-0)] select-none`,children:e}),(0,B.jsx)(`div`,{className:`flex-1 min-w-0 px-3 py-2 leading-relaxed`,children:(0,B.jsx)(Ho,{val:t})})]},e))})}var Wo={allow:`green`,block:`red`,force:`amber`,ask:`blue`,log:`gray`},Go={allow:`border-l-emerald-500/60`,block:`border-l-red-500/60`,force:`border-l-amber-400/60`,ask:`border-l-sky-500/60`,log:`border-l-[var(--color-line-2)]`};function Ko(e){return e==null?null:e<1e6?`${(e/1e3).toFixed(0)}µs`:`${(e/1e6).toFixed(1)}ms`}function qo({label:e,value:t,mono:n,children:r}){return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline mb-1`,children:e}),r??(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] text-xs ${n?`font-mono`:``} break-all`,children:t??`—`})]})}function Jo({text:e}){let[t,n]=(0,_.useState)(!1);return(0,B.jsx)(`button`,{onClick:async t=>{t.stopPropagation();try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] border border-[var(--color-line-1)] hover:border-[var(--color-line-2)] rounded-sm px-2 py-1 transition-colors cursor-pointer`,children:t?`✓ copied`:`copy json`})}function Yo({row:e,defaultExpanded:t=!1}){let[n,r]=(0,_.useState)(t),i=(0,_.useRef)(null),a=(0,_.useRef)(!0),o=ur(e.tool,e.input),s=Wo[e.decision]??`gray`,c=Go[e.decision]??`border-l-[var(--color-line-2)]`,l=lr(e.timestamp),u=Ko(e.duration_ns);(0,_.useEffect)(()=>{let e=i.current;if(e){if(a.current){a.current=!1,n||(e.style.maxHeight=`0`,e.style.opacity=`0`);return}if(pt()){e.style.maxHeight=n?`none`:`0`,e.style.opacity=n?`1`:`0`;return}if(n){let t=e.scrollHeight;jt(e,{"max-height":[`0px`,`${t}px`],opacity:[0,1],translateY:[-6,0],duration:260,ease:`outCubic`,onComplete:()=>{e.style.maxHeight=`none`}})}else{let t=e.scrollHeight;jt(e,{"max-height":[`${t}px`,`0px`],opacity:[1,0],duration:180,ease:`outCubic`})}}},[n]);let d=(()=>{try{return JSON.stringify(JSON.parse(e.input),null,2)}catch{return e.input}})();return(0,B.jsxs)(`div`,{className:`border border-[var(--color-line-1)] border-l-2 ${c} rounded-sm bg-[var(--color-surface-1)] overflow-hidden transition-colors hover:border-[var(--color-line-2)] hover:border-l-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 cursor-pointer select-none group`,onClick:()=>r(e=>!e),role:`button`,"aria-expanded":n,children:[(0,B.jsx)(`svg`,{className:`shrink-0 text-[var(--color-fg-4)] group-hover:text-[var(--color-fg-2)] transition-all ${n?`rotate-90`:``}`,width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,B.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),(0,B.jsx)(`time`,{className:`shrink-0 font-mono text-[11px] text-[var(--color-fg-3)] w-14 tabular-nums`,title:l,dateTime:new Date(e.timestamp*1e3).toISOString(),children:cr(e.timestamp)}),(0,B.jsx)(mr,{variant:s,className:`shrink-0`,children:e.decision}),(0,B.jsx)(`code`,{className:`shrink-0 text-[11px] text-[var(--color-brand)] font-mono`,children:e.tool}),o&&(0,B.jsx)(`span`,{className:`flex-1 min-w-0 text-[11px] text-[var(--color-fg-2)] font-mono truncate`,title:o,children:o}),(0,B.jsx)(`span`,{className:`shrink-0 text-[10px] font-mono text-[var(--color-fg-4)] ml-auto pl-2 uppercase tracking-wider`,title:e.client?`client: ${e.client}`:`client: unidentified`,children:e.client??`—`})]}),(0,B.jsx)(`div`,{ref:i,className:`border-t border-[var(--color-line-0)] overflow-hidden`,style:{maxHeight:n?`none`:`0`,opacity:n?1:0},"aria-hidden":!n,children:n&&(0,B.jsxs)(`div`,{className:`px-3 py-3 space-y-4`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-3`,children:[(0,B.jsx)(qo,{label:`Timestamp`,value:l}),(0,B.jsx)(qo,{label:`Decision`,children:(0,B.jsx)(mr,{variant:s,children:e.decision})}),(0,B.jsx)(qo,{label:`Tool`,children:(0,B.jsx)(`code`,{className:`text-xs font-mono text-[var(--color-brand)]`,children:e.tool})}),e.client&&(0,B.jsx)(qo,{label:`Client`,value:e.client}),e.rule_id&&(0,B.jsx)(qo,{label:`Rule ID`,children:(0,B.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.rule_id)}`,className:`text-xs text-[var(--color-brand)] hover:underline font-mono`,onClick:e=>e.stopPropagation(),children:e.rule_id})}),e.source_file&&(0,B.jsx)(qo,{label:`Source File`,value:e.source_file,mono:!0}),u&&(0,B.jsx)(qo,{label:`Latency`,value:u,mono:!0}),e.rules_evaluated!=null&&(0,B.jsx)(qo,{label:`Rules Evaluated`,value:`${e.rules_evaluated}`,mono:!0})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline mb-2`,children:`Tool Input`}),(0,B.jsx)(Uo,{inputJson:e.input})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.rule_id?(0,B.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.rule_id)}`,className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-brand)]/70 hover:text-[var(--color-brand)] transition-colors`,onClick:e=>e.stopPropagation(),children:`→ view rule`}):(0,B.jsx)(`span`,{}),(0,B.jsx)(Jo,{text:d})]})]})})]})}function Xo({className:e,children:t,...n}){return(0,B.jsx)(`pre`,{className:z(`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm px-3 py-2 text-[11px] leading-relaxed font-mono text-[var(--color-fg-1)] overflow-x-auto whitespace-pre-wrap break-all`,e),...n,children:t})}var Zo={neutral:`text-[var(--color-fg-0)]`,green:`text-emerald-300`,red:`text-red-300`,amber:`text-amber-300`,blue:`text-sky-300`,purple:`text-violet-300`,gray:`text-[var(--color-fg-3)]`},Qo={neutral:`bg-[var(--color-fg-3)]`,green:`bg-emerald-500`,red:`bg-red-500`,amber:`bg-[var(--color-brand)]`,blue:`bg-sky-500`,purple:`bg-violet-500`,gray:`bg-[var(--color-line-2)]`},$o=[{label:`User code`,color:`#451a03`},{label:`Runtime (bun:/node:)`,color:`#172554`},{label:`Native/other`,color:`#1f2937`},{label:`GC/idle`,color:`#450a0a`}];function es({label:e,value:t,sub:n,tone:r=`neutral`,align:i=`left`,labelPlacement:a=`above`,labelClassName:o,valueClassName:s,subClassName:c}){let l=(0,B.jsx)(`div`,{className:z(a===`above`?`overline mb-1.5`:`mt-1 text-[11px] text-[var(--color-fg-3)]`,o),children:e});return(0,B.jsxs)(B.Fragment,{children:[a===`above`&&l,(0,B.jsx)(`div`,{className:z(`font-mono font-medium tabular-nums`,i===`center`&&`text-center`,Zo[r],s),children:t}),a===`below`&&l,n&&(0,B.jsx)(`div`,{className:z(`mt-1 text-[10px] font-mono text-[var(--color-fg-3)]`,i===`center`&&`text-center`,c),children:n})]})}function ts({className:e,contentClassName:t,label:n,value:r,sub:i,tone:a,align:o,labelPlacement:s,labelClassName:c,valueClassName:l,subClassName:u,...d}){return(0,B.jsx)(V,{className:e,...d,children:(0,B.jsx)(U,{className:z(`py-3`,o===`center`&&`text-center`,t),children:(0,B.jsx)(es,{label:n,value:r,sub:i,tone:a,align:o,labelPlacement:s,labelClassName:c,valueClassName:l,subClassName:u})})})}function ns({className:e,...t}){return(0,B.jsx)(`div`,{className:z(`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)] p-3`,t.align===`center`&&`text-center`,e),children:(0,B.jsx)(es,{...t})})}function rs({pct:e,tone:t=`green`,markerPct:n,className:r,barClassName:i,markerTitle:a}){let o=Math.max(0,Math.min(100,e)),s=n===void 0?null:Math.max(0,Math.min(100,n));return(0,B.jsxs)(`div`,{className:z(`relative w-full overflow-hidden rounded-sm bg-[var(--color-surface-3)]`,r),children:[(0,B.jsx)(`div`,{className:z(`h-full rounded-sm transition-all duration-500`,Qo[t],i),style:{width:`${o}%`}}),s!==null&&(0,B.jsx)(`div`,{className:`absolute top-0 h-full w-0.5 bg-[var(--color-brand)]/70`,style:{left:`${s}%`},title:a})]})}function is({label:e,value:t,tone:n=`neutral`,breached:r=!1,breachLabel:i=`limit exceeded`,trendData:a,trendColor:o,threshold:s,maxValue:c,footer:l,className:u,valueClassName:d}){return(0,B.jsxs)(V,{className:u,children:[(0,B.jsxs)(H,{className:`py-2`,children:[(0,B.jsx)(`span`,{className:`overline`,children:e}),r&&(0,B.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300`,children:i})]}),(0,B.jsxs)(U,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsx)(`div`,{className:z(`text-2xl font-mono font-medium tabular-nums`,Zo[n],d),children:t}),(a?.length??0)>1&&o&&(0,B.jsx)(br,{data:a??[],width:80,height:28,color:o,threshold:s,maxValue:c})]}),l]})]})}function as({profile:e,children:t}){return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] font-mono text-[var(--color-fg-3)]`,children:[(0,B.jsxs)(`span`,{children:[`nodes:`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.nodes.length})]}),(0,B.jsxs)(`span`,{children:[`duration:`,` `,(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-1)]`,children:[((e.endTime-e.startTime)/1e3).toFixed(0),`ms`]})]}),(0,B.jsxs)(`span`,{children:[`samples:`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.samples?.length??0})]})]}),(0,B.jsx)(`div`,{className:`flex gap-3 text-[10px] font-mono text-[var(--color-fg-3)]`,children:$o.map(e=>(0,B.jsxs)(`span`,{className:`flex items-center`,children:[(0,B.jsx)(`span`,{className:`mr-1 inline-block h-2.5 w-2.5 rounded-[1px]`,style:{background:e.color}}),e.label]},e.label))}),t]})}function os({memory:e,formatValue:t}){return(0,B.jsx)(`div`,{className:`grid grid-cols-4 gap-3`,children:[{label:`RSS`,value:t(e.rss)},{label:`Heap Total`,value:t(e.heapTotal)},{label:`Heap Used`,value:t(e.heapUsed)},{label:`External`,value:t(e.external)}].map(e=>(0,B.jsx)(ns,{align:`center`,label:e.label,value:e.value,valueClassName:`text-lg font-medium text-[var(--color-fg-0)]`},e.label))})}var ss=3;function cs(e){return e===null?`—`:e<1e6?`${(e/1e3).toFixed(0)}µs`:`${(e/1e6).toFixed(1)}ms`}var ls=[`counters-updated`,`activity-updated`,`pending-changed`,`runtime-tick`,`limits-breach`];function us({info:e}){let t=e.tier===`pro`||e.tier===`enterprise`,n=e.status===`needs_reauth`,r=e.pct_used??0,i=r>=90?`bg-red-500`:r>=70?`bg-amber-500`:`bg-emerald-500`;return(0,B.jsxs)(V,{className:n?`border-l-2 border-l-amber-500/70`:t?`border-l-2 border-l-emerald-500/70`:`border-l-2 border-l-sky-500/70`,children:[(0,B.jsxs)(H,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-xs font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`license`}),(0,B.jsx)(mr,{variant:t?`green`:n?`amber`:`blue`,children:e.tier_label}),e.fleet_enrolled&&(0,B.jsx)(mr,{variant:`gray`,children:`fleet`})]}),e.email&&(0,B.jsx)(`span`,{className:`text-xs text-[var(--color-fg-3)]`,children:e.email})]}),(0,B.jsxs)(U,{className:`space-y-3`,children:[n&&e.detail&&(0,B.jsxs)(`div`,{className:`rounded border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs text-amber-200`,children:[e.detail,` — run `,(0,B.jsx)(`code`,{className:`font-mono`,children:`ssg auth login`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-xs text-[var(--color-fg-2)]`,children:[(0,B.jsx)(`span`,{children:`evals today`}),(0,B.jsxs)(`span`,{children:[e.evals_today.toLocaleString(),e.eval_daily_limit!==null&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:` / `}),e.eval_daily_limit.toLocaleString()]}),e.eval_daily_limit===null&&(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:` · unlimited`})]})]}),e.eval_daily_limit!==null&&(0,B.jsx)(`div`,{className:`mt-1 h-1.5 w-full overflow-hidden rounded-full bg-[var(--color-bg-2)]`,children:(0,B.jsx)(`div`,{className:`h-full transition-all ${i}`,style:{width:`${r}%`}})})]}),!t&&(0,B.jsxs)(`a`,{href:e.upgrade_url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs text-[var(--color-brand)] hover:underline`,children:[`Upgrade to Pro · $`,e.pricing.pro_monthly_usd,`/mo →`]}),t&&e.retention_days>0&&(0,B.jsxs)(`div`,{className:`text-[10px] text-[var(--color-fg-3)] font-mono uppercase tracking-wider`,children:[`cloud retention: `,e.retention_days,` days`]})]})]})}function ds(e){return new Date(e*1e3).toLocaleTimeString()}async function fs(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:Ae()})}async function ps(e,t){let n=await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...Ae()},body:JSON.stringify({ruleId:e,file:t})});if(!n.ok)throw Error(`Toggle failed: ${n.status}`)}async function ms(e,t){let n=await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...Ae()},body:JSON.stringify({ruleId:e,file:t})});if(!n.ok)throw Error(`Toggle failed: ${n.status}`)}async function hs(e,t){let n=await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({ruleId:e,file:t,decision:`ask`})});if(!n.ok)throw Error(`Update decision failed: ${n.status}`)}async function gs(e,t){let n=await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({ruleId:e,file:t,decision:`block`})});if(!n.ok)throw Error(`Update decision failed: ${n.status}`)}function _s({ruleId:e}){return e?(0,B.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e)}`,className:`text-[var(--color-brand)] hover:underline text-xs font-mono break-all`,title:`Go to rule: ${e}`,children:e}):(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`—`})}function vs({title:e,right:t}){return(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,B.jsx)(`h2`,{className:`overline text-[11px]`,children:e}),t]})}function ys({children:e}){return(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:e})}function bs({item:e,onDisable:t,onChangeToAsk:n,onUndo:r}){let[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(`idle`),[c,l]=(0,_.useState)(!1),u=ur(e.tool,e.input),d=e.rule_id&&e.source_file,f=e.decision===`force`?`force`:`block`,p=f===`force`?`amber`:`red`,m=async()=>{s(`loading`);try{await n(),s(`done-ask`)}catch{s(`error`)}},h=async()=>{s(`loading`);try{await t(),s(`done-disable`)}catch{s(`error`)}},g=async()=>{l(!0);try{await r(o===`done-disable`?`disable`:`ask`),s(`idle`)}catch{}finally{l(!1)}},v=o===`done-ask`||o===`done-disable`;return(0,B.jsx)(V,{className:`border-l-2 ${v?`border-l-[var(--color-line-1)]`:f===`force`?`border-l-amber-400/60`:`border-l-red-500/60`} ${v?`opacity-60`:``}`,children:(0,B.jsxs)(`div`,{className:`px-3 py-3`,children:[v&&(0,B.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm px-2.5 py-1.5 mb-3 text-[11px] font-mono ${o===`done-ask`?`bg-sky-500/5 border border-sky-500/25 text-sky-300`:`bg-amber-500/5 border border-amber-500/25 text-amber-300`}`,children:[(0,B.jsx)(`span`,{className:`truncate`,children:o===`done-ask`?`✓ rule "${e.rule_id}" → ask · prompts next time`:`✓ rule "${e.rule_id}" disabled · no longer blocks`}),(0,B.jsx)(`button`,{onClick:g,disabled:c,className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-current/40 hover:bg-white/5 transition-colors cursor-pointer disabled:opacity-50 uppercase tracking-wider text-[10px]`,children:c?`…`:`↩ undo`})]}),o===`error`&&(0,B.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm px-2.5 py-1.5 mb-3 text-[11px] font-mono bg-red-500/5 border border-red-500/25 text-red-300`,children:[(0,B.jsx)(`span`,{children:`failed to update rule — check server logs`}),(0,B.jsx)(`button`,{onClick:()=>s(`idle`),className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-current/40 hover:bg-white/5 transition-colors cursor-pointer uppercase tracking-wider text-[10px]`,children:`retry`})]}),(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5 flex-wrap`,children:[(0,B.jsx)(mr,{variant:v?o===`done-ask`?`blue`:`gray`:p,children:v?o===`done-ask`?`ask`:`disabled`:f}),(0,B.jsx)(`code`,{className:`text-[var(--color-brand)] text-xs font-mono`,children:e.tool}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-xs`,children:`·`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] text-[11px] font-mono tabular-nums`,children:ds(e.timestamp)}),e.repeat_count>1&&(0,B.jsxs)(mr,{variant:`gray`,children:[`×`,e.repeat_count]})]}),(0,B.jsx)(`div`,{className:`text-xs font-mono truncate cursor-pointer hover:text-[var(--color-fg-0)] transition-colors ${v?`text-[var(--color-fg-4)] line-through`:`text-[var(--color-fg-1)]`}`,title:u,onClick:()=>a(e=>!e),children:u})]}),d&&!v&&o!==`error`&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pt-0.5`,children:[(0,B.jsxs)(`button`,{onClick:m,disabled:o===`loading`,className:`inline-flex items-center gap-1 h-7 px-2.5 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-sky-500/8 text-sky-300 border border-sky-500/25 hover:bg-sky-500/15 hover:border-sky-500/40 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,children:[o===`loading`?(0,B.jsx)(`span`,{className:`animate-spin`,children:`⟳`}):(0,B.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,B.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,B.jsx)(`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}),(0,B.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),`ask instead`]}),(0,B.jsxs)(`button`,{onClick:h,disabled:o===`loading`,className:`inline-flex items-center gap-1 h-7 px-2.5 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-red-500/8 text-red-300 border border-red-500/25 hover:bg-red-500/15 hover:border-red-500/40 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,children:[o===`loading`?(0,B.jsx)(`span`,{className:`animate-spin`,children:`⟳`}):(0,B.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,B.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,B.jsx)(`line`,{x1:`15`,y1:`9`,x2:`9`,y2:`15`}),(0,B.jsx)(`line`,{x1:`9`,y1:`9`,x2:`15`,y2:`15`})]}),`disable rule`]})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 mt-2 text-[11px] font-mono`,children:[e.rule_id&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`rule`}),(0,B.jsx)(_s,{ruleId:e.rule_id})]}),e.source_file&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`src`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:e.source_file})]}),e.rules_evaluated!==null&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`evals`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums`,children:e.rules_evaluated})]}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`latency`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums`,children:cs(e.duration_ns)})]}),(0,B.jsx)(`button`,{onClick:()=>a(e=>!e),className:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-0)] transition-colors ml-auto cursor-pointer uppercase tracking-wider text-[10px]`,children:i?`▾ hide`:`▸ details`})]}),i&&(0,B.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,B.jsx)(`div`,{className:`overline mb-2`,children:`full input`}),(0,B.jsx)(Xo,{children:(()=>{try{return JSON.stringify(JSON.parse(e.input),null,2)}catch{return e.input}})()})]})]})})}function xs(){let e=je(ls),t=[e[`counters-updated`],e[`activity-updated`],e[`pending-changed`]],{data:n}=F(`/api/state/counters`,t),{data:r,refetch:i}=F(`/api/json/pending`,t),{data:a,refetch:o}=F(`/api/json/blocked`,t),{data:s}=F(`/api/state/activity`,t),{data:c}=F(`/api/state/runtime`,[e[`runtime-tick`]]),{data:l}=F(`/api/json/limits`,[e[`limits-breach`]]),{data:u}=F(`/api/json/license`,[e[`activity-updated`]]),[d,f]=(0,_.useState)(!1),p=a?.reduce((e,t)=>e+t.repeat_count,0)??0,m=[{label:`allow`,value:n?.allow??0,tone:`green`},{label:`block`,value:(n?.block??0)+(n?.force??0),tone:`red`},{label:`force`,value:n?.force??0,tone:`amber`},{label:`pending`,value:n?.pending??0,tone:`blue`},{label:`log`,value:n?.log??0,tone:`gray`}];return(0,B.jsxs)(`div`,{ref:Mt({from:`first`}),className:`space-y-8`,children:[(0,B.jsx)(`div`,{className:`grid grid-cols-5 gap-2`,children:m.map(e=>(0,B.jsx)(ts,{align:`left`,label:e.label,value:e.value,tone:e.tone,labelPlacement:`above`,contentClassName:`py-3`,valueClassName:`text-2xl font-medium`,"data-reveal":!0},e.label))}),u&&(0,B.jsx)(`div`,{"data-reveal":!0,children:(0,B.jsx)(us,{info:u})}),c&&(0,B.jsxs)(`div`,{"data-reveal":!0,className:`grid grid-cols-2 gap-2`,children:[(0,B.jsx)(is,{label:`cpu`,value:`${c.cpu_pct??`—`}%`,tone:l?.breaches.cpu?`red`:(c.cpu_pct??0)>=60?`amber`:`green`,breached:l?.breaches.cpu??!1,trendData:c.history?.cpu_pct,trendColor:l?.breaches.cpu?`#f87171`:`#34d399`,threshold:l?.config.cpuLimitPct,maxValue:100,className:l?.breaches.cpu?`border-red-500/40`:``,footer:(0,B.jsx)(`a`,{href:`/monitor`,className:`mt-1 block text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`view details →`})}),(0,B.jsx)(is,{label:`memory rss`,value:(0,B.jsxs)(B.Fragment,{children:[c.memory_rss_mb??`—`,(0,B.jsx)(`span`,{className:`ml-1 text-sm text-[var(--color-fg-3)]`,children:`MB`})]}),tone:l?.breaches.memory?`red`:`neutral`,breached:l?.breaches.memory??!1,trendData:c.history?.memory_rss_mb,trendColor:l?.breaches.memory?`#f87171`:`#38bdf8`,threshold:l?.config.memoryLimitMb,className:l?.breaches.memory?`border-red-500/40`:``,footer:(0,B.jsx)(`a`,{href:`/monitor`,className:`mt-1 block text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`view details →`})})]}),(0,B.jsxs)(`section`,{"data-reveal":!0,children:[(0,B.jsx)(vs,{title:`pending approvals`}),!r||r.length===0?(0,B.jsx)(ys,{children:`no pending approvals`}):(0,B.jsx)(`div`,{className:`space-y-2`,children:r.map(e=>(0,B.jsxs)(V,{className:`border-l-2 border-l-sky-500/50`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(W,{size:`sm`,variant:`primary`,onClick:async()=>{await fs(e.id,`allow`),i()},children:`approve`}),(0,B.jsx)(W,{size:`sm`,variant:`danger`,onClick:async()=>{await fs(e.id,`block`),i()},children:`deny`})]})]}),(0,B.jsxs)(U,{className:`space-y-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`tool`}),(0,B.jsx)(`code`,{className:`text-[var(--color-brand)] font-mono`,children:e.toolCall.tool})]}),e.prompt&&(0,B.jsxs)(`div`,{className:`flex gap-2 items-start`,children:[(0,B.jsx)(`span`,{className:`overline pt-0.5`,children:`prompt`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,children:e.prompt})]}),(0,B.jsx)(Xo,{children:JSON.stringify(e.toolCall.input,null,2)})]})]},e.id))})]}),a&&a.length>0&&(0,B.jsxs)(`section`,{"data-reveal":!0,children:[(0,B.jsx)(vs,{title:`blocked actions`,right:(0,B.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:[a.length,` active`,p>a.length?` · ${p} total hits`:``]})}),(0,B.jsx)(`div`,{className:`space-y-2`,children:(d?a:a.slice(0,ss)).map(e=>(0,B.jsx)(bs,{item:e,onDisable:async()=>{await ps(e.rule_id,e.source_file),o()},onChangeToAsk:async()=>{await hs(e.rule_id,e.source_file),o()},onUndo:async t=>{t===`disable`?await ms(e.rule_id,e.source_file):await gs(e.rule_id,e.source_file),o()}},`${e.decision}:${e.rule_id??`none`}:${e.tool}:${e.timestamp}:${e.input}`))}),a.length>ss&&(0,B.jsx)(`div`,{className:`mt-3 flex justify-center`,children:(0,B.jsx)(W,{size:`sm`,variant:`secondary`,onClick:()=>f(e=>!e),children:d?`↑ show less`:`↓ show ${a.length-ss} more`})})]}),(0,B.jsxs)(`section`,{"data-reveal":!0,children:[(0,B.jsx)(vs,{title:`recent audit log`,right:s&&s.length>0?(0,B.jsx)(`a`,{href:`/audit`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)] transition-colors`,children:`view all →`}):void 0}),!s||s.length===0?(0,B.jsx)(ys,{children:`no audit entries yet`}):(0,B.jsx)(`div`,{className:`space-y-1.5`,children:s.slice(0,15).map(e=>(0,B.jsx)(Yo,{row:e},e.id))})]})]})}var Ss=[`rules-changed`],Cs=[`block`,`ask`,`log`,`allow`,`force`,`shadow`],ws={block:`text-red-300`,deny:`text-red-300`,ask:`text-sky-300`,allow:`text-emerald-300`,log:`text-[var(--color-fg-3)]`,force:`text-amber-300`,shadow:`text-violet-300`};async function Ts(e,t){await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...Ae()},body:JSON.stringify({ruleId:e,file:t})})}async function Es(e,t,n){await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({ruleId:e,file:t,decision:n})})}function Ds({rule:e,file:t,onToggle:n}){let[r,i]=(0,_.useState)(!1),a=(0,_.useRef)(null),o=(0,_.useCallback)(()=>{if(!e.enabled){n();return}i(!0),a.current=setTimeout(()=>i(!1),3e3)},[e.enabled,n]);return(0,_.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),r?(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,B.jsx)(`button`,{onClick:()=>{i(!1),n()},className:`text-[11px] font-mono uppercase tracking-wider bg-red-500/8 border border-red-500/30 text-red-300 hover:bg-red-500/15 rounded-sm px-2 py-0.5 cursor-pointer transition-colors`,children:`disable`}),(0,B.jsx)(`button`,{onClick:()=>i(!1),className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer`,children:`cancel`})]}):(0,B.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer shrink-0`,children:[(0,B.jsx)(`input`,{type:`checkbox`,className:`w-3.5 h-3.5 accent-[var(--color-brand)] cursor-pointer`,checked:e.enabled,onChange:o}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider ${e.enabled?`text-[var(--color-fg-1)]`:`text-[var(--color-fg-4)]`}`,children:e.enabled?`on`:`off`})]})}function Os(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await fetch(`/api/json/rule-write-enforcement`,{headers:{Accept:`application/json`}});if(!n.ok)return;let r=await n.json();!e&&typeof r.enforced==`boolean`&&t(r.enforced)}catch{}})(),()=>{e=!0}},[]);async function o(e){r(!0);try{let n=await fetch(`/api/json/rule-write-enforcement`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({enforced:e})});if(n.ok){let e=await n.json();typeof e.enforced==`boolean`&&t(e.enforced)}}finally{r(!1),a(!1)}}if(e===null)return null;let s=!e;return(0,B.jsx)(V,{className:s?`border-amber-500/40 bg-amber-500/5`:`border-[var(--color-line-1)]`,children:(0,B.jsx)(U,{className:`px-3 py-2.5`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`rule-write protection`}),(0,B.jsx)(`span`,{className:`text-[11px] font-mono uppercase tracking-wider ${s?`text-amber-300`:`text-emerald-300`}`,children:s?`disabled`:`enforced`})]}),(0,B.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] mt-1 leading-snug`,children:s?`Agents can currently Write/Edit .rules files. Turn this back on when you finish authoring.`:`Agents cannot Write/Edit/MultiEdit any .sigmashake/rules/**/*.rules file. Disable only when curating rulesets.`})]}),(0,B.jsx)(`div`,{className:`shrink-0`,children:i?(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(`button`,{onClick:()=>o(!1),disabled:n,className:`text-[11px] font-mono uppercase tracking-wider bg-amber-500/10 border border-amber-500/40 text-amber-200 hover:bg-amber-500/20 rounded-sm px-2 py-0.5 cursor-pointer transition-colors disabled:opacity-50`,children:`disable`}),(0,B.jsx)(`button`,{onClick:()=>a(!1),disabled:n,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer disabled:opacity-50`,children:`cancel`})]}):(0,B.jsx)(`button`,{onClick:()=>{e?a(!0):o(!0)},disabled:n,className:`text-[11px] font-mono uppercase tracking-wider border rounded-sm px-2.5 py-0.5 cursor-pointer transition-colors disabled:opacity-50 ${s?`bg-emerald-500/10 border-emerald-500/40 text-emerald-200 hover:bg-emerald-500/20`:`bg-[var(--color-surface-1)] border-[var(--color-line-1)] text-[var(--color-fg-1)] hover:bg-[var(--color-surface-2)]`}`,children:s?`enable`:`disable`})})]})})})}function ks(){let{data:e,refetch:t}=F(`/api/json/rules`,[je(Ss)[`rules-changed`]]),[n,r]=(0,_.useState)(``),i=new URLSearchParams(window.location.search).get(`highlight`)??``,a=(0,_.useRef)(null);if((0,_.useEffect)(()=>{a.current&&a.current.scrollIntoView({behavior:`smooth`,block:`center`})},[e,i]),!e)return(0,B.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading rules…`});if(e.rulesets.length===0)return(0,B.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 p-10 text-center`,children:[(0,B.jsx)(`p`,{className:`text-sm text-[var(--color-fg-2)] mb-2`,children:`No .rules files found.`}),(0,B.jsx)(`a`,{href:`/hub`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline`,children:`→ browse hub to install rulesets`})]});let o=n.toLowerCase(),s=e.rulesets.map(e=>({...e,rules:o?e.rules.filter(e=>e.id.toLowerCase().includes(o)||e.message.toLowerCase().includes(o)):e.rules})).filter(e=>!o||e.rules.length>0),c=e.rulesets.reduce((e,t)=>e+t.rules.length,0),l=e.rulesets.reduce((e,t)=>e+t.rules.filter(e=>e.enabled).length,0);return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`overline text-[11px]`,children:`rules`}),(0,B.jsxs)(`div`,{className:`flex items-baseline gap-3 mt-1`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-sm text-[var(--color-fg-0)] tabular-nums`,children:[l,(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`/`,c]}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-[11px] uppercase tracking-wider`,children:`active`})]}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-[var(--color-fg-3)] uppercase tracking-wider`,children:[e.files.length,` file`,e.files.length===1?``:`s`]})]})]}),(0,B.jsx)(`div`,{className:`ml-auto relative`,children:(0,B.jsx)(`input`,{type:`text`,placeholder:`search rules…`,value:n,onChange:e=>r(e.target.value),className:`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-xs rounded-sm px-2.5 py-1.5 w-56 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono`})})]}),(0,B.jsx)(Os,{}),s.length===0&&(0,B.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:[`no rules match "`,n,`"`]}),(0,B.jsx)(`div`,{className:`space-y-3`,children:s.map(e=>{let n=e.rules.some(e=>e.id===i),r=e.rules.filter(e=>e.enabled).length;return(0,B.jsx)(V,{children:(0,B.jsxs)(`details`,{open:n||!o,children:[(0,B.jsxs)(`summary`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer list-none select-none hover:bg-[var(--color-surface-2)]/70 border-b border-[var(--color-line-0)]`,children:[(0,B.jsxs)(`svg`,{className:`text-[var(--color-fg-3)] shrink-0`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,B.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,B.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]}),(0,B.jsx)(`code`,{className:`text-xs text-[var(--color-fg-0)] font-mono`,children:e.file}),(0,B.jsxs)(`span`,{className:`ml-auto font-mono text-[11px] text-[var(--color-fg-3)] tabular-nums`,children:[r,(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`/`,e.rules.length]})]})]}),(0,B.jsxs)(U,{className:`py-0`,children:[e.rules.length===0?(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] py-3`,children:`no rules in this file`}):(0,B.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:e.rules.map(n=>{let r=n.id===i;return(0,B.jsxs)(`div`,{ref:r?a:null,className:`py-2.5 flex items-start justify-between gap-4 ${r?`bg-amber-400/8 border-l-2 border-l-amber-400/60 -mx-3 px-3 -my-px`:``}`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1 flex-wrap`,children:[(0,B.jsx)(`select`,{value:n.decision,onChange:async r=>{await Es(n.id,e.file,r.target.value),t()},className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm px-1.5 py-0.5 text-[11px] font-mono uppercase tracking-wider cursor-pointer focus:outline-none focus:border-[var(--color-brand)]/50 ${ws[n.decision]??`text-[var(--color-fg-2)]`}`,children:Cs.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))}),(0,B.jsx)(`code`,{className:`text-xs font-mono text-[var(--color-fg-0)] break-all`,children:n.id})]}),(0,B.jsx)(`p`,{className:`text-xs text-[var(--color-fg-2)] truncate`,children:n.message})]}),(0,B.jsx)(Ds,{rule:n,file:e.file,onToggle:async()=>{await Ts(n.id,e.file),t()}})]},n.id)})}),e.content&&(0,B.jsxs)(`details`,{className:`mt-3 pb-3`,children:[(0,B.jsx)(`summary`,{className:`overline cursor-pointer hover:text-[var(--color-fg-1)] select-none`,children:`raw source`}),(0,B.jsx)(`pre`,{className:`mt-2 p-3 bg-[var(--color-surface-0)] border border-[var(--color-line-0)] rounded-sm text-[11px] text-[var(--color-fg-2)] overflow-x-auto whitespace-pre-wrap break-words font-mono`,children:e.content})]})]})]})},e.file)})})]})}var As=[``,`allow`,`block`,`force`,`ask`,`log`],js=[``,`claude-code`,`gemini`,`antigravity`,`cursor`,`copilot`,`codex`,`pi`,`generic`],Ms=50;function Ns(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(Ms),u=je([`activity-updated`]),d=new URLSearchParams;e&&d.set(`decision`,e),n&&d.set(`tool`,n),i&&d.set(`client`,i);let{data:f,loading:p,error:m}=F(`/api/state/activity${d.size?`?`+d:``}`,[u[`activity-updated`],e,n,i]),h=e=>t=>{e(t.target.value),l(Ms)},g=(0,_.useMemo)(()=>{if(!f)return[];let e=o.trim().toLowerCase();return e?f.filter(t=>t.tool.toLowerCase().includes(e)||t.decision.toLowerCase().includes(e)||(t.rule_id??``).toLowerCase().includes(e)||(t.client??``).toLowerCase().includes(e)||(t.source_file??``).toLowerCase().includes(e)||t.input.toLowerCase().includes(e)):f},[f,o]),v=g.slice(0,c),y=g.length>c,b=f?.length??0,x=g.length,S=`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] font-mono rounded-sm px-2 py-1.5 focus:outline-none focus:border-[var(--color-brand)]/50 cursor-pointer`;return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`overline text-[11px]`,children:`audit log`}),f&&(0,B.jsx)(`p`,{className:`font-mono text-[11px] text-[var(--color-fg-3)] mt-1 tabular-nums`,children:o&&x!==b?`${x}/${b} events match`:`${b} events`})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`select`,{id:`audit-filter-decision`,value:e,onChange:h(t),className:S,children:As.map(e=>(0,B.jsx)(`option`,{value:e,children:e||`all decisions`},e))}),(0,B.jsx)(`select`,{id:`audit-filter-client`,value:i,onChange:h(a),className:S,children:js.map(e=>(0,B.jsx)(`option`,{value:e,children:e||`all clients`},e))}),(0,B.jsx)(`input`,{id:`audit-filter-tool`,type:`text`,placeholder:`filter by tool…`,value:n,onChange:h(r),className:`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] font-mono rounded-sm px-2.5 py-1.5 w-36 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)]`})]})]}),(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsxs)(`svg`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-fg-4)] pointer-events-none`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,B.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,B.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,B.jsx)(`input`,{id:`audit-search`,type:`text`,placeholder:`search tool, command, path, rule id, input fields…`,value:o,onChange:e=>{s(e.target.value),l(Ms)},className:`w-full bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-sm rounded-sm pl-9 pr-10 py-2.5 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono transition-colors`}),o&&(0,B.jsx)(`button`,{onClick:()=>{s(``),l(Ms)},className:`absolute right-3 top-1/2 -translate-y-1/2 text-[var(--color-fg-4)] hover:text-[var(--color-fg-1)] transition-colors cursor-pointer`,title:`Clear search`,children:(0,B.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,B.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,B.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),f&&f.length>0&&(0,B.jsxs)(`div`,{className:`flex items-center gap-3 px-3 font-mono text-[10px] uppercase tracking-widest text-[var(--color-fg-4)] select-none`,children:[(0,B.jsx)(`span`,{className:`w-3`}),(0,B.jsx)(`span`,{className:`w-14`,children:`time`}),(0,B.jsx)(`span`,{className:`w-14`,children:`decision`}),(0,B.jsx)(`span`,{className:`w-28`,children:`tool`}),(0,B.jsx)(`span`,{className:`flex-1`,children:`preview`}),(0,B.jsx)(`span`,{children:`client`})]}),m&&(0,B.jsxs)(`p`,{className:`text-sm text-red-300 font-mono`,children:[`failed to load audit log: `,m]}),p&&!f&&(0,B.jsx)(`div`,{className:`space-y-1.5`,children:Array.from({length:10}).map((e,t)=>(0,B.jsx)(`div`,{className:`h-9 bg-[var(--color-surface-1)] rounded-sm border border-[var(--color-line-0)] border-l-2 border-l-[var(--color-line-2)] shimmer`},t))}),!p&&!m&&g.length===0&&(0,B.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] py-16 flex flex-col items-center justify-center text-center`,children:[(0,B.jsxs)(`svg`,{className:`text-[var(--color-fg-4)] mb-3`,width:`32`,height:`32`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,B.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,B.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,B.jsx)(`p`,{className:`text-xs font-mono text-[var(--color-fg-3)] uppercase tracking-wider`,children:o?`no events match your search`:`no audit entries yet`}),o&&(0,B.jsx)(`button`,{onClick:()=>s(``),className:`mt-3 text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline cursor-pointer`,children:`clear search`})]}),v.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`space-y-1.5`,children:v.map(e=>(0,B.jsx)(Yo,{row:e},e.id))}),y&&(0,B.jsxs)(`div`,{className:`flex items-center justify-center gap-4 pt-2`,children:[(0,B.jsxs)(`button`,{onClick:()=>l(e=>e+Ms),className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-2)] hover:text-[var(--color-fg-0)] border border-[var(--color-line-1)] hover:border-[var(--color-line-2)] rounded-sm px-4 py-1.5 transition-colors cursor-pointer`,children:[`show`,` `,Math.min(Ms,g.length-c),` more`]}),(0,B.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:[c,` / `,g.length]})]})]})]})}var Ps={allow:`green`,block:`red`,force:`amber`,ask:`blue`,log:`gray`},Fs=[`all`,`allow`,`block`,`force`,`log`],Is={allow:`text-emerald-300`,block:`text-red-300`,force:`text-amber-300`,log:`text-[var(--color-fg-3)]`};function Ls(e){return new Date(e*1e3).toLocaleString()}function Rs(e,t){if(!t)return``;let n=t-e;return n<60?`${n}s`:`${Math.round(n/60)}m`}async function zs(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:Ae()})}function Bs(e){try{let t=JSON.parse(e).input;return t&&typeof t==`object`?ur(``,JSON.stringify(t)):ur(``,e)}catch{return e.slice(0,80)}}function Vs(e){try{let t=JSON.parse(e);return t.input===void 0?JSON.stringify(JSON.parse(e),null,2):JSON.stringify(t.input,null,2)}catch{return e}}function Hs({label:e,value:t,tone:n}){return(0,B.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,B.jsx)(`span`,{className:`font-mono text-sm tabular-nums ${n??`text-[var(--color-fg-0)]`}`,children:t}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-[var(--color-fg-3)]`,children:e})]})}function Us(){let e=je([`pending-changed`]),{data:t,refetch:n}=F(`/api/json/pending`,[e[`pending-changed`]]),{data:r}=F(`/api/json/approvals`,[e[`pending-changed`]]),[i,a]=(0,_.useState)(`all`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(new Set),u=Math.floor(Date.now()/1e3),d=(r??[]).filter(e=>e.created_at>=u-86400).length,f=(r??[]).reduce((e,t)=>(e[t.decision]=(e[t.decision]??0)+1,e),{}),p=(r??[]).filter(e=>{if(i!==`all`&&e.decision!==i)return!1;if(o){let t=o.toLowerCase(),n=Bs(e.input).toLowerCase();if(!e.tool.toLowerCase().includes(t)&&!e.rule_id.toLowerCase().includes(t)&&!(e.rule_message??``).toLowerCase().includes(t)&&!n.includes(t))return!1}return!0});function m(e){l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`overline text-[11px]`,children:`approvals`}),(0,B.jsx)(`p`,{className:`text-xs text-[var(--color-fg-3)] mt-1 font-mono`,children:`approve or deny pending tool calls · review past decisions`})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5 px-3 py-2.5 rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)]/60`,children:[(0,B.jsx)(Hs,{label:`pending`,value:t?.length??0,tone:`text-amber-300`}),(0,B.jsx)(`span`,{className:`text-[var(--color-line-2)]`,children:`|`}),[`allow`,`block`,`force`,`log`].map(e=>(0,B.jsx)(Hs,{label:e,value:f[e]??0,tone:Is[e]},e)),(0,B.jsx)(`span`,{className:`text-[var(--color-line-2)]`,children:`|`}),(0,B.jsx)(Hs,{label:`last 24h`,value:d})]}),t&&t.length>0&&(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,B.jsxs)(`h2`,{className:`overline text-[11px]`,children:[`pending · `,t.length]})}),(0,B.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,B.jsxs)(V,{className:`border-l-2 border-l-amber-400/60`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(W,{size:`sm`,variant:`primary`,onClick:async()=>{await zs(e.id,`allow`),n()},children:`approve`}),(0,B.jsx)(W,{size:`sm`,variant:`danger`,onClick:async()=>{await zs(e.id,`block`),n()},children:`deny`})]})]}),(0,B.jsxs)(U,{className:`space-y-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex gap-3 flex-wrap items-center`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`tool`}),(0,B.jsx)(`code`,{className:`text-[var(--color-brand)] font-mono`,children:e.toolCall.tool}),(0,B.jsx)(`span`,{className:`overline ml-2`,children:`rule`}),(0,B.jsx)(`span`,{className:`font-mono text-[var(--color-fg-2)]`,children:e.ruleId})]}),e.prompt&&(0,B.jsxs)(`div`,{className:`flex gap-2 items-start`,children:[(0,B.jsx)(`span`,{className:`overline pt-0.5 shrink-0`,children:`why`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.prompt})]}),(0,B.jsx)(Xo,{children:JSON.stringify(e.toolCall.input,null,2)})]})]},e.id))})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-3 gap-3 flex-wrap`,children:[(0,B.jsx)(`h2`,{className:`overline text-[11px]`,children:`history`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,B.jsx)(`div`,{className:`flex gap-0.5 rounded-sm border border-[var(--color-line-1)] p-0.5 bg-[var(--color-surface-1)]`,children:Fs.map(e=>(0,B.jsx)(`button`,{onClick:()=>a(e),className:`px-2 py-0.5 rounded-sm text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer ${i===e?`bg-[var(--color-brand)]/10 text-[var(--color-brand)] border border-[var(--color-brand)]/30`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] border border-transparent`}`,children:e},e))}),(0,B.jsx)(`input`,{type:`text`,placeholder:`search tool, rule, command…`,value:o,onChange:e=>s(e.target.value),className:`text-xs font-mono bg-[var(--color-surface-1)] border border-[var(--color-line-1)] rounded-sm px-2.5 py-1 text-[var(--color-fg-1)] placeholder-[var(--color-fg-4)] focus:outline-none focus:border-[var(--color-brand)]/50 w-48`})]})]}),!r||r.length===0?(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:`no approval history yet`}):p.length===0?(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:`no results match your filter`}):(0,B.jsx)(V,{children:(0,B.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:p.map(e=>{let t=c.has(e.id),n=Bs(e.input),r=Rs(e.created_at,e.resolved_at);return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{onClick:()=>m(e.id),className:`w-full text-left px-3 py-2 flex items-center gap-3 hover:bg-[var(--color-surface-2)]/60 transition-colors cursor-pointer`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-[10px] w-2.5 shrink-0`,children:t?`▼`:`▶`}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] whitespace-nowrap shrink-0 w-36 tabular-nums`,children:Ls(e.resolved_at??e.created_at)}),(0,B.jsx)(`span`,{className:`shrink-0`,children:(0,B.jsx)(mr,{variant:Ps[e.decision]??`gray`,children:e.decision})}),(0,B.jsx)(`code`,{className:`text-xs text-[var(--color-brand)] shrink-0 font-mono`,children:e.tool}),(0,B.jsx)(`span`,{className:`text-xs text-[var(--color-fg-2)] truncate flex-1 min-w-0`,children:e.rule_message||e.rule_id||`—`}),n&&(0,B.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)] font-mono truncate max-w-[180px] shrink-0 hidden md:block`,children:n}),r&&(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] shrink-0`,children:[`Δ`,r]})]}),t&&(0,B.jsxs)(`div`,{className:`px-3 pb-3 pt-1 space-y-2 bg-[var(--color-surface-0)]`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs font-mono`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`rule`}),` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.rule_id||`—`})]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`created`}),` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Ls(e.created_at)})]}),e.resolved_at&&(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`resolved`}),` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Ls(e.resolved_at)})]})]}),e.prompt&&(0,B.jsxs)(`div`,{className:`text-xs flex gap-2 items-start`,children:[(0,B.jsx)(`span`,{className:`overline pt-0.5 shrink-0`,children:`why`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.prompt})]}),(0,B.jsx)(Xo,{children:Vs(e.input)})]})]},e.id)})})})]})]})}function Ws(){let{data:e,refetch:t}=F(`/api/json/inspector-targets`),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(1),u=(0,_.useRef)(new Map),d=(0,_.useRef)(new Map),f=(0,_.useCallback)(()=>{let e=c.current;if(c.current=null,e)try{e.close()}catch{}r(!1),a(!1),s(null)},[]),p=(0,_.useCallback)(e=>{c.current&&f(),a(!0),s(null);let t=new WebSocket(`/ws/inspector?target=${encodeURIComponent(e)}`);c.current=t,t.onopen=()=>{r(!0),a(!1),s(null)},t.onclose=()=>{c.current=null,r(!1),a(!1)},t.onerror=()=>{a(!1),s(`Connection failed — is the inspector running with the correct target ID?`)},t.onmessage=e=>{try{let t=JSON.parse(e.data);if(t.id!=null){let e=u.current.get(t.id);e&&(u.current.delete(t.id),e(t.result))}else if(t.method){let e=d.current.get(t.method);if(e)for(let n of e)n(t.params)}}catch{}}},[f]),m=(0,_.useCallback)((e,t)=>new Promise((n,r)=>{let i=c.current;if(!i||i.readyState!==WebSocket.OPEN){r(Error(`Not connected`));return}let a=l.current++;u.current.set(a,e=>n(e)),i.send(JSON.stringify({id:a,method:e,params:t})),setTimeout(()=>{u.current.has(a)&&(u.current.delete(a),r(Error(`Command timed out`)))},1e4)}),[]),h=(0,_.useCallback)((e,t)=>{let n=d.current.get(e);return n||(n=new Set,d.current.set(e,n)),n.add(t),()=>{d.current.get(e)?.delete(t)}},[]),g=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{e?.active&&e?.target&&!n&&!i&&!g.current&&(g.current=!0,p(e.target.id))},[e?.active,e?.target?.id,n,i,p]),(0,_.useEffect)(()=>()=>{f()},[f]),{active:e?.active??!1,bunVersion:e?.version?.[`Bun-Version`]??null,preconfiguredTarget:e?.target??null,connected:n,connecting:i,error:o,connect:p,disconnect:f,sendCommand:m,onEvent:h,refetch:t}}var Gs=18,Ks=5e-4;function qs(e,t){return t===`(garbage collector)`||t===`(idle)`?`#450a0a`:e?e.startsWith(`node:`)||e.startsWith(`bun:`)?`#172554`:e.startsWith(`file:`)||e.startsWith(`/`)||e.includes(`.ts`)||e.includes(`.js`)?`#451a03`:`#1f2937`:`#1f2937`}function Js(e,t){return t===`(garbage collector)`||t===`(idle)`?`#fca5a5`:e?e.startsWith(`node:`)||e.startsWith(`bun:`)?`#93c5fd`:e.startsWith(`file:`)||e.startsWith(`/`)||e.includes(`.ts`)||e.includes(`.js`)?`#fbbf24`:`#6b7280`:`#6b7280`}function Ys(e,t){let n=new Map;for(let t of e.nodes)n.set(t.id,t);let r=new Map;function i(e){let t=n.get(e);if(!t)return 0;let a=t.hitCount??0;for(let e of t.children??[])a+=i(e);return r.set(e,a),a}let a=e.nodes[0];if(!a)return[];i(a.id);let o=t??a.id,s=r.get(o)??0;if(s===0)return[];let c=[];function l(e,t,i){let a=n.get(e);if(!a)return;let o=r.get(e)??0,u=o/s;if(u<Ks)return;c.push({x:i,width:u,depth:t,node:a,subtreeHits:o});let d=i;for(let e of a.children??[]){let n=(r.get(e)??0)/s;l(e,t+1,d),d+=n}}return l(o,0,0),c}function Xs(e){return e<1e3?`${e}µs`:e<1e6?`${(e/1e3).toFixed(1)}ms`:`${(e/1e6).toFixed(2)}s`}function Zs({profile:e}){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(800),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null);(0,_.useEffect)(()=>{let e=t.current;if(!e)return;let n=new ResizeObserver(e=>{let t=e[0]?.contentRect.width;t&&r(t)});return n.observe(e),r(e.clientWidth||800),()=>n.disconnect()},[]);let c=Ys(e,i),l=(c.reduce((e,t)=>Math.max(e,t.depth),0)+1)*Gs+4,u=e.endTime-e.startTime,d=(0,_.useCallback)(e=>{a(t=>t===e.node.id?null:e.node.id),s(null)},[]);return c.length===0?(0,B.jsx)(`p`,{className:`text-xs text-[#555] py-2`,children:`No samples — profile may be empty.`}):(0,B.jsxs)(`div`,{className:`relative select-none`,children:[i!==null&&(0,B.jsx)(`button`,{onClick:()=>a(null),className:`mb-2 text-xs text-amber-400 hover:underline`,children:`← Reset zoom`}),(0,B.jsx)(`div`,{ref:t,className:`overflow-x-hidden`,children:(0,B.jsx)(`svg`,{width:n,height:l,onMouseLeave:()=>s(null),children:c.map((e,t)=>{let r=e.x*n,a=Math.max(e.width*n,1),o=e.depth*Gs+1,c=e.node.callFrame.functionName||`(anonymous)`,l=e.node.callFrame.url,f=i===e.node.id;return(0,B.jsxs)(`g`,{children:[(0,B.jsx)(`rect`,{x:r,y:o,width:a,height:Gs-1,fill:f?`#92400e`:qs(l,c),stroke:`#080808`,strokeWidth:.5,style:{cursor:`pointer`},onClick:()=>d(e),onMouseMove:t=>s({clientX:t.clientX,clientY:t.clientY,rect:e,totalDuration:u})}),a>24&&(0,B.jsx)(`text`,{x:r+2,y:o+Gs-5,fontSize:9,fill:Js(l,c),style:{pointerEvents:`none`,userSelect:`none`},clipPath:`url(#fc-clip-${t})`,children:c}),a>24&&(0,B.jsx)(`clipPath`,{id:`fc-clip-${t}`,children:(0,B.jsx)(`rect`,{x:r,y:o,width:a,height:Gs})})]},t)})})}),o&&(0,B.jsxs)(`div`,{className:`fixed z-50 bg-[#111] border border-[#2a2a2a] rounded-lg p-2.5 text-xs shadow-xl pointer-events-none`,style:{left:o.clientX+14,top:o.clientY-8,maxWidth:320},children:[(0,B.jsx)(`div`,{className:`font-mono text-amber-400 truncate font-medium`,children:o.rect.node.callFrame.functionName||`(anonymous)`}),o.rect.node.callFrame.url&&(0,B.jsxs)(`div`,{className:`text-[#666] truncate mt-0.5 text-[10px]`,children:[o.rect.node.callFrame.url,`:`,o.rect.node.callFrame.lineNumber]}),(0,B.jsxs)(`div`,{className:`mt-1.5 space-y-0.5 text-[#aaa]`,children:[(0,B.jsxs)(`div`,{children:[`Samples:`,` `,(0,B.jsx)(`span`,{className:`text-white tabular-nums`,children:o.rect.subtreeHits})]}),(0,B.jsxs)(`div`,{children:[`Time share:`,` `,(0,B.jsxs)(`span`,{className:`text-white tabular-nums`,children:[(o.rect.width*100).toFixed(1),`%`]})]}),u>0&&(0,B.jsxs)(`div`,{children:[`Est. duration:`,` `,(0,B.jsx)(`span`,{className:`text-white tabular-nums`,children:Xs(Math.round(o.rect.width*u))})]})]}),o.rect.node.deoptReason&&(0,B.jsxs)(`div`,{className:`text-red-400 mt-1.5 text-[10px]`,children:[`⚠ `,o.rect.node.deoptReason]}),(0,B.jsx)(`div`,{className:`text-[#555] mt-1.5 text-[10px]`,children:`Click to zoom · click again to reset`})]})]})}function Qs(e){return e<1e6?`${(e/1e3).toFixed(0)}µs`:e<1e9?`${(e/1e6).toFixed(1)}ms`:`${(e/1e9).toFixed(2)}s`}function $s(e){return new Date(e*1e3).toLocaleString()}var ec={critical:`red`,high:`red`,medium:`amber`,low:`blue`},tc={critical:`border-l-red-500/70`,high:`border-l-red-500/50`,medium:`border-l-amber-400/60`,low:`border-l-sky-400/50`};function nc(){let{data:e}=F(`/api/json/profile`);if(!e)return(0,B.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading profile…`});let{diagnosis:t,sessions:n}=e;return!t||t.analyzed_evals===0?(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 px-4 py-6 text-center`,children:(0,B.jsxs)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] font-mono`,children:[`no eval data yet — run`,` `,(0,B.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg eval`}),` to start recording`]})}):(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-2`,children:[{label:`evals analyzed`,value:String(t.analyzed_evals)},{label:`median (inside)`,value:Qs(t.median_eval_ns)},{label:`p99 (inside)`,value:Qs(t.p99_eval_ns)},{label:`bottleneck`,value:t.bottleneck??`—`}].map(e=>(0,B.jsx)(ts,{label:e.label,value:e.value,labelPlacement:`above`,valueClassName:`text-xl font-medium tabular-nums text-[var(--color-fg-0)]`},e.label))}),t.phases.length>0&&(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`phase breakdown`})}),(0,B.jsx)(U,{children:(0,B.jsx)(`div`,{className:`space-y-2`,children:t.phases.filter(e=>e.median_ns>0).map(e=>{let n=e.name===t.bottleneck;return(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,B.jsx)(`span`,{className:`w-28 font-mono truncate ${n?`text-[var(--color-brand)] font-medium`:`text-[var(--color-fg-2)]`}`,title:n?`bottleneck`:void 0,children:e.name}),(0,B.jsx)(rs,{pct:Math.min(e.pct_of_total,100),tone:n?`amber`:`gray`,className:`h-1 flex-1`}),(0,B.jsx)(`span`,{className:`w-16 text-right text-[var(--color-fg-1)] tabular-nums font-mono`,children:Qs(e.median_ns)}),(0,B.jsxs)(`span`,{className:`w-10 text-right text-[var(--color-fg-3)] tabular-nums font-mono`,children:[e.pct_of_total,`%`]}),(0,B.jsxs)(`span`,{className:`w-20 text-right text-[var(--color-fg-4)] tabular-nums font-mono text-[10px]`,children:[`p95 `,Qs(e.p95_ns)]})]},e.name)})})})]}),t.recommendations.length>0&&(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsxs)(`span`,{className:`overline`,children:[`recommendations · `,t.recommendations.length]})}),(0,B.jsx)(U,{className:`space-y-2`,children:t.recommendations.map((e,t)=>(0,B.jsxs)(`div`,{className:`border border-[var(--color-line-1)] bg-[var(--color-surface-0)] rounded-sm px-3 py-2.5 border-l-2 ${tc[e.severity]??`border-l-[var(--color-line-2)]`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,B.jsx)(mr,{variant:ec[e.severity]??`gray`,children:e.severity}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:e.type})]}),(0,B.jsx)(`p`,{className:`text-sm text-[var(--color-fg-1)] leading-relaxed`,children:e.message}),e.fix_command&&(0,B.jsxs)(`code`,{className:`text-[11px] text-[var(--color-brand)] font-mono mt-1.5 block`,children:[`$ `,e.fix_command]})]},t))})]}),t.anomalies.length>0&&(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsxs)(`span`,{className:`overline`,children:[`anomalies · `,t.anomalies.length]})}),(0,B.jsx)(U,{children:(0,B.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:t.anomalies.map((e,t)=>(0,B.jsxs)(`div`,{className:`py-2 flex items-center gap-4 text-xs font-mono`,children:[(0,B.jsx)(`span`,{className:`w-24 text-[var(--color-brand)] uppercase tracking-wider text-[10px]`,children:e.type}),(0,B.jsxs)(`span`,{className:`w-10 tabular-nums text-[var(--color-fg-1)]`,children:[e.count,`×`]}),(0,B.jsxs)(`span`,{className:`w-20 tabular-nums text-[var(--color-fg-1)]`,children:[e.max_ms,`ms max`]}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:e.likely_cause})]},t))})})]}),n.length>0&&(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`session history`}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[n.length,` session`,n.length===1?``:`s`]})]}),(0,B.jsx)(U,{className:`p-0`,children:(0,B.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:[...n].reverse().map((e,t)=>(0,B.jsxs)(`div`,{className:`px-4 py-2.5 flex flex-wrap items-center gap-x-5 gap-y-1 text-xs ${e.is_current?`bg-amber-400/[0.04] border-l-2 border-l-amber-400/60`:``}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 w-48 shrink-0`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums font-mono`,children:$s(e.start_ts)}),e.is_current&&(0,B.jsx)(mr,{variant:`amber`,children:`current`})]}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums font-mono w-20`,children:[e.evals,` eval`,e.evals===1?``:`s`]}),(0,B.jsxs)(`span`,{className:`text-emerald-300 tabular-nums font-mono`,children:[e.allowed,` allow`]}),e.blocked>0&&(0,B.jsxs)(`span`,{className:`text-red-300 tabular-nums font-mono`,children:[e.blocked,` block (`,e.block_rate_pct,`%)`]}),e.asked>0&&(0,B.jsxs)(`span`,{className:`text-sky-300 tabular-nums font-mono`,children:[e.asked,` ask`]}),e.forced>0&&(0,B.jsxs)(`span`,{className:`text-violet-300 tabular-nums font-mono`,children:[e.forced,` force`]}),e.avg_ns>0&&(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums ml-auto font-mono`,children:[`avg `,Qs(e.avg_ns)]}),e.top_rule&&(0,B.jsxs)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.top_rule)}`,className:`text-[var(--color-fg-4)] hover:text-[var(--color-brand)] font-mono truncate max-w-xs transition-colors w-full pl-48`,title:`most blocked rule: ${e.top_rule}`,children:[`top block: `,e.top_rule]})]},t))})})]})]})}var rc={log:`text-[var(--color-fg-1)]`,info:`text-sky-300`,warn:`text-amber-300`,error:`text-red-300`,debug:`text-[var(--color-fg-3)]`};function ic(e){return e.value==null?e.description?e.description:`[${e.type}]`:String(e.value)}function ac(){let e=Ws(),[t,n]=(0,_.useState)(!1),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(0);(0,_.useEffect)(()=>{d.current?.scrollIntoView({behavior:`smooth`})},[a]),(0,_.useEffect)(()=>{if(e.connected)return e.sendCommand(`Runtime.enable`).catch(()=>{}),e.onEvent(`Runtime.consoleAPICalled`,e=>{let t=e;o(e=>{let n=[...e,{id:f.current++,type:t.type??`log`,args:t.args??[],timestamp:t.timestamp??Date.now()}];return n.length>500?n.slice(-500):n})})},[e.connected]);let p=(0,_.useCallback)(()=>{e.preconfiguredTarget&&e.connect(e.preconfiguredTarget.id)},[e]),m=(0,_.useCallback)(async()=>{try{await e.sendCommand(`Profiler.enable`),await e.sendCommand(`Profiler.start`),n(!0),i(null)}catch(e){console.error(`Profiler.start failed:`,e)}},[e]),h=(0,_.useCallback)(async()=>{try{let t=await e.sendCommand(`Profiler.stop`);n(!1),i(t.profile)}catch(e){console.error(`Profiler.stop failed:`,e),n(!1)}},[e]),g=(0,_.useCallback)(async()=>{u(!0);try{let t=await e.sendCommand(`Runtime.evaluate`,{expression:`JSON.stringify(process.memoryUsage())`,returnByValue:!0});c(JSON.parse(t.result.value))}catch{}finally{u(!1)}},[e]);function v(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}let y=e.connected?`connected${e.bunVersion?` · bun v${e.bunVersion}`:``}`:e.connecting?`connecting…`:e.active?`inspector active, connecting…`:`inspector not available`,b=e.connected?`bg-emerald-400`:e.connecting?`bg-amber-400 pulse-soft`:e.active?`bg-sky-400`:`bg-[var(--color-line-2)]`;return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono text-[var(--color-fg-2)]`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${b}`}),y]}),e.connected?(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:e.disconnect,children:`disconnect`}):(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:e.preconfiguredTarget?p:e.refetch,disabled:e.connecting,children:e.preconfiguredTarget?`reconnect`:`refresh`})]})]}),e.error&&(0,B.jsx)(U,{children:(0,B.jsx)(`p`,{className:`text-xs text-red-300 font-mono`,children:e.error})})]}),e.connected&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`cpu profiler`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&(0,B.jsxs)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300 flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-400 pulse-soft`}),`recording`]}),t?(0,B.jsx)(W,{variant:`danger`,size:`sm`,onClick:h,children:`stop & render`}):(0,B.jsx)(W,{variant:`primary`,size:`sm`,onClick:m,children:`start recording`})]})]}),(0,B.jsx)(U,{children:r?(0,B.jsx)(as,{profile:r,children:(0,B.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 overflow-x-hidden`,children:(0,B.jsx)(Zs,{profile:r})})}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:t?`recording… perform actions in ssg, then stop.`:`click start recording, perform actions, then stop.`})})]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`memory`}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:g,disabled:l,children:l?`…`:`refresh`})]}),(0,B.jsx)(U,{children:s?(0,B.jsx)(os,{memory:s,formatValue:v}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:`click refresh to fetch process.memoryUsage().`})})]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`console`}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o([]),children:`clear`})]}),(0,B.jsx)(U,{children:(0,B.jsxs)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 h-56 overflow-y-auto font-mono text-[11px]`,children:[a.length===0?(0,B.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`console output will appear here…`}):a.map(e=>(0,B.jsxs)(`div`,{className:`py-0.5 border-b border-[var(--color-line-0)] ${rc[e.type]??`text-[var(--color-fg-1)]`}`,children:[(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)] mr-2 uppercase tracking-wider`,children:[`[`,e.type,`]`]}),e.args.map(ic).join(` `)]},e.id)),(0,B.jsx)(`div`,{ref:d})]})})]})]}),!e.connected&&!e.connecting&&(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 px-4 py-6 text-center`,children:(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:e.active?`waiting for inspector connection…`:`inspector auto-starts with ssg serve. profiler, memory, and console appear here once connected.`})})]})}function oc({active:e,onClick:t,children:n}){return(0,B.jsxs)(`button`,{onClick:t,className:`relative px-3 h-9 text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer ${e?`text-[var(--color-fg-0)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`}`,children:[n,e&&(0,B.jsx)(`span`,{className:`absolute inset-x-2 -bottom-px h-px bg-[var(--color-brand)]`})]})}function sc(){let[e,t]=(0,_.useState)(`eval`);return(0,B.jsxs)(`div`,{className:`space-y-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center border-b border-[var(--color-line-0)] mb-5`,children:[(0,B.jsx)(oc,{active:e===`eval`,onClick:()=>t(`eval`),children:`eval profile`}),(0,B.jsx)(oc,{active:e===`inspector`,onClick:()=>t(`inspector`),children:`runtime inspector`})]}),e===`eval`?(0,B.jsx)(nc,{}):(0,B.jsx)(ac,{})]})}function cc(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}var lc=[{value:`downloads`,label:`most downloaded`},{value:`newest`,label:`newest`},{value:`rules`,label:`most rules`}],uc=[``,`critical`,`high`,`medium`,`low`],dc=[``,`deny`,`ask`,`allow`,`log`];function fc(){return(0,B.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)] p-4 space-y-3 shimmer`,children:[(0,B.jsx)(`div`,{className:`h-4 bg-[var(--color-surface-3)] rounded-sm w-2/3`}),(0,B.jsx)(`div`,{className:`h-3 bg-[var(--color-surface-2)] rounded-sm w-1/3`}),(0,B.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,B.jsx)(`div`,{className:`h-5 bg-[var(--color-surface-3)] rounded-sm w-14`}),(0,B.jsx)(`div`,{className:`h-5 bg-[var(--color-surface-3)] rounded-sm w-10`})]}),(0,B.jsx)(`div`,{className:`h-7 bg-[var(--color-surface-3)] rounded-sm`})]})}function pc({tech:e}){return(0,B.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded-sm text-[10px] font-mono uppercase tracking-wider border ${{typescript:`bg-sky-500/8 text-sky-300 border-sky-500/25`,ts:`bg-sky-500/8 text-sky-300 border-sky-500/25`,javascript:`bg-amber-500/8 text-amber-300 border-amber-500/25`,js:`bg-amber-500/8 text-amber-300 border-amber-500/25`,python:`bg-emerald-500/8 text-emerald-300 border-emerald-500/25`,rust:`bg-orange-500/8 text-orange-300 border-orange-500/25`,go:`bg-cyan-500/8 text-cyan-300 border-cyan-500/25`,bash:`bg-violet-500/8 text-violet-300 border-violet-500/25`}[e.toLowerCase()]??`bg-[var(--color-surface-2)] text-[var(--color-fg-3)] border-[var(--color-line-1)]`}`,children:e})}function mc({rs:e,installingId:t,onInstall:n,flashId:r}){let i=t===e.id,a=r===e.id;return(0,B.jsxs)(`div`,{className:`group relative flex flex-col rounded-sm border bg-[var(--color-surface-1)] transition-colors overflow-hidden
|
|
9
|
+
`).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Jt(e,``+r);break;case`className`:Mt(e,`class`,r);break;case`tabIndex`:Mt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Mt(e,n,r);break;case`style`:Zt(e,r,o);break;case`data`:if(t!==`object`){Mt(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=tn(``+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`&&Md(e,t,`name`,a.name,a,null),Md(e,t,`formEncType`,a.formEncType,a,null),Md(e,t,`formMethod`,a.formMethod,a,null),Md(e,t,`formTarget`,a.formTarget,a,null)):(Md(e,t,`encType`,a.encType,a,null),Md(e,t,`method`,a.method,a,null),Md(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=tn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`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=tn(``+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`:$(`beforetoggle`,e),$(`toggle`,e),jt(e,`popover`,r);break;case`xlinkActuate`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:jt(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=$t.get(n)||n,jt(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:Zt(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`?Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Jt(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!wt.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[ut]||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,``):jt(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`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:Md(e,t,o,s,n,null)}}a&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:$(`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:Md(e,t,r,d,n,null)}}Ut(e,o,c,l,u,s,a,!1);return;case`select`:for(a in $(`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:Md(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Gt(e,!!r,n,!0):Gt(e,!!r,t,!1);return;case`textarea`:for(s in $(`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:Md(e,t,s,c,n,null)}qt(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:Md(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<gd.length;r++)$(gd[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`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:Md(e,t,u,r,n,null)}return;default:if(Qt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(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)||Md(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&&Md(e,t,p,m,r,f)}}Ht(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)||Md(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&&Md(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Gt(e,!!n,n?[]:``,!1):Gt(e,!!n,t,!0)):Gt(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:Md(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&&Md(e,t,s,a,r,o)}Kt(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:Md(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:Md(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)&&Md(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:Md(e,t,u,p,r,m)}return;default:if(Qt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(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||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(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||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){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&&Id(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&&Id(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 Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(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 Hd(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 Ud(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 Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e===Wd?!1:(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(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),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[gt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(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 ef(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`:ef(n),_t(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(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[gt])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=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(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 cf(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 lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(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 ff(e,t,n){switch(t=Bd(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 pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);_t(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=A.d;A.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=vu();return e||t}function yf(e){var t=yt(e);t!==null&&t.tag===5&&t.type===`form`?xs(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Vt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),St(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Vt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Vt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Vt(n.imageSizes)+`"]`)):i+=`[href="`+Vt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),St(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Vt(r)+`"][href="`+Vt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),St(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=xt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);St(c),Pd(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,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=xt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),St(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=xt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),St(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=de.current)?gf(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=Af(n.href),n=xt(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=Af(n.href);var o=xt(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(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.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},mf.set(e,n),o||Nf(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=Pf(n),n=xt(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 Af(e){return`href="`+Vt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(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}),Pd(t,`link`,n),St(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Vt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Vt(n.href)+`"]`);if(r)return t.instance=r,St(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),St(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,St(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),St(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,St(a),a):(r=n,(a=mf.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),St(a),Pd(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,Lf(r,n.precedence,e));return t.instance}function Lf(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 Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,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[gt]||a[lt]||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 Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(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 Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(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=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,St(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),St(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(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=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.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=Jf.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 Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function $f(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=Qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qe(0),this.hiddenUpdates=Qe(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 ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ti(3,null,null,t),e.current=a,a.stateNode=e,t=ta(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Pa(a),e}function tp(e){return e?(e=$r,e):$r}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ia(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=La(e,r,t),n!==null&&(pu(n,e,t),Ra(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=G(e,67108864);t!==null&&pu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=du();t=it(t);var n=G(e,t);n!==null&&pu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=2,up(e,t,n,r)}finally{A.p=a,k.T=i}}function lp(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=8,up(e,t,n,r)}finally{A.p=a,k.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=yt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=qe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Be(o);s.entanglements[1]|=c,o&=~c}nd(a),!(Y&6)&&($l=ke()+500,rd(0,!1))}}break;case 31:case 13:s=G(a,2),s!==null&&pu(s,a,2),vu(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=an(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=vt(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 fp=e,null}function mp(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 F:return 8;case Me:case Ne:return 32;case Pe:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`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 Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(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=yt(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=vt(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,st(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,st(e.priority,function(){op(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 Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);rn=r,n.target.dispatchEvent(r),rn=null}else return t=yt(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=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(pp(r||n)===null)continue;break}var a=yt(n);a!==null&&(e.splice(t,3),t-=3,ys(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.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[ut]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[ut]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){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 Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,du(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),vu(),t[dt]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=ot();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.4`)throw Error(i(527,Lp,`19.2.4`));A.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=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:k,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Le=zp.inject(Rp),Re=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Hs,s=Us,c=Ws;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=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[dt]=t.current,xd(e),new Fp(t)}})),g=c(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=h()}))(),1),_=c(u(),1),v=500,y=3e3,b=1e3,x=3e4,S=Object.freeze({counters:Object.freeze({}),latestBurst:null,burstRing:Object.freeze([]),burstSeq:0,connectionSeq:0,connected:!1,reconnectAttempts:0,lastErrorAt:null,reconnectDelayMs:b}),C=new Set,w={},T=[],E=!1,ee=!1,D=null,te=null,ne=null,O=!1,re=typeof localStorage<`u`&&localStorage.getItem(`DEBUG_SSE`)===`1`;function ie(e,t){re&&(t?console.debug(`[ssg-sse] ${e}`,t):console.debug(`[ssg-sse] ${e}`))}function ae(){O||(O=!0,queueMicrotask(oe))}function oe(){O=!1;let e=Object.keys(w),t=T,n=E,r=D!==null||te!==null||ne!==null;if(e.length===0&&t.length===0&&!n&&!r)return;let i=S.counters;if(e.length>0){let t={...S.counters};for(let n of e)t[n]=(t[n]??0)+(w[n]??0);i=Object.freeze(t),w={}}let a=S.burstRing,o=S.latestBurst,s=S.burstSeq;if(t.length>0){let e=S.burstRing.length+t.length>v?[...S.burstRing,...t].slice(-v):[...S.burstRing,...t];a=Object.freeze(e),o=t[t.length-1]??o,s=S.burstSeq+t.length,T=[]}let c=S.connected,l=S.connectionSeq;n&&(c=ee,l=S.connectionSeq+1,E=!1);let u=S.reconnectAttempts,d=S.lastErrorAt,f=S.reconnectDelayMs;D!==null&&(u=D,D=null),te!==null&&(d=te,te=null),ne!==null&&(f=ne,ne=null),S=Object.freeze({counters:i,latestBurst:o,burstRing:a,burstSeq:s,connectionSeq:l,connected:c,reconnectAttempts:u,lastErrorAt:d,reconnectDelayMs:f});for(let e of C)e()}var k=null,A=0,se=new Set,ce=new Map,le=null,j=b,M=null;function N(e,t){if(e===`eval-burst`){try{let e=JSON.parse(t.data);Array.isArray(e?.bursts)&&(T.push(...e.bursts),ae())}catch{}return}w[e]=(w[e]??0)+1,ae()}function ue(e){if(!k||ce.has(e))return;let t=t=>N(e,t);k.addEventListener(e,t),ce.set(e,t)}var P=0,de=0,fe=2e3;function pe(){if(k)return;ie(`opening EventSource`,{url:`/api/events`}),de=Date.now();let e=new EventSource(`/api/events`);k=e,ce.clear();for(let e of se)ue(e);e.onopen=()=>{let e=S.lastErrorAt!==null;j=b,P=0,D=0,ne=b,E=!0,ee=!0,ae(),e&&Ce(`reconnect`),ie(`connected`)},e.onerror=()=>{e.close(),k=null,ce.clear(),E=!0,ee=!1,te=Date.now(),ae(),P===0&&Date.now()-de<fe?ie(`first-open interrupted (page-load race) — reconnect in ${j}ms`):console.warn(`[ssg-sse] EventSource error — reconnect in ${j}ms (attempt ${P+1})`),A>0&&(le=setTimeout(()=>{le=null,A>0&&pe()},j),P++,D=P,j=Math.min(j*2,x),ne=j,ae())}}function me(){le&&=(clearTimeout(le),null),k?.close(),k=null,ce.clear(),j=b,P=0,D=0,ne=b,E=!0,ee=!1,ae()}typeof document<`u`&&document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&A!==0&&(k||(le&&=(clearTimeout(le),null),ie(`visibilitychange → reconnecting`),pe()))});function he(){for(let e of se)e!==`eval-burst`&&(w[e]=(w[e]??0)+1);ae()}function ge(e){return C.add(e),()=>{C.delete(e)}}function _e(){return S}var ve=200,ye=1e4;function be(){let e=new Date;return e.setHours(0,0,0,0),e.getTime()}var xe=0,Se=null;function Ce(e){let t=Date.now();if(t-xe<ye){ie(`hydrate skipped (cooldown)`,{reason:e});return}if(Se)return;let n=S.burstRing.length>0?S.burstRing[S.burstRing.length-1].ts_ms+1:be(),r=e===`reconnect`?n:be(),i=t;if(r>=i)return;xe=t;let a=new AbortController;Se=a,ie(`hydrate start`,{reason:e,since:r,until:i,ringLen:S.burstRing.length}),fetch(`/api/json/graph/backfill?since_ms=${r}&until_ms=${i}&limit=${ve}`,{signal:a.signal,credentials:`same-origin`}).then(e=>e.ok?e.json():null).then(t=>{if(!t||!Array.isArray(t.bursts)||t.bursts.length===0){ie(`hydrate empty`,{reason:e});return}T.push(...t.bursts),ae(),ie(`hydrate merged`,{reason:e,count:t.bursts.length})}).catch(t=>{t.name!==`AbortError`&&console.warn(`[ssg-sse] ring hydration failed (${e})`,t)}).finally(()=>{Se=null})}function we(e){for(let t of e)se.add(t),ue(t);return A++,A===1&&(Ce(`initial`),pe(),M=setInterval(he,y)),()=>{A--,A===0&&(me(),M&&=(clearInterval(M),null))}}var Te=Object.freeze([`eval-burst`,`counters-updated`]);function Ee(){(0,_.useEffect)(()=>we(Te),[])}function De(){return Ee(),(0,_.useSyncExternalStore)(ge,_e).latestBurst}function Oe(){return Ee(),(0,_.useSyncExternalStore)(ge,_e).burstRing}function ke(){return Ee(),(0,_.useSyncExternalStore)(ge,_e).burstSeq}function Ae(){let e=document.querySelector(`meta[name="ssg-csrf"]`)?.content??``;return e?{"X-SigmaShake-Token":e}:{}}function je(e){let t=(0,_.useSyncExternalStore)(ge,_e),n=e.join(`,`);(0,_.useEffect)(()=>we(e),[n]);let r=(0,_.useRef)({});return(0,_.useMemo)(()=>{let n={},i=!1;for(let a of e){let e=t.counters[a]??0;n[a]=e,r.current[a]!==e&&(i=!0)}return!i&&Object.keys(r.current).length===e.length?r.current:(r.current=n,n)},[t,n])}function F(e,t=[]){let[n,r]=(0,_.useState)({data:null,loading:!0,error:null}),[i,a]=(0,_.useState)(0),o=(0,_.useRef)(null),s=(0,_.useCallback)(()=>{a(e=>e+1)},[]);return(0,_.useEffect)(()=>{let t=new AbortController;return o.current=t,r(e=>({...e,loading:!0,error:null})),fetch(e,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{t.signal.aborted||r({data:e,loading:!1,error:null})}).catch(e=>{if(t.signal.aborted)return;let n=e instanceof Error?e.message:String(e);r(e=>({...e,loading:!1,error:n}))}),()=>{t.abort()}},[e,i,...t]),{...n,refetch:s}}var Me=e=>e,Ne=e=>({in:t=>t**+e,out:t=>1-(1-t)**e,inOut:t=>t<.5?(2*t)**e/2:1-(-2*t+2)**e/2}),Pe=Ne(2),Fe=Ne(3),Ie=Ne(4),Le=Ne(5),Re={in:e=>1-Math.cos(e*Math.PI/2),out:e=>Math.sin(e*Math.PI/2),inOut:e=>-(Math.cos(Math.PI*e)-1)/2},ze={in:e=>e===0?0:2**(10*e-10),out:e=>e===1?1:1-2**(-10*e),inOut:e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2},Be={in:e=>1-Math.sqrt(1-e**2),out:e=>Math.sqrt(1-(e-1)**2),inOut:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2};function Ve(e=1.70158){let t=e;return e=>e*e*((t+1)*e-t)}function He(e=1.70158){let t=e;return e=>{let n=e-1;return n*n*((t+1)*n+t)+1}}function Ue(e=1.70158){let t=e*1.525;return e=>e<.5?(2*e)**2*((t+1)*2*e-t)/2:((2*e-2)**2*((t+1)*(e*2-2)+t)+2)/2}function We(e=1,t=.3){let n=Math.max(e,1),r=Math.max(t,.08),i=r/(Math.PI*2)*Math.asin(1/n);return e=>e===0?0:e===1?1:n*2**(-10*e)*Math.sin((e-i)*(Math.PI*2)/r)+1}function Ge(e=1,t=.3){let n=Math.max(e,1),r=Math.max(t,.08),i=r/(Math.PI*2)*Math.asin(1/n);return e=>e===0?0:e===1?1:-(n*2**(10*(e-1))*Math.sin((e-1-i)*(Math.PI*2)/r))}function Ke(e=1,t=.45){let n=Math.max(e,1),r=Math.max(t,.08),i=r/(Math.PI*2)*Math.asin(1/n);return e=>{if(e===0)return 0;if(e===1)return 1;let t=e*2;return t<1?-.5*(n*2**(10*(t-1))*Math.sin((t-1-i)*(Math.PI*2)/r)):n*2**(-10*(t-1))*Math.sin((t-1-i)*(Math.PI*2)/r)*.5+1}}var qe=7.5625,Je=2.75,Ye=e=>{if(e<1/Je)return qe*e*e;if(e<2/Je){let t=e-1.5/Je;return qe*t*t+.75}if(e<2.5/Je){let t=e-2.25/Je;return qe*t*t+.9375}let t=e-2.625/Je;return qe*t*t+.984375},Xe=e=>1-Ye(1-e),Ze=e=>e<.5?(1-Ye(1-2*e))/2:(1+Ye(2*e-1))/2;function Qe(e){let t=Math.max(1,Math.floor(e));return e=>e>=1?1:e<=0?0:Math.floor(e*t)/t}function $e(e,t,n,r){let i=3*e,a=3*(n-e)-i,o=1-i-a,s=3*t,c=3*(r-t)-s,l=1-s-c,u=e=>((o*e+a)*e+i)*e,d=e=>((l*e+c)*e+s)*e,f=e=>(3*o*e+2*a)*e+i,p=e=>{let t=e;for(let n=0;n<8;n++){let n=u(t)-e;if(Math.abs(n)<1e-5)return t;let r=f(t);if(Math.abs(r)<1e-6)break;t-=n/r}let n=0,r=1;for(t=e;n<r;){let i=u(t);if(Math.abs(i-e)<1e-5)return t;e>i?n=t:r=t,t=(n+r)/2}return t};return e=>e<=0?0:e>=1?1:d(p(e))}function et(e={}){let t=Math.max(1,e.stiffness??100),n=Math.max(0,e.damping??10),r=Math.max(.01,e.mass??1),i=e.velocity??0,a=Math.sqrt(t/r),o=n/(2*Math.sqrt(t*r)),s;if(o<1){let e=a*Math.sqrt(1-o*o),t=(o*a+-i)/e;s=n=>1-Math.exp(-o*a*n)*(1*Math.cos(e*n)+t*Math.sin(e*n))}else if(o===1){let e=a+-i;s=t=>1-Math.exp(-a*t)*(1+e*t)}else{let e=Math.sqrt(o*o-1),t=-a*(o-e),n=-a*(o+e),r=(n- -i)/(n-t),c=1-r;s=e=>1-(r*Math.exp(t*e)+c*Math.exp(n*e))}let c=400;for(let e=16;e<=4e3;e+=16){let t=s(e/1e3);if(Math.abs(1-t)<.005){let t=s((e-16)/1e3);if(Math.abs(1-t)<.005){c=e;break}}c=e}let l=c/1e3;return{duration:c,fn:e=>s(Math.max(0,Math.min(1,e))*l)}}var tt={linear:Me,inQuad:Pe.in,outQuad:Pe.out,inOutQuad:Pe.inOut,inCubic:Fe.in,outCubic:Fe.out,inOutCubic:Fe.inOut,inQuart:Ie.in,outQuart:Ie.out,inOutQuart:Ie.inOut,inQuint:Le.in,outQuint:Le.out,inOutQuint:Le.inOut,inSine:Re.in,outSine:Re.out,inOutSine:Re.inOut,inExpo:ze.in,outExpo:ze.out,inOutExpo:ze.inOut,inCirc:Be.in,outCirc:Be.out,inOutCirc:Be.inOut,inBack:Ve(),outBack:He(),inOutBack:Ue(),inElastic:Ge(),outElastic:We(),inOutElastic:Ke(),inBounce:Xe,outBounce:Ye,inOutBounce:Ze};function nt(e){if(typeof e==`function`)return e;if(e===void 0)return tt.outCubic;let t=tt[e];if(t)return t;let n=e.match(/^(\w+)\(([^)]*)\)$/);if(n){let e=n[1],t=n[2].split(`,`).map(e=>parseFloat(e.trim())).filter(e=>!Number.isNaN(e));switch(e){case`outElastic`:return We(t[0],t[1]);case`inElastic`:return Ge(t[0],t[1]);case`inOutElastic`:return Ke(t[0],t[1]);case`outBack`:return He(t[0]);case`inBack`:return Ve(t[0]);case`inOutBack`:return Ue(t[0]);case`steps`:return Qe(t[0]??4);case`cubicBezier`:return t.length>=4?$e(t[0],t[1],t[2],t[3]):tt.outCubic;default:return tt.outCubic}}return tt.outCubic}function rt(e,t){if(t<=1||e===void 0||e===`first`)return 0;if(e===`last`)return t-1;if(e===`center`)return(t-1)/2;let n=Math.floor(e);return n<0?0:n>t-1?t-1:n}function it(e,t={}){let n=t.start??0,r=t.direction===`reverse`;return(i,a)=>{if(a<=0)return n;let o=rt(t.from,a),s=Math.abs(i-o),c=Math.max(o,a-1-o),l=c===0?0:s/c,u=r?1-l:l,d;if(Array.isArray(e)){let[t,n]=e;d=t+u*(n-t)}else d=(r?c-s:s)*e;return n+d}}var at=new Set,ot=0;function st(){ot===0&&(typeof requestAnimationFrame>`u`||(ot=requestAnimationFrame(ct)))}function ct(e){for(let t of at){let n=t.state;if(!(!n.playing||n.completed)){if(n.lastFrame<0?n.deltaTime=0:n.deltaTime=Math.max(0,e-n.lastFrame),n.lastFrame=e,n.currentTime=Math.max(0,e-n.playStartAt),n.duration>0)for(;n.currentTime>=n.duration;){let e=n.loop===!0?1/0:typeof n.loop==`number`?Math.max(1,n.loop):1;if(n.iterationCount+1>=e){n.currentTime=n.duration,n.completed=!0,n.playing=!1,n.onUpdate?.(t.self),n.onComplete?.(t.self);break}n.currentTime-=n.duration,n.playStartAt+=n.duration,n.iterationCount+=1,n.onLoop?.(t.self)}n.completed||n.onUpdate?.(t.self)}}for(let e of[...at])e.state.completed&&at.delete(e);if(at.size===0){ot=0;return}ot=requestAnimationFrame(ct)}function lt(e={}){let t={duration:e.duration??0,loop:e.loop??!1,onUpdate:e.onUpdate,onComplete:e.onComplete,onLoop:e.onLoop,currentTime:0,deltaTime:0,iterationCount:0,completed:!1,playing:!1,lastFrame:-1,playStartAt:-1},n={play(){if(!(t.completed||t.playing)){if(pt()){t.playing=!0,t.lastFrame=-1,t.onUpdate?.(n),t.duration>0&&t.loop===!1?(t.currentTime=t.duration,t.completed=!0,t.playing=!1,t.onUpdate?.(n),t.onComplete?.(n)):t.playing=!1;return}t.playing=!0,t.playStartAt=(typeof performance<`u`?performance.now():Date.now())-t.currentTime,t.lastFrame=-1,at.add({state:t,self:n}),st()}},pause(){t.playing&&(t.playing=!1,t.lastFrame=-1)},cancel(){t.playing=!1,t.completed=!0,t.lastFrame=-1;for(let e of at)if(e.state===t){at.delete(e);break}},seek(e){if(t.completed)return;let n=t.duration>0?Math.max(0,Math.min(t.duration,e)):Math.max(0,e);t.currentTime=n,t.playStartAt=(typeof performance<`u`?performance.now():Date.now())-n,t.lastFrame=-1},get currentTime(){return t.currentTime},get deltaTime(){return t.deltaTime},get iterationCount(){return t.iterationCount},get progress(){return t.duration>0?Math.max(0,Math.min(1,t.currentTime/t.duration)):NaN},get completed(){return t.completed},get playing(){return t.playing}};return e.autoplay!==!1&&n.play(),n}var ut=new Set([`duration`,`delay`,`ease`,`loop`,`alternate`,`onBegin`,`onUpdate`,`onComplete`]);function dt(e){if(typeof e==`number`||typeof e==`string`)return e;if(Array.isArray(e)&&e.length===2){let[t,n]=e;if((typeof t==`number`||typeof t==`string`)&&(typeof n==`number`||typeof n==`string`))return[t,n]}return null}function ft(e){return e?typeof e==`string`?typeof document>`u`?[]:Array.from(document.querySelectorAll(e)):e instanceof Element?[e]:`length`in e?Array.from(e):[]:[]}function pt(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var mt=/^(-?\d*\.?\d+)([a-z%]*)$/i;function ht(e){if(typeof e==`number`)return{value:e,unit:``};let t=e.trim().match(mt);return t?{value:parseFloat(t[1]),unit:t[2]??``}:{value:0,unit:``}}function gt(e){return e.unit===``?`${e.value}`:`${e.value}${e.unit}`}var _t=new Set([`translate`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`]),vt=new WeakMap;function yt(e){let t=vt.get(e);return t||(t={values:{}},vt.set(e,t)),t}function bt(e){let t=[];for(let[n,r]of Object.entries(e.values)){let e=r.unit||(n.startsWith(`rotate`)||n.startsWith(`skew`)?`deg`:n.startsWith(`translate`)?`px`:``);t.push(`${n}(${r.value}${e})`)}return t.join(` `)}function xt(e,t,n){if(_t.has(t)){let r=yt(e);r.values[t]=n,e.style.transform=bt(r);return}if(t===`opacity`){e.style.opacity=`${n.value}`;return}e.style.setProperty(t,gt(n))}function St(e,t){return _t.has(t)?yt(e).values[t]||{value:t.startsWith(`scale`)?1:0,unit:``}:ht(e.style.getPropertyValue(t)||(typeof window<`u`?window.getComputedStyle(e).getPropertyValue(t):``)||(t===`opacity`?`1`:`0`))}function Ct(e,t,n){return e+(t-e)*n}function wt(e,t,n){return e===void 0?0:typeof e==`number`?e:e(t,n)}function Tt(e){if(e&&typeof e==`object`&&`spring`in e){let t=et(e.spring);return{ease:t.fn,duration:t.duration}}return{ease:nt(e),duration:null}}var Et=0,Dt=new Set;function Ot(e){for(let t of Dt){if(t.done||e<t.start)continue;let{target:n,options:r}=t,i=e-t.start,a=Math.max(1,n.duration),o=r.loop??!1,s=r.alternate===!0,c=o===!0?1/0:typeof o==`number`?Math.max(1,o):1,l=Math.floor(i/a),u=(i-l*a)/a,d=s&&l%2==1?1-u:u;if(l>=c){for(let e of n.props)xt(n.el,e.name,kt(e.from,e.to,s&&c%2==0?0:1));r.onUpdate?.(1,n.el,n.index),r.onComplete?.(n.el,n.index),t.done=!0;continue}for(let e of n.props){let t=e.ease(Math.max(0,Math.min(1,d)));n.el!==null&&xt(n.el,e.name,kt(e.from,e.to,t))}n.el!==null&&r.onUpdate?.(d,n.el,n.index)}for(let e of[...Dt])e.done&&Dt.delete(e);if(Dt.size===0){Et=0;return}Et=requestAnimationFrame(Ot)}function kt(e,t,n){let r=e.unit||t.unit;return{value:Ct(e.value,t.value,n),unit:r}}function At(){Et===0&&(typeof requestAnimationFrame>`u`||(Et=requestAnimationFrame(Ot)))}function jt(e,t){let n=ft(e),r=n.length,i=Object.keys(t).filter(e=>!ut.has(e)),a=pt(),{ease:o,duration:s}=Tt(t.ease),c=t.duration??s??400,l=[],u=[],d=typeof performance<`u`?performance.now():Date.now(),f=(e,n)=>{let a=[];for(let n of i){let r=t[n];if(r===void 0)continue;let i=dt(r);if(i===null)continue;let s,c;Array.isArray(i)?(s=ht(i[0]),c=ht(i[1])):(s=St(e,n),c=ht(i)),a.push({name:n,from:s,to:c,ease:o})}return{el:e,index:n,props:a,duration:c,delay:wt(t.delay,n,r)}};if(n.length===0)return{cancel:()=>{},finished:Promise.resolve(),get done(){return!0}};let p=!1;for(let e=0;e<n.length;e++){let r=n[e],i=f(r,e),o=d+i.delay;if(t.onBegin?.(r,e),a){for(let e of i.props)xt(r,e.name,e.to);t.onUpdate?.(1,r,e),t.onComplete?.(r,e),u.push(Promise.resolve());continue}for(let e of i.props)xt(r,e.name,e.from);let s={target:i,start:o,options:t,done:!1};l.push(s),Dt.add(s),u.push(new Promise(e=>{let n=t.onComplete,r=(t,r)=>{try{n?.(t,r)}finally{e()}};s.options={...t,onComplete:r}}))}return At(),{cancel(){if(!p){p=!0;for(let e of l)e.done=!0,Dt.delete(e)}},finished:Promise.all(u).then(()=>void 0),get done(){return p||l.every(e=>e.done)}}}function Mt(e={}){let t=(0,_.useRef)(null),n=(0,_.useRef)(!1),r=(0,_.useCallback)(()=>{if(n.current)return;let r=t.current;if(!r)return;let i=r.querySelectorAll(`[data-reveal]`);if(i.length===0)return;if(n.current=!0,pt()){i.forEach(e=>{e.style.opacity=`1`,e.style.transform=``});return}let a=e.staggerMs??40,o=e.maxStaggerMs??320,s=Math.min(a,Math.max(10,o/i.length)),c=e.translateY??14,l=e.durationMs??520,u=e.from??`center`;i.forEach(e=>{e.style.opacity=`0`,e.style.transform=`translateY(${c}px)`,e.style.willChange=`transform, opacity`}),jt(Array.from(i),{opacity:[0,1],translateY:[c,0],duration:l,ease:`outBack(1.2)`,delay:it(s,{from:u}),onComplete:e=>{e.style.willChange=``}})},[e.staggerMs,e.maxStaggerMs,e.durationMs,e.translateY,e.from]);return(0,_.useEffect)(()=>{let n=t.current;if(!n)return;if(typeof IntersectionObserver>`u`){r();return}let i=!1,a=new IntersectionObserver(e=>{for(let t of e)if(t.isIntersecting&&!i){r(),a.disconnect();return}},{threshold:.08});a.observe(n);let o=n.querySelectorAll(`[data-reveal]`);if(!pt()){let t=e.translateY??14;o.forEach(e=>{e.style.opacity=`0`,e.style.transform=`translateY(${t}px)`})}let s=n.getBoundingClientRect();return s.top<(window.innerHeight||document.documentElement.clientHeight)&&s.bottom>0&&(r(),a.disconnect()),()=>{i=!0,a.disconnect()}},[r,e.translateY]),t}function Nt(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Nt(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Pt(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Nt(e))&&(r&&(r+=` `),r+=t);return r}var Ft=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,It=Pt,Lt=(e,t)=>n=>{if(t?.variants==null)return It(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Ft(t)||Ft(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return It(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Rt=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},zt=(e,t)=>({classGroupId:e,validator:t}),Bt=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Vt=`-`,Ht=[],Ut=`arbitrary..`,Wt=e=>{let t=qt(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Kt(e);let n=e.split(Vt);return Gt(n,n[0]===``&&n.length>1?1:0,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Rt(i,t):t:i||Ht}return n[e]||Ht}}},Gt=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Gt(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Vt):e.slice(t).join(Vt),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Kt=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Ut+r:void 0})(),qt=e=>{let{theme:t,classGroups:n}=e;return Jt(n,t)},Jt=(e,t)=>{let n=Bt();for(let r in e){let i=e[r];Yt(i,n,r,t)}return n},Yt=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Xt(i,t,n,r)}},Xt=(e,t,n,r)=>{if(typeof e==`string`){Zt(e,t,n);return}if(typeof e==`function`){Qt(e,t,n,r);return}$t(e,t,n,r)},Zt=(e,t,n)=>{let r=e===``?t:en(t,e);r.classGroupId=n},Qt=(e,t,n,r)=>{if(tn(e)){Yt(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(zt(n,e))},$t=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Yt(o,en(t,a),n,r)}},en=(e,t)=>{let n=e,r=t.split(Vt),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Bt(),n.nextPart.set(t,i)),n=i}return n},tn=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,nn=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},rn=`!`,an=`:`,on=[],sn=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),cn=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===an){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(rn)?(c=s.slice(0,-1),l=!0):s.startsWith(rn)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return sn(t,l,c,u)};if(t){let e=t+an,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):sn(on,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ln=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},un=e=>({cache:nn(e.cacheSize),parseClassName:cn(e),sortModifiers:ln(e),...Wt(e)}),dn=/\s+/,fn=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(dn),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+rn:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},pn=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=mn(n))&&(i&&(i+=` `),i+=r);return i},mn=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=mn(e[r]))&&(n&&(n+=` `),n+=t);return n},hn=(e,...t)=>{let n,r,i,a,o=o=>(n=un(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=fn(e,n);return i(e,a),a};return a=o,(...e)=>a(pn(...e))},gn=[],_n=e=>{let t=t=>t[e]||gn;return t.isThemeGetter=!0,t},vn=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,yn=/^\((?:(\w[\w-]*):)?(.+)\)$/i,bn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,xn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Sn=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Cn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Tn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,En=e=>bn.test(e),I=e=>!!e&&!Number.isNaN(Number(e)),Dn=e=>!!e&&Number.isInteger(Number(e)),On=e=>e.endsWith(`%`)&&I(e.slice(0,-1)),kn=e=>xn.test(e),An=()=>!0,jn=e=>Sn.test(e)&&!Cn.test(e),Mn=()=>!1,Nn=e=>wn.test(e),Pn=e=>Tn.test(e),Fn=e=>!L(e)&&!R(e),In=e=>Zn(e,tr,Mn),L=e=>vn.test(e),Ln=e=>Zn(e,nr,jn),Rn=e=>Zn(e,rr,I),zn=e=>Zn(e,ar,An),Bn=e=>Zn(e,ir,Mn),Vn=e=>Zn(e,$n,Mn),Hn=e=>Zn(e,er,Pn),Un=e=>Zn(e,or,Nn),R=e=>yn.test(e),Wn=e=>Qn(e,nr),Gn=e=>Qn(e,ir),Kn=e=>Qn(e,$n),qn=e=>Qn(e,tr),Jn=e=>Qn(e,er),Yn=e=>Qn(e,or,!0),Xn=e=>Qn(e,ar,!0),Zn=(e,t,n)=>{let r=vn.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Qn=(e,t,n=!1)=>{let r=yn.exec(e);return r?r[1]?t(r[1]):n:!1},$n=e=>e===`position`||e===`percentage`,er=e=>e===`image`||e===`url`,tr=e=>e===`length`||e===`size`||e===`bg-size`,nr=e=>e===`length`,rr=e=>e===`number`,ir=e=>e===`family-name`,ar=e=>e===`number`||e===`weight`,or=e=>e===`shadow`,sr=hn(()=>{let e=_n(`color`),t=_n(`font`),n=_n(`text`),r=_n(`font-weight`),i=_n(`tracking`),a=_n(`leading`),o=_n(`breakpoint`),s=_n(`container`),c=_n(`spacing`),l=_n(`radius`),u=_n(`shadow`),d=_n(`inset-shadow`),f=_n(`text-shadow`),p=_n(`drop-shadow`),m=_n(`blur`),h=_n(`perspective`),g=_n(`aspect`),_=_n(`ease`),v=_n(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),R,L],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[R,L,c],T=()=>[En,`full`,`auto`,...w()],E=()=>[Dn,`none`,`subgrid`,R,L],ee=()=>[`auto`,{span:[`full`,Dn,R,L]},Dn,R,L],D=()=>[Dn,`auto`,R,L],te=()=>[`auto`,`min`,`max`,`fr`,R,L],ne=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],O=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],re=()=>[`auto`,...w()],ie=()=>[En,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ae=()=>[En,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],oe=()=>[En,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],k=()=>[e,R,L],A=()=>[...b(),Kn,Vn,{position:[R,L]}],se=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ce=()=>[`auto`,`cover`,`contain`,qn,In,{size:[R,L]}],le=()=>[On,Wn,Ln],j=()=>[``,`none`,`full`,l,R,L],M=()=>[``,I,Wn,Ln],N=()=>[`solid`,`dashed`,`dotted`,`double`],ue=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],P=()=>[I,On,Kn,Vn],de=()=>[``,`none`,m,R,L],fe=()=>[`none`,I,R,L],pe=()=>[`none`,I,R,L],me=()=>[I,R,L],he=()=>[En,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[kn],breakpoint:[kn],color:[An],container:[kn],"drop-shadow":[kn],ease:[`in`,`out`,`in-out`],font:[Fn],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[kn],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[kn],shadow:[kn],spacing:[`px`,I],text:[kn],"text-shadow":[kn],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,En,L,R,g]}],container:[`container`],columns:[{columns:[I,L,R,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Dn,`auto`,R,L]}],basis:[{basis:[En,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[I,En,`auto`,`initial`,`none`,L]}],grow:[{grow:[``,I,R,L]}],shrink:[{shrink:[``,I,R,L]}],order:[{order:[Dn,`first`,`last`,`none`,R,L]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ne(),`normal`]}],"justify-items":[{"justify-items":[...O(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...O()]}],"align-content":[{content:[`normal`,...ne()]}],"align-items":[{items:[...O(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...O(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...O(),`baseline`]}],"place-self":[{"place-self":[`auto`,...O()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:re()}],mx:[{mx:re()}],my:[{my:re()}],ms:[{ms:re()}],me:[{me:re()}],mbs:[{mbs:re()}],mbe:[{mbe:re()}],mt:[{mt:re()}],mr:[{mr:re()}],mb:[{mb:re()}],ml:[{ml:re()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ie()}],"inline-size":[{inline:[`auto`,...ae()]}],"min-inline-size":[{"min-inline":[`auto`,...ae()]}],"max-inline-size":[{"max-inline":[`none`,...ae()]}],"block-size":[{block:[`auto`,...oe()]}],"min-block-size":[{"min-block":[`auto`,...oe()]}],"max-block-size":[{"max-block":[`none`,...oe()]}],w:[{w:[s,`screen`,...ie()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ie()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ie()]}],h:[{h:[`screen`,`lh`,...ie()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ie()]}],"max-h":[{"max-h":[`screen`,`lh`,...ie()]}],"font-size":[{text:[`base`,n,Wn,Ln]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Xn,zn]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,On,L]}],"font-family":[{font:[Gn,Bn,t]}],"font-features":[{"font-features":[L]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,R,L]}],"line-clamp":[{"line-clamp":[I,`none`,R,Rn]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,R,L]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,R,L]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...N(),`wavy`]}],"text-decoration-thickness":[{decoration:[I,`from-font`,`auto`,R,Ln]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[I,`auto`,R,L]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,R,L]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,R,L]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:A()}],"bg-repeat":[{bg:se()}],"bg-size":[{bg:ce()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Dn,R,L],radial:[``,R,L],conic:[Dn,R,L]},Jn,Hn]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:j()}],"rounded-s":[{"rounded-s":j()}],"rounded-e":[{"rounded-e":j()}],"rounded-t":[{"rounded-t":j()}],"rounded-r":[{"rounded-r":j()}],"rounded-b":[{"rounded-b":j()}],"rounded-l":[{"rounded-l":j()}],"rounded-ss":[{"rounded-ss":j()}],"rounded-se":[{"rounded-se":j()}],"rounded-ee":[{"rounded-ee":j()}],"rounded-es":[{"rounded-es":j()}],"rounded-tl":[{"rounded-tl":j()}],"rounded-tr":[{"rounded-tr":j()}],"rounded-br":[{"rounded-br":j()}],"rounded-bl":[{"rounded-bl":j()}],"border-w":[{border:M()}],"border-w-x":[{"border-x":M()}],"border-w-y":[{"border-y":M()}],"border-w-s":[{"border-s":M()}],"border-w-e":[{"border-e":M()}],"border-w-bs":[{"border-bs":M()}],"border-w-be":[{"border-be":M()}],"border-w-t":[{"border-t":M()}],"border-w-r":[{"border-r":M()}],"border-w-b":[{"border-b":M()}],"border-w-l":[{"border-l":M()}],"divide-x":[{"divide-x":M()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":M()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...N(),`hidden`,`none`]}],"divide-style":[{divide:[...N(),`hidden`,`none`]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-bs":[{"border-bs":k()}],"border-color-be":[{"border-be":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...N(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[I,R,L]}],"outline-w":[{outline:[``,I,Wn,Ln]}],"outline-color":[{outline:k()}],shadow:[{shadow:[``,`none`,u,Yn,Un]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":[`none`,d,Yn,Un]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:M()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[I,Ln]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":M()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":[`none`,f,Yn,Un]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[I,R,L]}],"mix-blend":[{"mix-blend":[...ue(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ue()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[I]}],"mask-image-linear-from-pos":[{"mask-linear-from":P()}],"mask-image-linear-to-pos":[{"mask-linear-to":P()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":P()}],"mask-image-t-to-pos":[{"mask-t-to":P()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":P()}],"mask-image-r-to-pos":[{"mask-r-to":P()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":P()}],"mask-image-b-to-pos":[{"mask-b-to":P()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":P()}],"mask-image-l-to-pos":[{"mask-l-to":P()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":P()}],"mask-image-x-to-pos":[{"mask-x-to":P()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":P()}],"mask-image-y-to-pos":[{"mask-y-to":P()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[R,L]}],"mask-image-radial-from-pos":[{"mask-radial-from":P()}],"mask-image-radial-to-pos":[{"mask-radial-to":P()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[I]}],"mask-image-conic-from-pos":[{"mask-conic-from":P()}],"mask-image-conic-to-pos":[{"mask-conic-to":P()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:A()}],"mask-repeat":[{mask:se()}],"mask-size":[{mask:ce()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,R,L]}],filter:[{filter:[``,`none`,R,L]}],blur:[{blur:de()}],brightness:[{brightness:[I,R,L]}],contrast:[{contrast:[I,R,L]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Yn,Un]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:[``,I,R,L]}],"hue-rotate":[{"hue-rotate":[I,R,L]}],invert:[{invert:[``,I,R,L]}],saturate:[{saturate:[I,R,L]}],sepia:[{sepia:[``,I,R,L]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,R,L]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[I,R,L]}],"backdrop-contrast":[{"backdrop-contrast":[I,R,L]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,I,R,L]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[I,R,L]}],"backdrop-invert":[{"backdrop-invert":[``,I,R,L]}],"backdrop-opacity":[{"backdrop-opacity":[I,R,L]}],"backdrop-saturate":[{"backdrop-saturate":[I,R,L]}],"backdrop-sepia":[{"backdrop-sepia":[``,I,R,L]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,R,L]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[I,`initial`,R,L]}],ease:[{ease:[`linear`,`initial`,_,R,L]}],delay:[{delay:[I,R,L]}],animate:[{animate:[`none`,v,R,L]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,R,L]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:fe()}],"rotate-x":[{"rotate-x":fe()}],"rotate-y":[{"rotate-y":fe()}],"rotate-z":[{"rotate-z":fe()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":[`scale-3d`],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[R,L,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:he()}],"translate-x":[{"translate-x":he()}],"translate-y":[{"translate-y":he()}],"translate-z":[{"translate-z":he()}],"translate-none":[`translate-none`],accent:[{accent:k()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,R,L]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,R,L]}],fill:[{fill:[`none`,...k()]}],"stroke-w":[{stroke:[I,Wn,Ln,Rn]}],stroke:[{stroke:[`none`,...k()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function z(...e){return sr(Pt(e))}function cr(e){let t=Math.max(0,Math.floor((Date.now()-e*1e3)/1e3));if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}function lr(e){return new Date(e*1e3).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function ur(e,t){try{let e=JSON.parse(t);if(!e||typeof e!=`object`)return t;for(let t of[`command`,`CommandLine`,`Input`,`query`,`Task`,`Prompt`])if(typeof e[t]==`string`&&e[t].length>0)return e[t];for(let t of[`file_path`,`path`,`TargetFile`,`AbsolutePath`,`SearchPath`,`DirectoryPath`,`Url`,`ImageName`])if(typeof e[t]==`string`&&e[t].length>0)return e[t];for(let t of Object.values(e))if(typeof t==`string`&&t.length>0)return t;return``}catch{return t}}var dr=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})),B=o(((e,t)=>{t.exports=dr()}))(),fr=Lt(`flex flex-col min-h-0 overflow-hidden rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)]`,{variants:{variant:{default:``,interactive:`hover:border-[var(--color-line-2)] hover:bg-[var(--color-surface-2)] transition-colors cursor-pointer`,flush:`bg-transparent border-[var(--color-line-0)]`}},defaultVariants:{variant:`default`}});function V({className:e,variant:t,...n}){return(0,B.jsx)(`div`,{className:z(fr({variant:t,className:e})),...n})}function H({className:e,...t}){return(0,B.jsx)(`div`,{className:z(`flex items-center justify-between gap-2 px-3 pt-2 pb-1 shrink-0`,e),...t})}function U({className:e,...t}){return(0,B.jsx)(`div`,{className:z(`px-3 py-3 flex-1 min-h-0 overflow-auto`,e),...t})}var pr=Lt(`inline-flex items-center gap-1 rounded-sm px-1.5 py-0.5 text-[10px] font-mono font-medium leading-none tracking-wide uppercase border whitespace-nowrap`,{variants:{variant:{green:`bg-emerald-500/8 text-emerald-300 border-emerald-500/25`,red:`bg-red-500/8 text-red-300 border-red-500/25`,amber:`bg-amber-500/10 text-amber-300 border-amber-500/30`,blue:`bg-sky-500/8 text-sky-300 border-sky-500/25`,gray:`bg-[var(--color-surface-2)] text-[var(--color-fg-3)] border-[var(--color-line-1)]`,purple:`bg-violet-500/8 text-violet-300 border-violet-500/25`,outline:`bg-transparent text-[var(--color-fg-3)] border-[var(--color-line-1)]`}},defaultVariants:{variant:`outline`}});function mr({className:e,variant:t,...n}){return(0,B.jsx)(`span`,{className:z(pr({variant:t,className:e})),...n})}var hr=Lt(`relative inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-sm text-xs font-medium tracking-wide transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--color-brand)] focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--color-surface-0)] disabled:pointer-events-none disabled:opacity-40 cursor-pointer overflow-hidden`,{variants:{variant:{primary:`bg-[var(--color-brand)] text-black hover:bg-[var(--color-brand-hover)]`,secondary:`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] hover:border-[var(--color-line-2)] hover:bg-[var(--color-surface-2)]`,ghost:`text-[var(--color-fg-2)] hover:text-[var(--color-fg-0)] hover:bg-[var(--color-surface-2)] border border-transparent`,danger:`bg-red-500/5 border border-red-500/30 text-red-300 hover:border-red-500/60 hover:bg-red-500/10 hover:text-red-200`},size:{sm:`h-6 px-2`,md:`h-8 px-3`,icon:`h-7 w-7 p-0`}},defaultVariants:{variant:`primary`,size:`md`}});function gr(e,t){if(pt())return;let n=e.getBoundingClientRect(),r=Math.hypot(n.width,n.height),i=document.createElement(`span`);i.style.position=`absolute`,i.style.left=`${t.clientX-n.left-r/2}px`,i.style.top=`${t.clientY-n.top-r/2}px`,i.style.width=`${r}px`,i.style.height=`${r}px`,i.style.borderRadius=`50%`,i.style.pointerEvents=`none`,i.style.background=`currentColor`,i.style.opacity=`0.22`,i.style.transform=`scale(0)`,i.style.mixBlendMode=`screen`,e.appendChild(i),jt(i,{scale:[0,1],opacity:[.22,0],duration:540,ease:`outExpo`,onComplete:()=>{i.remove()}})}var W=_.forwardRef(({className:e,variant:t,size:n,onMouseDown:r,onClick:i,...a},o)=>(0,B.jsx)(`button`,{ref:o,className:z(hr({variant:t,size:n,className:e})),onMouseDown:e=>{gr(e.currentTarget,e),r?.(e)},onClick:i,...a}));W.displayName=`Button`;var _r=e=>Math.round(e).toLocaleString(void 0,{useGrouping:!0});function vr(e,t){if(e===`cubic`)return{ease:Fe.out,durationMs:t};if(e===`elastic`)return{ease:We(1.05,.45),durationMs:t};let n=et({stiffness:180,damping:22,mass:1});return{ease:n.fn,durationMs:n.duration}}function yr({value:e,duration:t=320,format:n=_r,curve:r=`spring`,className:i}){let[a,o]=(0,_.useState)(e),s=(0,_.useRef)(e),c=(0,_.useRef)(e),l=(0,_.useRef)(0),u=(0,_.useRef)(null),d=(0,_.useRef)(pt());return(0,_.useEffect)(()=>{if(c.current===e)return;if(d.current){c.current=e,s.current=e,o(e);return}s.current=a,c.current=e,l.current=performance.now(),u.current!==null&&cancelAnimationFrame(u.current);let{ease:n,durationMs:i}=vr(r,t),f=e=>{let t=Math.min(1,(e-l.current)/i),r=n(t);o(s.current+(c.current-s.current)*r),t<1?u.current=requestAnimationFrame(f):u.current=null};return u.current=requestAnimationFrame(f),()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null)}},[e,t,r]),(0,B.jsx)(`span`,{className:z(`tabular-nums`,i),children:n(a)})}function br({data:e,width:t=80,height:n=24,color:r=`#38bdf8`,threshold:i,maxValue:a}){if(e.length<2)return(0,B.jsx)(`svg`,{width:t,height:n,className:`shrink-0`,children:(0,B.jsx)(`line`,{x1:0,y1:n/2,x2:t,y2:n/2,stroke:`var(--color-line-2)`,strokeWidth:1})});let o=a??Math.max(...e,1),s=t-2,c=n-2,l=e.map((t,n)=>{let r=1+n/(e.length-1)*s,i=1+c-t/o*c;return`${r.toFixed(1)},${i.toFixed(1)}`}),u=i===void 0?null:1+c-Math.min(i,o)/o*c;return(0,B.jsxs)(`svg`,{width:t,height:n,className:`shrink-0`,children:[(0,B.jsx)(`polyline`,{points:l.join(` `),fill:`none`,stroke:r,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`}),u!==null&&(0,B.jsx)(`line`,{x1:1,y1:u,x2:t-1,y2:u,stroke:`var(--color-brand)`,strokeWidth:1,strokeDasharray:`3,2`,opacity:.7})]})}function xr(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Sr({value:e,samples:t,maxValue:n,width:r=320,height:i=64,windowMs:a=6e4,color:o=`var(--color-brand)`,fillColor:s=`rgba(245, 158, 11, 0.12)`,className:c}){let l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useRef)([]),f=(0,_.useRef)(t??null),p=(0,_.useRef)(e??0),m=(0,_.useRef)(xr());return(0,_.useEffect)(()=>{f.current=t??null},[t]),(0,_.useEffect)(()=>{t===void 0&&e!==void 0&&e!==p.current&&(p.current=e,d.current.push({ts:Date.now(),v:e}),d.current.length>600&&d.current.splice(0,d.current.length-600))},[e,t]),(0,_.useEffect)(()=>{let e=0,t=!1,o=()=>{let s=Date.now(),c=s-a,h;if(f.current){let e=f.current;h=[];for(let t of e)t.ts>=c&&h.push(t)}else{let e=d.current;for(;e.length>1&&e[1].ts<c;)e.shift();(e.length===0||e[e.length-1].ts<s-200)&&e.push({ts:s,v:p.current}),h=e.filter(e=>e.ts>=c)}if(h.length<2)l.current&&l.current.setAttribute(`points`,``),u.current&&u.current.setAttribute(`points`,``);else{let e=n??Math.max(1,...h.map(e=>e.v)),t=[];for(let n of h){let o=(n.ts-c)/a*r,s=i-n.v/e*(i-2)-1;t.push(`${o.toFixed(1)},${s.toFixed(1)}`)}let o=t.join(` `);if(l.current&&l.current.setAttribute(`points`,o),u.current){let e=t[0].split(`,`),n=t[t.length-1].split(`,`),r=`${e[0]},${i} ${o} ${n[0]},${i}`;u.current.setAttribute(`points`,r)}}t||(e=m.current?window.setTimeout(o,500):requestAnimationFrame(o))};return e=m.current?window.setTimeout(o,500):requestAnimationFrame(o),()=>{t=!0,m.current?clearTimeout(e):cancelAnimationFrame(e)}},[r,i,a,n]),(0,B.jsxs)(`svg`,{width:`100%`,height:i,viewBox:`0 0 ${r} ${i}`,className:z(`block`,c),preserveAspectRatio:`none`,children:[(0,B.jsx)(`polygon`,{ref:u,fill:s,stroke:`none`}),(0,B.jsx)(`polyline`,{ref:l,fill:`none`,stroke:o,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`})]})}var Cr=Lt(`hero-metric relative flex flex-col gap-2 rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] px-4 py-3 overflow-hidden`,{variants:{tone:{neutral:`hero-metric--neutral`,amber:`hero-metric--amber`,green:`hero-metric--green`,red:`hero-metric--red`,blue:`hero-metric--blue`,purple:`hero-metric--purple`,gray:`hero-metric--gray`}},defaultVariants:{tone:`neutral`}}),wr={neutral:`var(--color-fg-1)`,amber:`var(--color-brand)`,green:`#34d399`,red:`#f87171`,blue:`#38bdf8`,purple:`#a78bfa`,gray:`var(--color-fg-3)`},Tr={neutral:`rgba(214, 215, 217, 0.10)`,amber:`rgba(245, 158, 11, 0.14)`,green:`rgba(52, 211, 153, 0.14)`,red:`rgba(248, 113, 113, 0.14)`,blue:`rgba(56, 189, 248, 0.14)`,purple:`rgba(167, 139, 250, 0.14)`,gray:`rgba(110, 112, 118, 0.10)`},Er={neutral:`text-[var(--color-fg-0)]`,amber:`text-amber-300`,green:`text-emerald-300`,red:`text-red-300`,blue:`text-sky-300`,purple:`text-violet-300`,gray:`text-[var(--color-fg-2)]`},Dr=1e3,Or=.35;function kr(e,t,n){let r=Date.now(),i=r-n,a=Math.max(2,Math.floor(n/Dr)),o=Array(a).fill(0);for(let n of e){if(t&&!t(n)||n.ts_ms<i||n.ts_ms>r)continue;let e=a-1-Math.floor((r-n.ts_ms)/Dr);e>=0&&e<a&&o[e]++}let s=Array(a),c=o[0];for(let e=0;e<a;e++)c=Or*o[e]+(1-Or)*c,s[e]={ts:i+(e+1)*Dr,v:c};return s}function Ar({label:e,value:t,series:n,burstRing:r,filter:i,sparkWindowMs:a=6e4,sub:o,tone:s,format:c,className:l,...u}){let d=s??`neutral`,f=wr[d]??wr.neutral,p=Tr[d]??Tr.neutral,m=Er[d]??Er.neutral,h=(0,_.useRef)(null),g=(0,_.useRef)(t);(0,_.useEffect)(()=>{if(g.current===t)return;g.current=t;let e=h.current;e&&jt(e,{"--tick":[0,1],duration:160,ease:`outCubic`,onComplete:()=>{jt(e,{"--tick":[1,0],duration:520,ease:`outElastic(1, 0.6)`,onComplete:e=>{e.style.removeProperty(`--tick`)}})}})},[t]);let v=(0,_.useMemo)(()=>r?kr(r,i,a):null,[r,i,a]),y=v!==null,b=!y&&n&&n.length>=2;return(0,B.jsxs)(`div`,{ref:h,className:z(Cr({tone:s,className:l})),...u,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:e}),o?(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:o}):null]}),(0,B.jsxs)(`div`,{className:`flex items-end justify-between gap-3`,children:[(0,B.jsx)(yr,{value:t,format:c,className:z(`text-[2.4rem] leading-none font-semibold tracking-tight`,m)}),y?(0,B.jsx)(Sr,{samples:v,width:108,height:36,windowMs:a,color:f,fillColor:p,className:`shrink-0`}):b?(0,B.jsx)(br,{data:n,width:96,height:28,color:f}):null]})]})}var jr=135,Mr=405,Nr=Mr-jr,Pr=`#34d399`,Fr=`#f59e0b`,Ir=`#ef4444`;function Lr(e,t,n,r){let i=(r-90)*(Math.PI/180);return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}function Rr(e,t,n,r,i){let a=Lr(e,t,n,r),o=Lr(e,t,n,i),s=i-r>180?1:0;return`M ${a.x.toFixed(2)} ${a.y.toFixed(2)} A ${n} ${n} 0 ${s} 1 ${o.x.toFixed(2)} ${o.y.toFixed(2)}`}function zr(e,t){return jr+Math.max(0,Math.min(1,e/Math.max(t,1e-9)))*Nr}function Br(e,t,n){return e+(t-e)*n}function Vr(e){let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]}function Hr(e,t,n){let[r,i,a]=Vr(e),[o,s,c]=Vr(t);return`rgb(${Math.round(Br(r,o,n))},${Math.round(Br(i,s,n))},${Math.round(Br(a,c,n))})`}function Ur(e,t,n){let r=.04;return e<t-r?Pr:e<t+r?Hr(Pr,Fr,(e-(t-r))/(r*2)):e<n-r?Fr:e<n+r?Hr(Fr,Ir,(e-(n-r))/(r*2)):Ir}function Wr(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Gr=0;function Kr(){return Gr=Gr+1|0,Gr.toString(36)}function qr(){if(typeof crypto<`u`&&crypto.getRandomValues){let e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]/4294967296*Math.PI*2}return 0}function Jr({value:e,max:t,warnAt:n=.7,critAt:r=.9,marker50:i,marker99:a,label:o,display:s,displayFormat:c,scaleLabels:l,mode:u=`needle`,size:d=180,className:f,revLights:p=!0,revLightCount:m=20}){let h=Math.ceil(u===`needle`&&l!==void 0?d*.2:d*.08),g=-h,v=-h,y=d+h*2,b=d+h*2,x=d/2,S=d/2,C=d*.42,w=Math.max(0,Math.min(1,e/Math.max(t,1e-9))),T=(0,_.useMemo)(()=>Rr(x,S,C,jr,Mr),[x,S,C]),E=(0,_.useMemo)(()=>Rr(x,S,C-8,jr,Mr),[x,S,C]),ee=jr+n*Nr,D=jr+r*Nr,te=(0,_.useMemo)(()=>Rr(x,S,C,jr,ee),[x,S,C,ee]),ne=(0,_.useMemo)(()=>Rr(x,S,C,ee,D),[x,S,C,ee,D]),O=(0,_.useMemo)(()=>Rr(x,S,C,D,Mr),[x,S,C,D]),re=(0,_.useMemo)(()=>Rr(x,S,C-14,300,420),[x,S,C]),ie=jr+w*Nr,ae=(0,_.useMemo)(()=>Rr(x,S,C,jr,Math.max(jr+.01,ie)),[x,S,C,ie]),oe=Ur(w,n,r),k=(0,_.useMemo)(()=>Kr(),[]),A=`lgf-${k}`,se=`lgfn-${k}`,ce=`lgb-${k}`,le=`lgd-${k}`,j=`lgh-${k}`,M=`lgg-${k}`,N=`lgl-${k}`,ue=(0,_.useMemo)(()=>{if(u!==`needle`)return[];let e=[];for(let t=0;t<=10;t++)e.push(jr+t/10*Nr);return e},[u]),P=(0,_.useMemo)(()=>{if(u!==`needle`)return[];let e=[];for(let t=0;t<=40;t++)t%4!=0&&e.push(jr+t/40*Nr);return e},[u]),de=(0,_.useRef)(null),fe=(0,_.useRef)(null),pe=(0,_.useRef)(null),me=(0,_.useRef)(null),he=(0,_.useRef)(null),ge=(0,_.useRef)(null),_e=(0,_.useRef)(null),ve=(0,_.useRef)(null),ye=(0,_.useRef)([]),be=(0,_.useRef)(e),xe=(0,_.useRef)(t),Se=(0,_.useRef)(n),Ce=(0,_.useRef)(r);(0,_.useEffect)(()=>{be.current=e,xe.current=t,Se.current=n,Ce.current=r},[e,t,n,r]);let we=(0,_.useMemo)(()=>{if(!p||u!==`needle`)return[];let e=Math.max(4,m),t=C-11,n=[];for(let r=0;r<e;r++){let i=jr+(r+.5)/e*Nr;n.push(Lr(x,S,t,i))}return n},[p,m,u,x,S,C]);ye.current.length!==we.length&&(ye.current.length=we.length);let Te=x+C-6,Ee=x+d*.04,De=Math.max(2,d*.016),Oe=`${Te},${S} ${Ee},${S-De} ${Ee},${S+De}`,ke=x-d*.04,Ae=x-C*.24,je=Math.max(1.4,d*.012),F=`${Ae},${S} ${ke},${S-je} ${ke},${S+je}`,Me=d*.48,Ne=d*.17,Pe=x-Me/2,Fe=S+d*.16,Ie=Fe+Ne*.68;return(0,_.useEffect)(()=>{let e=Wr(),t=0,n=!1,r=performance.now(),i=qr(),a=qr(),o=qr(),s=be.current,l=0,d=be.current,f=0,m=be.current,h=g=>{let _=(g-r)/1e3;r=g;let v=Math.min(.04,Math.max(.001,_)),y=be.current,b=xe.current,w=Se.current,T=Ce.current,E=Math.max(b,1e-9),ee=y;if(!e&&u===`needle`){let e=Math.max(0,Math.min(1,s/E)),t=g/1e3,n=(E*.004+E*.016*e*e)*(Math.sin(t*8.7+i)*.46+Math.sin(t*14.3+a)*.31+Math.sin(t*23.7+o)*.23);ee=Math.max(0,Math.min(b,y+n))}if(e)s=y,d=y,m=y,l=0,f=0;else{let e=v/2;for(let t=0;t<2;t++){let t=-210*(s-ee)-22*l;l+=t*e,s+=l*e;let n=-55*(d-s)-13*f;f+=n*e,d+=f*e}let t=1-Math.exp(-v*8);m+=(y-m)*t,Math.abs(m-y)<E*1e-5&&(m=y)}let D=Math.max(0,Math.min(1,s/Math.max(b,1e-9))),te=jr+D*Nr,ne=jr+Math.max(0,Math.min(1,d/Math.max(b,1e-9)))*Nr,O=Ur(D,w,T);if(de.current&&de.current.setAttribute(`transform`,`rotate(${(te-90).toFixed(3)} ${x} ${S})`),fe.current&&fe.current.setAttribute(`fill`,O),pe.current&&pe.current.setAttribute(`fill`,O),me.current&&me.current.setAttribute(`stroke`,O),he.current&&he.current.setAttribute(`transform`,`rotate(${(ne-90).toFixed(3)} ${x} ${S})`),ge.current&&ge.current.setAttribute(`fill`,O),_e.current&&c&&(_e.current.textContent=c(m)),ve.current&&u===`ring`){let e=Math.max(jr+.01,te);ve.current.setAttribute(`d`,Rr(x,S,C,jr,e)),ve.current.setAttribute(`stroke`,O)}if(p&&u===`needle`){let e=ye.current,t=e.length;if(t>0){let n=1/t;for(let r=0;r<t;r++){let i=e[r];if(!i)continue;let a=(r+.5)/t,o=D-a,s=Math.max(0,Math.min(1,.5+o/n));i.setAttribute(`fill`,Ur(a,w,T)),i.setAttribute(`opacity`,s.toFixed(3))}}}n||(t=requestAnimationFrame(h))};return t=requestAnimationFrame(h),()=>{n=!0,cancelAnimationFrame(t)}},[x,S,C,u,p,c]),(0,B.jsxs)(`div`,{className:z(`flex flex-col items-center justify-center gap-1 min-h-0 min-w-0`,f),children:[(0,B.jsxs)(`svg`,{width:y,height:b,viewBox:`${g} ${v} ${y} ${b}`,preserveAspectRatio:`xMidYMid meet`,className:`block max-w-full max-h-full min-h-0`,children:[(0,B.jsxs)(`defs`,{children:[(0,B.jsxs)(`filter`,{id:A,x:`-40%`,y:`-40%`,width:`180%`,height:`180%`,children:[(0,B.jsx)(`feGaussianBlur`,{stdDeviation:`1.2`,result:`blur`}),(0,B.jsxs)(`feMerge`,{children:[(0,B.jsx)(`feMergeNode`,{in:`blur`}),(0,B.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,B.jsxs)(`filter`,{id:se,x:`-60%`,y:`-60%`,width:`220%`,height:`220%`,children:[(0,B.jsx)(`feGaussianBlur`,{stdDeviation:`2.2`,result:`nb`}),(0,B.jsxs)(`feMerge`,{children:[(0,B.jsx)(`feMergeNode`,{in:`nb`}),(0,B.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,B.jsxs)(`radialGradient`,{id:ce,cx:`50%`,cy:`32%`,r:`80%`,children:[(0,B.jsx)(`stop`,{offset:`0%`,stopColor:`#4e535d`}),(0,B.jsx)(`stop`,{offset:`55%`,stopColor:`#2a2e36`}),(0,B.jsx)(`stop`,{offset:`100%`,stopColor:`#0b0d11`})]}),(0,B.jsxs)(`radialGradient`,{id:le,cx:`50%`,cy:`45%`,r:`75%`,children:[(0,B.jsx)(`stop`,{offset:`0%`,stopColor:`#1b1f27`}),(0,B.jsx)(`stop`,{offset:`80%`,stopColor:`#0a0c10`}),(0,B.jsx)(`stop`,{offset:`100%`,stopColor:`#05060a`})]}),(0,B.jsxs)(`radialGradient`,{id:j,cx:`40%`,cy:`30%`,r:`70%`,children:[(0,B.jsx)(`stop`,{offset:`0%`,stopColor:`#f4f5f8`}),(0,B.jsx)(`stop`,{offset:`45%`,stopColor:`#aab1bd`}),(0,B.jsx)(`stop`,{offset:`100%`,stopColor:`#1c1f26`})]}),(0,B.jsxs)(`linearGradient`,{id:M,x1:`50%`,y1:`0%`,x2:`50%`,y2:`100%`,children:[(0,B.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`0.22`}),(0,B.jsx)(`stop`,{offset:`100%`,stopColor:`#ffffff`,stopOpacity:`0`})]}),(0,B.jsxs)(`linearGradient`,{id:N,x1:`50%`,y1:`0%`,x2:`50%`,y2:`100%`,children:[(0,B.jsx)(`stop`,{offset:`0%`,stopColor:`#0a0c11`}),(0,B.jsx)(`stop`,{offset:`100%`,stopColor:`#15181f`})]})]}),u===`needle`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`circle`,{cx:x,cy:S,r:C+12,fill:`url(#${ce})`,stroke:`#000`,strokeOpacity:.55,strokeWidth:1}),(0,B.jsx)(`circle`,{cx:x,cy:S,r:C+5,fill:`none`,stroke:`#0a0c11`,strokeWidth:1}),(0,B.jsx)(`circle`,{cx:x,cy:S,r:C-2,fill:`url(#${le})`})]}):null,(0,B.jsx)(`path`,{d:T,fill:`none`,stroke:`var(--color-line-1)`,strokeWidth:u===`ring`?12:3,strokeLinecap:`round`,opacity:u===`ring`?1:.35}),u===`needle`?(0,B.jsx)(`path`,{d:E,fill:`none`,stroke:`var(--color-line-0)`,strokeWidth:1,strokeLinecap:`round`,opacity:.55}):null,u===`needle`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:te,fill:`none`,stroke:Pr,strokeWidth:5,strokeLinecap:`round`,opacity:.78}),(0,B.jsx)(`path`,{d:ne,fill:`none`,stroke:Fr,strokeWidth:5,strokeLinecap:`round`,opacity:.82}),(0,B.jsx)(`path`,{d:O,fill:`none`,stroke:Ir,strokeWidth:5,strokeLinecap:`round`,opacity:.9}),P.map((e,t)=>{let n=Lr(x,S,C-4,e),r=Lr(x,S,C+2,e);return(0,B.jsx)(`line`,{x1:n.x,y1:n.y,x2:r.x,y2:r.y,stroke:`var(--color-fg-4)`,strokeWidth:.9,strokeLinecap:`round`,opacity:.7},`mi-${t}`)}),ue.map((e,t)=>{let n=Lr(x,S,C-8,e),r=Lr(x,S,C+4,e);return(0,B.jsx)(`line`,{x1:n.x,y1:n.y,x2:r.x,y2:r.y,stroke:`var(--color-fg-2)`,strokeWidth:1.8,strokeLinecap:`round`},`ma-${t}`)}),p?we.map((e,t)=>(0,B.jsx)(`circle`,{ref:e=>{ye.current[t]=e},cx:e.x,cy:e.y,r:Math.max(1.6,d*.013),fill:Pr,opacity:0,filter:`url(#${A})`},t)):null,i===void 0?null:(0,B.jsx)(Yr,{cx:x,cy:S,r:C,angle:zr(i,t),emphasis:!0}),a===void 0?null:(0,B.jsx)(Yr,{cx:x,cy:S,r:C,angle:zr(a,t),emphasis:!0}),l?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Xr,{cx:x,cy:S,r:C,angle:ee,text:l(n),size:d}),(0,B.jsx)(Xr,{cx:x,cy:S,r:C,angle:D,text:l(r),size:d}),(0,B.jsx)(Xr,{cx:x,cy:S,r:C,angle:Mr,text:l(1),size:d})]}):null,(0,B.jsx)(`path`,{d:re,fill:`none`,stroke:`url(#${M})`,strokeWidth:d*.14,strokeLinecap:`butt`}),c||s!==void 0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`rect`,{x:Pe,y:Fe,width:Me,height:Ne,rx:d*.022,ry:d*.022,fill:`url(#${N})`,stroke:`#242a33`,strokeWidth:1}),(0,B.jsx)(`rect`,{x:Pe+1,y:Fe+1,width:Me-2,height:1,fill:`#ffffff`,opacity:.08})]}):null,(0,B.jsx)(`g`,{ref:he,opacity:.28,children:(0,B.jsx)(`polygon`,{ref:ge,points:Oe,fill:oe,filter:`url(#${se})`})}),(0,B.jsxs)(`g`,{ref:de,children:[(0,B.jsx)(`polygon`,{ref:fe,points:Oe,fill:oe,stroke:`#05070a`,strokeWidth:.6,filter:`url(#${se})`}),(0,B.jsx)(`polygon`,{ref:pe,points:F,fill:oe,opacity:.7})]}),(0,B.jsx)(`circle`,{cx:x,cy:S,r:d*.06,fill:`url(#${j})`,stroke:`#06080c`,strokeWidth:1}),(0,B.jsx)(`circle`,{ref:me,cx:x,cy:S,r:d*.036,fill:`#0a0c11`,stroke:oe,strokeWidth:1.4}),(0,B.jsx)(`circle`,{cx:x,cy:S,r:d*.012,fill:`#f5f7fb`,opacity:.9})]}):(0,B.jsx)(`path`,{ref:ve,d:ae,fill:`none`,stroke:oe,strokeWidth:12,strokeLinecap:`round`}),u===`needle`&&(c||s!==void 0)?c?(0,B.jsx)(`text`,{ref:_e,x,y:Ie,textAnchor:`middle`,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:d*.1,fontWeight:600,fill:`#e8ecf3`,children:c(e)}):(0,B.jsx)(`text`,{x,y:Ie,textAnchor:`middle`,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:d*.1,fontWeight:600,fill:`#e8ecf3`,children:s}):c?(0,B.jsx)(`text`,{ref:_e,x,y:S+4,textAnchor:`middle`,className:`font-mono tabular-nums`,fontSize:d*.13,fill:`var(--color-fg-0)`,children:c(e)}):s===void 0?null:(0,B.jsx)(`text`,{x,y:S+4,textAnchor:`middle`,className:`font-mono tabular-nums`,fontSize:d*.13,fill:`var(--color-fg-0)`,children:s})]}),o?(0,B.jsx)(`span`,{className:`overline shrink-0 tracking-[0.12em] uppercase`,children:o}):null]})}function Yr({cx:e,cy:t,r:n,angle:r,emphasis:i=!1}){let a=Lr(e,t,n-(i?10:6),r),o=Lr(e,t,n+(i?8:6),r);return(0,B.jsx)(`line`,{x1:a.x,y1:a.y,x2:o.x,y2:o.y,stroke:i?`var(--color-fg-1)`:`var(--color-fg-2)`,strokeWidth:i?2:1.5,strokeLinecap:`round`})}function Xr({cx:e,cy:t,r:n,angle:r,text:i,size:a}){let o=Lr(e,t,n+Math.max(16,a*.1),r),s=r>=135&&r<215?`end`:r>=325?`start`:`middle`;return(0,B.jsx)(`text`,{x:o.x,y:o.y,textAnchor:s,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:a*.062,fontWeight:600,fill:`var(--color-fg-2)`,stroke:`var(--color-bg-0)`,strokeWidth:3,paintOrder:`stroke`,children:i})}var G={containerPaddingY:24,containerPaddingX:24,topToTrendGap:12,scatterHeaderH:18,scatterLegendH:16,scatterInnerGap:8,trendRowH:28,trendRowGap:6,trendTopPad:9,scatterAbsoluteMin:60,scatterAcceptableMin:70,gaugeFootprintFactor:1.36,gaugeAbsoluteMin:84,gaugeAbsoluteMax:240};function Zr(e,t,n=200){let r=Math.max(0,Math.floor(e)),i=Math.max(0,Math.floor(t)),a=Math.max(0,r-G.containerPaddingX),o=Math.max(0,i-G.containerPaddingY),s=o-(G.trendRowH*3+G.trendRowGap*2+G.trendTopPad+G.topToTrendGap),c=s-G.scatterHeaderH-G.scatterLegendH-G.scatterInnerGap>=G.scatterAcceptableMin,l=c?s:o,u=l-G.scatterHeaderH-G.scatterLegendH-G.scatterInnerGap,d=u>=G.scatterAbsoluteMin,f=u>=G.scatterAbsoluteMin&&l>=140,p=Math.floor(l/G.gaugeFootprintFactor),m=Math.floor(a*.45/G.gaugeFootprintFactor),h=Math.max(G.gaugeAbsoluteMin,Math.min(G.gaugeAbsoluteMax,n,p,m)),g=Math.ceil(h*G.gaugeFootprintFactor+8),_=l-(d?G.scatterHeaderH:0)-(f?G.scatterLegendH:0)-G.scatterInnerGap;return{gaugeSize:h,gaugeColumnMaxWidth:g,scatterMinHeight:Math.max(G.scatterAbsoluteMin,Math.min(160,_)),showTrendRows:c,showScatterHeader:d,showLegend:f,variant:o>=480?`wide`:o>=300?`normal`:`compact`}}var Qr={allow:`#34d399`,block:`#ef4444`,ask:`#f59e0b`,log:`#a78bfa`,force:`#38bdf8`,shadow:`#6e7076`};function $r(e){return!Number.isFinite(e)||e<=0?`—`:e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:`${(e/1e6).toFixed(2)} ms`}function ei({latency:e,bursts:t,gaugeMaxMs:n=10,windowMs:r=3e4,trendWindowSec:i=60,gaugeSize:a=200,compact:o=!1,className:s}){let c=e?e.p50_ns/1e6:0,l=e?e.p95_ns/1e6:0,u=e?e.p99_ns/1e6:0,d=(0,_.useRef)(null),[f,p]=(0,_.useState)((0,_.useMemo)(()=>Zr(a*2,a*2,a),[a]));(0,_.useEffect)(()=>{let e=d.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=0,r=0,i=e=>{let t=Math.round(e.width),i=Math.round(e.height);t===n&&i===r||(n=t,r=i,p(Zr(t,i,a)))};i(e.getBoundingClientRect());let o=new ResizeObserver(e=>{let n=e[0];n&&(t&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{i(n.contentRect)}))});return o.observe(e),()=>{t&&cancelAnimationFrame(t),o.disconnect()}},[a]);let m=(0,_.useRef)(null),h=(0,_.useRef)([]),g=(0,_.useRef)(0);(0,_.useEffect)(()=>{if(t.length===0)return;let e=h.current,n=g.current,i=n;for(let r of t)r.ts_ms<=n||(e.push({ts:r.ts_ms,durationNs:r.duration_ns,color:Qr[r.decision]??`#6e7076`}),r.ts_ms>i&&(i=r.ts_ms));g.current=i;let a=Date.now()-r*2;for(;e.length&&e[0].ts<a;)e.shift()},[t,r]),(0,_.useEffect)(()=>{let e=m.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let i=0,a=!1,o=0,s=0,c=0,l=8e3,u=.25,d=1e3,f=n*1e6,p=Math.log10(d),g=Math.log10(f),_=()=>{let n=window.devicePixelRatio||1,m=e.clientWidth,v=e.clientHeight;if(m===0||v===0){a||(i=requestAnimationFrame(_));return}(m!==s||v!==c||n!==o)&&(e.width=Math.floor(m*n),e.height=Math.floor(v*n),t.setTransform(n,0,0,n,0,0),s=m,c=v,o=n),t.clearRect(0,0,m,v),t.strokeStyle=`rgba(110, 112, 118, 0.18)`,t.lineWidth=1,t.setLineDash([2,4]);let y=[{ns:1e5,label:`100µs`},{ns:1e6,label:`1ms`},{ns:1e7,label:`10ms`}];t.font=`9px ui-monospace, SFMono-Regular, Menlo, monospace`,t.textBaseline=`middle`,t.fillStyle=`rgba(110, 112, 118, 0.7)`;for(let e of y){if(e.ns<d||e.ns>f)continue;let n=v-(Math.log10(e.ns)-p)/(g-p)*v;t.beginPath(),t.moveTo(0,n),t.lineTo(m-28,n),t.stroke(),t.fillText(e.label,m-26,n)}t.setLineDash([]);let b=Date.now(),x=b-r,S=h.current;for(;S.length&&S[0].ts<x;)S.shift();t.globalCompositeOperation=`source-over`;for(let e of S){let n=(e.ts-x)/r*m,i=Math.max(d,Math.min(f,e.durationNs)),a=v-(Math.log10(i)-p)/(g-p)*v,o=b-e.ts,s;if(o<=l)s=1-o/l*(1-u);else{let e=r-l;s=e>0?Math.max(0,u*(1-(o-l)/e)):0}s<=0||(t.globalAlpha=s,t.fillStyle=e.color,t.beginPath(),t.arc(n,a,2.5,0,Math.PI*2),t.fill())}t.globalAlpha=1,t.fillStyle=`rgba(110, 112, 118, 0.55)`,t.font=`9px ui-monospace, SFMono-Regular, Menlo, monospace`,t.textBaseline=`bottom`,t.textAlign=`left`,t.fillText(`← ${Math.round(r/1e3)} s ago`,4,v-2),t.textAlign=`right`,t.fillText(`now →`,m-4,v-2),t.textAlign=`left`,a||(i=requestAnimationFrame(_))};return i=requestAnimationFrame(_),()=>{a=!0,cancelAnimationFrame(i)}},[r,n]);let v=(0,_.useRef)({p50:[],p95:[],p99:[]});(0,_.useEffect)(()=>{if(!e)return;let t=v.current,n=Date.now(),r=n-i*1e3,a=(e,t)=>{let i=t/1e6;for(e.length===0&&e.push({ts:r,v:i}),e.push({ts:n,v:i});e.length>1&&e[0].ts<r;)e.shift()};a(t.p50,e.p50_ns),a(t.p95,e.p95_ns),a(t.p99,e.p99_ns)},[e,i]);let y=(0,_.useMemo)(()=>{let e=v.current;return{p50:[...e.p50],p95:[...e.p95],p99:[...e.p99]}},[e]);return(0,B.jsxs)(`div`,{ref:d,"data-lt-variant":f.variant,className:z(`flex h-full min-h-0 flex-col gap-3 overflow-hidden rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] p-3`,s),children:[(0,B.jsxs)(`div`,{className:z(`grid gap-3 min-h-0 flex-1`,`grid-cols-[auto_1fr]`),children:[(0,B.jsx)(`div`,{className:`flex items-stretch justify-center overflow-hidden min-h-0 min-w-0`,style:{maxWidth:f.gaugeColumnMaxWidth},children:(0,B.jsx)(Jr,{value:l,max:n,warnAt:Math.min(.85,.5/n),critAt:Math.min(.92,2/n),marker50:c,marker99:u,displayFormat:e=>$r(e*1e6),scaleLabels:f.gaugeSize>=130?e=>$r(e*n*1e6):void 0,size:f.gaugeSize,label:`p95 latency`})}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0 min-h-0 flex-1`,children:[f.showScatterHeader?(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 shrink-0 min-w-0`,children:[(0,B.jsx)(`span`,{className:`overline truncate min-w-0`,children:`live trace · 30 s scatter`}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] shrink min-w-0 truncate text-right`,children:[h.current.length,` live · log-Y`]})]}):null,f.showLegend?(0,B.jsx)(`div`,{className:`shrink-0`,children:(0,B.jsx)(ti,{})}):null,(0,B.jsx)(`canvas`,{ref:m,"data-testid":`latency-scatter-canvas`,className:`block w-full flex-1 min-h-0 rounded-sm bg-[var(--color-surface-0)] border border-[var(--color-line-0)]`,style:{minHeight:f.scatterMinHeight}})]})]}),f.showTrendRows?(0,B.jsxs)(`div`,{"data-testid":`latency-trend-rows`,className:`grid grid-cols-1 gap-1.5 pt-2 border-t border-[var(--color-line-0)]`,children:[(0,B.jsx)(ni,{label:`p50 · median`,value:$r(e?.p50_ns??0),color:`#34d399`,fill:`rgba(52, 211, 153, 0.14)`,samples:y.p50,windowMs:i*1e3}),(0,B.jsx)(ni,{label:`p95 · 95th`,value:$r(e?.p95_ns??0),color:`#38bdf8`,fill:`rgba(56, 189, 248, 0.14)`,samples:y.p95,windowMs:i*1e3}),(0,B.jsx)(ni,{label:`p99 · 99th`,value:$r(e?.p99_ns??0),color:`#6366f1`,fill:`rgba(99, 102, 241, 0.14)`,samples:y.p99,windowMs:i*1e3})]}):null]})}function ti(){return(0,B.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[{key:`allow`,color:Qr.allow},{key:`ask`,color:Qr.ask},{key:`block`,color:Qr.block},{key:`force`,color:Qr.force},{key:`log`,color:Qr.log},{key:`shadow`,color:Qr.shadow}].map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full`,style:{background:e.color}}),(0,B.jsx)(`span`,{className:`uppercase tracking-wide`,children:e.key})]},e.key))})}function ni({label:e,value:t,color:n,fill:r,samples:i,windowMs:a}){return(0,B.jsxs)(`div`,{className:`grid grid-cols-[72px_minmax(0,1fr)_92px] items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`overline text-right truncate min-w-0`,children:e}),(0,B.jsx)(Sr,{samples:i,width:1200,height:28,windowMs:a,color:n,fillColor:r,className:`w-full h-7`}),(0,B.jsx)(`span`,{className:`text-[11px] font-mono tabular-nums text-right truncate min-w-0`,style:{color:n},title:t,children:t})]})}function ri({counters:e,className:t,showLegend:n=!0}){let r=[{key:`allow`,label:`Allow`,value:e.allow,color:`#34d399`,textClass:`text-emerald-300`},{key:`ask`,label:`Ask`,value:e.ask,color:`#f59e0b`,textClass:`text-amber-300`},{key:`block`,label:`Block`,value:e.block,color:`#ef4444`,textClass:`text-red-300`},{key:`force`,label:`Force`,value:e.force,color:`#38bdf8`,textClass:`text-sky-300`},{key:`log`,label:`Log`,value:e.log,color:`#a78bfa`,textClass:`text-violet-300`},{key:`shadow`,label:`Shadow`,value:e.shadow,color:`#6e7076`,textClass:`text-[var(--color-fg-3)]`}],i=r.reduce((e,t)=>e+t.value,0),a=(0,_.useRef)(null),o=(0,_.useRef)({});return(0,_.useEffect)(()=>{let e=a.current;if(!e)return;let t=e.querySelectorAll(`[data-seg]`);if(t.length===0)return;let n=pt();t.forEach(e=>{let t=e.dataset.seg,a=r.find(e=>e.key===t);if(!a)return;let s=i===0?0:a.value/i*100,c=o.current[t]??0;if(n||Math.abs(c-s)<.01)e.style.width=`${s}%`;else{let t=s>c?`outExpo`:`outElastic(1.02, 0.4)`;jt(e,{width:[`${c}%`,`${s}%`],duration:480,ease:t})}o.current[t]=s})},[e,i]),(0,B.jsxs)(`div`,{className:z(`flex flex-col gap-2`,t),children:[(0,B.jsx)(`div`,{ref:a,className:`flex h-3 w-full overflow-hidden rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-2)]`,children:i===0?(0,B.jsx)(`div`,{className:`w-full bg-[var(--color-surface-3)]`}):r.map(e=>(0,B.jsx)(`div`,{"data-seg":e.key,style:{width:`${i===0?0:e.value/i*100}%`,background:e.color}},e.key))}),n?(0,B.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-[11px] font-mono`,children:r.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2 min-w-0`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,B.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-sm`,style:{background:e.color}}),(0,B.jsx)(`span`,{className:z(`uppercase tracking-wide truncate`,e.textClass),children:e.label})]}),(0,B.jsx)(yr,{value:e.value,className:`shrink-0 tabular-nums text-[var(--color-fg-1)]`})]},e.key))}):null]})}function ii(e){return e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m ${Math.floor(e%60)}s`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`}function ai(e,t){if(t===void 0||t<=0)return`var(--color-brand)`;let n=e/t;return n>=.9?`#ef4444`:n>=.7?`#f59e0b`:`#34d399`}function oi(e){return e===`#ef4444`?`rgba(239, 68, 68, 0.14)`:e===`#f59e0b`?`rgba(245, 158, 11, 0.14)`:e===`#34d399`?`rgba(52, 211, 153, 0.14)`:e===`#a78bfa`?`rgba(167, 139, 250, 0.14)`:`rgba(245, 158, 11, 0.12)`}function si(e,t){if(e.length===0)return[];let n=Date.now(),r=t/Math.max(1,e.length),i=Array(e.length);for(let t=0;t<e.length;t++)i[t]={ts:n-(e.length-1-t)*r,v:e[t]};return i}function ci({cpuPct:e,cpuSeries:t,cpuLimit:n,memMb:r,memSeries:i,memLimit:a,heapUsedMb:o,heapTotalMb:s,heapSeries:c,uptimeSec:l,className:u}){let d=6e4,f=ai(e,n),p=ai(r,a),m=`#a78bfa`,h=(0,_.useMemo)(()=>si(t,d),[t]),g=(0,_.useMemo)(()=>si(i,d),[i]),v=(0,_.useMemo)(()=>si(c,d),[c]),y=(0,_.useRef)([]);(0,_.useEffect)(()=>{let e=y.current.filter(e=>!!e);if(e.length===0)return;e.forEach(e=>{e.style.opacity=`0`,e.style.transform=`translateY(28px) scale(0.94)`});let t=jt(e,{translateY:[28,0],scale:[.94,1],opacity:[0,1],duration:720,delay:it(140),ease:`outBack(1.25)`,onComplete:e=>{e.style.transform=``}});return()=>t.cancel()},[]);let b=n!==void 0&&n>0&&e>=n*.9,x=a!==void 0&&a>0&&r>=a*.9;return(0,B.jsx)(`div`,{className:z(`rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] p-3`,u),children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:[(0,B.jsx)(li,{registerRef:e=>y.current[0]=e,label:`CPU`,color:f,fill:oi(f),pulse:b,valueNode:(0,B.jsxs)(`span`,{children:[(0,B.jsx)(yr,{value:e,format:e=>e.toFixed(1),className:`text-[var(--color-fg-0)]`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-base`,children:`%`})]}),subText:n?`limit ${n}%`:void 0,samples:h,maxValue:100,windowMs:d}),(0,B.jsx)(li,{registerRef:e=>y.current[1]=e,label:`Memory`,color:p,fill:oi(p),pulse:x,valueNode:(0,B.jsxs)(`span`,{children:[(0,B.jsx)(yr,{value:r,format:e=>e.toFixed(0),className:`text-[var(--color-fg-0)]`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-base`,children:`MB`})]}),subText:a?`limit ${a} MB`:void 0,samples:g,maxValue:a?a*1.1:void 0,windowMs:d}),(0,B.jsx)(li,{registerRef:e=>y.current[2]=e,label:`Heap`,color:m,fill:oi(m),valueNode:(0,B.jsxs)(`span`,{children:[(0,B.jsx)(yr,{value:o,format:e=>e.toFixed(0),className:`text-[var(--color-fg-0)]`}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-base`,children:[`/ `,s.toFixed(0),` MB`]})]}),subText:s>0?`${(o/s*100).toFixed(0)}% used`:void 0,samples:v,maxValue:s>0?s:void 0,windowMs:d}),(0,B.jsx)(li,{registerRef:e=>y.current[3]=e,label:`Uptime`,color:`var(--color-fg-2)`,fill:`rgba(214, 215, 217, 0.04)`,valueNode:(0,B.jsx)(`span`,{className:`text-[var(--color-fg-0)] tabular-nums`,children:ii(l)}),subText:`since daemon start`})]})})}function li({label:e,valueNode:t,subText:n,color:r,fill:i,samples:a,maxValue:o,windowMs:s,pulse:c,registerRef:l}){let u=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!c||!u.current)return;let e=!1,t=null,n=()=>{e||!u.current||(t=jt(u.current,{"--breach":[0,1],duration:420,ease:`outCubic`,onComplete:()=>{e||!u.current||(t=jt(u.current,{"--breach":[1,0],duration:560,ease:`outCubic`,onComplete:()=>{e||n()}}))}}))};return n(),()=>{e=!0,t?.cancel();let n=u.current;n&&n.style.removeProperty(`--breach`)}},[c]),(0,B.jsxs)(`div`,{ref:e=>{u.current=e,l(e)},className:`flex flex-col gap-2 rounded-sm border bg-[var(--color-surface-0)] border-[var(--color-line-1)] px-4 py-3 min-h-[140px] system-pulse__tile`,"data-breach":c?`true`:void 0,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:e}),n?(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:n}):null]}),(0,B.jsx)(`span`,{className:`text-[1.9rem] leading-none font-semibold tracking-tight font-mono`,style:{color:r},children:t}),a&&a.length>=2?(0,B.jsx)(`div`,{className:`mt-auto`,children:(0,B.jsx)(Sr,{samples:a,width:320,height:64,windowMs:s??6e4,color:r,fillColor:i,maxValue:o,className:`w-full`})}):(0,B.jsx)(`div`,{className:`mt-auto h-[64px] flex items-end`,children:(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`— no series —`})})]})}var ui=Lt(`relative font-mono text-[11px] overflow-hidden border bg-[var(--color-surface-1)] border-[var(--color-line-1)] rounded-sm`,{variants:{density:{compact:``,roomy:`text-[12px]`}},defaultVariants:{density:`compact`}}),di={allow:`#34d399`,block:`#ef4444`,ask:`#f59e0b`,log:`#a78bfa`,force:`#38bdf8`,shadow:`#6e7076`},fi={allow:`text-emerald-300`,block:`text-red-300`,ask:`text-amber-300`,log:`text-violet-300`,force:`text-sky-300`,shadow:`text-[var(--color-fg-3)]`};function pi(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function mi(e){return e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:e<1e9?`${(e/1e6).toFixed(2)} ms`:`${(e/1e9).toFixed(2)} s`}function hi(e){return e.variant===`raw`?(0,B.jsx)(_i,{...e}):(0,B.jsx)(gi,{...e})}function gi({bursts:e,windowSize:t=60,filterDecision:n,filterClient:r,className:i,density:a,height:o=260}){let[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),u=(0,_.useMemo)(()=>{let i=e;n&&(i=i.filter(e=>e.decision===n)),r&&(i=i.filter(e=>e.client===r));let a=i.slice(-t),o=Array(a.length);for(let e=0;e<a.length;e++)o[e]=a[a.length-1-e];return o},[e,n,r,t]);s?l.current===null&&(l.current=u):l.current=null;let d=s&&l.current?l.current:u,f=(0,_.useRef)(null),p=(0,_.useRef)(0);return(0,_.useLayoutEffect)(()=>{if(s)return;let e=d[0];if(!e||e.ts_ms===p.current)return;p.current=e.ts_ms;let t=f.current;t&&(pt()||jt(t,{translateX:[-10,0],opacity:[0,1],duration:220,ease:`outExpo`}))},[d,s]),(0,B.jsxs)(`div`,{className:z(ui({density:a,className:i})),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,B.jsx)(`div`,{className:`overflow-auto`,style:{height:o},children:d.length===0?(0,B.jsx)(`div`,{className:`px-3 py-4 text-[var(--color-fg-4)]`,children:`— waiting for events —`}):d.map((e,t)=>(0,B.jsxs)(`div`,{ref:t===0?f:void 0,className:`telemetry-row grid items-center gap-2 px-3 py-1 border-b border-[var(--color-line-0)] last:border-b-0 hover:bg-[var(--color-surface-2)]`,style:{gridTemplateColumns:`90px 56px 1fr 1fr 80px 90px`,borderLeft:`3px solid ${di[e.decision]??`#666`}`},children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:pi(e.ts_ms)}),(0,B.jsx)(`span`,{className:z(`uppercase tracking-wide font-medium`,fi[e.decision]??`text-[var(--color-fg-2)]`),children:e.decision}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,children:e.tool||`—`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)] truncate`,children:e.rule_id??`—`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums text-right`,children:mi(e.duration_ns)}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate text-right`,children:e.client})]},`${e.ts_ms}-${t}`))}),s?(0,B.jsx)(vi,{}):null]})}function _i({lines:e,windowSize:t=300,className:n,density:r,height:i=260}){let[a,o]=(0,_.useState)(!1),s=(0,_.useRef)(null),c=(0,_.useMemo)(()=>{let n=e.slice(-t),r=Array(n.length);for(let e=0;e<n.length;e++)r[e]=n[n.length-1-e];return r},[e,t]);a?s.current===null&&(s.current=c):s.current=null;let l=a&&s.current?s.current:c;return(0,B.jsxs)(`div`,{className:z(ui({density:r,className:n})),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[(0,B.jsx)(`div`,{className:`overflow-auto px-3 py-2 leading-relaxed text-[var(--color-fg-2)] whitespace-pre`,style:{height:i},children:l.length===0?(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`— empty —`}):l.map((e,t)=>(0,B.jsx)(`div`,{className:`hover:bg-[var(--color-surface-2)]`,children:e},`${t}-${e.length}`))}),a?(0,B.jsx)(vi,{}):null]})}function vi(){return(0,B.jsx)(`span`,{className:`absolute top-1 right-2 text-[10px] uppercase tracking-wider font-mono text-[var(--color-brand)] bg-[var(--color-surface-0)] px-1.5 py-0.5 border border-[var(--color-brand)]/40 rounded-sm`,children:`paused`})}var yi=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),bi=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),xi=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Si=e=>{let t=xi(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ci={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`},wi=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Ti=(0,_.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,_.createElement)(`svg`,{ref:c,...Ci,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:yi(`lucide`,i),...!a&&!wi(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,_.createElement)(e,t)),...Array.isArray(a)?a:[a]])),Ei=(e,t)=>{let n=(0,_.forwardRef)(({className:n,...r},i)=>(0,_.createElement)(Ti,{ref:i,iconNode:t,className:yi(`lucide-${bi(Si(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Si(e),n},Di=Ei(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),K=Ei(`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`}]]),Oi=Ei(`grip-horizontal`,[[`circle`,{cx:`12`,cy:`9`,r:`1`,key:`124mty`}],[`circle`,{cx:`19`,cy:`9`,r:`1`,key:`1ruzo2`}],[`circle`,{cx:`5`,cy:`9`,r:`1`,key:`1a8b28`}],[`circle`,{cx:`12`,cy:`15`,r:`1`,key:`1e56xg`}],[`circle`,{cx:`19`,cy:`15`,r:`1`,key:`1a92ep`}],[`circle`,{cx:`5`,cy:`15`,r:`1`,key:`5r1jwy`}]]),ki=Ei(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Ai=Ei(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),ji=Ei(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Mi=Ei(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Ni=Ei(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Pi=Ei(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Fi=[`hero-metrics`,`graph`,`latency-trace`,`throughput`,`decision-mix`,`telemetry-feed`,`system-pulse`,`pending-approvals`,`recent-blocks`],Ii={"hero-metrics":`Hero metrics`,graph:`Graph intelligence`,"latency-trace":`Latency trace`,throughput:`Throughput`,"decision-mix":`Decision mix`,"telemetry-feed":`Telemetry feed`,"system-pulse":`System pulse`,"pending-approvals":`Pending approvals`,"recent-blocks":`Recent blocks`},Li={"hero-metrics":{minW:6,minH:1,defaultW:12,defaultH:1},graph:{minW:4,minH:3,defaultW:8,defaultH:5},"latency-trace":{minW:4,minH:3,defaultW:8,defaultH:4},throughput:{minW:2,minH:2,defaultW:4,defaultH:2},"decision-mix":{minW:2,minH:2,defaultW:4,defaultH:2},"telemetry-feed":{minW:6,minH:3,defaultW:12,defaultH:4},"system-pulse":{minW:4,minH:3,defaultW:12,defaultH:3},"pending-approvals":{minW:3,minH:2,defaultW:6,defaultH:3},"recent-blocks":{minW:3,minH:2,defaultW:6,defaultH:3}};function Ri({panel:e,isEditing:t,children:n,drag:r}){let i=(0,_.useRef)(null),a={gridColumn:`${e.x+1} / span ${e.w}`,gridRow:`${e.y+1} / span ${e.h}`};return(0,B.jsxs)(`div`,{ref:i,className:`grid-panel ${t?`grid-panel--edit`:``}`,style:a,role:t?`region`:void 0,"aria-label":t?Ii[e.id]:void 0,tabIndex:t?0:void 0,onKeyDown:t?t=>r.onPanelKeyDown(t,e.id):void 0,"data-panel-id":e.id,children:[t&&(0,B.jsx)(`button`,{type:`button`,className:`grid-panel__drag-handle`,title:`Drag ${Ii[e.id]} (or Arrow keys)`,"aria-label":`Drag ${Ii[e.id]}`,onPointerDown:t=>{let n=i.current;n&&r.onDragPointerDown(t,e.id,n)},children:(0,B.jsx)(Oi,{size:12,strokeWidth:2})}),(0,B.jsx)(`div`,{className:`grid-panel__content`,"data-reveal":t?void 0:``,children:n}),t&&(0,B.jsx)(`button`,{type:`button`,className:`grid-panel__resize-handle`,title:`Resize ${Ii[e.id]} (or Shift+Arrow keys)`,"aria-label":`Resize ${Ii[e.id]}`,onPointerDown:t=>{let n=i.current;n&&r.onResizePointerDown(t,e.id,n)},children:(0,B.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,"aria-hidden":!0,children:[(0,B.jsx)(`path`,{d:`M10 0 L10 10 L0 10 Z`,fill:`currentColor`,fillOpacity:`0.4`}),(0,B.jsx)(`path`,{d:`M3 10 L10 3 M6 10 L10 6 M9 10 L10 9`,stroke:`currentColor`,strokeWidth:`0.8`,fill:`none`})]})})]})}var zi=(0,_.memo)(Ri);function Bi(e){let t=getComputedStyle(e),n=e.getBoundingClientRect(),r=parseFloat(t.rowGap||t.gap||`0`)||0,i=r*11;return{cellWidthPx:(n.width-i)/12+r,cellHeightPx:72+r}}function Vi(e){let t=(0,_.useRef)(null),n=(0,_.useRef)(e);n.current=e;let r=(0,_.useCallback)(()=>{let e=t.current;if(e){e.element.style.transform=``,e.element.style.width=``,e.element.style.height=``,e.element.style.zIndex=``,e.element.classList.remove(`grid-panel--dragging`),e.element.classList.remove(`grid-panel--resizing`);try{e.element.releasePointerCapture(e.pointerId)}catch{}t.current=null}},[]);(0,_.useEffect)(()=>{function e(e){let n=t.current;if(!n||e.pointerId!==n.pointerId)return;let r=e.clientX-n.startPointerX,i=e.clientY-n.startPointerY;if(n.mode===`drag`)n.element.style.transform=`translate3d(${r}px, ${i}px, 0)`;else{let e=Li[n.startPanel.id],t=e.minW*n.cellWidthPx-n.cellWidthPx+40,a=e.minH*n.cellHeightPx-n.cellHeightPx+40,o=Math.max(t,n.startRectW+r),s=Math.max(a,n.startRectH+i);n.element.style.width=`${o}px`,n.element.style.height=`${s}px`}}function i(e,t,n){let r=Li[e.startPanel.id];if(e.mode===`drag`){let r=Math.round(t/e.cellWidthPx),i=Math.round(n/e.cellHeightPx),a=e.startPanel.x+r,o=e.startPanel.y+i;return a<0&&(a=0),a+e.startPanel.w>12&&(a=12-e.startPanel.w),o<0&&(o=0),{id:e.id,x:a,y:o,w:e.startPanel.w,h:e.startPanel.h}}let i=Math.round(t/e.cellWidthPx),a=Math.round(n/e.cellHeightPx),o=e.startPanel.w+i,s=e.startPanel.h+a;return o<r.minW&&(o=r.minW),s<r.minH&&(s=r.minH),e.startPanel.x+o>12&&(o=12-e.startPanel.x),{id:e.id,x:e.startPanel.x,y:e.startPanel.y,w:o,h:s}}function a(e){let a=t.current;if(!a||e.pointerId!==a.pointerId)return;let o=i(a,e.clientX-a.startPointerX,e.clientY-a.startPointerY);r(),o.x===a.startPanel.x&&o.y===a.startPanel.y&&o.w===a.startPanel.w&&o.h===a.startPanel.h||n.current.onCommit(o)}function o(e){let n=t.current;!n||e.pointerId!==n.pointerId||r()}function s(e){e.key===`Escape`&&t.current&&r()}function c(){document.visibilityState===`hidden`&&t.current&&r()}return document.addEventListener(`pointermove`,e),document.addEventListener(`pointerup`,a),document.addEventListener(`pointercancel`,o),document.addEventListener(`keydown`,s),document.addEventListener(`visibilitychange`,c),()=>{document.removeEventListener(`pointermove`,e),document.removeEventListener(`pointerup`,a),document.removeEventListener(`pointercancel`,o),document.removeEventListener(`keydown`,s),document.removeEventListener(`visibilitychange`,c),t.current&&r()}},[r]);let i=(0,_.useCallback)((e,r,i,a)=>{if(!n.current.enabled||t.current)return;let o=n.current.getPanel(r),s=n.current.gridRef.current;if(!o||!s)return;e.preventDefault(),e.stopPropagation();let{cellWidthPx:c,cellHeightPx:l}=Bi(s),u=i.getBoundingClientRect();t.current={id:r,mode:a,startPointerX:e.clientX,startPointerY:e.clientY,startPanel:o,element:i,cellWidthPx:c,cellHeightPx:l,pointerId:e.pointerId,startRectW:u.width,startRectH:u.height},i.classList.add(a===`drag`?`grid-panel--dragging`:`grid-panel--resizing`),i.style.zIndex=`10`;try{i.setPointerCapture(e.pointerId)}catch{}},[]);return{onDragPointerDown:(0,_.useCallback)((e,t,n)=>i(e,t,n,`drag`),[i]),onResizePointerDown:(0,_.useCallback)((e,t,n)=>i(e,t,n,`resize`),[i]),onPanelKeyDown:(0,_.useCallback)((e,t)=>{if(!n.current.enabled)return;let r=n.current.getPanel(t);if(!r)return;let i=e.shiftKey,a=0,o=0;switch(e.key){case`ArrowLeft`:a=-1;break;case`ArrowRight`:a=1;break;case`ArrowUp`:o=-1;break;case`ArrowDown`:o=1;break;default:return}e.preventDefault(),e.stopPropagation();let s=Li[t];if(i){let e=r.w+a,i=r.h+o;if(e<s.minW&&(e=s.minW),i<s.minH&&(i=s.minH),r.x+e>12&&(e=12-r.x),e===r.w&&i===r.h)return;n.current.onCommit({id:t,x:r.x,y:r.y,w:e,h:i})}else{let e=r.x+a,i=r.y+o;if(e<0&&(e=0),e+r.w>12&&(e=12-r.w),i<0&&(i=0),e===r.x&&i===r.y)return;n.current.onCommit({id:t,x:e,y:i,w:r.w,h:r.h})}},[]),isGesturing:(0,_.useCallback)(()=>t.current!==null,[])}}function Hi(e,t){return e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y}function Ui(e){return{id:e.id,x:e.x,y:e.y,w:e.w,h:e.h}}function Wi(e,t){let n=[Ui(e)],r=t.map(Ui);r.sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y);for(let e of r){for(;;){let t=!1;for(let r of n)if(Hi(e,r)){let n=r.y+r.h;n>e.y&&(e.y=n,t=!0)}if(!t)break}n.push(e)}return n}function Gi(e){if(e.length===0)return[];let t=[...e].map(Ui).sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y),n=[];for(let e of t){let t=!0;for(;t;){t=!1;for(let r of n)Hi(e,r)&&(e.y=r.y+r.h,t=!0)}n.push(e)}return n}function Ki(e,t,n){let r=e.findIndex(e=>e.id===t);if(r===-1)return{panels:e.map(Ui)};let i=Wi({id:e[r].id,x:n.x,y:n.y,w:n.w,h:n.h},e.filter((e,t)=>t!==r)),a=new Map(i.map(e=>[e.id,e]));return{panels:Gi(e.map(e=>a.get(e.id)).filter(Boolean))}}function qi({panels:e,isEditing:t,renderers:n,onPanelsChange:r}){let i=(0,_.useRef)(null),a=(0,_.useRef)(e);a.current=e;let o=(0,_.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n);return t},[e]),s=Vi({gridRef:i,getPanel:(0,_.useCallback)(e=>o.get(e),[o]),onCommit:(0,_.useCallback)(e=>{let t=a.current,{panels:n}=Ki(t,e.id,{x:e.x,y:e.y,w:e.w,h:e.h});r(n)},[r]),enabled:t});return(0,B.jsx)(`div`,{ref:i,className:`grid-layout ${t?`grid-layout--editing`:``}`,"aria-live":t?`polite`:void 0,children:e.map(e=>(0,B.jsx)(zi,{panel:e,isEditing:t,drag:s,children:n[e.id]()},e.id))})}function Ji({manager:e,isEditing:t,onToggleEditing:n}){let{config:r,activeLayout:i,canAddUserLayout:a,saveError:o,selectLayout:s,saveAs:c,renameActive:l,deleteLayout:u,resetActive:d,exportConfig:f,importConfig:p}=e,[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(``),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(i.name),[T,E]=(0,_.useState)(!1),[ee,D]=(0,_.useState)(!1),te=(0,_.useRef)(null);(0,_.useEffect)(()=>{w(i.name)},[i.name]),(0,_.useEffect)(()=>{o&&h(o)},[o]),(0,_.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>h(null),4e3);return()=>clearTimeout(e)},[m]);function ne(){y.trim()&&(c(y.trim()),b(``),v(!1),h(`Saved "${y.trim()}"`))}function O(){C.trim()&&(l(C.trim()),S(!1),h(`Renamed`))}function re(){let e=i.name;u(i.id),D(!1),h(`Deleted "${e}"`)}function ie(){d(),E(!1),h(`Reset to default`)}function ae(){let e=f(),t=new Blob([e],{type:`application/json`}),n=URL.createObjectURL(t),r=new Date().toISOString().slice(0,10),i=document.createElement(`a`);i.href=n,i.download=`ssg-layout-${r}.json`,i.click(),URL.revokeObjectURL(n),h(`Layout exported`)}function oe(e){let t=e.target.files?.[0];e.target.value=``,t&&t.text().then(e=>{h(p(e).message)}).catch(()=>h(`Import failed: could not read file`))}return(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,B.jsx)(`span`,{className:`overline shrink-0`,children:`layout`}),(0,B.jsxs)(`select`,{value:r.activeLayoutId,onChange:e=>s(e.target.value),className:`bg-[var(--color-surface-2)] border border-[var(--color-line-1)] rounded-sm px-2 py-1 text-[11px] font-mono text-[var(--color-fg-1)] hover:border-[var(--color-line-2)] focus:outline-none focus:ring-1 focus:ring-[var(--color-brand)] cursor-pointer`,"aria-label":`Select layout`,children:[(0,B.jsx)(`optgroup`,{label:`Built-in`,children:r.layouts.filter(e=>e.builtIn).map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.name},e.id))}),r.layouts.some(e=>!e.builtIn)&&(0,B.jsx)(`optgroup`,{label:`Your layouts`,children:r.layouts.filter(e=>!e.builtIn).map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),i.builtIn&&(0,B.jsx)(`span`,{className:`chip text-[var(--color-fg-3)]`,title:`Built-in preset`,children:`built-in`})]}),(0,B.jsx)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:t?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(W,{variant:`secondary`,size:`sm`,onClick:()=>v(!0),disabled:!a,title:a?`Save the current arrangement as a new preset`:`Layout limit reached — delete one first`,children:[(0,B.jsx)(ji,{size:11,strokeWidth:2.25}),`Save as`]}),!i.builtIn&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:()=>{w(i.name),S(!0)},children:[(0,B.jsx)(ki,{size:11,strokeWidth:2.25}),`Rename`]}),(0,B.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:()=>D(!0),children:[(0,B.jsx)(Mi,{size:11,strokeWidth:2.25}),`Delete`]})]}),(0,B.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:()=>E(!0),title:`Replace the current layout with the Default preset`,children:[(0,B.jsx)(Ai,{size:11,strokeWidth:2.25}),`Reset`]}),(0,B.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:ae,title:`Download current layouts as JSON`,children:[(0,B.jsx)(K,{size:11,strokeWidth:2.25}),`Export`]}),(0,B.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:()=>te.current?.click(),title:`Load layouts from a JSON file`,children:[(0,B.jsx)(Ni,{size:11,strokeWidth:2.25}),`Import`]}),(0,B.jsx)(`input`,{ref:te,type:`file`,accept:`application/json,.json`,onChange:oe,className:`hidden`,"aria-hidden":!0}),(0,B.jsxs)(W,{variant:`primary`,size:`sm`,onClick:()=>n(!1),children:[(0,B.jsx)(Di,{size:11,strokeWidth:2.5}),`Done`]})]}):(0,B.jsxs)(W,{variant:`secondary`,size:`sm`,onClick:()=>n(!0),children:[(0,B.jsx)(ki,{size:11,strokeWidth:2.25}),`Edit layout`]})}),g&&(0,B.jsx)(Yi,{title:`Save layout as`,value:y,placeholder:`My dashboard`,onChange:b,onConfirm:ne,onCancel:()=>{v(!1),b(``)},confirmLabel:`Save`}),x&&(0,B.jsx)(Yi,{title:`Rename layout`,value:C,placeholder:i.name,onChange:w,onConfirm:O,onCancel:()=>S(!1),confirmLabel:`Rename`}),T&&(0,B.jsx)(Xi,{title:`Reset this layout?`,body:`The current arrangement will be replaced with the Default preset. Saved layouts are not affected.`,confirmLabel:`Reset`,onConfirm:ie,onCancel:()=>E(!1),destructive:!1}),ee&&(0,B.jsx)(Xi,{title:`Delete "${i.name}"?`,body:`This layout will be removed. You can always recreate it via Save as.`,confirmLabel:`Delete`,onConfirm:re,onCancel:()=>D(!1),destructive:!0}),m&&(0,B.jsx)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 -translate-x-1/2 z-50 rounded-sm border border-[var(--color-line-2)] bg-[var(--color-surface-3)] px-3 py-2 text-[11px] font-mono text-[var(--color-fg-1)] shadow-lg`,children:m})]})}function Yi({title:e,value:t,placeholder:n,onChange:r,onConfirm:i,onCancel:a,confirmLabel:o}){return(0,B.jsx)(`div`,{role:`dialog`,"aria-modal":!0,"aria-label":e,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:a,children:(0,B.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`w-80 rounded-sm border border-[var(--color-line-2)] bg-[var(--color-surface-2)] p-4`,children:[(0,B.jsx)(`div`,{className:`overline mb-2`,children:e}),(0,B.jsx)(`input`,{value:t,onChange:e=>r(e.target.value),placeholder:n,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&i(),e.key===`Escape`&&a()},className:`w-full bg-[var(--color-surface-1)] border border-[var(--color-line-1)] rounded-sm px-2 py-1.5 text-[13px] font-mono text-[var(--color-fg-1)] focus:outline-none focus:border-[var(--color-brand)]`}),(0,B.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,B.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:a,children:[(0,B.jsx)(Pi,{size:11,strokeWidth:2.25}),`Cancel`]}),(0,B.jsx)(W,{variant:`primary`,size:`sm`,onClick:i,children:o})]})]})})}function Xi({title:e,body:t,confirmLabel:n,destructive:r,onConfirm:i,onCancel:a}){return(0,B.jsx)(`div`,{role:`dialog`,"aria-modal":!0,"aria-label":e,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:a,children:(0,B.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`w-96 rounded-sm border border-[var(--color-line-2)] bg-[var(--color-surface-2)] p-4`,children:[(0,B.jsx)(`div`,{className:`overline mb-2`,children:e}),(0,B.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:t}),(0,B.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),(0,B.jsx)(W,{variant:r?`danger`:`primary`,size:`sm`,onClick:i,children:n})]})]})})}var Zi={default:`builtin-default`,focusLatency:`builtin-focus-latency`,focusApprovals:`builtin-focus-approvals`,compact:`builtin-compact`},Qi={id:Zi.default,name:`Default`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:1},{id:`graph`,x:0,y:1,w:8,h:5},{id:`latency-trace`,x:8,y:1,w:4,h:3},{id:`throughput`,x:8,y:4,w:2,h:2},{id:`decision-mix`,x:10,y:4,w:2,h:2},{id:`telemetry-feed`,x:0,y:6,w:12,h:3},{id:`system-pulse`,x:0,y:9,w:12,h:3},{id:`pending-approvals`,x:0,y:12,w:6,h:3},{id:`recent-blocks`,x:6,y:12,w:6,h:3}]},$i={id:Zi.focusLatency,name:`Focus · Latency`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:1},{id:`latency-trace`,x:0,y:1,w:8,h:5},{id:`graph`,x:8,y:1,w:4,h:5},{id:`throughput`,x:0,y:6,w:6,h:2},{id:`decision-mix`,x:6,y:6,w:6,h:2},{id:`system-pulse`,x:0,y:8,w:12,h:3},{id:`telemetry-feed`,x:0,y:11,w:12,h:3},{id:`pending-approvals`,x:0,y:14,w:6,h:2},{id:`recent-blocks`,x:6,y:14,w:6,h:2}]},ea={id:Zi.focusApprovals,name:`Focus · Approvals`,builtIn:!0,panels:[{id:`pending-approvals`,x:0,y:0,w:8,h:4},{id:`graph`,x:8,y:0,w:4,h:4},{id:`recent-blocks`,x:0,y:4,w:12,h:3},{id:`hero-metrics`,x:0,y:7,w:12,h:1},{id:`latency-trace`,x:0,y:8,w:6,h:3},{id:`telemetry-feed`,x:6,y:8,w:6,h:3},{id:`system-pulse`,x:0,y:11,w:12,h:3},{id:`throughput`,x:0,y:14,w:6,h:2},{id:`decision-mix`,x:6,y:14,w:6,h:2}]},ta={id:Zi.compact,name:`Compact`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:1},{id:`graph`,x:0,y:1,w:8,h:3},{id:`latency-trace`,x:8,y:1,w:4,h:3},{id:`system-pulse`,x:0,y:4,w:12,h:3},{id:`throughput`,x:0,y:7,w:4,h:2},{id:`decision-mix`,x:4,y:7,w:4,h:2},{id:`telemetry-feed`,x:0,y:9,w:12,h:3},{id:`pending-approvals`,x:0,y:12,w:6,h:2},{id:`recent-blocks`,x:6,y:12,w:6,h:2}]},na=Object.freeze([Qi,$i,ea,ta]);function ra(){return na.map(e=>({...e,panels:e.panels.map(e=>({...e}))}))}function ia(){return{version:1,activeLayoutId:Zi.default,layouts:ra()}}function aa(e){return Object.values(Zi).includes(e)}var oa=new Set(Fi),sa=new Set(na.map(e=>e.id));function ca(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function la(e,t,n,r){if(typeof e!=`number`||!Number.isFinite(e))return r;let i=Math.floor(e);return i<t?t:i>n?n:i}function ua(e,t){let n=(typeof e==`string`?e:``).replace(/[\u0000-\u001F\u007F]/g,``).trim();return n.length===0?t:n.slice(0,40)}function da(e){let t=e.find(e=>e.id===`system-pulse`);if(!t||t.h>=3)return e;let n=3-t.h,r=t.y+t.h;return e.map(e=>e.id===`system-pulse`?{...e,h:3}:e.y>=r?{...e,y:e.y+n}:e)}function fa(e){for(let t=0;t<e.length;t++){let n=e[t];for(let r=t+1;r<e.length;r++){let t=e[r];if(n.x<t.x+t.w&&n.x+n.w>t.x&&n.y<t.y+t.h&&n.y+n.h>t.y)return!0}}return!1}function pa(e){if(!ca(e))return null;let{id:t}=e;if(typeof t!=`string`||!oa.has(t))return null;let n=t,r=Li[n],i=la(e.x,0,11,0),a=la(e.w,r.minW,12,r.defaultW);return{id:n,x:i+a>12?12-a:i,y:la(e.y,0,999,0),w:a,h:la(e.h,r.minH,99,r.defaultH)}}function ma(e,t){if(!ca(e))return{layout:null,droppedPanels:0};let n=typeof e.id==`string`&&e.id.length>0?e.id:null;if(!n)return{layout:null,droppedPanels:0};let r=ua(e.name,t),i=sa.has(n),a=e.panels;if(!Array.isArray(a))return{layout:null,droppedPanels:0};let o=new Set,s=[],c=0;for(let e of a){let t=pa(e);if(!t){c+=1;continue}if(o.has(t.id)){c+=1;continue}o.add(t.id),s.push(t)}return s.length===0?{layout:null,droppedPanels:c}:{layout:{id:n,name:r,builtIn:i,panels:da(s)},droppedPanels:c}}function ha(e){if(!ca(e)||e.version!==1)return{config:ia(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0};let t=e.layouts;if(!Array.isArray(t)||t.length===0)return{config:ia(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0};let n=[],r=0,i=0,a=0;for(let e of t){let{layout:t,droppedPanels:o}=ma(e,`Layout ${n.length+1}`);if(r+=o,t){if(!t.builtIn){if(i>=12){a+=1;continue}i+=1}n.push(t)}}if(n.length===0)return{config:ia(),droppedPanels:r,prunedLayouts:a,fellBackToDefault:!0};let o=new Set(n.map(e=>e.id));for(let e of na)o.has(e.id)||n.push({...e,panels:e.panels.map(e=>({...e}))});let s=new Map(na.map(e=>[e.id,e])),c=0,l=0;for(let e=0;e<n.length;e++){let t=n[e],r=s.get(t.id);if(!r)continue;if(fa(t.panels)){n[e]={...r,panels:r.panels.map(e=>({...e}))},l+=1;continue}let i=new Set(t.panels.map(e=>e.id)),a=r.panels.filter(e=>!i.has(e.id));if(a.length===0)continue;let o=t.panels.reduce((e,t)=>Math.max(e,t.y+t.h),0);for(let e of a)t.panels.push({id:e.id,x:0,y:o,w:e.w,h:e.h}),o+=e.h,c+=1}let u=e.activeLayoutId;return{config:{version:1,activeLayoutId:typeof u==`string`&&n.some(e=>e.id===u)?u:na[0].id,layouts:n},droppedPanels:r,prunedLayouts:a,fellBackToDefault:!1,backfilledPanels:c,refreshedBuiltins:l}}var ga=`ssg:dashboard-layout:v1`,_a=300;function va(){if(typeof localStorage>`u`)return null;try{let e=`__ssg_probe__`;return localStorage.setItem(e,`1`),localStorage.removeItem(e),localStorage}catch{return null}}var ya;function ba(){return ya===void 0&&(ya=va()),ya}function xa(){let e=ba();if(!e)return{config:ia(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!1};let t=null;try{t=e.getItem(ga)}catch{t=null}if(t===null)return{config:ia(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!1};let n=null;try{n=JSON.parse(t)}catch{return{config:ia(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0}}return ha(n)}var Sa=null,Ca=null,wa=null;function Ta(e){return wa=e,()=>{wa===e&&(wa=null)}}function Ea(e){wa?wa(e):typeof console<`u`&&console.warn(`[ssg-layout]`,e)}function Da(){if(Ca=null,!Sa)return;let e=ba();if(!e){Sa=null;return}let t=Sa;Sa=null;try{e.setItem(ga,JSON.stringify(t))}catch(e){e instanceof Error&&e.name===`QuotaExceededError`?Ea(`Layout storage full — save skipped`):Ea(`Layout save failed: ${e instanceof Error?e.message:String(e)}`)}}function Oa(e){Sa=e,Ca===null&&(Ca=setTimeout(Da,_a))}function ka(e){Sa=e,Ca!==null&&(clearTimeout(Ca),Ca=null),Da()}function Aa(e){let t=0;for(let n of e.layouts)n.builtIn||(t+=1);return t}function ja(e){return e.map(e=>({...e}))}function Ma(){return`user-`+Math.random().toString(16).slice(2,11)}function Na(){let[e,t]=(0,_.useState)(()=>xa().config),[n,r]=(0,_.useState)(null);(0,_.useEffect)(()=>Ta(e=>r(e)),[]),(0,_.useEffect)(()=>{Oa(e)},[e]);let i=e.layouts.find(t=>t.id===e.activeLayoutId)??e.layouts[0]??ra()[0],a=Aa(e)<12,o=(0,_.useCallback)(e=>{t(t=>t.layouts.some(t=>t.id===e)?{...t,activeLayoutId:e}:t)},[]),s=(0,_.useCallback)(e=>{t(t=>{let n=t.activeLayoutId;return{...t,layouts:t.layouts.map(t=>t.id===n?{...t,panels:ja(e)}:t)}})},[]),c=(0,_.useCallback)(e=>{let n=e.trim();n&&t(e=>{if(Aa(e)>=12)return e;let t=e.layouts.find(t=>t.id===e.activeLayoutId)??e.layouts[0];if(!t)return e;let r={id:Ma(),name:n,builtIn:!1,panels:ja(t.panels)};return{...e,activeLayoutId:r.id,layouts:[...e.layouts,r]}})},[]),l=(0,_.useCallback)(e=>{let n=e.trim();n&&t(e=>({...e,layouts:e.layouts.map(t=>t.id===e.activeLayoutId&&!t.builtIn?{...t,name:n}:t)}))},[]),u=(0,_.useCallback)(e=>{t(t=>{let n=t.layouts.find(t=>t.id===e);if(!n||n.builtIn)return t;let r=t.layouts.filter(t=>t.id!==e),i=t.activeLayoutId===e?r[0]?.id??na[0].id:t.activeLayoutId;return{...t,activeLayoutId:i,layouts:r}})},[]),d=(0,_.useCallback)(()=>{t(e=>{let t=e.layouts.find(t=>t.id===e.activeLayoutId);if(!t)return e;let n=aa(t.id)?na.find(e=>e.id===t.id):na[0];return n?{...e,layouts:e.layouts.map(e=>e.id===t.id?{...e,panels:ja(n.panels)}:e)}:e})},[]),f=(0,_.useCallback)(()=>JSON.stringify(e,null,2),[e]),p=(0,_.useCallback)(e=>{let n;try{n=JSON.parse(e)}catch{return{ok:!1,message:`Import failed: not valid JSON`}}let r=ha(n);if(r.fellBackToDefault)return{ok:!1,message:`Import rejected: schema invalid, no changes applied`};t(r.config),ka(r.config);let i=[`Layout imported`];return r.droppedPanels>0&&i.push(`${r.droppedPanels} unrecognized panel(s) dropped`),r.prunedLayouts>0&&i.push(`${r.prunedLayouts} excess layout(s) pruned`),{ok:!0,message:i.join(` · `)}},[]);return(0,_.useEffect)(()=>{e.layouts.length===0&&t(ia())},[e.layouts.length]),{config:e,activeLayout:i,canAddUserLayout:a,saveError:n,selectLayout:o,updateActivePanels:s,saveAs:c,renameActive:l,deleteLayout:u,resetActive:d,exportConfig:f,importConfig:p}}var Pa=Object.freeze({allow:`#22c55e`,block:`#ef4444`,ask:`#f59e0b`,log:`#60a5fa`,force:`#a855f7`,shadow:`#6b7280`}),Fa=5*6e4,Ia=1200,La=28,Ra=22,za=.04,Ba=.2,Va=.82;function Ha(e,t,n){let r=new Map;for(let t of e){if(t.exitingAt!=null)continue;let e=r.get(t.session);e?e.push(t):r.set(t.session,[t])}let i=0;for(let e of r.values())e.length>i&&(i=e.length);let a=Math.min(t,n)-20,o=i>1?Math.min(Ra,(a-La)/(i-1)):Ra,s=Array.from(r.keys()).sort();for(let e=0;e<s.length;e++){let i=s[e],a=r.get(i);if(!a)continue;a.sort((e,t)=>e.ts_ms-t.ts_ms);let c=2*Math.PI*(e*.6180339887%1);for(let e=0;e<a.length;e++){let r=a[e];if(!r)continue;let i=La+o*e,s=c+za*e;r.tx=t+i*Math.cos(s),r.ty=n+i*Math.sin(s)}}}function Ua(e,t){for(let n of e)n.tx==null||n.ty==null||(n.vx=(n.vx+(n.tx-n.x)*Ba*t)*Va,n.vy=(n.vy+(n.ty-n.y)*Ba*t)*Va,n.x+=n.vx*t,n.y+=n.vy*t)}var Wa=Object.freeze({repulsion:2500,springLength:80,springStiffness:.04,damping:.85,centeringStrength:.005,sessionCohesion:.01,width:800,height:600});function Ga(e){let t=new Map;for(let n of e){let e=t.get(n.session);e?(e.x+=n.x,e.y+=n.y,e.n+=1):t.set(n.session,{x:n.x,y:n.y,n:1})}for(let e of t.values())e.x/=e.n,e.y/=e.n;return t}function Ka(e,t,n,r){if(e.length===0)return;let i=new Map;for(let t of e)i.set(t.id,t);let a=Ga(e),o=n.width/2,s=n.height/2;for(let t of e)t.vx*=n.damping,t.vy*=n.damping;for(let t=0;t<e.length;t++){let i=e[t];if(i)for(let a=t+1;a<e.length;a++){let t=e[a];if(!t)continue;let o=i.x-t.x,s=i.y-t.y,c=o*o+s*s;c<1&&(c=1);let l=n.repulsion/c,u=Math.sqrt(c),d=o/u*l,f=s/u*l;i.vx+=d*r,i.vy+=f*r,t.vx-=d*r,t.vy-=f*r}}for(let e of t){let t=i.get(e.source),a=i.get(e.target);if(!t||!a)continue;let o=a.x-t.x,s=a.y-t.y,c=Math.sqrt(o*o+s*s)||1,l=(c-n.springLength)*n.springStiffness,u=o/c*l,d=s/c*l;t.vx+=u*r,t.vy+=d*r,a.vx-=u*r,a.vy-=d*r}for(let t of e){t.vx+=(o-t.x)*n.centeringStrength*r,t.vy+=(s-t.y)*n.centeringStrength*r;let e=a.get(t.session);e&&(t.vx+=(e.x-t.x)*n.sessionCohesion*r,t.vy+=(e.y-t.y)*n.sessionCohesion*r)}for(let t of e)t.vx>20&&(t.vx=20),t.vx<-20&&(t.vx=-20),t.vy>20&&(t.vy=20),t.vy<-20&&(t.vy=-20),t.x+=t.vx*r,t.y+=t.vy*r,t.x<20?(t.x=20,t.vx=Math.abs(t.vx)*.5):t.x>n.width-20&&(t.x=n.width-20,t.vx=-Math.abs(t.vx)*.5),t.y<20?(t.y=20,t.vy=Math.abs(t.vy)*.5):t.y>n.height-20&&(t.y=n.height-20,t.vy=-Math.abs(t.vy)*.5)}function qa(e,t){let n=[],r=new Map;for(let t of e){let e=r.get(t.session);e?e.push(t):r.set(t.session,[t])}for(let e of r.values()){e.sort((e,t)=>e.ts_ms-t.ts_ms);for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r];!i||!a||a.ts_ms-i.ts_ms<=t&&n.push({source:i.id,target:a.id,kind:`session`})}}return n}function Ja(e){let t=e|0;return()=>{t=t+1831565813|0;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}var Ya={"claude-code":`C`,"claude-code-ide":`C`,cursor:`>`,copilot:`H`,codex:`X`,pi:`P`,gemini:`G`,antigravity:`A`};function Xa(e){return Ya[e.toLowerCase()]??`.`}function Za(e){let t=0;for(let n=0;n<e.length;n++)t=Math.imul(t,31)+e.charCodeAt(n)|0;return(t>>>0)%360}function Qa(e,t){for(let[n,r]of t){let{x:t,y:i,n:a}=r,o=50+Math.min(a,12)*7,s=Za(n),c=e.createRadialGradient(t,i,0,t,i,o);c.addColorStop(0,`hsla(${s},80%,55%,0.10)`),c.addColorStop(1,`hsla(${s},80%,55%,0)`),e.fillStyle=c,e.beginPath(),e.arc(t,i,o,0,Math.PI*2),e.fill()}}var $a={block:{spikes:4,maxR:22},force:{spikes:8,maxR:32}};function eo(e,t,n,r,i,a){let o=$a[i];if(!o)return;let{spikes:s,maxR:c}=o,l=c*r,u=Math.max(0,1-r)*.75;if(u<=0)return;let d=Pa[i]??`#6b7280`;e.save(),e.globalAlpha=u,e.strokeStyle=d,e.lineWidth=1.5,e.translate(t,n),e.rotate(a);let f=l*.28;e.beginPath();for(let t=0;t<s;t++){let n=t/s*Math.PI*2,r=n+Math.PI/s;t===0&&e.moveTo(Math.cos(r)*f,Math.sin(r)*f),e.lineTo(Math.cos(n)*l,Math.sin(n)*l),e.lineTo(Math.cos(r)*f,Math.sin(r)*f)}e.closePath(),e.stroke(),e.restore()}function to(e,t,n,r,i,a,o){let s=8+a*r,c=Math.max(0,1-r)*o;c<=0||(e.save(),e.globalAlpha=c,e.fillStyle=i,e.beginPath(),e.arc(t,n,s,0,Math.PI*2),e.fill(),e.restore())}var no=`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,ro=`bold 10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;function io(e,t,n,r,i,a,o){let s=(r.split(`:`)[0]??r).slice(0,18),c=Xa(s),l=Za(r),u=Pa[o]??`#6b7280`;e.save(),e.textAlign=`center`;let d=`[${c}] ${s}`,f=`${i.length>14?i.slice(0,14):i} · ${a}`;e.font=ro;let p=e.measureText(d).width;e.font=no;let m=e.measureText(f).width,h=Math.max(p,m)+10;e.globalAlpha=.82,e.fillStyle=`hsla(${l},25%,5%,0.92)`,e.fillRect(t-h/2,n-2,h,28),e.globalAlpha=.92,e.fillStyle=`hsla(${l},78%,70%,1)`,e.font=ro,e.fillText(d,t,n+10),e.globalAlpha=.72,e.fillStyle=u,e.font=no,e.fillText(f,t,n+21),e.restore()}function ao(e,t,n,r,i,a,o){let s=r-t,c=i-n;if(Math.sqrt(s*s+c*c)<24)return;let l=Math.atan2(c,s),u=3.5,d=r-Math.cos(l)*9,f=i-Math.sin(l)*9;e.save(),e.globalAlpha=o*.85,e.fillStyle=a,e.translate(d,f),e.rotate(l),e.beginPath(),e.moveTo(0,0),e.lineTo(-6,-u),e.lineTo(-6,u),e.closePath(),e.fill(),e.restore()}var q=240,J=Array.from({length:q},()=>({x:0,y:0,vx:0,vy:0,life:0,decay:.02,color:`#fff`,size:2})),oo=0;function so(e,t,n,r,i=6){let a=Ja(r);for(let r=0;r<i;r++){let o=oo%q;oo++;let s=J[o];if(!s)continue;let c=r/i*Math.PI*2+a()*.6,l=1.2+a()*2;s.x=e+(a()-.5)*4,s.y=t+(a()-.5)*4,s.vx=Math.cos(c)*l,s.vy=Math.sin(c)*l,s.life=1,s.decay=.016+a()*.014,s.color=n,s.size=1.5+a()*2}}function co(e){for(let t of J){if(t.life<=0)continue;t.x+=t.vx,t.y+=t.vy,t.vx*=.93,t.vy*=.93,t.life-=t.decay;let n=Math.max(0,t.life)*.65;n<=0||(e.globalAlpha=n,e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,Math.max(.1,t.size),0,Math.PI*2),e.fill())}e.globalAlpha=1}function lo(){return{amplitude:0,startedAt:0,durationMs:0}}function uo(e,t,n){e.amplitude=t,e.startedAt=performance.now(),e.durationMs=n}function fo(e,t,n){if(t.amplitude<=0)return!1;let r=performance.now()-t.startedAt;if(r>=t.durationMs)return!1;let i=t.amplitude*Math.max(0,1-r/t.durationMs);return e.translate((n()-.5)*i*2,(n()-.5)*i*2),!0}var po=420,mo=He(1.7),ho=620,go=We(1.2,.5),_o=et({stiffness:90,damping:7,mass:1});function vo(e,t,n,r){let i=new Map;for(let t of e)i.set(t.id,t);let a=new Set,o=[];for(let e=0;e<t.length;e++){let s=t[e],c=s.audit_id??`${s.ts_ms}:${s.tool}:${e}`;a.add(c);let l=i.get(c);if(l)l.burst=s,l.exitingAt=void 0,o.push(l);else{let t=Ja(s.ts_ms^e),i=n*.6+(t()-.5)*60,a=r/2+(t()-.5)*40,l=`${s.client}:${s.agent_id??`solo`}`;o.push({id:c,burst:s,ts_ms:s.ts_ms,session:l,x:i,y:a,vx:(t()-.5)*2,vy:(t()-.5)*2,age:0,tx:i,ty:a})}}let s=performance.now();for(let t of e)a.has(t.id)||(t.exitingAt??=s,s-t.exitingAt<1200&&o.push(t));return o}function yo(e){let{bursts:t,paused:n,selectedId:r,onSelect:i,burstSeq:a,layout:o=`spiral`}=e,s=(0,_.useRef)(null),c=(0,_.useRef)([]),l=(0,_.useRef)([]),u=(0,_.useRef)({...Wa}),d=(0,_.useRef)(null),f=(0,_.useRef)(lo()),[p,m]=(0,_.useState)({w:800,h:560});(0,_.useEffect)(()=>{let e=s.current?.parentElement;if(!e)return;let t=new ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;m({w:Math.max(40,e),h:Math.max(40,n)})}});return t.observe(e),()=>t.disconnect()},[]),(0,_.useEffect)(()=>{let e=new Map;for(let t of c.current)e.set(t.id,t);if(c.current=vo(c.current,t,p.w,p.h),o===`spiral`){Ha(c.current,p.w/2,p.h/2);for(let t of c.current)!e.has(t.id)&&t.tx!=null&&t.ty!=null&&(t.x=t.tx,t.y=t.ty)}if(l.current=qa(c.current,12e4),u.current.width=p.w,u.current.height=p.h,!pt())for(let t=0;t<c.current.length;t++){let n=c.current[t];if(!n||e.has(n.id))continue;let r=Pa[n.burst.decision]??`#6b7280`;so(n.x,n.y,r,n.burst.ts_ms^t),n.burst.decision===`block`?uo(f.current,4,280):n.burst.decision===`force`&&uo(f.current,6,280)}},[t,p.w,p.h,a,o]),(0,_.useEffect)(()=>{let e=s.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let i=0,a=performance.now(),m=()=>{let s=performance.now(),h=Math.min(50,s-a);a=s;let g=Math.max(.5,Math.min(2,h/16.67)),_=c.current,v=l.current;n||(o===`force`?Ka(_,v,u.current,g):(Ha(_,u.current.width/2,u.current.height/2),Ua(_,g)));for(let e of _)e.age<1&&(e.age=Math.min(1,e.age+h/po));let y=window.devicePixelRatio||1,b=p.w,x=p.h;(e.width!==b*y||e.height!==x*y)&&(e.width=b*y,e.height=x*y,e.style.width=`${b}px`,e.style.height=`${x}px`,t.scale(y,y)),t.fillStyle=`#0a0a0f`,t.fillRect(0,0,b,x);let S=t.createRadialGradient(b/2,x/2,0,b/2,x/2,Math.max(b,x)/1.2);S.addColorStop(0,`rgba(56, 189, 248, 0.06)`),S.addColorStop(1,`rgba(0, 0, 0, 0)`),t.fillStyle=S,t.fillRect(0,0,b,x);let C=pt();if(t.save(),!C){let e=Ja((f.current.startedAt+s)*.01|0);fo(t,f.current,e)}let w=Ga(_);if(Qa(t,w),!C){let e=new Map,n=new Map;for(let t of _)t.exitingAt??(n.set(t.session,(n.get(t.session)??0)+1),e.set(t.session,t));for(let[r,i]of w){let a=e.get(r),o=n.get(r)??0;if(!a||o===0)continue;let s=50+Math.min(i.n,12)*7;io(t,i.x,i.y+s+8,r,a.burst.tool,o,a.burst.decision)}}let T=e=>e.exitingAt==null?1:Math.max(0,1-(s-e.exitingAt)/Ia);C||co(t);let E=new Map;for(let e of _)E.set(e.id,e);t.lineWidth=2;for(let e=0;e<v.length;e++){let n=v[e],r=E.get(n.source),i=E.get(n.target);if(!r||!i)continue;let a=Pa[i.burst.decision]??`#6b7280`,o=Math.min(T(r),T(i));if(!(o<=0)&&(t.globalAlpha=o,t.strokeStyle=a+`aa`,t.beginPath(),t.moveTo(r.x,r.y),t.lineTo(i.x,i.y),t.stroke(),!C)){let n=(s/1800+e*.618033)%1,c=r.x+(i.x-r.x)*n,l=r.y+(i.y-r.y)*n;t.save(),t.globalAlpha=o*Math.sin(n*Math.PI)*.9,t.fillStyle=a,t.beginPath(),t.arc(c,l,2.5,0,Math.PI*2),t.fill(),t.restore(),ao(t,r.x,r.y,i.x,i.y,a,o)}}t.globalAlpha=1;let ee=new Set,D=new Set,te=0,ne=0;for(let e=_.length-1;e>=0;e--){let t=_[e];if(!(!t||t.exitingAt!=null)&&(te<20&&(ee.add(t.id),te++),ne<8&&(D.add(t.id),ne++),te>=20&&ne>=8))break}let O=r,re=d.current;for(let e of _){let n=T(e);if(n<=0)continue;t.globalAlpha=n;let r=Math.min(1,e.age),i=mo(r),a=(6+2*Math.min(1,e.age))*i,o=Pa[e.burst.decision]??`#6b7280`;if((e.id===O||e.id===re)&&(t.beginPath(),t.arc(e.x,e.y,a+6,0,Math.PI*2),t.fillStyle=o+`33`,t.fill()),!C)if(e.burst.decision===`block`||e.burst.decision===`force`){let n=r;eo(t,e.x,e.y,n,e.burst.decision,s*.002)}else e.burst.decision===`allow`?to(t,e.x,e.y,r,`#22c55e`,14,.3):e.burst.decision===`ask`&&to(t,e.x,e.y,r,`#f59e0b`,14,.45);if(e.burst.decision===`block`||e.burst.decision===`force`){let n=r*po;if(n<ho){let r=n/ho,i=a+16*go(r),s=Math.max(0,1-r)*.75;t.beginPath(),t.arc(e.x,e.y,i,0,Math.PI*2),t.strokeStyle=o+Math.floor(s*255).toString(16).padStart(2,`0`),t.lineWidth=1.5,t.stroke()}}let c=!C&&ee.has(e.id);if(c&&(t.save(),t.shadowColor=o,t.shadowBlur=18*(1-r*.5)),t.beginPath(),t.arc(e.x,e.y,Math.max(.1,a),0,Math.PI*2),t.fillStyle=o,t.fill(),c&&(t.shadowBlur=0,t.restore()),t.strokeStyle=`#00000066`,t.lineWidth=1,t.stroke(),D.has(e.id)){t.font=`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.textAlign=`center`,t.fillStyle=o+`cc`,t.fillText(Xa(e.burst.client),e.x,e.y-a-3);let n=e.burst.tool.length>12?e.burst.tool.slice(0,12):e.burst.tool;t.fillStyle=o+`88`,t.fillText(n,e.x,e.y+a+11),t.textAlign=`left`}(e.id===O||e.id===re)&&(t.font=`11px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.fillStyle=`#e0e7ff`,t.fillText(e.burst.tool,e.x+a+6,e.y+3))}if(t.globalAlpha=1,_.length>0&&!n){let e=null;for(let t=_.length-1;t>=0;t--)if(_[t].exitingAt==null){e=_[t];break}if(e){let n=1100,r=s%n/n,i=10+_o.fn(r)*6,a=Math.max(0,1-r)*.9,o=Math.floor(a*200).toString(16).padStart(2,`0`);t.beginPath(),t.arc(e.x,e.y,i,0,Math.PI*2),t.strokeStyle=`#38bdf8${o}`,t.lineWidth=2,t.stroke()}}t.restore(),i=requestAnimationFrame(m)};return i=requestAnimationFrame(m),()=>cancelAnimationFrame(i)},[n,r,p.w,p.h,o]);function h(e,t){let n=s.current;if(!n)return null;let r=n.getBoundingClientRect(),i=e-r.left,a=t-r.top,o=null,l=200;for(let e of c.current){let t=e.x-i,n=e.y-a,r=t*t+n*n;r<l&&(l=r,o=e.id)}return o}return(0,B.jsxs)(`div`,{className:`relative w-full h-full rounded-sm border border-[var(--color-line-1)] overflow-hidden bg-black`,children:[(0,B.jsx)(`canvas`,{ref:s,className:`block w-full h-full cursor-crosshair`,onMouseMove:e=>{d.current=h(e.clientX,e.clientY)},onMouseLeave:()=>{d.current=null},onClick:e=>{i(h(e.clientX,e.clientY))}}),t.length===0&&(0,B.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center pointer-events-none px-4 text-center`,children:[(0,B.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`graph · idle`}),(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] max-w-[260px]`,children:[`Each dot = one tool call an AI agent made.`,(0,B.jsx)(`br`,{}),`Color = the ssg rule decision · line = same agent's sequence.`]})]})]})}function bo(e){let t=e.windowMs??3e4,n=Oe(),r=ke(),[i,a]=(0,_.useState)(null),o=Date.now()-t,s=(0,_.useMemo)(()=>n.filter(e=>e.ts_ms>=o),[n,o]),c=(0,_.useMemo)(()=>{let e=new Map;for(let t of s){let n=`${t.client}:${t.agent_id??`solo`}`,r=e.get(n);r?r.count+=1:e.set(n,{client:t.client,count:1})}return e},[s]),l=(0,_.useMemo)(()=>{let e={allow:0,block:0,ask:0,other:0};for(let t of s)t.decision===`allow`?e.allow++:t.decision===`block`||t.decision===`force`?e.block++:t.decision===`ask`?e.ask++:e.other++;return e},[s]),u=(0,_.useMemo)(()=>{let e=new Set,t=0;for(let n of s)n.rule_id&&(e.add(n.rule_id),t+=1);return{distinct:e.size,matched:t,topRule:e.values().next().value}},[s]);return(0,B.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,children:[(0,B.jsxs)(`header`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-[var(--color-line-1)]`,children:[(0,B.jsx)(`span`,{className:`overline text-[var(--color-fg-3)]`,children:`graph · live`}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[(0,B.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),s.length]}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] font-mono`,children:[(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:Pa.allow}}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.allow}),(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ml-1`,style:{background:Pa.block}}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.block}),(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ml-1`,style:{background:Pa.ask}}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.ask})]}),(0,B.jsx)(`span`,{className:`flex-1`}),(0,B.jsxs)(`span`,{className:`chip text-violet-300 border-violet-500/30`,title:`${u.matched} tool calls matched ${u.distinct} ssg ${u.distinct===1?`rule`:`rules`} in the last ${Math.round(t/1e3)}s`,children:[u.distinct,` `,u.distinct===1?`rule`:`rules`]}),(0,B.jsxs)(`span`,{className:`chip text-[var(--color-fg-3)] border-[var(--color-line-1)]`,title:c.size===0?`no active agents`:Array.from(c.entries()).map(([e,t])=>`${e}: ${t.count}`).join(`
|
|
10
|
+
`),children:[c.size,` `,c.size===1?`agent`:`agents`]}),(0,B.jsx)(`a`,{href:`/graph`,className:`text-[10px] font-mono uppercase tracking-wider text-sky-300 hover:text-sky-200`,title:`Open full /graph page`,children:`expand ↗`})]}),(0,B.jsx)(`div`,{className:`flex-1 min-h-0 relative`,children:(0,B.jsx)(yo,{bursts:s,paused:!1,selectedId:i,onSelect:a,burstSeq:r,layout:`spiral`})})]})}var xo=3e4,So=6e4,Co=5e3;function wo(e){let t=Date.now(),n=e.length>0?e[e.length-1]:null;if(!n||t-n.ts_ms>Co||!n)return{idle:!0,client:``,tool:``,ruleId:null,decision:``,evalsPerSec:`0.0`,allowPct:0,agents:0,topRules:[]};let r=e.filter(e=>t-e.ts_ms<=xo),i=r.filter(e=>e.decision===`allow`).length,a=r.length>0?Math.round(i/r.length*100):0,o=(r.length/(xo/1e3)).toFixed(1),s=new Set(r.map(e=>`${e.client}:${e.agent_id??`solo`}`)).size,c=e.filter(e=>t-e.ts_ms<=So&&e.rule_id),l=new Map;for(let e of c){let t=e.rule_id;t&&l.set(t,(l.get(t)??0)+1)}let u=[...l.entries()].sort((e,t)=>t[1]-e[1]).slice(0,4).map(([e])=>e);return{idle:!1,client:n.client,tool:n.tool,ruleId:n.rule_id,decision:n.decision,evalsPerSec:o,allowPct:a,agents:s,topRules:u}}var To={allow:`ALLOW`,block:`BLOCK`,ask:`ASK`,log:`LOG`,force:`FORCE`,shadow:`SHADOW`},Eo={allow:`#22c55e`,block:`#ef4444`,ask:`#f59e0b`,log:`#60a5fa`,force:`#a855f7`,shadow:`#6b7280`};function Do({className:e}){let t=Oe(),n=ke(),r=(0,_.useRef)(-1),i=(0,_.useRef)(null),a=(0,_.useMemo)(()=>{if(r.current===n&&i.current)return i.current;r.current=n;let e=wo(t);return i.current=e,e},[t,n]),o=a.decision?Eo[a.decision]??`#6b7280`:`#6b7280`,s=a.decision?To[a.decision]??a.decision:``,c=a.client?Xa(a.client):``;return a.idle?(0,B.jsxs)(`div`,{className:z(`pointer-events-none select-none`,`flex items-center justify-center gap-2`,`px-4 py-2 rounded-sm`,`bg-[#0a0a0f]/80 backdrop-blur-sm`,`border border-[var(--color-line-1,#242424)]`,`font-mono text-[11px] text-[var(--color-fg-4,#5a6071)]`,e),children:[(0,B.jsx)(`span`,{className:`status-dot bg-[var(--color-fg-4)] pulse-soft`}),(0,B.jsx)(`span`,{className:`uppercase tracking-wider`,children:`waiting for activity`})]}):(0,B.jsxs)(`div`,{className:z(`pointer-events-none select-none`,`flex flex-col gap-1 px-4 py-2.5 rounded-sm`,`bg-[#0a0a0f]/88 backdrop-blur-sm`,`border border-[var(--color-line-1,#242424)]`,`font-mono min-w-[280px] max-w-[460px]`,e),children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-widest text-[var(--color-fg-4,#5a6071)]`,children:[(0,B.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),(0,B.jsx)(`span`,{children:`now evaluating`}),(0,B.jsxs)(`span`,{className:`ml-auto tabular-nums`,children:[a.evalsPerSec,`/s · `,a.allowPct,`% allow · `,a.agents,` `,a.agents===1?`agent`:`agents`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px] text-[var(--color-fg-0,#f5f5f5)] tracking-tight`,children:[(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)] text-[11px] tabular-nums`,children:[`[`,c,`]`]}),(0,B.jsx)(`span`,{className:`text-sky-300`,children:a.client}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`·`}),(0,B.jsx)(`span`,{className:`text-white font-semibold`,children:a.tool}),a.ruleId&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`->`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)] text-[12px]`,children:a.ruleId})]}),(0,B.jsx)(`span`,{className:`ml-auto text-[13px] font-bold tabular-nums`,style:{color:o},children:s})]}),a.topRules.length>0&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-[var(--color-fg-4)]`,children:[(0,B.jsx)(`span`,{className:`uppercase tracking-wider text-[9px]`,children:`rules`}),a.topRules.map(e=>(0,B.jsx)(`span`,{className:`px-1 py-0.5 rounded-sm bg-[var(--color-surface-2,#121212)] text-[var(--color-fg-3)]`,children:e},e))]})]})}var Oo=`ssg.sfx.enabled`;function ko(){if(typeof window>`u`)return!1;try{return window.localStorage.getItem(Oo)===`true`}catch{return!1}}function Ao(e){if(!(typeof window>`u`))try{window.localStorage.setItem(Oo,String(e))}catch{}}function jo(e,t,n,r,i,a,o=`sine`){try{let s=e.createOscillator(),c=e.createGain(),l=i/1e3;s.type=o,s.frequency.setValueAtTime(n,e.currentTime),s.frequency.exponentialRampToValueAtTime(Math.max(1,r),e.currentTime+l),c.gain.setValueAtTime(a,e.currentTime),c.gain.exponentialRampToValueAtTime(.001,e.currentTime+l),s.connect(c),c.connect(t),s.start(e.currentTime),s.stop(e.currentTime+l+.02)}catch{}}function Mo(){let[e,t]=(0,_.useState)(ko),n=(0,_.useRef)(null),r=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=()=>{let t=n.current;t&&(document.hidden?t.suspend().catch(()=>{}):e&&t.resume().catch(()=>{}))};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e]),{enabled:e,toggle:(0,_.useCallback)(()=>{t(e=>{let t=!e;if(Ao(t),t){if(!n.current)try{let e=new AudioContext,t=e.createGain();t.gain.value=.8,t.connect(e.destination),n.current=e,r.current=t}catch{}n.current?.resume().catch(()=>{})}else n.current?.suspend().catch(()=>{});return t})},[]),play:(0,_.useCallback)(t=>{if(!e)return;let i=n.current,a=r.current;if(!(!i||!a||i.state===`suspended`))switch(t){case`block`:jo(i,a,110,55,150,.08);break;case`force`:jo(i,a,80,40,200,.1),jo(i,a,160,80,200,.05,`square`);break;case`milestone`:{jo(i,a,660,880,100,.06);let e=i,t=a;setTimeout(()=>{e.state!==`suspended`&&jo(e,t,880,1320,100,.05)},115);break}case`record`:jo(i,a,880,1320,350,.07);break}},[e])}}function No(e){return!Number.isFinite(e)||e<=0?`—`:e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:`${(e/1e6).toFixed(2)} ms`}async function Po(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:Ae()})}var Fo=e=>!0,Io=e=>e.decision===`allow`,Lo=e=>e.decision===`block`,Ro=e=>e.decision===`ask`,zo=e=>e.decision===`force`,Bo=e=>e.decision===`log`;function Vo(){let e=new Date;return e.setHours(0,0,0,0),e.getTime()}function Ho(){let e=je([`counters-updated`,`activity-updated`,`pending-changed`,`runtime-tick`]),t=De(),n=ke(),r=Oe(),i=Mo();(0,_.useEffect)(()=>{t&&(t.decision===`block`?i.play(`block`):t.decision===`force`&&i.play(`force`))},[n]);let[a,o]=(0,_.useState)(()=>Vo());(0,_.useEffect)(()=>{let e=()=>{if(document.visibilityState!==`visible`)return;let e=Vo();o(t=>e===t?t:e)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let{data:s}=F(`/api/state/counters?since_ms=${a}`,[e[`counters-updated`],a]),{data:c}=F(`/api/state/runtime`,[e[`runtime-tick`]]),{data:l}=F(`/api/json/limits`,[e[`runtime-tick`]]),{data:u,refetch:d}=F(`/api/json/pending`,[e[`pending-changed`]]),{data:f}=F(`/api/json/blocked`,[e[`activity-updated`]]),p=Na(),[m,h]=(0,_.useState)(!1),g=(0,_.useMemo)(()=>{let e=s?.allow??0,n=s?.block??0,r=s?.ask??0,i=s?.log??0,a=s?.force??0,o=e+n+r+i+a,c=t?.counters.total??0;return t&&c>=o&&t?{allow:t.counters.allow,block:t.counters.block,ask:t.counters.ask,log:t.counters.log,force:t.counters.force,shadow:t.counters.shadow,total:t.counters.total}:{allow:e,block:n,ask:r,log:i,force:a,shadow:0,total:o}},[t,s]),v=(0,_.useMemo)(()=>{if(r.length===0)return 0;let e=Date.now()-1e4;return r.filter(t=>t.ts_ms>=e).length/10},[r]),y=c?.history?.cpu_pct??[],b=c?.history?.memory_rss_mb??[],x=[],S=c?.latency,C=(0,_.useMemo)(()=>({"hero-metrics":()=>(0,B.jsx)(`div`,{className:`grid-bleed rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 h-full`,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3 h-full`,children:[(0,B.jsx)(Ar,{label:`Total`,value:g.total,tone:`amber`,sub:t?No(t.duration_ns):void 0,burstRing:r,filter:Fo}),(0,B.jsx)(Ar,{label:`Allow`,value:g.allow,tone:`green`,burstRing:r,filter:Io}),(0,B.jsx)(Ar,{label:`Block`,value:g.block,tone:`red`,burstRing:r,filter:Lo}),(0,B.jsx)(Ar,{label:`Ask`,value:g.ask,tone:`amber`,burstRing:r,filter:Ro}),(0,B.jsx)(Ar,{label:`Force`,value:g.force,tone:`blue`,burstRing:r,filter:zo}),(0,B.jsx)(Ar,{label:`Log`,value:g.log,tone:`purple`,burstRing:r,filter:Bo})]})}),graph:()=>(0,B.jsx)(bo,{}),"latency-trace":()=>(0,B.jsx)(ei,{latency:S,bursts:r,gaugeMaxMs:10,windowMs:3e4,trendWindowSec:60,gaugeSize:200}),throughput:()=>(0,B.jsxs)(V,{className:`h-full`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`overline`,children:`throughput · evals/s`}),(0,B.jsxs)(mr,{variant:`blue`,children:[v.toFixed(1),`/s`]})]}),(0,B.jsxs)(U,{children:[(0,B.jsx)(Sr,{value:v,width:360,height:96,windowMs:6e4,className:`w-full`}),(0,B.jsx)(`p`,{className:`overline mt-2 text-center`,children:`60-second rolling window`})]})]}),"decision-mix":()=>(0,B.jsxs)(V,{className:`h-full`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`overline`,children:`decision mix`}),(0,B.jsx)(mr,{variant:`gray`,children:g.total.toLocaleString()})]}),(0,B.jsx)(U,{children:(0,B.jsx)(ri,{counters:{allow:g.allow,block:g.block,ask:g.ask,log:g.log,force:g.force,shadow:g.shadow}})})]}),"telemetry-feed":()=>(0,B.jsxs)(V,{variant:`flush`,className:`h-full flex flex-col`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`overline`,children:`telemetry · live · newest first`}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:[`hover to pause · scroll for history · `,r.length,` events buffered`]})]}),(0,B.jsx)(U,{className:`p-0 flex-1 min-h-0`,children:(0,B.jsx)(hi,{variant:`decision`,bursts:r,windowSize:80,height:360,className:`border-0 rounded-none`})})]}),"system-pulse":()=>(0,B.jsx)(ci,{cpuPct:c?.cpu_pct??0,cpuSeries:y,cpuLimit:l?.config.cpuLimitPct,memMb:c?.memory_rss_mb??0,memSeries:b,memLimit:l?.config.memoryLimitMb,heapUsedMb:c?.heap_used_mb??0,heapTotalMb:c?.heap_total_mb??0,heapSeries:x,uptimeSec:(c?.uptime_ms??0)/1e3}),"pending-approvals":()=>(0,B.jsxs)(V,{className:`h-full`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`overline`,children:`pending approvals`}),(0,B.jsx)(mr,{variant:u&&u.length>0?`amber`:`gray`,children:u?.length??0})]}),(0,B.jsx)(U,{children:u&&u.length>0?(0,B.jsx)(`ul`,{className:`space-y-2`,children:u.slice(0,5).map(e=>(0,B.jsxs)(`li`,{className:`flex items-center justify-between gap-2 border-b border-[var(--color-line-0)] last:border-b-0 py-1.5 text-[12px] font-mono`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`text-[var(--color-fg-1)] truncate`,children:[e.toolCall.tool,` · `,e.ruleId]}),(0,B.jsx)(`div`,{className:`text-[var(--color-fg-3)] text-[11px] truncate`,children:ur(e.toolCall.tool,JSON.stringify(e.toolCall.input??{}))})]}),(0,B.jsxs)(`div`,{className:`flex gap-1 shrink-0`,children:[(0,B.jsx)(W,{size:`sm`,variant:`primary`,onClick:()=>Po(e.id,`allow`).then(d),children:`allow`}),(0,B.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>Po(e.id,`block`).then(d),children:`block`})]})]},e.id))}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] py-3 text-center`,children:`— no pending approvals —`})})]}),"recent-blocks":()=>(0,B.jsxs)(V,{className:`h-full`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`overline`,children:`recent blocks & forces`}),(0,B.jsx)(mr,{variant:f&&f.length>0?`red`:`gray`,children:f?.length??0})]}),(0,B.jsx)(U,{children:f&&f.length>0?(0,B.jsx)(`ul`,{className:`space-y-1.5`,children:f.slice(0,6).map((e,t)=>(0,B.jsxs)(`li`,{className:`flex items-center gap-2 text-[12px] font-mono border-b border-[var(--color-line-0)] last:border-b-0 py-1.5`,children:[(0,B.jsx)(mr,{variant:e.decision===`force`?`amber`:`red`,children:e.decision}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate flex-1`,children:ur(e.tool,e.input)}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate text-[11px] max-w-[120px]`,children:e.rule_id??`—`})]},`${e.timestamp}-${t}`))}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] py-3 text-center`,children:`— no recent blocks —`})})]})}),[g,t,r,S,v,c,y,b,x,l,u,f,d]),w=Mt({from:`first`,translateY:22,durationMs:640,staggerMs:80,maxStaggerMs:520});return(0,B.jsxs)(`div`,{ref:m?void 0:w,className:`space-y-5`,children:[(0,B.jsx)(Do,{className:`w-full max-w-none`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`div`,{className:`flex-1`,children:(0,B.jsx)(Ji,{manager:p,isEditing:m,onToggleEditing:h})}),(0,B.jsx)(`button`,{type:`button`,onClick:i.toggle,className:`chip cursor-pointer hover:border-sky-500/50 hover:text-sky-300 transition-colors shrink-0`,title:i.enabled?`Mute stream sounds`:`Enable stream sounds`,children:i.enabled?`SFX ON`:`SFX OFF`})]}),(0,B.jsx)(qi,{panels:p.activeLayout.panels,isEditing:m,renderers:C,onPanelsChange:p.updateActivePanels})]})}function Uo({val:e}){return e==null?(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] italic font-mono text-xs`,children:`null`}):typeof e==`boolean`?(0,B.jsx)(`span`,{className:`inline-block font-mono text-[10px] font-medium uppercase tracking-wider px-1.5 py-0.5 rounded-sm border ${e?`bg-emerald-500/8 text-emerald-300 border-emerald-500/25`:`bg-red-500/8 text-red-300 border-red-500/25`}`,children:e.toString()}):typeof e==`number`?(0,B.jsx)(`span`,{className:`font-mono tabular-nums text-violet-300 text-xs`,children:e}):typeof e==`string`?e.length===0?(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] italic text-xs font-mono`,children:`empty string`}):e.length>200?(0,B.jsx)(`pre`,{className:`text-[11px] font-mono text-[var(--color-fg-1)] whitespace-pre-wrap break-all bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 max-h-40 overflow-y-auto`,children:e}):(0,B.jsx)(`span`,{className:`font-mono text-xs text-[var(--color-fg-1)] break-all`,children:e}):(0,B.jsx)(`pre`,{className:`text-[11px] font-mono text-[var(--color-fg-1)] whitespace-pre-wrap break-all bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 max-h-40 overflow-y-auto`,children:JSON.stringify(e,null,2)})}function Wo({inputJson:e}){let t=[];try{let n=JSON.parse(e);n&&typeof n==`object`&&!Array.isArray(n)&&(t=Object.entries(n))}catch{return(0,B.jsx)(`pre`,{className:`text-[11px] font-mono text-[var(--color-fg-1)] whitespace-pre-wrap break-all bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2`,children:e})}return t.length===0?(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-xs italic font-mono`,children:`no input fields`}):(0,B.jsx)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] overflow-hidden text-xs`,children:t.map(([e,t],n)=>(0,B.jsxs)(`div`,{className:`flex gap-0 ${n>0?`border-t border-[var(--color-line-0)]`:``}`,children:[(0,B.jsx)(`div`,{className:`w-40 shrink-0 px-3 py-2 bg-[var(--color-surface-0)] text-[var(--color-fg-3)] font-mono text-[11px] border-r border-[var(--color-line-0)] select-none`,children:e}),(0,B.jsx)(`div`,{className:`flex-1 min-w-0 px-3 py-2 leading-relaxed`,children:(0,B.jsx)(Uo,{val:t})})]},e))})}var Go={allow:`green`,block:`red`,force:`amber`,ask:`blue`,log:`gray`},Ko={allow:`border-l-emerald-500/60`,block:`border-l-red-500/60`,force:`border-l-amber-400/60`,ask:`border-l-sky-500/60`,log:`border-l-[var(--color-line-2)]`};function qo(e){return e==null?null:e<1e6?`${(e/1e3).toFixed(0)}µs`:`${(e/1e6).toFixed(1)}ms`}function Jo({label:e,value:t,mono:n,children:r}){return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline mb-1`,children:e}),r??(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] text-xs ${n?`font-mono`:``} break-all`,children:t??`—`})]})}function Yo({text:e}){let[t,n]=(0,_.useState)(!1);return(0,B.jsx)(`button`,{onClick:async t=>{t.stopPropagation();try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] border border-[var(--color-line-1)] hover:border-[var(--color-line-2)] rounded-sm px-2 py-1 transition-colors cursor-pointer`,children:t?`✓ copied`:`copy json`})}function Xo({row:e,defaultExpanded:t=!1}){let[n,r]=(0,_.useState)(t),i=(0,_.useRef)(null),a=(0,_.useRef)(!0),o=ur(e.tool,e.input),s=Go[e.decision]??`gray`,c=Ko[e.decision]??`border-l-[var(--color-line-2)]`,l=lr(e.timestamp),u=qo(e.duration_ns);(0,_.useEffect)(()=>{let e=i.current;if(e){if(a.current){a.current=!1,n||(e.style.maxHeight=`0`,e.style.opacity=`0`);return}if(pt()){e.style.maxHeight=n?`none`:`0`,e.style.opacity=n?`1`:`0`;return}if(n){let t=e.scrollHeight;jt(e,{"max-height":[`0px`,`${t}px`],opacity:[0,1],translateY:[-6,0],duration:260,ease:`outCubic`,onComplete:()=>{e.style.maxHeight=`none`}})}else{let t=e.scrollHeight;jt(e,{"max-height":[`${t}px`,`0px`],opacity:[1,0],duration:180,ease:`outCubic`})}}},[n]);let d=(()=>{try{return JSON.stringify(JSON.parse(e.input),null,2)}catch{return e.input}})();return(0,B.jsxs)(`div`,{className:`border border-[var(--color-line-1)] border-l-2 ${c} rounded-sm bg-[var(--color-surface-1)] overflow-hidden transition-colors hover:border-[var(--color-line-2)] hover:border-l-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 cursor-pointer select-none group`,onClick:()=>r(e=>!e),role:`button`,"aria-expanded":n,children:[(0,B.jsx)(`svg`,{className:`shrink-0 text-[var(--color-fg-4)] group-hover:text-[var(--color-fg-2)] transition-all ${n?`rotate-90`:``}`,width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,B.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),(0,B.jsx)(`time`,{className:`shrink-0 font-mono text-[11px] text-[var(--color-fg-3)] w-14 tabular-nums`,title:l,dateTime:new Date(e.timestamp*1e3).toISOString(),children:cr(e.timestamp)}),(0,B.jsx)(mr,{variant:s,className:`shrink-0`,children:e.decision}),(0,B.jsx)(`code`,{className:`shrink-0 text-[11px] text-[var(--color-brand)] font-mono`,children:e.tool}),o&&(0,B.jsx)(`span`,{className:`flex-1 min-w-0 text-[11px] text-[var(--color-fg-2)] font-mono truncate`,title:o,children:o}),(0,B.jsx)(`span`,{className:`shrink-0 text-[10px] font-mono text-[var(--color-fg-4)] ml-auto pl-2 uppercase tracking-wider`,title:e.client?`client: ${e.client}`:`client: unidentified`,children:e.client??`—`})]}),(0,B.jsx)(`div`,{ref:i,className:`border-t border-[var(--color-line-0)] overflow-hidden`,style:{maxHeight:n?`none`:`0`,opacity:n?1:0},"aria-hidden":!n,children:n&&(0,B.jsxs)(`div`,{className:`px-3 py-3 space-y-4`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-3`,children:[(0,B.jsx)(Jo,{label:`Timestamp`,value:l}),(0,B.jsx)(Jo,{label:`Decision`,children:(0,B.jsx)(mr,{variant:s,children:e.decision})}),(0,B.jsx)(Jo,{label:`Tool`,children:(0,B.jsx)(`code`,{className:`text-xs font-mono text-[var(--color-brand)]`,children:e.tool})}),e.client&&(0,B.jsx)(Jo,{label:`Client`,value:e.client}),e.rule_id&&(0,B.jsx)(Jo,{label:`Rule ID`,children:(0,B.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.rule_id)}`,className:`text-xs text-[var(--color-brand)] hover:underline font-mono`,onClick:e=>e.stopPropagation(),children:e.rule_id})}),e.source_file&&(0,B.jsx)(Jo,{label:`Source File`,value:e.source_file,mono:!0}),u&&(0,B.jsx)(Jo,{label:`Latency`,value:u,mono:!0}),e.rules_evaluated!=null&&(0,B.jsx)(Jo,{label:`Rules Evaluated`,value:`${e.rules_evaluated}`,mono:!0})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline mb-2`,children:`Tool Input`}),(0,B.jsx)(Wo,{inputJson:e.input})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.rule_id?(0,B.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.rule_id)}`,className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-brand)]/70 hover:text-[var(--color-brand)] transition-colors`,onClick:e=>e.stopPropagation(),children:`→ view rule`}):(0,B.jsx)(`span`,{}),(0,B.jsx)(Yo,{text:d})]})]})})]})}function Zo({className:e,children:t,...n}){return(0,B.jsx)(`pre`,{className:z(`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm px-3 py-2 text-[11px] leading-relaxed font-mono text-[var(--color-fg-1)] overflow-x-auto whitespace-pre-wrap break-all`,e),...n,children:t})}var Qo={neutral:`text-[var(--color-fg-0)]`,green:`text-emerald-300`,red:`text-red-300`,amber:`text-amber-300`,blue:`text-sky-300`,purple:`text-violet-300`,gray:`text-[var(--color-fg-3)]`},$o={neutral:`bg-[var(--color-fg-3)]`,green:`bg-emerald-500`,red:`bg-red-500`,amber:`bg-[var(--color-brand)]`,blue:`bg-sky-500`,purple:`bg-violet-500`,gray:`bg-[var(--color-line-2)]`},es=[{label:`User code`,color:`#451a03`},{label:`Runtime (bun:/node:)`,color:`#172554`},{label:`Native/other`,color:`#1f2937`},{label:`GC/idle`,color:`#450a0a`}];function ts({label:e,value:t,sub:n,tone:r=`neutral`,align:i=`left`,labelPlacement:a=`above`,labelClassName:o,valueClassName:s,subClassName:c}){let l=(0,B.jsx)(`div`,{className:z(a===`above`?`overline mb-1.5`:`mt-1 text-[11px] text-[var(--color-fg-3)]`,o),children:e});return(0,B.jsxs)(B.Fragment,{children:[a===`above`&&l,(0,B.jsx)(`div`,{className:z(`font-mono font-medium tabular-nums`,i===`center`&&`text-center`,Qo[r],s),children:t}),a===`below`&&l,n&&(0,B.jsx)(`div`,{className:z(`mt-1 text-[10px] font-mono text-[var(--color-fg-3)]`,i===`center`&&`text-center`,c),children:n})]})}function ns({className:e,contentClassName:t,label:n,value:r,sub:i,tone:a,align:o,labelPlacement:s,labelClassName:c,valueClassName:l,subClassName:u,...d}){return(0,B.jsx)(V,{className:e,...d,children:(0,B.jsx)(U,{className:z(`py-3`,o===`center`&&`text-center`,t),children:(0,B.jsx)(ts,{label:n,value:r,sub:i,tone:a,align:o,labelPlacement:s,labelClassName:c,valueClassName:l,subClassName:u})})})}function rs({className:e,...t}){return(0,B.jsx)(`div`,{className:z(`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)] p-3`,t.align===`center`&&`text-center`,e),children:(0,B.jsx)(ts,{...t})})}function is({pct:e,tone:t=`green`,markerPct:n,className:r,barClassName:i,markerTitle:a}){let o=Math.max(0,Math.min(100,e)),s=n===void 0?null:Math.max(0,Math.min(100,n));return(0,B.jsxs)(`div`,{className:z(`relative w-full overflow-hidden rounded-sm bg-[var(--color-surface-3)]`,r),children:[(0,B.jsx)(`div`,{className:z(`h-full rounded-sm transition-all duration-500`,$o[t],i),style:{width:`${o}%`}}),s!==null&&(0,B.jsx)(`div`,{className:`absolute top-0 h-full w-0.5 bg-[var(--color-brand)]/70`,style:{left:`${s}%`},title:a})]})}function as({label:e,value:t,tone:n=`neutral`,breached:r=!1,breachLabel:i=`limit exceeded`,trendData:a,trendColor:o,threshold:s,maxValue:c,footer:l,className:u,valueClassName:d}){return(0,B.jsxs)(V,{className:u,children:[(0,B.jsxs)(H,{className:`py-2`,children:[(0,B.jsx)(`span`,{className:`overline`,children:e}),r&&(0,B.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300`,children:i})]}),(0,B.jsxs)(U,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsx)(`div`,{className:z(`text-2xl font-mono font-medium tabular-nums`,Qo[n],d),children:t}),(a?.length??0)>1&&o&&(0,B.jsx)(br,{data:a??[],width:80,height:28,color:o,threshold:s,maxValue:c})]}),l]})]})}function os({profile:e,children:t}){return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] font-mono text-[var(--color-fg-3)]`,children:[(0,B.jsxs)(`span`,{children:[`nodes:`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.nodes.length})]}),(0,B.jsxs)(`span`,{children:[`duration:`,` `,(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-1)]`,children:[((e.endTime-e.startTime)/1e3).toFixed(0),`ms`]})]}),(0,B.jsxs)(`span`,{children:[`samples:`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.samples?.length??0})]})]}),(0,B.jsx)(`div`,{className:`flex gap-3 text-[10px] font-mono text-[var(--color-fg-3)]`,children:es.map(e=>(0,B.jsxs)(`span`,{className:`flex items-center`,children:[(0,B.jsx)(`span`,{className:`mr-1 inline-block h-2.5 w-2.5 rounded-[1px]`,style:{background:e.color}}),e.label]},e.label))}),t]})}function ss({memory:e,formatValue:t}){return(0,B.jsx)(`div`,{className:`grid grid-cols-4 gap-3`,children:[{label:`RSS`,value:t(e.rss)},{label:`Heap Total`,value:t(e.heapTotal)},{label:`Heap Used`,value:t(e.heapUsed)},{label:`External`,value:t(e.external)}].map(e=>(0,B.jsx)(rs,{align:`center`,label:e.label,value:e.value,valueClassName:`text-lg font-medium text-[var(--color-fg-0)]`},e.label))})}var cs=3;function ls(e){return e===null?`—`:e<1e6?`${(e/1e3).toFixed(0)}µs`:`${(e/1e6).toFixed(1)}ms`}var us=[`counters-updated`,`activity-updated`,`pending-changed`,`runtime-tick`,`limits-breach`];function ds({info:e}){let t=e.tier===`pro`||e.tier===`enterprise`,n=e.status===`needs_reauth`,r=e.pct_used??0,i=r>=90?`bg-red-500`:r>=70?`bg-amber-500`:`bg-emerald-500`;return(0,B.jsxs)(V,{className:n?`border-l-2 border-l-amber-500/70`:t?`border-l-2 border-l-emerald-500/70`:`border-l-2 border-l-sky-500/70`,children:[(0,B.jsxs)(H,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-xs font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`license`}),(0,B.jsx)(mr,{variant:t?`green`:n?`amber`:`blue`,children:e.tier_label}),e.fleet_enrolled&&(0,B.jsx)(mr,{variant:`gray`,children:`fleet`})]}),e.email&&(0,B.jsx)(`span`,{className:`text-xs text-[var(--color-fg-3)]`,children:e.email})]}),(0,B.jsxs)(U,{className:`space-y-3`,children:[n&&e.detail&&(0,B.jsxs)(`div`,{className:`rounded border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs text-amber-200`,children:[e.detail,` — run `,(0,B.jsx)(`code`,{className:`font-mono`,children:`ssg auth login`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-xs text-[var(--color-fg-2)]`,children:[(0,B.jsx)(`span`,{children:`evals today`}),(0,B.jsxs)(`span`,{children:[e.evals_today.toLocaleString(),e.eval_daily_limit!==null&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:` / `}),e.eval_daily_limit.toLocaleString()]}),e.eval_daily_limit===null&&(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:` · unlimited`})]})]}),e.eval_daily_limit!==null&&(0,B.jsx)(`div`,{className:`mt-1 h-1.5 w-full overflow-hidden rounded-full bg-[var(--color-bg-2)]`,children:(0,B.jsx)(`div`,{className:`h-full transition-all ${i}`,style:{width:`${r}%`}})})]}),!t&&(0,B.jsxs)(`a`,{href:e.upgrade_url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs text-[var(--color-brand)] hover:underline`,children:[`Upgrade to Pro · $`,e.pricing.pro_monthly_usd,`/mo →`]}),t&&e.retention_days>0&&(0,B.jsxs)(`div`,{className:`text-[10px] text-[var(--color-fg-3)] font-mono uppercase tracking-wider`,children:[`cloud retention: `,e.retention_days,` days`]})]})]})}function fs(e){return new Date(e*1e3).toLocaleTimeString()}async function ps(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:Ae()})}async function ms(e,t){let n=await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...Ae()},body:JSON.stringify({ruleId:e,file:t})});if(!n.ok)throw Error(`Toggle failed: ${n.status}`)}async function hs(e,t){let n=await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...Ae()},body:JSON.stringify({ruleId:e,file:t})});if(!n.ok)throw Error(`Toggle failed: ${n.status}`)}async function gs(e,t){let n=await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({ruleId:e,file:t,decision:`ask`})});if(!n.ok)throw Error(`Update decision failed: ${n.status}`)}async function _s(e,t){let n=await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({ruleId:e,file:t,decision:`block`})});if(!n.ok)throw Error(`Update decision failed: ${n.status}`)}function vs({ruleId:e}){return e?(0,B.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e)}`,className:`text-[var(--color-brand)] hover:underline text-xs font-mono break-all`,title:`Go to rule: ${e}`,children:e}):(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`—`})}function ys({title:e,right:t}){return(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,B.jsx)(`h2`,{className:`overline text-[11px]`,children:e}),t]})}function bs({children:e}){return(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:e})}function xs({item:e,onDisable:t,onChangeToAsk:n,onUndo:r}){let[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(`idle`),[c,l]=(0,_.useState)(!1),u=ur(e.tool,e.input),d=e.rule_id&&e.source_file,f=e.decision===`force`?`force`:`block`,p=f===`force`?`amber`:`red`,m=async()=>{s(`loading`);try{await n(),s(`done-ask`)}catch{s(`error`)}},h=async()=>{s(`loading`);try{await t(),s(`done-disable`)}catch{s(`error`)}},g=async()=>{l(!0);try{await r(o===`done-disable`?`disable`:`ask`),s(`idle`)}catch{}finally{l(!1)}},v=o===`done-ask`||o===`done-disable`;return(0,B.jsx)(V,{className:`border-l-2 ${v?`border-l-[var(--color-line-1)]`:f===`force`?`border-l-amber-400/60`:`border-l-red-500/60`} ${v?`opacity-60`:``}`,children:(0,B.jsxs)(`div`,{className:`px-3 py-3`,children:[v&&(0,B.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm px-2.5 py-1.5 mb-3 text-[11px] font-mono ${o===`done-ask`?`bg-sky-500/5 border border-sky-500/25 text-sky-300`:`bg-amber-500/5 border border-amber-500/25 text-amber-300`}`,children:[(0,B.jsx)(`span`,{className:`truncate`,children:o===`done-ask`?`✓ rule "${e.rule_id}" → ask · prompts next time`:`✓ rule "${e.rule_id}" disabled · no longer blocks`}),(0,B.jsx)(`button`,{onClick:g,disabled:c,className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-current/40 hover:bg-white/5 transition-colors cursor-pointer disabled:opacity-50 uppercase tracking-wider text-[10px]`,children:c?`…`:`↩ undo`})]}),o===`error`&&(0,B.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm px-2.5 py-1.5 mb-3 text-[11px] font-mono bg-red-500/5 border border-red-500/25 text-red-300`,children:[(0,B.jsx)(`span`,{children:`failed to update rule — check server logs`}),(0,B.jsx)(`button`,{onClick:()=>s(`idle`),className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-current/40 hover:bg-white/5 transition-colors cursor-pointer uppercase tracking-wider text-[10px]`,children:`retry`})]}),(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5 flex-wrap`,children:[(0,B.jsx)(mr,{variant:v?o===`done-ask`?`blue`:`gray`:p,children:v?o===`done-ask`?`ask`:`disabled`:f}),(0,B.jsx)(`code`,{className:`text-[var(--color-brand)] text-xs font-mono`,children:e.tool}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-xs`,children:`·`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] text-[11px] font-mono tabular-nums`,children:fs(e.timestamp)}),e.repeat_count>1&&(0,B.jsxs)(mr,{variant:`gray`,children:[`×`,e.repeat_count]})]}),(0,B.jsx)(`div`,{className:`text-xs font-mono truncate cursor-pointer hover:text-[var(--color-fg-0)] transition-colors ${v?`text-[var(--color-fg-4)] line-through`:`text-[var(--color-fg-1)]`}`,title:u,onClick:()=>a(e=>!e),children:u})]}),d&&!v&&o!==`error`&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pt-0.5`,children:[(0,B.jsxs)(`button`,{onClick:m,disabled:o===`loading`,className:`inline-flex items-center gap-1 h-7 px-2.5 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-sky-500/8 text-sky-300 border border-sky-500/25 hover:bg-sky-500/15 hover:border-sky-500/40 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,children:[o===`loading`?(0,B.jsx)(`span`,{className:`animate-spin`,children:`⟳`}):(0,B.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,B.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,B.jsx)(`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}),(0,B.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),`ask instead`]}),(0,B.jsxs)(`button`,{onClick:h,disabled:o===`loading`,className:`inline-flex items-center gap-1 h-7 px-2.5 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-red-500/8 text-red-300 border border-red-500/25 hover:bg-red-500/15 hover:border-red-500/40 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,children:[o===`loading`?(0,B.jsx)(`span`,{className:`animate-spin`,children:`⟳`}):(0,B.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,B.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,B.jsx)(`line`,{x1:`15`,y1:`9`,x2:`9`,y2:`15`}),(0,B.jsx)(`line`,{x1:`9`,y1:`9`,x2:`15`,y2:`15`})]}),`disable rule`]})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 mt-2 text-[11px] font-mono`,children:[e.rule_id&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`rule`}),(0,B.jsx)(vs,{ruleId:e.rule_id})]}),e.source_file&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`src`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:e.source_file})]}),e.rules_evaluated!==null&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`evals`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums`,children:e.rules_evaluated})]}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`latency`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums`,children:ls(e.duration_ns)})]}),(0,B.jsx)(`button`,{onClick:()=>a(e=>!e),className:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-0)] transition-colors ml-auto cursor-pointer uppercase tracking-wider text-[10px]`,children:i?`▾ hide`:`▸ details`})]}),i&&(0,B.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,B.jsx)(`div`,{className:`overline mb-2`,children:`full input`}),(0,B.jsx)(Zo,{children:(()=>{try{return JSON.stringify(JSON.parse(e.input),null,2)}catch{return e.input}})()})]})]})})}function Ss(){let e=je(us),t=[e[`counters-updated`],e[`activity-updated`],e[`pending-changed`]],{data:n}=F(`/api/state/counters`,t),{data:r,refetch:i}=F(`/api/json/pending`,t),{data:a,refetch:o}=F(`/api/json/blocked`,t),{data:s}=F(`/api/state/activity`,t),{data:c}=F(`/api/state/runtime`,[e[`runtime-tick`]]),{data:l}=F(`/api/json/limits`,[e[`limits-breach`]]),{data:u}=F(`/api/json/license`,[e[`activity-updated`]]),[d,f]=(0,_.useState)(!1),p=a?.reduce((e,t)=>e+t.repeat_count,0)??0,m=[{label:`allow`,value:n?.allow??0,tone:`green`},{label:`block`,value:(n?.block??0)+(n?.force??0),tone:`red`},{label:`force`,value:n?.force??0,tone:`amber`},{label:`pending`,value:n?.pending??0,tone:`blue`},{label:`log`,value:n?.log??0,tone:`gray`}];return(0,B.jsxs)(`div`,{ref:Mt({from:`first`}),className:`space-y-8`,children:[(0,B.jsx)(`div`,{className:`grid grid-cols-5 gap-2`,children:m.map(e=>(0,B.jsx)(ns,{align:`left`,label:e.label,value:e.value,tone:e.tone,labelPlacement:`above`,contentClassName:`py-3`,valueClassName:`text-2xl font-medium`,"data-reveal":!0},e.label))}),u&&(0,B.jsx)(`div`,{"data-reveal":!0,children:(0,B.jsx)(ds,{info:u})}),c&&(0,B.jsxs)(`div`,{"data-reveal":!0,className:`grid grid-cols-2 gap-2`,children:[(0,B.jsx)(as,{label:`cpu`,value:`${c.cpu_pct??`—`}%`,tone:l?.breaches.cpu?`red`:(c.cpu_pct??0)>=60?`amber`:`green`,breached:l?.breaches.cpu??!1,trendData:c.history?.cpu_pct,trendColor:l?.breaches.cpu?`#f87171`:`#34d399`,threshold:l?.config.cpuLimitPct,maxValue:100,className:l?.breaches.cpu?`border-red-500/40`:``,footer:(0,B.jsx)(`a`,{href:`/monitor`,className:`mt-1 block text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`view details →`})}),(0,B.jsx)(as,{label:`memory rss`,value:(0,B.jsxs)(B.Fragment,{children:[c.memory_rss_mb??`—`,(0,B.jsx)(`span`,{className:`ml-1 text-sm text-[var(--color-fg-3)]`,children:`MB`})]}),tone:l?.breaches.memory?`red`:`neutral`,breached:l?.breaches.memory??!1,trendData:c.history?.memory_rss_mb,trendColor:l?.breaches.memory?`#f87171`:`#38bdf8`,threshold:l?.config.memoryLimitMb,className:l?.breaches.memory?`border-red-500/40`:``,footer:(0,B.jsx)(`a`,{href:`/monitor`,className:`mt-1 block text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`view details →`})})]}),(0,B.jsxs)(`section`,{"data-reveal":!0,children:[(0,B.jsx)(ys,{title:`pending approvals`}),!r||r.length===0?(0,B.jsx)(bs,{children:`no pending approvals`}):(0,B.jsx)(`div`,{className:`space-y-2`,children:r.map(e=>(0,B.jsxs)(V,{className:`border-l-2 border-l-sky-500/50`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(W,{size:`sm`,variant:`primary`,onClick:async()=>{await ps(e.id,`allow`),i()},children:`approve`}),(0,B.jsx)(W,{size:`sm`,variant:`danger`,onClick:async()=>{await ps(e.id,`block`),i()},children:`deny`})]})]}),(0,B.jsxs)(U,{className:`space-y-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`tool`}),(0,B.jsx)(`code`,{className:`text-[var(--color-brand)] font-mono`,children:e.toolCall.tool})]}),e.prompt&&(0,B.jsxs)(`div`,{className:`flex gap-2 items-start`,children:[(0,B.jsx)(`span`,{className:`overline pt-0.5`,children:`prompt`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,children:e.prompt})]}),(0,B.jsx)(Zo,{children:JSON.stringify(e.toolCall.input,null,2)})]})]},e.id))})]}),a&&a.length>0&&(0,B.jsxs)(`section`,{"data-reveal":!0,children:[(0,B.jsx)(ys,{title:`blocked actions`,right:(0,B.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:[a.length,` active`,p>a.length?` · ${p} total hits`:``]})}),(0,B.jsx)(`div`,{className:`space-y-2`,children:(d?a:a.slice(0,cs)).map(e=>(0,B.jsx)(xs,{item:e,onDisable:async()=>{await ms(e.rule_id,e.source_file),o()},onChangeToAsk:async()=>{await gs(e.rule_id,e.source_file),o()},onUndo:async t=>{t===`disable`?await hs(e.rule_id,e.source_file):await _s(e.rule_id,e.source_file),o()}},`${e.decision}:${e.rule_id??`none`}:${e.tool}:${e.timestamp}:${e.input}`))}),a.length>cs&&(0,B.jsx)(`div`,{className:`mt-3 flex justify-center`,children:(0,B.jsx)(W,{size:`sm`,variant:`secondary`,onClick:()=>f(e=>!e),children:d?`↑ show less`:`↓ show ${a.length-cs} more`})})]}),(0,B.jsxs)(`section`,{"data-reveal":!0,children:[(0,B.jsx)(ys,{title:`recent audit log`,right:s&&s.length>0?(0,B.jsx)(`a`,{href:`/audit`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)] transition-colors`,children:`view all →`}):void 0}),!s||s.length===0?(0,B.jsx)(bs,{children:`no audit entries yet`}):(0,B.jsx)(`div`,{className:`space-y-1.5`,children:s.slice(0,15).map(e=>(0,B.jsx)(Xo,{row:e},e.id))})]})]})}var Cs=[`rules-changed`],ws=[`block`,`ask`,`log`,`allow`,`force`,`shadow`],Ts={block:`text-red-300`,deny:`text-red-300`,ask:`text-sky-300`,allow:`text-emerald-300`,log:`text-[var(--color-fg-3)]`,force:`text-amber-300`,shadow:`text-violet-300`};async function Es(e,t){await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...Ae()},body:JSON.stringify({ruleId:e,file:t})})}async function Ds(e,t,n){await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({ruleId:e,file:t,decision:n})})}function Os({rule:e,file:t,onToggle:n}){let[r,i]=(0,_.useState)(!1),a=(0,_.useRef)(null),o=(0,_.useCallback)(()=>{if(!e.enabled){n();return}i(!0),a.current=setTimeout(()=>i(!1),3e3)},[e.enabled,n]);return(0,_.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),r?(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,B.jsx)(`button`,{onClick:()=>{i(!1),n()},className:`text-[11px] font-mono uppercase tracking-wider bg-red-500/8 border border-red-500/30 text-red-300 hover:bg-red-500/15 rounded-sm px-2 py-0.5 cursor-pointer transition-colors`,children:`disable`}),(0,B.jsx)(`button`,{onClick:()=>i(!1),className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer`,children:`cancel`})]}):(0,B.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer shrink-0`,children:[(0,B.jsx)(`input`,{type:`checkbox`,className:`w-3.5 h-3.5 accent-[var(--color-brand)] cursor-pointer`,checked:e.enabled,onChange:o}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider ${e.enabled?`text-[var(--color-fg-1)]`:`text-[var(--color-fg-4)]`}`,children:e.enabled?`on`:`off`})]})}function ks(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await fetch(`/api/json/rule-write-enforcement`,{headers:{Accept:`application/json`}});if(!n.ok)return;let r=await n.json();!e&&typeof r.enforced==`boolean`&&t(r.enforced)}catch{}})(),()=>{e=!0}},[]);async function o(e){r(!0);try{let n=await fetch(`/api/json/rule-write-enforcement`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({enforced:e})});if(n.ok){let e=await n.json();typeof e.enforced==`boolean`&&t(e.enforced)}}finally{r(!1),a(!1)}}if(e===null)return null;let s=!e;return(0,B.jsx)(V,{className:s?`border-amber-500/40 bg-amber-500/5`:`border-[var(--color-line-1)]`,children:(0,B.jsx)(U,{className:`px-3 py-2.5`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`rule-write protection`}),(0,B.jsx)(`span`,{className:`text-[11px] font-mono uppercase tracking-wider ${s?`text-amber-300`:`text-emerald-300`}`,children:s?`disabled`:`enforced`})]}),(0,B.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] mt-1 leading-snug`,children:s?`Agents can currently Write/Edit .rules files. Turn this back on when you finish authoring.`:`Agents cannot Write/Edit/MultiEdit any .sigmashake/rules/**/*.rules file. Disable only when curating rulesets.`})]}),(0,B.jsx)(`div`,{className:`shrink-0`,children:i?(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(`button`,{onClick:()=>o(!1),disabled:n,className:`text-[11px] font-mono uppercase tracking-wider bg-amber-500/10 border border-amber-500/40 text-amber-200 hover:bg-amber-500/20 rounded-sm px-2 py-0.5 cursor-pointer transition-colors disabled:opacity-50`,children:`disable`}),(0,B.jsx)(`button`,{onClick:()=>a(!1),disabled:n,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer disabled:opacity-50`,children:`cancel`})]}):(0,B.jsx)(`button`,{onClick:()=>{e?a(!0):o(!0)},disabled:n,className:`text-[11px] font-mono uppercase tracking-wider border rounded-sm px-2.5 py-0.5 cursor-pointer transition-colors disabled:opacity-50 ${s?`bg-emerald-500/10 border-emerald-500/40 text-emerald-200 hover:bg-emerald-500/20`:`bg-[var(--color-surface-1)] border-[var(--color-line-1)] text-[var(--color-fg-1)] hover:bg-[var(--color-surface-2)]`}`,children:s?`enable`:`disable`})})]})})})}function As(){let{data:e,refetch:t}=F(`/api/json/rules`,[je(Cs)[`rules-changed`]]),[n,r]=(0,_.useState)(``),i=new URLSearchParams(window.location.search).get(`highlight`)??``,a=(0,_.useRef)(null);if((0,_.useEffect)(()=>{a.current&&a.current.scrollIntoView({behavior:`smooth`,block:`center`})},[e,i]),!e)return(0,B.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading rules…`});if(e.rulesets.length===0)return(0,B.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 p-10 text-center`,children:[(0,B.jsx)(`p`,{className:`text-sm text-[var(--color-fg-2)] mb-2`,children:`No .rules files found.`}),(0,B.jsx)(`a`,{href:`/hub`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline`,children:`→ browse hub to install rulesets`})]});let o=n.toLowerCase(),s=e.rulesets.map(e=>({...e,rules:o?e.rules.filter(e=>e.id.toLowerCase().includes(o)||e.message.toLowerCase().includes(o)):e.rules})).filter(e=>!o||e.rules.length>0),c=e.rulesets.reduce((e,t)=>e+t.rules.length,0),l=e.rulesets.reduce((e,t)=>e+t.rules.filter(e=>e.enabled).length,0);return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`overline text-[11px]`,children:`rules`}),(0,B.jsxs)(`div`,{className:`flex items-baseline gap-3 mt-1`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-sm text-[var(--color-fg-0)] tabular-nums`,children:[l,(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`/`,c]}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-[11px] uppercase tracking-wider`,children:`active`})]}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-[var(--color-fg-3)] uppercase tracking-wider`,children:[e.files.length,` file`,e.files.length===1?``:`s`]})]})]}),(0,B.jsx)(`div`,{className:`ml-auto relative`,children:(0,B.jsx)(`input`,{type:`text`,placeholder:`search rules…`,value:n,onChange:e=>r(e.target.value),className:`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-xs rounded-sm px-2.5 py-1.5 w-56 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono`})})]}),(0,B.jsx)(ks,{}),s.length===0&&(0,B.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:[`no rules match "`,n,`"`]}),(0,B.jsx)(`div`,{className:`space-y-3`,children:s.map(e=>{let n=e.rules.some(e=>e.id===i),r=e.rules.filter(e=>e.enabled).length;return(0,B.jsx)(V,{children:(0,B.jsxs)(`details`,{open:n||!o,children:[(0,B.jsxs)(`summary`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer list-none select-none hover:bg-[var(--color-surface-2)]/70 border-b border-[var(--color-line-0)]`,children:[(0,B.jsxs)(`svg`,{className:`text-[var(--color-fg-3)] shrink-0`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,B.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,B.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]}),(0,B.jsx)(`code`,{className:`text-xs text-[var(--color-fg-0)] font-mono`,children:e.file}),(0,B.jsxs)(`span`,{className:`ml-auto font-mono text-[11px] text-[var(--color-fg-3)] tabular-nums`,children:[r,(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`/`,e.rules.length]})]})]}),(0,B.jsxs)(U,{className:`py-0`,children:[e.rules.length===0?(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] py-3`,children:`no rules in this file`}):(0,B.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:e.rules.map(n=>{let r=n.id===i;return(0,B.jsxs)(`div`,{ref:r?a:null,className:`py-2.5 flex items-start justify-between gap-4 ${r?`bg-amber-400/8 border-l-2 border-l-amber-400/60 -mx-3 px-3 -my-px`:``}`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1 flex-wrap`,children:[(0,B.jsx)(`select`,{value:n.decision,onChange:async r=>{await Ds(n.id,e.file,r.target.value),t()},className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm px-1.5 py-0.5 text-[11px] font-mono uppercase tracking-wider cursor-pointer focus:outline-none focus:border-[var(--color-brand)]/50 ${Ts[n.decision]??`text-[var(--color-fg-2)]`}`,children:ws.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))}),(0,B.jsx)(`code`,{className:`text-xs font-mono text-[var(--color-fg-0)] break-all`,children:n.id})]}),(0,B.jsx)(`p`,{className:`text-xs text-[var(--color-fg-2)] truncate`,children:n.message})]}),(0,B.jsx)(Os,{rule:n,file:e.file,onToggle:async()=>{await Es(n.id,e.file),t()}})]},n.id)})}),e.content&&(0,B.jsxs)(`details`,{className:`mt-3 pb-3`,children:[(0,B.jsx)(`summary`,{className:`overline cursor-pointer hover:text-[var(--color-fg-1)] select-none`,children:`raw source`}),(0,B.jsx)(`pre`,{className:`mt-2 p-3 bg-[var(--color-surface-0)] border border-[var(--color-line-0)] rounded-sm text-[11px] text-[var(--color-fg-2)] overflow-x-auto whitespace-pre-wrap break-words font-mono`,children:e.content})]})]})]})},e.file)})})]})}var js=[``,`allow`,`block`,`force`,`ask`,`log`],Ms=[``,`claude-code`,`gemini`,`antigravity`,`cursor`,`copilot`,`codex`,`pi`,`generic`],Ns=50;function Ps(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(Ns),u=je([`activity-updated`]),d=new URLSearchParams;e&&d.set(`decision`,e),n&&d.set(`tool`,n),i&&d.set(`client`,i);let{data:f,loading:p,error:m}=F(`/api/state/activity${d.size?`?`+d:``}`,[u[`activity-updated`],e,n,i]),h=e=>t=>{e(t.target.value),l(Ns)},g=(0,_.useMemo)(()=>{if(!f)return[];let e=o.trim().toLowerCase();return e?f.filter(t=>t.tool.toLowerCase().includes(e)||t.decision.toLowerCase().includes(e)||(t.rule_id??``).toLowerCase().includes(e)||(t.client??``).toLowerCase().includes(e)||(t.source_file??``).toLowerCase().includes(e)||t.input.toLowerCase().includes(e)):f},[f,o]),v=g.slice(0,c),y=g.length>c,b=f?.length??0,x=g.length,S=`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] font-mono rounded-sm px-2 py-1.5 focus:outline-none focus:border-[var(--color-brand)]/50 cursor-pointer`;return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`overline text-[11px]`,children:`audit log`}),f&&(0,B.jsx)(`p`,{className:`font-mono text-[11px] text-[var(--color-fg-3)] mt-1 tabular-nums`,children:o&&x!==b?`${x}/${b} events match`:`${b} events`})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`select`,{id:`audit-filter-decision`,value:e,onChange:h(t),className:S,children:js.map(e=>(0,B.jsx)(`option`,{value:e,children:e||`all decisions`},e))}),(0,B.jsx)(`select`,{id:`audit-filter-client`,value:i,onChange:h(a),className:S,children:Ms.map(e=>(0,B.jsx)(`option`,{value:e,children:e||`all clients`},e))}),(0,B.jsx)(`input`,{id:`audit-filter-tool`,type:`text`,placeholder:`filter by tool…`,value:n,onChange:h(r),className:`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] font-mono rounded-sm px-2.5 py-1.5 w-36 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)]`})]})]}),(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsxs)(`svg`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-fg-4)] pointer-events-none`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,B.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,B.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,B.jsx)(`input`,{id:`audit-search`,type:`text`,placeholder:`search tool, command, path, rule id, input fields…`,value:o,onChange:e=>{s(e.target.value),l(Ns)},className:`w-full bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-sm rounded-sm pl-9 pr-10 py-2.5 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono transition-colors`}),o&&(0,B.jsx)(`button`,{onClick:()=>{s(``),l(Ns)},className:`absolute right-3 top-1/2 -translate-y-1/2 text-[var(--color-fg-4)] hover:text-[var(--color-fg-1)] transition-colors cursor-pointer`,title:`Clear search`,children:(0,B.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,B.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,B.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),f&&f.length>0&&(0,B.jsxs)(`div`,{className:`flex items-center gap-3 px-3 font-mono text-[10px] uppercase tracking-widest text-[var(--color-fg-4)] select-none`,children:[(0,B.jsx)(`span`,{className:`w-3`}),(0,B.jsx)(`span`,{className:`w-14`,children:`time`}),(0,B.jsx)(`span`,{className:`w-14`,children:`decision`}),(0,B.jsx)(`span`,{className:`w-28`,children:`tool`}),(0,B.jsx)(`span`,{className:`flex-1`,children:`preview`}),(0,B.jsx)(`span`,{children:`client`})]}),m&&(0,B.jsxs)(`p`,{className:`text-sm text-red-300 font-mono`,children:[`failed to load audit log: `,m]}),p&&!f&&(0,B.jsx)(`div`,{className:`space-y-1.5`,children:Array.from({length:10}).map((e,t)=>(0,B.jsx)(`div`,{className:`h-9 bg-[var(--color-surface-1)] rounded-sm border border-[var(--color-line-0)] border-l-2 border-l-[var(--color-line-2)] shimmer`},t))}),!p&&!m&&g.length===0&&(0,B.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] py-16 flex flex-col items-center justify-center text-center`,children:[(0,B.jsxs)(`svg`,{className:`text-[var(--color-fg-4)] mb-3`,width:`32`,height:`32`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,B.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,B.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,B.jsx)(`p`,{className:`text-xs font-mono text-[var(--color-fg-3)] uppercase tracking-wider`,children:o?`no events match your search`:`no audit entries yet`}),o&&(0,B.jsx)(`button`,{onClick:()=>s(``),className:`mt-3 text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline cursor-pointer`,children:`clear search`})]}),v.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`space-y-1.5`,children:v.map(e=>(0,B.jsx)(Xo,{row:e},e.id))}),y&&(0,B.jsxs)(`div`,{className:`flex items-center justify-center gap-4 pt-2`,children:[(0,B.jsxs)(`button`,{onClick:()=>l(e=>e+Ns),className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-2)] hover:text-[var(--color-fg-0)] border border-[var(--color-line-1)] hover:border-[var(--color-line-2)] rounded-sm px-4 py-1.5 transition-colors cursor-pointer`,children:[`show`,` `,Math.min(Ns,g.length-c),` more`]}),(0,B.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:[c,` / `,g.length]})]})]})]})}var Fs={allow:`green`,block:`red`,force:`amber`,ask:`blue`,log:`gray`},Is=[`all`,`allow`,`block`,`force`,`log`],Ls={allow:`text-emerald-300`,block:`text-red-300`,force:`text-amber-300`,log:`text-[var(--color-fg-3)]`};function Rs(e){return new Date(e*1e3).toLocaleString()}function zs(e,t){if(!t)return``;let n=t-e;return n<60?`${n}s`:`${Math.round(n/60)}m`}async function Bs(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:Ae()})}function Vs(e){try{let t=JSON.parse(e).input;return t&&typeof t==`object`?ur(``,JSON.stringify(t)):ur(``,e)}catch{return e.slice(0,80)}}function Hs(e){try{let t=JSON.parse(e);return t.input===void 0?JSON.stringify(JSON.parse(e),null,2):JSON.stringify(t.input,null,2)}catch{return e}}function Us({label:e,value:t,tone:n}){return(0,B.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,B.jsx)(`span`,{className:`font-mono text-sm tabular-nums ${n??`text-[var(--color-fg-0)]`}`,children:t}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-[var(--color-fg-3)]`,children:e})]})}function Ws(){let e=je([`pending-changed`]),{data:t,refetch:n}=F(`/api/json/pending`,[e[`pending-changed`]]),{data:r}=F(`/api/json/approvals`,[e[`pending-changed`]]),[i,a]=(0,_.useState)(`all`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(new Set),u=Math.floor(Date.now()/1e3),d=(r??[]).filter(e=>e.created_at>=u-86400).length,f=(r??[]).reduce((e,t)=>(e[t.decision]=(e[t.decision]??0)+1,e),{}),p=(r??[]).filter(e=>{if(i!==`all`&&e.decision!==i)return!1;if(o){let t=o.toLowerCase(),n=Vs(e.input).toLowerCase();if(!e.tool.toLowerCase().includes(t)&&!e.rule_id.toLowerCase().includes(t)&&!(e.rule_message??``).toLowerCase().includes(t)&&!n.includes(t))return!1}return!0});function m(e){l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`overline text-[11px]`,children:`approvals`}),(0,B.jsx)(`p`,{className:`text-xs text-[var(--color-fg-3)] mt-1 font-mono`,children:`approve or deny pending tool calls · review past decisions`})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5 px-3 py-2.5 rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)]/60`,children:[(0,B.jsx)(Us,{label:`pending`,value:t?.length??0,tone:`text-amber-300`}),(0,B.jsx)(`span`,{className:`text-[var(--color-line-2)]`,children:`|`}),[`allow`,`block`,`force`,`log`].map(e=>(0,B.jsx)(Us,{label:e,value:f[e]??0,tone:Ls[e]},e)),(0,B.jsx)(`span`,{className:`text-[var(--color-line-2)]`,children:`|`}),(0,B.jsx)(Us,{label:`last 24h`,value:d})]}),t&&t.length>0&&(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,B.jsxs)(`h2`,{className:`overline text-[11px]`,children:[`pending · `,t.length]})}),(0,B.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,B.jsxs)(V,{className:`border-l-2 border-l-amber-400/60`,children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(W,{size:`sm`,variant:`primary`,onClick:async()=>{await Bs(e.id,`allow`),n()},children:`approve`}),(0,B.jsx)(W,{size:`sm`,variant:`danger`,onClick:async()=>{await Bs(e.id,`block`),n()},children:`deny`})]})]}),(0,B.jsxs)(U,{className:`space-y-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex gap-3 flex-wrap items-center`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`tool`}),(0,B.jsx)(`code`,{className:`text-[var(--color-brand)] font-mono`,children:e.toolCall.tool}),(0,B.jsx)(`span`,{className:`overline ml-2`,children:`rule`}),(0,B.jsx)(`span`,{className:`font-mono text-[var(--color-fg-2)]`,children:e.ruleId})]}),e.prompt&&(0,B.jsxs)(`div`,{className:`flex gap-2 items-start`,children:[(0,B.jsx)(`span`,{className:`overline pt-0.5 shrink-0`,children:`why`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.prompt})]}),(0,B.jsx)(Zo,{children:JSON.stringify(e.toolCall.input,null,2)})]})]},e.id))})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-3 gap-3 flex-wrap`,children:[(0,B.jsx)(`h2`,{className:`overline text-[11px]`,children:`history`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,B.jsx)(`div`,{className:`flex gap-0.5 rounded-sm border border-[var(--color-line-1)] p-0.5 bg-[var(--color-surface-1)]`,children:Is.map(e=>(0,B.jsx)(`button`,{onClick:()=>a(e),className:`px-2 py-0.5 rounded-sm text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer ${i===e?`bg-[var(--color-brand)]/10 text-[var(--color-brand)] border border-[var(--color-brand)]/30`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] border border-transparent`}`,children:e},e))}),(0,B.jsx)(`input`,{type:`text`,placeholder:`search tool, rule, command…`,value:o,onChange:e=>s(e.target.value),className:`text-xs font-mono bg-[var(--color-surface-1)] border border-[var(--color-line-1)] rounded-sm px-2.5 py-1 text-[var(--color-fg-1)] placeholder-[var(--color-fg-4)] focus:outline-none focus:border-[var(--color-brand)]/50 w-48`})]})]}),!r||r.length===0?(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:`no approval history yet`}):p.length===0?(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:`no results match your filter`}):(0,B.jsx)(V,{children:(0,B.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:p.map(e=>{let t=c.has(e.id),n=Vs(e.input),r=zs(e.created_at,e.resolved_at);return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{onClick:()=>m(e.id),className:`w-full text-left px-3 py-2 flex items-center gap-3 hover:bg-[var(--color-surface-2)]/60 transition-colors cursor-pointer`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-[10px] w-2.5 shrink-0`,children:t?`▼`:`▶`}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] whitespace-nowrap shrink-0 w-36 tabular-nums`,children:Rs(e.resolved_at??e.created_at)}),(0,B.jsx)(`span`,{className:`shrink-0`,children:(0,B.jsx)(mr,{variant:Fs[e.decision]??`gray`,children:e.decision})}),(0,B.jsx)(`code`,{className:`text-xs text-[var(--color-brand)] shrink-0 font-mono`,children:e.tool}),(0,B.jsx)(`span`,{className:`text-xs text-[var(--color-fg-2)] truncate flex-1 min-w-0`,children:e.rule_message||e.rule_id||`—`}),n&&(0,B.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)] font-mono truncate max-w-[180px] shrink-0 hidden md:block`,children:n}),r&&(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] shrink-0`,children:[`Δ`,r]})]}),t&&(0,B.jsxs)(`div`,{className:`px-3 pb-3 pt-1 space-y-2 bg-[var(--color-surface-0)]`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs font-mono`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`rule`}),` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.rule_id||`—`})]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`created`}),` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Rs(e.created_at)})]}),e.resolved_at&&(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`resolved`}),` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Rs(e.resolved_at)})]})]}),e.prompt&&(0,B.jsxs)(`div`,{className:`text-xs flex gap-2 items-start`,children:[(0,B.jsx)(`span`,{className:`overline pt-0.5 shrink-0`,children:`why`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.prompt})]}),(0,B.jsx)(Zo,{children:Hs(e.input)})]})]},e.id)})})})]})]})}function Gs(){let{data:e,refetch:t}=F(`/api/json/inspector-targets`),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(1),u=(0,_.useRef)(new Map),d=(0,_.useRef)(new Map),f=(0,_.useCallback)(()=>{let e=c.current;if(c.current=null,e)try{e.close()}catch{}r(!1),a(!1),s(null)},[]),p=(0,_.useCallback)(e=>{c.current&&f(),a(!0),s(null);let t=new WebSocket(`/ws/inspector?target=${encodeURIComponent(e)}`);c.current=t,t.onopen=()=>{r(!0),a(!1),s(null)},t.onclose=()=>{c.current=null,r(!1),a(!1)},t.onerror=()=>{a(!1),s(`Connection failed — is the inspector running with the correct target ID?`)},t.onmessage=e=>{try{let t=JSON.parse(e.data);if(t.id!=null){let e=u.current.get(t.id);e&&(u.current.delete(t.id),e(t.result))}else if(t.method){let e=d.current.get(t.method);if(e)for(let n of e)n(t.params)}}catch{}}},[f]),m=(0,_.useCallback)((e,t)=>new Promise((n,r)=>{let i=c.current;if(!i||i.readyState!==WebSocket.OPEN){r(Error(`Not connected`));return}let a=l.current++;u.current.set(a,e=>n(e)),i.send(JSON.stringify({id:a,method:e,params:t})),setTimeout(()=>{u.current.has(a)&&(u.current.delete(a),r(Error(`Command timed out`)))},1e4)}),[]),h=(0,_.useCallback)((e,t)=>{let n=d.current.get(e);return n||(n=new Set,d.current.set(e,n)),n.add(t),()=>{d.current.get(e)?.delete(t)}},[]),g=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{e?.active&&e?.target&&!n&&!i&&!g.current&&(g.current=!0,p(e.target.id))},[e?.active,e?.target?.id,n,i,p]),(0,_.useEffect)(()=>()=>{f()},[f]),{active:e?.active??!1,bunVersion:e?.version?.[`Bun-Version`]??null,preconfiguredTarget:e?.target??null,connected:n,connecting:i,error:o,connect:p,disconnect:f,sendCommand:m,onEvent:h,refetch:t}}var Ks=18,qs=5e-4;function Js(e,t){return t===`(garbage collector)`||t===`(idle)`?`#450a0a`:e?e.startsWith(`node:`)||e.startsWith(`bun:`)?`#172554`:e.startsWith(`file:`)||e.startsWith(`/`)||e.includes(`.ts`)||e.includes(`.js`)?`#451a03`:`#1f2937`:`#1f2937`}function Ys(e,t){return t===`(garbage collector)`||t===`(idle)`?`#fca5a5`:e?e.startsWith(`node:`)||e.startsWith(`bun:`)?`#93c5fd`:e.startsWith(`file:`)||e.startsWith(`/`)||e.includes(`.ts`)||e.includes(`.js`)?`#fbbf24`:`#6b7280`:`#6b7280`}function Xs(e,t){let n=new Map;for(let t of e.nodes)n.set(t.id,t);let r=new Map;function i(e){let t=n.get(e);if(!t)return 0;let a=t.hitCount??0;for(let e of t.children??[])a+=i(e);return r.set(e,a),a}let a=e.nodes[0];if(!a)return[];i(a.id);let o=t??a.id,s=r.get(o)??0;if(s===0)return[];let c=[];function l(e,t,i){let a=n.get(e);if(!a)return;let o=r.get(e)??0,u=o/s;if(u<qs)return;c.push({x:i,width:u,depth:t,node:a,subtreeHits:o});let d=i;for(let e of a.children??[]){let n=(r.get(e)??0)/s;l(e,t+1,d),d+=n}}return l(o,0,0),c}function Zs(e){return e<1e3?`${e}µs`:e<1e6?`${(e/1e3).toFixed(1)}ms`:`${(e/1e6).toFixed(2)}s`}function Qs({profile:e}){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(800),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null);(0,_.useEffect)(()=>{let e=t.current;if(!e)return;let n=new ResizeObserver(e=>{let t=e[0]?.contentRect.width;t&&r(t)});return n.observe(e),r(e.clientWidth||800),()=>n.disconnect()},[]);let c=Xs(e,i),l=(c.reduce((e,t)=>Math.max(e,t.depth),0)+1)*Ks+4,u=e.endTime-e.startTime,d=(0,_.useCallback)(e=>{a(t=>t===e.node.id?null:e.node.id),s(null)},[]);return c.length===0?(0,B.jsx)(`p`,{className:`text-xs text-[#555] py-2`,children:`No samples — profile may be empty.`}):(0,B.jsxs)(`div`,{className:`relative select-none`,children:[i!==null&&(0,B.jsx)(`button`,{onClick:()=>a(null),className:`mb-2 text-xs text-amber-400 hover:underline`,children:`← Reset zoom`}),(0,B.jsx)(`div`,{ref:t,className:`overflow-x-hidden`,children:(0,B.jsx)(`svg`,{width:n,height:l,onMouseLeave:()=>s(null),children:c.map((e,t)=>{let r=e.x*n,a=Math.max(e.width*n,1),o=e.depth*Ks+1,c=e.node.callFrame.functionName||`(anonymous)`,l=e.node.callFrame.url,f=i===e.node.id;return(0,B.jsxs)(`g`,{children:[(0,B.jsx)(`rect`,{x:r,y:o,width:a,height:Ks-1,fill:f?`#92400e`:Js(l,c),stroke:`#080808`,strokeWidth:.5,style:{cursor:`pointer`},onClick:()=>d(e),onMouseMove:t=>s({clientX:t.clientX,clientY:t.clientY,rect:e,totalDuration:u})}),a>24&&(0,B.jsx)(`text`,{x:r+2,y:o+Ks-5,fontSize:9,fill:Ys(l,c),style:{pointerEvents:`none`,userSelect:`none`},clipPath:`url(#fc-clip-${t})`,children:c}),a>24&&(0,B.jsx)(`clipPath`,{id:`fc-clip-${t}`,children:(0,B.jsx)(`rect`,{x:r,y:o,width:a,height:Ks})})]},t)})})}),o&&(0,B.jsxs)(`div`,{className:`fixed z-50 bg-[#111] border border-[#2a2a2a] rounded-lg p-2.5 text-xs shadow-xl pointer-events-none`,style:{left:o.clientX+14,top:o.clientY-8,maxWidth:320},children:[(0,B.jsx)(`div`,{className:`font-mono text-amber-400 truncate font-medium`,children:o.rect.node.callFrame.functionName||`(anonymous)`}),o.rect.node.callFrame.url&&(0,B.jsxs)(`div`,{className:`text-[#666] truncate mt-0.5 text-[10px]`,children:[o.rect.node.callFrame.url,`:`,o.rect.node.callFrame.lineNumber]}),(0,B.jsxs)(`div`,{className:`mt-1.5 space-y-0.5 text-[#aaa]`,children:[(0,B.jsxs)(`div`,{children:[`Samples:`,` `,(0,B.jsx)(`span`,{className:`text-white tabular-nums`,children:o.rect.subtreeHits})]}),(0,B.jsxs)(`div`,{children:[`Time share:`,` `,(0,B.jsxs)(`span`,{className:`text-white tabular-nums`,children:[(o.rect.width*100).toFixed(1),`%`]})]}),u>0&&(0,B.jsxs)(`div`,{children:[`Est. duration:`,` `,(0,B.jsx)(`span`,{className:`text-white tabular-nums`,children:Zs(Math.round(o.rect.width*u))})]})]}),o.rect.node.deoptReason&&(0,B.jsxs)(`div`,{className:`text-red-400 mt-1.5 text-[10px]`,children:[`⚠ `,o.rect.node.deoptReason]}),(0,B.jsx)(`div`,{className:`text-[#555] mt-1.5 text-[10px]`,children:`Click to zoom · click again to reset`})]})]})}function $s(e){return e<1e6?`${(e/1e3).toFixed(0)}µs`:e<1e9?`${(e/1e6).toFixed(1)}ms`:`${(e/1e9).toFixed(2)}s`}function ec(e){return new Date(e*1e3).toLocaleString()}var tc={critical:`red`,high:`red`,medium:`amber`,low:`blue`},nc={critical:`border-l-red-500/70`,high:`border-l-red-500/50`,medium:`border-l-amber-400/60`,low:`border-l-sky-400/50`};function rc(){let{data:e}=F(`/api/json/profile`);if(!e)return(0,B.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading profile…`});let{diagnosis:t,sessions:n}=e;return!t||t.analyzed_evals===0?(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 px-4 py-6 text-center`,children:(0,B.jsxs)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] font-mono`,children:[`no eval data yet — run`,` `,(0,B.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg eval`}),` to start recording`]})}):(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-2`,children:[{label:`evals analyzed`,value:String(t.analyzed_evals)},{label:`median (inside)`,value:$s(t.median_eval_ns)},{label:`p99 (inside)`,value:$s(t.p99_eval_ns)},{label:`bottleneck`,value:t.bottleneck??`—`}].map(e=>(0,B.jsx)(ns,{label:e.label,value:e.value,labelPlacement:`above`,valueClassName:`text-xl font-medium tabular-nums text-[var(--color-fg-0)]`},e.label))}),t.phases.length>0&&(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`phase breakdown`})}),(0,B.jsx)(U,{children:(0,B.jsx)(`div`,{className:`space-y-2`,children:t.phases.filter(e=>e.median_ns>0).map(e=>{let n=e.name===t.bottleneck;return(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,B.jsx)(`span`,{className:`w-28 font-mono truncate ${n?`text-[var(--color-brand)] font-medium`:`text-[var(--color-fg-2)]`}`,title:n?`bottleneck`:void 0,children:e.name}),(0,B.jsx)(is,{pct:Math.min(e.pct_of_total,100),tone:n?`amber`:`gray`,className:`h-1 flex-1`}),(0,B.jsx)(`span`,{className:`w-16 text-right text-[var(--color-fg-1)] tabular-nums font-mono`,children:$s(e.median_ns)}),(0,B.jsxs)(`span`,{className:`w-10 text-right text-[var(--color-fg-3)] tabular-nums font-mono`,children:[e.pct_of_total,`%`]}),(0,B.jsxs)(`span`,{className:`w-20 text-right text-[var(--color-fg-4)] tabular-nums font-mono text-[10px]`,children:[`p95 `,$s(e.p95_ns)]})]},e.name)})})})]}),t.recommendations.length>0&&(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsxs)(`span`,{className:`overline`,children:[`recommendations · `,t.recommendations.length]})}),(0,B.jsx)(U,{className:`space-y-2`,children:t.recommendations.map((e,t)=>(0,B.jsxs)(`div`,{className:`border border-[var(--color-line-1)] bg-[var(--color-surface-0)] rounded-sm px-3 py-2.5 border-l-2 ${nc[e.severity]??`border-l-[var(--color-line-2)]`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,B.jsx)(mr,{variant:tc[e.severity]??`gray`,children:e.severity}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:e.type})]}),(0,B.jsx)(`p`,{className:`text-sm text-[var(--color-fg-1)] leading-relaxed`,children:e.message}),e.fix_command&&(0,B.jsxs)(`code`,{className:`text-[11px] text-[var(--color-brand)] font-mono mt-1.5 block`,children:[`$ `,e.fix_command]})]},t))})]}),t.anomalies.length>0&&(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsxs)(`span`,{className:`overline`,children:[`anomalies · `,t.anomalies.length]})}),(0,B.jsx)(U,{children:(0,B.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:t.anomalies.map((e,t)=>(0,B.jsxs)(`div`,{className:`py-2 flex items-center gap-4 text-xs font-mono`,children:[(0,B.jsx)(`span`,{className:`w-24 text-[var(--color-brand)] uppercase tracking-wider text-[10px]`,children:e.type}),(0,B.jsxs)(`span`,{className:`w-10 tabular-nums text-[var(--color-fg-1)]`,children:[e.count,`×`]}),(0,B.jsxs)(`span`,{className:`w-20 tabular-nums text-[var(--color-fg-1)]`,children:[e.max_ms,`ms max`]}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:e.likely_cause})]},t))})})]}),n.length>0&&(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`session history`}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[n.length,` session`,n.length===1?``:`s`]})]}),(0,B.jsx)(U,{className:`p-0`,children:(0,B.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:[...n].reverse().map((e,t)=>(0,B.jsxs)(`div`,{className:`px-4 py-2.5 flex flex-wrap items-center gap-x-5 gap-y-1 text-xs ${e.is_current?`bg-amber-400/[0.04] border-l-2 border-l-amber-400/60`:``}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 w-48 shrink-0`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums font-mono`,children:ec(e.start_ts)}),e.is_current&&(0,B.jsx)(mr,{variant:`amber`,children:`current`})]}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums font-mono w-20`,children:[e.evals,` eval`,e.evals===1?``:`s`]}),(0,B.jsxs)(`span`,{className:`text-emerald-300 tabular-nums font-mono`,children:[e.allowed,` allow`]}),e.blocked>0&&(0,B.jsxs)(`span`,{className:`text-red-300 tabular-nums font-mono`,children:[e.blocked,` block (`,e.block_rate_pct,`%)`]}),e.asked>0&&(0,B.jsxs)(`span`,{className:`text-sky-300 tabular-nums font-mono`,children:[e.asked,` ask`]}),e.forced>0&&(0,B.jsxs)(`span`,{className:`text-violet-300 tabular-nums font-mono`,children:[e.forced,` force`]}),e.avg_ns>0&&(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums ml-auto font-mono`,children:[`avg `,$s(e.avg_ns)]}),e.top_rule&&(0,B.jsxs)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.top_rule)}`,className:`text-[var(--color-fg-4)] hover:text-[var(--color-brand)] font-mono truncate max-w-xs transition-colors w-full pl-48`,title:`most blocked rule: ${e.top_rule}`,children:[`top block: `,e.top_rule]})]},t))})})]})]})}var ic={log:`text-[var(--color-fg-1)]`,info:`text-sky-300`,warn:`text-amber-300`,error:`text-red-300`,debug:`text-[var(--color-fg-3)]`};function ac(e){return e.value==null?e.description?e.description:`[${e.type}]`:String(e.value)}function oc(){let e=Gs(),[t,n]=(0,_.useState)(!1),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(0);(0,_.useEffect)(()=>{d.current?.scrollIntoView({behavior:`smooth`})},[a]),(0,_.useEffect)(()=>{if(e.connected)return e.sendCommand(`Runtime.enable`).catch(()=>{}),e.onEvent(`Runtime.consoleAPICalled`,e=>{let t=e;o(e=>{let n=[...e,{id:f.current++,type:t.type??`log`,args:t.args??[],timestamp:t.timestamp??Date.now()}];return n.length>500?n.slice(-500):n})})},[e.connected]);let p=(0,_.useCallback)(()=>{e.preconfiguredTarget&&e.connect(e.preconfiguredTarget.id)},[e]),m=(0,_.useCallback)(async()=>{try{await e.sendCommand(`Profiler.enable`),await e.sendCommand(`Profiler.start`),n(!0),i(null)}catch(e){console.error(`Profiler.start failed:`,e)}},[e]),h=(0,_.useCallback)(async()=>{try{let t=await e.sendCommand(`Profiler.stop`);n(!1),i(t.profile)}catch(e){console.error(`Profiler.stop failed:`,e),n(!1)}},[e]),g=(0,_.useCallback)(async()=>{u(!0);try{let t=await e.sendCommand(`Runtime.evaluate`,{expression:`JSON.stringify(process.memoryUsage())`,returnByValue:!0});c(JSON.parse(t.result.value))}catch{}finally{u(!1)}},[e]);function v(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}let y=e.connected?`connected${e.bunVersion?` · bun v${e.bunVersion}`:``}`:e.connecting?`connecting…`:e.active?`inspector active, connecting…`:`inspector not available`,b=e.connected?`bg-emerald-400`:e.connecting?`bg-amber-400 pulse-soft`:e.active?`bg-sky-400`:`bg-[var(--color-line-2)]`;return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono text-[var(--color-fg-2)]`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${b}`}),y]}),e.connected?(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:e.disconnect,children:`disconnect`}):(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:e.preconfiguredTarget?p:e.refetch,disabled:e.connecting,children:e.preconfiguredTarget?`reconnect`:`refresh`})]})]}),e.error&&(0,B.jsx)(U,{children:(0,B.jsx)(`p`,{className:`text-xs text-red-300 font-mono`,children:e.error})})]}),e.connected&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`cpu profiler`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&(0,B.jsxs)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300 flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-400 pulse-soft`}),`recording`]}),t?(0,B.jsx)(W,{variant:`danger`,size:`sm`,onClick:h,children:`stop & render`}):(0,B.jsx)(W,{variant:`primary`,size:`sm`,onClick:m,children:`start recording`})]})]}),(0,B.jsx)(U,{children:r?(0,B.jsx)(os,{profile:r,children:(0,B.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 overflow-x-hidden`,children:(0,B.jsx)(Qs,{profile:r})})}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:t?`recording… perform actions in ssg, then stop.`:`click start recording, perform actions, then stop.`})})]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`memory`}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:g,disabled:l,children:l?`…`:`refresh`})]}),(0,B.jsx)(U,{children:s?(0,B.jsx)(ss,{memory:s,formatValue:v}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:`click refresh to fetch process.memoryUsage().`})})]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`console`}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o([]),children:`clear`})]}),(0,B.jsx)(U,{children:(0,B.jsxs)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 h-56 overflow-y-auto font-mono text-[11px]`,children:[a.length===0?(0,B.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`console output will appear here…`}):a.map(e=>(0,B.jsxs)(`div`,{className:`py-0.5 border-b border-[var(--color-line-0)] ${ic[e.type]??`text-[var(--color-fg-1)]`}`,children:[(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)] mr-2 uppercase tracking-wider`,children:[`[`,e.type,`]`]}),e.args.map(ac).join(` `)]},e.id)),(0,B.jsx)(`div`,{ref:d})]})})]})]}),!e.connected&&!e.connecting&&(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 px-4 py-6 text-center`,children:(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:e.active?`waiting for inspector connection…`:`inspector auto-starts with ssg serve. profiler, memory, and console appear here once connected.`})})]})}function sc({active:e,onClick:t,children:n}){return(0,B.jsxs)(`button`,{onClick:t,className:`relative px-3 h-9 text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer ${e?`text-[var(--color-fg-0)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`}`,children:[n,e&&(0,B.jsx)(`span`,{className:`absolute inset-x-2 -bottom-px h-px bg-[var(--color-brand)]`})]})}function cc(){let[e,t]=(0,_.useState)(`eval`);return(0,B.jsxs)(`div`,{className:`space-y-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center border-b border-[var(--color-line-0)] mb-5`,children:[(0,B.jsx)(sc,{active:e===`eval`,onClick:()=>t(`eval`),children:`eval profile`}),(0,B.jsx)(sc,{active:e===`inspector`,onClick:()=>t(`inspector`),children:`runtime inspector`})]}),e===`eval`?(0,B.jsx)(rc,{}):(0,B.jsx)(oc,{})]})}function lc(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}var uc=[{value:`downloads`,label:`most downloaded`},{value:`newest`,label:`newest`},{value:`rules`,label:`most rules`}],dc=[``,`critical`,`high`,`medium`,`low`],fc=[``,`deny`,`ask`,`allow`,`log`];function pc(){return(0,B.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)] p-4 space-y-3 shimmer`,children:[(0,B.jsx)(`div`,{className:`h-4 bg-[var(--color-surface-3)] rounded-sm w-2/3`}),(0,B.jsx)(`div`,{className:`h-3 bg-[var(--color-surface-2)] rounded-sm w-1/3`}),(0,B.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,B.jsx)(`div`,{className:`h-5 bg-[var(--color-surface-3)] rounded-sm w-14`}),(0,B.jsx)(`div`,{className:`h-5 bg-[var(--color-surface-3)] rounded-sm w-10`})]}),(0,B.jsx)(`div`,{className:`h-7 bg-[var(--color-surface-3)] rounded-sm`})]})}function mc({tech:e}){return(0,B.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded-sm text-[10px] font-mono uppercase tracking-wider border ${{typescript:`bg-sky-500/8 text-sky-300 border-sky-500/25`,ts:`bg-sky-500/8 text-sky-300 border-sky-500/25`,javascript:`bg-amber-500/8 text-amber-300 border-amber-500/25`,js:`bg-amber-500/8 text-amber-300 border-amber-500/25`,python:`bg-emerald-500/8 text-emerald-300 border-emerald-500/25`,rust:`bg-orange-500/8 text-orange-300 border-orange-500/25`,go:`bg-cyan-500/8 text-cyan-300 border-cyan-500/25`,bash:`bg-violet-500/8 text-violet-300 border-violet-500/25`}[e.toLowerCase()]??`bg-[var(--color-surface-2)] text-[var(--color-fg-3)] border-[var(--color-line-1)]`}`,children:e})}function hc({rs:e,installingId:t,onInstall:n,flashId:r}){let i=t===e.id,a=r===e.id;return(0,B.jsxs)(`div`,{className:`group relative flex flex-col rounded-sm border bg-[var(--color-surface-1)] transition-colors overflow-hidden
|
|
11
11
|
${e.installed?`border-emerald-500/25 hover:border-emerald-500/40`:`border-[var(--color-line-1)] hover:border-[var(--color-line-2)]`}
|
|
12
|
-
${a?`ring-1 ring-emerald-500/40`:``}`,children:[e.installed&&(0,B.jsxs)(`div`,{className:`absolute top-2 right-2 z-10 flex items-center gap-1 px-1.5 py-0.5 rounded-sm bg-emerald-500/10 border border-emerald-500/30 text-emerald-300 text-[10px] font-mono uppercase tracking-wider`,children:[(0,B.jsx)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,children:(0,B.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),`installed`]}),(0,B.jsxs)(`a`,{href:`/hub/${e.id}`,className:`block p-3 flex-1 min-h-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-2`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 pr-16`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium text-[var(--color-fg-0)] leading-snug`,children:e.title}),e.tested_versions&&e.tested_versions.length>0&&(0,B.jsx)(`span`,{title:`Certified ruleset`,className:`text-[var(--color-brand)] text-[11px]`,children:`★`})]}),(0,B.jsxs)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] mt-0.5 font-mono`,children:[`@`,e.author]})]}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] shrink-0 mt-0.5`,children:[`v`,e.version]})]}),e.technologies.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1 mb-3`,children:[e.technologies.slice(0,4).map(e=>(0,B.jsx)(
|
|
12
|
+
${a?`ring-1 ring-emerald-500/40`:``}`,children:[e.installed&&(0,B.jsxs)(`div`,{className:`absolute top-2 right-2 z-10 flex items-center gap-1 px-1.5 py-0.5 rounded-sm bg-emerald-500/10 border border-emerald-500/30 text-emerald-300 text-[10px] font-mono uppercase tracking-wider`,children:[(0,B.jsx)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,children:(0,B.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),`installed`]}),(0,B.jsxs)(`a`,{href:`/hub/${e.id}`,className:`block p-3 flex-1 min-h-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-2`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 pr-16`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium text-[var(--color-fg-0)] leading-snug`,children:e.title}),e.tested_versions&&e.tested_versions.length>0&&(0,B.jsx)(`span`,{title:`Certified ruleset`,className:`text-[var(--color-brand)] text-[11px]`,children:`★`})]}),(0,B.jsxs)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] mt-0.5 font-mono`,children:[`@`,e.author]})]}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] shrink-0 mt-0.5`,children:[`v`,e.version]})]}),e.technologies.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1 mb-3`,children:[e.technologies.slice(0,4).map(e=>(0,B.jsx)(mc,{tech:e},e)),e.technologies.length>4&&(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] self-center`,children:[`+`,e.technologies.length-4]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] font-mono text-[var(--color-fg-3)]`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,B.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,B.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]}),(0,B.jsx)(`span`,{className:`tabular-nums`,children:e.rule_count}),(0,B.jsx)(`span`,{className:`uppercase tracking-wider text-[10px] text-[var(--color-fg-4)]`,children:`rules`})]}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,B.jsx)(`polyline`,{points:`8 17 12 21 16 17`}),(0,B.jsx)(`line`,{x1:`12`,y1:`12`,x2:`12`,y2:`21`}),(0,B.jsx)(`path`,{d:`M20.88 18.09A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.29`})]}),(0,B.jsx)(`span`,{className:`tabular-nums`,children:lc(e.download_count)})]})]})]}),(0,B.jsx)(`div`,{className:`px-3 pb-3 pt-0`,children:e.installed?(0,B.jsxs)(`div`,{className:`flex items-center justify-center gap-1.5 h-7 w-full rounded-sm text-[11px] font-mono uppercase tracking-wider text-emerald-300 bg-emerald-500/5 border border-emerald-500/25`,children:[(0,B.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,B.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),`installed`]}):(0,B.jsx)(`button`,{onClick:t=>{t.preventDefault(),t.stopPropagation(),n(e.id)},disabled:i,className:`w-full h-7 rounded-sm text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer
|
|
13
13
|
bg-[var(--color-brand)]/8 text-[var(--color-brand)] border border-[var(--color-brand)]/30
|
|
14
14
|
hover:bg-[var(--color-brand)]/15 hover:border-[var(--color-brand)]/50
|
|
15
|
-
disabled:opacity-40 disabled:cursor-not-allowed`,children:i?(0,B.jsxs)(`span`,{className:`flex items-center justify-center gap-1.5`,children:[(0,B.jsx)(`svg`,{className:`animate-spin`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,B.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),`installing…`]}):`install`})})]})}function
|
|
15
|
+
disabled:opacity-40 disabled:cursor-not-allowed`,children:i?(0,B.jsxs)(`span`,{className:`flex items-center justify-center gap-1.5`,children:[(0,B.jsx)(`svg`,{className:`animate-spin`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,B.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),`installing…`]}):`install`})})]})}function gc(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(`downloads`),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(`all`),[u,d]=(0,_.useState)([]),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(0),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),T=(0,_.useCallback)((t=0)=>{let r=new URLSearchParams({page:String(t)});return e&&r.set(`search`,e),n&&n!==`downloads`&&r.set(`sort`,n),i&&r.set(`decision`,i),o&&r.set(`severity`,o),r},[e,n,i,o]);(0,_.useEffect)(()=>{let e=!1;return v(!0),h(0),fetch(`/api/json/hub?${T(0)}`).then(e=>e.json()).then(t=>{e||(d(t.data),p(t.has_more),h(0))}).catch(()=>{}).finally(()=>{e||v(!1)}),()=>{e=!0}},[T]);async function E(){let e=m+1;v(!0);try{let t=await fetch(`/api/json/hub?${T(e)}`);if(!t.ok)return;let n=await t.json();d(e=>[...e,...n.data]),p(n.has_more),h(e)}catch{}finally{v(!1)}}async function ee(){let e=await fetch(`/api/json/hub?${T(0)}`);if(!e.ok)return;let t=await e.json();d(t.data),p(t.has_more),h(0)}async function D(e){b(e);try{let t=await(await fetch(`/api/hub/install`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...Ae()},body:JSON.stringify({id:e})})).json();t.ok?(S(e),setTimeout(()=>S(null),2e3),w({msg:t.already_installed?`${t.message??e} — already installed`:t.message??`installed ${e}`,type:`ok`}),await ee()):w({msg:t.error??`install failed`,type:`error`})}catch(e){w({msg:e instanceof Error?e.message:`network error`,type:`error`})}finally{b(null),setTimeout(()=>w(null),5e3)}}let te=c===`installed`?u.filter(e=>e.installed):u,ne=u.filter(e=>e.installed).length,O=`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-2)] text-[11px] font-mono rounded-sm px-2.5 h-8 focus:outline-none focus:border-[var(--color-brand)]/50 cursor-pointer`;return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`overline text-[11px]`,children:`hub`}),(0,B.jsx)(`p`,{className:`text-xs text-[var(--color-fg-3)] mt-1 font-mono`,children:`install community rule packs from hub.sigmashake.com`})]}),(0,B.jsxs)(`a`,{href:`/hub/connect`,className:`inline-flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-2)] hover:text-[var(--color-brand)] transition-colors border border-[var(--color-line-1)] hover:border-[var(--color-brand)]/40 rounded-sm px-3 h-7`,children:[(0,B.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,B.jsx)(`path`,{d:`M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22`})}),`connect github`]})]}),C&&(0,B.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm px-3 py-2 text-[11px] font-mono border
|
|
16
16
|
${C.type===`ok`?`bg-emerald-500/5 border-emerald-500/25 text-emerald-300`:`bg-red-500/5 border-red-500/25 text-red-300`}`,children:[(0,B.jsxs)(`span`,{children:[C.type===`ok`?`✓ `:`✗ `,C.msg]}),(0,B.jsx)(`button`,{onClick:()=>w(null),className:`ml-3 opacity-60 hover:opacity-100 cursor-pointer`,children:`✕`})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center bg-[var(--color-surface-1)] border border-[var(--color-line-1)] rounded-sm p-0.5 shrink-0`,children:[(0,B.jsx)(`button`,{onClick:()=>l(`all`),className:`px-3 h-6 rounded-sm text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer
|
|
17
17
|
${c===`all`?`bg-[var(--color-surface-3)] text-[var(--color-fg-0)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`}`,children:`all`}),(0,B.jsxs)(`button`,{onClick:()=>l(`installed`),className:`px-3 h-6 rounded-sm text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer flex items-center gap-1.5
|
|
18
|
-
${c===`installed`?`bg-[var(--color-surface-3)] text-[var(--color-fg-0)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`}`,children:[`installed`,ne>0&&(0,B.jsx)(`span`,{className:`text-[9px] bg-emerald-500/15 text-emerald-300 rounded-sm px-1 py-0.5 font-medium tabular-nums`,children:ne})]})]}),(0,B.jsxs)(`div`,{className:`relative flex-1 min-w-[160px]`,children:[(0,B.jsxs)(`svg`,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--color-fg-4)]`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,B.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,B.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,B.jsx)(`input`,{type:`text`,placeholder:`search rulesets…`,value:e,onChange:e=>t(e.target.value),className:`w-full bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-xs rounded-sm pl-8 pr-3 h-8 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono`})]}),(0,B.jsx)(`select`,{value:n,onChange:e=>r(e.target.value),className:O,children:lc.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,B.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),className:O,children:[(0,B.jsx)(`option`,{value:``,children:`any decision`}),dc.filter(Boolean).map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),className:O,children:[(0,B.jsx)(`option`,{value:``,children:`any severity`}),uc.filter(Boolean).map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]}),g&&u.length===0?(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,B.jsx)(fc,{},t))}):te.length===0?(0,B.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] py-16 flex flex-col items-center justify-center text-center`,children:[(0,B.jsxs)(`svg`,{className:`text-[var(--color-fg-4)] mb-3`,width:`36`,height:`36`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,B.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,B.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,B.jsx)(`p`,{className:`text-xs font-mono text-[var(--color-fg-3)] uppercase tracking-wider`,children:c===`installed`?`no rulesets installed yet — browse and click install`:`no rulesets found${e?` matching "${e}"`:``}`})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:te.map(e=>(0,B.jsx)(mc,{rs:e,installingId:y,onInstall:D,flashId:x},e.id))}),f&&c===`all`&&(0,B.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,B.jsx)(`button`,{onClick:E,disabled:g,className:`h-8 px-5 rounded-sm text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-2)] border border-[var(--color-line-1)] hover:text-[var(--color-fg-0)] hover:border-[var(--color-line-2)] transition-colors cursor-pointer disabled:opacity-40`,children:g?`loading…`:`load more`})})]})]})}var gc={deny:`red`,block:`red`,ask:`amber`,allow:`green`,log:`gray`,force:`blue`};function _c({id:e}){let{data:t,error:n}=F(`/api/json/hub/${e}`),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1);if(n)return(0,B.jsxs)(`div`,{className:`text-sm text-red-300 font-mono`,children:[(0,B.jsx)(`p`,{children:n}),(0,B.jsx)(`a`,{href:`/hub`,className:`text-[var(--color-brand)] hover:underline mt-3 block text-[11px] uppercase tracking-wider`,children:`← back to hub`})]});if(!t)return(0,B.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading ruleset…`});async function s(){o(!0);try{(await fetch(`/api/hub/install`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({id:e})})).ok&&i(!0)}finally{o(!1)}}return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`a`,{href:`/hub`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`← hub`}),(0,B.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-1.5 text-[var(--color-fg-0)]`,children:t.title}),(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mt-1 tabular-nums`,children:[`@`,t.author,` · v`,t.version,` · `,t.rule_count,` rule`,t.rule_count===1?``:`s`]})]}),(0,B.jsx)(W,{variant:r?`secondary`:`primary`,onClick:s,disabled:a||r,children:r?`✓ installed`:a?`installing…`:`install`})]}),t.technologies.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.technologies.map(e=>(0,B.jsx)(mr,{variant:`blue`,children:e},e))}),t.github_repo&&(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`source`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:t.github_repo})]}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsxs)(`span`,{className:`overline`,children:[`rules · `,t.rules.length]})}),(0,B.jsx)(U,{className:`space-y-4`,children:t.rules.map((e,t)=>(0,B.jsxs)(`div`,{className:t>0?`border-t border-[var(--color-line-0)] pt-4`:void 0,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-2 flex-wrap`,children:[(0,B.jsx)(mr,{variant:gc[e.decision]??`gray`,children:e.decision}),(0,B.jsx)(`code`,{className:`text-xs text-[var(--color-brand)] font-mono`,children:e.name}),e.capability&&(0,B.jsx)(mr,{variant:`gray`,children:e.capability})]}),(0,B.jsx)(`p`,{className:`text-sm text-[var(--color-fg-1)] mb-2`,children:e.message}),(0,B.jsx)(Xo,{children:e.raw_text})]},e.id))})]})]})}function vc(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(`idle`),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(!1);async function u(){l(!0),a(``);try{let e=await fetch(`/api/hub/device-start`,{method:`POST`,headers:{Accept:`application/json`,...Ae()}}),n=await e.json();if(!e.ok){let t=n;t.error===`not_configured`?(r(`not_configured`),s(t.setup_steps??[]),a(t.message??`GitHub OAuth not configured.`)):(a(n.error??`HTTP ${e.status}`),r(`error`));return}t(n),r(`polling`)}catch(e){a(e instanceof Error?e.message:`Failed to start`),r(`error`)}finally{l(!1)}}return(0,_.useEffect)(()=>{if(n!==`polling`||!e)return;let t=setInterval(async()=>{try{let n=await(await fetch(`/api/hub/device-poll?flow=${e.flow_id}`,{headers:{Accept:`application/json`}})).json();n.status===`complete`?(clearInterval(t),r(`done`),a(`connected as @${n.session?.login??`GitHub`} — you can now publish rulesets`)):(n.status===`expired`||n.status===`error`)&&(clearInterval(t),r(`error`),a(n.error??`Authentication failed`))}catch{}},3e3);return()=>clearInterval(t)},[n,e]),(0,B.jsxs)(`div`,{className:`max-w-lg mx-auto space-y-5`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`a`,{href:`/hub`,className:`inline-flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)] transition-colors`,children:[(0,B.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,B.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}),`back to hub`]}),(0,B.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-2 text-[var(--color-fg-0)]`,children:`Connect GitHub`}),(0,B.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-3)] mt-1 font-mono`,children:`authenticate with github to publish rulesets to the hub`})]}),n===`not_configured`&&(0,B.jsx)(V,{children:(0,B.jsxs)(U,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(`span`,{className:`text-amber-300 shrink-0 mt-0.5`,children:(0,B.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,B.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,B.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,B.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-[var(--color-fg-0)]`,children:`GitHub OAuth not configured`}),(0,B.jsx)(`p`,{className:`text-xs text-[var(--color-fg-2)] mt-1 leading-relaxed`,children:i})]})]}),(0,B.jsxs)(`div`,{className:`border-t border-[var(--color-line-0)] pt-4`,children:[(0,B.jsx)(`div`,{className:`overline mb-3`,children:`setup steps`}),(0,B.jsx)(`ol`,{className:`space-y-2`,children:o.map((e,t)=>(0,B.jsxs)(`li`,{className:`flex items-start gap-2.5 text-xs text-[var(--color-fg-1)]`,children:[(0,B.jsx)(`span`,{className:`shrink-0 w-5 h-5 rounded-sm bg-[var(--color-surface-2)] border border-[var(--color-line-1)] text-[var(--color-fg-3)] text-[10px] font-mono flex items-center justify-center tabular-nums`,children:t+1}),(0,B.jsx)(`span`,{className:`mt-0.5 leading-relaxed`,children:e.replace(/^\d+\.\s+/,``)})]},t))})]}),(0,B.jsxs)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-3`,children:[(0,B.jsx)(`div`,{className:`overline mb-1.5`,children:`quick start`}),(0,B.jsx)(`code`,{className:`text-[11px] text-[var(--color-brand)]/90 font-mono`,children:`export SSG_GITHUB_CLIENT_ID=<your-client-id>`}),(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mt-1`,children:[`then restart:`,` `,(0,B.jsx)(`code`,{className:`text-[var(--color-fg-1)]`,children:`ssg serve`})]})]}),(0,B.jsx)(`a`,{href:`https://github.com/settings/applications/new`,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline`,children:`create github oauth app →`})]})}),n===`idle`&&(0,B.jsx)(V,{children:(0,B.jsxs)(U,{children:[(0,B.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] mb-4 leading-relaxed`,children:`This uses GitHub's device authorization flow — no redirect URIs needed. You'll be shown a code to enter at github.com.`}),(0,B.jsx)(W,{onClick:u,disabled:c,variant:`primary`,children:c?`starting…`:`connect with github`})]})}),e&&n===`polling`&&(0,B.jsx)(V,{children:(0,B.jsxs)(U,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`overline mb-2`,children:`open this url in your browser`}),(0,B.jsx)(`a`,{href:e.verification_uri,target:`_blank`,rel:`noreferrer`,className:`text-sm text-[var(--color-brand)] hover:underline font-mono`,children:e.verification_uri})]}),(0,B.jsxs)(`div`,{className:`border border-[var(--color-line-1)] bg-[var(--color-surface-0)] rounded-sm py-5 text-center`,children:[(0,B.jsx)(`div`,{className:`overline mb-3`,children:`enter this code`}),(0,B.jsx)(`div`,{className:`text-4xl font-mono font-bold tracking-[0.3em] text-[var(--color-fg-0)]`,children:e.user_code})]}),(0,B.jsxs)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] text-center flex items-center justify-center gap-2`,children:[(0,B.jsx)(`svg`,{className:`animate-spin`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,B.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),`waiting for github authorization…`]})]})}),n===`done`&&(0,B.jsxs)(`div`,{className:`rounded-sm border border-emerald-500/25 bg-emerald-500/5 p-4 text-sm text-emerald-200 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,B.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),(0,B.jsx)(`span`,{className:`font-mono text-xs`,children:i})]}),(0,B.jsx)(`a`,{href:`/hub/publish`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline block mt-1`,children:`publish a ruleset →`})]}),n===`error`&&i&&(0,B.jsxs)(`div`,{className:`rounded-sm border border-red-500/25 bg-red-500/5 p-4`,children:[(0,B.jsx)(`p`,{className:`text-sm text-red-200 font-mono`,children:i}),(0,B.jsx)(`button`,{onClick:()=>{r(`idle`),a(``)},className:`text-[11px] font-mono text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] mt-3 cursor-pointer uppercase tracking-wider`,children:`← try again`})]})]})}function yc(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null);async function o(t){if(t.preventDefault(),e.trim()){r(!0),a(null);try{a(await(await fetch(`/api/hub/publish`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({repo_url:e.trim()})})).json())}catch(e){a({ok:!1,error:e instanceof Error?e.message:`Unknown error`})}finally{r(!1)}}}return(0,B.jsxs)(`div`,{className:`max-w-md mx-auto space-y-5`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`a`,{href:`/hub`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`← hub`}),(0,B.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-2 text-[var(--color-fg-0)]`,children:`Publish Ruleset`}),(0,B.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-3)] mt-1 font-mono`,children:`publish a github repository containing .rules files to the hub`})]}),(0,B.jsx)(V,{children:(0,B.jsx)(U,{children:(0,B.jsxs)(`form`,{onSubmit:o,className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block overline mb-1.5`,children:`github repository url`}),(0,B.jsx)(`input`,{type:`url`,placeholder:`https://github.com/owner/repo`,value:e,onChange:e=>t(e.target.value),required:!0,className:`w-full bg-[var(--color-surface-0)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-sm rounded-sm px-3 py-2 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono`})]}),(0,B.jsx)(W,{type:`submit`,variant:`primary`,disabled:n,children:n?`publishing…`:`publish to hub`})]})})}),i&&(0,B.jsx)(`div`,{className:`rounded-sm border px-3 py-2 text-xs font-mono ${i.ok?`border-emerald-500/25 bg-emerald-500/5 text-emerald-300`:`border-red-500/25 bg-red-500/5 text-red-300`}`,children:i.ok?(0,B.jsxs)(B.Fragment,{children:[`✓ published!`,` `,i.id&&(0,B.jsx)(`a`,{href:`/hub/${i.id}`,className:`text-[var(--color-brand)] hover:underline uppercase tracking-wider text-[11px] ml-2`,children:`view ruleset →`})]}):i.error??`publish failed`})]})}function bc(e){return e===0?`—`:e<1e3?`${e}ns`:e<1e6?`${(e/1e3).toFixed(1)}µs`:`${(e/1e6).toFixed(1)}ms`}function xc(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function Sc(e){let t=e<1e10?e*1e3:e,n=new Date(t);return`${String(n.getHours()).padStart(2,`0`)}:${String(n.getMinutes()).padStart(2,`0`)}:${String(n.getSeconds()).padStart(2,`0`)}`}function Cc(e){let t=Math.round((Date.now()-e)/1e3);if(t<5)return`just now`;if(t<60)return`${t}s ago`;let n=Math.floor(t/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}var wc={allow:`text-emerald-300`,block:`text-red-300`,force:`text-violet-300`,log:`text-amber-300`,ask:`text-sky-300`,shadow:`text-[var(--color-fg-3)]`},Tc={allow:`✓`,block:`✗`,force:`→`,log:`·`,ask:`?`,shadow:`~`};function Ec({label:e,ns:t,maxNs:n}){let r=n>0?Math.min(100,t/n*100):0;return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] w-8 text-right font-mono uppercase tracking-wider text-[10px]`,children:e}),(0,B.jsx)(rs,{pct:r,tone:t<1e5?`green`:t<1e6?`amber`:`red`,className:`h-1 flex-1`}),(0,B.jsx)(`span`,{className:`font-mono text-[var(--color-fg-1)] tabular-nums w-14 text-right`,children:bc(t)})]})}function Dc({value:e,max:t,threshold:n,breached:r}){let i=t>0?Math.min(100,e/t*100):0,a=t>0?Math.min(100,n/t*100):0;return(0,B.jsx)(rs,{pct:i,tone:r?`red`:e/t>=.6?`amber`:`green`,markerPct:a,markerTitle:`limit: ${n}`,className:`h-1`})}function Oc({limitsData:e,onSaved:t}){let[n,r]=(0,_.useState)(String(e.config.cpuLimitPct)),[i,a]=(0,_.useState)(String(e.config.memoryLimitMb)),[o,s]=(0,_.useState)(e.config.breachAction),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null);async function f(){l(!0),d(null);try{let e=await fetch(`/api/json/limits`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({cpu_limit_pct:parseFloat(n),memory_limit_mb:parseFloat(i),breach_action:o})});e.ok?t():d((await e.json()).error??`save failed`)}catch{d(`network error`)}finally{l(!1)}}let p=`w-full bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm px-2 py-1.5 text-[var(--color-fg-1)] font-mono text-xs focus:outline-none focus:border-[var(--color-brand)]/50`;return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`overline block mb-1.5`,children:`cpu limit (%)`}),(0,B.jsx)(`input`,{type:`number`,min:1,max:100,value:n,onChange:e=>r(e.target.value),className:p})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`overline block mb-1.5`,children:`memory limit (mb)`}),(0,B.jsx)(`input`,{type:`number`,min:1,value:i,onChange:e=>a(e.target.value),className:p})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`overline block mb-1.5`,children:`on breach`}),(0,B.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),className:p,children:[(0,B.jsx)(`option`,{value:`warn`,children:`warn in ui only`}),(0,B.jsx)(`option`,{value:`log`,children:`warn + write to audit log`})]})]}),u&&(0,B.jsx)(`p`,{className:`text-xs text-red-300 font-mono`,children:u}),(0,B.jsx)(W,{onClick:f,disabled:c,variant:`primary`,size:`sm`,children:c?`saving…`:`save limits`})]})}var kc={running:`green`,hibernating:`amber`,exhausted:`red`,stopped:`gray`,idle:`gray`};function Ac(e,t){let n=e-t;if(n<=0)return`any moment`;let r=Math.round(n/1e3);if(r<60)return`in ${r}s`;let i=Math.floor(r/60);return i<60?`in ${i}m ${r%60}s`:`in ${Math.floor(i/60)}h ${i%60}m`}function jc({supervisors:e}){let[t,n]=(0,_.useState)(Date.now());return(0,_.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2 overline`,children:[`supervisor health`,e.some(e=>e.state===`hibernating`||e.state===`exhausted`)&&(0,B.jsx)(mr,{variant:`amber`,children:`degraded`})]}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono tabular-nums text-[var(--color-fg-4)]`,children:[e.length,` supervisor`,e.length===1?``:`s`]})]}),(0,B.jsx)(U,{children:e.length===0?(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no supervisors registered yet`}):(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(`table`,{className:`w-full text-xs font-mono`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider text-[var(--color-fg-4)]`,children:[(0,B.jsx)(`th`,{className:`text-left font-normal pb-1.5`,children:`name`}),(0,B.jsx)(`th`,{className:`text-left font-normal pb-1.5`,children:`kind`}),(0,B.jsx)(`th`,{className:`text-left font-normal pb-1.5`,children:`state`}),(0,B.jsx)(`th`,{className:`text-right font-normal pb-1.5`,children:`restarts`}),(0,B.jsx)(`th`,{className:`text-left font-normal pb-1.5 pl-4`,children:`last restart`}),(0,B.jsx)(`th`,{className:`text-left font-normal pb-1.5 pl-4`,children:`next retry`})]})}),(0,B.jsx)(`tbody`,{children:e.map(e=>(0,B.jsxs)(`tr`,{className:`border-t border-[var(--color-line-0)]`,children:[(0,B.jsx)(`td`,{className:`py-1.5 text-[var(--color-fg-1)]`,children:e.name}),(0,B.jsx)(`td`,{className:`py-1.5 text-[var(--color-fg-3)]`,children:e.kind===`single`?`single`:`tree`}),(0,B.jsx)(`td`,{className:`py-1.5`,children:(0,B.jsx)(mr,{variant:kc[e.state],children:e.state})}),(0,B.jsx)(`td`,{className:`py-1.5 text-right tabular-nums text-[var(--color-fg-1)]`,children:e.restarts}),(0,B.jsx)(`td`,{className:`py-1.5 pl-4 tabular-nums text-[var(--color-fg-3)]`,children:e.lastRestartAt>0?Cc(e.lastRestartAt):`—`}),(0,B.jsx)(`td`,{className:`py-1.5 pl-4 tabular-nums text-[var(--color-fg-3)]`,children:e.nextRetryAt>0?(0,B.jsx)(`span`,{title:e.hibernateReason?`reason: ${e.hibernateReason}`:void 0,children:Ac(e.nextRetryAt,t)}):`—`})]},e.name))})]})})})]})}function Mc(){let e=je([`runtime-tick`,`activity-updated`,`limits-breach`,`supervisor-changed`]),t=Oe(),[n,r]=(0,_.useState)(Date.now()),[i,a]=(0,_.useState)(0),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(0),[u,d]=(0,_.useState)(!1),f=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(e)},[]);let{data:p}=F(`/api/state/runtime`,[e[`runtime-tick`]]),{data:m,refetch:h}=F(`/api/json/limits`,[e[`limits-breach`]]),{data:g}=F(`/api/state/activity-tail?after=${i}&limit=50`,[e[`activity-updated`],e[`runtime-tick`]]),{data:v}=F(`/api/json/supervisors`,[e[`supervisor-changed`],e[`runtime-tick`]]);(0,_.useEffect)(()=>{g&&g.rows.length>0&&(a(e=>Math.max(e,g.maxId)),s(e=>{let t=new Set(e.map(e=>e.id));return[...g.rows.filter(e=>!t.has(e.id)),...e].slice(0,100)}))},[g]),(0,_.useEffect)(()=>{let e=p!==null;f.current===!1&&e&&l(e=>e+1),f.current=e},[p]);let y=p?xc(p.uptime_ms):null,b=p&&p.last_eval_at>0?Cc(p.last_eval_at):null,x=m?.breaches.cpu??!1,S=m?.breaches.memory??!1,C=p?x?`text-red-300`:(p.cpu_pct??0)>=60?`text-amber-300`:`text-emerald-300`:`text-[var(--color-fg-1)]`,w=S?`text-red-300`:`text-[var(--color-fg-1)]`;return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-xl font-medium tracking-tight text-[var(--color-fg-0)]`,children:`Daemon Monitor`}),(0,B.jsx)(`p`,{className:`text-[12px] font-mono text-[var(--color-fg-3)] mt-0.5`,children:`live metrics · audit tail · resource limits`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[c>0&&(0,B.jsxs)(mr,{variant:`amber`,children:[c,` restart`,c===1?``:`s`]}),(0,B.jsx)(`span`,{className:`text-[11px] font-mono tabular-nums text-[var(--color-fg-3)]`,children:Sc(n)})]})]}),(0,B.jsx)(Nc,{cpuPct:p?.cpu_pct??0,cpuLimit:m?.config.cpuLimitPct,memMb:p?.memory_rss_mb??0,memLimit:m?.config.memoryLimitMb,decisions:p?.decisions,latency:p?.latency,burstBuffer:t,evalsTotal:p?.evals_total??0}),m&&(x||S)&&(0,B.jsxs)(`div`,{className:`rounded-sm border border-red-500/25 bg-red-500/[0.06] border-l-2 border-l-red-500/70 px-3 py-2.5 flex items-start gap-2.5`,children:[(0,B.jsx)(`span`,{className:`text-red-300 shrink-0 mt-0.5`,children:(0,B.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,B.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z`}),(0,B.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,B.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]})}),(0,B.jsxs)(`div`,{className:`space-y-0.5 text-xs font-mono`,children:[x&&(0,B.jsxs)(`div`,{className:`text-red-200`,children:[`cpu limit exceeded: `,p?.cpu_pct??`?`,`% >`,` `,m.config.cpuLimitPct,`%`]}),S&&(0,B.jsxs)(`div`,{className:`text-red-200`,children:[`memory limit exceeded: `,p?.memory_rss_mb??`?`,`mb >`,` `,m.config.memoryLimitMb,`mb`]})]})]}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`daemon status`})}),(0,B.jsx)(U,{children:p===null?(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-500 shrink-0`}),(0,B.jsx)(`span`,{className:`text-red-300 font-mono uppercase tracking-wider text-xs`,children:`down`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] text-xs font-mono`,children:`— socket not reachable`})]}):(0,B.jsxs)(`div`,{className:`flex items-center gap-5 flex-wrap text-xs font-mono`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-emerald-400 pulse-soft shrink-0`}),(0,B.jsx)(`span`,{className:`text-emerald-300 uppercase tracking-wider`,children:`up`})]}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`pid`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:p.pid})]}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`uptime`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:y})]}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`mem`,` `,(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:[p.memory_rss_mb,`MB`]})]}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`cpu`,` `,(0,B.jsxs)(`span`,{className:`${C} tabular-nums`,children:[p.cpu_pct,`%`]})]}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`last eval`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:b??`—`})]})]})})]}),(0,B.jsx)(jc,{supervisors:v?.supervisors??[]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2 overline`,children:[`system resources`,m&&(x||S)&&(0,B.jsx)(mr,{variant:`red`,children:`limit exceeded`})]}),(0,B.jsx)(`button`,{onClick:()=>d(e=>!e),className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)] transition-colors cursor-pointer`,children:u?`hide limits`:`configure limits`})]}),(0,B.jsxs)(U,{children:[p===null?(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no data — daemon not running`}):(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`cpu`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(p.history.cpu_pct.length??0)>1&&(0,B.jsx)(br,{data:p.history.cpu_pct,width:80,height:20,color:x?`#f87171`:`#34d399`,threshold:m?.config.cpuLimitPct,maxValue:100}),(0,B.jsxs)(`span`,{className:`font-mono font-medium w-12 text-right tabular-nums ${C}`,children:[p.cpu_pct,`%`]})]})]}),(0,B.jsx)(Dc,{value:p.cpu_pct,max:100,threshold:m?.config.cpuLimitPct??90,breached:x}),m&&(0,B.jsxs)(`div`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`limit: `,m.config.cpuLimitPct,`%`]})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`memory rss`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(p.history.memory_rss_mb.length??0)>1&&(0,B.jsx)(br,{data:p.history.memory_rss_mb,width:80,height:20,color:S?`#f87171`:`#38bdf8`,threshold:m?.config.memoryLimitMb}),(0,B.jsxs)(`span`,{className:`font-mono font-medium w-16 text-right tabular-nums ${w}`,children:[p.memory_rss_mb,`MB`]})]})]}),(0,B.jsx)(Dc,{value:p.memory_rss_mb,max:Math.max(p.memory_rss_mb*1.5,m?.config.memoryLimitMb??512),threshold:m?.config.memoryLimitMb??512,breached:S}),m&&(0,B.jsxs)(`div`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`limit: `,m.config.memoryLimitMb,`MB`]})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`heap`}),(0,B.jsxs)(`span`,{className:`font-mono text-[var(--color-fg-1)] tabular-nums`,children:[p.heap_used_mb,`MB / `,p.heap_total_mb,`MB`]})]}),(0,B.jsx)(rs,{pct:p.heap_total_mb>0?Math.min(100,p.heap_used_mb/p.heap_total_mb*100):0,tone:`blue`,className:`h-1`})]})]}),u&&m&&(0,B.jsxs)(`div`,{className:`mt-5 pt-4 border-t border-[var(--color-line-0)]`,children:[(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mb-3 leading-relaxed`,children:[`thresholds trigger ui warnings. values are persisted to`,` `,(0,B.jsx)(`code`,{className:`text-[var(--color-fg-1)]`,children:`.sigmashake/config.toml`}),`.`]}),(0,B.jsx)(Oc,{limitsData:m,onSaved:()=>{h(),d(!1)}})]})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-2`,children:[(0,B.jsx)(ns,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`total evals`,value:p?.evals_total??`—`,valueClassName:`text-xl font-medium tabular-nums text-[var(--color-fg-0)]`}),(0,B.jsx)(ns,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`allow`,value:p?.decisions.allow??`—`,valueClassName:`text-xl font-medium tabular-nums text-emerald-300`}),(0,B.jsx)(ns,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`block`,value:p?.decisions.block??`—`,valueClassName:`text-xl font-medium tabular-nums text-red-300`}),(0,B.jsx)(ns,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`force`,value:p?.decisions.force??`—`,valueClassName:`text-xl font-medium tabular-nums text-violet-300`}),(0,B.jsx)(ns,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`log`,value:p?.decisions.log??`—`,valueClassName:`text-xl font-medium tabular-nums text-amber-300`}),(0,B.jsx)(ns,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`ask`,value:p?.decisions.ask??`—`,valueClassName:`text-xl font-medium tabular-nums text-sky-300`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`eval latency`}),p&&(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[p.latency.samples,` samples`]})]}),(0,B.jsx)(U,{children:p===null?(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no data`}):(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(Ec,{label:`p50`,ns:p.latency.p50_ns,maxNs:p.latency.max_ns}),(0,B.jsx)(Ec,{label:`p95`,ns:p.latency.p95_ns,maxNs:p.latency.max_ns}),(0,B.jsx)(Ec,{label:`p99`,ns:p.latency.p99_ns,maxNs:p.latency.max_ns}),(0,B.jsx)(Ec,{label:`max`,ns:p.latency.max_ns,maxNs:p.latency.max_ns})]})})]}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`engine`})}),(0,B.jsx)(U,{children:p===null?(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no data`}):(0,B.jsx)(`div`,{className:`space-y-1.5 text-xs font-mono`,children:[[`native evals`,p.engine.native_evals],[`ts evals`,p.engine.ts_evals],[`native %`,`${p.engine.native_pct}%`],[`rule reloads`,p.rule_reloads],[`rate limit trips`,p.rate_limit_trips],[`loop guard blocks`,p.loop_guard_blocks],[`connection errors`,p.connection_errors]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`flex justify-between py-0.5 border-b border-[var(--color-line-0)] last:border-0`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:e}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:t})]},e))})})]})]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`live event tail`}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`newest first · auto-updating`})]}),(0,B.jsx)(U,{children:o.length===0?(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-4 py-6 text-center`,children:(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no events yet`})}):(0,B.jsx)(`div`,{className:`font-mono text-[11px] max-h-96 overflow-y-auto divide-y divide-[var(--color-line-0)]`,children:o.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2 py-1`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] shrink-0 w-16 tabular-nums`,children:Sc(e.timestamp)}),e.tool===`__daemon`?(0,B.jsxs)(`span`,{className:`text-sky-400`,children:[`daemon`,` `,(()=>{try{let t=JSON.parse(e.input??`{}`);return`${t.event??e.decision}${t.detail?` (${t.detail})`:``}`}catch{return e.decision}})()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`shrink-0 w-16 uppercase tracking-wider text-[10px] ${wc[e.decision]??`text-[var(--color-fg-3)]`}`,children:[Tc[e.decision]??`·`,` `,e.decision]}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] shrink-0 w-24 truncate`,children:e.tool}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] shrink-0 w-14 text-right tabular-nums`,children:bc(e.duration_ns)}),e.rule_id&&(0,B.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.rule_id)}`,className:`text-[var(--color-brand)]/80 hover:text-[var(--color-brand)] truncate transition-colors`,title:e.rule_id,children:e.rule_id})]})]},e.id))})})]}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`ai agent debug endpoints`})}),(0,B.jsxs)(U,{children:[(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mb-2.5`,children:`agents can query these endpoints directly for automated triage:`}),(0,B.jsx)(`div`,{className:`space-y-1 font-mono text-[11px]`,children:[[`/api/state/runtime`,`full metrics snapshot (cpu, memory, history, latency)`],[`/api/json/limits`,`resource limits config + breach state`],[`/api/state/activity-tail?after=0&limit=20`,`recent eval events`],[`/api/json/daemon-status`,`status, pid, log tail`],[`/healthz`,`process uptime`]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`GET`}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-[var(--color-brand)]/80 hover:text-[var(--color-brand)] transition-colors`,children:e}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`— `,t]})]},e))})]})]})]})}function Nc({cpuPct:e,cpuLimit:t,memMb:n,memLimit:r,decisions:i,latency:a,evalsTotal:o,burstBuffer:s}){let c=(0,_.useMemo)(()=>{if(s.length===0)return 0;let e=Date.now()-1e4;return s.filter(t=>t.ts_ms>=e).length/10},[s]);return(a?.p95_ns??0)/1e6,(a?.p50_ns??0)/1e6,(a?.p99_ns??0)/1e6,(0,B.jsxs)(`div`,{className:`grid-bleed rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-4`,children:[(0,B.jsxs)(`div`,{className:`lg:col-span-3 flex flex-col items-center gap-2`,children:[(0,B.jsx)(Jr,{mode:`ring`,value:e,max:100,warnAt:(t??90)/100*.7,critAt:(t??90)/100,display:`${e.toFixed(1)}%`,label:`cpu`,size:220}),(0,B.jsx)(Sr,{value:e,width:260,height:56,windowMs:6e4,color:`#34d399`,fillColor:`rgba(52, 211, 153, 0.14)`,maxValue:100,className:`w-full`})]}),(0,B.jsxs)(`div`,{className:`lg:col-span-3 flex flex-col items-center gap-2`,children:[(0,B.jsx)(Jr,{mode:`ring`,value:n,max:r??1024,warnAt:.7,critAt:.9,display:`${n.toFixed(0)} MB`,label:`memory`,size:220}),(0,B.jsx)(Sr,{value:n,width:260,height:56,windowMs:6e4,color:`#38bdf8`,fillColor:`rgba(56, 189, 248, 0.14)`,maxValue:r?r*1.1:void 0,className:`w-full`})]}),(0,B.jsx)(`div`,{className:`lg:col-span-6`,children:(0,B.jsx)(ei,{latency:a,bursts:s,gaugeMaxMs:10,windowMs:3e4,trendWindowSec:60,gaugeSize:200})})]}),(0,B.jsxs)(`div`,{className:`mt-4 grid grid-cols-1 lg:grid-cols-2 gap-3`,children:[(0,B.jsx)(Ar,{label:`Total Evals`,value:o,tone:`amber`,sub:`${c.toFixed(1)}/s`,burstRing:s}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] px-4 py-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`throughput · 60 s`}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[c.toFixed(1),`/s`]})]}),(0,B.jsx)(Sr,{value:c,width:420,height:56,windowMs:6e4,className:`w-full`})]})]}),i?(0,B.jsx)(`div`,{className:`mt-4 pt-3 border-t border-[var(--color-line-0)]`,children:(0,B.jsx)(ri,{counters:{allow:i.allow,block:i.block,ask:i.ask,log:i.log,force:i.force,shadow:i.shadow}})}):null,(0,B.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`live event stream · newest first`}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:[s.length,` buffered · hover to pause`]})]}),(0,B.jsx)(hi,{variant:`decision`,bursts:s,windowSize:300,height:260})]})]})}var Pc={ok:`green`,warn:`amber`,error:`red`,unknown:`gray`},Fc={ok:`OK`,warn:`Warn`,error:`Error`,unknown:`Idle`};function Ic({title:e,status:t=`unknown`,statusLabel:n,className:r,children:i}){return(0,B.jsxs)(V,{className:z(`flex flex-col`,r),children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`overline text-[var(--color-fg-2)]`,children:e}),(0,B.jsx)(mr,{variant:Pc[t],children:n??Fc[t]})]}),(0,B.jsx)(U,{className:`flex flex-col gap-2 text-[12px]`,children:i})]})}function Lc({label:e,value:t,mono:n=!1,tone:r}){return(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 border-b border-[var(--color-line-0)] last:border-b-0 py-1`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] uppercase tracking-wider text-[10px] font-mono`,children:e}),(0,B.jsx)(`span`,{className:z(n?`font-mono`:`font-sans`,`tabular-nums text-right truncate`,r===`good`?`text-emerald-300`:r===`warn`?`text-amber-300`:r===`bad`?`text-red-300`:`text-[var(--color-fg-1)]`),children:t})]})}function Rc(e){return e===0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(2)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function zc(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}function Bc(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function Vc(e){return e?new Date(e*1e3).toLocaleString():`—`}function Hc(e){if(!e||e===0)return`never`;let t=Math.round((Date.now()-e)/1e3);if(t<5)return`just now`;if(t<60)return`${t}s ago`;let n=Math.floor(t/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}function Uc({children:e,className:t}){return(0,B.jsx)(`div`,{className:`overline mb-2.5 ${t??``}`,children:e})}function Wc({label:e,value:t,mono:n=!0,accent:r}){return(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 py-1.5 border-b border-[var(--color-line-0)] last:border-0`,children:[(0,B.jsx)(`span`,{className:`text-xs text-[var(--color-fg-3)] shrink-0 font-mono`,children:e}),(0,B.jsx)(`span`,{className:`text-xs text-right truncate max-w-[65%] ${n?`font-mono tabular-nums`:``} ${r??`text-[var(--color-fg-1)]`}`,children:t})]})}function Gc({ok:e,label:t,badLabel:n}){return e?(0,B.jsx)(mr,{variant:`green`,children:t}):(0,B.jsx)(mr,{variant:`red`,children:n??t})}function Kc({pct:e,total:t,max:n}){let r=e<60?`green`:e<85?`amber`:`red`,i=e>=85?`text-red-300`:e>=60?`text-amber-300`:`text-emerald-300`;return(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-xs font-mono tabular-nums`,children:[(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[t.toLocaleString(),` / `,n.toLocaleString(),` rows`]}),(0,B.jsxs)(`span`,{className:i,children:[e,`%`]})]}),(0,B.jsx)(rs,{pct:e,tone:r,className:`h-1.5`})]})}var qc=3e3,Jc={log:`text-[var(--color-fg-1)]`,info:`text-sky-300`,warn:`text-amber-300`,error:`text-red-300`,debug:`text-[var(--color-fg-3)]`};function Yc(e){return e.value==null?e.description?e.description:`[${e.type}]`:String(e.value)}function Xc(){let e=Ws(),[t,n]=(0,_.useState)(!1),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!1),p=(0,_.useRef)(null),m=(0,_.useRef)(0),h=(0,_.useRef)(!0);(0,_.useEffect)(()=>{if(h.current){h.current=!1;return}let e=p.current;if(!e)return;let t=e.parentElement;t&&(t.scrollTop=t.scrollHeight)},[a]),(0,_.useEffect)(()=>{if(e.connected)return e.sendCommand(`Runtime.enable`).catch(()=>{}),e.onEvent(`Runtime.consoleAPICalled`,e=>{let t=e;o(e=>{let n=[...e,{id:m.current++,type:t.type??`log`,args:t.args??[],timestamp:t.timestamp??Date.now()}];return n.length>500?n.slice(-500):n})})},[e.connected]),(0,_.useEffect)(()=>{e.preconfiguredTarget&&!e.connected&&!e.connecting&&e.connect(e.preconfiguredTarget.id)},[e]),(0,_.useEffect)(()=>{!e.connected||d||t||r||(f(!0),(async()=>{try{await e.sendCommand(`Profiler.enable`),await e.sendCommand(`Profiler.start`),n(!0),setTimeout(async()=>{try{let t=await e.sendCommand(`Profiler.stop`);n(!1),i(t.profile)}catch{n(!1)}},qc)}catch{}})(),e.sendCommand(`Runtime.evaluate`,{expression:`JSON.stringify(process.memoryUsage())`,returnByValue:!0}).then(e=>{c(JSON.parse(e.result.value))}).catch(()=>{}))},[e.connected,d,t,r]);let g=(0,_.useCallback)(async()=>{try{await e.sendCommand(`Profiler.enable`),await e.sendCommand(`Profiler.start`),n(!0),i(null)}catch(e){console.error(`Profiler.start failed:`,e)}},[e]),v=(0,_.useCallback)(async()=>{try{let t=await e.sendCommand(`Profiler.stop`);n(!1),i(t.profile)}catch(e){console.error(`Profiler.stop failed:`,e),n(!1)}},[e]),y=(0,_.useCallback)(async()=>{u(!0);try{let t=await e.sendCommand(`Runtime.evaluate`,{expression:`JSON.stringify(process.memoryUsage())`,returnByValue:!0});c(JSON.parse(t.result.value))}catch{}finally{u(!1)}},[e]),b=(0,_.useCallback)(()=>{e.preconfiguredTarget&&e.connect(e.preconfiguredTarget.id)},[e]);return e.active?e.connected?(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono text-[var(--color-fg-2)]`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-emerald-400`}),`connected`,e.bunVersion?` · bun v${e.bunVersion}`:``]}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:e.disconnect,children:`disconnect`})]})]}),e.error&&(0,B.jsx)(U,{children:(0,B.jsx)(`p`,{className:`text-xs text-red-300 font-mono`,children:e.error})})]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`cpu profiler`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&(0,B.jsxs)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300 flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-400 pulse-soft`}),`recording`]}),t?(0,B.jsx)(W,{variant:`danger`,size:`sm`,onClick:v,children:`stop & render`}):(0,B.jsx)(W,{variant:`primary`,size:`sm`,onClick:g,children:`start recording`})]})]}),(0,B.jsx)(U,{children:r?(0,B.jsx)(as,{profile:r,children:(0,B.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 overflow-x-hidden`,children:(0,B.jsx)(Zs,{profile:r})})}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:t?`recording cpu profile (auto-captures ${qc/1e3}s)… perform actions in ssg to generate data.`:`click start recording, or wait for auto-capture on page load.`})})]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`memory`}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:y,disabled:l,children:l?`…`:`refresh`})]}),(0,B.jsx)(U,{children:s?(0,B.jsx)(os,{memory:s,formatValue:zc}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:d?`fetching memory metrics…`:`click refresh to fetch process.memoryUsage().`})})]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`console`}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o([]),children:`clear`})]}),(0,B.jsx)(U,{children:(0,B.jsxs)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 h-40 overflow-y-auto font-mono text-[11px]`,children:[a.length===0?(0,B.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`console output will appear here…`}):a.map(e=>(0,B.jsxs)(`div`,{className:`py-0.5 border-b border-[var(--color-line-0)] ${Jc[e.type]??`text-[var(--color-fg-1)]`}`,children:[(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)] mr-2 uppercase tracking-wider`,children:[`[`,e.type,`]`]}),e.args.map(Yc).join(` `)]},e.id)),(0,B.jsx)(`div`,{ref:p})]})})]})]}):(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(mr,{variant:`amber`,children:e.connecting?`connecting…`:`available`}),!e.connecting&&(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:b,children:`connect`})]})]}),(0,B.jsx)(U,{children:(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:e.connecting?`establishing websocket connection to bun inspector…`:`inspector is active but not connected. click connect to start profiling.`})})]}):(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,B.jsx)(mr,{variant:`outline`,children:`inactive`})]}),(0,B.jsx)(U,{children:(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:[`the bun inspector is not active. restart`,` `,(0,B.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg serve`}),` to enable it automatically.`]})})]})}function Zc(){let[e,t]=(0,_.useState)(0),{data:n}=F(`/api/json/evald-log`,[e]),r=(0,_.useRef)(null),i=(0,_.useRef)(!0);(0,_.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),5e3);return()=>clearInterval(e)},[]),(0,_.useEffect)(()=>{if(i.current){i.current=!1;return}let e=r.current;if(!e)return;let t=e.parentElement;t&&(t.scrollTop=t.scrollHeight)},[n?.lines.length]);let a=n?.lines??[];return(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`daemon log`}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] truncate max-w-[60%]`,children:[n?.path?n.path:`loading…`,` · last 200 lines · 5s refresh`]})]}),(0,B.jsxs)(U,{children:[n?.error&&(0,B.jsx)(`p`,{className:`text-xs text-red-300 font-mono mb-2`,children:n.error}),a.length===0&&!n?.error&&(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-4 py-6 text-center`,children:(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:[`no log entries yet. start the daemon with`,` `,(0,B.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg serve`}),` to generate log output.`]})}),a.length>0&&(0,B.jsxs)(`pre`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-3 text-[10px] text-[var(--color-fg-2)] overflow-x-auto whitespace-pre-wrap break-all max-h-80 overflow-y-auto font-mono leading-relaxed`,children:[a.join(`
|
|
19
|
-
`),(0,B.jsx)(`div`,{ref:r})]})]})]})}function Qc(){let e=je([`runtime-tick`,`rules-changed`]),{data:t,refetch:n}=F(`/api/json/observability`,[e[`runtime-tick`],e[`rules-changed`]]),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(Date.now()),[l,u]=(0,_.useState)(`idle`),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(`idle`);(0,_.useEffect)(()=>{t&&c(Date.now())},[t]);let h=(0,_.useCallback)(async()=>{u(`loading`);try{let e=await(await fetch(`/api/rules/sync-to-db`,{method:`POST`,headers:Ae()})).json();if(e.ok){u(`done`);let t=(e.pruned_count??0)>0?` (${e.pruned_count} orphan(s) pruned)`:``;f((e.message??`synced ${e.synced} rules`)+t),n()}else u(`error`),f(e.error??`sync failed`)}catch(e){u(`error`),f(String(e))}},[n]),g=(0,_.useCallback)(async()=>{m(`loading`);try{await fetch(`/api/rules/force-reload`,{method:`POST`,headers:Ae()}),m(`done`),n(),setTimeout(()=>m(`idle`),3e3)}catch{m(`idle`)}},[n]),v=t?.db,y=t?.rules,b=t?.audit,x=t?.process,S=t?.flight_recorder,C=y?.drift_detected??!1;return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-xl font-medium tracking-tight text-[var(--color-fg-0)]`,children:`Observability`}),(0,B.jsx)(`p`,{className:`text-[12px] font-mono text-[var(--color-fg-3)] mt-0.5`,children:`sqlite health · rule drift · runtime profiler · diagnostics`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:[`refreshed `,Hc(s)]}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:n,children:`refresh`})]})]}),(0,B.jsx)($c,{db:v,audit:b,proc:x,flight:S,driftDetected:C}),(0,B.jsxs)(V,{className:C?`border-red-500/30 border-l-2 border-l-red-500/70`:`border-emerald-500/20 border-l-2 border-l-emerald-500/60`,children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`rule drift detector`}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`— .rules files vs sqlite`}),(0,B.jsx)(`button`,{onClick:()=>o(e=>!e),"aria-expanded":a,"aria-label":`Explain these counts`,title:`Why do these numbers differ?`,className:`text-[10px] font-mono text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)] border border-[var(--color-line-1)] rounded-sm px-1.5 py-0.5 transition-colors cursor-pointer`,children:a?`× close`:`? why these numbers`})]}),y&&(C?(0,B.jsx)(mr,{variant:`red`,children:`⚠ drift detected`}):(0,B.jsx)(mr,{variant:`green`,children:`✓ in sync`}))]}),(0,B.jsxs)(U,{children:[a&&(0,B.jsxs)(`div`,{className:`mb-4 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-3 py-2.5 space-y-2 text-[11px] font-mono leading-relaxed text-[var(--color-fg-3)]`,children:[(0,B.jsxs)(`div`,{className:`text-[var(--color-fg-2)]`,children:[(0,B.jsx)(`code`,{children:`.rules files`}),` and `,(0,B.jsx)(`code`,{children:`db rules`}),` are`,` `,(0,B.jsx)(`span`,{className:`text-amber-300`,children:`not auto-synced`}),`. A mismatch is usually expected:`]}),(0,B.jsxs)(`ul`,{className:`space-y-1 pl-3 list-disc marker:text-[var(--color-fg-4)]`,children:[(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`one file can hold many rules`}),` `,`— compare `,(0,B.jsx)(`code`,{children:`db rules`}),` against`,` `,(0,B.jsx)(`code`,{children:`file_rule_count`}),`, not `,(0,B.jsx)(`code`,{children:`file_count`}),`.`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`only in files`}),` `,`means unsynced edits — run`,` `,(0,B.jsx)(`code`,{className:`text-amber-300`,children:`ssg sync`}),` or click`,` `,(0,B.jsx)(`code`,{children:`↑ sync files → db`}),`.`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`only in db`}),` `,`with `,(0,B.jsx)(`code`,{children:`source_file IS NULL`}),` is healthy — hub, fleet, or cloud-synced rules legitimately live only in the db.`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`only in db`}),` `,`with `,(0,B.jsx)(`code`,{children:`source_file`}),` set means an orphan from a deleted file — `,(0,B.jsx)(`code`,{className:`text-amber-300`,children:`ssg sync`}),` `,`prunes it.`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`db rules`}),` `,`includes disabled rows; `,(0,B.jsx)(`code`,{children:`db_enabled_count`}),` `,`excludes them.`]})]}),(0,B.jsxs)(`div`,{className:`pt-1.5 border-t border-[var(--color-line-0)]`,children:[`full reference:`,` `,(0,B.jsx)(`a`,{href:`https://docs.sigmashake.com/rule-storage`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--color-fg-2)] underline decoration-dotted underline-offset-2 hover:text-amber-300 transition-colors`,children:`docs.sigmashake.com/rule-storage ↗`})]})]}),y?(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:[{label:`.rules files`,value:y.file_count,sub:`${y.file_rule_count} rules total`,tone:`neutral`},{label:`db rules`,value:y.db_rule_count,sub:`${y.db_enabled_count} enabled`,tone:`neutral`},{label:`only in files`,value:y.drift_details.only_in_files.length,tone:y.drift_details.only_in_files.length>0?`amber`:`gray`},{label:`only in db`,value:y.drift_details.only_in_db.length,tone:y.drift_details.only_in_db.length>0?`red`:`gray`}].map(({label:e,value:t,sub:n,tone:r})=>(0,B.jsx)(ns,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)]`,label:e,value:t,sub:n,tone:r,labelPlacement:`above`,subClassName:`text-[var(--color-fg-4)]`,valueClassName:`text-xl font-medium tabular-nums`},e))}),C&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{onClick:()=>i(e=>!e),className:`text-[10px] font-mono uppercase tracking-wider text-amber-300 hover:text-amber-200 flex items-center gap-1 transition-colors cursor-pointer`,children:[r?`▾`:`▸`,` view drift details`]}),r&&(0,B.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[y.drift_details.only_in_files.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`text-[10px] font-mono uppercase tracking-wider text-amber-300/80 mb-1.5`,children:[`in .rules files but not in db — run`,` `,(0,B.jsx)(`code`,{className:`text-amber-300`,children:`ssg sync`})]}),(0,B.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-amber-400/20 rounded-sm p-2 space-y-0.5 max-h-40 overflow-y-auto`,children:y.drift_details.only_in_files.map(e=>(0,B.jsxs)(`div`,{className:`font-mono text-[11px] text-amber-200/80`,children:[`+ `,e]},e))})]}),y.drift_details.only_in_db.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300/80 mb-1.5`,children:`in db but not in any .rules file — orphaned rules`}),(0,B.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-red-400/20 rounded-sm p-2 space-y-0.5 max-h-40 overflow-y-auto`,children:y.drift_details.only_in_db.map(e=>(0,B.jsxs)(`div`,{className:`font-mono text-[11px] text-red-200/80`,children:[`− `,e]},e))})]})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,B.jsx)(W,{variant:`primary`,size:`sm`,onClick:h,disabled:l===`loading`,children:l===`loading`?`syncing…`:`↑ sync files → db`}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:g,disabled:p===`loading`,children:p===`loading`?`…`:p===`done`?`✓ reloaded`:`↻ force reload`}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] ml-auto`,children:y.db_rule_count===0?`⚠ db empty — daemon falls back to file-based loading`:`db has ${y.db_rule_count} rules — indexed queries`})]}),l===`done`&&(0,B.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm border border-emerald-500/25 bg-emerald-500/[0.06] px-3 py-2 text-xs font-mono text-emerald-200`,children:[(0,B.jsxs)(`span`,{children:[`✓ `,d]}),(0,B.jsx)(`button`,{onClick:()=>u(`idle`),className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-emerald-500/30 hover:bg-emerald-500/10 transition-colors cursor-pointer uppercase tracking-wider text-[10px]`,children:`dismiss`})]}),l===`error`&&(0,B.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm border border-red-500/25 bg-red-500/[0.06] px-3 py-2 text-xs font-mono text-red-200`,children:[(0,B.jsxs)(`span`,{children:[`✗ `,d]}),(0,B.jsx)(`button`,{onClick:()=>u(`idle`),className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-red-500/30 hover:bg-red-500/10 transition-colors cursor-pointer uppercase tracking-wider text-[10px]`,children:`dismiss`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] font-mono text-[var(--color-fg-4)] pt-2 border-t border-[var(--color-line-0)]`,children:[(0,B.jsxs)(`span`,{children:[`rules dir:`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:y.rules_dir})]}),(0,B.jsxs)(`span`,{className:`ml-auto`,children:[`last reload:`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:Hc(y.last_reload_at)})]})]})]}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-5`,children:[(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`sqlite database`}),v&&!v.error&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(Gc,{ok:v.journal_mode===`wal`,label:`wal`,badLabel:`no wal`}),(0,B.jsx)(Gc,{ok:v.synchronous===`NORMAL`,label:`normal`,badLabel:v.synchronous})]})]}),(0,B.jsx)(U,{children:v?v.error?(0,B.jsx)(`div`,{className:`text-xs text-red-300 font-mono bg-red-500/[0.06] border border-red-500/25 rounded-sm p-2`,children:v.error}):(0,B.jsxs)(`div`,{children:[(0,B.jsx)(Uc,{children:`storage`}),(0,B.jsx)(Wc,{label:`file path`,value:v.path}),(0,B.jsx)(Wc,{label:`file size`,value:Rc(v.file_size_bytes)}),(0,B.jsx)(Wc,{label:`allocated`,value:`${Rc(v.allocated_bytes)} (${v.page_count.toLocaleString()} pages × ${v.page_size}B)`}),(0,B.jsx)(Uc,{className:`mt-4`,children:`pragma configuration`}),(0,B.jsx)(Wc,{label:`journal_mode`,value:v.journal_mode,accent:v.journal_mode===`wal`?`text-emerald-300`:`text-amber-300`}),(0,B.jsx)(Wc,{label:`synchronous`,value:v.synchronous,accent:v.synchronous===`NORMAL`?`text-emerald-300`:`text-amber-300`}),(0,B.jsx)(Wc,{label:`cache_size`,value:`${v.cache_size_kb.toLocaleString()} KB (${Math.round(v.cache_size_kb/1024)} MB)`}),(0,B.jsx)(Wc,{label:`page_size`,value:`${v.page_size.toLocaleString()} B`}),v.wal_checkpoint&&(0,B.jsx)(Wc,{label:`wal checkpoint`,value:`log ${v.wal_checkpoint.log}, checkpointed ${v.wal_checkpoint.checkpointed}, busy ${v.wal_checkpoint.busy}`}),(0,B.jsx)(Uc,{className:`mt-4`,children:`table row counts`}),v.tables.map(e=>(0,B.jsx)(Wc,{label:e.name,value:e.row_count>=0?e.row_count.toLocaleString():`error`,accent:e.row_count<0?`text-red-300`:`text-[var(--color-fg-1)]`},e.name))]}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]}),(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`audit log capacity`})}),(0,B.jsx)(U,{children:b?(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(Kc,{pct:b.utilization_pct,total:b.total_rows,max:b.max_rows}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(Wc,{label:`total rows`,value:b.total_rows.toLocaleString()}),(0,B.jsx)(Wc,{label:`rotation limit`,value:b.max_rows.toLocaleString()}),(0,B.jsx)(Wc,{label:`utilization`,value:`${b.utilization_pct}%`,accent:b.utilization_pct>=85?`text-red-300`:b.utilization_pct>=60?`text-amber-300`:`text-emerald-300`}),(0,B.jsx)(Wc,{label:`oldest entry`,value:Vc(b.oldest_timestamp)}),(0,B.jsx)(Wc,{label:`newest entry`,value:Vc(b.newest_timestamp)})]}),b.utilization_pct>=85&&(0,B.jsx)(`div`,{className:`rounded-sm border border-red-500/25 bg-red-500/[0.06] px-3 py-2 text-[11px] font-mono text-red-200`,children:`⚠ audit log nearing rotation limit. oldest entries will be purged automatically.`})]}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`process & runtime`})}),(0,B.jsx)(U,{children:x?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(Wc,{label:`pid`,value:x.pid}),(0,B.jsx)(Wc,{label:`uptime`,value:Bc(x.uptime_ms)}),(0,B.jsx)(Wc,{label:`memory (rss)`,value:`${x.memory_rss_mb} MB`}),(0,B.jsx)(Wc,{label:`bun version`,value:x.bun_version}),(0,B.jsx)(Wc,{label:`node compat`,value:x.node_version}),(0,B.jsx)(Wc,{label:`platform`,value:`${x.platform} / ${x.arch}`})]}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]})]})]}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`flight recorder`})}),(0,B.jsx)(U,{children:S?(0,B.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline mb-1.5`,children:`log file`}),(0,B.jsx)(`div`,{className:`text-xs font-mono text-[var(--color-fg-1)] truncate`,children:`…${S.path.slice(-50)}`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline mb-1.5`,children:`file size`}),(0,B.jsx)(`div`,{className:`text-xs font-mono tabular-nums ${S.file_size_bytes===0?`text-[var(--color-fg-4)]`:`text-[var(--color-fg-1)]`}`,children:Rc(S.file_size_bytes)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline mb-1.5`,children:`approx. entries`}),(0,B.jsx)(`div`,{className:`text-xs font-mono tabular-nums ${S.approx_entries===0?`text-[var(--color-fg-4)]`:`text-[var(--color-fg-1)]`}`,children:S.approx_entries===0?`—`:S.approx_entries.toLocaleString()})]})]}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]}),(0,B.jsx)(Xc,{}),(0,B.jsx)(Zc,{}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`observability api`})}),(0,B.jsxs)(U,{children:[(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mb-2.5`,children:`machine-readable endpoints for automated monitoring and ai agent triage:`}),(0,B.jsx)(`div`,{className:`space-y-1 font-mono text-[11px]`,children:[[`/api/json/observability`,`sqlite health, rule drift, process info`],[`/api/state/runtime`,`eval latency, decision counters, memory`],[`/api/state/activity-tail?after=0&limit=20`,`recent eval events (live feed)`],[`/api/json/daemon-status`,`daemon pid, status, log tail`],[`/api/json/evald-log`,`last 200 lines of evald.log (daemon stderr)`],[`/healthz`,`process liveness`],[`/readyz`,`sqlite liveness`]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`GET`}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-[var(--color-brand)]/80 hover:text-[var(--color-brand)] transition-colors`,children:e}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)] hidden sm:inline`,children:[`— `,t]})]},e))})]})]})]})}function $c({db:e,audit:t,proc:n,flight:r,driftDetected:i}){let a=e?e.error?`error`:e.journal_mode===`wal`&&e.synchronous===`NORMAL`?`ok`:`warn`:`unknown`,o=t?t.utilization_pct>=85?`error`:t.utilization_pct>=60?`warn`:`ok`:`unknown`,s=n?n.memory_rss_mb>600?`warn`:`ok`:`unknown`;return(0,B.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,B.jsxs)(Ic,{title:`sqlite`,status:a,statusLabel:e?.journal_mode?.toUpperCase()??`idle`,children:[(0,B.jsx)(Lc,{label:`size`,value:e?(0,B.jsx)(yr,{value:e.file_size_bytes,format:e=>zc(e)}):`—`,mono:!0}),(0,B.jsx)(Lc,{label:`journal`,value:e?.journal_mode??`—`,mono:!0}),(0,B.jsx)(Lc,{label:`sync`,value:e?.synchronous??`—`,mono:!0}),(0,B.jsx)(Lc,{label:`tables`,value:e?.tables.length??0,tone:i?`warn`:`neutral`})]}),(0,B.jsxs)(Ic,{title:`audit log`,status:o,statusLabel:t?`${t.utilization_pct}%`:`idle`,children:[(0,B.jsx)(Lc,{label:`rows`,value:t?(0,B.jsx)(yr,{value:t.total_rows}):`—`}),(0,B.jsx)(Lc,{label:`capacity`,value:t?`${(t.total_rows/Math.max(1,t.max_rows)*100).toFixed(1)}%`:`—`,tone:t&&t.utilization_pct>=85?`bad`:t&&t.utilization_pct>=60?`warn`:`good`}),(0,B.jsx)(Lc,{label:`oldest`,value:Vc(t?.oldest_timestamp??null),mono:!0}),(0,B.jsx)(Lc,{label:`newest`,value:Vc(t?.newest_timestamp??null),mono:!0})]}),(0,B.jsxs)(Ic,{title:`process`,status:s,statusLabel:n?`pid ${n.pid}`:`idle`,children:[(0,B.jsx)(Lc,{label:`uptime`,value:n?Bc(n.uptime_ms):`—`,mono:!0}),(0,B.jsx)(Lc,{label:`rss`,value:n?(0,B.jsxs)(`span`,{children:[(0,B.jsx)(yr,{value:n.memory_rss_mb,format:e=>e.toFixed(0)}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1`,children:`MB`})]}):`—`}),(0,B.jsx)(Lc,{label:`bun`,value:n?.bun_version??`—`,mono:!0}),(0,B.jsx)(Lc,{label:`platform`,value:n?`${n.platform}/${n.arch}`:`—`,mono:!0})]}),(0,B.jsxs)(Ic,{title:`flight recorder`,status:r&&r.file_size_bytes>0?`ok`:`unknown`,statusLabel:r?`${r.approx_entries.toLocaleString()} entries`:`idle`,children:[(0,B.jsx)(Lc,{label:`size`,value:r?(0,B.jsx)(yr,{value:r.file_size_bytes,format:e=>zc(e)}):`—`,mono:!0}),(0,B.jsx)(Lc,{label:`entries`,value:r?(0,B.jsx)(yr,{value:r.approx_entries}):`—`})]})]})}function el(e){let{playback:t,bursts:n,rangeStart:r,rangeEnd:i,loading:a,onPlayhead:o,onLive:s,onPause:c,onResume:l,onToday:u}=e,d=(0,_.useRef)(null),f=(0,_.useRef)(!1),p=Math.max(1,i-r),m=(t.playhead_ms-r)/p*100,h=Math.max(0,Math.min(100,m)),g=(0,_.useMemo)(()=>{let e=[];for(let t=0;t<200;t++)e.push({allow:0,block:0,ask:0,other:0});for(let t of n){let n=t.ts_ms;if(n<r||n>i)continue;let a=e[Math.floor((n-r)/p*199)];t.decision===`allow`?a.allow++:t.decision===`block`||t.decision===`force`?a.block++:t.decision===`ask`?a.ask++:a.other++}return e},[n,r,i,p]),v=(0,_.useCallback)(e=>{let t=d.current;if(!t)return;let n=t.getBoundingClientRect();o(r+Math.max(0,Math.min(1,(e-n.left)/n.width))*p)},[r,p,o]);(0,_.useEffect)(()=>{let e=e=>{f.current&&v(e.clientX)},t=()=>{f.current=!1};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t)}},[v]);let y=t.mode===`live`;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono uppercase tracking-wider`,children:[(0,B.jsx)(`button`,{onClick:()=>y?c():l(),className:`px-2.5 py-1 rounded-sm border transition-colors cursor-pointer ${y?`border-emerald-500/40 text-emerald-300 hover:bg-emerald-500/10`:`border-amber-500/40 text-amber-300 hover:bg-amber-500/10`}`,title:y?`Pause the live stream`:`Resume updates at this playhead`,children:y?`⏸ pause`:`▶ resume`}),(0,B.jsx)(`button`,{onClick:s,disabled:y,className:`px-2.5 py-1 rounded-sm border transition-colors cursor-pointer ${y?`border-[var(--color-line-1)] text-[var(--color-fg-4)] opacity-50`:`border-sky-500/40 text-sky-300 hover:bg-sky-500/10`}`,title:`Jump to live (now)`,children:`⏭ live`}),(0,B.jsx)(`button`,{onClick:u,className:`px-2.5 py-1 rounded-sm border border-violet-500/40 text-violet-300 hover:bg-violet-500/10 transition-colors cursor-pointer`,title:`Expand to today — window covers from local midnight through now. Backfills audit_log so the scrubber shows every eval since 00:00 local.`,children:`◉ today`}),(0,B.jsx)(`div`,{className:`flex-1`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`mode`}),(0,B.jsx)(`span`,{className:y?`text-emerald-300`:t.mode===`paused`?`text-amber-300`:`text-violet-300`,children:t.mode}),a&&(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] animate-pulse`,children:`· backfilling`}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`· t=`,tl(t.playhead_ms)]})]}),(0,B.jsxs)(`div`,{ref:d,className:`relative h-10 w-full rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] cursor-pointer overflow-hidden select-none`,onPointerDown:e=>{f.current=!0,e.target.setPointerCapture?.(e.pointerId),v(e.clientX)},children:[(0,B.jsx)(`svg`,{viewBox:`0 0 200 40`,preserveAspectRatio:`none`,className:`absolute inset-0 w-full h-full`,"aria-hidden":!0,children:g.map((e,t)=>{let n=e.allow+e.block+e.ask+e.other;if(n===0)return null;let r=Math.min(32,n*3),i=e.block>0?Pa.block:e.ask>0?Pa.ask:Pa.allow;return(0,B.jsx)(`rect`,{x:t,y:40-r,width:.9,height:r,fill:i,opacity:.7},t)})}),(0,B.jsx)(`div`,{className:`absolute top-0 bottom-0 w-px bg-sky-300 pointer-events-none`,style:{left:`${h}%`},children:(0,B.jsx)(`div`,{className:`absolute -top-0.5 -translate-x-1/2 w-2 h-2 rotate-45 bg-sky-300`})}),y&&(0,B.jsx)(`div`,{className:`absolute top-0 right-0 bottom-0 w-[2px] bg-emerald-400 animate-pulse pointer-events-none`})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] font-mono text-[var(--color-fg-4)]`,children:[(0,B.jsx)(`span`,{children:nl(r)}),(0,B.jsxs)(`span`,{className:`uppercase tracking-wider`,children:[rl(t.window_ms),` window`]}),(0,B.jsx)(`span`,{children:nl(i)})]})]})}function tl(e){let t=Date.now()-e;if(Math.abs(t)<1500)return`live`;let n=Math.round(t/1e3);if(n<60)return`−${n}s`;let r=Math.floor(n/60);return r<60?`−${r}m${n%60}s`:`−${Math.floor(r/60)}h${r%60}m`}function nl(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function rl(e){return e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:`${Math.round(e/36e5)}h`}function il(e){let{burst:t,onClose:n}=e;if(!t)return(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,B.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`node · none`}),(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`click a node to inspect`})]});let r=Pa[t.decision]??`#6b7280`,i=t.duration_ns/1e6,a=Date.now()-t.ts_ms;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 text-[12px] font-mono`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline text-[var(--color-fg-3)]`,children:`node · inspect`}),(0,B.jsx)(`button`,{onClick:n,className:`text-[var(--color-fg-4)] hover:text-[var(--color-fg-1)] cursor-pointer`,title:`Close inspector`,children:`✕`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{background:r},"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`uppercase tracking-wider`,style:{color:r},children:t.decision}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:t.tool})]}),(0,B.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[11px]`,children:[(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`rule`}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)] break-all`,children:t.rule_id??`—`}),(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`client`}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:t.client}),(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`agent`}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:t.agent_id?(0,B.jsx)(`span`,{className:`chip text-violet-300 border-violet-500/30`,children:t.agent_id}):(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`—`})}),(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`duration`}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:i<1?`${(i*1e3).toFixed(0)}µs`:`${i.toFixed(2)}ms`}),(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`age`}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:al(a)}),(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`timestamp`}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:new Date(t.ts_ms).toLocaleString()})]}),t.input_preview&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:`input`}),(0,B.jsx)(`pre`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-0)] rounded-sm p-2 text-[10px] text-[var(--color-fg-2)] whitespace-pre-wrap break-all max-h-48 overflow-y-auto`,children:t.input_preview})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[t.audit_id&&(0,B.jsx)(`a`,{href:`/audit?id=${encodeURIComponent(t.audit_id)}`,className:`chip text-[var(--color-fg-3)] border-[var(--color-line-1)] hover:text-[var(--color-fg-1)]`,title:`Open full audit record`,children:`audit ↗`}),t.rule_id&&(0,B.jsx)(`a`,{href:`/rules#${encodeURIComponent(t.rule_id)}`,className:`chip text-[var(--color-fg-3)] border-[var(--color-line-1)] hover:text-[var(--color-fg-1)]`,title:`Jump to rule`,children:`rule ↗`})]})]})}function al(e){if(e<1500)return`just now`;let t=Math.floor(e/1e3);if(t<60)return`${t}s ago`;let n=Math.floor(t/60);return n<60?`${n}m${t%60}s ago`:`${Math.floor(n/60)}h${n%60}m ago`}function ol(e){let t=new Map;for(let n of e){let e=`${n.client}:${n.agent_id??`solo`}`,r=t.get(e);r?(r.count+=1,n.ts_ms>r.newest_ts_ms&&(r.newest_ts_ms=n.ts_ms)):t.set(e,{client:n.client,agent_id:n.agent_id??`solo`,count:1,newest_ts_ms:n.ts_ms})}return Array.from(t.values()).sort((e,t)=>t.newest_ts_ms===e.newest_ts_ms?t.count-e.count:t.newest_ts_ms-e.newest_ts_ms)}function sl(e){let{bursts:t,allBursts:n}=e,r=n??t,{toolCounts:i,decisionCounts:a,ruleCounts:o,unmatchedCount:s}=(0,_.useMemo)(()=>{let e=new Map,n=new Map,r=new Map,i=0;for(let a of t)if(e.set(a.tool,(e.get(a.tool)??0)+1),n.set(a.decision,(n.get(a.decision)??0)+1),a.rule_id){let e=r.get(a.rule_id);e?(e.count+=1,e.decisions.add(a.decision)):r.set(a.rule_id,{count:1,decisions:new Set([a.decision])})}else i+=1;return{toolCounts:Array.from(e.entries()).sort((e,t)=>t[1]-e[1]),decisionCounts:Array.from(n.entries()),ruleCounts:Array.from(r.entries()).map(([e,t])=>({id:e,count:t.count,decisions:t.decisions})).sort((e,t)=>t.count-e.count),unmatchedCount:i}},[t]),c=(0,_.useMemo)(()=>ol(r),[r]),l=i[0]?.[1]??0,u=c[0]?.count??0,d=o[0]?.count??0,f=e=>{for(let t of[`block`,`ask`,`force`,`log`,`allow`,`shadow`])if(e.has(t))return Pa[t];return`#6b7280`};return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 text-[11px] font-mono`,children:[(0,B.jsx)(`div`,{className:`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-0)] p-2 text-[10px] text-[var(--color-fg-3)] leading-relaxed`,children:`Each dot is one tool call by an AI agent. Color encodes the ssg rule decision; lines link calls from the same agent in time order.`}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`rules · `,o.length,` matched`,s>0&&(0,B.jsxs)(`span`,{className:`ml-2 text-[var(--color-fg-4)] normal-case tracking-normal`,children:[s,` unmatched`]})]}),o.length===0?(0,B.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no rules matched in window`}):(0,B.jsx)(`ul`,{className:`space-y-0.5`,children:o.slice(0,6).map(e=>{let t=d>0?e.count/d*100:0,n=f(e.decisions);return(0,B.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,title:`${e.id} — decisions: ${Array.from(e.decisions).join(`, `)}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:n},"aria-hidden":!0}),(0,B.jsx)(`a`,{href:`/rules#${encodeURIComponent(e.id)}`,className:`truncate text-[var(--color-fg-2)] hover:text-[var(--color-fg-1)]`,children:e.id}),(0,B.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full`,style:{background:n,width:`${t}%`,opacity:.6}})})]}),(0,B.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:e.count})]},e.id)})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:`decisions`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[`allow`,`block`,`ask`,`log`,`force`,`shadow`].map(e=>{let t=a.find(([t])=>t===e)?.[1]??0;return(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:Pa[e]},"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)] uppercase tracking-wider`,children:e}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] tabular-nums`,children:t})]},e)})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`agents · `,c.length,` active`,n&&n!==t&&(0,B.jsx)(`span`,{className:`ml-2 text-[var(--color-fg-4)] normal-case tracking-normal`,children:`roster: today`})]}),c.length===0?(0,B.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no agents in window`}):(0,B.jsx)(`ul`,{className:`space-y-0.5`,children:c.slice(0,8).map(e=>{let t=u>0?e.count/u*100:0,n=`${e.client}:${e.agent_id}`,r=Date.now()-e.newest_ts_ms,i=r<5e3;return(0,B.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,title:`${n} — last eval ${Math.max(0,Math.round(r/1e3))}s ago`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i?(0,B.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft shrink-0`,"aria-hidden":!0}):(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-[var(--color-fg-4)]/40`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{className:`truncate text-[var(--color-fg-2)]`,children:[e.client,(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`:`,e.agent_id]})]}),(0,B.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full bg-violet-400/60`,style:{width:`${t}%`}})})]}),(0,B.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:e.count})]},n)})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`tools · `,t.length,` in window`]}),i.length===0?(0,B.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no tool activity`}):(0,B.jsx)(`ul`,{className:`space-y-0.5`,children:i.slice(0,8).map(([e,t])=>{let n=l>0?t/l*100:0;return(0,B.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`truncate text-[var(--color-fg-2)]`,children:e}),(0,B.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full bg-sky-400/60`,style:{width:`${n}%`}})})]}),(0,B.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:t})]},e)})})]})]})}function cl(){let e=new Date;return e.setHours(0,0,0,0),e.getTime()}function ll(e,t,n){let r=t-n,i=[];for(let n of e)if(!(n.ts_ms<r)){if(n.ts_ms>t)break;i.push(n)}return i}function ul(e,t){if(e.length===0)return t.slice();if(t.length===0)return e.slice();let n=new Set,r=[],i=0,a=0;for(;i<e.length&&a<t.length;){let o=e[i].ts_ms<=t[a].ts_ms?e[i++]:t[a++],s=dl(o);n.has(s)||(n.add(s),r.push(o))}for(;i<e.length;i++){let t=dl(e[i]);n.has(t)||(n.add(t),r.push(e[i]))}for(;a<t.length;a++){let e=dl(t[a]);n.has(e)||(n.add(e),r.push(t[a]))}return r}function dl(e){return e.audit_id??`${e.ts_ms}:${e.tool}:${e.client}`}function fl(e={}){let t=e.windowMs??12e4,n=Oe(),r=ke(),[i,a]=(0,_.useState)(()=>({mode:`live`,playhead_ms:Date.now(),window_ms:t})),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(!1),u=(0,_.useRef)(null),d=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(i.mode!==`live`)return;let e=n.length>0?n[n.length-1].ts_ms:Date.now();e!==i.playhead_ms&&a(t=>({...t,playhead_ms:e}))},[i.mode,i.playhead_ms,n,r]);let f=(0,_.useMemo)(()=>ul(o,n),[o,n,r]),p=(0,_.useMemo)(()=>ll(f,i.playhead_ms,i.window_ms),[f,i.playhead_ms,i.window_ms]),m=f.length>0?f[0].ts_ms:i.playhead_ms,h=f.length>0?f[f.length-1].ts_ms:i.playhead_ms,g=(0,_.useCallback)(async e=>{if(d.current)return;let t=m,n=Math.min(t,(u.current??Date.now())-e);if(n>=t)return;let r=new AbortController;d.current=r,l(!0);try{let e=await fetch(`/api/json/graph/backfill?since_ms=${n}&until_ms=${t}&limit=500`,{signal:r.signal,credentials:`same-origin`});if(!e.ok)throw Error(`backfill ${e.status}`);let i=await e.json();Array.isArray(i.bursts)&&i.bursts.length>0&&s(e=>ul(e,i.bursts)),u.current=n}catch(e){e.name!==`AbortError`&&console.warn(`[graph] backfill failed`,e)}finally{d.current=null,l(!1)}},[m]);(0,_.useEffect)(()=>{i.playhead_ms-m<i.window_ms*.5&&g(Fa)},[i.mode,i.playhead_ms,i.window_ms,m,g]);let v=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(v.current)return;v.current=!0;let e=Date.now()-cl();e>0&&g(e)},[]),(0,_.useEffect)(()=>()=>{d.current?.abort(),d.current=null},[]);let y=(0,_.useCallback)(e=>{a(t=>e===`live`?{...t,mode:`live`}:{...t,mode:e})},[]),b=(0,_.useCallback)(e=>{a(t=>({...t,mode:t.mode===`live`?`scrubbing`:t.mode,playhead_ms:e}))},[]),x=(0,_.useCallback)(e=>{a(t=>({...t,window_ms:Math.max(1e3,e)}))},[]),S=(0,_.useCallback)(()=>{a(e=>({...e,mode:`live`,playhead_ms:Date.now()}))},[]),C=(0,_.useCallback)(()=>{let e=cl(),t=Date.now(),n=Math.max(1e3,t-e);a(e=>({...e,mode:`live`,playhead_ms:t,window_ms:n})),g(n)},[g]);return{snapshot:(0,_.useMemo)(()=>({bursts:p,playback:i,oldest_known_ms:m,newest_known_ms:h,loading_backfill:c}),[p,i,m,h,c]),allBursts:f,setMode:y,setPlayhead:b,setWindow:x,jumpToLive:S,requestBackfill:g,jumpToToday:C}}function pl(){let e=fl(),t=ke(),n=De(),[r,i]=(0,_.useState)(null),a=jo();(0,_.useEffect)(()=>{n&&(n.decision===`block`?a.play(`block`):n.decision===`force`&&a.play(`force`))},[t]);let o=(0,_.useCallback)(()=>a.play(`milestone`),[a]),s=(0,_.useCallback)(()=>a.play(`record`),[a]),{bursts:c,playback:l,oldest_known_ms:u,newest_known_ms:d,loading_backfill:f}=e.snapshot,p=(0,_.useMemo)(()=>{if(!r)return null;for(let e of c)if((e.audit_id??`${e.ts_ms}:${e.tool}`)===r||r.startsWith(`${e.ts_ms}:${e.tool}`))return e;return null},[c,r]),m=Math.min(u,l.playhead_ms-l.window_ms),h=Math.max(d,l.playhead_ms);return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 min-h-[70vh]`,children:[(0,B.jsxs)(`header`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`h1`,{className:`text-sm font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`graph intelligence`}),(0,B.jsx)(`span`,{className:`chip text-sky-300 border-sky-500/30`,children:`real-time tool-use`}),l.mode===`live`?(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-emerald-300`,children:[(0,B.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),`streaming`]}):(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-amber-300`,children:[(0,B.jsx)(`span`,{className:`status-dot bg-amber-400`}),l.mode]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:[c.length,` nodes · window`,` `,Math.round(l.window_ms/1e3),`s`]}),(0,B.jsx)(`button`,{type:`button`,onClick:a.toggle,className:`chip cursor-pointer hover:border-sky-500/50 hover:text-sky-300 transition-colors`,title:a.enabled?`Mute stream sounds`:`Enable stream sounds`,children:a.enabled?`SFX ON`:`SFX OFF`})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-4 flex-1 min-h-0`,children:[(0,B.jsxs)(`div`,{className:`min-h-[440px] flex relative`,children:[(0,B.jsx)(fo,{bursts:c,paused:l.mode!==`live`,selectedId:r,onSelect:i,burstSeq:t}),(0,B.jsx)(bo,{className:`absolute top-3 left-3 z-10`}),(0,B.jsx)(To,{className:`absolute top-3 right-3 z-10`,onMilestone:o,onRecord:s})]}),(0,B.jsxs)(`aside`,{className:`flex flex-col gap-4 min-w-0`,children:[(0,B.jsx)(`section`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:(0,B.jsx)(sl,{bursts:c,allBursts:e.allBursts})}),(0,B.jsx)(`section`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 min-h-[200px]`,children:(0,B.jsx)(il,{burst:p,onClose:()=>i(null)})})]})]}),(0,B.jsx)(`section`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:(0,B.jsx)(el,{playback:l,bursts:c,rangeStart:m,rangeEnd:h,loading:f,onPlayhead:t=>e.setPlayhead(t),onLive:()=>e.jumpToLive(),onPause:()=>e.setMode(`paused`),onResume:()=>e.setMode(`scrubbing`),onToday:()=>e.jumpToToday()})})]})}var ml=[{id:`rca`,label:`rca`,hint:`pre-computed root cause`},{id:`timeline`,label:`timeline`,hint:`recent frames across traces`},{id:`watch`,label:`watch`,hint:`subscribe to any ssg:// URI`},{id:`state`,label:`state`,hint:`daemon runtime snapshot`},{id:`metrics`,label:`metrics`,hint:`latency + counters`}];function hl(){let[e,t]=(0,_.useState)(`rca`);return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 min-h-[70vh]`,children:[(0,B.jsxs)(`header`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`h1`,{className:`text-sm font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`ai-native debugger`}),(0,B.jsx)(`span`,{className:`chip text-sky-300 border-sky-500/30`,children:`ssg:// unified resolver`}),(0,B.jsx)(gl,{})]}),(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`one surface · cli · mcp · dashboard`})]}),(0,B.jsx)(`nav`,{className:`flex items-center gap-1 border-b border-[var(--color-line-1)]`,children:ml.map(n=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>t(n.id),title:n.hint,className:`px-3 py-1.5 text-[11px] font-mono uppercase tracking-wider border-b-2 transition-colors `+(e===n.id?`border-[var(--color-brand)] text-[var(--color-fg-1)]`:`border-transparent text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)]`),children:n.label},n.id))}),(0,B.jsxs)(`section`,{className:`flex-1 min-h-0`,children:[e===`rca`&&(0,B.jsx)(_l,{}),e===`timeline`&&(0,B.jsx)(Sl,{}),e===`watch`&&(0,B.jsx)(Al,{}),e===`state`&&(0,B.jsx)(jl,{uri:`ssg://daemon/state`}),e===`metrics`&&(0,B.jsx)(jl,{uri:`ssg://daemon/metrics`})]})]})}function gl(){let e=je([`debug-frame`])[`debug-frame`]??0;return(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-emerald-300`,title:`${e} debug-frame bursts received`,children:[(0,B.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),`live · `,e]})}function _l(){let e=je([`debug-frame`,`activity-updated`]),{data:t,loading:n,error:r,refetch:i}=F(`/api/json/debug?uri=ssg%3A%2F%2Frca%2Fcurrent`,[e[`debug-frame`],e[`activity-updated`]]),a=t?.data?.pack??null;return(0,B.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-[1fr_340px] gap-4`,children:[(0,B.jsxs)(`article`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-4 space-y-3`,children:[n&&!t&&(0,B.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`loading RCA pack…`}),r&&(0,B.jsxs)(`p`,{className:`text-sm text-rose-300`,children:[`rca fetch error: `,r]}),!n&&!a&&(0,B.jsxs)(`div`,{className:`text-sm text-[var(--color-fg-3)] space-y-2`,children:[(0,B.jsx)(`p`,{className:`font-mono`,children:`no current RCA pack`}),(0,B.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)]`,children:`Packs are composed automatically when an eval errors, an ssqa finding arrives, or a daemon-level error fires. Nothing to diagnose yet — you're green.`})]}),a&&(0,B.jsx)(yl,{pack:a})]}),(0,B.jsxs)(`aside`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 text-[11px] font-mono text-[var(--color-fg-4)] space-y-2`,children:[(0,B.jsx)(`p`,{className:`uppercase tracking-wider text-[var(--color-fg-2)]`,children:`how claude sees this`}),(0,B.jsxs)(`pre`,{className:`text-[10px] whitespace-pre-wrap leading-snug`,children:[`ssg debug rca --current --json`,`
|
|
18
|
+
${c===`installed`?`bg-[var(--color-surface-3)] text-[var(--color-fg-0)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`}`,children:[`installed`,ne>0&&(0,B.jsx)(`span`,{className:`text-[9px] bg-emerald-500/15 text-emerald-300 rounded-sm px-1 py-0.5 font-medium tabular-nums`,children:ne})]})]}),(0,B.jsxs)(`div`,{className:`relative flex-1 min-w-[160px]`,children:[(0,B.jsxs)(`svg`,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--color-fg-4)]`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,B.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,B.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,B.jsx)(`input`,{type:`text`,placeholder:`search rulesets…`,value:e,onChange:e=>t(e.target.value),className:`w-full bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-xs rounded-sm pl-8 pr-3 h-8 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono`})]}),(0,B.jsx)(`select`,{value:n,onChange:e=>r(e.target.value),className:O,children:uc.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,B.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),className:O,children:[(0,B.jsx)(`option`,{value:``,children:`any decision`}),fc.filter(Boolean).map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),className:O,children:[(0,B.jsx)(`option`,{value:``,children:`any severity`}),dc.filter(Boolean).map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]}),g&&u.length===0?(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,B.jsx)(pc,{},t))}):te.length===0?(0,B.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] py-16 flex flex-col items-center justify-center text-center`,children:[(0,B.jsxs)(`svg`,{className:`text-[var(--color-fg-4)] mb-3`,width:`36`,height:`36`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,B.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,B.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,B.jsx)(`p`,{className:`text-xs font-mono text-[var(--color-fg-3)] uppercase tracking-wider`,children:c===`installed`?`no rulesets installed yet — browse and click install`:`no rulesets found${e?` matching "${e}"`:``}`})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:te.map(e=>(0,B.jsx)(hc,{rs:e,installingId:y,onInstall:D,flashId:x},e.id))}),f&&c===`all`&&(0,B.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,B.jsx)(`button`,{onClick:E,disabled:g,className:`h-8 px-5 rounded-sm text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-2)] border border-[var(--color-line-1)] hover:text-[var(--color-fg-0)] hover:border-[var(--color-line-2)] transition-colors cursor-pointer disabled:opacity-40`,children:g?`loading…`:`load more`})})]})]})}var _c={deny:`red`,block:`red`,ask:`amber`,allow:`green`,log:`gray`,force:`blue`};function vc({id:e}){let{data:t,error:n}=F(`/api/json/hub/${e}`),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1);if(n)return(0,B.jsxs)(`div`,{className:`text-sm text-red-300 font-mono`,children:[(0,B.jsx)(`p`,{children:n}),(0,B.jsx)(`a`,{href:`/hub`,className:`text-[var(--color-brand)] hover:underline mt-3 block text-[11px] uppercase tracking-wider`,children:`← back to hub`})]});if(!t)return(0,B.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading ruleset…`});async function s(){o(!0);try{(await fetch(`/api/hub/install`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({id:e})})).ok&&i(!0)}finally{o(!1)}}return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`a`,{href:`/hub`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`← hub`}),(0,B.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-1.5 text-[var(--color-fg-0)]`,children:t.title}),(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mt-1 tabular-nums`,children:[`@`,t.author,` · v`,t.version,` · `,t.rule_count,` rule`,t.rule_count===1?``:`s`]})]}),(0,B.jsx)(W,{variant:r?`secondary`:`primary`,onClick:s,disabled:a||r,children:r?`✓ installed`:a?`installing…`:`install`})]}),t.technologies.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.technologies.map(e=>(0,B.jsx)(mr,{variant:`blue`,children:e},e))}),t.github_repo&&(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`source`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:t.github_repo})]}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsxs)(`span`,{className:`overline`,children:[`rules · `,t.rules.length]})}),(0,B.jsx)(U,{className:`space-y-4`,children:t.rules.map((e,t)=>(0,B.jsxs)(`div`,{className:t>0?`border-t border-[var(--color-line-0)] pt-4`:void 0,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-2 flex-wrap`,children:[(0,B.jsx)(mr,{variant:_c[e.decision]??`gray`,children:e.decision}),(0,B.jsx)(`code`,{className:`text-xs text-[var(--color-brand)] font-mono`,children:e.name}),e.capability&&(0,B.jsx)(mr,{variant:`gray`,children:e.capability})]}),(0,B.jsx)(`p`,{className:`text-sm text-[var(--color-fg-1)] mb-2`,children:e.message}),(0,B.jsx)(Zo,{children:e.raw_text})]},e.id))})]})]})}function yc(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(`idle`),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(!1);async function u(){l(!0),a(``);try{let e=await fetch(`/api/hub/device-start`,{method:`POST`,headers:{Accept:`application/json`,...Ae()}}),n=await e.json();if(!e.ok){let t=n;t.error===`not_configured`?(r(`not_configured`),s(t.setup_steps??[]),a(t.message??`GitHub OAuth not configured.`)):(a(n.error??`HTTP ${e.status}`),r(`error`));return}t(n),r(`polling`)}catch(e){a(e instanceof Error?e.message:`Failed to start`),r(`error`)}finally{l(!1)}}return(0,_.useEffect)(()=>{if(n!==`polling`||!e)return;let t=setInterval(async()=>{try{let n=await(await fetch(`/api/hub/device-poll?flow=${e.flow_id}`,{headers:{Accept:`application/json`}})).json();n.status===`complete`?(clearInterval(t),r(`done`),a(`connected as @${n.session?.login??`GitHub`} — you can now publish rulesets`)):(n.status===`expired`||n.status===`error`)&&(clearInterval(t),r(`error`),a(n.error??`Authentication failed`))}catch{}},3e3);return()=>clearInterval(t)},[n,e]),(0,B.jsxs)(`div`,{className:`max-w-lg mx-auto space-y-5`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`a`,{href:`/hub`,className:`inline-flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)] transition-colors`,children:[(0,B.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,B.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}),`back to hub`]}),(0,B.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-2 text-[var(--color-fg-0)]`,children:`Connect GitHub`}),(0,B.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-3)] mt-1 font-mono`,children:`authenticate with github to publish rulesets to the hub`})]}),n===`not_configured`&&(0,B.jsx)(V,{children:(0,B.jsxs)(U,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(`span`,{className:`text-amber-300 shrink-0 mt-0.5`,children:(0,B.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,B.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,B.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,B.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-[var(--color-fg-0)]`,children:`GitHub OAuth not configured`}),(0,B.jsx)(`p`,{className:`text-xs text-[var(--color-fg-2)] mt-1 leading-relaxed`,children:i})]})]}),(0,B.jsxs)(`div`,{className:`border-t border-[var(--color-line-0)] pt-4`,children:[(0,B.jsx)(`div`,{className:`overline mb-3`,children:`setup steps`}),(0,B.jsx)(`ol`,{className:`space-y-2`,children:o.map((e,t)=>(0,B.jsxs)(`li`,{className:`flex items-start gap-2.5 text-xs text-[var(--color-fg-1)]`,children:[(0,B.jsx)(`span`,{className:`shrink-0 w-5 h-5 rounded-sm bg-[var(--color-surface-2)] border border-[var(--color-line-1)] text-[var(--color-fg-3)] text-[10px] font-mono flex items-center justify-center tabular-nums`,children:t+1}),(0,B.jsx)(`span`,{className:`mt-0.5 leading-relaxed`,children:e.replace(/^\d+\.\s+/,``)})]},t))})]}),(0,B.jsxs)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-3`,children:[(0,B.jsx)(`div`,{className:`overline mb-1.5`,children:`quick start`}),(0,B.jsx)(`code`,{className:`text-[11px] text-[var(--color-brand)]/90 font-mono`,children:`export SSG_GITHUB_CLIENT_ID=<your-client-id>`}),(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mt-1`,children:[`then restart:`,` `,(0,B.jsx)(`code`,{className:`text-[var(--color-fg-1)]`,children:`ssg serve`})]})]}),(0,B.jsx)(`a`,{href:`https://github.com/settings/applications/new`,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline`,children:`create github oauth app →`})]})}),n===`idle`&&(0,B.jsx)(V,{children:(0,B.jsxs)(U,{children:[(0,B.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] mb-4 leading-relaxed`,children:`This uses GitHub's device authorization flow — no redirect URIs needed. You'll be shown a code to enter at github.com.`}),(0,B.jsx)(W,{onClick:u,disabled:c,variant:`primary`,children:c?`starting…`:`connect with github`})]})}),e&&n===`polling`&&(0,B.jsx)(V,{children:(0,B.jsxs)(U,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`overline mb-2`,children:`open this url in your browser`}),(0,B.jsx)(`a`,{href:e.verification_uri,target:`_blank`,rel:`noreferrer`,className:`text-sm text-[var(--color-brand)] hover:underline font-mono`,children:e.verification_uri})]}),(0,B.jsxs)(`div`,{className:`border border-[var(--color-line-1)] bg-[var(--color-surface-0)] rounded-sm py-5 text-center`,children:[(0,B.jsx)(`div`,{className:`overline mb-3`,children:`enter this code`}),(0,B.jsx)(`div`,{className:`text-4xl font-mono font-bold tracking-[0.3em] text-[var(--color-fg-0)]`,children:e.user_code})]}),(0,B.jsxs)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] text-center flex items-center justify-center gap-2`,children:[(0,B.jsx)(`svg`,{className:`animate-spin`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,B.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),`waiting for github authorization…`]})]})}),n===`done`&&(0,B.jsxs)(`div`,{className:`rounded-sm border border-emerald-500/25 bg-emerald-500/5 p-4 text-sm text-emerald-200 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,B.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),(0,B.jsx)(`span`,{className:`font-mono text-xs`,children:i})]}),(0,B.jsx)(`a`,{href:`/hub/publish`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline block mt-1`,children:`publish a ruleset →`})]}),n===`error`&&i&&(0,B.jsxs)(`div`,{className:`rounded-sm border border-red-500/25 bg-red-500/5 p-4`,children:[(0,B.jsx)(`p`,{className:`text-sm text-red-200 font-mono`,children:i}),(0,B.jsx)(`button`,{onClick:()=>{r(`idle`),a(``)},className:`text-[11px] font-mono text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] mt-3 cursor-pointer uppercase tracking-wider`,children:`← try again`})]})]})}function bc(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null);async function o(t){if(t.preventDefault(),e.trim()){r(!0),a(null);try{a(await(await fetch(`/api/hub/publish`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({repo_url:e.trim()})})).json())}catch(e){a({ok:!1,error:e instanceof Error?e.message:`Unknown error`})}finally{r(!1)}}}return(0,B.jsxs)(`div`,{className:`max-w-md mx-auto space-y-5`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`a`,{href:`/hub`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`← hub`}),(0,B.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-2 text-[var(--color-fg-0)]`,children:`Publish Ruleset`}),(0,B.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-3)] mt-1 font-mono`,children:`publish a github repository containing .rules files to the hub`})]}),(0,B.jsx)(V,{children:(0,B.jsx)(U,{children:(0,B.jsxs)(`form`,{onSubmit:o,className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block overline mb-1.5`,children:`github repository url`}),(0,B.jsx)(`input`,{type:`url`,placeholder:`https://github.com/owner/repo`,value:e,onChange:e=>t(e.target.value),required:!0,className:`w-full bg-[var(--color-surface-0)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-sm rounded-sm px-3 py-2 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono`})]}),(0,B.jsx)(W,{type:`submit`,variant:`primary`,disabled:n,children:n?`publishing…`:`publish to hub`})]})})}),i&&(0,B.jsx)(`div`,{className:`rounded-sm border px-3 py-2 text-xs font-mono ${i.ok?`border-emerald-500/25 bg-emerald-500/5 text-emerald-300`:`border-red-500/25 bg-red-500/5 text-red-300`}`,children:i.ok?(0,B.jsxs)(B.Fragment,{children:[`✓ published!`,` `,i.id&&(0,B.jsx)(`a`,{href:`/hub/${i.id}`,className:`text-[var(--color-brand)] hover:underline uppercase tracking-wider text-[11px] ml-2`,children:`view ruleset →`})]}):i.error??`publish failed`})]})}function xc(e){return e===0?`—`:e<1e3?`${e}ns`:e<1e6?`${(e/1e3).toFixed(1)}µs`:`${(e/1e6).toFixed(1)}ms`}function Sc(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function Cc(e){let t=e<1e10?e*1e3:e,n=new Date(t);return`${String(n.getHours()).padStart(2,`0`)}:${String(n.getMinutes()).padStart(2,`0`)}:${String(n.getSeconds()).padStart(2,`0`)}`}function wc(e){let t=Math.round((Date.now()-e)/1e3);if(t<5)return`just now`;if(t<60)return`${t}s ago`;let n=Math.floor(t/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}var Tc={allow:`text-emerald-300`,block:`text-red-300`,force:`text-violet-300`,log:`text-amber-300`,ask:`text-sky-300`,shadow:`text-[var(--color-fg-3)]`},Ec={allow:`✓`,block:`✗`,force:`→`,log:`·`,ask:`?`,shadow:`~`};function Dc({label:e,ns:t,maxNs:n}){let r=n>0?Math.min(100,t/n*100):0;return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] w-8 text-right font-mono uppercase tracking-wider text-[10px]`,children:e}),(0,B.jsx)(is,{pct:r,tone:t<1e5?`green`:t<1e6?`amber`:`red`,className:`h-1 flex-1`}),(0,B.jsx)(`span`,{className:`font-mono text-[var(--color-fg-1)] tabular-nums w-14 text-right`,children:xc(t)})]})}function Oc({value:e,max:t,threshold:n,breached:r}){let i=t>0?Math.min(100,e/t*100):0,a=t>0?Math.min(100,n/t*100):0;return(0,B.jsx)(is,{pct:i,tone:r?`red`:e/t>=.6?`amber`:`green`,markerPct:a,markerTitle:`limit: ${n}`,className:`h-1`})}function kc({limitsData:e,onSaved:t}){let[n,r]=(0,_.useState)(String(e.config.cpuLimitPct)),[i,a]=(0,_.useState)(String(e.config.memoryLimitMb)),[o,s]=(0,_.useState)(e.config.breachAction),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null);async function f(){l(!0),d(null);try{let e=await fetch(`/api/json/limits`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({cpu_limit_pct:parseFloat(n),memory_limit_mb:parseFloat(i),breach_action:o})});e.ok?t():d((await e.json()).error??`save failed`)}catch{d(`network error`)}finally{l(!1)}}let p=`w-full bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm px-2 py-1.5 text-[var(--color-fg-1)] font-mono text-xs focus:outline-none focus:border-[var(--color-brand)]/50`;return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`overline block mb-1.5`,children:`cpu limit (%)`}),(0,B.jsx)(`input`,{type:`number`,min:1,max:100,value:n,onChange:e=>r(e.target.value),className:p})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`overline block mb-1.5`,children:`memory limit (mb)`}),(0,B.jsx)(`input`,{type:`number`,min:1,value:i,onChange:e=>a(e.target.value),className:p})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`overline block mb-1.5`,children:`on breach`}),(0,B.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),className:p,children:[(0,B.jsx)(`option`,{value:`warn`,children:`warn in ui only`}),(0,B.jsx)(`option`,{value:`log`,children:`warn + write to audit log`})]})]}),u&&(0,B.jsx)(`p`,{className:`text-xs text-red-300 font-mono`,children:u}),(0,B.jsx)(W,{onClick:f,disabled:c,variant:`primary`,size:`sm`,children:c?`saving…`:`save limits`})]})}var Ac={running:`green`,hibernating:`amber`,exhausted:`red`,stopped:`gray`,idle:`gray`};function jc(e,t){let n=e-t;if(n<=0)return`any moment`;let r=Math.round(n/1e3);if(r<60)return`in ${r}s`;let i=Math.floor(r/60);return i<60?`in ${i}m ${r%60}s`:`in ${Math.floor(i/60)}h ${i%60}m`}function Mc({supervisors:e}){let[t,n]=(0,_.useState)(Date.now());return(0,_.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2 overline`,children:[`supervisor health`,e.some(e=>e.state===`hibernating`||e.state===`exhausted`)&&(0,B.jsx)(mr,{variant:`amber`,children:`degraded`})]}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono tabular-nums text-[var(--color-fg-4)]`,children:[e.length,` supervisor`,e.length===1?``:`s`]})]}),(0,B.jsx)(U,{children:e.length===0?(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no supervisors registered yet`}):(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(`table`,{className:`w-full text-xs font-mono`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider text-[var(--color-fg-4)]`,children:[(0,B.jsx)(`th`,{className:`text-left font-normal pb-1.5`,children:`name`}),(0,B.jsx)(`th`,{className:`text-left font-normal pb-1.5`,children:`kind`}),(0,B.jsx)(`th`,{className:`text-left font-normal pb-1.5`,children:`state`}),(0,B.jsx)(`th`,{className:`text-right font-normal pb-1.5`,children:`restarts`}),(0,B.jsx)(`th`,{className:`text-left font-normal pb-1.5 pl-4`,children:`last restart`}),(0,B.jsx)(`th`,{className:`text-left font-normal pb-1.5 pl-4`,children:`next retry`})]})}),(0,B.jsx)(`tbody`,{children:e.map(e=>(0,B.jsxs)(`tr`,{className:`border-t border-[var(--color-line-0)]`,children:[(0,B.jsx)(`td`,{className:`py-1.5 text-[var(--color-fg-1)]`,children:e.name}),(0,B.jsx)(`td`,{className:`py-1.5 text-[var(--color-fg-3)]`,children:e.kind===`single`?`single`:`tree`}),(0,B.jsx)(`td`,{className:`py-1.5`,children:(0,B.jsx)(mr,{variant:Ac[e.state],children:e.state})}),(0,B.jsx)(`td`,{className:`py-1.5 text-right tabular-nums text-[var(--color-fg-1)]`,children:e.restarts}),(0,B.jsx)(`td`,{className:`py-1.5 pl-4 tabular-nums text-[var(--color-fg-3)]`,children:e.lastRestartAt>0?wc(e.lastRestartAt):`—`}),(0,B.jsx)(`td`,{className:`py-1.5 pl-4 tabular-nums text-[var(--color-fg-3)]`,children:e.nextRetryAt>0?(0,B.jsx)(`span`,{title:e.hibernateReason?`reason: ${e.hibernateReason}`:void 0,children:jc(e.nextRetryAt,t)}):`—`})]},e.name))})]})})})]})}function Nc(){let e=je([`runtime-tick`,`activity-updated`,`limits-breach`,`supervisor-changed`]),t=Oe(),[n,r]=(0,_.useState)(Date.now()),[i,a]=(0,_.useState)(0),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(0),[u,d]=(0,_.useState)(!1),f=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(e)},[]);let{data:p}=F(`/api/state/runtime`,[e[`runtime-tick`]]),{data:m,refetch:h}=F(`/api/json/limits`,[e[`limits-breach`]]),{data:g}=F(`/api/state/activity-tail?after=${i}&limit=50`,[e[`activity-updated`],e[`runtime-tick`]]),{data:v}=F(`/api/json/supervisors`,[e[`supervisor-changed`],e[`runtime-tick`]]);(0,_.useEffect)(()=>{g&&g.rows.length>0&&(a(e=>Math.max(e,g.maxId)),s(e=>{let t=new Set(e.map(e=>e.id));return[...g.rows.filter(e=>!t.has(e.id)),...e].slice(0,100)}))},[g]),(0,_.useEffect)(()=>{let e=p!==null;f.current===!1&&e&&l(e=>e+1),f.current=e},[p]);let y=p?Sc(p.uptime_ms):null,b=p&&p.last_eval_at>0?wc(p.last_eval_at):null,x=m?.breaches.cpu??!1,S=m?.breaches.memory??!1,C=p?x?`text-red-300`:(p.cpu_pct??0)>=60?`text-amber-300`:`text-emerald-300`:`text-[var(--color-fg-1)]`,w=S?`text-red-300`:`text-[var(--color-fg-1)]`;return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-xl font-medium tracking-tight text-[var(--color-fg-0)]`,children:`Daemon Monitor`}),(0,B.jsx)(`p`,{className:`text-[12px] font-mono text-[var(--color-fg-3)] mt-0.5`,children:`live metrics · audit tail · resource limits`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[c>0&&(0,B.jsxs)(mr,{variant:`amber`,children:[c,` restart`,c===1?``:`s`]}),(0,B.jsx)(`span`,{className:`text-[11px] font-mono tabular-nums text-[var(--color-fg-3)]`,children:Cc(n)})]})]}),(0,B.jsx)(Pc,{cpuPct:p?.cpu_pct??0,cpuLimit:m?.config.cpuLimitPct,memMb:p?.memory_rss_mb??0,memLimit:m?.config.memoryLimitMb,decisions:p?.decisions,latency:p?.latency,burstBuffer:t,evalsTotal:p?.evals_total??0}),m&&(x||S)&&(0,B.jsxs)(`div`,{className:`rounded-sm border border-red-500/25 bg-red-500/[0.06] border-l-2 border-l-red-500/70 px-3 py-2.5 flex items-start gap-2.5`,children:[(0,B.jsx)(`span`,{className:`text-red-300 shrink-0 mt-0.5`,children:(0,B.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,B.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z`}),(0,B.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,B.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]})}),(0,B.jsxs)(`div`,{className:`space-y-0.5 text-xs font-mono`,children:[x&&(0,B.jsxs)(`div`,{className:`text-red-200`,children:[`cpu limit exceeded: `,p?.cpu_pct??`?`,`% >`,` `,m.config.cpuLimitPct,`%`]}),S&&(0,B.jsxs)(`div`,{className:`text-red-200`,children:[`memory limit exceeded: `,p?.memory_rss_mb??`?`,`mb >`,` `,m.config.memoryLimitMb,`mb`]})]})]}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`daemon status`})}),(0,B.jsx)(U,{children:p===null?(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-500 shrink-0`}),(0,B.jsx)(`span`,{className:`text-red-300 font-mono uppercase tracking-wider text-xs`,children:`down`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] text-xs font-mono`,children:`— socket not reachable`})]}):(0,B.jsxs)(`div`,{className:`flex items-center gap-5 flex-wrap text-xs font-mono`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-emerald-400 pulse-soft shrink-0`}),(0,B.jsx)(`span`,{className:`text-emerald-300 uppercase tracking-wider`,children:`up`})]}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`pid`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:p.pid})]}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`uptime`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:y})]}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`mem`,` `,(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:[p.memory_rss_mb,`MB`]})]}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`cpu`,` `,(0,B.jsxs)(`span`,{className:`${C} tabular-nums`,children:[p.cpu_pct,`%`]})]}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`last eval`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:b??`—`})]})]})})]}),(0,B.jsx)(Mc,{supervisors:v?.supervisors??[]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2 overline`,children:[`system resources`,m&&(x||S)&&(0,B.jsx)(mr,{variant:`red`,children:`limit exceeded`})]}),(0,B.jsx)(`button`,{onClick:()=>d(e=>!e),className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)] transition-colors cursor-pointer`,children:u?`hide limits`:`configure limits`})]}),(0,B.jsxs)(U,{children:[p===null?(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no data — daemon not running`}):(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`cpu`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(p.history.cpu_pct.length??0)>1&&(0,B.jsx)(br,{data:p.history.cpu_pct,width:80,height:20,color:x?`#f87171`:`#34d399`,threshold:m?.config.cpuLimitPct,maxValue:100}),(0,B.jsxs)(`span`,{className:`font-mono font-medium w-12 text-right tabular-nums ${C}`,children:[p.cpu_pct,`%`]})]})]}),(0,B.jsx)(Oc,{value:p.cpu_pct,max:100,threshold:m?.config.cpuLimitPct??90,breached:x}),m&&(0,B.jsxs)(`div`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`limit: `,m.config.cpuLimitPct,`%`]})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`memory rss`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(p.history.memory_rss_mb.length??0)>1&&(0,B.jsx)(br,{data:p.history.memory_rss_mb,width:80,height:20,color:S?`#f87171`:`#38bdf8`,threshold:m?.config.memoryLimitMb}),(0,B.jsxs)(`span`,{className:`font-mono font-medium w-16 text-right tabular-nums ${w}`,children:[p.memory_rss_mb,`MB`]})]})]}),(0,B.jsx)(Oc,{value:p.memory_rss_mb,max:Math.max(p.memory_rss_mb*1.5,m?.config.memoryLimitMb??512),threshold:m?.config.memoryLimitMb??512,breached:S}),m&&(0,B.jsxs)(`div`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`limit: `,m.config.memoryLimitMb,`MB`]})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`heap`}),(0,B.jsxs)(`span`,{className:`font-mono text-[var(--color-fg-1)] tabular-nums`,children:[p.heap_used_mb,`MB / `,p.heap_total_mb,`MB`]})]}),(0,B.jsx)(is,{pct:p.heap_total_mb>0?Math.min(100,p.heap_used_mb/p.heap_total_mb*100):0,tone:`blue`,className:`h-1`})]})]}),u&&m&&(0,B.jsxs)(`div`,{className:`mt-5 pt-4 border-t border-[var(--color-line-0)]`,children:[(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mb-3 leading-relaxed`,children:[`thresholds trigger ui warnings. values are persisted to`,` `,(0,B.jsx)(`code`,{className:`text-[var(--color-fg-1)]`,children:`.sigmashake/config.toml`}),`.`]}),(0,B.jsx)(kc,{limitsData:m,onSaved:()=>{h(),d(!1)}})]})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-2`,children:[(0,B.jsx)(rs,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`total evals`,value:p?.evals_total??`—`,valueClassName:`text-xl font-medium tabular-nums text-[var(--color-fg-0)]`}),(0,B.jsx)(rs,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`allow`,value:p?.decisions.allow??`—`,valueClassName:`text-xl font-medium tabular-nums text-emerald-300`}),(0,B.jsx)(rs,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`block`,value:p?.decisions.block??`—`,valueClassName:`text-xl font-medium tabular-nums text-red-300`}),(0,B.jsx)(rs,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`force`,value:p?.decisions.force??`—`,valueClassName:`text-xl font-medium tabular-nums text-violet-300`}),(0,B.jsx)(rs,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`log`,value:p?.decisions.log??`—`,valueClassName:`text-xl font-medium tabular-nums text-amber-300`}),(0,B.jsx)(rs,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`ask`,value:p?.decisions.ask??`—`,valueClassName:`text-xl font-medium tabular-nums text-sky-300`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`eval latency`}),p&&(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[p.latency.samples,` samples`]})]}),(0,B.jsx)(U,{children:p===null?(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no data`}):(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(Dc,{label:`p50`,ns:p.latency.p50_ns,maxNs:p.latency.max_ns}),(0,B.jsx)(Dc,{label:`p95`,ns:p.latency.p95_ns,maxNs:p.latency.max_ns}),(0,B.jsx)(Dc,{label:`p99`,ns:p.latency.p99_ns,maxNs:p.latency.max_ns}),(0,B.jsx)(Dc,{label:`max`,ns:p.latency.max_ns,maxNs:p.latency.max_ns})]})})]}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`engine`})}),(0,B.jsx)(U,{children:p===null?(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no data`}):(0,B.jsx)(`div`,{className:`space-y-1.5 text-xs font-mono`,children:[[`native evals`,p.engine.native_evals],[`ts evals`,p.engine.ts_evals],[`native %`,`${p.engine.native_pct}%`],[`rule reloads`,p.rule_reloads],[`rate limit trips`,p.rate_limit_trips],[`loop guard blocks`,p.loop_guard_blocks],[`connection errors`,p.connection_errors]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`flex justify-between py-0.5 border-b border-[var(--color-line-0)] last:border-0`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:e}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:t})]},e))})})]})]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`live event tail`}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`newest first · auto-updating`})]}),(0,B.jsx)(U,{children:o.length===0?(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-4 py-6 text-center`,children:(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no events yet`})}):(0,B.jsx)(`div`,{className:`font-mono text-[11px] max-h-96 overflow-y-auto divide-y divide-[var(--color-line-0)]`,children:o.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2 py-1`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] shrink-0 w-16 tabular-nums`,children:Cc(e.timestamp)}),e.tool===`__daemon`?(0,B.jsxs)(`span`,{className:`text-sky-400`,children:[`daemon`,` `,(()=>{try{let t=JSON.parse(e.input??`{}`);return`${t.event??e.decision}${t.detail?` (${t.detail})`:``}`}catch{return e.decision}})()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`shrink-0 w-16 uppercase tracking-wider text-[10px] ${Tc[e.decision]??`text-[var(--color-fg-3)]`}`,children:[Ec[e.decision]??`·`,` `,e.decision]}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)] shrink-0 w-24 truncate`,children:e.tool}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] shrink-0 w-14 text-right tabular-nums`,children:xc(e.duration_ns)}),e.rule_id&&(0,B.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.rule_id)}`,className:`text-[var(--color-brand)]/80 hover:text-[var(--color-brand)] truncate transition-colors`,title:e.rule_id,children:e.rule_id})]})]},e.id))})})]}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`ai agent debug endpoints`})}),(0,B.jsxs)(U,{children:[(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mb-2.5`,children:`agents can query these endpoints directly for automated triage:`}),(0,B.jsx)(`div`,{className:`space-y-1 font-mono text-[11px]`,children:[[`/api/state/runtime`,`full metrics snapshot (cpu, memory, history, latency)`],[`/api/json/limits`,`resource limits config + breach state`],[`/api/state/activity-tail?after=0&limit=20`,`recent eval events`],[`/api/json/daemon-status`,`status, pid, log tail`],[`/healthz`,`process uptime`]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`GET`}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-[var(--color-brand)]/80 hover:text-[var(--color-brand)] transition-colors`,children:e}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`— `,t]})]},e))})]})]})]})}function Pc({cpuPct:e,cpuLimit:t,memMb:n,memLimit:r,decisions:i,latency:a,evalsTotal:o,burstBuffer:s}){let c=(0,_.useMemo)(()=>{if(s.length===0)return 0;let e=Date.now()-1e4;return s.filter(t=>t.ts_ms>=e).length/10},[s]);return(a?.p95_ns??0)/1e6,(a?.p50_ns??0)/1e6,(a?.p99_ns??0)/1e6,(0,B.jsxs)(`div`,{className:`grid-bleed rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-4`,children:[(0,B.jsxs)(`div`,{className:`lg:col-span-3 flex flex-col items-center gap-2`,children:[(0,B.jsx)(Jr,{mode:`ring`,value:e,max:100,warnAt:(t??90)/100*.7,critAt:(t??90)/100,display:`${e.toFixed(1)}%`,label:`cpu`,size:220}),(0,B.jsx)(Sr,{value:e,width:260,height:56,windowMs:6e4,color:`#34d399`,fillColor:`rgba(52, 211, 153, 0.14)`,maxValue:100,className:`w-full`})]}),(0,B.jsxs)(`div`,{className:`lg:col-span-3 flex flex-col items-center gap-2`,children:[(0,B.jsx)(Jr,{mode:`ring`,value:n,max:r??1024,warnAt:.7,critAt:.9,display:`${n.toFixed(0)} MB`,label:`memory`,size:220}),(0,B.jsx)(Sr,{value:n,width:260,height:56,windowMs:6e4,color:`#38bdf8`,fillColor:`rgba(56, 189, 248, 0.14)`,maxValue:r?r*1.1:void 0,className:`w-full`})]}),(0,B.jsx)(`div`,{className:`lg:col-span-6`,children:(0,B.jsx)(ei,{latency:a,bursts:s,gaugeMaxMs:10,windowMs:3e4,trendWindowSec:60,gaugeSize:200})})]}),(0,B.jsxs)(`div`,{className:`mt-4 grid grid-cols-1 lg:grid-cols-2 gap-3`,children:[(0,B.jsx)(Ar,{label:`Total Evals`,value:o,tone:`amber`,sub:`${c.toFixed(1)}/s`,burstRing:s}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] px-4 py-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`throughput · 60 s`}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[c.toFixed(1),`/s`]})]}),(0,B.jsx)(Sr,{value:c,width:420,height:56,windowMs:6e4,className:`w-full`})]})]}),i?(0,B.jsx)(`div`,{className:`mt-4 pt-3 border-t border-[var(--color-line-0)]`,children:(0,B.jsx)(ri,{counters:{allow:i.allow,block:i.block,ask:i.ask,log:i.log,force:i.force,shadow:i.shadow}})}):null,(0,B.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`live event stream · newest first`}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:[s.length,` buffered · hover to pause`]})]}),(0,B.jsx)(hi,{variant:`decision`,bursts:s,windowSize:300,height:260})]})]})}var Fc={ok:`green`,warn:`amber`,error:`red`,unknown:`gray`},Ic={ok:`OK`,warn:`Warn`,error:`Error`,unknown:`Idle`};function Lc({title:e,status:t=`unknown`,statusLabel:n,className:r,children:i}){return(0,B.jsxs)(V,{className:z(`flex flex-col`,r),children:[(0,B.jsxs)(H,{children:[(0,B.jsx)(`span`,{className:`overline text-[var(--color-fg-2)]`,children:e}),(0,B.jsx)(mr,{variant:Fc[t],children:n??Ic[t]})]}),(0,B.jsx)(U,{className:`flex flex-col gap-2 text-[12px]`,children:i})]})}function Rc({label:e,value:t,mono:n=!1,tone:r}){return(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 border-b border-[var(--color-line-0)] last:border-b-0 py-1`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] uppercase tracking-wider text-[10px] font-mono`,children:e}),(0,B.jsx)(`span`,{className:z(n?`font-mono`:`font-sans`,`tabular-nums text-right truncate`,r===`good`?`text-emerald-300`:r===`warn`?`text-amber-300`:r===`bad`?`text-red-300`:`text-[var(--color-fg-1)]`),children:t})]})}function zc(e){return e===0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(2)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Bc(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}function Vc(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function Hc(e){return e?new Date(e*1e3).toLocaleString():`—`}function Uc(e){if(!e||e===0)return`never`;let t=Math.round((Date.now()-e)/1e3);if(t<5)return`just now`;if(t<60)return`${t}s ago`;let n=Math.floor(t/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}function Wc({children:e,className:t}){return(0,B.jsx)(`div`,{className:`overline mb-2.5 ${t??``}`,children:e})}function Gc({label:e,value:t,mono:n=!0,accent:r}){return(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 py-1.5 border-b border-[var(--color-line-0)] last:border-0`,children:[(0,B.jsx)(`span`,{className:`text-xs text-[var(--color-fg-3)] shrink-0 font-mono`,children:e}),(0,B.jsx)(`span`,{className:`text-xs text-right truncate max-w-[65%] ${n?`font-mono tabular-nums`:``} ${r??`text-[var(--color-fg-1)]`}`,children:t})]})}function Kc({ok:e,label:t,badLabel:n}){return e?(0,B.jsx)(mr,{variant:`green`,children:t}):(0,B.jsx)(mr,{variant:`red`,children:n??t})}function qc({pct:e,total:t,max:n}){let r=e<60?`green`:e<85?`amber`:`red`,i=e>=85?`text-red-300`:e>=60?`text-amber-300`:`text-emerald-300`;return(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-xs font-mono tabular-nums`,children:[(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[t.toLocaleString(),` / `,n.toLocaleString(),` rows`]}),(0,B.jsxs)(`span`,{className:i,children:[e,`%`]})]}),(0,B.jsx)(is,{pct:e,tone:r,className:`h-1.5`})]})}var Jc=3e3,Yc={log:`text-[var(--color-fg-1)]`,info:`text-sky-300`,warn:`text-amber-300`,error:`text-red-300`,debug:`text-[var(--color-fg-3)]`};function Xc(e){return e.value==null?e.description?e.description:`[${e.type}]`:String(e.value)}function Zc(){let e=Gs(),[t,n]=(0,_.useState)(!1),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!1),p=(0,_.useRef)(null),m=(0,_.useRef)(0),h=(0,_.useRef)(!0);(0,_.useEffect)(()=>{if(h.current){h.current=!1;return}let e=p.current;if(!e)return;let t=e.parentElement;t&&(t.scrollTop=t.scrollHeight)},[a]),(0,_.useEffect)(()=>{if(e.connected)return e.sendCommand(`Runtime.enable`).catch(()=>{}),e.onEvent(`Runtime.consoleAPICalled`,e=>{let t=e;o(e=>{let n=[...e,{id:m.current++,type:t.type??`log`,args:t.args??[],timestamp:t.timestamp??Date.now()}];return n.length>500?n.slice(-500):n})})},[e.connected]),(0,_.useEffect)(()=>{e.preconfiguredTarget&&!e.connected&&!e.connecting&&e.connect(e.preconfiguredTarget.id)},[e]),(0,_.useEffect)(()=>{!e.connected||d||t||r||(f(!0),(async()=>{try{await e.sendCommand(`Profiler.enable`),await e.sendCommand(`Profiler.start`),n(!0),setTimeout(async()=>{try{let t=await e.sendCommand(`Profiler.stop`);n(!1),i(t.profile)}catch{n(!1)}},Jc)}catch{}})(),e.sendCommand(`Runtime.evaluate`,{expression:`JSON.stringify(process.memoryUsage())`,returnByValue:!0}).then(e=>{c(JSON.parse(e.result.value))}).catch(()=>{}))},[e.connected,d,t,r]);let g=(0,_.useCallback)(async()=>{try{await e.sendCommand(`Profiler.enable`),await e.sendCommand(`Profiler.start`),n(!0),i(null)}catch(e){console.error(`Profiler.start failed:`,e)}},[e]),v=(0,_.useCallback)(async()=>{try{let t=await e.sendCommand(`Profiler.stop`);n(!1),i(t.profile)}catch(e){console.error(`Profiler.stop failed:`,e),n(!1)}},[e]),y=(0,_.useCallback)(async()=>{u(!0);try{let t=await e.sendCommand(`Runtime.evaluate`,{expression:`JSON.stringify(process.memoryUsage())`,returnByValue:!0});c(JSON.parse(t.result.value))}catch{}finally{u(!1)}},[e]),b=(0,_.useCallback)(()=>{e.preconfiguredTarget&&e.connect(e.preconfiguredTarget.id)},[e]);return e.active?e.connected?(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono text-[var(--color-fg-2)]`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-emerald-400`}),`connected`,e.bunVersion?` · bun v${e.bunVersion}`:``]}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:e.disconnect,children:`disconnect`})]})]}),e.error&&(0,B.jsx)(U,{children:(0,B.jsx)(`p`,{className:`text-xs text-red-300 font-mono`,children:e.error})})]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`cpu profiler`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&(0,B.jsxs)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300 flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-400 pulse-soft`}),`recording`]}),t?(0,B.jsx)(W,{variant:`danger`,size:`sm`,onClick:v,children:`stop & render`}):(0,B.jsx)(W,{variant:`primary`,size:`sm`,onClick:g,children:`start recording`})]})]}),(0,B.jsx)(U,{children:r?(0,B.jsx)(os,{profile:r,children:(0,B.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 overflow-x-hidden`,children:(0,B.jsx)(Qs,{profile:r})})}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:t?`recording cpu profile (auto-captures ${Jc/1e3}s)… perform actions in ssg to generate data.`:`click start recording, or wait for auto-capture on page load.`})})]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`memory`}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:y,disabled:l,children:l?`…`:`refresh`})]}),(0,B.jsx)(U,{children:s?(0,B.jsx)(ss,{memory:s,formatValue:Bc}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:d?`fetching memory metrics…`:`click refresh to fetch process.memoryUsage().`})})]}),(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`console`}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o([]),children:`clear`})]}),(0,B.jsx)(U,{children:(0,B.jsxs)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 h-40 overflow-y-auto font-mono text-[11px]`,children:[a.length===0?(0,B.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`console output will appear here…`}):a.map(e=>(0,B.jsxs)(`div`,{className:`py-0.5 border-b border-[var(--color-line-0)] ${Yc[e.type]??`text-[var(--color-fg-1)]`}`,children:[(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)] mr-2 uppercase tracking-wider`,children:[`[`,e.type,`]`]}),e.args.map(Xc).join(` `)]},e.id)),(0,B.jsx)(`div`,{ref:p})]})})]})]}):(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(mr,{variant:`amber`,children:e.connecting?`connecting…`:`available`}),!e.connecting&&(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:b,children:`connect`})]})]}),(0,B.jsx)(U,{children:(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:e.connecting?`establishing websocket connection to bun inspector…`:`inspector is active but not connected. click connect to start profiling.`})})]}):(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,B.jsx)(mr,{variant:`outline`,children:`inactive`})]}),(0,B.jsx)(U,{children:(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:[`the bun inspector is not active. restart`,` `,(0,B.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg serve`}),` to enable it automatically.`]})})]})}function Qc(){let[e,t]=(0,_.useState)(0),{data:n}=F(`/api/json/evald-log`,[e]),r=(0,_.useRef)(null),i=(0,_.useRef)(!0);(0,_.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),5e3);return()=>clearInterval(e)},[]),(0,_.useEffect)(()=>{if(i.current){i.current=!1;return}let e=r.current;if(!e)return;let t=e.parentElement;t&&(t.scrollTop=t.scrollHeight)},[n?.lines.length]);let a=n?.lines??[];return(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`daemon log`}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] truncate max-w-[60%]`,children:[n?.path?n.path:`loading…`,` · last 200 lines · 5s refresh`]})]}),(0,B.jsxs)(U,{children:[n?.error&&(0,B.jsx)(`p`,{className:`text-xs text-red-300 font-mono mb-2`,children:n.error}),a.length===0&&!n?.error&&(0,B.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-4 py-6 text-center`,children:(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:[`no log entries yet. start the daemon with`,` `,(0,B.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg serve`}),` to generate log output.`]})}),a.length>0&&(0,B.jsxs)(`pre`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-3 text-[10px] text-[var(--color-fg-2)] overflow-x-auto whitespace-pre-wrap break-all max-h-80 overflow-y-auto font-mono leading-relaxed`,children:[a.join(`
|
|
19
|
+
`),(0,B.jsx)(`div`,{ref:r})]})]})]})}function $c(){let e=je([`runtime-tick`,`rules-changed`]),{data:t,refetch:n}=F(`/api/json/observability`,[e[`runtime-tick`],e[`rules-changed`]]),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(Date.now()),[l,u]=(0,_.useState)(`idle`),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(`idle`);(0,_.useEffect)(()=>{t&&c(Date.now())},[t]);let h=(0,_.useCallback)(async()=>{u(`loading`);try{let e=await(await fetch(`/api/rules/sync-to-db`,{method:`POST`,headers:Ae()})).json();if(e.ok){u(`done`);let t=(e.pruned_count??0)>0?` (${e.pruned_count} orphan(s) pruned)`:``;f((e.message??`synced ${e.synced} rules`)+t),n()}else u(`error`),f(e.error??`sync failed`)}catch(e){u(`error`),f(String(e))}},[n]),g=(0,_.useCallback)(async()=>{m(`loading`);try{await fetch(`/api/rules/force-reload`,{method:`POST`,headers:Ae()}),m(`done`),n(),setTimeout(()=>m(`idle`),3e3)}catch{m(`idle`)}},[n]),v=t?.db,y=t?.rules,b=t?.audit,x=t?.process,S=t?.flight_recorder,C=y?.drift_detected??!1;return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-xl font-medium tracking-tight text-[var(--color-fg-0)]`,children:`Observability`}),(0,B.jsx)(`p`,{className:`text-[12px] font-mono text-[var(--color-fg-3)] mt-0.5`,children:`sqlite health · rule drift · runtime profiler · diagnostics`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:[`refreshed `,Uc(s)]}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:n,children:`refresh`})]})]}),(0,B.jsx)(el,{db:v,audit:b,proc:x,flight:S,driftDetected:C}),(0,B.jsxs)(V,{className:C?`border-red-500/30 border-l-2 border-l-red-500/70`:`border-emerald-500/20 border-l-2 border-l-emerald-500/60`,children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`rule drift detector`}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`— .rules files vs sqlite`}),(0,B.jsx)(`button`,{onClick:()=>o(e=>!e),"aria-expanded":a,"aria-label":`Explain these counts`,title:`Why do these numbers differ?`,className:`text-[10px] font-mono text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)] border border-[var(--color-line-1)] rounded-sm px-1.5 py-0.5 transition-colors cursor-pointer`,children:a?`× close`:`? why these numbers`})]}),y&&(C?(0,B.jsx)(mr,{variant:`red`,children:`⚠ drift detected`}):(0,B.jsx)(mr,{variant:`green`,children:`✓ in sync`}))]}),(0,B.jsxs)(U,{children:[a&&(0,B.jsxs)(`div`,{className:`mb-4 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-3 py-2.5 space-y-2 text-[11px] font-mono leading-relaxed text-[var(--color-fg-3)]`,children:[(0,B.jsxs)(`div`,{className:`text-[var(--color-fg-2)]`,children:[(0,B.jsx)(`code`,{children:`.rules files`}),` and `,(0,B.jsx)(`code`,{children:`db rules`}),` are`,` `,(0,B.jsx)(`span`,{className:`text-amber-300`,children:`not auto-synced`}),`. A mismatch is usually expected:`]}),(0,B.jsxs)(`ul`,{className:`space-y-1 pl-3 list-disc marker:text-[var(--color-fg-4)]`,children:[(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`one file can hold many rules`}),` `,`— compare `,(0,B.jsx)(`code`,{children:`db rules`}),` against`,` `,(0,B.jsx)(`code`,{children:`file_rule_count`}),`, not `,(0,B.jsx)(`code`,{children:`file_count`}),`.`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`only in files`}),` `,`means unsynced edits — run`,` `,(0,B.jsx)(`code`,{className:`text-amber-300`,children:`ssg sync`}),` or click`,` `,(0,B.jsx)(`code`,{children:`↑ sync files → db`}),`.`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`only in db`}),` `,`with `,(0,B.jsx)(`code`,{children:`source_file IS NULL`}),` is healthy — hub, fleet, or cloud-synced rules legitimately live only in the db.`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`only in db`}),` `,`with `,(0,B.jsx)(`code`,{children:`source_file`}),` set means an orphan from a deleted file — `,(0,B.jsx)(`code`,{className:`text-amber-300`,children:`ssg sync`}),` `,`prunes it.`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`db rules`}),` `,`includes disabled rows; `,(0,B.jsx)(`code`,{children:`db_enabled_count`}),` `,`excludes them.`]})]}),(0,B.jsxs)(`div`,{className:`pt-1.5 border-t border-[var(--color-line-0)]`,children:[`full reference:`,` `,(0,B.jsx)(`a`,{href:`https://docs.sigmashake.com/rule-storage`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--color-fg-2)] underline decoration-dotted underline-offset-2 hover:text-amber-300 transition-colors`,children:`docs.sigmashake.com/rule-storage ↗`})]})]}),y?(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:[{label:`.rules files`,value:y.file_count,sub:`${y.file_rule_count} rules total`,tone:`neutral`},{label:`db rules`,value:y.db_rule_count,sub:`${y.db_enabled_count} enabled`,tone:`neutral`},{label:`only in files`,value:y.drift_details.only_in_files.length,tone:y.drift_details.only_in_files.length>0?`amber`:`gray`},{label:`only in db`,value:y.drift_details.only_in_db.length,tone:y.drift_details.only_in_db.length>0?`red`:`gray`}].map(({label:e,value:t,sub:n,tone:r})=>(0,B.jsx)(rs,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)]`,label:e,value:t,sub:n,tone:r,labelPlacement:`above`,subClassName:`text-[var(--color-fg-4)]`,valueClassName:`text-xl font-medium tabular-nums`},e))}),C&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{onClick:()=>i(e=>!e),className:`text-[10px] font-mono uppercase tracking-wider text-amber-300 hover:text-amber-200 flex items-center gap-1 transition-colors cursor-pointer`,children:[r?`▾`:`▸`,` view drift details`]}),r&&(0,B.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[y.drift_details.only_in_files.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`text-[10px] font-mono uppercase tracking-wider text-amber-300/80 mb-1.5`,children:[`in .rules files but not in db — run`,` `,(0,B.jsx)(`code`,{className:`text-amber-300`,children:`ssg sync`})]}),(0,B.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-amber-400/20 rounded-sm p-2 space-y-0.5 max-h-40 overflow-y-auto`,children:y.drift_details.only_in_files.map(e=>(0,B.jsxs)(`div`,{className:`font-mono text-[11px] text-amber-200/80`,children:[`+ `,e]},e))})]}),y.drift_details.only_in_db.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300/80 mb-1.5`,children:`in db but not in any .rules file — orphaned rules`}),(0,B.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-red-400/20 rounded-sm p-2 space-y-0.5 max-h-40 overflow-y-auto`,children:y.drift_details.only_in_db.map(e=>(0,B.jsxs)(`div`,{className:`font-mono text-[11px] text-red-200/80`,children:[`− `,e]},e))})]})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,B.jsx)(W,{variant:`primary`,size:`sm`,onClick:h,disabled:l===`loading`,children:l===`loading`?`syncing…`:`↑ sync files → db`}),(0,B.jsx)(W,{variant:`ghost`,size:`sm`,onClick:g,disabled:p===`loading`,children:p===`loading`?`…`:p===`done`?`✓ reloaded`:`↻ force reload`}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] ml-auto`,children:y.db_rule_count===0?`⚠ db empty — daemon falls back to file-based loading`:`db has ${y.db_rule_count} rules — indexed queries`})]}),l===`done`&&(0,B.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm border border-emerald-500/25 bg-emerald-500/[0.06] px-3 py-2 text-xs font-mono text-emerald-200`,children:[(0,B.jsxs)(`span`,{children:[`✓ `,d]}),(0,B.jsx)(`button`,{onClick:()=>u(`idle`),className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-emerald-500/30 hover:bg-emerald-500/10 transition-colors cursor-pointer uppercase tracking-wider text-[10px]`,children:`dismiss`})]}),l===`error`&&(0,B.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm border border-red-500/25 bg-red-500/[0.06] px-3 py-2 text-xs font-mono text-red-200`,children:[(0,B.jsxs)(`span`,{children:[`✗ `,d]}),(0,B.jsx)(`button`,{onClick:()=>u(`idle`),className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-red-500/30 hover:bg-red-500/10 transition-colors cursor-pointer uppercase tracking-wider text-[10px]`,children:`dismiss`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] font-mono text-[var(--color-fg-4)] pt-2 border-t border-[var(--color-line-0)]`,children:[(0,B.jsxs)(`span`,{children:[`rules dir:`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:y.rules_dir})]}),(0,B.jsxs)(`span`,{className:`ml-auto`,children:[`last reload:`,` `,(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:Uc(y.last_reload_at)})]})]})]}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-5`,children:[(0,B.jsxs)(V,{children:[(0,B.jsxs)(H,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`sqlite database`}),v&&!v.error&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(Kc,{ok:v.journal_mode===`wal`,label:`wal`,badLabel:`no wal`}),(0,B.jsx)(Kc,{ok:v.synchronous===`NORMAL`,label:`normal`,badLabel:v.synchronous})]})]}),(0,B.jsx)(U,{children:v?v.error?(0,B.jsx)(`div`,{className:`text-xs text-red-300 font-mono bg-red-500/[0.06] border border-red-500/25 rounded-sm p-2`,children:v.error}):(0,B.jsxs)(`div`,{children:[(0,B.jsx)(Wc,{children:`storage`}),(0,B.jsx)(Gc,{label:`file path`,value:v.path}),(0,B.jsx)(Gc,{label:`file size`,value:zc(v.file_size_bytes)}),(0,B.jsx)(Gc,{label:`allocated`,value:`${zc(v.allocated_bytes)} (${v.page_count.toLocaleString()} pages × ${v.page_size}B)`}),(0,B.jsx)(Wc,{className:`mt-4`,children:`pragma configuration`}),(0,B.jsx)(Gc,{label:`journal_mode`,value:v.journal_mode,accent:v.journal_mode===`wal`?`text-emerald-300`:`text-amber-300`}),(0,B.jsx)(Gc,{label:`synchronous`,value:v.synchronous,accent:v.synchronous===`NORMAL`?`text-emerald-300`:`text-amber-300`}),(0,B.jsx)(Gc,{label:`cache_size`,value:`${v.cache_size_kb.toLocaleString()} KB (${Math.round(v.cache_size_kb/1024)} MB)`}),(0,B.jsx)(Gc,{label:`page_size`,value:`${v.page_size.toLocaleString()} B`}),v.wal_checkpoint&&(0,B.jsx)(Gc,{label:`wal checkpoint`,value:`log ${v.wal_checkpoint.log}, checkpointed ${v.wal_checkpoint.checkpointed}, busy ${v.wal_checkpoint.busy}`}),(0,B.jsx)(Wc,{className:`mt-4`,children:`table row counts`}),v.tables.map(e=>(0,B.jsx)(Gc,{label:e.name,value:e.row_count>=0?e.row_count.toLocaleString():`error`,accent:e.row_count<0?`text-red-300`:`text-[var(--color-fg-1)]`},e.name))]}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]}),(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`audit log capacity`})}),(0,B.jsx)(U,{children:b?(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(qc,{pct:b.utilization_pct,total:b.total_rows,max:b.max_rows}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(Gc,{label:`total rows`,value:b.total_rows.toLocaleString()}),(0,B.jsx)(Gc,{label:`rotation limit`,value:b.max_rows.toLocaleString()}),(0,B.jsx)(Gc,{label:`utilization`,value:`${b.utilization_pct}%`,accent:b.utilization_pct>=85?`text-red-300`:b.utilization_pct>=60?`text-amber-300`:`text-emerald-300`}),(0,B.jsx)(Gc,{label:`oldest entry`,value:Hc(b.oldest_timestamp)}),(0,B.jsx)(Gc,{label:`newest entry`,value:Hc(b.newest_timestamp)})]}),b.utilization_pct>=85&&(0,B.jsx)(`div`,{className:`rounded-sm border border-red-500/25 bg-red-500/[0.06] px-3 py-2 text-[11px] font-mono text-red-200`,children:`⚠ audit log nearing rotation limit. oldest entries will be purged automatically.`})]}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`process & runtime`})}),(0,B.jsx)(U,{children:x?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(Gc,{label:`pid`,value:x.pid}),(0,B.jsx)(Gc,{label:`uptime`,value:Vc(x.uptime_ms)}),(0,B.jsx)(Gc,{label:`memory (rss)`,value:`${x.memory_rss_mb} MB`}),(0,B.jsx)(Gc,{label:`bun version`,value:x.bun_version}),(0,B.jsx)(Gc,{label:`node compat`,value:x.node_version}),(0,B.jsx)(Gc,{label:`platform`,value:`${x.platform} / ${x.arch}`})]}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]})]})]}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`flight recorder`})}),(0,B.jsx)(U,{children:S?(0,B.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline mb-1.5`,children:`log file`}),(0,B.jsx)(`div`,{className:`text-xs font-mono text-[var(--color-fg-1)] truncate`,children:`…${S.path.slice(-50)}`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline mb-1.5`,children:`file size`}),(0,B.jsx)(`div`,{className:`text-xs font-mono tabular-nums ${S.file_size_bytes===0?`text-[var(--color-fg-4)]`:`text-[var(--color-fg-1)]`}`,children:zc(S.file_size_bytes)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline mb-1.5`,children:`approx. entries`}),(0,B.jsx)(`div`,{className:`text-xs font-mono tabular-nums ${S.approx_entries===0?`text-[var(--color-fg-4)]`:`text-[var(--color-fg-1)]`}`,children:S.approx_entries===0?`—`:S.approx_entries.toLocaleString()})]})]}):(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]}),(0,B.jsx)(Zc,{}),(0,B.jsx)(Qc,{}),(0,B.jsxs)(V,{children:[(0,B.jsx)(H,{children:(0,B.jsx)(`span`,{className:`overline`,children:`observability api`})}),(0,B.jsxs)(U,{children:[(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mb-2.5`,children:`machine-readable endpoints for automated monitoring and ai agent triage:`}),(0,B.jsx)(`div`,{className:`space-y-1 font-mono text-[11px]`,children:[[`/api/json/observability`,`sqlite health, rule drift, process info`],[`/api/state/runtime`,`eval latency, decision counters, memory`],[`/api/state/activity-tail?after=0&limit=20`,`recent eval events (live feed)`],[`/api/json/daemon-status`,`daemon pid, status, log tail`],[`/api/json/evald-log`,`last 200 lines of evald.log (daemon stderr)`],[`/healthz`,`process liveness`],[`/readyz`,`sqlite liveness`]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`GET`}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-[var(--color-brand)]/80 hover:text-[var(--color-brand)] transition-colors`,children:e}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)] hidden sm:inline`,children:[`— `,t]})]},e))})]})]})]})}function el({db:e,audit:t,proc:n,flight:r,driftDetected:i}){let a=e?e.error?`error`:e.journal_mode===`wal`&&e.synchronous===`NORMAL`?`ok`:`warn`:`unknown`,o=t?t.utilization_pct>=85?`error`:t.utilization_pct>=60?`warn`:`ok`:`unknown`,s=n?n.memory_rss_mb>600?`warn`:`ok`:`unknown`;return(0,B.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,B.jsxs)(Lc,{title:`sqlite`,status:a,statusLabel:e?.journal_mode?.toUpperCase()??`idle`,children:[(0,B.jsx)(Rc,{label:`size`,value:e?(0,B.jsx)(yr,{value:e.file_size_bytes,format:e=>Bc(e)}):`—`,mono:!0}),(0,B.jsx)(Rc,{label:`journal`,value:e?.journal_mode??`—`,mono:!0}),(0,B.jsx)(Rc,{label:`sync`,value:e?.synchronous??`—`,mono:!0}),(0,B.jsx)(Rc,{label:`tables`,value:e?.tables.length??0,tone:i?`warn`:`neutral`})]}),(0,B.jsxs)(Lc,{title:`audit log`,status:o,statusLabel:t?`${t.utilization_pct}%`:`idle`,children:[(0,B.jsx)(Rc,{label:`rows`,value:t?(0,B.jsx)(yr,{value:t.total_rows}):`—`}),(0,B.jsx)(Rc,{label:`capacity`,value:t?`${(t.total_rows/Math.max(1,t.max_rows)*100).toFixed(1)}%`:`—`,tone:t&&t.utilization_pct>=85?`bad`:t&&t.utilization_pct>=60?`warn`:`good`}),(0,B.jsx)(Rc,{label:`oldest`,value:Hc(t?.oldest_timestamp??null),mono:!0}),(0,B.jsx)(Rc,{label:`newest`,value:Hc(t?.newest_timestamp??null),mono:!0})]}),(0,B.jsxs)(Lc,{title:`process`,status:s,statusLabel:n?`pid ${n.pid}`:`idle`,children:[(0,B.jsx)(Rc,{label:`uptime`,value:n?Vc(n.uptime_ms):`—`,mono:!0}),(0,B.jsx)(Rc,{label:`rss`,value:n?(0,B.jsxs)(`span`,{children:[(0,B.jsx)(yr,{value:n.memory_rss_mb,format:e=>e.toFixed(0)}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1`,children:`MB`})]}):`—`}),(0,B.jsx)(Rc,{label:`bun`,value:n?.bun_version??`—`,mono:!0}),(0,B.jsx)(Rc,{label:`platform`,value:n?`${n.platform}/${n.arch}`:`—`,mono:!0})]}),(0,B.jsxs)(Lc,{title:`flight recorder`,status:r&&r.file_size_bytes>0?`ok`:`unknown`,statusLabel:r?`${r.approx_entries.toLocaleString()} entries`:`idle`,children:[(0,B.jsx)(Rc,{label:`size`,value:r?(0,B.jsx)(yr,{value:r.file_size_bytes,format:e=>Bc(e)}):`—`,mono:!0}),(0,B.jsx)(Rc,{label:`entries`,value:r?(0,B.jsx)(yr,{value:r.approx_entries}):`—`})]})]})}function tl(e){let{playback:t,bursts:n,rangeStart:r,rangeEnd:i,loading:a,onPlayhead:o,onLive:s,onPause:c,onResume:l,onToday:u}=e,d=(0,_.useRef)(null),f=(0,_.useRef)(!1),p=Math.max(1,i-r),m=(t.playhead_ms-r)/p*100,h=Math.max(0,Math.min(100,m)),g=(0,_.useMemo)(()=>{let e=[];for(let t=0;t<200;t++)e.push({allow:0,block:0,ask:0,other:0});for(let t of n){let n=t.ts_ms;if(n<r||n>i)continue;let a=e[Math.floor((n-r)/p*199)];t.decision===`allow`?a.allow++:t.decision===`block`||t.decision===`force`?a.block++:t.decision===`ask`?a.ask++:a.other++}return e},[n,r,i,p]),v=(0,_.useCallback)(e=>{let t=d.current;if(!t)return;let n=t.getBoundingClientRect();o(r+Math.max(0,Math.min(1,(e-n.left)/n.width))*p)},[r,p,o]);(0,_.useEffect)(()=>{let e=e=>{f.current&&v(e.clientX)},t=()=>{f.current=!1};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t)}},[v]);let y=t.mode===`live`;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono uppercase tracking-wider`,children:[(0,B.jsx)(`button`,{onClick:()=>y?c():l(),className:`px-2.5 py-1 rounded-sm border transition-colors cursor-pointer ${y?`border-emerald-500/40 text-emerald-300 hover:bg-emerald-500/10`:`border-amber-500/40 text-amber-300 hover:bg-amber-500/10`}`,title:y?`Pause the live stream`:`Resume updates at this playhead`,children:y?`⏸ pause`:`▶ resume`}),(0,B.jsx)(`button`,{onClick:s,disabled:y,className:`px-2.5 py-1 rounded-sm border transition-colors cursor-pointer ${y?`border-[var(--color-line-1)] text-[var(--color-fg-4)] opacity-50`:`border-sky-500/40 text-sky-300 hover:bg-sky-500/10`}`,title:`Jump to live (now)`,children:`⏭ live`}),(0,B.jsx)(`button`,{onClick:u,className:`px-2.5 py-1 rounded-sm border border-violet-500/40 text-violet-300 hover:bg-violet-500/10 transition-colors cursor-pointer`,title:`Expand to today — window covers from local midnight through now. Backfills audit_log so the scrubber shows every eval since 00:00 local.`,children:`◉ today`}),(0,B.jsx)(`div`,{className:`flex-1`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`mode`}),(0,B.jsx)(`span`,{className:y?`text-emerald-300`:t.mode===`paused`?`text-amber-300`:`text-violet-300`,children:t.mode}),a&&(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] animate-pulse`,children:`· backfilling`}),(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`· t=`,nl(t.playhead_ms)]})]}),(0,B.jsxs)(`div`,{ref:d,className:`relative h-10 w-full rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] cursor-pointer overflow-hidden select-none`,onPointerDown:e=>{f.current=!0,e.target.setPointerCapture?.(e.pointerId),v(e.clientX)},children:[(0,B.jsx)(`svg`,{viewBox:`0 0 200 40`,preserveAspectRatio:`none`,className:`absolute inset-0 w-full h-full`,"aria-hidden":!0,children:g.map((e,t)=>{let n=e.allow+e.block+e.ask+e.other;if(n===0)return null;let r=Math.min(32,n*3),i=e.block>0?Pa.block:e.ask>0?Pa.ask:Pa.allow;return(0,B.jsx)(`rect`,{x:t,y:40-r,width:.9,height:r,fill:i,opacity:.7},t)})}),(0,B.jsx)(`div`,{className:`absolute top-0 bottom-0 w-px bg-sky-300 pointer-events-none`,style:{left:`${h}%`},children:(0,B.jsx)(`div`,{className:`absolute -top-0.5 -translate-x-1/2 w-2 h-2 rotate-45 bg-sky-300`})}),y&&(0,B.jsx)(`div`,{className:`absolute top-0 right-0 bottom-0 w-[2px] bg-emerald-400 animate-pulse pointer-events-none`})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] font-mono text-[var(--color-fg-4)]`,children:[(0,B.jsx)(`span`,{children:rl(r)}),(0,B.jsxs)(`span`,{className:`uppercase tracking-wider`,children:[il(t.window_ms),` window`]}),(0,B.jsx)(`span`,{children:rl(i)})]})]})}function nl(e){let t=Date.now()-e;if(Math.abs(t)<1500)return`live`;let n=Math.round(t/1e3);if(n<60)return`−${n}s`;let r=Math.floor(n/60);return r<60?`−${r}m${n%60}s`:`−${Math.floor(r/60)}h${r%60}m`}function rl(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function il(e){return e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:`${Math.round(e/36e5)}h`}function al(e){let{burst:t,onClose:n}=e;if(!t)return(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,B.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`node · none`}),(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`click a node to inspect`})]});let r=Pa[t.decision]??`#6b7280`,i=t.duration_ns/1e6,a=Date.now()-t.ts_ms;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 text-[12px] font-mono`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`overline text-[var(--color-fg-3)]`,children:`node · inspect`}),(0,B.jsx)(`button`,{onClick:n,className:`text-[var(--color-fg-4)] hover:text-[var(--color-fg-1)] cursor-pointer`,title:`Close inspector`,children:`✕`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{background:r},"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`uppercase tracking-wider`,style:{color:r},children:t.decision}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:t.tool})]}),(0,B.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[11px]`,children:[(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`rule`}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)] break-all`,children:t.rule_id??`—`}),(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`client`}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:t.client}),(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`agent`}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:t.agent_id?(0,B.jsx)(`span`,{className:`chip text-violet-300 border-violet-500/30`,children:t.agent_id}):(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`—`})}),(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`duration`}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:i<1?`${(i*1e3).toFixed(0)}µs`:`${i.toFixed(2)}ms`}),(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`age`}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:ol(a)}),(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`timestamp`}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:new Date(t.ts_ms).toLocaleString()})]}),t.input_preview&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:`input`}),(0,B.jsx)(`pre`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-0)] rounded-sm p-2 text-[10px] text-[var(--color-fg-2)] whitespace-pre-wrap break-all max-h-48 overflow-y-auto`,children:t.input_preview})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[t.audit_id&&(0,B.jsx)(`a`,{href:`/audit?id=${encodeURIComponent(t.audit_id)}`,className:`chip text-[var(--color-fg-3)] border-[var(--color-line-1)] hover:text-[var(--color-fg-1)]`,title:`Open full audit record`,children:`audit ↗`}),t.rule_id&&(0,B.jsx)(`a`,{href:`/rules#${encodeURIComponent(t.rule_id)}`,className:`chip text-[var(--color-fg-3)] border-[var(--color-line-1)] hover:text-[var(--color-fg-1)]`,title:`Jump to rule`,children:`rule ↗`})]})]})}function ol(e){if(e<1500)return`just now`;let t=Math.floor(e/1e3);if(t<60)return`${t}s ago`;let n=Math.floor(t/60);return n<60?`${n}m${t%60}s ago`:`${Math.floor(n/60)}h${n%60}m ago`}function sl(e){let t=new Map;for(let n of e){let e=`${n.client}:${n.agent_id??`solo`}`,r=t.get(e);r?(r.count+=1,n.ts_ms>r.newest_ts_ms&&(r.newest_ts_ms=n.ts_ms)):t.set(e,{client:n.client,agent_id:n.agent_id??`solo`,count:1,newest_ts_ms:n.ts_ms})}return Array.from(t.values()).sort((e,t)=>t.newest_ts_ms===e.newest_ts_ms?t.count-e.count:t.newest_ts_ms-e.newest_ts_ms)}function cl(e){let{bursts:t,allBursts:n}=e,r=n??t,{toolCounts:i,decisionCounts:a,ruleCounts:o,unmatchedCount:s}=(0,_.useMemo)(()=>{let e=new Map,n=new Map,r=new Map,i=0;for(let a of t)if(e.set(a.tool,(e.get(a.tool)??0)+1),n.set(a.decision,(n.get(a.decision)??0)+1),a.rule_id){let e=r.get(a.rule_id);e?(e.count+=1,e.decisions.add(a.decision)):r.set(a.rule_id,{count:1,decisions:new Set([a.decision])})}else i+=1;return{toolCounts:Array.from(e.entries()).sort((e,t)=>t[1]-e[1]),decisionCounts:Array.from(n.entries()),ruleCounts:Array.from(r.entries()).map(([e,t])=>({id:e,count:t.count,decisions:t.decisions})).sort((e,t)=>t.count-e.count),unmatchedCount:i}},[t]),c=(0,_.useMemo)(()=>sl(r),[r]),l=i[0]?.[1]??0,u=c[0]?.count??0,d=o[0]?.count??0,f=e=>{for(let t of[`block`,`ask`,`force`,`log`,`allow`,`shadow`])if(e.has(t))return Pa[t];return`#6b7280`};return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 text-[11px] font-mono`,children:[(0,B.jsx)(`div`,{className:`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-0)] p-2 text-[10px] text-[var(--color-fg-3)] leading-relaxed`,children:`Each dot is one tool call by an AI agent. Color encodes the ssg rule decision; lines link calls from the same agent in time order.`}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`rules · `,o.length,` matched`,s>0&&(0,B.jsxs)(`span`,{className:`ml-2 text-[var(--color-fg-4)] normal-case tracking-normal`,children:[s,` unmatched`]})]}),o.length===0?(0,B.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no rules matched in window`}):(0,B.jsx)(`ul`,{className:`space-y-0.5`,children:o.slice(0,6).map(e=>{let t=d>0?e.count/d*100:0,n=f(e.decisions);return(0,B.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,title:`${e.id} — decisions: ${Array.from(e.decisions).join(`, `)}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:n},"aria-hidden":!0}),(0,B.jsx)(`a`,{href:`/rules#${encodeURIComponent(e.id)}`,className:`truncate text-[var(--color-fg-2)] hover:text-[var(--color-fg-1)]`,children:e.id}),(0,B.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full`,style:{background:n,width:`${t}%`,opacity:.6}})})]}),(0,B.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:e.count})]},e.id)})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:`decisions`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[`allow`,`block`,`ask`,`log`,`force`,`shadow`].map(e=>{let t=a.find(([t])=>t===e)?.[1]??0;return(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:Pa[e]},"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-2)] uppercase tracking-wider`,children:e}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4)] tabular-nums`,children:t})]},e)})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`agents · `,c.length,` active`,n&&n!==t&&(0,B.jsx)(`span`,{className:`ml-2 text-[var(--color-fg-4)] normal-case tracking-normal`,children:`roster: today`})]}),c.length===0?(0,B.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no agents in window`}):(0,B.jsx)(`ul`,{className:`space-y-0.5`,children:c.slice(0,8).map(e=>{let t=u>0?e.count/u*100:0,n=`${e.client}:${e.agent_id}`,r=Date.now()-e.newest_ts_ms,i=r<5e3;return(0,B.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,title:`${n} — last eval ${Math.max(0,Math.round(r/1e3))}s ago`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i?(0,B.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft shrink-0`,"aria-hidden":!0}):(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-[var(--color-fg-4)]/40`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{className:`truncate text-[var(--color-fg-2)]`,children:[e.client,(0,B.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`:`,e.agent_id]})]}),(0,B.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full bg-violet-400/60`,style:{width:`${t}%`}})})]}),(0,B.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:e.count})]},n)})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`tools · `,t.length,` in window`]}),i.length===0?(0,B.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no tool activity`}):(0,B.jsx)(`ul`,{className:`space-y-0.5`,children:i.slice(0,8).map(([e,t])=>{let n=l>0?t/l*100:0;return(0,B.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`truncate text-[var(--color-fg-2)]`,children:e}),(0,B.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full bg-sky-400/60`,style:{width:`${n}%`}})})]}),(0,B.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:t})]},e)})})]})]})}var ll=[100,500,1e3,5e3,1e4,1e5];function ul(e){return e>=1e5||e>=1e3?`${e/1e3|0}k`:String(e)}function dl(e){let t=Math.floor(e/100),n=Math.floor(t/600),r=Math.floor(t%600/10),i=t%10;return`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}.${i}`}function fl(e){let t=Math.floor(e/100);return`${Math.floor(t/10)}.${t%10}s`}function pl({className:e,onMilestone:t,onRecord:n}){let[r,i]=(0,_.useState)(0),[a,o]=(0,_.useState)(0),[s,c]=(0,_.useState)(0),[l,u]=(0,_.useState)(0),[d,f]=(0,_.useState)(0),[p,m]=(0,_.useState)(0),[h,g]=(0,_.useState)(0),[v,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(!1),w=De(),T=ke(),E=Oe(),ee=(0,_.useRef)(null),D=(0,_.useRef)(0),te=(0,_.useRef)(0),ne=(0,_.useRef)(0),O=(0,_.useRef)(0),re=(0,_.useRef)(new Set);(0,_.useEffect)(()=>{if(pt()){let e=performance.now(),t=e,n=setInterval(()=>{let n=performance.now();i(n-e),o(n-t)},1e3);return ae.current=()=>{t=performance.now()},()=>{clearInterval(n),ae.current=null}}performance.now();let e=lt({onUpdate:e=>i(e.currentTime)}),t=lt({onUpdate:e=>o(e.currentTime)});return ie.current=()=>{performance.now(),t.seek(0)},()=>{e.cancel(),t.cancel(),ie.current=null}},[]);let ie=(0,_.useRef)(null),ae=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(ee.current===null){ee.current=T,D.current=T;return}if(T<=D.current)return;let e=T-D.current;D.current=T,f(n=>{let r=n+e,i=ll.find(e=>e>O.current&&r>=e);return i&&(O.current=i,y(ul(i)),C(!0),t?.(),setTimeout(()=>{y(``),C(!1)},700)),r});let r=Date.now(),i=E.filter(e=>r-e.ts_ms<=6e4);m(new Set(i.map(e=>`${e.client}:${e.agent_id??`solo`}`)).size),w?.rule_id&&re.current.add(w.rule_id),g(re.current.size),w&&(w.decision===`block`?(te.current=0,c(0),ie.current?.(),ae.current?.()):(te.current+=e,te.current>ne.current&&(ne.current=te.current,u(ne.current),x(!0),n?.(),setTimeout(()=>x(!1),450)),c(te.current)))},[T,w,E,t,n]),(0,B.jsxs)(`div`,{className:z(`pointer-events-none select-none`,`flex flex-col gap-2 p-3 rounded-md`,`bg-[var(--color-bg-2,#0c0d12)]/85 backdrop-blur-sm`,`border border-[var(--color-border-1,#1c1f26)]`,`shadow-lg shadow-black/40`,`min-w-[180px] font-mono text-[11px]`,`text-[var(--color-fg-2,#9aa1ad)]`,S&&`milestone-ring`,e),"aria-label":`Live engagement counters`,children:[(0,B.jsx)(ml,{label:`uptime`,children:(0,B.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-0,#e6e8ed)] text-[15px] tracking-tight`,children:dl(r)})}),(0,B.jsx)(ml,{label:`evals`,children:(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(yr,{value:d,curve:`spring`,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`}),v&&(0,B.jsxs)(`span`,{className:`text-[10px] text-emerald-400 uppercase tracking-wide`,children:[`+`,v]})]})}),(0,B.jsx)(ml,{label:`since block`,children:(0,B.jsx)(`span`,{className:`tabular-nums text-emerald-300 text-[15px]`,children:fl(a)})}),(0,B.jsx)(ml,{label:`streak / best`,children:(0,B.jsxs)(`span`,{className:z(`tabular-nums text-[15px]`,b?`record-beat`:`text-[var(--color-fg-0,#e6e8ed)]`),children:[(0,B.jsx)(yr,{value:s,curve:`spring`}),(0,B.jsx)(`span`,{className:`text-[var(--color-fg-4,#5a6071)] mx-1`,children:`/`}),(0,B.jsx)(yr,{value:l,curve:`elastic`})]})}),(0,B.jsx)(ml,{label:`agents`,children:(0,B.jsx)(yr,{value:p,curve:`spring`,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`})}),(0,B.jsx)(ml,{label:`rules`,children:(0,B.jsx)(yr,{value:h,curve:`spring`,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`})})]})}function ml({label:e,children:t}){return(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,B.jsx)(`span`,{className:`uppercase tracking-wider text-[10px] text-[var(--color-fg-4,#5a6071)]`,children:e}),t]})}function hl(){let e=new Date;return e.setHours(0,0,0,0),e.getTime()}function gl(e,t,n){let r=t-n,i=[];for(let n of e)if(!(n.ts_ms<r)){if(n.ts_ms>t)break;i.push(n)}return i}function _l(e,t){if(e.length===0)return t.slice();if(t.length===0)return e.slice();let n=new Set,r=[],i=0,a=0;for(;i<e.length&&a<t.length;){let o=e[i].ts_ms<=t[a].ts_ms?e[i++]:t[a++],s=vl(o);n.has(s)||(n.add(s),r.push(o))}for(;i<e.length;i++){let t=vl(e[i]);n.has(t)||(n.add(t),r.push(e[i]))}for(;a<t.length;a++){let e=vl(t[a]);n.has(e)||(n.add(e),r.push(t[a]))}return r}function vl(e){return e.audit_id??`${e.ts_ms}:${e.tool}:${e.client}`}function yl(e={}){let t=e.windowMs??12e4,n=Oe(),r=ke(),[i,a]=(0,_.useState)(()=>({mode:`live`,playhead_ms:Date.now(),window_ms:t})),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(!1),u=(0,_.useRef)(null),d=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(i.mode!==`live`)return;let e=n.length>0?n[n.length-1].ts_ms:Date.now();e!==i.playhead_ms&&a(t=>({...t,playhead_ms:e}))},[i.mode,i.playhead_ms,n,r]);let f=(0,_.useMemo)(()=>_l(o,n),[o,n,r]),p=(0,_.useMemo)(()=>gl(f,i.playhead_ms,i.window_ms),[f,i.playhead_ms,i.window_ms]),m=f.length>0?f[0].ts_ms:i.playhead_ms,h=f.length>0?f[f.length-1].ts_ms:i.playhead_ms,g=(0,_.useCallback)(async e=>{if(d.current)return;let t=m,n=Math.min(t,(u.current??Date.now())-e);if(n>=t)return;let r=new AbortController;d.current=r,l(!0);try{let e=await fetch(`/api/json/graph/backfill?since_ms=${n}&until_ms=${t}&limit=500`,{signal:r.signal,credentials:`same-origin`});if(!e.ok)throw Error(`backfill ${e.status}`);let i=await e.json();Array.isArray(i.bursts)&&i.bursts.length>0&&s(e=>_l(e,i.bursts)),u.current=n}catch(e){e.name!==`AbortError`&&console.warn(`[graph] backfill failed`,e)}finally{d.current=null,l(!1)}},[m]);(0,_.useEffect)(()=>{i.playhead_ms-m<i.window_ms*.5&&g(Fa)},[i.mode,i.playhead_ms,i.window_ms,m,g]);let v=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(v.current)return;v.current=!0;let e=Date.now()-hl();e>0&&g(e)},[]),(0,_.useEffect)(()=>()=>{d.current?.abort(),d.current=null},[]);let y=(0,_.useCallback)(e=>{a(t=>e===`live`?{...t,mode:`live`}:{...t,mode:e})},[]),b=(0,_.useCallback)(e=>{a(t=>({...t,mode:t.mode===`live`?`scrubbing`:t.mode,playhead_ms:e}))},[]),x=(0,_.useCallback)(e=>{a(t=>({...t,window_ms:Math.max(1e3,e)}))},[]),S=(0,_.useCallback)(()=>{a(e=>({...e,mode:`live`,playhead_ms:Date.now()}))},[]),C=(0,_.useCallback)(()=>{let e=hl(),t=Date.now(),n=Math.max(1e3,t-e);a(e=>({...e,mode:`live`,playhead_ms:t,window_ms:n})),g(n)},[g]);return{snapshot:(0,_.useMemo)(()=>({bursts:p,playback:i,oldest_known_ms:m,newest_known_ms:h,loading_backfill:c}),[p,i,m,h,c]),allBursts:f,setMode:y,setPlayhead:b,setWindow:x,jumpToLive:S,requestBackfill:g,jumpToToday:C}}function bl(){let e=yl(),t=ke(),n=De(),r=(0,_.useRef)(new URLSearchParams(window.location.search).get(`layout`)===`force`?`force`:`spiral`),[i,a]=(0,_.useState)(null),o=Mo();(0,_.useEffect)(()=>{n&&(n.decision===`block`?o.play(`block`):n.decision===`force`&&o.play(`force`))},[t]);let s=(0,_.useCallback)(()=>o.play(`milestone`),[o]),c=(0,_.useCallback)(()=>o.play(`record`),[o]),{bursts:l,playback:u,oldest_known_ms:d,newest_known_ms:f,loading_backfill:p}=e.snapshot,m=(0,_.useMemo)(()=>{if(!i)return null;for(let e of l)if((e.audit_id??`${e.ts_ms}:${e.tool}`)===i||i.startsWith(`${e.ts_ms}:${e.tool}`))return e;return null},[l,i]),h=Math.min(d,u.playhead_ms-u.window_ms),g=Math.max(f,u.playhead_ms);return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 min-h-[70vh]`,children:[(0,B.jsxs)(`header`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`h1`,{className:`text-sm font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`graph intelligence`}),(0,B.jsx)(`span`,{className:`chip text-sky-300 border-sky-500/30`,children:`real-time tool-use`}),u.mode===`live`?(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-emerald-300`,children:[(0,B.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),`streaming`]}):(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-amber-300`,children:[(0,B.jsx)(`span`,{className:`status-dot bg-amber-400`}),u.mode]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:[l.length,` nodes · window`,` `,Math.round(u.window_ms/1e3),`s`]}),(0,B.jsx)(`button`,{type:`button`,onClick:o.toggle,className:`chip cursor-pointer hover:border-sky-500/50 hover:text-sky-300 transition-colors`,title:o.enabled?`Mute stream sounds`:`Enable stream sounds`,children:o.enabled?`SFX ON`:`SFX OFF`})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-4 flex-1 min-h-0`,children:[(0,B.jsxs)(`div`,{className:`min-h-[440px] flex relative`,children:[(0,B.jsx)(yo,{bursts:l,paused:u.mode!==`live`,selectedId:i,onSelect:a,burstSeq:t,layout:r.current}),(0,B.jsx)(Do,{className:`absolute top-3 left-3 z-10`}),(0,B.jsx)(pl,{className:`absolute top-3 right-3 z-10`,onMilestone:s,onRecord:c})]}),(0,B.jsxs)(`aside`,{className:`flex flex-col gap-4 min-w-0`,children:[(0,B.jsx)(`section`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:(0,B.jsx)(cl,{bursts:l,allBursts:e.allBursts})}),(0,B.jsx)(`section`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 min-h-[200px]`,children:(0,B.jsx)(al,{burst:m,onClose:()=>a(null)})})]})]}),(0,B.jsx)(`section`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:(0,B.jsx)(tl,{playback:u,bursts:l,rangeStart:h,rangeEnd:g,loading:p,onPlayhead:t=>e.setPlayhead(t),onLive:()=>e.jumpToLive(),onPause:()=>e.setMode(`paused`),onResume:()=>e.setMode(`scrubbing`),onToday:()=>e.jumpToToday()})})]})}var xl=[{id:`rca`,label:`rca`,hint:`pre-computed root cause`},{id:`timeline`,label:`timeline`,hint:`recent frames across traces`},{id:`watch`,label:`watch`,hint:`subscribe to any ssg:// URI`},{id:`state`,label:`state`,hint:`daemon runtime snapshot`},{id:`metrics`,label:`metrics`,hint:`latency + counters`}];function Sl(){let[e,t]=(0,_.useState)(`rca`);return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 min-h-[70vh]`,children:[(0,B.jsxs)(`header`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`h1`,{className:`text-sm font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`ai-native debugger`}),(0,B.jsx)(`span`,{className:`chip text-sky-300 border-sky-500/30`,children:`ssg:// unified resolver`}),(0,B.jsx)(Cl,{})]}),(0,B.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`one surface · cli · mcp · dashboard`})]}),(0,B.jsx)(`nav`,{className:`flex items-center gap-1 border-b border-[var(--color-line-1)]`,children:xl.map(n=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>t(n.id),title:n.hint,className:`px-3 py-1.5 text-[11px] font-mono uppercase tracking-wider border-b-2 transition-colors `+(e===n.id?`border-[var(--color-brand)] text-[var(--color-fg-1)]`:`border-transparent text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)]`),children:n.label},n.id))}),(0,B.jsxs)(`section`,{className:`flex-1 min-h-0`,children:[e===`rca`&&(0,B.jsx)(wl,{}),e===`timeline`&&(0,B.jsx)(kl,{}),e===`watch`&&(0,B.jsx)(Il,{}),e===`state`&&(0,B.jsx)(X,{uri:`ssg://daemon/state`}),e===`metrics`&&(0,B.jsx)(X,{uri:`ssg://daemon/metrics`})]})]})}function Cl(){let e=je([`debug-frame`])[`debug-frame`]??0;return(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-emerald-300`,title:`${e} debug-frame bursts received`,children:[(0,B.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),`live · `,e]})}function wl(){let e=je([`debug-frame`,`activity-updated`]),{data:t,loading:n,error:r,refetch:i}=F(`/api/json/debug?uri=ssg%3A%2F%2Frca%2Fcurrent`,[e[`debug-frame`],e[`activity-updated`]]),a=t?.data?.pack??null;return(0,B.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-[1fr_340px] gap-4`,children:[(0,B.jsxs)(`article`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-4 space-y-3`,children:[n&&!t&&(0,B.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`loading RCA pack…`}),r&&(0,B.jsxs)(`p`,{className:`text-sm text-rose-300`,children:[`rca fetch error: `,r]}),!n&&!a&&(0,B.jsxs)(`div`,{className:`text-sm text-[var(--color-fg-3)] space-y-2`,children:[(0,B.jsx)(`p`,{className:`font-mono`,children:`no current RCA pack`}),(0,B.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)]`,children:`Packs are composed automatically when an eval errors, an ssqa finding arrives, or a daemon-level error fires. Nothing to diagnose yet — you're green.`})]}),a&&(0,B.jsx)(El,{pack:a})]}),(0,B.jsxs)(`aside`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 text-[11px] font-mono text-[var(--color-fg-4)] space-y-2`,children:[(0,B.jsx)(`p`,{className:`uppercase tracking-wider text-[var(--color-fg-2)]`,children:`how claude sees this`}),(0,B.jsxs)(`pre`,{className:`text-[10px] whitespace-pre-wrap leading-snug`,children:[`ssg debug rca --current --json`,`
|
|
20
20
|
`,`# or via MCP:`,`
|
|
21
|
-
`,`ssg_debug_rca(`,`{`,`auto_current:true`,`}`,`)`]}),(0,B.jsx)(`button`,{type:`button`,onClick:i,className:`w-full mt-2 px-2 py-1 border border-[var(--color-line-1)] rounded-sm hover:bg-[var(--color-surface-2)]`,children:`refresh`}),t?.snapshot_hash&&(0,B.jsxs)(`p`,{className:`text-[10px] opacity-60`,children:[`hash `,t.snapshot_hash.slice(0,12),`…`]})]})]})}function vl(e){return e===`critical`?`text-rose-400 border-rose-500/40`:e===`high`?`text-amber-300 border-amber-500/40`:e===`medium`?`text-sky-300 border-sky-500/40`:`text-[var(--color-fg-3)] border-[var(--color-line-1)]`}function yl({pack:e}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`header`,{className:`flex items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`p`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)]`,children:[`rca pack · `,new Date(e.ts_ms).toLocaleTimeString()]}),(0,B.jsx)(`h2`,{className:`text-[15px] font-medium text-[var(--color-fg-1)] mt-1`,children:e.summary}),e.trace_id&&(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] mt-1`,children:[`trace_id · `,e.trace_id]})]}),(0,B.jsx)(`span`,{className:`chip uppercase text-[10px] tracking-wider `+vl(e.severity),children:e.severity})]}),e.hypothesis&&e.hypothesis.length>0&&(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`hypothesis`}),(0,B.jsx)(`ol`,{className:`space-y-2`,children:e.hypothesis.map((e,t)=>(0,B.jsxs)(`li`,{className:`p-2 rounded-sm bg-[var(--color-surface-2)] border border-[var(--color-line-1)]`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsx)(`p`,{className:`text-[13px] text-[var(--color-fg-1)]`,children:e.cause}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`conf `,(e.confidence*100).toFixed(0),`%`]})]}),e.evidence.length>0&&(0,B.jsx)(`ul`,{className:`mt-1 pl-3 text-[11px] text-[var(--color-fg-3)] list-disc list-inside space-y-0.5`,children:e.evidence.map((e,t)=>(0,B.jsx)(`li`,{children:e},t))})]},t))})]}),e.suggested_next_actions&&e.suggested_next_actions.length>0&&(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`suggested next actions`}),(0,B.jsx)(`ul`,{className:`space-y-1 text-[13px] text-[var(--color-fg-2)]`,children:e.suggested_next_actions.map((e,t)=>(0,B.jsxs)(`li`,{className:`font-mono text-[12px]`,children:[`→ `,e]},t))})]}),e.state_snapshot&&e.state_snapshot.length>0&&(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`expand`}),(0,B.jsx)(`ul`,{className:`space-y-1 text-[11px] font-mono`,children:e.state_snapshot.map(e=>(0,B.jsxs)(`li`,{className:`text-[var(--color-fg-3)]`,children:[(0,B.jsx)(`code`,{className:`text-sky-300`,children:e.uri}),(0,B.jsxs)(`span`,{className:`opacity-50 ml-2`,children:[e.hash.slice(0,10),`…`]})]},e.uri))})]})]})}var bl=[`hook-ingress`,`parse`,`match`,`ffi-call`,`decide`,`audit`,`respond`],xl={"hook-ingress":`#6ea8ff`,parse:`#a78bfa`,match:`#60d394`,"ffi-call":`#f59e0b`,decide:`#f472b6`,audit:`#94a3b8`,respond:`#22d3ee`};function Sl(){let{data:e,loading:t,error:n}=F(`/api/json/debug?uri=ssg%3A%2F%2Fframes%2Frecent%3Flimit%3D256`,[je([`debug-frame`])[`debug-frame`]]),r=e?.data?.frames??[],i=e?.data?.dropped??0,[a,o]=(0,_.useState)(null);return(0,B.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-[1fr_320px] gap-4`,children:[(0,B.jsxs)(`article`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:[`frames · `,r.length,i>0&&(0,B.jsxs)(`span`,{className:`ml-2 text-amber-300`,children:[`dropped · `,i]})]}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`ssg://frames/recent`})]}),n&&(0,B.jsxs)(`p`,{className:`text-sm text-rose-300`,children:[`timeline fetch error: `,n]}),t&&r.length===0?(0,B.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`loading…`}):r.length===0?(0,B.jsx)(Cl,{}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Tl,{frames:r,onSelect:o}),(0,B.jsx)(wl,{})]})]}),(0,B.jsxs)(`aside`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2 text-[11px] font-mono text-[var(--color-fg-3)]`,children:[(0,B.jsx)(`p`,{className:`uppercase tracking-wider text-[var(--color-fg-2)]`,children:`frame inspector`}),a?(0,B.jsx)(El,{frame:a}):(0,B.jsx)(`p`,{className:`opacity-60`,children:`click a bar to inspect`})]})]})}function Cl(){return(0,B.jsxs)(`div`,{className:`text-[12px] text-[var(--color-fg-3)] space-y-1 py-4`,children:[(0,B.jsx)(`p`,{children:`no frames yet`}),(0,B.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)] font-mono`,children:`SSG_DEBUG_ENABLED=1 ssg daemon`}),(0,B.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)]`,children:`then fire an eval — frames stream in live.`})]})}function wl(){return(0,B.jsx)(`div`,{className:`flex flex-wrap gap-3 text-[10px] font-mono text-[var(--color-fg-4)]`,children:bl.map(e=>(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm`,style:{background:xl[e]}}),e]},e))})}function Tl({frames:e,onSelect:t}){let n=(0,_.useRef)(null),r=(0,_.useRef)([]),[i,a]=(0,_.useState)(-1),{rows:o,tMin:s,tMax:c}=(0,_.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.trace_id)??[];e.push(n),t.set(n.trace_id,e)}let n=Array.from(t.entries()).map(([e,t])=>({trace_id:e,frames:t.slice().sort((e,t)=>Ol(e.ts_start_ns,t.ts_start_ns))}));n.sort((e,t)=>Ol(e.frames[0].ts_start_ns,t.frames[0].ts_start_ns));let r=null,i=null;for(let t of e){let e=BigInt(t.ts_start_ns),n=BigInt(t.ts_end_ns);(r===null||e<r)&&(r=e),(i===null||n>i)&&(i=n)}return{rows:n,tMin:r??0n,tMax:i??1n}},[e]);(0,_.useEffect)(()=>{let e=n.current;if(!e)return;let t=window.devicePixelRatio||1,a=e.clientWidth,l=Math.max(120,o.length*22+24);e.width=a*t,e.height=l*t,e.style.height=`${l}px`;let u=e.getContext(`2d`);if(!u)return;u.setTransform(t,0,0,t,0,0),u.clearRect(0,0,a,l),u.strokeStyle=`rgba(255,255,255,0.04)`,u.lineWidth=1;for(let e=1;e<4;e++){let t=e*a/4;u.beginPath(),u.moveTo(t,0),u.lineTo(t,l),u.stroke()}let d=c>s?Number(c-s):1,f=a-110-8;u.font=`10px ui-monospace, monospace`,u.textBaseline=`middle`;let p=[];if(o.forEach((e,t)=>{let n=8+t*22;u.fillStyle=`rgba(255,255,255,0.55)`,u.fillText(e.trace_id.slice(0,10),6,n+18/2);for(let t of e.frames){let e=Number(BigInt(t.ts_start_ns)-s),r=Number(BigInt(t.ts_end_ns)-s),i=110+e/d*f,a=Math.max(2,(r-e)/d*f);u.fillStyle=xl[t.stage]??`#888`,u.globalAlpha=t.result===`error`?1:.82,u.fillRect(i,n,a,18),u.globalAlpha=1,t.result===`error`&&(u.strokeStyle=`#f43f5e`,u.lineWidth=1.5,u.strokeRect(i+.5,n+.5,a-1,17)),p.push({x:i,y:n,w:a,h:18,frame:t})}}),r.current=p,i>=0&&i<p.length){let e=p[i];u.strokeStyle=`#fff`,u.lineWidth=1.5,u.strokeRect(e.x+.5,e.y+.5,e.w-1,e.h-1)}},[o,s,c,i]);function l(e){let t=n.current;if(!t)return-1;let i=t.getBoundingClientRect(),a=e.clientX-i.left,o=e.clientY-i.top;for(let e=r.current.length-1;e>=0;e--){let t=r.current[e];if(a>=t.x&&a<=t.x+t.w&&o>=t.y&&o<=t.y+t.h)return e}return-1}return(0,B.jsx)(`canvas`,{ref:n,className:`w-full block cursor-crosshair`,onMouseMove:e=>a(l(e)),onMouseLeave:()=>a(-1),onClick:e=>{let n=l(e);t(n>=0?r.current[n].frame:null)}})}function El({frame:e}){let t=Number(BigInt(e.ts_end_ns)-BigInt(e.ts_start_ns)),n=t>=1e6?`${(t/1e6).toFixed(2)}ms`:t>=1e3?`${(t/1e3).toFixed(1)}µs`:`${t}ns`;return(0,B.jsxs)(`dl`,{className:`space-y-1`,children:[(0,B.jsxs)(Dl,{k:`stage`,children:[(0,B.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm mr-1 align-middle`,style:{background:xl[e.stage]??`#888`}}),e.stage]}),(0,B.jsx)(Dl,{k:`tool`,children:e.tool}),(0,B.jsx)(Dl,{k:`result`,children:(0,B.jsx)(`span`,{className:e.result===`error`?`text-rose-300`:e.result===`skip`?`text-[var(--color-fg-4)]`:`text-emerald-300`,children:e.result})}),(0,B.jsx)(Dl,{k:`dur`,children:n}),e.rule_id&&(0,B.jsx)(Dl,{k:`rule`,children:e.rule_id}),e.error&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Dl,{k:`err.type`,children:(0,B.jsx)(`span`,{className:`text-rose-300`,children:e.error.type})}),(0,B.jsx)(Dl,{k:`err.msg`,children:(0,B.jsx)(`span`,{className:`text-rose-200`,children:e.error.message})})]}),e.input_preview&&(0,B.jsx)(Dl,{k:`input`,children:(0,B.jsx)(`code`,{className:`text-[10px] break-all`,children:e.input_preview})}),(0,B.jsx)(Dl,{k:`trace`,children:(0,B.jsx)(`code`,{className:`text-[10px]`,children:e.trace_id})}),(0,B.jsx)(Dl,{k:`frame`,children:(0,B.jsx)(`code`,{className:`text-[10px]`,children:e.frame_id})})]})}function Dl({k:e,children:t}){return(0,B.jsxs)(`div`,{className:`flex gap-2 text-[11px] leading-tight`,children:[(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)] w-16 shrink-0 uppercase tracking-wider`,children:e}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)] break-all min-w-0`,children:t})]})}function Ol(e,t){let n=BigInt(e),r=BigInt(t);return n<r?-1:n>r?1:0}var kl=[`ssg://daemon/state`,`ssg://daemon/metrics`,`ssg://audit/recent?limit=10`,`ssg://frames/recent?limit=32`,`ssg://rules/list`,`ssg://rca/current`,`ssg://native/stats`];function Al(){let[e,t]=(0,_.useState)(`ssg://daemon/state`),[n,r]=(0,_.useState)(`ssg://daemon/state`);return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:kl.map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>{t(e),r(e)},className:`chip text-[10px] `+(n===e?`border-[var(--color-brand)] text-[var(--color-fg-1)]`:`text-[var(--color-fg-3)]`),children:e},e))}),(0,B.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:t=>{t.preventDefault(),r(e)},children:[(0,B.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),placeholder:`ssg://source/path?k=v`,className:`flex-1 px-3 py-1.5 text-[12px] font-mono rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] text-[var(--color-fg-1)]`}),(0,B.jsx)(`button`,{type:`submit`,className:`px-3 py-1.5 text-[11px] font-mono uppercase tracking-wider border border-[var(--color-line-1)] rounded-sm hover:bg-[var(--color-surface-2)]`,children:`resolve`})]}),(0,B.jsx)(jl,{uri:n})]})}function jl({uri:e}){let t=je([`debug-frame`,`activity-updated`,`counters-updated`]),{data:n,loading:r,error:i,refetch:a}=F(`/api/json/debug?uri=${encodeURIComponent(e)}`,[t[`debug-frame`],t[`activity-updated`],t[`counters-updated`],e]),o=n?JSON.stringify(n.data,null,2):``;return(0,B.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2`,children:[(0,B.jsxs)(`header`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:e}),n?.snapshot_hash&&(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`hash `,n.snapshot_hash.slice(0,10),`…`]}),n?.stale&&(0,B.jsxs)(`span`,{className:`chip text-amber-300 border-amber-500/40 text-[10px]`,children:[`stale `,n.age_ms?`${Math.round(n.age_ms/1e3)}s`:``]})]}),(0,B.jsx)(`button`,{type:`button`,onClick:a,className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`,children:`refresh`})]}),r&&!n&&(0,B.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`resolving…`}),i&&(0,B.jsx)(`p`,{className:`text-sm text-rose-300`,children:i}),o&&(0,B.jsx)(`pre`,{className:`text-[11px] leading-snug font-mono text-[var(--color-fg-2)] overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:o})]})}var Ml=`ssg-dashboard-tabs`,Nl=2e3,Pl=6e3;function Fl(){return`tab-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}function Y(){let[e,t]=(0,_.useState)(0),[n,r]=(0,_.useState)(!0),i=(0,_.useRef)(Fl()),a=(0,_.useRef)(new Map);return(0,_.useEffect)(()=>{if(typeof BroadcastChannel>`u`)return;let e=new BroadcastChannel(Ml);function n(){let e=Date.now();for(let[t,n]of a.current.entries())e-n>Pl&&a.current.delete(t);let n=a.current.size;t(n),r([...a.current.keys(),i.current].sort()[0]===i.current)}function o(e){let t=e.data;!t||t.id===i.current||(t.type===`leave`?a.current.delete(t.id):a.current.set(t.id,Date.now()),n())}e.addEventListener(`message`,o),e.postMessage({type:`join`,id:i.current});let s=setInterval(()=>{e.postMessage({type:`heartbeat`,id:i.current}),n()},Nl),c=()=>{e.postMessage({type:`leave`,id:i.current})};return window.addEventListener(`beforeunload`,c),()=>{clearInterval(s),e.postMessage({type:`leave`,id:i.current}),e.removeEventListener(`message`,o),e.close(),window.removeEventListener(`beforeunload`,c)}},[]),{otherTabCount:e,isLeader:n}}var Il=y;function X(){(0,_.useEffect)(()=>we([]),[]);let e=(0,_.useSyncExternalStore)(ge,_e),[,t]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(e.connected||e.lastErrorAt===null)return;let n=setInterval(()=>t(e=>e+1),500);return()=>clearInterval(n)},[e.connected,e.lastErrorAt]);let n=Z(e),r=n===`reconnecting`&&e.lastErrorAt!==null?Math.max(0,Math.ceil((e.lastErrorAt+e.reconnectDelayMs-Date.now())/1e3)):null,i=Math.round(Il/1e3);if(n===`connected`)return(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,title:`Telemetry Live — SSE connected`,"data-testid":`sse-status-chip`,"data-state":`connected`,children:[(0,B.jsx)(`span`,{className:`status-dot bg-emerald-400`}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:`sse · live`})]});let a=n===`reconnecting`,o=a?`border-amber-500/40 bg-amber-500/10 text-amber-200`:`border-red-500/40 bg-red-500/10 text-red-200`,s=a?`bg-amber-400`:`bg-red-400`,c=a?r===null?`reconnecting`:`reconnect · ${r}s`:`offline`,l=`live paused · ${i}s poll`,u=a?`Live stream down — reconnect in ${r??`…`}s (attempt ${e.reconnectAttempts}). Dashboard is polling every ${i}s until SSE recovers.`:`Live stream disconnected. Dashboard is polling every ${i}s — data still updates, just at a coarser cadence.`;return(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded border px-2 py-0.5 text-[11px] font-mono uppercase tracking-wider ${o}`,title:u,"data-testid":`sse-status-chip`,"data-state":n,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(`span`,{className:`status-dot ${s} pulse-soft`}),(0,B.jsx)(`span`,{className:`hidden md:inline`,children:l}),(0,B.jsx)(`span`,{className:`md:hidden`,children:c})]})}function Z(e){return e.connected?`connected`:e.reconnectAttempts>0||e.lastErrorAt!==null?`reconnecting`:`disconnected`}var Q=`ssg:ui:font-scale:v1`,Ll=[{label:`S`,value:.9},{label:`M`,value:1},{label:`L`,value:1.15},{label:`XL`,value:1.3}],Rl=1;function zl(e){if(typeof e!=`number`||!Number.isFinite(e))return Rl;let t=Ll.find(t=>Math.abs(t.value-e)<.001);return t?t.value:Rl}function Bl(){if(typeof localStorage>`u`)return Rl;try{let e=localStorage.getItem(Q);return e===null?Rl:zl(parseFloat(e))}catch{return Rl}}function Vl(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(Q,String(e))}catch{}}function Hl(e){typeof document>`u`||(document.documentElement.style.setProperty(`--ssg-font-scale`,String(e)),document.documentElement.style.fontSize=`${16*e}px`)}function Ul(){let[e,t]=(0,_.useState)(()=>{let e=Bl();return Hl(e),e});return(0,_.useEffect)(()=>{Hl(e)},[e]),{scale:e,setScale:(0,_.useCallback)(e=>{t(e),Vl(e),Hl(e)},[])}}function Wl(){let{scale:e,setScale:t}=Ul();return(0,B.jsx)(`div`,{role:`radiogroup`,"aria-label":`Font size`,className:`flex items-center gap-0.5 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-0.5`,children:Ll.map(n=>{let r=Math.abs(n.value-e)<.001;return(0,B.jsx)(`button`,{role:`radio`,"aria-checked":r,onClick:()=>t(n.value),title:`Font size: ${n.label} (${Math.round(n.value*100)}%)`,className:`px-1.5 py-0.5 text-[10px] font-mono uppercase tracking-wider cursor-pointer transition-colors rounded-sm `+(r?`bg-[var(--color-surface-3)] text-[var(--color-fg-0)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`),children:n.label},n.label)})})}var Gl=[{path:`/`,label:`dashboard`},{path:`/graph`,label:`graph`},{path:`/rules`,label:`rules`},{path:`/audit`,label:`audit`},{path:`/approvals`,label:`approvals`},{path:`/hub`,label:`hub`},{path:`/profile`,label:`profile`},{path:`/monitor`,label:`monitor`},{path:`/observability`,label:`observability`},{path:`/debug`,label:`debug`}];function Kl(e){let t=Math.max(0,e-Date.now()),n=Math.floor(t/1e3);if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m ${n%60}s`:`${Math.floor(r/60)}h ${r%60}m`}function ql(){let{data:e}=F(`/api/json/daemon-status`,[je([`counters-updated`])[`counters-updated`]]),[t,n]=(0,_.useState)(!1),[,r]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(e?.status!==`degraded`||!e.hibernation)return;let t=setInterval(()=>r(e=>e+1),1e3);return()=>clearInterval(t)},[e?.status,e?.hibernation]);let i=e?.status??`starting`,a=i===`running`?`bg-emerald-400`:i===`starting`||i===`degraded`?`bg-amber-400`:`bg-red-400`,o=i===`starting`||i===`degraded`?`pulse-soft`:``,s=i===`degraded`&&e?.hibernation?Kl(e.hibernation.nextRetryAt):null,c=i===`running`?`daemon · online`:i===`starting`?`daemon · booting`:i===`degraded`?`daemon · retry ${s??`…`}`:i===`error`?`daemon · error`:`daemon · offline`;return(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsxs)(`button`,{onClick:()=>n(e=>!e),className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] transition-colors cursor-pointer`,title:i===`running`?`Daemon running`:i===`starting`?`Daemon starting…`:i===`degraded`?`Daemon hibernating — retry in ${s??`…`}`:i===`error`?`Daemon error`:`Daemon stopped`,children:[(0,B.jsx)(`span`,{className:`status-dot ${a} ${o}`}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:c})]}),t&&(0,B.jsxs)(`div`,{className:`absolute right-0 top-7 z-50 w-72 bg-[var(--color-surface-1)] border border-[var(--color-line-2)] rounded-sm shadow-xl p-3 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`eval daemon`}),(0,B.jsx)(`button`,{onClick:()=>n(!1),className:`text-[var(--color-fg-4)] hover:text-[var(--color-fg-1)] cursor-pointer`,children:`✕`})]}),(0,B.jsxs)(`div`,{className:`space-y-1 text-[var(--color-fg-2)]`,children:[(0,B.jsxs)(`div`,{className:`font-mono text-[11px]`,children:[`status:`,` `,(0,B.jsx)(`span`,{className:i===`running`?`text-emerald-300`:i===`starting`||i===`degraded`?`text-amber-300`:`text-red-300`,children:i})]}),e?.pid&&(0,B.jsxs)(`div`,{className:`font-mono text-[11px]`,children:[`pid: `,e.pid]}),i===`degraded`&&e?.hibernation&&(0,B.jsxs)(`div`,{className:`mt-2 rounded-sm border border-amber-500/25 bg-amber-500/5 p-2 text-[11px] text-amber-300 space-y-0.5`,children:[(0,B.jsxs)(`div`,{children:[`next retry:`,` `,(0,B.jsx)(`span`,{className:`font-medium`,children:s})]}),(0,B.jsxs)(`div`,{children:[`episode attempt: `,e.hibernation.attempt,e.hibernation.reason?` (${e.hibernation.reason})`:``]}),(0,B.jsx)(`div`,{className:`text-amber-400/70`,children:`Slow-tier supervisor is retrying at long backoff — no manual restart required.`})]})]}),e?.logTail&&e.logTail.length>0&&(0,B.jsxs)(`div`,{className:`mt-3`,children:[(0,B.jsx)(`div`,{className:`overline mb-1`,children:`recent log`}),(0,B.jsx)(`pre`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-0)] rounded-sm p-2 text-[10px] text-[var(--color-fg-2)] overflow-x-auto whitespace-pre-wrap break-all max-h-32 overflow-y-auto`,children:e.logTail.join(`
|
|
22
|
-
`)})]})]})]})}function
|
|
21
|
+
`,`ssg_debug_rca(`,`{`,`auto_current:true`,`}`,`)`]}),(0,B.jsx)(`button`,{type:`button`,onClick:i,className:`w-full mt-2 px-2 py-1 border border-[var(--color-line-1)] rounded-sm hover:bg-[var(--color-surface-2)]`,children:`refresh`}),t?.snapshot_hash&&(0,B.jsxs)(`p`,{className:`text-[10px] opacity-60`,children:[`hash `,t.snapshot_hash.slice(0,12),`…`]})]})]})}function Tl(e){return e===`critical`?`text-rose-400 border-rose-500/40`:e===`high`?`text-amber-300 border-amber-500/40`:e===`medium`?`text-sky-300 border-sky-500/40`:`text-[var(--color-fg-3)] border-[var(--color-line-1)]`}function El({pack:e}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`header`,{className:`flex items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`p`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)]`,children:[`rca pack · `,new Date(e.ts_ms).toLocaleTimeString()]}),(0,B.jsx)(`h2`,{className:`text-[15px] font-medium text-[var(--color-fg-1)] mt-1`,children:e.summary}),e.trace_id&&(0,B.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] mt-1`,children:[`trace_id · `,e.trace_id]})]}),(0,B.jsx)(`span`,{className:`chip uppercase text-[10px] tracking-wider `+Tl(e.severity),children:e.severity})]}),e.hypothesis&&e.hypothesis.length>0&&(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`hypothesis`}),(0,B.jsx)(`ol`,{className:`space-y-2`,children:e.hypothesis.map((e,t)=>(0,B.jsxs)(`li`,{className:`p-2 rounded-sm bg-[var(--color-surface-2)] border border-[var(--color-line-1)]`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsx)(`p`,{className:`text-[13px] text-[var(--color-fg-1)]`,children:e.cause}),(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`conf `,(e.confidence*100).toFixed(0),`%`]})]}),e.evidence.length>0&&(0,B.jsx)(`ul`,{className:`mt-1 pl-3 text-[11px] text-[var(--color-fg-3)] list-disc list-inside space-y-0.5`,children:e.evidence.map((e,t)=>(0,B.jsx)(`li`,{children:e},t))})]},t))})]}),e.suggested_next_actions&&e.suggested_next_actions.length>0&&(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`suggested next actions`}),(0,B.jsx)(`ul`,{className:`space-y-1 text-[13px] text-[var(--color-fg-2)]`,children:e.suggested_next_actions.map((e,t)=>(0,B.jsxs)(`li`,{className:`font-mono text-[12px]`,children:[`→ `,e]},t))})]}),e.state_snapshot&&e.state_snapshot.length>0&&(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`expand`}),(0,B.jsx)(`ul`,{className:`space-y-1 text-[11px] font-mono`,children:e.state_snapshot.map(e=>(0,B.jsxs)(`li`,{className:`text-[var(--color-fg-3)]`,children:[(0,B.jsx)(`code`,{className:`text-sky-300`,children:e.uri}),(0,B.jsxs)(`span`,{className:`opacity-50 ml-2`,children:[e.hash.slice(0,10),`…`]})]},e.uri))})]})]})}var Dl=[`hook-ingress`,`parse`,`match`,`ffi-call`,`decide`,`audit`,`respond`],Ol={"hook-ingress":`#6ea8ff`,parse:`#a78bfa`,match:`#60d394`,"ffi-call":`#f59e0b`,decide:`#f472b6`,audit:`#94a3b8`,respond:`#22d3ee`};function kl(){let{data:e,loading:t,error:n}=F(`/api/json/debug?uri=ssg%3A%2F%2Fframes%2Frecent%3Flimit%3D256`,[je([`debug-frame`])[`debug-frame`]]),r=e?.data?.frames??[],i=e?.data?.dropped??0,[a,o]=(0,_.useState)(null);return(0,B.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-[1fr_320px] gap-4`,children:[(0,B.jsxs)(`article`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:[`frames · `,r.length,i>0&&(0,B.jsxs)(`span`,{className:`ml-2 text-amber-300`,children:[`dropped · `,i]})]}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`ssg://frames/recent`})]}),n&&(0,B.jsxs)(`p`,{className:`text-sm text-rose-300`,children:[`timeline fetch error: `,n]}),t&&r.length===0?(0,B.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`loading…`}):r.length===0?(0,B.jsx)(Al,{}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ml,{frames:r,onSelect:o}),(0,B.jsx)(jl,{})]})]}),(0,B.jsxs)(`aside`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2 text-[11px] font-mono text-[var(--color-fg-3)]`,children:[(0,B.jsx)(`p`,{className:`uppercase tracking-wider text-[var(--color-fg-2)]`,children:`frame inspector`}),a?(0,B.jsx)(Nl,{frame:a}):(0,B.jsx)(`p`,{className:`opacity-60`,children:`click a bar to inspect`})]})]})}function Al(){return(0,B.jsxs)(`div`,{className:`text-[12px] text-[var(--color-fg-3)] space-y-1 py-4`,children:[(0,B.jsx)(`p`,{children:`no frames yet`}),(0,B.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)] font-mono`,children:`SSG_DEBUG_ENABLED=1 ssg daemon`}),(0,B.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)]`,children:`then fire an eval — frames stream in live.`})]})}function jl(){return(0,B.jsx)(`div`,{className:`flex flex-wrap gap-3 text-[10px] font-mono text-[var(--color-fg-4)]`,children:Dl.map(e=>(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm`,style:{background:Ol[e]}}),e]},e))})}function Ml({frames:e,onSelect:t}){let n=(0,_.useRef)(null),r=(0,_.useRef)([]),[i,a]=(0,_.useState)(-1),{rows:o,tMin:s,tMax:c}=(0,_.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.trace_id)??[];e.push(n),t.set(n.trace_id,e)}let n=Array.from(t.entries()).map(([e,t])=>({trace_id:e,frames:t.slice().sort((e,t)=>Fl(e.ts_start_ns,t.ts_start_ns))}));n.sort((e,t)=>Fl(e.frames[0].ts_start_ns,t.frames[0].ts_start_ns));let r=null,i=null;for(let t of e){let e=BigInt(t.ts_start_ns),n=BigInt(t.ts_end_ns);(r===null||e<r)&&(r=e),(i===null||n>i)&&(i=n)}return{rows:n,tMin:r??0n,tMax:i??1n}},[e]);(0,_.useEffect)(()=>{let e=n.current;if(!e)return;let t=window.devicePixelRatio||1,a=e.clientWidth,l=Math.max(120,o.length*22+24);e.width=a*t,e.height=l*t,e.style.height=`${l}px`;let u=e.getContext(`2d`);if(!u)return;u.setTransform(t,0,0,t,0,0),u.clearRect(0,0,a,l),u.strokeStyle=`rgba(255,255,255,0.04)`,u.lineWidth=1;for(let e=1;e<4;e++){let t=e*a/4;u.beginPath(),u.moveTo(t,0),u.lineTo(t,l),u.stroke()}let d=c>s?Number(c-s):1,f=a-110-8;u.font=`10px ui-monospace, monospace`,u.textBaseline=`middle`;let p=[];if(o.forEach((e,t)=>{let n=8+t*22;u.fillStyle=`rgba(255,255,255,0.55)`,u.fillText(e.trace_id.slice(0,10),6,n+18/2);for(let t of e.frames){let e=Number(BigInt(t.ts_start_ns)-s),r=Number(BigInt(t.ts_end_ns)-s),i=110+e/d*f,a=Math.max(2,(r-e)/d*f);u.fillStyle=Ol[t.stage]??`#888`,u.globalAlpha=t.result===`error`?1:.82,u.fillRect(i,n,a,18),u.globalAlpha=1,t.result===`error`&&(u.strokeStyle=`#f43f5e`,u.lineWidth=1.5,u.strokeRect(i+.5,n+.5,a-1,17)),p.push({x:i,y:n,w:a,h:18,frame:t})}}),r.current=p,i>=0&&i<p.length){let e=p[i];u.strokeStyle=`#fff`,u.lineWidth=1.5,u.strokeRect(e.x+.5,e.y+.5,e.w-1,e.h-1)}},[o,s,c,i]);function l(e){let t=n.current;if(!t)return-1;let i=t.getBoundingClientRect(),a=e.clientX-i.left,o=e.clientY-i.top;for(let e=r.current.length-1;e>=0;e--){let t=r.current[e];if(a>=t.x&&a<=t.x+t.w&&o>=t.y&&o<=t.y+t.h)return e}return-1}return(0,B.jsx)(`canvas`,{ref:n,className:`w-full block cursor-crosshair`,onMouseMove:e=>a(l(e)),onMouseLeave:()=>a(-1),onClick:e=>{let n=l(e);t(n>=0?r.current[n].frame:null)}})}function Nl({frame:e}){let t=Number(BigInt(e.ts_end_ns)-BigInt(e.ts_start_ns)),n=t>=1e6?`${(t/1e6).toFixed(2)}ms`:t>=1e3?`${(t/1e3).toFixed(1)}µs`:`${t}ns`;return(0,B.jsxs)(`dl`,{className:`space-y-1`,children:[(0,B.jsxs)(Pl,{k:`stage`,children:[(0,B.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm mr-1 align-middle`,style:{background:Ol[e.stage]??`#888`}}),e.stage]}),(0,B.jsx)(Pl,{k:`tool`,children:e.tool}),(0,B.jsx)(Pl,{k:`result`,children:(0,B.jsx)(`span`,{className:e.result===`error`?`text-rose-300`:e.result===`skip`?`text-[var(--color-fg-4)]`:`text-emerald-300`,children:e.result})}),(0,B.jsx)(Pl,{k:`dur`,children:n}),e.rule_id&&(0,B.jsx)(Pl,{k:`rule`,children:e.rule_id}),e.error&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Pl,{k:`err.type`,children:(0,B.jsx)(`span`,{className:`text-rose-300`,children:e.error.type})}),(0,B.jsx)(Pl,{k:`err.msg`,children:(0,B.jsx)(`span`,{className:`text-rose-200`,children:e.error.message})})]}),e.input_preview&&(0,B.jsx)(Pl,{k:`input`,children:(0,B.jsx)(`code`,{className:`text-[10px] break-all`,children:e.input_preview})}),(0,B.jsx)(Pl,{k:`trace`,children:(0,B.jsx)(`code`,{className:`text-[10px]`,children:e.trace_id})}),(0,B.jsx)(Pl,{k:`frame`,children:(0,B.jsx)(`code`,{className:`text-[10px]`,children:e.frame_id})})]})}function Pl({k:e,children:t}){return(0,B.jsxs)(`div`,{className:`flex gap-2 text-[11px] leading-tight`,children:[(0,B.jsx)(`dt`,{className:`text-[var(--color-fg-4)] w-16 shrink-0 uppercase tracking-wider`,children:e}),(0,B.jsx)(`dd`,{className:`text-[var(--color-fg-2)] break-all min-w-0`,children:t})]})}function Fl(e,t){let n=BigInt(e),r=BigInt(t);return n<r?-1:n>r?1:0}var Y=[`ssg://daemon/state`,`ssg://daemon/metrics`,`ssg://audit/recent?limit=10`,`ssg://frames/recent?limit=32`,`ssg://rules/list`,`ssg://rca/current`,`ssg://native/stats`];function Il(){let[e,t]=(0,_.useState)(`ssg://daemon/state`),[n,r]=(0,_.useState)(`ssg://daemon/state`);return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Y.map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>{t(e),r(e)},className:`chip text-[10px] `+(n===e?`border-[var(--color-brand)] text-[var(--color-fg-1)]`:`text-[var(--color-fg-3)]`),children:e},e))}),(0,B.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:t=>{t.preventDefault(),r(e)},children:[(0,B.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),placeholder:`ssg://source/path?k=v`,className:`flex-1 px-3 py-1.5 text-[12px] font-mono rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] text-[var(--color-fg-1)]`}),(0,B.jsx)(`button`,{type:`submit`,className:`px-3 py-1.5 text-[11px] font-mono uppercase tracking-wider border border-[var(--color-line-1)] rounded-sm hover:bg-[var(--color-surface-2)]`,children:`resolve`})]}),(0,B.jsx)(X,{uri:n})]})}function X({uri:e}){let t=je([`debug-frame`,`activity-updated`,`counters-updated`]),{data:n,loading:r,error:i,refetch:a}=F(`/api/json/debug?uri=${encodeURIComponent(e)}`,[t[`debug-frame`],t[`activity-updated`],t[`counters-updated`],e]),o=n?JSON.stringify(n.data,null,2):``;return(0,B.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2`,children:[(0,B.jsxs)(`header`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:e}),n?.snapshot_hash&&(0,B.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`hash `,n.snapshot_hash.slice(0,10),`…`]}),n?.stale&&(0,B.jsxs)(`span`,{className:`chip text-amber-300 border-amber-500/40 text-[10px]`,children:[`stale `,n.age_ms?`${Math.round(n.age_ms/1e3)}s`:``]})]}),(0,B.jsx)(`button`,{type:`button`,onClick:a,className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`,children:`refresh`})]}),r&&!n&&(0,B.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`resolving…`}),i&&(0,B.jsx)(`p`,{className:`text-sm text-rose-300`,children:i}),o&&(0,B.jsx)(`pre`,{className:`text-[11px] leading-snug font-mono text-[var(--color-fg-2)] overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:o})]})}var Z=`ssg-dashboard-tabs`,Q=2e3,Ll=6e3;function Rl(){return`tab-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}function zl(){let[e,t]=(0,_.useState)(0),[n,r]=(0,_.useState)(!0),i=(0,_.useRef)(Rl()),a=(0,_.useRef)(new Map);return(0,_.useEffect)(()=>{if(typeof BroadcastChannel>`u`)return;let e=new BroadcastChannel(Z);function n(){let e=Date.now();for(let[t,n]of a.current.entries())e-n>Ll&&a.current.delete(t);let n=a.current.size;t(n),r([...a.current.keys(),i.current].sort()[0]===i.current)}function o(e){let t=e.data;!t||t.id===i.current||(t.type===`leave`?a.current.delete(t.id):a.current.set(t.id,Date.now()),n())}e.addEventListener(`message`,o),e.postMessage({type:`join`,id:i.current});let s=setInterval(()=>{e.postMessage({type:`heartbeat`,id:i.current}),n()},Q),c=()=>{e.postMessage({type:`leave`,id:i.current})};return window.addEventListener(`beforeunload`,c),()=>{clearInterval(s),e.postMessage({type:`leave`,id:i.current}),e.removeEventListener(`message`,o),e.close(),window.removeEventListener(`beforeunload`,c)}},[]),{otherTabCount:e,isLeader:n}}var Bl=y;function Vl(){(0,_.useEffect)(()=>we([]),[]);let e=(0,_.useSyncExternalStore)(ge,_e),[,t]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(e.connected||e.lastErrorAt===null)return;let n=setInterval(()=>t(e=>e+1),500);return()=>clearInterval(n)},[e.connected,e.lastErrorAt]);let n=Hl(e),r=n===`reconnecting`&&e.lastErrorAt!==null?Math.max(0,Math.ceil((e.lastErrorAt+e.reconnectDelayMs-Date.now())/1e3)):null,i=Math.round(Bl/1e3);if(n===`connected`)return(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,title:`Telemetry Live — SSE connected`,"data-testid":`sse-status-chip`,"data-state":`connected`,children:[(0,B.jsx)(`span`,{className:`status-dot bg-emerald-400`}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:`sse · live`})]});let a=n===`reconnecting`,o=a?`border-amber-500/40 bg-amber-500/10 text-amber-200`:`border-red-500/40 bg-red-500/10 text-red-200`,s=a?`bg-amber-400`:`bg-red-400`,c=a?r===null?`reconnecting`:`reconnect · ${r}s`:`offline`,l=`live paused · ${i}s poll`,u=a?`Live stream down — reconnect in ${r??`…`}s (attempt ${e.reconnectAttempts}). Dashboard is polling every ${i}s until SSE recovers.`:`Live stream disconnected. Dashboard is polling every ${i}s — data still updates, just at a coarser cadence.`;return(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded border px-2 py-0.5 text-[11px] font-mono uppercase tracking-wider ${o}`,title:u,"data-testid":`sse-status-chip`,"data-state":n,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(`span`,{className:`status-dot ${s} pulse-soft`}),(0,B.jsx)(`span`,{className:`hidden md:inline`,children:l}),(0,B.jsx)(`span`,{className:`md:hidden`,children:c})]})}function Hl(e){return e.connected?`connected`:e.reconnectAttempts>0||e.lastErrorAt!==null?`reconnecting`:`disconnected`}var Ul=`ssg:ui:font-scale:v1`,Wl=[{label:`S`,value:.9},{label:`M`,value:1},{label:`L`,value:1.15},{label:`XL`,value:1.3}],Gl=1;function Kl(e){if(typeof e!=`number`||!Number.isFinite(e))return Gl;let t=Wl.find(t=>Math.abs(t.value-e)<.001);return t?t.value:Gl}function ql(){if(typeof localStorage>`u`)return Gl;try{let e=localStorage.getItem(Ul);return e===null?Gl:Kl(parseFloat(e))}catch{return Gl}}function Jl(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(Ul,String(e))}catch{}}function Yl(e){typeof document>`u`||(document.documentElement.style.setProperty(`--ssg-font-scale`,String(e)),document.documentElement.style.fontSize=`${16*e}px`)}function Xl(){let[e,t]=(0,_.useState)(()=>{let e=ql();return Yl(e),e});return(0,_.useEffect)(()=>{Yl(e)},[e]),{scale:e,setScale:(0,_.useCallback)(e=>{t(e),Jl(e),Yl(e)},[])}}function Zl(){let{scale:e,setScale:t}=Xl();return(0,B.jsx)(`div`,{role:`radiogroup`,"aria-label":`Font size`,className:`flex items-center gap-0.5 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-0.5`,children:Wl.map(n=>{let r=Math.abs(n.value-e)<.001;return(0,B.jsx)(`button`,{role:`radio`,"aria-checked":r,onClick:()=>t(n.value),title:`Font size: ${n.label} (${Math.round(n.value*100)}%)`,className:`px-1.5 py-0.5 text-[10px] font-mono uppercase tracking-wider cursor-pointer transition-colors rounded-sm `+(r?`bg-[var(--color-surface-3)] text-[var(--color-fg-0)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`),children:n.label},n.label)})})}var Ql=[{path:`/`,label:`dashboard`},{path:`/graph`,label:`graph`},{path:`/rules`,label:`rules`},{path:`/audit`,label:`audit`},{path:`/approvals`,label:`approvals`},{path:`/hub`,label:`hub`},{path:`/profile`,label:`profile`},{path:`/monitor`,label:`monitor`},{path:`/observability`,label:`observability`},{path:`/debug`,label:`debug`}];function $l(e){let t=Math.max(0,e-Date.now()),n=Math.floor(t/1e3);if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m ${n%60}s`:`${Math.floor(r/60)}h ${r%60}m`}function eu(){let{data:e}=F(`/api/json/daemon-status`,[je([`counters-updated`])[`counters-updated`]]),[t,n]=(0,_.useState)(!1),[,r]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(e?.status!==`degraded`||!e.hibernation)return;let t=setInterval(()=>r(e=>e+1),1e3);return()=>clearInterval(t)},[e?.status,e?.hibernation]);let i=e?.status??`starting`,a=i===`running`?`bg-emerald-400`:i===`starting`||i===`degraded`?`bg-amber-400`:`bg-red-400`,o=i===`starting`||i===`degraded`?`pulse-soft`:``,s=i===`degraded`&&e?.hibernation?$l(e.hibernation.nextRetryAt):null,c=i===`running`?`daemon · online`:i===`starting`?`daemon · booting`:i===`degraded`?`daemon · retry ${s??`…`}`:i===`error`?`daemon · error`:`daemon · offline`;return(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsxs)(`button`,{onClick:()=>n(e=>!e),className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] transition-colors cursor-pointer`,title:i===`running`?`Daemon running`:i===`starting`?`Daemon starting…`:i===`degraded`?`Daemon hibernating — retry in ${s??`…`}`:i===`error`?`Daemon error`:`Daemon stopped`,children:[(0,B.jsx)(`span`,{className:`status-dot ${a} ${o}`}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:c})]}),t&&(0,B.jsxs)(`div`,{className:`absolute right-0 top-7 z-50 w-72 bg-[var(--color-surface-1)] border border-[var(--color-line-2)] rounded-sm shadow-xl p-3 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,B.jsx)(`span`,{className:`overline`,children:`eval daemon`}),(0,B.jsx)(`button`,{onClick:()=>n(!1),className:`text-[var(--color-fg-4)] hover:text-[var(--color-fg-1)] cursor-pointer`,children:`✕`})]}),(0,B.jsxs)(`div`,{className:`space-y-1 text-[var(--color-fg-2)]`,children:[(0,B.jsxs)(`div`,{className:`font-mono text-[11px]`,children:[`status:`,` `,(0,B.jsx)(`span`,{className:i===`running`?`text-emerald-300`:i===`starting`||i===`degraded`?`text-amber-300`:`text-red-300`,children:i})]}),e?.pid&&(0,B.jsxs)(`div`,{className:`font-mono text-[11px]`,children:[`pid: `,e.pid]}),i===`degraded`&&e?.hibernation&&(0,B.jsxs)(`div`,{className:`mt-2 rounded-sm border border-amber-500/25 bg-amber-500/5 p-2 text-[11px] text-amber-300 space-y-0.5`,children:[(0,B.jsxs)(`div`,{children:[`next retry:`,` `,(0,B.jsx)(`span`,{className:`font-medium`,children:s})]}),(0,B.jsxs)(`div`,{children:[`episode attempt: `,e.hibernation.attempt,e.hibernation.reason?` (${e.hibernation.reason})`:``]}),(0,B.jsx)(`div`,{className:`text-amber-400/70`,children:`Slow-tier supervisor is retrying at long backoff — no manual restart required.`})]})]}),e?.logTail&&e.logTail.length>0&&(0,B.jsxs)(`div`,{className:`mt-3`,children:[(0,B.jsx)(`div`,{className:`overline mb-1`,children:`recent log`}),(0,B.jsx)(`pre`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-0)] rounded-sm p-2 text-[10px] text-[var(--color-fg-2)] overflow-x-auto whitespace-pre-wrap break-all max-h-32 overflow-y-auto`,children:e.logTail.join(`
|
|
22
|
+
`)})]})]})]})}function tu(){let{data:e}=F(`/api/state/activity-degraded`);if(!e?.degraded)return null;let t=e.since?new Date(e.since).toLocaleTimeString():`recently`;return(0,B.jsxs)(`div`,{role:`status`,className:`border-b border-amber-500/40 bg-amber-500/10 px-4 py-1.5 text-[11px] font-mono text-amber-200 text-center`,title:e.reason??`audit-worker degraded`,children:[`audit pipeline degraded since `,t,` — entries may be missing. Run`,` `,(0,B.jsx)(`code`,{className:`text-amber-100`,children:`ssg daemon --status`}),` to inspect.`]})}function nu(){let{data:e}=F(`/api/json/license`,[je([`counters-updated`])[`counters-updated`]]);return!e||e.tier!==`unlicensed`||e.eval_daily_limit===null||e.evals_today<e.eval_daily_limit?null:(0,B.jsxs)(`div`,{role:`alert`,className:`border-b border-red-500/50 bg-red-500/10 px-4 py-1.5 text-[11px] font-mono text-red-200 text-center`,title:`Free tier daily eval limit reached — rules are being bypassed until quota resets`,children:[`quota exhausted — `,e.evals_today.toLocaleString(),`/`,e.eval_daily_limit.toLocaleString(),` evals used today. BLOCK and ASK rules are being bypassed (fail-open) until daily reset.`,` `,(0,B.jsx)(`a`,{href:e.upgrade_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-red-100 underline hover:text-white`,children:`Upgrade to Pro →`})]})}function ru(){let{data:e,refetch:t}=F(`/api/json/ask-mode`),[n,r]=(0,_.useState)(!1),i=e?.mode??`tty`;async function a(e){if(!(n||e===i)){r(!0);try{await fetch(`/api/json/ask-mode`,{method:`POST`,headers:{"Content-Type":`application/json`,...Ae()},body:JSON.stringify({mode:e})}),t()}finally{r(!1)}}}let o=i===`tty`;return(0,B.jsxs)(`button`,{onClick:()=>a(o?`dashboard`:`tty`),disabled:n,className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] transition-colors cursor-pointer disabled:opacity-50`,title:o?`ASK decisions prompt in the native IDE/TTY. Click to route to dashboard.`:`ASK decisions queue on /approvals. Click to route to native prompt.`,children:[(0,B.jsx)(`span`,{className:`status-dot ${o?`bg-sky-400`:`bg-violet-400`}`}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:o?`ask · native`:`ask · dashboard`})]})}function iu(){let{data:e}=F(`/api/json/mcp-status`,[je([`activity-updated`])[`activity-updated`]]),t=e?.status??`inactive`;if(t===`inactive`)return null;let n=t===`active`?`bg-sky-400`:`bg-[var(--color-fg-4)]`,r=t===`active`?`mcp · active`:`mcp · idle`;return(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,title:t===`active`?`MCP server: ${e?.recentCount??0} evals in last 5 min`:`MCP server: ${e?.totalCount??0} total evals`,children:[(0,B.jsx)(`span`,{className:`status-dot ${n}`}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:r})]})}function au(e){if(e===`/`)return(0,B.jsx)(Ho,{});if(e===`/classic`)return(0,B.jsx)(Ss,{});if(e===`/graph`)return(0,B.jsx)(bl,{});if(e===`/debug`)return(0,B.jsx)(Sl,{});if(e===`/rules`)return(0,B.jsx)(As,{});if(e===`/audit`)return(0,B.jsx)(Ps,{});if(e===`/approvals`)return(0,B.jsx)(Ws,{});if(e===`/profile`)return(0,B.jsx)(cc,{});if(e===`/hub/connect`)return(0,B.jsx)(yc,{});if(e===`/hub/publish`)return(0,B.jsx)(bc,{});if(e.startsWith(`/hub/`)){let t=e.slice(5);if(t)return(0,B.jsx)(vc,{id:t})}return e===`/hub`?(0,B.jsx)(gc,{}):e===`/monitor`?(0,B.jsx)(Nc,{}):e===`/observability`?(0,B.jsx)($c,{}):(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-24 text-[var(--color-fg-3)]`,children:[(0,B.jsx)(`p`,{className:`overline mb-2`,children:`error · 404`}),(0,B.jsx)(`p`,{className:`text-sm`,children:`page not found`}),(0,B.jsx)(`a`,{href:`/`,className:`mt-4 text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline`,children:`← back to dashboard`})]})}function ou(e){history.pushState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}function su({count:e}){let[t,n]=(0,_.useState)(!1);return t||e===0?null:(0,B.jsx)(`div`,{className:`border-b border-amber-500/25 bg-amber-500/5 px-4 py-2`,children:(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto flex items-center gap-3`,children:[(0,B.jsxs)(`svg`,{className:`shrink-0 text-amber-300`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,B.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`}),(0,B.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,B.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),(0,B.jsxs)(`p`,{className:`text-[11px] text-amber-200 flex-1 font-mono`,children:[(0,B.jsxs)(`span`,{className:`font-semibold uppercase tracking-wider`,children:[e,` other `,e===1?`tab`:`tabs`,` open.`]}),` `,`Each tab holds a live SSE connection. Browsers limit connections per origin — too many tabs will prevent this page from loading.`,` `,(0,B.jsx)(`span`,{className:`text-amber-400/70`,children:`Close other tabs to restore full live-update functionality.`})]}),(0,B.jsx)(`button`,{onClick:()=>n(!0),className:`text-amber-500/50 hover:text-amber-300 transition-colors shrink-0 cursor-pointer`,title:`Dismiss`,children:(0,B.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,B.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,B.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})})}function cu(){let[e,t]=(0,_.useState)(window.location.pathname),{otherTabCount:n}=zl();(0,_.useEffect)(()=>{let e=()=>t(window.location.pathname);return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,_.useEffect)(()=>{let e=e=>{let t=e.target.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);!n||n.startsWith(`http`)||n.startsWith(`//`)||(e.preventDefault(),ou(n))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[]);let r=t=>t===`/`?e===`/`:e.startsWith(t);return(0,B.jsxs)(`div`,{className:`min-h-screen bg-[var(--color-surface-0)] text-[var(--color-fg-1)]`,children:[(0,B.jsxs)(`header`,{className:`border-b border-[var(--color-line-1)] sticky top-0 z-50 bg-[var(--color-surface-0)]/95 backdrop-blur`,children:[(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto px-4 flex items-center h-11 gap-5`,children:[(0,B.jsxs)(`a`,{href:`/`,className:`flex items-baseline gap-0.5 select-none`,title:`SigmaShake Governance`,children:[(0,B.jsx)(`span`,{className:`font-mono text-sm font-semibold text-[var(--color-brand)] tracking-tight`,children:`ssg`}),(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-[var(--color-fg-3)] tracking-tight`,children:`/gov`})]}),(0,B.jsx)(`nav`,{className:`flex items-center`,children:Ql.map(e=>{let t=r(e.path);return(0,B.jsxs)(`a`,{href:e.path,className:`relative px-2.5 py-1 text-[12px] font-mono tracking-wide transition-colors ${t?`text-[var(--color-fg-0)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`}`,children:[e.label,t&&(0,B.jsx)(`span`,{className:`absolute inset-x-2 -bottom-px h-px bg-[var(--color-brand)]`})]},e.path)})}),(0,B.jsxs)(`div`,{className:`flex items-center gap-4 ml-auto`,children:[n>0&&(0,B.jsxs)(`span`,{className:`chip text-amber-300 border-amber-500/30`,title:`${n} other tab${n===1?``:`s`} open — may cause connection issues`,children:[n+1,` tabs`]}),(0,B.jsx)(Vl,{}),(0,B.jsx)(ru,{}),(0,B.jsx)(iu,{}),(0,B.jsx)(eu,{}),(0,B.jsx)(Zl,{})]})]}),(0,B.jsx)(su,{count:n}),(0,B.jsx)(nu,{}),(0,B.jsx)(tu,{})]}),(0,B.jsx)(`main`,{className:`max-w-7xl mx-auto px-4 py-6`,children:au(e)})]})}var lu=document.getElementById(`app-root`);if(!lu)throw Error(`Missing #app-root`);g.createRoot(lu).render((0,B.jsx)(_.StrictMode,{children:(0,B.jsx)(cu,{})}));
|