@sigmashake/ssg 0.29.102 → 0.29.103

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.
@@ -8,8 +8,8 @@ Error generating stack: `+e.message+`
8
8
  `+e.stack}}var ve=Object.prototype.hasOwnProperty,ye=t.unstable_scheduleCallback,be=t.unstable_cancelCallback,xe=t.unstable_shouldYield,Se=t.unstable_requestPaint,Ce=t.unstable_now,we=t.unstable_getCurrentPriorityLevel,Te=t.unstable_ImmediatePriority,Ee=t.unstable_UserBlockingPriority,De=t.unstable_NormalPriority,Oe=t.unstable_LowPriority,ke=t.unstable_IdlePriority,Ae=t.log,je=t.unstable_setDisableYieldValue,Me=null,Ne=null;function Pe(e){if(typeof Ae==`function`&&je(e),Ne&&typeof Ne.setStrictMode==`function`)try{Ne.setStrictMode(Me,e)}catch{}}var Fe=Math.clz32?Math.clz32:Re,Ie=Math.log,Le=Math.LN2;function Re(e){return e>>>=0,e===0?32:31-(Ie(e)/Le|0)|0}var ze=256,Be=262144,Ve=4194304;function He(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 Ue(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=He(n))):i=He(o):i=He(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=He(n))):i=He(o)):i=He(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 We(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ge(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ke(){var e=Ve;return Ve<<=1,!(Ve&62914560)&&(Ve=4194304),e}function qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Je(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ye(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-Fe(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&&Xe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Xe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Fe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ze(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Fe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Qe(e,t){var n=t&-t;return n=n&42?1:$e(n),(n&(e.suspendedLanes|t))===0?n:0}function $e(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 et(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function tt(){var e=P.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function nt(e,t){var n=P.p;try{return P.p=e,t()}finally{P.p=n}}var rt=Math.random().toString(36).slice(2),it=`__reactFiber$`+rt,at=`__reactProps$`+rt,ot=`__reactContainer$`+rt,st=`__reactEvents$`+rt,ct=`__reactListeners$`+rt,lt=`__reactHandles$`+rt,ut=`__reactResources$`+rt,dt=`__reactMarker$`+rt;function ft(e){delete e[it],delete e[at],delete e[st],delete e[ct],delete e[lt]}function pt(e){var t=e[it];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ot]||n[it]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[it])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function mt(e){if(e=e[it]||e[ot]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ht(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function gt(e){var t=e[ut];return t||=e[ut]={hoistableStyles:new Map,hoistableScripts:new Map},t}function _t(e){e[dt]=!0}var vt=new Set,yt={};function bt(e,t){xt(e,t),xt(e+`Capture`,t)}function xt(e,t){for(yt[e]=t,e=0;e<t.length;e++)vt.add(t[e])}var St=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]*$`),Ct={},wt={};function Tt(e){return ve.call(wt,e)?!0:ve.call(Ct,e)?!1:St.test(e)?wt[e]=!0:(Ct[e]=!0,!1)}function Et(e,t,n){if(Tt(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 Dt(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 Ot(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 kt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function At(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function jt(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 Mt(e){if(!e._valueTracker){var t=At(e)?`checked`:`value`;e._valueTracker=jt(e,t,``+e[t])}}function Nt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=At(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Pt(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 Ft=/[\n"\\]/g;function It(e){return e.replace(Ft,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Lt(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=``+kt(t)):e.value!==``+kt(t)&&(e.value=``+kt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):zt(e,o,kt(n)):zt(e,o,kt(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=``+kt(s):e.removeAttribute(`name`)}function Rt(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)){Mt(e);return}n=n==null?``:``+kt(n),t=t==null?n:``+kt(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),Mt(e)}function zt(e,t,n){t===`number`&&Pt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function V(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=``+kt(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 Bt(e,t,n){if(t!=null&&(t=``+kt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+kt(n)}function Vt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ne(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=kt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Mt(e)}function Ht(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ut=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 Wt(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||Ut.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Gt(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&&Wt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Wt(e,o,t[o])}function H(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 Kt=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`]]),qt=/^[\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 Jt(e){return qt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Yt(){}var Xt=null;function Zt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qt=null,$t=null;function en(e){var t=mt(e);if(t&&(e=t.stateNode)){var n=e[at]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Lt(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="`+It(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[at]||null;if(!a)throw Error(i(90));Lt(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&&Nt(r)}break a;case`textarea`:Bt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&V(e,!!n.multiple,t,!1)}}}var tn=!1;function nn(e,t,n){if(tn)return e(t,n);tn=!0;try{return e(t)}finally{if(tn=!1,(Qt!==null||$t!==null)&&(_u(),Qt&&(t=Qt,e=$t,$t=Qt=null,en(t),e)))for(t=0;t<e.length;t++)en(e[t])}}function rn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[at]||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 an=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),on=!1;if(an)try{var sn={};Object.defineProperty(sn,`passive`,{get:function(){on=!0}}),window.addEventListener(`test`,sn,sn),window.removeEventListener(`test`,sn,sn)}catch{on=!1}var cn=null,ln=null,un=null;function dn(){if(un)return un;var e,t=ln,n=t.length,r,i=`value`in cn?cn.value:cn.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 un=i.slice(e,1<r?1-r:void 0)}function fn(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 pn(){return!0}function mn(){return!1}function hn(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)?pn:mn,this.isPropagationStopped=mn,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=pn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=pn)},persist:function(){},isPersistent:pn}),t}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_n=hn(gn),vn=h({},gn,{view:0,detail:0}),yn=hn(vn),bn,xn,Sn,Cn=h({},vn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pn,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!==Sn&&(Sn&&e.type===`mousemove`?(bn=e.screenX-Sn.screenX,xn=e.screenY-Sn.screenY):xn=bn=0,Sn=e),bn)},movementY:function(e){return`movementY`in e?e.movementY:xn}}),wn=hn(Cn),Tn=hn(h({},Cn,{dataTransfer:0})),En=hn(h({},vn,{relatedTarget:0})),Dn=hn(h({},gn,{animationName:0,elapsedTime:0,pseudoElement:0})),On=hn(h({},gn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),kn=hn(h({},gn,{data:0})),An={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},jn={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`},Mn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Nn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Mn[e])?!!t[e]:!1}function Pn(){return Nn}var Fn=hn(h({},vn,{key:function(e){if(e.key){var t=An[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=fn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?jn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pn,charCode:function(e){return e.type===`keypress`?fn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?fn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),In=hn(h({},Cn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Ln=hn(h({},vn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pn})),Rn=hn(h({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0})),zn=hn(h({},Cn,{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})),Bn=hn(h({},gn,{newState:0,oldState:0})),Vn=[9,13,27,32],Hn=an&&`CompositionEvent`in window,Un=null;an&&`documentMode`in document&&(Un=document.documentMode);var Wn=an&&`TextEvent`in window&&!Un,Gn=an&&(!Hn||Un&&8<Un&&11>=Un),Kn=` `,qn=!1;function Jn(e,t){switch(e){case`keyup`:return Vn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Yn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Xn=!1;function Zn(e,t){switch(e){case`compositionend`:return Yn(t);case`keypress`:return t.which===32?(qn=!0,Kn):null;case`textInput`:return e=t.data,e===Kn&&qn?null:e;default:return null}}function Qn(e,t){if(Xn)return e===`compositionend`||!Hn&&Jn(e,t)?(e=dn(),un=ln=cn=null,Xn=!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 Gn&&t.locale!==`ko`?null:t.data;default:return null}}var $n={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 er(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!$n[e.type]:t===`textarea`}function tr(e,t,n,r){Qt?$t?$t.push(r):$t=[r]:Qt=r,t=Td(t,`onChange`),0<t.length&&(n=new _n(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var nr=null,rr=null;function ir(e){_d(e,0)}function ar(e){if(Nt(ht(e)))return e}function or(e,t){if(e===`change`)return t}var U=!1;if(an){var sr;if(an){var cr=`oninput`in document;if(!cr){var lr=document.createElement(`div`);lr.setAttribute(`oninput`,`return;`),cr=typeof lr.oninput==`function`}sr=cr}else sr=!1;U=sr&&(!document.documentMode||9<document.documentMode)}function ur(){nr&&(nr.detachEvent(`onpropertychange`,dr),rr=nr=null)}function dr(e){if(e.propertyName===`value`&&ar(rr)){var t=[];tr(t,rr,e,Zt(e)),nn(ir,t)}}function fr(e,t,n){e===`focusin`?(ur(),nr=t,rr=n,nr.attachEvent(`onpropertychange`,dr)):e===`focusout`&&ur()}function pr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return ar(rr)}function mr(e,t){if(e===`click`)return ar(t)}function hr(e,t){if(e===`input`||e===`change`)return ar(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(!ve.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=Pt(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=Pt(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=an&&`documentMode`in document&&11>=document.documentMode,G=null,wr=null,Tr=null,Er=!1;function Dr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Er||G==null||G!==Pt(r)||(r=G,`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}),Tr&&_r(Tr,r)||(Tr=r,r=Td(wr,`onSelect`),0<r.length&&(t=new _n(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=G)))}function Or(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var kr={animationend:Or(`Animation`,`AnimationEnd`),animationiteration:Or(`Animation`,`AnimationIteration`),animationstart:Or(`Animation`,`AnimationStart`),transitionrun:Or(`Transition`,`TransitionRun`),transitionstart:Or(`Transition`,`TransitionStart`),transitioncancel:Or(`Transition`,`TransitionCancel`),transitionend:Or(`Transition`,`TransitionEnd`)},Ar={},jr={};an&&(jr=document.createElement(`div`).style,`AnimationEvent`in window||(delete kr.animationend.animation,delete kr.animationiteration.animation,delete kr.animationstart.animation),`TransitionEvent`in window||delete kr.transitionend.transition);function Mr(e){if(Ar[e])return Ar[e];if(!kr[e])return e;var t=kr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in jr)return Ar[e]=t[n];return e}var Nr=Mr(`animationend`),Pr=Mr(`animationiteration`),Fr=Mr(`animationstart`),Ir=Mr(`transitionrun`),Lr=Mr(`transitionstart`),Rr=Mr(`transitioncancel`),zr=Mr(`transitionend`),Br=new Map,Vr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Vr.push(`scrollEnd`);function K(e,t){Br.set(e,t),bt(t,[e])}var Hr=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)},Ur=[],Wr=0,Gr=0;function q(){for(var e=Wr,t=Gr=Wr=0;t<e;){var n=Ur[t];Ur[t++]=null;var r=Ur[t];Ur[t++]=null;var i=Ur[t];Ur[t++]=null;var a=Ur[t];if(Ur[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&&Yr(n,i,a)}}function Kr(e,t,n,r){Ur[Wr++]=e,Ur[Wr++]=t,Ur[Wr++]=n,Ur[Wr++]=r,Gr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function qr(e,t,n,r){return Kr(e,t,n,r),Xr(e)}function Jr(e,t){return Kr(e,null,null,t),Xr(e)}function Yr(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-Fe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Xr(e){if(50<cu)throw cu=0,lu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Zr={};function Qr(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 $r(e,t,n,r){return new Qr(e,t,n,r)}function ei(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ti(e,t){var n=e.alternate;return n===null?(n=$r(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 ni(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 ri(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ei(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,ie.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=$r(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return ii(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=$r(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=$r(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=$r(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=$r(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ii(e,t,n,r){return e=$r(7,e,r,t),e.lanes=n,e}function ai(e,t,n){return e=$r(6,e,null,t),e.lanes=n,e}function oi(e){var t=$r(18,null,null,0);return t.stateNode=e,t}function si(e,t,n){return t=$r(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ci=new WeakMap;function li(e,t){if(typeof e==`object`&&e){var n=ci.get(e);return n===void 0?(t={value:e,source:t,stack:_e(t)},ci.set(e,t),t):n}return{value:e,source:t,stack:_e(t)}}var ui=[],di=0,fi=null,pi=0,mi=[],hi=0,gi=null,_i=1,vi=``;function yi(e,t){ui[di++]=pi,ui[di++]=fi,fi=e,pi=t}function bi(e,t,n){mi[hi++]=_i,mi[hi++]=vi,mi[hi++]=gi,gi=e;var r=_i;e=vi;var i=32-Fe(r)-1;r&=~(1<<i),n+=1;var a=32-Fe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,_i=1<<32-Fe(t)+i|n<<i|r,vi=a+e}else _i=1<<a|n<<i|r,vi=e}function xi(e){e.return!==null&&(yi(e,1),bi(e,1,0))}function Si(e){for(;e===fi;)fi=ui[--di],ui[di]=null,pi=ui[--di],ui[di]=null;for(;e===gi;)gi=mi[--hi],mi[hi]=null,vi=mi[--hi],mi[hi]=null,_i=mi[--hi],mi[hi]=null}function Ci(e,t){mi[hi++]=_i,mi[hi++]=vi,mi[hi++]=gi,_i=t.id,vi=t.overflow,gi=e}var wi=null,Ti=null,Ei=!1,Di=null,Oi=!1,ki=Error(i(519));function Ai(e){throw Ii(li(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ki}function ji(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[it]=e,t[at]=r,n){case`dialog`:vd(`cancel`,t),vd(`close`,t);break;case`iframe`:case`object`:case`embed`:vd(`load`,t);break;case`video`:case`audio`:for(n=0;n<hd.length;n++)vd(hd[n],t);break;case`source`:vd(`error`,t);break;case`img`:case`image`:case`link`:vd(`error`,t),vd(`load`,t);break;case`details`:vd(`toggle`,t);break;case`input`:vd(`invalid`,t),Rt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:vd(`invalid`,t);break;case`textarea`:vd(`invalid`,t),Vt(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&&(vd(`beforetoggle`,t),vd(`toggle`,t)),r.onScroll!=null&&vd(`scroll`,t),r.onScrollEnd!=null&&vd(`scrollend`,t),r.onClick!=null&&(t.onclick=Yt),t=!0):t=!1,t||Ai(e,!0)}function Mi(e){for(wi=e.return;wi;)switch(wi.tag){case 5:case 31:case 13:Oi=!1;return;case 27:case 3:Oi=!0;return;default:wi=wi.return}}function Ni(e){if(e!==wi)return!1;if(!Ei)return Mi(e),Ei=!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&&Ti&&Ai(e),Mi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ti=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ti=uf(e)}else t===27?(t=Ti,Zd(e.type)?(e=lf,lf=null,Ti=e):Ti=t):Ti=wi?cf(e.stateNode.nextSibling):null;return!0}function Pi(){Ti=wi=null,Ei=!1}function Fi(){var e=Di;return e!==null&&(Jl===null?Jl=e:Jl.push.apply(Jl,e),Di=null),e}function Ii(e){Di===null?Di=[e]:Di.push(e)}var Li=L(null),Ri=null,zi=null;function Bi(e,t,n){z(Li,t._currentValue),t._currentValue=n}function Vi(e){e._currentValue=Li.current,R(Li)}function Hi(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 J(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),Hi(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),Hi(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 Ui(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===oe.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&&J(t,e,n,r),t.flags|=262144}function Y(e){for(e=e.firstContext;e!==null;){if(!W(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function X(e){Ri=e,zi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Z(e){return Gi(Ri,e)}function Wi(e,t){return Ri===null&&X(e),Gi(e,t)}function Gi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},zi===null){if(e===null)throw Error(i(308));zi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else zi=zi.next=t;return n}var Ki=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,Ji=t.unstable_NormalPriority,Yi={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Xi(){return{controller:new Ki,data:new Map,refCount:0}}function Zi(e){e.refCount--,e.refCount===0&&qi(Ji,function(){e.controller.abort()})}var Qi=null,$i=0,ea=0,ta=null;function na(e,t){if(Qi===null){var n=Qi=[];$i=0,ea=ld(),ta={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return $i++,t.then(ra,ra),t}function ra(){if(--$i===0&&Qi!==null){ta!==null&&(ta.status=`fulfilled`);var e=Qi;Qi=null,ea=0,ta=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ia(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 aa=N.S;N.S=function(e,t){Zl=Ce(),typeof t==`object`&&t&&typeof t.then==`function`&&na(e,t),aa!==null&&aa(e,t)};var oa=L(null);function sa(){var e=oa.current;return e===null?Nl.pooledCache:e}function ca(e,t){t===null?z(oa,oa.current):z(oa,t.pool)}function la(){var e=sa();return e===null?null:{parent:Yi._currentValue,pool:e}}var ua=Error(i(460)),da=Error(i(474)),fa=Error(i(542)),pa={then:function(){}};function ma(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ha(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Yt,Yt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ya(e),e;default:if(typeof t.status==`string`)t.then(Yt,Yt);else{if(e=Nl,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,ya(e),e}throw _a=t,ua}}function ga(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(_a=e,ua):e}}var _a=null;function va(){if(_a===null)throw Error(i(459));var e=_a;return _a=null,e}function ya(e){if(e===ua||e===fa)throw Error(i(483))}var ba=null,xa=0;function Sa(e){var t=xa;return xa+=1,ba===null&&(ba=[]),ha(ba,e,t)}function Ca(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function wa(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 Ta(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=ti(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=ai(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&ga(i)===t.type)?(t=a(t,n.props),Ca(t,n),t.return=e,t):(t=ri(n.type,n.key,n.props,null,e.mode,r),Ca(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=si(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=ii(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=ai(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ri(t.type,t.key,t.props,null,e.mode,n),Ca(n,t),n.return=e,n;case v:return t=si(t,e.mode,n),t.return=e,t;case O:return t=ga(t),f(e,t,n)}if(ne(t)||j(t))return t=ii(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Sa(t),n);if(t.$$typeof===C)return f(e,Wi(e,t),n);wa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=ga(n),p(e,t,n,r)}if(ne(n)||j(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Sa(n),r);if(n.$$typeof===C)return p(e,t,Wi(e,n),r);wa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=ga(r),m(e,t,n,r,i)}if(ne(r)||j(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Sa(r),i);if(r.$$typeof===C)return m(e,t,n,Wi(t,r),i);wa(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),Ei&&yi(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 Ei&&yi(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)}),Ei&&yi(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),Ei&&yi(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 Ei&&yi(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)}),Ei&&yi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&ga(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ca(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=ii(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ri(o.type,o.key,o.props,null,e.mode,c),Ca(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=si(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=ga(o),b(e,r,o,c)}if(ne(o))return h(e,r,o,c);if(j(o)){if(l=j(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,Sa(o),c);if(o.$$typeof===C)return b(e,r,Wi(e,o),c);wa(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=ai(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{xa=0;var i=b(e,t,n,r);return ba=null,i}catch(t){if(t===ua||t===fa)throw t;var a=$r(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ea=Ta(!0),Da=Ta(!1),Oa=!1;function ka(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Aa(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 ja(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ma(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ml&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Xr(e),Yr(e,null,n),t}return Kr(e,r,t,n),Xr(e)}function Na(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,Ze(e,n)}}function Pa(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 Fa=!1;function Ia(){if(Fa){var e=ta;if(e!==null)throw e}}function La(e,t,n,r){Fa=!1;var i=e.updateQueue;Oa=!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?(Pl&f)===f:(r&f)===f){f!==0&&f===ea&&(Fa=!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:Oa=!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),Hl|=o,e.lanes=o,e.memoizedState=d}}function Ra(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function za(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ra(n[e],t)}var Ba=L(null),Va=L(0);function Ha(e,t){e=Bl,z(Va,e),z(Ba,t),Bl=e|t.baseLanes}function Ua(){z(Va,Bl),z(Ba,Ba.current)}function Wa(){Bl=Va.current,R(Ba),R(Va)}var Ga=L(null),Ka=null;function qa(e){var t=e.alternate;z(Qa,Qa.current&1),z(Ga,e),Ka===null&&(t===null||Ba.current!==null||t.memoizedState!==null)&&(Ka=e)}function Ja(e){z(Qa,Qa.current),z(Ga,e),Ka===null&&(Ka=e)}function Ya(e){e.tag===22?(z(Qa,Qa.current),z(Ga,e),Ka===null&&(Ka=e)):Xa(e)}function Xa(){z(Qa,Qa.current),z(Ga,Ga.current)}function Za(e){R(Ga),Ka===e&&(Ka=null),R(Qa)}var Qa=L(0);function $a(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 eo=0,Q=null,to=null,no=null,ro=!1,io=!1,ao=!1,oo=0,so=0,co=null,lo=0;function uo(){throw Error(i(321))}function fo(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 po(e,t,n,r,i,a){return eo=a,Q=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?As:js,ao=!1,a=n(r,i),ao=!1,io&&(a=ho(t,n,r,i)),mo(e),a}function mo(e){N.H=ks;var t=to!==null&&to.next!==null;if(eo=0,no=to=Q=null,ro=!1,so=0,co=null,t)throw Error(i(300));e===null||Js||(e=e.dependencies,e!==null&&Y(e)&&(Js=!0))}function ho(e,t,n,r){Q=e;var a=0;do{if(io&&(co=null),so=0,io=!1,25<=a)throw Error(i(301));if(a+=1,no=to=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}N.H=Ms,o=t(n,r)}while(io);return o}function go(){var e=N.H,t=e.useState()[0];return t=typeof t.then==`function`?Co(t):t,e=e.useState()[0],(to===null?null:to.memoizedState)!==e&&(Q.flags|=1024),t}function _o(){var e=oo!==0;return oo=0,e}function vo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function yo(e){if(ro){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ro=!1}eo=0,no=to=Q=null,io=!1,so=oo=0,co=null}function bo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return no===null?Q.memoizedState=no=e:no=no.next=e,no}function xo(){if(to===null){var e=Q.alternate;e=e===null?null:e.memoizedState}else e=to.next;var t=no===null?Q.memoizedState:no.next;if(t!==null)no=t,to=e;else{if(e===null)throw Q.alternate===null?Error(i(467)):Error(i(310));to=e,e={memoizedState:to.memoizedState,baseState:to.baseState,baseQueue:to.baseQueue,queue:to.queue,next:null},no===null?Q.memoizedState=no=e:no=no.next=e}return no}function So(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Co(e){var t=so;return so+=1,co===null&&(co=[]),e=ha(co,e,t),t=Q,(no===null?t.memoizedState:no.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?As:js),e}function wo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Co(e);if(e.$$typeof===C)return Z(e)}throw Error(i(438,String(e)))}function To(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=So(),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]=ee;return t.index++,n}function Eo(e,t){return typeof t==`function`?t(e):t}function Do(e){return Oo(xo(),to,e)}function Oo(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?(eo&f)===f:(Pl&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===ea&&(d=!0);else if((eo&p)===p){u=u.next,p===ea&&(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,Hl|=p;f=u.action,ao&&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,Hl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!W(o,e.memoizedState)&&(Js=!0,d&&(n=ta,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 ko(e){var t=xo(),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)||(Js=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Ao(e,t,n){var r=Q,a=xo(),o=Ei;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!W((to||a).memoizedState,n);if(s&&(a.memoizedState=n,Js=!0),a=a.queue,ts(No.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||no!==null&&no.memoizedState.tag&1){if(r.flags|=2048,Xo(9,{destroy:void 0},Mo.bind(null,r,a,n,t),null),Nl===null)throw Error(i(349));o||eo&127||jo(r,t,n)}return n}function jo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Q.updateQueue,t===null?(t=So(),Q.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Mo(e,t,n,r){t.value=n,t.getSnapshot=r,Po(t)&&Fo(e)}function No(e,t,n){return n(function(){Po(t)&&Fo(e)})}function Po(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!W(e,n)}catch{return!0}}function Fo(e){var t=Jr(e,2);t!==null&&fu(t,e,2)}function Io(e){var t=bo();if(typeof e==`function`){var n=e;if(e=n(),ao){Pe(!0);try{n()}finally{Pe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:e},t}function Lo(e,t,n,r){return e.baseState=n,Oo(e,to,typeof r==`function`?r:Eo)}function Ro(e,t,n,r,a){if(Es(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)}};N.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,zo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function zo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=N.T,o={};N.T=o;try{var s=n(i,r),c=N.S;c!==null&&c(o,s),Bo(e,t,s)}catch(n){Ho(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),N.T=a}}else try{a=n(i,r),Bo(e,t,a)}catch(n){Ho(e,t,n)}}function Bo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Vo(e,t,n)},function(n){return Ho(e,t,n)}):Vo(e,t,n)}function Vo(e,t,n){t.status=`fulfilled`,t.value=n,Uo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,zo(e,n)))}function Ho(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Uo(t),t=t.next;while(t!==r)}e.action=null}function Uo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Wo(e,t){return t}function Go(e,t){if(Ei){var n=Nl.formState;if(n!==null){a:{var r=Q;if(Ei){if(Ti){b:{for(var i=Ti,a=Oi;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){Ti=cf(i.nextSibling),r=i.data===`F!`;break a}}Ai(r)}r=!1}r&&(t=n[0])}}return n=bo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wo,lastRenderedState:t},n.queue=r,n=Cs.bind(null,Q,r),r.dispatch=n,r=Io(!1),a=Ts.bind(null,Q,!1,r.queue),r=bo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ro.bind(null,Q,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ko(e){return qo(xo(),to,e)}function qo(e,t,n){if(t=Oo(e,t,Wo)[0],e=Do(Eo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Co(t)}catch(e){throw e===ua?fa:e}else r=t;t=xo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Q.flags|=2048,Xo(9,{destroy:void 0},Jo.bind(null,i,n),null)),[r,a,e]}function Jo(e,t){e.action=t}function Yo(e){var t=xo(),n=to;if(n!==null)return qo(t,n,e);xo(),t=t.memoizedState,n=xo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Xo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Q.updateQueue,t===null&&(t=So(),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 Zo(){return xo().memoizedState}function Qo(e,t,n,r){var i=bo();Q.flags|=e,i.memoizedState=Xo(1|t,{destroy:void 0},n,r===void 0?null:r)}function $o(e,t,n,r){var i=xo();r=r===void 0?null:r;var a=i.memoizedState.inst;to!==null&&r!==null&&fo(r,to.memoizedState.deps)?i.memoizedState=Xo(t,a,n,r):(Q.flags|=e,i.memoizedState=Xo(1|t,a,n,r))}function es(e,t){Qo(8390656,8,e,t)}function ts(e,t){$o(2048,8,e,t)}function ns(e){Q.flags|=4;var t=Q.updateQueue;if(t===null)t=So(),Q.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function rs(e){var t=xo().memoizedState;return ns({ref:t,nextImpl:e}),function(){if(Ml&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function is(e,t){return $o(4,2,e,t)}function as(e,t){return $o(4,4,e,t)}function os(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 ss(e,t,n){n=n==null?null:n.concat([e]),$o(4,4,os.bind(null,t,e),n)}function cs(){}function ls(e,t){var n=xo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&fo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function us(e,t){var n=xo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&fo(t,r[1]))return r[0];if(r=e(),ao){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r}function ds(e,t,n){return n===void 0||eo&1073741824&&!(Pl&261930)?e.memoizedState=t:(e.memoizedState=n,e=du(),Q.lanes|=e,Hl|=e,n)}function fs(e,t,n,r){return W(n,t)?n:Ba.current===null?!(eo&42)||eo&1073741824&&!(Pl&261930)?(Js=!0,e.memoizedState=n):(e=du(),Q.lanes|=e,Hl|=e,t):(e=ds(e,n,r),W(e,t)||(Js=!0),e)}function ps(e,t,n,r,i){var a=P.p;P.p=a!==0&&8>a?a:8;var o=N.T,s={};N.T=s,Ts(e,!1,t,n);try{var c=i(),l=N.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ws(e,t,ia(c,r),uu(e)):ws(e,t,r,uu(e))}catch(n){ws(e,t,{then:function(){},status:`rejected`,reason:n},uu())}finally{P.p=a,o!==null&&s.types!==null&&(o.types=s.types),N.T=o}}function ms(){}function hs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=gs(e).queue;ps(e,a,t,F,n===null?ms:function(){return _s(e),n(r)})}function gs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:F},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function _s(e){var t=gs(e);t.next===null&&(t=e.alternate.memoizedState),ws(e,t.next.queue,{},uu())}function vs(){return Z(Qf)}function ys(){return xo().memoizedState}function bs(){return xo().memoizedState}function xs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=uu();e=ja(n);var r=Ma(t,e,n);r!==null&&(fu(r,t,n),Na(r,t,n)),t={cache:Xi()},e.payload=t;return}t=t.return}}function Ss(e,t,n){var r=uu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Es(e)?Ds(t,n):(n=qr(e,t,n,r),n!==null&&(fu(n,e,r),Os(n,t,r)))}function Cs(e,t,n){ws(e,t,n,uu())}function ws(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Es(e))Ds(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 Kr(e,t,i,0),Nl===null&&q(),!1}catch{}if(n=qr(e,t,i,r),n!==null)return fu(n,e,r),Os(n,t,r),!0}return!1}function Ts(e,t,n,r){if(r={lane:2,revertLane:ld(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Es(e)){if(t)throw Error(i(479))}else t=qr(e,n,r,2),t!==null&&fu(t,e,2)}function Es(e){var t=e.alternate;return e===Q||t!==null&&t===Q}function Ds(e,t){io=ro=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Os(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}var ks={readContext:Z,use:wo,useCallback:uo,useContext:uo,useEffect:uo,useImperativeHandle:uo,useLayoutEffect:uo,useInsertionEffect:uo,useMemo:uo,useReducer:uo,useRef:uo,useState:uo,useDebugValue:uo,useDeferredValue:uo,useTransition:uo,useSyncExternalStore:uo,useId:uo,useHostTransitionStatus:uo,useFormState:uo,useActionState:uo,useOptimistic:uo,useMemoCache:uo,useCacheRefresh:uo};ks.useEffectEvent=uo;var As={readContext:Z,use:wo,useCallback:function(e,t){return bo().memoizedState=[e,t===void 0?null:t],e},useContext:Z,useEffect:es,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Qo(4194308,4,os.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Qo(4194308,4,e,t)},useInsertionEffect:function(e,t){Qo(4,2,e,t)},useMemo:function(e,t){var n=bo();t=t===void 0?null:t;var r=e();if(ao){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=bo();if(n!==void 0){var i=n(t);if(ao){Pe(!0);try{n(t)}finally{Pe(!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=Ss.bind(null,Q,e),[r.memoizedState,e]},useRef:function(e){var t=bo();return e={current:e},t.memoizedState=e},useState:function(e){e=Io(e);var t=e.queue,n=Cs.bind(null,Q,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:cs,useDeferredValue:function(e,t){return ds(bo(),e,t)},useTransition:function(){var e=Io(!1);return e=ps.bind(null,Q,e.queue,!0,!1),bo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Q,a=bo();if(Ei){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Nl===null)throw Error(i(349));Pl&127||jo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,es(No.bind(null,r,o,e),[e]),r.flags|=2048,Xo(9,{destroy:void 0},Mo.bind(null,r,o,n,t),null),n},useId:function(){var e=bo(),t=Nl.identifierPrefix;if(Ei){var n=vi,r=_i;n=(r&~(1<<32-Fe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=oo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=lo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:vs,useFormState:Go,useActionState:Go,useOptimistic:function(e){var t=bo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ts.bind(null,Q,!0,n),n.dispatch=t,[e,t]},useMemoCache:To,useCacheRefresh:function(){return bo().memoizedState=xs.bind(null,Q)},useEffectEvent:function(e){var t=bo(),n={impl:e};return t.memoizedState=n,function(){if(Ml&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},js={readContext:Z,use:wo,useCallback:ls,useContext:Z,useEffect:ts,useImperativeHandle:ss,useInsertionEffect:is,useLayoutEffect:as,useMemo:us,useReducer:Do,useRef:Zo,useState:function(){return Do(Eo)},useDebugValue:cs,useDeferredValue:function(e,t){return fs(xo(),to.memoizedState,e,t)},useTransition:function(){var e=Do(Eo)[0],t=xo().memoizedState;return[typeof e==`boolean`?e:Co(e),t]},useSyncExternalStore:Ao,useId:ys,useHostTransitionStatus:vs,useFormState:Ko,useActionState:Ko,useOptimistic:function(e,t){return Lo(xo(),to,e,t)},useMemoCache:To,useCacheRefresh:bs};js.useEffectEvent=rs;var Ms={readContext:Z,use:wo,useCallback:ls,useContext:Z,useEffect:ts,useImperativeHandle:ss,useInsertionEffect:is,useLayoutEffect:as,useMemo:us,useReducer:ko,useRef:Zo,useState:function(){return ko(Eo)},useDebugValue:cs,useDeferredValue:function(e,t){var n=xo();return to===null?ds(n,e,t):fs(n,to.memoizedState,e,t)},useTransition:function(){var e=ko(Eo)[0],t=xo().memoizedState;return[typeof e==`boolean`?e:Co(e),t]},useSyncExternalStore:Ao,useId:ys,useHostTransitionStatus:vs,useFormState:Yo,useActionState:Yo,useOptimistic:function(e,t){var n=xo();return to===null?(n.baseState=e,[e,n.queue.dispatch]):Lo(n,to,e,t)},useMemoCache:To,useCacheRefresh:bs};Ms.useEffectEvent=rs;function Ns(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 Ps={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=uu(),i=ja(r);i.payload=t,n!=null&&(i.callback=n),t=Ma(e,i,r),t!==null&&(fu(t,e,r),Na(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=uu(),i=ja(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ma(e,i,r),t!==null&&(fu(t,e,r),Na(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=uu(),r=ja(n);r.tag=2,t!=null&&(r.callback=t),t=Ma(e,r,n),t!==null&&(fu(t,e,n),Na(t,e,n))}};function Fs(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 Is(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&&Ps.enqueueReplaceState(t,t.state,null)}function Ls(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 Rs(e){Hr(e)}function zs(e){console.error(e)}function Bs(e){Hr(e)}function Vs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Hs(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 Us(e,t,n){return n=ja(n),n.tag=3,n.payload={element:null},n.callback=function(){Vs(e,t)},n}function Ws(e){return e=ja(e),e.tag=3,e}function Gs(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(){Hs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Hs(t,n,r),typeof i!=`function`&&(eu===null?eu=new Set([this]):eu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Ks(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ui(t,n,a,!0),n=Ga.current,n!==null){switch(n.tag){case 31:case 13:return Ka===null?wu():n.alternate===null&&Vl===0&&(Vl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===pa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Uu(e,r,a)),!1;case 22:return n.flags|=65536,r===pa?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)),Uu(e,r,a)),!1}throw Error(i(435,n.tag))}return Uu(e,r,a),wu(),!1}if(Ei)return t=Ga.current,t===null?(r!==ki&&(t=Error(i(423),{cause:r}),Ii(li(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=li(r,n),a=Us(e.stateNode,r,a),Pa(e,a),Vl!==4&&(Vl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ki&&(e=Error(i(422),{cause:r}),Ii(li(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=li(o,n),ql===null?ql=[o]:ql.push(o),Vl!==4&&(Vl=2),t===null)return!0;r=li(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Us(n.stateNode,r,e),Pa(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`&&(eu===null||!eu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ws(a),Gs(a,e,n,r),Pa(n,a),!1}n=n.return}while(n!==null);return!1}var qs=Error(i(461)),Js=!1;function Ys(e,t,n,r){t.child=e===null?Da(t,null,n,r):Ea(t,e.child,n,r)}function Xs(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 X(t),r=po(e,t,n,o,a,i),s=_o(),e!==null&&!Js?(vo(e,t,i),bc(e,t,i)):(Ei&&s&&xi(t),t.flags|=1,Ys(e,t,r,i),t.child)}function Zs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ei(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Qs(e,t,a,r,i)):(e=ri(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!xc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?_r:n,n(o,r)&&e.ref===t.ref)return bc(e,t,i)}return t.flags|=1,e=ti(a,r),e.ref=t.ref,e.return=t,t.child=e}function Qs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(_r(a,r)&&e.ref===t.ref)if(Js=!1,t.pendingProps=r=a,xc(e,i))e.flags&131072&&(Js=!0);else return t.lanes=e.lanes,bc(e,t,i)}return oc(e,t,n,r,i)}function $s(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 tc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ca(t,a===null?null:a.cachePool),a===null?Ua():Ha(t,a),Ya(t);else return r=t.lanes=536870912,tc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ca(t,null),Ua(),Xa(t)):(ca(t,a.cachePool),Ha(t,a),Xa(t),t.memoizedState=null);return Ys(e,t,i,n),t.child}function ec(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function tc(e,t,n,r,i){var a=sa();return a=a===null?null:{parent:Yi._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ca(t,null),Ua(),Ya(t),e!==null&&Ui(e,t,r,!0),t.childLanes=i,null}function nc(e,t){return t=hc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function rc(e,t,n){return Ea(t,e.child,null,n),e=nc(t,t.pendingProps),e.flags|=2,Za(t),t.memoizedState=null,e}function ic(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Ei){if(r.mode===`hidden`)return e=nc(t,r),t.lanes=536870912,ec(null,e);if(Ja(t),(e=Ti)?(e=rf(e,Oi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:gi===null?null:{id:_i,overflow:vi},retryLane:536870912,hydrationErrors:null},n=oi(e),n.return=t,t.child=n,wi=t,Ti=null)):e=null,e===null)throw Ai(t);return t.lanes=536870912,null}return nc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Ja(t),a)if(t.flags&256)t.flags&=-257,t=rc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(Js||Ui(e,t,n,!1),a=(n&e.childLanes)!==0,Js||a){if(r=Nl,r!==null&&(s=Qe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Jr(e,s),fu(r,e,s),qs;wu(),t=rc(e,t,n)}else e=o.treeContext,Ti=cf(s.nextSibling),wi=t,Ei=!0,Di=null,Oi=!1,e!==null&&Ci(t,e),t=nc(t,r),t.flags|=4096;return t}return e=ti(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ac(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 oc(e,t,n,r,i){return X(t),n=po(e,t,n,r,void 0,i),r=_o(),e!==null&&!Js?(vo(e,t,i),bc(e,t,i)):(Ei&&r&&xi(t),t.flags|=1,Ys(e,t,n,i),t.child)}function sc(e,t,n,r,i,a){return X(t),t.updateQueue=null,n=ho(t,r,n,i),mo(e),r=_o(),e!==null&&!Js?(vo(e,t,a),bc(e,t,a)):(Ei&&r&&xi(t),t.flags|=1,Ys(e,t,n,a),t.child)}function cc(e,t,n,r,i){if(X(t),t.stateNode===null){var a=Zr,o=n.contextType;typeof o==`object`&&o&&(a=Z(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ps,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},ka(t),o=n.contextType,a.context=typeof o==`object`&&o?Z(o):Zr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ns(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&&Ps.enqueueReplaceState(a,a.state,null),La(t,r,a,i),Ia(),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=Ls(n,s);a.props=c;var l=a.context,u=n.contextType;o=Zr,typeof u==`object`&&u&&(o=Z(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)&&Is(t,a,r,o),Oa=!1;var f=t.memoizedState;a.state=f,La(t,r,a,i),Ia(),l=t.memoizedState,s||f!==l||Oa?(typeof d==`function`&&(Ns(t,n,d,r),l=t.memoizedState),(c=Oa||Fs(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,Aa(e,t),o=t.memoizedProps,u=Ls(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Zr,typeof l==`object`&&l&&(c=Z(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)&&Is(t,a,r,c),Oa=!1,f=t.memoizedState,a.state=f,La(t,r,a,i),Ia();var p=t.memoizedState;o!==d||f!==p||Oa||e!==null&&e.dependencies!==null&&Y(e.dependencies)?(typeof s==`function`&&(Ns(t,n,s,r),p=t.memoizedState),(u=Oa||Fs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Y(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,ac(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=Ea(t,e.child,null,i),t.child=Ea(t,null,n,i)):Ys(e,t,n,i),t.memoizedState=a.state,e=t.child):e=bc(e,t,i),e}function lc(e,t,n,r){return Pi(),t.flags|=256,Ys(e,t,n,r),t.child}var uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function dc(e){return{baseLanes:e,cachePool:la()}}function fc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Gl),e}function pc(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:(Qa.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Ei){if(a?qa(t):Xa(t),(e=Ti)?(e=rf(e,Oi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:gi===null?null:{id:_i,overflow:vi},retryLane:536870912,hydrationErrors:null},n=oi(e),n.return=t,t.child=n,wi=t,Ti=null)):e=null,e===null)throw Ai(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(Xa(t),a=t.mode,c=hc({mode:`hidden`,children:c},a),r=ii(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=dc(n),r.childLanes=fc(e,s,n),t.memoizedState=uc,ec(null,r)):(qa(t),mc(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=gc(e,t,n)):t.memoizedState===null?(Xa(t),c=r.fallback,a=t.mode,r=hc({mode:`visible`,children:r.children},a),c=ii(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ea(t,e.child,null,n),r=t.child,r.memoizedState=dc(n),r.childLanes=fc(e,s,n),t.memoizedState=uc,t=ec(null,r)):(Xa(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,Ii({value:r,source:null,stack:null}),t=gc(e,t,n)}else if(Js||Ui(e,t,n,!1),s=(n&e.childLanes)!==0,Js||s){if(s=Nl,s!==null&&(r=Qe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Jr(e,r),fu(s,e,r),qs;af(c)||wu(),t=gc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ti=cf(c.nextSibling),wi=t,Ei=!0,Di=null,Oi=!1,e!==null&&Ci(t,e),t=mc(t,r.children),t.flags|=4096);return t}return a?(Xa(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ti(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ii(c,a,n,null),c.flags|=2):c=ti(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ec(null,r),r=t.child,c=e.child.memoizedState,c===null?c=dc(n):(a=c.cachePool,a===null?a=la():(l=Yi._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=fc(e,s,n),t.memoizedState=uc,ec(e.child,r)):(qa(t),n=e.child,e=n.sibling,n=ti(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 mc(e,t){return t=hc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function hc(e,t){return e=$r(22,e,null,t),e.lanes=0,e}function gc(e,t,n){return Ea(t,e.child,null,n),e=mc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _c(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Hi(e.return,t,n)}function vc(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 yc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Qa.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,z(Qa,o),Ys(e,t,r,n),r=Ei?pi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&_c(e,n,t);else if(e.tag===19)_c(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&&$a(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),vc(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&&$a(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}vc(t,!0,n,null,a,r);break;case`together`:vc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function bc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Hl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ui(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=ti(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ti(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function xc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Y(e))):!0}function Sc(e,t,n){switch(t.tag){case 3:se(t,t.stateNode.containerInfo),Bi(t,Yi,e.memoizedState.cache),Pi();break;case 27:case 5:le(t);break;case 4:se(t,t.stateNode.containerInfo);break;case 10:Bi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ja(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(qa(t),e=bc(e,t,n),e===null?null:e.sibling):pc(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||=(Ui(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return yc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),z(Qa,Qa.current),r)break;return null;case 22:return t.lanes=0,$s(e,t,n,t.pendingProps);case 24:Bi(t,Yi,e.memoizedState.cache)}return bc(e,t,n)}function Cc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Js=!0;else{if(!xc(e,n)&&!(t.flags&128))return Js=!1,Sc(e,t,n);Js=!!(e.flags&131072)}else Js=!1,Ei&&t.flags&1048576&&bi(t,pi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ga(t.elementType),t.type=e,typeof e==`function`)ei(e)?(r=Ls(e,r),t.tag=1,t=cc(null,t,e,r,n)):(t.tag=0,t=oc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=Xs(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=Zs(null,t,e,r,n);break a}}throw t=te(e)||e,Error(i(306,t,``))}}return t;case 0:return oc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Ls(r,t.pendingProps),cc(e,t,r,a,n);case 3:a:{if(se(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Aa(e,t),La(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Bi(t,Yi,r),r!==o.cache&&J(t,[Yi],n,!0),Ia(),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=lc(e,t,r,n);break a}else if(r!==a){a=li(Error(i(424)),t),Ii(a),t=lc(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(Ti=cf(e.firstChild),wi=t,Ei=!0,Di=null,Oi=!0,n=Da(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Pi(),r===a){t=bc(e,t,n);break a}Ys(e,t,r,n)}t=t.child}return t;case 26:return ac(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ei||(n=t.type,e=t.pendingProps,r=Bd(ae.current).createElement(n),r[it]=t,r[at]=e,Pd(r,n,e),_t(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return le(t),e===null&&Ei&&(r=t.stateNode=ff(t.type,t.pendingProps,ae.current),wi=t,Oi=!0,a=Ti,Zd(t.type)?(lf=a,Ti=cf(r.firstChild)):Ti=a),Ys(e,t,t.pendingProps.children,n),ac(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ei&&((a=r=Ti)&&(r=tf(r,t.type,t.pendingProps,Oi),r===null?a=!1:(t.stateNode=r,wi=t,Ti=cf(r.firstChild),Oi=!1,a=!0)),a||Ai(t)),le(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=po(e,t,go,null,null,n),Qf._currentValue=a),ac(e,t),Ys(e,t,r,n),t.child;case 6:return e===null&&Ei&&((e=n=Ti)&&(n=nf(n,t.pendingProps,Oi),n===null?e=!1:(t.stateNode=n,wi=t,Ti=null,e=!0)),e||Ai(t)),null;case 13:return pc(e,t,n);case 4:return se(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ea(t,null,r,n):Ys(e,t,r,n),t.child;case 11:return Xs(e,t,t.type,t.pendingProps,n);case 7:return Ys(e,t,t.pendingProps,n),t.child;case 8:return Ys(e,t,t.pendingProps.children,n),t.child;case 12:return Ys(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Bi(t,t.type,r.value),Ys(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,X(t),a=Z(a),r=r(a),t.flags|=1,Ys(e,t,r,n),t.child;case 14:return Zs(e,t,t.type,t.pendingProps,n);case 15:return Qs(e,t,t.type,t.pendingProps,n);case 19:return yc(e,t,n);case 31:return ic(e,t,n);case 22:return $s(e,t,n,t.pendingProps);case 24:return X(t),r=Z(Yi),e===null?(a=sa(),a===null&&(a=Nl,o=Xi(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},ka(t),Bi(t,Yi,a)):((e.lanes&n)!==0&&(Aa(e,t),La(t,null,null,n),Ia()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Bi(t,Yi,r),r!==a.cache&&J(t,[Yi],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Bi(t,Yi,r))),Ys(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function wc(e){e.flags|=4}function Tc(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(xu())e.flags|=8192;else throw _a=pa,da}else e.flags&=-16777217}function Ec(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t))if(xu())e.flags|=8192;else throw _a=pa,da}function Dc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ke(),e.lanes|=t,Kl|=t)}function Oc(e,t){if(!Ei)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 kc(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 Ac(e,t,n){var r=t.pendingProps;switch(Si(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kc(t),null;case 1:return kc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Vi(Yi),ce(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ni(t)?wc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Fi())),kc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(wc(t),o===null?(kc(t),Tc(t,a,null,r,n)):(kc(t),Ec(t,o))):o?o===e.memoizedState?(kc(t),t.flags&=-16777217):(wc(t),kc(t),Ec(t,o)):(e=e.memoizedProps,e!==r&&wc(t),kc(t),Tc(t,a,e,r,n)),null;case 27:if(ue(t),n=ae.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&wc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return kc(t),null}e=ie.current,Ni(t)?ji(t,e):(e=ff(a,r,n),t.stateNode=e,wc(t))}return kc(t),null;case 5:if(ue(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&wc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return kc(t),null}if(o=ie.current,Ni(t))ji(t,o);else{var s=Bd(ae.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[it]=t,o[at]=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&&wc(t)}}return kc(t),Tc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&wc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ae.current,Ni(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=wi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[it]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Ai(t,!0)}else e=Bd(e).createTextNode(r),e[it]=t,t.stateNode=e}return kc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ni(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[it]=t}else Pi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;kc(t),e=!1}else n=Fi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Za(t),t):(Za(t),null);if(t.flags&128)throw Error(i(558))}return kc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ni(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[it]=t}else Pi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;kc(t),a=!1}else a=Fi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Za(t),t):(Za(t),null)}return Za(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),Dc(t,t.updateQueue),kc(t),null);case 4:return ce(),e===null&&xd(t.stateNode.containerInfo),kc(t),null;case 10:return Vi(t.type),kc(t),null;case 19:if(R(Qa),r=t.memoizedState,r===null)return kc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Oc(r,!1);else{if(Vl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=$a(e),o!==null){for(t.flags|=128,Oc(r,!1),e=o.updateQueue,t.updateQueue=e,Dc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ni(n,e),n=n.sibling;return z(Qa,Qa.current&1|2),Ei&&yi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ce()>Ql&&(t.flags|=128,a=!0,Oc(r,!1),t.lanes=4194304)}else{if(!a)if(e=$a(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Dc(t,e),Oc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ei)return kc(t),null}else 2*Ce()-r.renderingStartTime>Ql&&n!==536870912&&(t.flags|=128,a=!0,Oc(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?(kc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ce(),e.sibling=null,n=Qa.current,z(Qa,a?n&1|2:n&1),Ei&&yi(t,r.treeForkCount),e);case 22:case 23:return Za(t),Wa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(kc(t),t.subtreeFlags&6&&(t.flags|=8192)):kc(t),n=t.updateQueue,n!==null&&Dc(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&&R(oa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Vi(Yi),kc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function jc(e,t){switch(Si(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vi(Yi),ce(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ue(t),null;case 31:if(t.memoizedState!==null){if(Za(t),t.alternate===null)throw Error(i(340));Pi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Za(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Pi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(Qa),null;case 4:return ce(),null;case 10:return Vi(t.type),null;case 22:case 23:return Za(t),Wa(),e!==null&&R(oa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Vi(Yi),null;case 25:return null;default:return null}}function Mc(e,t){switch(Si(t),t.tag){case 3:Vi(Yi),ce();break;case 26:case 27:case 5:ue(t);break;case 4:ce();break;case 31:t.memoizedState!==null&&Za(t);break;case 13:Za(t);break;case 19:R(Qa);break;case 10:Vi(t.type);break;case 22:case 23:Za(t),Wa(),e!==null&&R(oa);break;case 24:Vi(Yi)}}function Nc(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){Hu(t,t.return,e)}}function Pc(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){Hu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Hu(t,t.return,e)}}function Fc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{za(t,n)}catch(t){Hu(e,e.return,t)}}}function Ic(e,t,n){n.props=Ls(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Hu(e,t,n)}}function Lc(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){Hu(e,t,n)}}function Rc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Hu(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){Hu(e,t,n)}else n.current=null}function zc(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){Hu(e,e.return,t)}}function Bc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[at]=t}catch(t){Hu(e,e.return,t)}}function Vc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Hc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Vc(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 Uc(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=Yt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Uc(e,t,n),e=e.sibling;e!==null;)Uc(e,t,n),e=e.sibling}function Wc(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(Wc(e,t,n),e=e.sibling;e!==null;)Wc(e,t,n),e=e.sibling}function Gc(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[it]=e,t[at]=n}catch(t){Hu(e,e.return,t)}}var Kc=!1,qc=!1,Jc=!1,Yc=typeof WeakSet==`function`?WeakSet:Set,Xc=null;function Zc(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,Xc=t;Xc!==null;)if(t=Xc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Xc=e;else for(;Xc!==null;){switch(t=Xc,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=Ls(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Hu(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,Xc=e;break}Xc=t.return}}function Qc(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:pl(e,n),r&4&&Nc(5,n);break;case 1:if(pl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Hu(n,n.return,e)}else{var i=Ls(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Hu(n,n.return,e)}}r&64&&Fc(n),r&512&&Lc(n,n.return);break;case 3:if(pl(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{za(e,t)}catch(e){Hu(n,n.return,e)}}break;case 27:t===null&&r&4&&Gc(n);case 26:case 5:pl(e,n),t===null&&r&4&&zc(n),r&512&&Lc(n,n.return);break;case 12:pl(e,n);break;case 31:pl(e,n),r&4&&il(e,n);break;case 13:pl(e,n),r&4&&al(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Ku.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Kc,!r){t=t!==null&&t.memoizedState!==null||qc,i=Kc;var a=qc;Kc=r,(qc=t)&&!a?hl(e,n,(n.subtreeFlags&8772)!=0):pl(e,n),Kc=i,qc=a}break;case 30:break;default:pl(e,n)}}function $c(e){var t=e.alternate;t!==null&&(e.alternate=null,$c(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ft(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 el=null,tl=!1;function nl(e,t,n){for(n=n.child;n!==null;)rl(e,t,n),n=n.sibling}function rl(e,t,n){if(Ne&&typeof Ne.onCommitFiberUnmount==`function`)try{Ne.onCommitFiberUnmount(Me,n)}catch{}switch(n.tag){case 26:qc||Rc(n,t),nl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:qc||Rc(n,t);var r=el,i=tl;Zd(n.type)&&(el=n.stateNode,tl=!1),nl(e,t,n),pf(n.stateNode),el=r,tl=i;break;case 5:qc||Rc(n,t);case 6:if(r=el,i=tl,el=null,nl(e,t,n),el=r,tl=i,el!==null)if(tl)try{(el.nodeType===9?el.body:el.nodeName===`HTML`?el.ownerDocument.body:el).removeChild(n.stateNode)}catch(e){Hu(n,t,e)}else try{el.removeChild(n.stateNode)}catch(e){Hu(n,t,e)}break;case 18:el!==null&&(tl?(e=el,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(el,n.stateNode));break;case 4:r=el,i=tl,el=n.stateNode.containerInfo,tl=!0,nl(e,t,n),el=r,tl=i;break;case 0:case 11:case 14:case 15:Pc(2,n,t),qc||Pc(4,n,t),nl(e,t,n);break;case 1:qc||(Rc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Ic(n,t,r)),nl(e,t,n);break;case 21:nl(e,t,n);break;case 22:qc=(r=qc)||n.memoizedState!==null,nl(e,t,n),qc=r;break;default:nl(e,t,n)}}function il(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Hu(t,t.return,e)}}}function al(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){Hu(t,t.return,e)}}function ol(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Yc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Yc),t;default:throw Error(i(435,e.tag))}}function sl(e,t){var n=ol(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=qu.bind(null,e,t);t.then(r,r)}})}function cl(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)){el=c.stateNode,tl=!1;break a}break;case 5:el=c.stateNode,tl=!1;break a;case 3:case 4:el=c.stateNode.containerInfo,tl=!0;break a}c=c.return}if(el===null)throw Error(i(160));rl(o,s,a),el=null,tl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ul(t,e),t=t.sibling}var ll=null;function ul(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:cl(t,e),dl(e),r&4&&(Pc(3,e,e.return),Nc(3,e),Pc(5,e,e.return));break;case 1:cl(t,e),dl(e),r&512&&(qc||n===null||Rc(n,n.return)),r&64&&Kc&&(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=ll;if(cl(t,e),dl(e),r&512&&(qc||n===null||Rc(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[dt]||o[it]||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[it]=e,_t(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[it]=e,_t(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&&Bc(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:cl(t,e),dl(e),r&512&&(qc||n===null||Rc(n,n.return)),n!==null&&r&4&&Bc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(cl(t,e),dl(e),r&512&&(qc||n===null||Rc(n,n.return)),e.flags&32){a=e.stateNode;try{Ht(a,``)}catch(t){Hu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Bc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Jc=!0);break;case 6:if(cl(t,e),dl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Hu(e,e.return,t)}}break;case 3:if(Bf=null,a=ll,ll=gf(t.containerInfo),cl(t,e),ll=a,dl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Hu(e,e.return,t)}Jc&&(Jc=!1,fl(e));break;case 4:r=ll,ll=gf(e.stateNode.containerInfo),cl(t,e),dl(e),ll=r;break;case 12:cl(t,e),dl(e);break;case 31:cl(t,e),dl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 13:cl(t,e),dl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Xl=Ce()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Kc,d=qc;if(Kc=u||a,qc=d||l,cl(t,e),qc=d,Kc=u,dl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Kc||qc||ml(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){Hu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Hu(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){Hu(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,sl(e,n))));break;case 19:cl(t,e),dl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 30:break;case 21:break;default:cl(t,e),dl(e)}}function dl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Vc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Wc(e,Hc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Ht(o,``),n.flags&=-33),Wc(e,Hc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Uc(e,Hc(e),s);break;default:throw Error(i(161))}}catch(t){Hu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function fl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;fl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function pl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Qc(e,t.alternate,t),t=t.sibling}function ml(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Pc(4,t,t.return),ml(t);break;case 1:Rc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Ic(t,t.return,n),ml(t);break;case 27:pf(t.stateNode);case 26:case 5:Rc(t,t.return),ml(t);break;case 22:t.memoizedState===null&&ml(t);break;case 30:ml(t);break;default:ml(t)}e=e.sibling}}function hl(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:hl(i,a,n),Nc(4,a);break;case 1:if(hl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Hu(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++)Ra(c[i],s)}catch(e){Hu(r,r.return,e)}}n&&o&64&&Fc(a),Lc(a,a.return);break;case 27:Gc(a);case 26:case 5:hl(i,a,n),n&&r===null&&o&4&&zc(a),Lc(a,a.return);break;case 12:hl(i,a,n);break;case 31:hl(i,a,n),n&&o&4&&il(i,a);break;case 13:hl(i,a,n),n&&o&4&&al(i,a);break;case 22:a.memoizedState===null&&hl(i,a,n),Lc(a,a.return);break;case 30:break;default:hl(i,a,n)}t=t.sibling}}function gl(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&&Zi(n))}function _l(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Zi(e))}function vl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)yl(e,t,n,r),t=t.sibling}function yl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:vl(e,t,n,r),i&2048&&Nc(9,t);break;case 1:vl(e,t,n,r);break;case 3:vl(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&&Zi(e)));break;case 12:if(i&2048){vl(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){Hu(t,t.return,e)}}else vl(e,t,n,r);break;case 31:vl(e,t,n,r);break;case 13:vl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?vl(e,t,n,r):(a._visibility|=2,bl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?vl(e,t,n,r):xl(e,t),i&2048&&gl(o,t);break;case 24:vl(e,t,n,r),i&2048&&_l(t.alternate,t);break;default:vl(e,t,n,r)}}function bl(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:bl(a,o,s,c,i),Nc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,bl(a,o,s,c,i)):u._visibility&2?bl(a,o,s,c,i):xl(a,o),i&&l&2048&&gl(o.alternate,o);break;case 24:bl(a,o,s,c,i),i&&l&2048&&_l(o.alternate,o);break;default:bl(a,o,s,c,i)}t=t.sibling}}function xl(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:xl(n,r),i&2048&&gl(r.alternate,r);break;case 24:xl(n,r),i&2048&&_l(r.alternate,r);break;default:xl(n,r)}t=t.sibling}}var Sl=8192;function Cl(e,t,n){if(e.subtreeFlags&Sl)for(e=e.child;e!==null;)wl(e,t,n),e=e.sibling}function wl(e,t,n){switch(e.tag){case 26:Cl(e,t,n),e.flags&Sl&&e.memoizedState!==null&&Gf(n,ll,e.memoizedState,e.memoizedProps);break;case 5:Cl(e,t,n);break;case 3:case 4:var r=ll;ll=gf(e.stateNode.containerInfo),Cl(e,t,n),ll=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Sl,Sl=16777216,Cl(e,t,n),Sl=r):Cl(e,t,n));break;default:Cl(e,t,n)}}function Tl(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 El(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Xc=r,kl(r,e)}Tl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Dl(e),e=e.sibling}function Dl(e){switch(e.tag){case 0:case 11:case 15:El(e),e.flags&2048&&Pc(9,e,e.return);break;case 3:El(e);break;case 12:El(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ol(e)):El(e);break;default:El(e)}}function Ol(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Xc=r,kl(r,e)}Tl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Pc(8,t,t.return),Ol(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ol(t));break;default:Ol(t)}e=e.sibling}}function kl(e,t){for(;Xc!==null;){var n=Xc;switch(n.tag){case 0:case 11:case 15:Pc(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:Zi(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Xc=r;else a:for(n=e;Xc!==null;){r=Xc;var i=r.sibling,a=r.return;if($c(r),r===n){Xc=null;break a}if(i!==null){i.return=a,Xc=i;break a}Xc=a}}}var Al={getCacheForType:function(e){var t=Z(Yi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Z(Yi).controller.signal}},jl=typeof WeakMap==`function`?WeakMap:Map,Ml=0,Nl=null,$=null,Pl=0,Fl=0,Il=null,Ll=!1,Rl=!1,zl=!1,Bl=0,Vl=0,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=null,Jl=null,Yl=!1,Xl=0,Zl=0,Ql=1/0,$l=null,eu=null,tu=0,nu=null,ru=null,iu=0,au=0,ou=null,su=null,cu=0,lu=null;function uu(){return Ml&2&&Pl!==0?Pl&-Pl:N.T===null?tt():ld()}function du(){if(Gl===0)if(!(Pl&536870912)||Ei){var e=Be;Be<<=1,!(Be&3932160)&&(Be=262144),Gl=e}else Gl=536870912;return e=Ga.current,e!==null&&(e.flags|=32),Gl}function fu(e,t,n){(e===Nl&&(Fl===2||Fl===9)||e.cancelPendingCommit!==null)&&(yu(e,0),gu(e,Pl,Gl,!1)),Je(e,n),(!(Ml&2)||e!==Nl)&&(e===Nl&&(!(Ml&2)&&(Ul|=n),Vl===4&&gu(e,Pl,Gl,!1)),td(e))}function pu(e,t,n){if(Ml&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||We(e,t),a=r?Du(e,t):Tu(e,t,!0),o=r;do{if(a===0){Rl&&!r&&gu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!hu(n)){a=Tu(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=ql;var l=c.current.memoizedState.isDehydrated;if(l&&(yu(c,s).flags|=256),s=Tu(c,s,!1),s!==2){if(zl&&!l){c.errorRecoveryDisabledLanes|=o,Ul|=o,a=4;break a}o=Jl,Jl=a,o!==null&&(Jl===null?Jl=o:Jl.push.apply(Jl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){yu(e,0),gu(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:gu(r,t,Gl,!Ll);break a;case 2:Jl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Xl+300-Ce(),10<a)){if(gu(r,t,Gl,!Ll),Ue(r,0,!0)!==0)break a;iu=t,r.timeoutHandle=Kd(mu.bind(null,r,n,Jl,$l,Yl,t,Gl,Ul,Kl,Ll,o,`Throttled`,-0,0),a);break a}mu(r,n,Jl,$l,Yl,t,Gl,Ul,Kl,Ll,o,null,-0,0)}}break}while(1);td(e)}function mu(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:Yt},wl(t,a,d);var m=(a&62914560)===a?Xl-Ce():(a&4194048)===a?Zl-Ce():0;if(m=qf(d,m),m!==null){iu=a,e.cancelPendingCommit=m(Pu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),gu(e,a,o,!l);return}}Pu(e,t,a,n,r,i,o,s,c)}function hu(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 gu(e,t,n,r){t&=~Wl,t&=~Ul,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Fe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Xe(e,n,t)}function _u(){return Ml&6?!0:(nd(0,!1),!1)}function vu(){if($!==null){if(Fl===0)var e=$.return;else e=$,zi=Ri=null,yo(e),ba=null,xa=0,e=$;for(;e!==null;)Mc(e.alternate,e),e=e.return;$=null}}function yu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),iu=0,vu(),Nl=e,$=n=ti(e.current,null),Pl=t,Fl=0,Il=null,Ll=!1,Rl=We(e,t),zl=!1,Kl=Gl=Wl=Ul=Hl=Vl=0,Jl=ql=null,Yl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Fe(r),a=1<<i;t|=e[i],r&=~a}return Bl=t,q(),n}function bu(e,t){Q=null,N.H=ks,t===ua||t===fa?(t=va(),Fl=3):t===da?(t=va(),Fl=4):Fl=t===qs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Il=t,$===null&&(Vl=1,Vs(e,li(t,e.current)))}function xu(){var e=Ga.current;return e===null?!0:(Pl&4194048)===Pl?Ka===null:(Pl&62914560)===Pl||Pl&536870912?e===Ka:!1}function Su(){var e=N.H;return N.H=ks,e===null?ks:e}function Cu(){var e=N.A;return N.A=Al,e}function wu(){Vl=4,Ll||(Pl&4194048)!==Pl&&Ga.current!==null||(Rl=!0),!(Hl&134217727)&&!(Ul&134217727)||Nl===null||gu(Nl,Pl,Gl,!1)}function Tu(e,t,n){var r=Ml;Ml|=2;var i=Su(),a=Cu();(Nl!==e||Pl!==t)&&($l=null,yu(e,t)),t=!1;var o=Vl;a:do try{if(Fl!==0&&$!==null){var s=$,c=Il;switch(Fl){case 8:vu(),o=6;break a;case 3:case 2:case 9:case 6:Ga.current===null&&(t=!0);var l=Fl;if(Fl=0,Il=null,ju(e,s,c,l),n&&Rl){o=0;break a}break;default:l=Fl,Fl=0,Il=null,ju(e,s,c,l)}}Eu(),o=Vl;break}catch(t){bu(e,t)}while(1);return t&&e.shellSuspendCounter++,zi=Ri=null,Ml=r,N.H=i,N.A=a,$===null&&(Nl=null,Pl=0,q()),o}function Eu(){for(;$!==null;)ku($)}function Du(e,t){var n=Ml;Ml|=2;var r=Su(),a=Cu();Nl!==e||Pl!==t?($l=null,Ql=Ce()+500,yu(e,t)):Rl=We(e,t);a:do try{if(Fl!==0&&$!==null){t=$;var o=Il;b:switch(Fl){case 1:Fl=0,Il=null,ju(e,t,o,1);break;case 2:case 9:if(ma(o)){Fl=0,Il=null,Au(t);break}t=function(){Fl!==2&&Fl!==9||Nl!==e||(Fl=7),td(e)},o.then(t,t);break a;case 3:Fl=7;break a;case 4:Fl=5;break a;case 7:ma(o)?(Fl=0,Il=null,Au(t)):(Fl=0,Il=null,ju(e,t,o,7));break;case 5:var s=null;switch($.tag){case 26:s=$.memoizedState;case 5:case 27:var c=$;if(s?Wf(s):c.stateNode.complete){Fl=0,Il=null;var l=c.sibling;if(l!==null)$=l;else{var u=c.return;u===null?$=null:($=u,Mu(u))}break b}}Fl=0,Il=null,ju(e,t,o,5);break;case 6:Fl=0,Il=null,ju(e,t,o,6);break;case 8:vu(),Vl=6;break a;default:throw Error(i(462))}}Ou();break}catch(t){bu(e,t)}while(1);return zi=Ri=null,N.H=r,N.A=a,Ml=n,$===null?(Nl=null,Pl=0,q(),Vl):0}function Ou(){for(;$!==null&&!xe();)ku($)}function ku(e){var t=Cc(e.alternate,e,Bl);e.memoizedProps=e.pendingProps,t===null?Mu(e):$=t}function Au(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=sc(n,t,t.pendingProps,t.type,void 0,Pl);break;case 11:t=sc(n,t,t.pendingProps,t.type.render,t.ref,Pl);break;case 5:yo(t);default:Mc(n,t),t=$=ni(t,Bl),t=Cc(n,t,Bl)}e.memoizedProps=e.pendingProps,t===null?Mu(e):$=t}function ju(e,t,n,r){zi=Ri=null,yo(t),ba=null,xa=0;var i=t.return;try{if(Ks(e,i,t,n,Pl)){Vl=1,Vs(e,li(n,e.current)),$=null;return}}catch(t){if(i!==null)throw $=i,t;Vl=1,Vs(e,li(n,e.current)),$=null;return}t.flags&32768?(Ei||r===1?e=!0:Rl||Pl&536870912?e=!1:(Ll=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ga.current,r!==null&&r.tag===13&&(r.flags|=16384))),Nu(t,e)):Mu(t)}function Mu(e){var t=e;do{if(t.flags&32768){Nu(t,Ll);return}e=t.return;var n=Ac(t.alternate,t,Bl);if(n!==null){$=n;return}if(t=t.sibling,t!==null){$=t;return}$=t=e}while(t!==null);Vl===0&&(Vl=5)}function Nu(e,t){do{var n=jc(e.alternate,e);if(n!==null){n.flags&=32767,$=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){$=e;return}$=e=n}while(e!==null);Vl=6,$=null}function Pu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do zu();while(tu!==0);if(Ml&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Gr,Ye(e,n,o,s,c,l),e===Nl&&($=Nl=null,Pl=0),ru=t,nu=e,iu=n,au=o,ou=a,su=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Ju(De,function(){return Bu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=N.T,N.T=null,a=P.p,P.p=2,s=Ml,Ml|=4;try{Zc(e,t,n)}finally{Ml=s,P.p=a,N.T=r}}tu=1,Fu(),Iu(),Lu()}}function Fu(){if(tu===1){tu=0;var e=nu,t=ru,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Ml;Ml|=4;try{ul(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{Ml=i,P.p=r,N.T=n}}e.current=t,tu=2}}function Iu(){if(tu===2){tu=0;var e=nu,t=ru,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Ml;Ml|=4;try{Qc(e,t.alternate,t)}finally{Ml=i,P.p=r,N.T=n}}tu=3}}function Lu(){if(tu===4||tu===3){tu=0,Se();var e=nu,t=ru,n=iu,r=su;t.subtreeFlags&10256||t.flags&10256?tu=5:(tu=0,ru=nu=null,Ru(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(eu=null),et(n),t=t.stateNode,Ne&&typeof Ne.onCommitFiberRoot==`function`)try{Ne.onCommitFiberRoot(Me,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=N.T,i=P.p,P.p=2,N.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{N.T=t,P.p=i}}iu&3&&zu(),td(e),i=e.pendingLanes,n&261930&&i&42?e===lu?cu++:(cu=0,lu=e):cu=0,nd(0,!1)}}function Ru(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Zi(t)))}function zu(){return Fu(),Iu(),Lu(),Bu()}function Bu(){if(tu!==5)return!1;var e=nu,t=au;au=0;var n=et(iu),r=N.T,a=P.p;try{P.p=32>n?32:n,N.T=null,n=ou,ou=null;var o=nu,s=iu;if(tu=0,ru=nu=null,iu=0,Ml&6)throw Error(i(331));var c=Ml;if(Ml|=4,Dl(o.current),yl(o,o.current,s,n),Ml=c,nd(0,!1),Ne&&typeof Ne.onPostCommitFiberRoot==`function`)try{Ne.onPostCommitFiberRoot(Me,o)}catch{}return!0}finally{P.p=a,N.T=r,Ru(e,t)}}function Vu(e,t,n){t=li(n,t),t=Us(e.stateNode,t,2),e=Ma(e,t,2),e!==null&&(Je(e,2),td(e))}function Hu(e,t,n){if(e.tag===3)Vu(e,e,n);else for(;t!==null;){if(t.tag===3){Vu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(eu===null||!eu.has(r))){e=li(n,e),n=Ws(2),r=Ma(t,n,2),r!==null&&(Gs(n,r,t,e),Je(r,2),td(r));break}}t=t.return}}function Uu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new jl;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)||(zl=!0,i.add(n),e=Wu.bind(null,e,t,n),t.then(e,e))}function Wu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Nl===e&&(Pl&n)===n&&(Vl===4||Vl===3&&(Pl&62914560)===Pl&&300>Ce()-Xl?!(Ml&2)&&yu(e,0):Wl|=n,Kl===Pl&&(Kl=0)),td(e)}function Gu(e,t){t===0&&(t=Ke()),e=Jr(e,t),e!==null&&(Je(e,t),td(e))}function Ku(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gu(e,n)}function qu(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),Gu(e,n)}function Ju(e,t){return ye(e,t)}var Yu=null,Xu=null,Zu=!1,Qu=!1,$u=!1,ed=0;function td(e){e!==Xu&&e.next===null&&(Xu===null?Yu=Xu=e:Xu=Xu.next=e),Qu=!0,Zu||(Zu=!0,cd())}function nd(e,t){if(!$u&&Qu){$u=!0;do for(var n=!1,r=Yu;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-Fe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,sd(r,a))}else a=Pl,a=Ue(r,r===Nl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||We(r,a)||(n=!0,sd(r,a));r=r.next}while(n);$u=!1}}function rd(){id()}function id(){Qu=Zu=!1;var e=0;ed!==0&&Gd()&&(e=ed);for(var t=Ce(),n=null,r=Yu;r!==null;){var i=r.next,a=ad(r,t);a===0?(r.next=null,n===null?Yu=i:n.next=i,i===null&&(Xu=n)):(n=r,(e!==0||a&3)&&(Qu=!0)),r=i}tu!==0&&tu!==5||nd(e,!1),ed!==0&&(ed=0)}function ad(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Fe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ge(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Nl,n=Pl,n=Ue(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Fl===2||Fl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&be(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||We(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&be(r),et(n)){case 2:case 8:n=Ee;break;case 32:n=De;break;case 268435456:n=ke;break;default:n=De}return r=od.bind(null,e),n=ye(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&be(r),e.callbackPriority=2,e.callbackNode=null,2}function od(e,t){if(tu!==0&&tu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(zu()&&e.callbackNode!==n)return null;var r=Pl;return r=Ue(e,e===Nl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(pu(e,r,t),ad(e,Ce()),e.callbackNode!=null&&e.callbackNode===n?od.bind(null,e):null)}function sd(e,t){if(zu())return null;pu(e,t,!0)}function cd(){Yd(function(){Ml&6?ye(Te,rd):id()})}function ld(){if(ed===0){var e=ea;e===0&&(e=ze,ze<<=1,!(ze&261888)&&(ze=256)),ed=e}return ed}function ud(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Jt(``+e)}function dd(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 fd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=ud((i[at]||null).action),o=r.submitter;o&&(t=(t=o[at]||null)?ud(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new _n(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ed!==0){var e=o?dd(i,o):new FormData(i);hs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?dd(i,o):new FormData(i),hs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var pd=0;pd<Vr.length;pd++){var md=Vr[pd];K(md.toLowerCase(),`on`+(md[0].toUpperCase()+md.slice(1)))}K(Nr,`onAnimationEnd`),K(Pr,`onAnimationIteration`),K(Fr,`onAnimationStart`),K(`dblclick`,`onDoubleClick`),K(`focusin`,`onFocus`),K(`focusout`,`onBlur`),K(Ir,`onTransitionRun`),K(Lr,`onTransitionStart`),K(Rr,`onTransitionCancel`),K(zr,`onTransitionEnd`),xt(`onMouseEnter`,[`mouseout`,`mouseover`]),xt(`onMouseLeave`,[`mouseout`,`mouseover`]),xt(`onPointerEnter`,[`pointerout`,`pointerover`]),xt(`onPointerLeave`,[`pointerout`,`pointerover`]),bt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),bt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),bt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),bt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var hd=`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(` `),gd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(hd));function _d(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){Hr(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){Hr(e)}i.currentTarget=null,a=c}}}}function vd(e,t){var n=t[st];n===void 0&&(n=t[st]=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,vt.forEach(function(t){t!==`selectionchange`&&(gd.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,!on||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=pt(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}nn(function(){var r=a,i=Zt(n),s=[];a:{var c=Br.get(e);if(c!==void 0){var l=_n,u=e;switch(e){case`keypress`:if(fn(n)===0)break a;case`keydown`:case`keyup`:l=Fn;break;case`focusin`:u=`focus`,l=En;break;case`focusout`:u=`blur`,l=En;break;case`beforeblur`:case`afterblur`:l=En;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=wn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Tn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Ln;break;case Nr:case Pr:case Fr:l=Dn;break;case zr:l=Rn;break;case`scroll`:case`scrollend`:l=yn;break;case`wheel`:l=zn;break;case`copy`:case`cut`:case`paste`:l=On;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=In;break;case`toggle`:case`beforetoggle`:l=Bn}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=rn(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!==Xt&&(u=n.relatedTarget||n.fromElement)&&(pt(u)||u[ot]))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?pt(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=wn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=In,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:ht(l),h=u==null?c:ht(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,pt(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?ht(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=or;else if(er(c))if(U)v=hr;else{v=pr;var y=fr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&H(r.elementType)&&(v=or):v=mr;if(v&&=v(e,r)){tr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&zt(c,`number`,c.value)}switch(y=r?ht(r):window,e){case`focusin`:(er(y)||y.contentEditable===`true`)&&(G=y,wr=r,Tr=null);break;case`focusout`:Tr=wr=G=null;break;case`mousedown`:Er=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Er=!1,Dr(s,n,i);break;case`selectionchange`:if(Cr)break;case`keydown`:case`keyup`:Dr(s,n,i)}var b;if(Hn)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 Xn?Jn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Gn&&n.locale!==`ko`&&(Xn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Xn&&(b=dn()):(cn=i,ln=`value`in cn?cn.value:cn.textContent,Xn=!0)),y=Td(r,x),0<y.length&&(x=new kn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Yn(n),b!==null&&(x.data=b)))),(b=Wn?Zn(e,n):Qn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new kn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),fd(s,e,r,n,i)}_d(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=rn(e,n),i!=null&&r.unshift(wd(e,i,a)),i=rn(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=rn(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=rn(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
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===``||Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ht(e,``+r);break;case`className`:Dt(e,`class`,r);break;case`tabIndex`:Dt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Dt(e,n,r);break;case`style`:Gt(e,r,o);break;case`data`:if(t!==`object`){Dt(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=Jt(``+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=Jt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`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=Jt(``+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`:vd(`beforetoggle`,e),vd(`toggle`,e),Et(e,`popover`,r);break;case`xlinkActuate`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Et(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=Kt.get(n)||n,Et(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:Gt(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`?Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ht(e,``+r);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!yt.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[at]||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,``):Et(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`:vd(`error`,e),vd(`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`:vd(`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)}}Rt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in vd(`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&&V(e,!!r,n,!0):V(e,!!r,t,!1);return;case`textarea`:for(s in vd(`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)}Vt(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`:vd(`beforetoggle`,e),vd(`toggle`,e),vd(`cancel`,e),vd(`close`,e);break;case`iframe`:case`object`:vd(`load`,e);break;case`video`:case`audio`:for(r=0;r<hd.length;r++)vd(hd[r],e);break;case`image`:vd(`error`,e),vd(`load`,e);break;case`details`:vd(`toggle`,e);break;case`embed`:case`source`:case`link`:vd(`error`,e),vd(`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(H(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)}}Lt(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?V(e,!!n,n?[]:``,!1):V(e,!!n,t,!0)):V(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)}Bt(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(H(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[dt]||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),ft(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[dt])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]);ft(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=P.d;P.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=_u();return e||t}function yf(e){var t=mt(e);t!==null&&t.tag===5&&t.type===`form`?_s(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=It(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),_t(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="`+It(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+It(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+It(n.imageSizes)+`"]`)):i+=`[href="`+It(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),_t(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="`+It(r)+`"][href="`+It(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),_t(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=gt(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`);_t(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=gt(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`),_t(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=gt(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`),_t(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=ae.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=gt(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=gt(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=gt(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="`+It(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),_t(t),e.head.appendChild(t))}function Pf(e){return`[src="`+It(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~="`+It(n.href)+`"]`);if(r)return t.instance=r,_t(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`),_t(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,_t(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),_t(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,_t(a),a):(r=n,(a=mf.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),_t(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[dt]||a[it]||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,_t(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),_t(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:F,_currentValue2:F,_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=$r(3,null,null,t),e.current=a,a.stateNode=e,t=Xi(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ka(a),e}function tp(e){return e?(e=Zr,e):Zr}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=ja(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ma(e,r,t),n!==null&&(fu(n,e,t),Na(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=Jr(e,67108864);t!==null&&fu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=uu();t=$e(t);var n=Jr(e,t);n!==null&&fu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=2,up(e,t,n,r)}finally{P.p=a,N.T=i}}function lp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=8,up(e,t,n,r)}finally{P.p=a,N.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=mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=He(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Fe(o);s.entanglements[1]|=c,o&=~c}td(a),!(Ml&6)&&(Ql=Ce()+500,nd(0,!1))}}break;case 31:case 13:s=Jr(a,2),s!==null&&fu(s,a,2),_u(),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=Zt(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=pt(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(we()){case Te:return 2;case Ee:return 8;case De:case Oe:return 32;case ke: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=mt(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=pt(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,nt(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,nt(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);Xt=r,n.target.dispatchEvent(r),Xt=null}else return t=mt(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=mt(n);a!==null&&(e.splice(t,3),t-=3,hs(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[at]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[at]||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,uu(),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),_u(),t[ot]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=tt();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`));P.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:N,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Me=zp.inject(Rp),Ne=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Rs,s=zs,c=Bs;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[ot]=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=`ssg:ui:font-scale:v1`,y=[{label:`S`,value:.9},{label:`M`,value:1},{label:`L`,value:1.15},{label:`XL`,value:1.3}],b=1;function x(e){if(typeof e!=`number`||!Number.isFinite(e))return b;let t=y.find(t=>Math.abs(t.value-e)<.001);return t?t.value:b}function S(){if(typeof localStorage>`u`)return b;try{let e=localStorage.getItem(v);return e===null?b:x(parseFloat(e))}catch{return b}}function C(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(v,String(e))}catch{}}function w(e){typeof document>`u`||(document.documentElement.style.setProperty(`--ssg-font-scale`,String(e)),document.documentElement.style.fontSize=`${16*e}px`)}function T(){let[e,t]=(0,_.useState)(()=>{let e=S();return w(e),e});return(0,_.useEffect)(()=>{w(e)},[e]),{scale:e,setScale:(0,_.useCallback)(e=>{t(e),C(e),w(e)},[])}}var E=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})),D=o(((e,t)=>{t.exports=E()}))();function O(){let{scale:e,setScale:t}=T();return(0,D.jsx)(`div`,{role:`radiogroup`,"aria-label":`Font size`,className:`hig-segmented`,style:{height:`24px`},children:y.map(n=>{let r=Math.abs(n.value-e)<.001;return(0,D.jsx)(`button`,{role:`radio`,"aria-checked":r,"aria-selected":r,onClick:()=>t(n.value),title:`Font size: ${n.label} (${Math.round(n.value*100)}%)`,className:r?`selected`:``,style:{height:`20px`,padding:`0 8px`,fontSize:`11px`},children:n.label},n.label)})})}var k=`ssg:ui:theme:v1`,ee=[{label:`System (Auto)`,value:`default`},{label:`Apple Light`,value:`apple-light`},{label:`Apple Dark`,value:`apple-dark`},{label:`Light (Legacy)`,value:`light`},{label:`Dracula`,value:`dracula`},{label:`Gruvbox Dark`,value:`gruvbox-dark`},{label:`Gruvbox Light`,value:`gruvbox-light`},{label:`Tokyo Night`,value:`tokyo-night`},{label:`Catppuccin Mocha`,value:`catppuccin-mocha`},{label:`Nord`,value:`nord`},{label:`One Dark Pro`,value:`one-dark-pro`}],A=new Set([`light`,`gruvbox-light`,`apple-light`]),j=new Set([`apple-dark`,`dracula`,`gruvbox-dark`,`tokyo-night`,`catppuccin-mocha`,`nord`,`one-dark-pro`]),M=`default`;function te(e){return typeof e==`string`&&ee.some(t=>t.value===e)}function ne(){if(typeof localStorage>`u`)return M;try{let e=localStorage.getItem(k);return te(e)?e:M}catch{return M}}function N(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(k,e)}catch{}}function P(e){typeof document>`u`||(e===M?(document.documentElement.removeAttribute(`data-theme`),document.documentElement.style.colorScheme=`light dark`):(document.documentElement.setAttribute(`data-theme`,e),document.documentElement.style.colorScheme=A.has(e)?`light`:j.has(e)?`dark`:`light dark`))}function F(){let[e,t]=(0,_.useState)(()=>{let e=ne();return P(e),e});return(0,_.useEffect)(()=>{P(e)},[e]),{theme:e,setTheme:(0,_.useCallback)(e=>{t(e),N(e),P(e)},[])}}function re(){let{theme:e,setTheme:t}=F();return(0,D.jsx)(`select`,{value:e,onChange:e=>t(e.target.value),"aria-label":`Color theme`,title:`Color theme`,className:`hig-input cursor-pointer`,style:{height:`24px`,paddingRight:`22px`,minWidth:`90px`},children:ee.map(e=>(0,D.jsx)(`option`,{value:e.value,children:e.label},e.value))})}function I(){return{target:`[data-tutorial="app-tutorial-btn"]`,title:`Replay anytime`,body:`That's the tour. Reopen this walkthrough whenever you need it from the Tutorial button — every page has its own.`,placement:`bottom`}}function L(){return{target:`[data-tutorial="app-sidebar"]`,title:`Move around`,body:`The sidebar groups every dashboard area — Overview, Rules, Activity and Tools. Your current page stays highlighted.`,placement:`right`}}var R={"home-pro":{id:`home-pro`,title:`Dashboard`,steps:[{title:`Welcome to SigmaShake`,body:`SigmaShake governs what your AI coding agents are allowed to do. This is your Dashboard — a live, customizable view of every decision the engine is making right now.`},{target:`[data-tutorial="cb-grid"]`,title:`Live panels`,body:`These panels stream straight from the governance engine: eval counters, the allow/block/ask decision mix, a telemetry feed and system vitals. They refresh on their own — no reload needed.`},{target:`[data-tutorial="cb-layout"]`,title:`Make it yours`,body:`Use the layout controls to enter edit mode, then drag and resize panels or swap layout presets. SigmaShake remembers the arrangement on this device.`,placement:`bottom`},{target:`[data-tutorial="app-mode"]`,title:`Enforcement mode`,body:`This pill controls how hard SigmaShake enforces. Cycle On → Soft → Audit → Off when you need to temporarily loosen the guardrails.`,placement:`bottom`},L(),I()]},"home-newcomer":{id:`home-newcomer`,title:`Home`,steps:[{title:`Welcome to SigmaShake`,body:`SigmaShake is a seatbelt for AI coding agents — it checks every action your agent takes and stops the risky ones. Here's the quick tour.`},{target:`[data-tutorial="wh-hero"]`,title:`Today at a glance`,body:`These counters show how many actions your AI agent took today and how SigmaShake responded to each one.`,placement:`bottom`},{target:`[data-tutorial="wh-actions"]`,title:`Start here`,body:`These cards are your shortcuts — connect an AI agent, choose guardrails, and review activity. Work through them top to bottom.`},{target:`[data-tutorial="wh-try"]`,title:`Try it risk-free`,body:`The sandbox lets you watch SigmaShake judge realistic scenarios without touching your real machine. Great for building intuition.`},L(),I()]},classic:{id:`classic`,title:`Classic Dashboard`,steps:[{title:`The classic Dashboard`,body:`An at-a-glance view of your governance setup — totals, live activity, pending approvals and the latest audit entries, all on one scrolling page.`},{target:`[data-tutorial="dash-stats"]`,title:`Headline numbers`,body:`Each card is a running total — evaluations, allows, blocks and held actions. They tick up live as your agent works.`},{target:`[data-tutorial="dash-meters"]`,title:`Live activity`,body:`These meters animate with every evaluation the daemon processes, so you can see traffic in real time.`},{target:`[data-tutorial="dash-approvals"]`,title:`Pending approvals`,body:`Actions your rules marked ASK wait here for a yes or no. Anything unanswered keeps the agent paused until you decide.`},{target:`[data-tutorial="dash-audit"]`,title:`Recent activity`,body:`The newest decisions land here. Open the full Audit page for search, filters and complete history.`},I()]},graph:{id:`graph`,title:`Graph`,steps:[{title:`The live Graph`,body:`Watch tool calls flow through the governance engine in real time. Each node is a decision; the graph redraws as your agent works.`},{target:`[data-tutorial="graph-panels"]`,title:`Session panels`,body:`Every active agent session gets its own panel. The busiest session takes the larger hero slot up top.`},{target:`[data-tutorial="graph-views"]`,title:`View modes`,body:`Switch between full, feed, stream and broadcast layouts depending on whether you're inspecting, demoing or streaming.`,placement:`bottom`},{target:`[data-tutorial="graph-timeline"]`,title:`Scrub time`,body:`The timeline lets you rewind and replay what happened — pause the live feed and drag to any moment.`,placement:`top`},{target:`[data-tutorial="graph-inspector"]`,title:`Inspect a node`,body:`Click any node and its details — tool, rule, latency, decision — appear in this side panel.`,placement:`left`},{target:`[data-tutorial="graph-clear"]`,title:`Clear the canvas`,body:`Reset the view when it gets crowded. This only clears the display — your audit log keeps everything.`,placement:`bottom`},I()]},sessions:{id:`sessions`,title:`Sessions`,steps:[{title:`Agent sessions`,body:`Every run of an AI agent is grouped into a session. This page lists them all with per-session counts and outcomes.`},{target:`[data-tutorial="sessions-table"]`,title:`The session list`,body:`Each row is one session — client, action counts and decision mix. Click a row to open its full inspector.`},{target:`[data-tutorial="sessions-filter"]`,title:`Find a session`,body:`Filter by client, agent id or session key when the list gets long.`,placement:`bottom`},{target:`[data-tutorial="sessions-refresh"]`,title:`Refresh`,body:`Sessions update as agents run — tap refresh to pull the very latest.`,placement:`bottom`},I()]},"session-detail":{id:`session-detail`,title:`Session Inspector`,steps:[{title:`Session inspector`,body:`A deep dive into one agent session — its decision breakdown, busiest tools and rules, latency profile and full audit trail.`},{target:`[data-tutorial="sd-back"]`,title:`Back to the list`,body:`This breadcrumb returns you to every session. Each row over there links to its own inspector.`,placement:`bottom`},{target:`[data-tutorial="sd-audit"]`,title:`Every action`,body:`The audit panel lists each tool call in this session in order, with the rule that decided it and why.`,placement:`top`},I()]},debug:{id:`debug`,title:`Debug`,steps:[{title:`AI-native debugger`,body:`When a rule misfires, start here. The debugger surfaces root-cause analysis, eval timelines and live daemon state.`},{target:`[data-tutorial="debug-tabs"]`,title:`Pick a lens`,body:`Each tab is a different debugging view — RCA pack, eval flame chart, ssg:// watch, raw state and metrics.`,placement:`bottom`},{target:`[data-tutorial="debug-pane"]`,title:`The active view`,body:`The selected lens renders here. The RCA pack is the fastest way to understand a misbehaving evaluation.`,placement:`top`},I()]},rules:{id:`rules`,title:`Rules`,steps:[{title:`Your rules`,body:`Rules are the policy SigmaShake enforces. This page is where you see, tune and monitor every one of them.`},{target:`[data-tutorial="rules-firewall"]`,title:`Firewall controls`,body:`The firewall card is the master switch — see how many rules are active and toggle enforcement in bulk.`},{target:`[data-tutorial="rules-stats"]`,title:`Performance at a glance`,body:`This bar shows how often rules fired and how fast the engine ran over your chosen time window.`},{target:`[data-tutorial="rules-top"]`,title:`Busiest rules`,body:`The chart ranks rules by how often they triggered. Click a bar to jump straight to that rule.`},{target:`[data-tutorial="rules-activity"]`,title:`Blocks & holds`,body:`See which rules are actually stopping or pausing your agent — the ones doing the real work.`},{target:`[data-tutorial="rules-recent"]`,title:`Latest decisions`,body:`A live strip of the most recent rule hits, so you can spot a noisy or misfiring rule fast.`},I()]},audit:{id:`audit`,title:`Audit`,steps:[{title:`The audit log`,body:`Every action your AI agent attempted — and exactly what SigmaShake decided — is recorded here, in full.`},{target:`[data-tutorial="audit-filters"]`,title:`Narrow it down`,body:`Filter by decision, AI agent or tool to focus on just the activity you care about.`,placement:`bottom`},{target:`#audit-search`,title:`Search this page`,body:`Full-text search across the current page of results — tool names, rule ids, commands and file paths.`,placement:`bottom`},{target:`[data-tutorial="audit-config"]`,title:`Storage budget`,body:`Tune how many rows the audit log keeps before it rotates — right where you read the data.`},{target:`[data-tutorial="audit-sinks"]`,title:`Forward your logs`,body:`Stream audit events to a central logging destination for long-term retention or SIEM analysis.`},I()]},approvals:{id:`approvals`,title:`Approvals`,steps:[{title:`Approvals`,body:`When a rule decides ASK, the action pauses here for your call. This page is your review queue.`},{target:`[data-tutorial="appr-stats"]`,title:`Queue health`,body:`A quick read on how many actions are waiting and how you've been responding to them.`,placement:`bottom`},{target:`.ss-noisy-card`,title:`Tame noisy rules`,body:`If a rule asks too often, silence it from here instead of letting it interrupt every run.`},{target:`[data-tutorial="appr-pending"]`,title:`Decide`,body:`Each pending card shows the tool call and the rule that held it. Approve to let it through, deny to block it.`},{target:`[data-tutorial="appr-history"]`,title:`Past decisions`,body:`Everything you've already approved or denied, searchable, so you can revisit any call.`},I()]},profile:{id:`profile`,title:`Profile`,steps:[{title:`Performance profile`,body:`Two tools in one: an eval profiler that finds governance bottlenecks, and a runtime inspector for the dashboard process itself.`},{target:`[data-tutorial="profile-tabs"]`,title:`Switch tools`,body:`Toggle between the eval profile and the runtime inspector here.`,placement:`bottom`},{target:`[data-tutorial="profile-metrics"]`,title:`The numbers`,body:`Headline latency and throughput metrics for rule evaluation — your baseline for spotting regressions.`},I()]},agents:{id:`agents`,title:`Agents`,steps:[{title:`AI agents`,body:`SigmaShake works with many AI coding tools. This page connects them and shows which are wired up.`},{target:`[data-tutorial="agents-active"]`,title:`Connected agent`,body:`The agent SigmaShake currently detects sits up top, with its live connection status.`},{target:`[data-tutorial="agents-filter"]`,title:`Browse adapters`,body:`Filter the list to see every supported agent, just the detected ones, or what's available to add.`,placement:`bottom`},{target:`[data-tutorial="agents-list"]`,title:`Wire one up`,body:`Pick an agent to install the SigmaShake hook into it. Each row opens its setup details.`},{target:`[data-tutorial="agents-connections"]`,title:`Where it's installed`,body:`An overview of which projects each agent is governing.`},I()]},notifications:{id:`notifications`,title:`Notifications`,steps:[{title:`Notifications`,body:`One place to answer "is anything wrong?" — rule drift, audit capacity, daemon health and noisy rules.`},{target:`[data-tutorial="notif-list"]`,title:`What needs attention`,body:`Each item is something SigmaShake noticed. An empty list means everything is healthy.`},L(),I()]},setup:{id:`setup`,title:`Setup Status`,steps:[{title:`Setup status`,body:`A full health check of your SigmaShake install — license, daemon, native engine, rules directories and per-agent wiring.`},{target:`[data-tutorial="setup-summary"]`,title:`Overall status`,body:`The top card is the verdict. Green means you're fully set up; warnings point you at what's left.`},{target:`[data-tutorial="setup-checks"]`,title:`The checklist`,body:`Each probe verifies one piece of the install. Expand any that aren't passing to see the fix.`},I()]},simulator:{id:`simulator`,title:`Try It`,steps:[{title:`Try it`,body:`A safe sandbox: run realistic scenarios past your rules and see what SigmaShake would allow, block, ask or log — nothing actually executes.`},{target:`[data-tutorial="try-scenarios"]`,title:`Pick a scenario`,body:`Scenarios are grouped by category. Choose one to load a realistic command.`},{target:`[data-tutorial="try-detail"]`,title:`Review & run`,body:`The selected scenario shows the exact command. Hit Run simulation to get a verdict.`},{target:`#tryit-result`,title:`The verdict`,body:`SigmaShake explains its decision here — what it decided, why, and what would have happened.`,placement:`top`},{target:`[data-tutorial="try-advanced"]`,title:`Custom input`,body:`Drop in your own tool call to test an edge case the preset scenarios don't cover.`},I()]},guardrails:{id:`guardrails`,title:`Guardrails`,steps:[{title:`Guardrails`,body:`Starter packs are bundles of rules curated for a job. Install one and you're protected in a tap — no rule writing.`},{target:`[data-tutorial="guard-hero"]`,title:`One-tap protection`,body:`Pick the pack that matches what you're worried about — SigmaShake handles the rest.`},{target:`[data-tutorial="guard-packs"]`,title:`Browse the packs`,body:`Each row is a pack. Expand it to see exactly which rules it adds before you install.`},{target:`[data-tutorial="guard-advanced"]`,title:`Go further`,body:`Ready for more control? This leads to the full rules library and the community hub.`},I()]},hub:{id:`hub`,title:`Hub`,steps:[{title:`Rules hub`,body:`A marketplace of community governance rulesets. Find one that fits, install it, and it joins your rules.`},{target:`[data-tutorial="hub-search"]`,title:`Search`,body:`Search rulesets by name or keyword.`,placement:`bottom`},{target:`[data-tutorial="hub-filters"]`,title:`Filter & sort`,body:`Narrow by decision type or severity, and sort to surface the most relevant or popular packs.`,placement:`bottom`},{target:`[data-tutorial="hub-grid"]`,title:`Browse rulesets`,body:`Each card is an installable ruleset. Open one to read its rules before committing.`},{target:`[data-tutorial="hub-tabs"]`,title:`All vs installed`,body:`Flip between the whole catalog and just what you've already installed.`,placement:`bottom`},{target:`[data-tutorial="hub-connect"]`,title:`Publish your own`,body:`Connect a GitHub account to publish your own rulesets back to the hub.`,placement:`bottom`},I()]},"hub-connect":{id:`hub-connect`,title:`Connect Hub`,steps:[{title:`Connect GitHub`,body:`Publishing rulesets to the hub needs a GitHub account. This page runs the secure device-code sign-in.`},{title:`The device-code flow`,body:`Start the flow, then enter the short code shown on this page at GitHub's verification page. The dashboard polls until you approve it — no password ever touches SigmaShake.`},I()]},"hub-publish":{id:`hub-publish`,title:`Publish to Hub`,steps:[{title:`Publish a ruleset`,body:`Share a governance ruleset you keep in a GitHub repo with the whole SigmaShake community.`},{target:`[data-tutorial="hubpub-input"]`,title:`Point at your repo`,body:`Paste the GitHub URL of the repo holding your .rules files.`},{title:`Submit for review`,body:`Publish sends the ruleset to the hub. Once accepted it appears in the marketplace for everyone to install.`},I()]},"hub-detail":{id:`hub-detail`,title:`Hub Ruleset`,steps:[{title:`Ruleset details`,body:`Everything about one hub ruleset — what it does, which technologies it covers, and every rule inside.`},{title:`Install it`,body:`The install button adds this ruleset to your local rules. You can disable individual rules afterwards on the Rules page.`},{title:`Read before you install`,body:`Scroll the rule list to see the actual policy — each rule's decision and trigger — so there are no surprises.`},I()]},monitor:{id:`monitor`,title:`Monitor`,steps:[{title:`Daemon monitor`,body:`Live vitals for the evaluation daemon — the background process that judges every tool call.`},{target:`[data-tutorial="monitor-counters"]`,title:`Eval counters`,body:`Running totals of evaluations by outcome, straight from the daemon.`},{target:`[data-tutorial="monitor-resources"]`,title:`Resource limits`,body:`Watch CPU and memory, and set the limits that keep the daemon from running away.`},{target:`[data-tutorial="monitor-tail"]`,title:`Live event tail`,body:`The most recent daemon events scroll here — the fastest way to confirm it's healthy.`,placement:`top`},I()]},observability:{id:`observability`,title:`Observability`,steps:[{title:`Observability`,body:`Deep system health — database integrity, rule drift, the flight recorder and the daemon log, all in one place.`},{target:`[data-tutorial="observ-drift"]`,title:`Rule drift`,body:`The most important card: it flags when a rule in the database has diverged from its .rules file source. Sync it back from here.`},{target:`[data-tutorial="observ-capacity"]`,title:`Audit capacity`,body:`Track how full the audit log is and when it will next rotate.`},{title:`Dig deeper`,body:`Further down: SQLite health, the flight recorder, the runtime profiler and a live daemon log tail — scroll for the full picture.`},I()]},plugins:{id:`plugins`,title:`Plugins`,steps:[{title:`Plugin marketplace`,body:`Plugins extend the dashboard with new pages and features. Browse, install and manage them here.`},{target:`[data-tutorial="plugins-tabs"]`,title:`Three views`,body:`Browse the marketplace, manage what you've Installed, or see the Built-in features that ship with SigmaShake.`,placement:`bottom`},{target:`[data-tutorial="plugins-search"]`,title:`Find a plugin`,body:`Search the marketplace by name or keyword.`,placement:`bottom`},{target:`[data-tutorial="plugins-categories"]`,title:`Filter by category`,body:`Category chips narrow the marketplace to one kind of plugin.`,placement:`bottom`},{target:`[data-tutorial="plugins-featured"]`,title:`Editor's picks`,body:`Hand-picked plugins worth a look if you're not sure where to start.`},I()]},"plugin-publish":{id:`plugin-publish`,title:`Publish a Plugin`,steps:[{title:`Publish a plugin`,body:`Built something useful? This page walks you through getting it onto the marketplace.`},{title:`Three commands`,body:`It's a CLI flow: ssg plugins init scaffolds the plugin, build bundles and signs it, and publish cuts the release.`},{target:`[data-tutorial="pubplug-submit"]`,title:`Submit to the hub`,body:`After building, this link opens the hub submission form to finish your listing.`},I()]},support:{id:`support`,title:`Support`,steps:[{title:`Support & feedback`,body:`Hit a bug, want a feature, or have a question? Send it straight to the SigmaShake team from here.`},{target:`[data-tutorial="support-subject"]`,title:`Subject`,body:`A short summary. Pick the category above first so it routes to the right place.`},{target:`[data-tutorial="support-desc"]`,title:`Describe it`,body:`The detail. For bugs, what you did and what you expected helps most — diagnostics are attached automatically.`},{target:`[data-tutorial="support-attach"]`,title:`Add a screenshot`,body:`Drag in an image — a screenshot of the problem is worth a thousand words.`},I()]}};function z(e,t){return e===`/`?t===`newcomer`?R[`home-newcomer`]:R[`home-pro`]:e===`/classic`?R.classic:e===`/graph`?R.graph:e===`/sessions`?R.sessions:e.startsWith(`/sessions/`)?R[`session-detail`]:e===`/debug`?R.debug:e===`/rules`?R.rules:e===`/audit`?R.audit:e===`/approvals`?R.approvals:e===`/profile`?R.profile:e===`/agents`?R.agents:e===`/notifications`?R.notifications:e===`/setup`?R.setup:e===`/try`?R.simulator:e===`/guardrails`?R.guardrails:e===`/hub/connect`?R[`hub-connect`]:e===`/hub/publish`?R[`hub-publish`]:e.startsWith(`/hub/`)?R[`hub-detail`]:e===`/hub`?R.hub:e===`/monitor`?R.monitor:e===`/observability`?R.observability:e===`/plugins`?R.plugins:e===`/publish-plugin`?R[`plugin-publish`]:e===`/support`?R.support:null}var ie=m(),B=344,ae=8,oe=16,se=14;function ce(e){if(!e)return null;let t=null;try{t=document.querySelector(e)}catch{return null}if(!t)return null;let n=t.getBoundingClientRect();return n.width<1||n.height<1?null:{top:n.top,left:n.left,width:n.width,height:n.height}}function le(e,t,n,r){let i=window.innerWidth,a=window.innerHeight;if(!e||t===`center`)return{top:Math.max(se,(a-r)/2),left:Math.max(se,(i-n)/2),side:`center`};let o={top:e.top-ae,left:e.left-ae,right:e.left+e.width+ae,bottom:e.top+e.height+ae,cx:e.left+e.width/2,cy:e.top+e.height/2},s={bottom:a-o.bottom>=r+oe+se,top:o.top>=r+oe+se,right:i-o.right>=n+oe+se,left:o.left>=n+oe+se},c=(t===`auto`?[`bottom`,`top`,`right`,`left`]:[t,`bottom`,`top`,`right`,`left`]).find(e=>s[e])??`bottom`,l=0,u=0;return c===`bottom`?(l=o.bottom+oe,u=o.cx-n/2):c===`top`?(l=o.top-oe-r,u=o.cx-n/2):c===`right`?(u=o.right+oe,l=o.cy-r/2):(u=o.left-oe-n,l=o.cy-r/2),u=Math.min(Math.max(se,u),i-n-se),l=Math.min(Math.max(se,l),a-r-se),{top:l,left:u,side:c}}function ue({tutorial:e,onClose:t}){let[n,r]=(0,_.useState)(0),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)({top:-9999,left:-9999,side:`center`}),c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=e.steps.length,d=e.steps[n],f=n>=u-1,p=n===0,m=(0,_.useCallback)(()=>{n>=e.steps.length-1?t():r(e=>e+1)},[n,e.steps.length,t]),h=(0,_.useCallback)(()=>{r(e=>Math.max(0,e-1))},[]);if((0,_.useEffect)(()=>{let e=d?.target;if(a(ce(e)),!e)return;let t=null;try{t=document.querySelector(e)}catch{t=null}if(!t)return;t.scrollIntoView({block:`center`,inline:`nearest`,behavior:`smooth`});let n=window.setTimeout(()=>a(ce(e)),380);return()=>window.clearTimeout(n)},[d]),(0,_.useEffect)(()=>{let e=d?.target;if(!e)return;let t=0,n=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(()=>a(ce(e)))};return window.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{cancelAnimationFrame(t),window.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[d]),(0,_.useLayoutEffect)(()=>{let e=c.current,t=e?.offsetWidth??B,n=e?.offsetHeight??220;s(le(i,d?.placement??`auto`,t,n))},[i,d]),(0,_.useEffect)(()=>{let e=e=>{e.key===`Escape`?(e.preventDefault(),t()):e.key===`ArrowRight`?(e.preventDefault(),m()):e.key===`ArrowLeft`&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m,h,t]),(0,_.useEffect)(()=>{l.current?.focus({preventScroll:!0})},[n]),!d)return null;let g=i!==null;return(0,ie.createPortal)((0,D.jsxs)(`div`,{className:`ssg-tut-root`,role:`presentation`,children:[(0,D.jsx)(`div`,{className:`ssg-tut-catcher${g?``:` ssg-tut-catcher--dim`}`}),g&&i&&(0,D.jsx)(`div`,{className:`ssg-tut-spot`,"aria-hidden":`true`,style:{top:i.top-ae,left:i.left-ae,width:i.width+ae*2,height:i.height+ae*2}}),(0,D.jsxs)(`div`,{ref:c,className:`ssg-tut-card ssg-tut-card--${o.side}`,style:{top:o.top,left:o.left},role:`dialog`,"aria-modal":`true`,"aria-label":`${e.title} tutorial`,children:[(0,D.jsx)(`button`,{type:`button`,className:`ssg-tut-close`,onClick:t,"aria-label":`Close tutorial`,children:(0,D.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`}),(0,D.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`})]})}),(0,D.jsxs)(`div`,{className:`ssg-tut-eyebrow`,children:[(0,D.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M12 3l2.5 5.5L20 11l-5.5 2.5L12 19l-2.5-5.5L4 11l5.5-2.5z`})}),(0,D.jsxs)(`span`,{children:[`Tutorial · `,e.title]})]}),(0,D.jsxs)(`div`,{className:`ssg-tut-counter`,children:[`Step `,n+1,` of `,u]}),(0,D.jsx)(`h2`,{className:`ssg-tut-title`,children:d.title}),(0,D.jsx)(`p`,{className:`ssg-tut-body`,children:d.body}),(0,D.jsx)(`div`,{className:`ssg-tut-dots`,role:`tablist`,"aria-label":`Tutorial steps`,children:e.steps.map((e,t)=>(0,D.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===n,"aria-label":`Step ${t+1}: ${e.title}`,className:`ssg-tut-dot${t===n?` ssg-tut-dot--on`:``}${t<n?` ssg-tut-dot--done`:``}`,onClick:()=>r(t)},e.title))}),(0,D.jsxs)(`div`,{className:`ssg-tut-actions`,children:[!f&&(0,D.jsx)(`button`,{type:`button`,className:`hig-button hig-button-plain hig-button-small`,onClick:t,children:`Skip tour`}),(0,D.jsx)(`span`,{className:`ssg-tut-actions-spacer`}),(0,D.jsx)(`button`,{type:`button`,className:`hig-button hig-button-small`,onClick:h,disabled:p,children:`Back`}),(0,D.jsx)(`button`,{ref:l,type:`button`,className:`hig-button hig-button-primary hig-button-small`,onClick:m,children:f?`Finish`:`Next`})]})]},n)]}),document.body)}var de=`ssg.tutorial.seen.`;function fe(e){try{return localStorage.getItem(de+e)===`1`}catch{return!0}}function pe(e){try{localStorage.setItem(de+e,`1`)}catch{}}function me({pathname:e,mode:t}){let n=z(e,t),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!0);(0,_.useEffect)(()=>{i(!1),o(n?fe(n.id):!0)},[n]);let s=(0,_.useCallback)(()=>{n&&(pe(n.id),o(!0),i(!0))},[n]);return n?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`button`,{type:`button`,"data-tutorial":`app-tutorial-btn`,className:`hig-button hig-button-small ssg-tut-launch`,onClick:s,title:`Take the ${n.title} tutorial`,"aria-label":`Take the ${n.title} tutorial`,children:[(0,D.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,D.jsx)(`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}),(0,D.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`Tutorial`}),!a&&(0,D.jsx)(`span`,{className:`ssg-tut-launch-hint`,"aria-hidden":`true`})]}),r&&(0,D.jsx)(ue,{tutorial:n,onClose:()=>i(!1)})]}):null}var he=`ssg:ui:mode:v1`,ge=`ssg:ui:mode:seeded`,_e=`ssg:ui-mode-change`,ve=new Set([`professional`,`enterprise`,`agent-dev`]);function ye(){try{let e=localStorage.getItem(he);if(e===`newcomer`||e===`pro`)return e}catch{}return null}function be(e){try{localStorage.setItem(he,e)}catch{}}async function xe(){if(ye()===null){try{if(localStorage.getItem(ge))return;localStorage.setItem(ge,`1`)}catch{return}try{let e=await fetch(`/api/json/wizard-state`);if(!e.ok){be(`newcomer`);return}let t=await e.json(),n=ve.has(t.profile??``)?`pro`:`newcomer`;be(n),window.dispatchEvent(new CustomEvent(_e,{detail:n}))}catch{be(`newcomer`)}}}function Se(){let[e,t]=(0,_.useState)(()=>ye()??`newcomer`);return(0,_.useEffect)(()=>{xe().then(()=>{let n=ye();n&&n!==e&&t(n)});let n=e=>{let n=e.detail;(n===`newcomer`||n===`pro`)&&t(n)};return window.addEventListener(_e,n),()=>window.removeEventListener(_e,n)},[e]),{mode:e,setMode:(0,_.useCallback)(e=>{t(e),be(e),window.dispatchEvent(new CustomEvent(_e,{detail:e}))},[])}}function Ce(){let{mode:e,setMode:t}=Se(),n=e===`newcomer`;return(0,D.jsxs)(`div`,{role:`radiogroup`,"aria-label":`UI mode`,className:`hig-segmented`,style:{height:`24px`},title:n?`Switch to advanced view`:`Switch to simple view`,children:[(0,D.jsx)(`button`,{role:`radio`,"aria-checked":n,"aria-selected":n,onClick:()=>t(`newcomer`),className:n?`selected`:``,style:{height:`20px`,padding:`0 10px`,fontSize:`11.5px`},children:`Simple`}),(0,D.jsx)(`button`,{role:`radio`,"aria-checked":!n,"aria-selected":!n,onClick:()=>t(`pro`),className:n?``:`selected`,style:{height:`20px`,padding:`0 10px`,fontSize:`11.5px`},children:`Advanced`})]})}var we=`SSG_AUDIO`,Te=`SSG_AUDIO_VOLUME`,Ee=12,De=null,Oe=null,ke=!1,Ae=.18,je=[],Me=!1;function Ne(){if(typeof localStorage>`u`)return{enabled:!1,volume:.18};let e=localStorage.getItem(we)===`1`,t=localStorage.getItem(Te);return{enabled:e,volume:t?Math.max(0,Math.min(1,parseFloat(t))):.18}}function Pe(){typeof localStorage>`u`||(localStorage.setItem(we,ke?`1`:`0`),localStorage.setItem(Te,Ae.toString()))}function Fe(){if(typeof window>`u`)return null;if(De)return De;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;try{De=new e,Oe=De.createGain(),Oe.gain.value=Ae,Oe.connect(De.destination),typeof document<`u`&&document.addEventListener(`visibilitychange`,()=>{De&&(document.visibilityState===`hidden`?De.suspend():De.resume())})}catch{De=null,Oe=null}return De}function Ie(){if(Me)return;Me=!0;let{enabled:e,volume:t}=Ne();ke=e,Ae=t}function Le(){return Ie(),ke}function Re(e){if(Ie(),ke=e,Pe(),e){let e=Fe();e&&e.state===`suspended`&&e.resume()}}function ze(){return Ie(),Ae}function Be(e){Ie(),Ae=Math.max(0,Math.min(1,e)),Pe(),Oe&&(Oe.gain.value=Ae)}function Ve(e){for(;je.length>0&&e-je[0]>1e3;)je.shift();return je.length>=Ee?!1:(je.push(e),!0)}var He={allow:{type:`sine`,freq:660,durationMs:90,peak:.6},block:{type:`square`,freq:110,durationMs:130,peak:1},force:{type:`sawtooth`,freq:220,freqSweep:440,durationMs:170,peak:.8},ask:{type:`triangle`,freq:880,durationMs:110,peak:.55},log:{type:`sine`,freq:1320,durationMs:30,peak:.35},shadow:{type:`sine`,freq:220,durationMs:60,peak:.18}};function Ue(e){if(Ie(),!ke||typeof document<`u`&&document.visibilityState===`hidden`)return;let t=Fe();if(!t||!Oe)return;t.state===`suspended`&&t.resume().catch(()=>{});let n=t.currentTime;if(!Ve(performance.now()))return;let r=He[e],i=t.createOscillator();i.type=r.type,i.frequency.value=r.freq,r.freqSweep!==void 0&&(i.frequency.setValueAtTime(r.freq,n),i.frequency.exponentialRampToValueAtTime(Math.max(1,r.freqSweep),n+r.durationMs/1e3));let a=t.createGain();a.gain.setValueAtTime(0,n),a.gain.linearRampToValueAtTime(r.peak,n+.005),a.gain.exponentialRampToValueAtTime(1e-4,n+r.durationMs/1e3),i.connect(a),a.connect(Oe),i.start(n),i.stop(n+r.durationMs/1e3+.05),i.onended=()=>{try{i.disconnect(),a.disconnect()}catch{}}}function We(){let[e,t]=(0,_.useState)(()=>Le()),[n,r]=(0,_.useState)(()=>ze()),[i,a]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{Re(e)},[e]),(0,_.useEffect)(()=>{Be(n)},[n]),(0,D.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,D.jsxs)(`button`,{onClick:()=>t(e=>!e),onContextMenu:e=>{e.preventDefault(),a(e=>!e)},className:`chip cursor-pointer hover:bg-[var(--color-fill-2)] transition-colors`,style:e?{color:`var(--color-decision-allow)`}:void 0,title:e?`Decision chimes on · click to mute · right-click for volume`:`Decision chimes off · click to enable`,children:[(0,D.jsx)(`span`,{className:`status-dot ${e?`bg-[var(--color-decision-allow)]`:`bg-[var(--color-fg-4)]`}`}),(0,D.jsxs)(`span`,{className:`hidden sm:inline`,children:[`Audio `,e?`on`:`off`]})]}),i&&(0,D.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-50 flex items-center gap-2 px-3 py-2 hig-card hig-card-padded shadow-[var(--hig-shadow-2)]`,onMouseLeave:()=>a(!1),children:[(0,D.jsx)(`span`,{className:`overline`,children:`Volume`}),(0,D.jsx)(`input`,{type:`range`,min:0,max:1,step:.02,value:n,onChange:e=>r(parseFloat(e.target.value)),className:`w-24`,style:{accentColor:`var(--color-accent)`}}),(0,D.jsx)(`span`,{className:`text-[11px] font-mono tabular-nums text-[var(--color-fg-2)] w-8 text-right`,children:Math.round(n*100)})]})]})}var Ge=2e3,Ke=200,qe=3e3,Je=1e3,Ye=3e4,Xe=Object.freeze({counters:Object.freeze({}),latestBurst:null,burstRing:Object.freeze([]),burstSeq:0,lifecycleRing:Object.freeze([]),connectionSeq:0,connected:!1,reconnectAttempts:0,lastErrorAt:null,reconnectDelayMs:Je}),Ze=new Set,Qe={},$e=[],et=[],tt=[],nt=!1,rt=!1,it=null,at=null,ot=null,st=!1,ct=typeof localStorage<`u`&&localStorage.getItem(`DEBUG_SSE`)===`1`;function lt(e,t){ct&&(t?console.debug(`[ssg-sse] ${e}`,t):console.debug(`[ssg-sse] ${e}`))}function ut(){st||(st=!0,queueMicrotask(dt))}function dt(){st=!1;let e=Object.keys(Qe),t=$e,n=et,r=tt,i=nt,a=it!==null||at!==null||ot!==null;if(e.length===0&&t.length===0&&n.length===0&&r.length===0&&!i&&!a)return;let o=Xe.counters;if(e.length>0){let t={...Xe.counters};for(let n of e)t[n]=(t[n]??0)+(Qe[n]??0);o=Object.freeze(t),Qe={}}let s=Xe.burstRing,c=Xe.latestBurst,l=Xe.burstSeq;if(t.length>0){let e=Xe.burstRing.length+t.length>Ge?[...Xe.burstRing,...t].slice(-Ge):[...Xe.burstRing,...t];s=Object.freeze(e),c=t[t.length-1]??c,l=Xe.burstSeq+t.length,$e=[]}if(n.length>0){let e=new Map;for(let t of n)e.set(t.tool_use_id,t);let t=!1,r=s.map(n=>{if(!n.tool_use_id)return n;let r=e.get(n.tool_use_id);if(!r)return n;t=!0;let i=n.output_tokens??0,a=n.complete_ts_ms??0,o=Math.max(i,r.output_tokens),s=Math.max(a,r.ts_ms),c=Math.max(n.complete_duration_ms??0,r.duration_ms??0);return{...n,output_tokens:o,complete_ts_ms:s,...c>0?{complete_duration_ms:c}:{}}});t&&(s=Object.freeze(r),l=Xe.burstSeq+1),et=[]}let u=Xe.lifecycleRing;if(r.length>0){let e=Xe.lifecycleRing.length+r.length>Ke?[...Xe.lifecycleRing,...r].slice(-Ke):[...Xe.lifecycleRing,...r];u=Object.freeze(e),tt=[]}let d=Xe.connected,f=Xe.connectionSeq;i&&(d=rt,f=Xe.connectionSeq+1,nt=!1);let p=Xe.reconnectAttempts,m=Xe.lastErrorAt,h=Xe.reconnectDelayMs;it!==null&&(p=it,it=null),at!==null&&(m=at,at=null),ot!==null&&(h=ot,ot=null),Xe=Object.freeze({counters:o,latestBurst:c,burstRing:s,burstSeq:l,lifecycleRing:u,connectionSeq:f,connected:d,reconnectAttempts:p,lastErrorAt:m,reconnectDelayMs:h});for(let e of Ze)e()}var ft=null,pt=0,mt=new Set,ht=new Map,gt=null,_t=Je,vt=null;function yt(e,t){if(e===`eval-burst`){try{let e=JSON.parse(t.data);Array.isArray(e?.bursts)&&($e.push(...e.bursts),ut())}catch{}return}if(e===`eval-burst-complete`){try{let e=JSON.parse(t.data);if(e&&typeof e.tool_use_id==`string`&&e.tool_use_id.length>0&&typeof e.output_tokens==`number`&&Number.isFinite(e.output_tokens)&&typeof e.ts_ms==`number`&&Number.isFinite(e.ts_ms)){let t={ts_ms:e.ts_ms,tool_use_id:e.tool_use_id,output_tokens:Math.max(0,e.output_tokens),...typeof e.duration_ms==`number`&&Number.isFinite(e.duration_ms)?{duration_ms:e.duration_ms}:{}};et.push(t),ut()}}catch{}return}if(e===`session-lifecycle`){try{let e=JSON.parse(t.data);Array.isArray(e?.events)&&e.events.length>0&&(tt.push(...e.events),ut())}catch{}return}Qe[e]=(Qe[e]??0)+1,ut()}function bt(e){if(!ft||ht.has(e))return;let t=t=>yt(e,t);ft.addEventListener(e,t),ht.set(e,t)}var xt=0,St=0,Ct=2e3;function wt(){if(ft)return;lt(`opening EventSource`,{url:`/api/events`}),St=Date.now();let e=new EventSource(`/api/events`);ft=e,ht.clear();for(let e of mt)bt(e);e.onopen=()=>{let e=Xe.lastErrorAt!==null;_t=Je,xt=0,it=0,ot=Je,nt=!0,rt=!0,ut(),e&&Ft(`reconnect`),lt(`connected`)},e.onerror=()=>{e.close(),ft=null,ht.clear(),nt=!0,rt=!1,at=Date.now(),ut(),xt===0&&Date.now()-St<Ct?lt(`first-open interrupted (page-load race) — reconnect in ${_t}ms`):console.warn(`[ssg-sse] EventSource error — reconnect in ${_t}ms (attempt ${xt+1})`),pt>0&&(gt=setTimeout(()=>{gt=null,pt>0&&wt()},_t),xt++,it=xt,_t=Math.min(_t*2,Ye),ot=_t,ut())}}function Tt(){gt&&=(clearTimeout(gt),null),ft?.close(),ft=null,ht.clear(),_t=Je,xt=0,it=0,ot=Je,nt=!0,rt=!1,ut()}typeof document<`u`&&document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&pt!==0&&(ft||(gt&&=(clearTimeout(gt),null),lt(`visibilitychange → reconnecting`),wt()))});function Et(){for(let e of mt)e!==`eval-burst`&&(Qe[e]=(Qe[e]??0)+1);ut()}function Dt(e){return Ze.add(e),()=>{Ze.delete(e)}}function Ot(){return Xe}var kt=2e3,At=1e4,jt=1440*60*1e3,Mt=500,Nt=0,Pt=null;function Ft(e){let t=Date.now();if(t-Nt<At){lt(`hydrate skipped (cooldown)`,{reason:e});return}if(Pt)return;let n=t-jt,r=Xe.burstRing[Xe.burstRing.length-1],i=Xe.burstRing.length>0&&r!==void 0?r.ts_ms+1:n,a=e===`reconnect`?Math.max(i,n):n,o=t;if(a>=o)return;Nt=t;let s=new AbortController;Pt=s,lt(`hydrate start`,{reason:e,since:a,until:o,ringLen:Xe.burstRing.length}),(async()=>{let t=a,n=0;try{for(;n<kt&&t<o&&!s.signal.aborted;){let r=Math.min(Mt,kt-n),i=await fetch(`/api/json/graph/backfill?since_ms=${t}&until_ms=${o}&limit=${r}`,{signal:s.signal,credentials:`same-origin`});if(!i.ok)break;let a=await i.json();if(!Array.isArray(a.bursts)||a.bursts.length===0||($e.push(...a.bursts),ut(),n+=a.bursts.length,lt(`hydrate page`,{reason:e,page:n,count:a.bursts.length}),a.bursts.length<r))break;let c=a.bursts[a.bursts.length-1];if(c===void 0)break;t=c.ts_ms+1}lt(`hydrate done`,{reason:e,fetched:n})}catch(t){t.name!==`AbortError`&&console.warn(`[ssg-sse] ring hydration failed (${e})`,t)}finally{Pt=null}})()}function It(e){for(let t of e)mt.add(t),bt(t);return pt++,pt===1&&(Ft(`initial`),wt(),vt=setInterval(Et,qe)),()=>{pt--,pt===0&&(Tt(),vt&&=(clearInterval(vt),null))}}var Lt=qe;function Rt(){(0,_.useEffect)(()=>It([]),[]);let e=(0,_.useSyncExternalStore)(Dt,Ot),[,t]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(e.connected||e.lastErrorAt===null)return;let n=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(n)},[e.connected,e.lastErrorAt]);let n=zt(e),r=n===`reconnecting`&&e.lastErrorAt!==null?Math.max(0,Math.ceil((e.lastErrorAt+e.reconnectDelayMs-Date.now())/1e3)):null,i=Math.round(Lt/1e3);if(n===`connected`)return(0,D.jsxs)(`div`,{className:`chip`,title:`Telemetry Live — SSE connected`,"data-testid":`sse-status-chip`,"data-state":`connected`,children:[(0,D.jsx)(`span`,{className:`status-dot bg-[var(--color-decision-allow)]`}),(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`Live`})]});let a=n===`reconnecting`,o=a?{color:`var(--color-hig-orange)`,background:`color-mix(in oklab, var(--color-hig-orange) 14%, transparent)`}:{color:`var(--color-hig-red)`,background:`color-mix(in oklab, var(--color-hig-red) 14%, transparent)`},s=a?`bg-[var(--color-hig-orange)]`:`bg-[var(--color-hig-red)]`,c=a?r===null?`Reconnecting`:`Reconnect ${r}s`:`Offline`,l=`Live paused · ${i}s poll`;return(0,D.jsxs)(`div`,{className:`chip`,style:o,title: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.`,"data-testid":`sse-status-chip`,"data-state":n,role:`status`,"aria-live":`polite`,children:[(0,D.jsx)(`span`,{className:`status-dot ${s} pulse-soft`}),(0,D.jsx)(`span`,{className:`hidden md:inline`,children:l}),(0,D.jsx)(`span`,{className:`md:hidden`,children:c})]})}function zt(e){return e.connected?`connected`:e.reconnectAttempts>0||e.lastErrorAt!==null?`reconnecting`:`disconnected`}function V(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}}function Bt(e){let t=(0,_.useSyncExternalStore)(Dt,Ot);(0,_.useEffect)(()=>It(e),[e]);let n=(0,_.useRef)({});return(0,_.useMemo)(()=>{let r={},i=!1;for(let a of e){let e=t.counters[a]??0;r[a]=e,n.current[a]!==e&&(i=!0)}return!i&&Object.keys(n.current).length===e.length?n.current:(n.current=r,r)},[t,e.length,e])}var Vt=`ssg-dashboard-tabs`,Ht=2e3,Ut=6e3;function Wt(){return`tab-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}function Gt(){let[e,t]=(0,_.useState)(0),[n,r]=(0,_.useState)(!0),i=(0,_.useRef)(Wt()),a=(0,_.useRef)(new Map);return(0,_.useEffect)(()=>{if(typeof BroadcastChannel>`u`)return;let e=new BroadcastChannel(Vt);function n(){let e=Date.now();for(let[t,n]of a.current.entries())e-n>Ut&&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()},Ht),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}}function H(){let e=document.querySelector(`meta[name="ssg-csrf"]`)?.content??``;return e?{"X-SigmaShake-Token":e}:{}}function Kt(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of n)if(e[r]!==t[r])return!1;return!0}function qt(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.enabled!==i.enabled||n.toolGroups.length!==i.toolGroups.length||n.toolGroups.some((e,t)=>e!==i.toolGroups[t]))return!1}return!0}function Jt(e,t){let[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(`project`),[f,p]=(0,_.useState)({}),[m,h]=(0,_.useState)({}),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(0),C=(0,_.useRef)(null);(0,_.useEffect)(()=>{let n=`${e}:${u}:${x}`,i=C.current!==n;C.current=n;let o=!1,c=setTimeout(()=>{i&&(s(!0),l(null));let n=new URLSearchParams({agent:e,projectDir:t,scope:u});fetch(`/api/json/adapters/toggles?${n.toString()}`).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(t=>{if(o)return;r(t.catalog);let n=t.resolved[e]??{hooks:{},mcp:{}};a(n),i&&(p({...n.hooks}),h(Object.fromEntries(Object.entries(n.mcp).map(([e,t])=>[e,{...t,toolGroups:[...t.toolGroups]}]))),s(!1))}).catch(e=>{o||i&&(l(e instanceof Error?e.message:String(e)),s(!1))})},i?0:250);return()=>{o=!0,clearTimeout(c)}},[e,t,u,x]);let w=(0,_.useCallback)(()=>S(e=>e+1),[]);return{catalog:n,loading:o,fetchError:c,scope:u,setScope:d,hooks:f,mcp:m,setHook:(0,_.useCallback)((e,t)=>{p(n=>({...n,[e]:t}))},[]),setMcpEnabled:(0,_.useCallback)((e,t)=>{h(n=>({...n,[e]:{...n[e]??{enabled:!0,toolGroups:[`core`]},enabled:t}}))},[]),setMcpToolGroups:(0,_.useCallback)((e,t)=>{h(n=>({...n,[e]:{...n[e]??{enabled:!0,toolGroups:[`core`]},toolGroups:t}}))},[]),hasChanges:i!==null&&(!Kt(f,i.hooks)||!qt(m,i.mcp)),saving:g,saveError:y,refetch:w,save:(0,_.useCallback)(async()=>{v(!0),b(null);try{let n=await(await fetch(`/api/json/adapters/toggles`,{method:`POST`,headers:{"Content-Type":`application/json`,...H()},body:JSON.stringify({agent:e,scope:u,projectDir:t,changes:{hooks:f,mcp:m}})})).json();if(!n.ok)b(n.error??`Save failed`);else{let e=n.resolved??{hooks:f,mcp:m};a(e),p({...e.hooks}),h(Object.fromEntries(Object.entries(e.mcp).map(([e,t])=>[e,{...t,toolGroups:[...t.toolGroups]}])))}}catch(e){b(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e,u,t,f,m]),saveAndInstall:(0,_.useCallback)(async(t,n)=>{v(!0),b(null);try{let r=await(await fetch(`/api/json/adapters/toggles`,{method:`POST`,headers:{"Content-Type":`application/json`,...H()},body:JSON.stringify({agent:e,scope:u,projectDir:t,changes:{hooks:f,mcp:m}})})).json();if(!r.ok){b(r.error??`Save failed`),n?.(!1);return}a(r.resolved??{hooks:f,mcp:m});let i=await(await fetch(`/api/json/adapters/install`,{method:`POST`,headers:{"Content-Type":`application/json`,...H()},body:JSON.stringify({adapter:e,projectDir:t})})).json();i.ok?n?.(!0):(b(i.error??`Install failed`),n?.(!1))}catch(e){b(e instanceof Error?e.message:String(e)),n?.(!1)}finally{v(!1)}},[e,u,f,m])}}function Yt({checked:e,onChange:t,disabled:n,size:r=`md`,tone:i=`brand`,label:a}){return(0,D.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":a,disabled:n,onClick:()=>t(!e),className:`ss-toggle ${r===`sm`?`ss-toggle--sm`:``} ${i===`danger`?`ss-toggle--danger`:``}`,children:(0,D.jsx)(`span`,{className:`ss-toggle-thumb`,"aria-hidden":`true`})})}function Xt({groups:e,selected:t,onChange:n,disabled:r}){let i=(0,_.useRef)(null);function a(e){if(t.includes(e)){let r=t.filter(t=>t!==e);if(r.length>0)n(r);else{i.current&&(i.current.textContent=``,requestAnimationFrame(()=>{i.current&&(i.current.textContent=`At least one tool group must remain enabled.`)}));let t=document.getElementById(`chip-${e}`);t&&(t.classList.remove(`chip--shake-deny`),t.offsetWidth,t.classList.add(`chip--shake-deny`),t.addEventListener(`animationend`,()=>t.classList.remove(`chip--shake-deny`),{once:!0}))}}else n([...t,e])}return(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 mt-1.5`,children:[e.map(e=>{let n=t.includes(e.id);return(0,D.jsx)(`button`,{id:`chip-${e.id}`,type:`button`,disabled:r,"aria-pressed":n,onClick:()=>a(e.id),className:`chip${n?` chip--active`:``}`,children:e.label},e.id)}),(0,D.jsx)(`span`,{ref:i,className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`})]})}function Zt(){return(0,D.jsx)(`div`,{className:`flex flex-col gap-0.5 mb-4`,children:[0,1,2,3].map(e=>(0,D.jsx)(`div`,{className:`shimmer agent-toggles-skeleton-row`},e))})}function Qt({agentId:e,projectDir:t,onApplied:n}){let{catalog:r,loading:i,fetchError:a,scope:o,setScope:s,hooks:c,mcp:l,setHook:u,setMcpEnabled:d,setMcpToolGroups:f,hasChanges:p,saving:m,saveError:h,saveAndInstall:g,refetch:_}=Jt(e,t);if(i)return(0,D.jsx)(Zt,{});if(a)return(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 py-1`,children:[(0,D.jsx)(`p`,{className:`text-xs text-[var(--color-hig-red)] font-sans`,children:a}),(0,D.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--ghost`,onClick:()=>_(),children:`Retry`})]});if(!r)return null;let v=r.hookApplicability[e]??[],y=r.mcpApplicability[e]??[],b=v.length>0,x=y.length>0;if(!b&&!x)return(0,D.jsx)(`p`,{className:`text-xs text-[var(--color-fg-3)] font-sans py-1`,children:`No configurable hooks or MCP servers for this agent yet.`});let S=r.hooks.filter(e=>v.includes(e.id)),C=r.mcp.filter(e=>y.includes(e.id)),w=p?S.filter(e=>(c[e.id]??!0)!==!0).length+C.filter(e=>{let t=l[e.id]??{enabled:!0,toolGroups:[`core`]};return!t.enabled||t.toolGroups.join()!==`core`}).length:0;return(0,D.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`text-[10.5px] font-mono uppercase tracking-widest text-[var(--color-fg-3)] mb-2`,children:`Scope`}),(0,D.jsx)(`div`,{className:`ss-segment`,role:`tablist`,"aria-label":`Toggle scope`,children:[`project`,`global`].map(e=>(0,D.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":o===e,className:`ss-segment-item`,onClick:()=>s(e),children:e===`project`?`This project`:`Global`},e))}),(0,D.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] mt-1.5`,children:o===`project`?`Saves to .sigmashake/agent-toggles.json in this project.`:`Saves to ~/.sigmashake/agent-toggles.json (applies to all projects).`})]}),b&&(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`text-[10.5px] font-mono uppercase tracking-widest text-[var(--color-fg-3)] mb-2`,children:`Claude Code lifecycle hooks`}),(0,D.jsx)(`div`,{className:`ss-list`,style:{margin:0},children:S.map(e=>{let t=c[e.id]??!0;return(0,D.jsxs)(`div`,{className:`ss-list-row`,style:{gap:12,cursor:`pointer`},onClick:()=>u(e.id,!t),children:[(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsx)(`span`,{className:`block text-[12.5px] font-medium text-[var(--color-fg-1)] mb-0.5`,children:e.label}),(0,D.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] m-0`,children:e.description})]}),(0,D.jsx)(Yt,{checked:t,onChange:t=>u(e.id,t),disabled:m,label:e.label,size:`sm`})]},e.id)})})]}),x&&(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`text-[10.5px] font-mono uppercase tracking-widest text-[var(--color-fg-3)] mb-2`,children:`MCP servers`}),(0,D.jsx)(`div`,{className:`ss-list`,style:{margin:0},children:C.map(e=>{let t=l[e.id]??{enabled:!0,toolGroups:[`core`]},n=!t.enabled;return(0,D.jsxs)(`div`,{style:{padding:`10px 14px`,borderBottom:`1px solid var(--color-line-0)`},children:[(0,D.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,D.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,D.jsx)(`span`,{className:`block text-[12.5px] font-medium text-[var(--color-fg-1)] mb-0.5`,children:e.label})}),(0,D.jsx)(Yt,{checked:t.enabled,onChange:t=>d(e.id,t),disabled:m,label:e.label,size:`sm`,tone:n?`danger`:`brand`})]}),n&&(0,D.jsxs)(`p`,{className:`ss-list-row-warning`,children:[`Disconnecting will remove `,e.id,` from this agent. Hooks remain unchanged.`]}),t.enabled&&(0,D.jsxs)(`div`,{className:`mt-2`,children:[(0,D.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] mb-0.5`,children:`Tool groups`}),(0,D.jsx)(Xt,{groups:e.toolGroups,selected:t.toolGroups,onChange:t=>f(e.id,t),disabled:m})]})]},e.id)})})]}),p&&w>0&&(0,D.jsxs)(`p`,{className:`agent-toggles-pending`,children:[w,` change`,w===1?``:`s`,` pending — click Apply to save.`]}),h&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(`p`,{className:`text-[11px] text-[var(--color-hig-red)] font-sans m-0`,children:h}),(0,D.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--ghost`,onClick:()=>void g(t,e=>n?.(e)),children:`Retry`})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsxs)(`button`,{type:`button`,className:`ss-btn ss-btn--primary`,disabled:m||!p||!t.trim(),onClick:()=>void g(t,e=>n?.(e)),title:t.trim()?p?`Save toggle choices and re-run ssg init to update config files.`:`No changes to apply.`:`Pick a project directory above before applying.`,style:{height:34,padding:`0 16px`,fontSize:12.5,display:`inline-flex`,alignItems:`center`,gap:6},children:[m&&(0,D.jsx)(`span`,{className:`ss-spinner`,"aria-hidden":`true`}),m?`Applying…`:`Apply`]}),!p&&!m&&(0,D.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)]`,children:`no changes`})]})]})}function $t({open:e,onClose:t,title:n,subtitle:r,children:i,footer:a,size:o=`md`}){let s=(0,_.useRef)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(t);return l.current=t,(0,_.useEffect)(()=>{if(!e)return;c.current=document.activeElement;let t=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=e=>{e.key===`Escape`&&(e.preventDefault(),l.current())};return document.addEventListener(`keydown`,n),s.current?.focus(),()=>{document.removeEventListener(`keydown`,n),document.body.style.overflow=t,c.current?.focus?.()}},[e]),e?(0,D.jsx)(`div`,{className:`ss-sheet-backdrop`,onClick:e=>{e.target===e.currentTarget&&t()},role:`presentation`,children:(0,D.jsxs)(`div`,{ref:s,className:`ss-sheet ss-sheet--${o}`,role:`dialog`,"aria-modal":`true`,"aria-label":n??`Detail`,tabIndex:-1,children:[(0,D.jsx)(`button`,{className:`ss-sheet-handle`,onClick:t,"aria-label":`Close`,type:`button`}),(0,D.jsxs)(`div`,{className:`ss-sheet-head`,children:[(0,D.jsxs)(`div`,{className:`ss-sheet-head-text`,children:[n&&(0,D.jsx)(`h2`,{className:`ss-sheet-title`,children:n}),r&&(0,D.jsx)(`p`,{className:`ss-sheet-subtitle`,children:r})]}),(0,D.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Close`,className:`ss-sheet-close`,children:(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`}),(0,D.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`})]})})]}),(0,D.jsx)(`div`,{className:`ss-sheet-body`,children:i}),a&&(0,D.jsx)(`div`,{className:`ss-sheet-footer`,children:a})]})}):null}var en=`http://www.w3.org/2000/svg`;function tn({markup:e,size:t=22}){let n=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=n.current;if(!t)return;for(;t.firstChild;)t.removeChild(t.firstChild);let r=`<svg xmlns="${en}">${e}</svg>`,i=new DOMParser().parseFromString(r,`image/svg+xml`).documentElement;for(let e of Array.from(i.childNodes))t.appendChild(t.ownerDocument.importNode(e,!0))},[e]),(0,D.jsx)(`svg`,{ref:n,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,width:t,height:t,"aria-hidden":`true`})}function nn({a:e,size:t=40}){return(0,D.jsx)(`div`,{className:`agent-card-icon shrink-0`,style:{width:t,height:t,color:e.accent,background:`color-mix(in oklab, ${e.accent} 16%, var(--color-surface-2))`,borderColor:`color-mix(in oklab, ${e.accent} 38%, var(--color-line-1))`},children:(0,D.jsx)(tn,{markup:e.glyph,size:Math.round(t*.55)})})}function rn({a:e}){return e.active?(0,D.jsx)(`span`,{className:`agent-badge`,style:{color:e.accent,background:`color-mix(in oklab, ${e.accent} 16%, transparent)`,borderColor:`color-mix(in oklab, ${e.accent} 38%, transparent)`},children:`Active`}):e.detected?(0,D.jsxs)(`span`,{className:`agent-badge agent-badge--detected`,children:[(0,D.jsx)(`span`,{className:`agent-badge-dot`}),`Detected`]}):e.recommended?(0,D.jsx)(`span`,{className:`agent-badge`,style:{color:e.accent,background:`color-mix(in oklab, ${e.accent} 12%, transparent)`,borderColor:`color-mix(in oklab, ${e.accent} 30%, transparent)`},children:`Recommended`}):null}function an(){return(0,D.jsx)(`svg`,{className:`ss-list-row-chevron`,viewBox:`0 0 16 16`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M5 3l5 5-5 5`})})}function on({text:e}){let[t,n]=(0,_.useState)(!1);return(0,D.jsx)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},className:`ss-btn ss-btn--secondary`,style:{height:32,padding:`0 12px`,fontSize:12},"aria-label":t?`Copied`:`Copy`,children:t?`Copied ✓`:`Copy`})}function sn(e,t){return t&&e.startsWith(t)?`~${e.slice(t.length)}`:e}function cn({agentId:e,projectDir:t}){let[n,r]=(0,_.useState)(!1);return(0,D.jsxs)(`div`,{style:{border:`1px solid var(--color-line-1)`,borderRadius:10,overflow:`hidden`,marginBottom:16},children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,width:`100%`,padding:`10px 14px`,background:`var(--color-surface-2)`,border:`none`,cursor:`pointer`,textAlign:`left`,gap:8},children:[(0,D.jsx)(`span`,{style:{fontSize:12.5,fontWeight:500,color:`var(--color-fg-1)`},children:`Configure hooks & MCP`}),(0,D.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{color:`var(--color-fg-3)`,transform:n?`rotate(90deg)`:`rotate(0deg)`,transition:`transform 0.15s`,flexShrink:0},"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M5 3l5 5-5 5`})})]}),(0,D.jsx)(`div`,{className:`agent-toggles-body`,"data-open":n?`true`:`false`,style:{borderTop:n?`1px solid var(--color-line-1)`:`none`},children:(0,D.jsx)(`div`,{style:{padding:`14px 14px 16px`},children:(0,D.jsx)(Qt,{agentId:e,projectDir:t})})})]})}function ln({agent:e,ctx:t,onClose:n,onInstalled:r}){let[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(null),C=`ssg init --client=${e.id}`;async function w(){b(!0),S(null);try{let e=await(await fetch(`/api/json/pick-dir`,{method:`POST`,headers:{"Content-Type":`application/json`,...H()}})).json();e.ok?a(e.path):e.reason===`user_cancelled`||(e.reason===`no_display`?S(`No graphical session — type the path manually instead.`):e.reason===`no_picker_found`?S("Folder picker not available. Install `zenity` (Linux), or type the path manually."):S(e.error||`Folder picker failed.`))}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(!1)}}(0,_.useEffect)(()=>{let e=!1;return fetch(`/api/json/adapters/recent`).then(e=>e.json()).then(t=>{e||(s(t.recents??[]),!i&&t.recents&&t.recents.length>0&&a(t.recents[0]?.path))}).catch(()=>{}),()=>{e=!0}},[i]);async function T(){if(i.trim()){l(!0),h(null),v(!1);try{let t=await(await fetch(`/api/json/adapters/install`,{method:`POST`,headers:{"Content-Type":`application/json`,...H()},body:JSON.stringify({adapter:e.id,projectDir:i})})).json();h(t),t.ok&&(r(),fetch(`/api/json/adapters/recent`).then(e=>e.json()).then(e=>s(e.recents??[])).catch(()=>{}))}catch(t){h({ok:!1,exitCode:-1,adapter:e.id,projectDir:i,stdout:``,stderr:``,error:t instanceof Error?t.message:String(t)})}finally{l(!1)}}}async function E(e){d(!0),p(null);try{let t=await(await fetch(`/api/json/adapters/active`,{method:`POST`,headers:{"Content-Type":`application/json`,...H()},body:JSON.stringify({adapter:e})})).json();t.ok?r():p(t.error??`Failed to pin adapter.`)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}let O=c||!i.trim(),k=c?`Connecting…`:i.trim()?`Connect this project`:`Pick a project directory`,ee=u?`Saving…`:e.pinned?`Pinned ✓`:`Set as my agent`,A=u||e.pinned;return(0,D.jsxs)($t,{open:!0,onClose:n,title:e.displayName,subtitle:e.vendor,size:`md`,footer:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--secondary`,disabled:O,onClick:()=>void T(),title:"Run `ssg init --client` in the chosen project directory.",children:k}),(0,D.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--primary`,disabled:A,onClick:()=>void E(e.id),style:{"--tone":e.accent},title:e.pinned?`Already pinned as your default agent.`:`Pin ${e.displayName} as the default — overrides auto-detection across SSG.`,children:ee})]}),children:[(0,D.jsxs)(`div`,{className:`flex items-start gap-4 mb-4`,children:[(0,D.jsx)(nn,{a:e,size:56}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap mb-1.5`,children:[(0,D.jsx)(rn,{a:e}),e.pinned&&(0,D.jsx)(`span`,{className:`agent-badge`,style:{color:e.accent,background:`color-mix(in oklab, ${e.accent} 14%, transparent)`,borderColor:`color-mix(in oklab, ${e.accent} 36%, transparent)`},title:`You pinned this agent as your default.`,children:`Pinned`}),e.healthy&&!e.active&&(0,D.jsx)(`span`,{className:`text-[10.5px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`healthy`})]}),(0,D.jsx)(`p`,{className:`text-[13px] text-[var(--color-fg-1)] leading-relaxed`,children:e.tagline}),e.pinned&&(0,D.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>void E(null),className:`text-[11px] font-mono text-[var(--color-fg-3)] hover:text-[var(--color-brand)] mt-2 cursor-pointer hover:underline`,children:u?`unpinning…`:`unpin & return to auto-detect`}),f&&(0,D.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-hig-red)] mt-2`,children:f})]})]}),(0,D.jsx)(`p`,{className:`ss-list-section-title`,children:`Install target`}),(0,D.jsxs)(`div`,{className:`ss-list mb-4`,children:[(0,D.jsx)(`div`,{className:`ss-list-row`,style:{cursor:`default`},onClick:e=>e.preventDefault(),children:(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsx)(`p`,{className:`text-[12.5px] font-medium text-[var(--color-fg-1)]`,children:`Project directory`}),(0,D.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mt-0.5 truncate`,children:i.trim()?sn(i,t.home):`Type a path or pick from below.`})]})}),(0,D.jsxs)(`div`,{style:{padding:`10px 14px`,borderTop:`1px solid var(--color-line-0)`},children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),spellCheck:!1,placeholder:`Click Browse… or paste a path`,className:`flex-1 h-9 px-3 rounded-md text-[12px] font-mono`,style:{background:`var(--color-surface-2)`,border:`1px solid var(--color-line-1)`,color:`var(--color-fg-1)`,outline:`none`}}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>void w(),disabled:y,className:`ss-btn ss-btn--secondary`,style:{height:36,padding:`0 14px`,fontSize:12},title:`Open the system folder picker.`,children:y?`Opening…`:`Browse…`})]}),x&&(0,D.jsx)(`p`,{className:`text-[11px] font-mono mt-2`,style:{color:`var(--color-hig-red)`},children:x}),o.length>0&&(0,D.jsxs)(`div`,{className:`mt-3`,children:[(0,D.jsx)(`p`,{className:`text-[10.5px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`Recent`}),(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.map(e=>(0,D.jsx)(`button`,{type:`button`,onClick:()=>a(e.path),className:`text-[11px] font-mono px-2 py-1 rounded-md cursor-pointer`,style:{background:i===e.path?`color-mix(in oklab, var(--color-brand) 14%, var(--color-surface-2))`:`var(--color-surface-2)`,border:`1px solid ${i===e.path?`color-mix(in oklab, var(--color-brand) 38%, var(--color-line-1))`:`var(--color-line-1)`}`,color:i===e.path?`var(--color-brand)`:`var(--color-fg-1)`},title:e.path,children:sn(e.path,t.home)},e.path))})]})]})]}),(0,D.jsx)(`p`,{className:`ss-list-section-title`,children:`Or run from terminal`}),(0,D.jsxs)(`div`,{className:`ss-list mb-4 p-3 flex items-center gap-2`,style:{padding:`12px 14px`},children:[(0,D.jsxs)(`code`,{className:`flex-1 text-[12px] font-mono text-[var(--color-brand)] overflow-x-auto whitespace-nowrap`,children:[`$ `,C]}),(0,D.jsx)(on,{text:C})]}),(0,D.jsx)(cn,{agentId:e.id,projectDir:i}),m&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`p`,{className:`ss-list-section-title`,children:m.ok?`Setup complete`:`Setup failed`}),(0,D.jsx)(un,{result:m}),(m.stdout||m.stderr||m.error)&&(0,D.jsxs)(`div`,{className:`mt-3`,children:[(0,D.jsx)(`button`,{type:`button`,className:`text-[11px] font-mono text-[var(--color-fg-3)] hover:text-[var(--color-brand)] cursor-pointer`,onClick:()=>v(e=>!e),children:g?`▾ Hide full log`:`▸ Show full log`}),g&&(0,D.jsx)(`pre`,{className:`text-[11px] font-mono rounded-md p-3 mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-all`,style:{background:`var(--color-surface-2)`,border:`1px solid var(--color-line-1)`,color:`var(--color-fg-2)`},children:m.error?`${m.error}${m.detail?`\n${m.detail}`:``}`:[m.stdout,m.stderr].filter(Boolean).join(`
10
10
  `)||`Exit code: ${m.exitCode}`})]})]})]})}function un({result:e}){return(0,D.jsx)(`ul`,{className:`ss-install-checklist`,children:(e.steps&&e.steps.length>0?e.steps:[{label:e.ok?`Setup complete`:`Setup failed`,status:e.ok?`ok`:`error`,detail:e.error??void 0}]).map((e,t)=>(0,D.jsxs)(`li`,{className:`ss-install-step ss-install-step--${e.status}`,children:[(0,D.jsx)(`span`,{className:`ss-install-step__icon`,"aria-hidden":`true`,children:e.status===`ok`?`✓`:e.status===`error`?`✗`:`–`}),(0,D.jsxs)(`div`,{className:`ss-install-step__body`,children:[(0,D.jsx)(`span`,{className:`ss-install-step__label`,children:e.label}),e.detail&&(0,D.jsx)(`span`,{className:`ss-install-step__detail`,children:e.detail})]})]},t))})}function dn({a:e,onOpen:t}){return(0,D.jsxs)(`button`,{type:`button`,className:`ss-list-row`,onClick:t,"aria-label":`Open ${e.displayName} details`,children:[(0,D.jsx)(nn,{a:e,size:34}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,D.jsx)(`span`,{className:`text-[13.5px] font-semibold text-[var(--color-fg-0)] truncate`,children:e.displayName}),(0,D.jsx)(rn,{a:e}),e.pinned&&!e.active&&(0,D.jsx)(`span`,{className:`agent-badge`,style:{color:e.accent,background:`color-mix(in oklab, ${e.accent} 12%, transparent)`,borderColor:`color-mix(in oklab, ${e.accent} 30%, transparent)`},children:`Pinned`})]}),(0,D.jsx)(`p`,{className:`text-[10.5px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mt-0.5`,children:e.vendor})]}),(0,D.jsx)(an,{})]})}function fn(){let{data:e,refetch:t}=V(`/api/json/adapters`),[n,r]=(0,_.useState)(`all`),[i,a]=(0,_.useState)(null),o=(0,_.useMemo)(()=>e?n===`detected`?e.adapters.filter(e=>e.detected):n===`available`?e.adapters.filter(e=>!e.detected):e.adapters:[],[e,n]);if(!e)return(0,D.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading adapters…`});let s=e.adapters.find(e=>e.active),c=e.adapters.filter(e=>e.detected).length,l=i?e.adapters.find(e=>e.id===i):null;return(0,D.jsxs)(`div`,{className:`max-w-3xl mx-auto space-y-6`,children:[(0,D.jsxs)(`section`,{"data-tutorial":`agents-active`,className:`rounded-2xl p-5 relative overflow-hidden`,style:{border:`1px solid var(--color-line-1)`,background:s?`linear-gradient(180deg, color-mix(in oklab, ${s.accent} 14%, transparent) 0%, transparent 70%), var(--color-surface-1)`:`var(--color-surface-1)`,boxShadow:s?`0 0 0 1px color-mix(in oklab, ${s.accent} 30%, transparent), 0 18px 40px color-mix(in oklab, ${s.accent} 14%, transparent)`:void 0},children:[(0,D.jsx)(`p`,{className:`ss-list-section-title`,style:{padding:0,marginBottom:12},children:`Connected agent`}),s?(0,D.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,D.jsx)(nn,{a:s,size:56}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,D.jsx)(`h2`,{className:`text-[18px] font-semibold text-[var(--color-fg-0)] tracking-tight`,children:s.displayName}),(0,D.jsx)(rn,{a:s}),s.pinned?(0,D.jsx)(`span`,{className:`agent-badge`,style:{color:s.accent,background:`color-mix(in oklab, ${s.accent} 14%, transparent)`,borderColor:`color-mix(in oklab, ${s.accent} 36%, transparent)`},title:`You pinned this agent as your default — auto-detection is overridden.`,children:`Pinned`}):(0,D.jsx)(`span`,{className:`agent-badge`,style:{color:`var(--color-fg-3)`,background:`var(--color-surface-2)`,borderColor:`var(--color-line-1)`},title:`SSG auto-detected this agent from process env and filesystem markers.`,children:`Auto-detected`})]}),(0,D.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mt-0.5`,children:s.vendor}),(0,D.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)] mt-2 leading-relaxed`,children:s.pinned?`Pinned as your default agent — SSG will treat every tool call as ${s.displayName} regardless of auto-detection.`:s.id===`generic`?`No specific AI client detected — falling back to the generic adapter. Pick the agent you actually use and hit "Set as my agent" to override.`:s.healthy?`Auto-detected from process environment. If this isn't the agent you actually use, tap any other row and hit "Set as my agent" to pin it.`:`Forced via SSG_CLIENT — adapter is in use but its config dir is missing or incomplete.`}),s.pinned&&(0,D.jsx)(`button`,{type:`button`,onClick:()=>{fetch(`/api/json/adapters/active`,{method:`POST`,headers:{"Content-Type":`application/json`,...H()},body:JSON.stringify({adapter:null})}).then(()=>t())},className:`text-[11px] font-mono text-[var(--color-fg-3)] hover:text-[var(--color-brand)] mt-3 cursor-pointer hover:underline`,children:`↺ reset to auto-detect`})]})]}):(0,D.jsx)(`p`,{className:`text-sm text-[var(--color-fg-2)]`,children:`No active adapter resolved.`})]}),(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsxs)(`p`,{className:`ss-list-section-title`,style:{padding:0,marginBottom:0},children:[`All supported agents · `,e.adapters.length]}),(0,D.jsx)(`div`,{"data-tutorial":`agents-filter`,className:`ss-segment`,role:`tablist`,"aria-label":`Filter`,children:[`all`,`detected`,`available`].map(e=>(0,D.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":n===e,className:`ss-segment-item`,onClick:()=>r(e),children:e===`all`?`All`:e===`detected`?`Detected${c>0?` · ${c}`:``}`:`Available`},e))})]}),o.length>0?(0,D.jsx)(`div`,{"data-tutorial":`agents-list`,className:`ss-list`,children:o.map(e=>(0,D.jsx)(dn,{a:e,onOpen:()=>a(e.id)},e.id))}):(0,D.jsx)(`div`,{className:`rounded-2xl p-8 text-center`,style:{border:`1px dashed var(--color-line-1)`,background:`color-mix(in oklab, var(--color-surface-1) 50%, transparent)`},children:(0,D.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-3)] font-mono`,children:`no agents match this filter`})}),(0,D.jsx)(`div`,{className:`rounded-xl p-4`,style:{border:`1px dashed var(--color-line-1)`,background:`color-mix(in oklab, var(--color-surface-1) 50%, transparent)`},children:(0,D.jsxs)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:[`SSG picks the active adapter at runtime — either from`,` `,(0,D.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`SSG_CLIENT`}),` or by auto-detecting your tool. Tap any agent to wire it into a project from the dashboard, or copy the`,` `,(0,D.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg init`}),` command and run it yourself.`]})}),(0,D.jsx)(pn,{ctx:e.context,adapters:e.adapters}),(0,D.jsx)(hn,{}),l&&(0,D.jsx)(ln,{agent:l,ctx:e.context,onClose:()=>a(null),onInstalled:()=>t()})]})}function pn({ctx:e,adapters:t}){let{data:n}=V(`/api/json/adapters/recent`),r=t.find(e=>e.active)??null,i=t.filter(e=>e.detected);return(0,D.jsxs)(`section`,{"data-tutorial":`agents-connections`,className:`rounded-2xl p-5`,style:{border:`1px solid var(--color-line-1)`,background:`var(--color-surface-1)`},children:[(0,D.jsxs)(`div`,{className:`flex items-baseline justify-between mb-3`,children:[(0,D.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight text-[var(--color-fg-0)]`,children:`How SigmaShake is connected`}),(0,D.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)]`,children:`Overview`})]}),(0,D.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)] leading-relaxed mb-4`,children:`Each AI agent on your machine has its own config file. SigmaShake adds a small hook to those files so it sees every tool call before it runs.`}),(0,D.jsxs)(`ul`,{className:`space-y-2`,children:[(0,D.jsx)(mn,{label:`Daemon`,status:`on`,detail:`Running — watching tool calls in real time.`}),(0,D.jsx)(mn,{label:`Active AI agent`,status:r?`on`:`off`,detail:r?`${r.displayName} (${r.vendor})`:`Nothing detected yet — install an adapter below.`}),(0,D.jsx)(mn,{label:`Wired-in agents`,status:i.length>0?`on`:`off`,detail:i.length>0?i.map(e=>e.displayName).join(`, `):`No agents wired in yet.`})]}),n?.recents&&n.recents.length>0&&(0,D.jsxs)(`div`,{className:`mt-5`,children:[(0,D.jsxs)(`p`,{className:`text-[11px] uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:[`Projects connected (`,n.recents.length,`)`]}),(0,D.jsx)(`ul`,{className:`space-y-1.5`,children:n.recents.map(t=>(0,D.jsxs)(`li`,{className:`flex items-center gap-3 rounded-lg px-3 py-2 text-[12px]`,style:{background:`var(--color-surface-2)`,border:`0.5px solid var(--color-line-1)`},children:[(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{background:`var(--color-hig-green)`}}),(0,D.jsx)(`span`,{className:`font-mono text-[var(--color-fg-1)] truncate flex-1 min-w-0`,children:sn(t.path,e.home)}),(0,D.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-3)] shrink-0`,children:new Date(t.lastUsed).toLocaleDateString(void 0,{month:`short`,day:`numeric`})})]},t.path))})]})]})}function mn({label:e,status:t,detail:n}){return(0,D.jsxs)(`li`,{className:`flex items-center gap-3 rounded-lg px-3 py-2`,style:{background:`var(--color-surface-2)`,border:`0.5px solid var(--color-line-1)`},children:[(0,D.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:t===`on`?`var(--color-hig-green)`:`var(--color-fg-4)`,boxShadow:t===`on`?`0 0 0 3px color-mix(in oklab, var(--color-hig-green) 22%, transparent)`:void 0}}),(0,D.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--color-fg-0)] w-32 shrink-0`,children:e}),(0,D.jsx)(`span`,{className:`text-[12px] text-[var(--color-fg-2)] flex-1 min-w-0 truncate`,children:n})]})}function hn(){let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(!0),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null);async function c(){a(!0),s(null);try{s(await(await fetch(`/api/json/uninstall-everything`,{method:`POST`,headers:{"Content-Type":`application/json`,...H()},body:JSON.stringify({keepData:n})})).json())}catch(e){s({ok:!1,error:`Could not reach SigmaShake`,detail:e instanceof Error?e.message:String(e)})}finally{a(!1)}}return(0,D.jsxs)(`section`,{className:`rounded-2xl p-5`,style:{border:`1px solid color-mix(in oklab, var(--color-hig-red) 28%, var(--color-line-1))`,background:`linear-gradient(180deg, color-mix(in oklab, var(--color-hig-red) 6%, transparent) 0%, transparent 100%), var(--color-surface-1)`},children:[(0,D.jsx)(`div`,{className:`flex items-baseline justify-between gap-3 flex-wrap`,children:(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight text-[var(--color-fg-0)]`,children:`Uninstall SigmaShake`}),(0,D.jsxs)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)] leading-relaxed mt-1`,children:[`Removes the SigmaShake hook from every AI-agent config file on this machine and stops the daemon.`,` `,(0,D.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`The `,(0,D.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg`}),` binary itself stays installed — remove it with your package manager.`]})]})]})}),!e&&!o&&(0,D.jsx)(`button`,{type:`button`,onClick:()=>t(!0),className:`mt-4 text-[12.5px] font-medium px-4 py-2 rounded-lg cursor-pointer transition-colors`,style:{color:`var(--color-hig-red)`,border:`1px solid color-mix(in oklab, var(--color-hig-red) 40%, transparent)`,background:`color-mix(in oklab, var(--color-hig-red) 8%, transparent)`},children:`Uninstall SigmaShake everywhere…`}),e&&!o&&(0,D.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,D.jsxs)(`label`,{className:`flex items-start gap-2 text-[12px] text-[var(--color-fg-1)] cursor-pointer`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked),className:`mt-0.5`}),(0,D.jsxs)(`span`,{children:[`Keep my activity history and license`,` `,(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`(~/.sigmashake/). Uncheck to wipe everything.`})]})]}),(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>void c(),disabled:i,className:`text-[12.5px] font-medium px-4 py-2 rounded-lg cursor-pointer transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,style:{color:`white`,background:`var(--color-hig-red)`},children:i?`Uninstalling…`:`Yes — uninstall everywhere`}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>t(!1),disabled:i,className:`text-[12.5px] font-medium px-4 py-2 rounded-lg cursor-pointer transition-colors`,style:{color:`var(--color-fg-1)`,background:`var(--color-surface-2)`,border:`1px solid var(--color-line-1)`},children:`Cancel`})]})]}),o&&(0,D.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`rounded-lg px-4 py-3`,style:{border:`1px solid ${o.ok?`color-mix(in oklab, var(--color-hig-green) 38%, transparent)`:`color-mix(in oklab, var(--color-hig-red) 38%, transparent)`}`,background:o.ok?`color-mix(in oklab, var(--color-hig-green) 6%, transparent)`:`color-mix(in oklab, var(--color-hig-red) 6%, transparent)`},children:[(0,D.jsx)(`p`,{className:`text-[13px] font-semibold`,style:{color:o.ok?`var(--color-hig-green)`:`var(--color-hig-red)`},children:o.ok?`SigmaShake has been removed from this machine`:`Uninstall failed`}),(0,D.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] mt-1 leading-relaxed`,children:o.ok?(0,D.jsxs)(D.Fragment,{children:[`Hooks were stripped from every AI-agent config file. The daemon has stopped.`,o.packageManagerHint&&(0,D.jsxs)(D.Fragment,{children:[` `,`To also remove the`,` `,(0,D.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg`}),` `,`binary, run:`,(0,D.jsx)(`code`,{className:`block mt-2 px-2 py-1.5 rounded bg-[var(--color-surface-2)] text-[var(--color-brand)] text-[11.5px] font-mono`,children:o.packageManagerHint})]})]}):(0,D.jsxs)(D.Fragment,{children:[o.error??`Unknown error.`,` `,o.detail&&(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:o.detail})]})})]}),(o.stdout||o.stderr)&&(0,D.jsxs)(`details`,{children:[(0,D.jsx)(`summary`,{className:`text-[11px] text-[var(--color-fg-3)] cursor-pointer hover:text-[var(--color-fg-1)]`,children:`Show full log`}),(0,D.jsx)(`pre`,{className:`text-[11px] font-mono rounded-md p-3 mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-all`,style:{background:`var(--color-surface-2)`,border:`1px solid var(--color-line-1)`,color:`var(--color-fg-2)`},children:[o.stdout,o.stderr].filter(Boolean).join(`
11
- `)})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>{s(null),t(!1)},className:`text-[11.5px] text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer`,children:`↺ Close`})]})]})}function gn(e,t){if(!e)return;let n=typeof e;if(n===`string`||n===`number`||n===`bigint`){t.push(String(e));return}if(Array.isArray(e)){for(let n of e)gn(n,t);return}if(n===`object`)for(let[n,r]of Object.entries(e))r&&t.push(n)}function _n(...e){let t=[];for(let n of e)gn(n,t);return t.join(` `)}function vn(e,t){return n=>{let r=[e],i=t?.variants;if(i){let e=i,a=t?.defaultVariants??{},o=n??{};for(let t of Object.keys(e)){let n=o[t]??a[t];typeof n==`string`&&r.push(e[t][n])}}return r.push(n?.class,n?.className),_n(...r)}}var yn=(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},bn=(e,t)=>({classGroupId:e,validator:t}),xn=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Sn=`-`,Cn=[],wn=`arbitrary..`,Tn=e=>{let t=On(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Dn(e);let n=e.split(Sn);return En(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?yn(i,t):t:i||Cn}return n[e]||Cn}}},En=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=En(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Sn):e.slice(t).join(Sn),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Dn=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?wn+r:void 0})(),On=e=>{let{theme:t,classGroups:n}=e;return kn(n,t)},kn=(e,t)=>{let n=xn();for(let r in e){let i=e[r];An(i,n,r,t)}return n},An=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];jn(i,t,n,r)}},jn=(e,t,n,r)=>{if(typeof e==`string`){Mn(e,t,n);return}if(typeof e==`function`){Nn(e,t,n,r);return}Pn(e,t,n,r)},Mn=(e,t,n)=>{let r=e===``?t:Fn(t,e);r.classGroupId=n},Nn=(e,t,n,r)=>{if(In(e)){An(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(bn(n,e))},Pn=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];An(o,Fn(t,a),n,r)}},Fn=(e,t)=>{let n=e,r=t.split(Sn),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=xn(),n.nextPart.set(t,i)),n=i}return n},In=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Ln=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=`!`,zn=`:`,Bn=[],Vn=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Hn=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===zn){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 Vn(t,l,c,u)};if(t){let e=t+zn,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Vn(Bn,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Un=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}},Wn=e=>({cache:Ln(e.cacheSize),parseClassName:Hn(e),sortModifiers:Un(e),...Tn(e)}),Gn=/\s+/,Kn=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Gn),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},qn=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Jn(n))&&(i&&(i+=` `),i+=r);return i},Jn=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Jn(e[r]))&&(n&&(n+=` `),n+=t);return n},Yn=(e,...t)=>{let n,r,i,a,o=o=>(n=Wn(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=Kn(e,n);return i(e,a),a};return a=o,(...e)=>a(qn(...e))},Xn=[],Zn=e=>{let t=t=>t[e]||Xn;return t.isThemeGetter=!0,t},Qn=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,$n=/^\((?:(\w[\w-]*):)?(.+)\)$/i,er=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,tr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,nr=/\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$/,rr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ir=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ar=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,or=e=>er.test(e),U=e=>!!e&&!Number.isNaN(Number(e)),sr=e=>!!e&&Number.isInteger(Number(e)),cr=e=>e.endsWith(`%`)&&U(e.slice(0,-1)),lr=e=>tr.test(e),ur=()=>!0,dr=e=>nr.test(e)&&!rr.test(e),fr=()=>!1,pr=e=>ir.test(e),mr=e=>ar.test(e),hr=e=>!W(e)&&!G(e),gr=e=>jr(e,Fr,fr),W=e=>Qn.test(e),_r=e=>jr(e,Ir,dr),vr=e=>jr(e,Lr,U),yr=e=>jr(e,zr,ur),br=e=>jr(e,Rr,fr),xr=e=>jr(e,Nr,fr),Sr=e=>jr(e,Pr,mr),Cr=e=>jr(e,Br,pr),G=e=>$n.test(e),wr=e=>Mr(e,Ir),Tr=e=>Mr(e,Rr),Er=e=>Mr(e,Nr),Dr=e=>Mr(e,Fr),Or=e=>Mr(e,Pr),kr=e=>Mr(e,Br,!0),Ar=e=>Mr(e,zr,!0),jr=(e,t,n)=>{let r=Qn.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Mr=(e,t,n=!1)=>{let r=$n.exec(e);return r?r[1]?t(r[1]):n:!1},Nr=e=>e===`position`||e===`percentage`,Pr=e=>e===`image`||e===`url`,Fr=e=>e===`length`||e===`size`||e===`bg-size`,Ir=e=>e===`length`,Lr=e=>e===`number`,Rr=e=>e===`family-name`,zr=e=>e===`number`||e===`weight`,Br=e=>e===`shadow`,Vr=Yn(()=>{let e=Zn(`color`),t=Zn(`font`),n=Zn(`text`),r=Zn(`font-weight`),i=Zn(`tracking`),a=Zn(`leading`),o=Zn(`breakpoint`),s=Zn(`container`),c=Zn(`spacing`),l=Zn(`radius`),u=Zn(`shadow`),d=Zn(`inset-shadow`),f=Zn(`text-shadow`),p=Zn(`drop-shadow`),m=Zn(`blur`),h=Zn(`perspective`),g=Zn(`aspect`),_=Zn(`ease`),v=Zn(`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(),G,W],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[G,W,c],T=()=>[or,`full`,`auto`,...w()],E=()=>[sr,`none`,`subgrid`,G,W],D=()=>[`auto`,{span:[`full`,sr,G,W]},sr,G,W],O=()=>[sr,`auto`,G,W],k=()=>[`auto`,`min`,`max`,`fr`,G,W],ee=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],A=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],j=()=>[`auto`,...w()],M=()=>[or,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],te=()=>[or,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ne=()=>[or,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],N=()=>[e,G,W],P=()=>[...b(),Er,xr,{position:[G,W]}],F=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],re=()=>[`auto`,`cover`,`contain`,Dr,gr,{size:[G,W]}],I=()=>[cr,wr,_r],L=()=>[``,`none`,`full`,l,G,W],R=()=>[``,U,wr,_r],z=()=>[`solid`,`dashed`,`dotted`,`double`],ie=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],B=()=>[U,cr,Er,xr],ae=()=>[``,`none`,m,G,W],oe=()=>[`none`,U,G,W],se=()=>[`none`,U,G,W],ce=()=>[U,G,W],le=()=>[or,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[lr],breakpoint:[lr],color:[ur],container:[lr],"drop-shadow":[lr],ease:[`in`,`out`,`in-out`],font:[hr],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[lr],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[lr],shadow:[lr],spacing:[`px`,U],text:[lr],"text-shadow":[lr],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,or,W,G,g]}],container:[`container`],columns:[{columns:[U,W,G,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:[sr,`auto`,G,W]}],basis:[{basis:[or,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[U,or,`auto`,`initial`,`none`,W]}],grow:[{grow:[``,U,G,W]}],shrink:[{shrink:[``,U,G,W]}],order:[{order:[sr,`first`,`last`,`none`,G,W]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ee(),`normal`]}],"justify-items":[{"justify-items":[...A(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...A()]}],"align-content":[{content:[`normal`,...ee()]}],"align-items":[{items:[...A(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...A(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...A(),`baseline`]}],"place-self":[{"place-self":[`auto`,...A()]}],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:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:M()}],"inline-size":[{inline:[`auto`,...te()]}],"min-inline-size":[{"min-inline":[`auto`,...te()]}],"max-inline-size":[{"max-inline":[`none`,...te()]}],"block-size":[{block:[`auto`,...ne()]}],"min-block-size":[{"min-block":[`auto`,...ne()]}],"max-block-size":[{"max-block":[`none`,...ne()]}],w:[{w:[s,`screen`,...M()]}],"min-w":[{"min-w":[s,`screen`,`none`,...M()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...M()]}],h:[{h:[`screen`,`lh`,...M()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...M()]}],"max-h":[{"max-h":[`screen`,`lh`,...M()]}],"font-size":[{text:[`base`,n,wr,_r]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Ar,yr]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,cr,W]}],"font-family":[{font:[Tr,br,t]}],"font-features":[{"font-features":[W]}],"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,G,W]}],"line-clamp":[{"line-clamp":[U,`none`,G,vr]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,G,W]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,G,W]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...z(),`wavy`]}],"text-decoration-thickness":[{decoration:[U,`from-font`,`auto`,G,_r]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[U,`auto`,G,W]}],"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`,G,W]}],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`,G,W]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:re()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},sr,G,W],radial:[``,G,W],conic:[sr,G,W]},Or,Sr]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:R()}],"border-w-x":[{"border-x":R()}],"border-w-y":[{"border-y":R()}],"border-w-s":[{"border-s":R()}],"border-w-e":[{"border-e":R()}],"border-w-bs":[{"border-bs":R()}],"border-w-be":[{"border-be":R()}],"border-w-t":[{"border-t":R()}],"border-w-r":[{"border-r":R()}],"border-w-b":[{"border-b":R()}],"border-w-l":[{"border-l":R()}],"divide-x":[{"divide-x":R()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":R()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...z(),`hidden`,`none`]}],"divide-style":[{divide:[...z(),`hidden`,`none`]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...z(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[U,G,W]}],"outline-w":[{outline:[``,U,wr,_r]}],"outline-color":[{outline:N()}],shadow:[{shadow:[``,`none`,u,kr,Cr]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":[`none`,d,kr,Cr]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:R()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[U,_r]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":[`none`,f,kr,Cr]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[U,G,W]}],"mix-blend":[{"mix-blend":[...ie(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ie()}],"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":[U]}],"mask-image-linear-from-pos":[{"mask-linear-from":B()}],"mask-image-linear-to-pos":[{"mask-linear-to":B()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":B()}],"mask-image-t-to-pos":[{"mask-t-to":B()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":B()}],"mask-image-r-to-pos":[{"mask-r-to":B()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":B()}],"mask-image-b-to-pos":[{"mask-b-to":B()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":B()}],"mask-image-l-to-pos":[{"mask-l-to":B()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":B()}],"mask-image-x-to-pos":[{"mask-x-to":B()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":B()}],"mask-image-y-to-pos":[{"mask-y-to":B()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[G,W]}],"mask-image-radial-from-pos":[{"mask-radial-from":B()}],"mask-image-radial-to-pos":[{"mask-radial-to":B()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"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":[U]}],"mask-image-conic-from-pos":[{"mask-conic-from":B()}],"mask-image-conic-to-pos":[{"mask-conic-to":B()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,G,W]}],filter:[{filter:[``,`none`,G,W]}],blur:[{blur:ae()}],brightness:[{brightness:[U,G,W]}],contrast:[{contrast:[U,G,W]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,kr,Cr]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:[``,U,G,W]}],"hue-rotate":[{"hue-rotate":[U,G,W]}],invert:[{invert:[``,U,G,W]}],saturate:[{saturate:[U,G,W]}],sepia:[{sepia:[``,U,G,W]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,G,W]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[U,G,W]}],"backdrop-contrast":[{"backdrop-contrast":[U,G,W]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,U,G,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[U,G,W]}],"backdrop-invert":[{"backdrop-invert":[``,U,G,W]}],"backdrop-opacity":[{"backdrop-opacity":[U,G,W]}],"backdrop-saturate":[{"backdrop-saturate":[U,G,W]}],"backdrop-sepia":[{"backdrop-sepia":[``,U,G,W]}],"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`,G,W]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[U,`initial`,G,W]}],ease:[{ease:[`linear`,`initial`,_,G,W]}],delay:[{delay:[U,G,W]}],animate:[{animate:[`none`,v,G,W]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,G,W]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:oe()}],"rotate-x":[{"rotate-x":oe()}],"rotate-y":[{"rotate-y":oe()}],"rotate-z":[{"rotate-z":oe()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":[`scale-3d`],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[G,W,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":[`translate-none`],accent:[{accent:N()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:N()}],"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`,G,W]}],"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`,G,W]}],fill:[{fill:[`none`,...N()]}],"stroke-w":[{stroke:[U,wr,_r,vr]}],stroke:[{stroke:[`none`,...N()]}],"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 K(...e){return Vr(_n(e))}function Hr(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 Ur(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 Wr(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 Gr=vn(`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 q({className:e,variant:t,...n}){return(0,D.jsx)(`span`,{className:K(Gr({variant:t,className:e})),...n})}var Kr=e=>e,qr=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}),Jr=qr(2),Yr=qr(3),Xr=qr(4),Zr=qr(5),Qr={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},$r={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},ei={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 ti(e=1.70158){let t=e;return e=>e*e*((t+1)*e-t)}function ni(e=1.70158){let t=e;return e=>{let n=e-1;return n*n*((t+1)*n+t)+1}}function ri(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 ii(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 ai(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 oi(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 si=7.5625,ci=2.75,li=e=>{if(e<1/ci)return si*e*e;if(e<2/ci){let t=e-1.5/ci;return si*t*t+.75}if(e<2.5/ci){let t=e-2.25/ci;return si*t*t+.9375}let t=e-2.625/ci;return si*t*t+.984375},ui=e=>1-li(1-e),di=e=>e<.5?(1-li(1-2*e))/2:(1+li(2*e-1))/2;function fi(e){let t=Math.max(1,Math.floor(e));return e=>e>=1?1:e<=0?0:Math.floor(e*t)/t}function pi(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 mi(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 hi={linear:Kr,inQuad:Jr.in,outQuad:Jr.out,inOutQuad:Jr.inOut,inCubic:Yr.in,outCubic:Yr.out,inOutCubic:Yr.inOut,inQuart:Xr.in,outQuart:Xr.out,inOutQuart:Xr.inOut,inQuint:Zr.in,outQuint:Zr.out,inOutQuint:Zr.inOut,inSine:Qr.in,outSine:Qr.out,inOutSine:Qr.inOut,inExpo:$r.in,outExpo:$r.out,inOutExpo:$r.inOut,inCirc:ei.in,outCirc:ei.out,inOutCirc:ei.inOut,inBack:ti(),outBack:ni(),inOutBack:ri(),inElastic:ai(),outElastic:ii(),inOutElastic:oi(),inBounce:ui,outBounce:li,inOutBounce:di};function gi(e){if(typeof e==`function`)return e;if(e===void 0)return hi.outCubic;let t=hi[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 ii(t[0],t[1]);case`inElastic`:return ai(t[0],t[1]);case`inOutElastic`:return oi(t[0],t[1]);case`outBack`:return ni(t[0]);case`inBack`:return ti(t[0]);case`inOutBack`:return ri(t[0]);case`steps`:return fi(t[0]??4);case`cubicBezier`:return t.length>=4?pi(t[0],t[1],t[2],t[3]):hi.outCubic;default:return hi.outCubic}}return hi.outCubic}function _i(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 vi(e,t={}){let n=t.start??0,r=t.direction===`reverse`;return(i,a)=>{if(a<=0)return n;let o=_i(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 yi=new Set([`duration`,`delay`,`ease`,`loop`,`alternate`,`onBegin`,`onUpdate`,`onComplete`]);function bi(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 xi(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 Si(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Ci=/^(-?\d*\.?\d+)([a-z%]*)$/i;function wi(e){if(typeof e==`number`)return{value:e,unit:``};let t=e.trim().match(Ci);return t?{value:parseFloat(t[1]),unit:t[2]??``}:{value:0,unit:``}}function Ti(e){return e.unit===``?`${e.value}`:`${e.value}${e.unit}`}var Ei=new Set([`translate`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`]),Di=new WeakMap;function Oi(e){let t=Di.get(e);return t||(t={values:{}},Di.set(e,t)),t}function ki(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 Ai(e,t,n){if(Ei.has(t)){let r=Oi(e);r.values[t]=n,e.style.transform=ki(r);return}if(t===`opacity`){e.style.opacity=`${n.value}`;return}e.style.setProperty(t,Ti(n))}function ji(e,t){return Ei.has(t)?Oi(e).values[t]||{value:+!!t.startsWith(`scale`),unit:``}:wi(e.style.getPropertyValue(t)||(typeof window<`u`?window.getComputedStyle(e).getPropertyValue(t):``)||(t===`opacity`?`1`:`0`))}function Mi(e,t,n){return e+(t-e)*n}function Ni(e,t,n){return e===void 0?0:typeof e==`number`?e:e(t,n)}function Pi(e){if(e&&typeof e==`object`&&`spring`in e){let t=mi(e.spring);return{ease:t.fn,duration:t.duration}}return{ease:gi(e),duration:null}}var Fi=0,Ii=new Set;function Li(e){for(let t of Ii){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)Ai(n.el,e.name,Ri(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&&Ai(n.el,e.name,Ri(e.from,e.to,t))}n.el!==null&&r.onUpdate?.(d,n.el,n.index)}for(let e of[...Ii])e.done&&Ii.delete(e);if(Ii.size===0){Fi=0;return}Fi=requestAnimationFrame(Li)}function Ri(e,t,n){let r=e.unit||t.unit;return{value:Mi(e.value,t.value,n),unit:r}}function zi(){Fi===0&&(typeof requestAnimationFrame>`u`||(Fi=requestAnimationFrame(Li)))}function Bi(e,t){let n=xi(e),r=n.length,i=Object.keys(t).filter(e=>!yi.has(e)),a=Si(),{ease:o,duration:s}=Pi(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=bi(r);if(i===null)continue;let s,c;Array.isArray(i)?(s=wi(i[0]),c=wi(i[1])):(s=ji(e,n),c=wi(i)),a.push({name:n,from:s,to:c,ease:o})}return{el:e,index:n,props:a,duration:c,delay:Ni(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)Ai(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)Ai(r,e.name,e.from);let s={target:i,start:o,options:t,done:!1};l.push(s),Ii.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 zi(),{cancel(){if(!p){p=!0;for(let e of l)e.done=!0,Ii.delete(e)}},finished:Promise.all(u).then(()=>void 0),get done(){return p||l.every(e=>e.done)}}}var Vi=vn(`hig-button relative overflow-hidden focus-visible:outline-none disabled:pointer-events-none disabled:opacity-45`,{variants:{variant:{primary:`hig-button-primary`,secondary:``,ghost:`hig-button-plain`,danger:`hig-button-destructive`},size:{sm:`hig-button-small`,md:``,icon:`!w-7 !h-7 !min-w-0 !p-0`}},defaultVariants:{variant:`primary`,size:`md`}});function Hi(e,t){if(Si())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),Bi(i,{scale:[0,1],opacity:[.22,0],duration:540,ease:`outExpo`,onComplete:()=>{i.remove()}})}var J=_.forwardRef(({className:e,variant:t,size:n,onMouseDown:r,onClick:i,...a},o)=>(0,D.jsx)(`button`,{ref:o,className:K(Vi({variant:t,size:n,className:e})),onMouseDown:e=>{Hi(e.currentTarget,e),r?.(e)},onClick:i,...a}));J.displayName=`Button`;var Ui=vn(`hig-card flex flex-col min-h-0 overflow-hidden`,{variants:{variant:{default:``,interactive:`hover:border-[var(--color-line-2)] hover:shadow-[var(--hig-shadow-2)] transition-all cursor-pointer`,flush:`bg-transparent border-[var(--color-line-0)] shadow-none`}},defaultVariants:{variant:`default`}});function Y({className:e,variant:t,...n}){return(0,D.jsx)(`div`,{className:K(Ui({variant:t,className:e})),...n})}function X({className:e,...t}){return(0,D.jsx)(`div`,{className:K(`flex items-center justify-between gap-2 px-4 pt-3 pb-2 shrink-0`,e),...t})}function Z({className:e,...t}){return(0,D.jsx)(`div`,{className:K(`px-4 py-3 flex-1 min-h-0 overflow-auto`,e),...t})}function Wi({className:e,children:t,...n}){return(0,D.jsx)(`pre`,{className:K(`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 Gi=new Map;async function Ki(e){let t=Gi.get(e);if(t)return t.status===`ok`?t.data:t.status===`error`?null:t.promise;let n=(async()=>{try{let t=await fetch(`/api/json/rule-explain?ruleId=${encodeURIComponent(e)}`,{headers:{Accept:`application/json`}});if(!t.ok)return Gi.set(e,{status:`error`,error:`HTTP ${t.status}`}),null;let n=await t.json();return Gi.set(e,{status:`ok`,data:n}),n}catch(t){return Gi.set(e,{status:`error`,error:String(t)}),null}})();return Gi.set(e,{status:`loading`,promise:n}),n}var qi=220,Ji=90;function Yi({ruleId:e,children:t,className:n}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=()=>{u.current&&clearTimeout(u.current),d.current&&clearTimeout(d.current),u.current=null,d.current=null},p=(0,_.useCallback)(()=>{let e=l.current;if(!e)return;let t=e.getBoundingClientRect(),n=t.left;n+320>window.innerWidth-12&&(n=Math.max(12,window.innerWidth-320-12));let r=t.bottom+8;r+200>window.innerHeight-12&&(r=Math.max(12,t.top-200-8)),c({top:r,left:n})},[]),m=(0,_.useCallback)(()=>{f(),u.current=setTimeout(()=>{p(),i(!0),Ki(e).then(e=>{e&&o(e)});let t=Gi.get(e);t&&t.status===`ok`&&o(t.data)},qi)},[e,p,f]),h=(0,_.useCallback)(()=>{f(),d.current=setTimeout(()=>{i(!1)},Ji)},[f]);return(0,_.useEffect)(()=>{if(!r)return;let e=()=>p(),t=()=>p(),n=e=>{e.key===`Escape`&&i(!1)};return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,t),window.addEventListener(`keydown`,n),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,t),window.removeEventListener(`keydown`,n)}},[r,p]),(0,_.useEffect)(()=>()=>f(),[f]),(0,D.jsxs)(`span`,{ref:l,className:`ss-rule-trigger${n?` ${n}`:``}`,onMouseEnter:m,onMouseLeave:h,onFocus:m,onBlur:h,"aria-describedby":r?`rule-popover-${e}`:void 0,children:[t,r&&s&&(0,D.jsx)(`span`,{id:`rule-popover-${e}`,role:`tooltip`,className:`ss-rule-popover`,style:{top:s.top,left:s.left},onMouseEnter:()=>f(),onMouseLeave:h,children:a?(0,D.jsx)(Xi,{data:a}):(0,D.jsx)(`span`,{className:`ss-rule-popover__loading`,children:`loading rule…`})})]})}function Xi({data:e}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`span`,{className:`ss-rule-popover__head`,children:[(0,D.jsx)(`code`,{className:`ss-rule-popover__id`,children:e.ruleId}),(0,D.jsx)(`span`,{className:`ss-rule-popover__pill ss-rule-popover__pill--${e.decision}`,children:e.decision}),(0,D.jsx)(`span`,{className:`ss-rule-popover__state ss-rule-popover__state--${e.enabled?`on`:`off`}`,children:e.enabled?`ON`:`OFF`})]}),(0,D.jsx)(`strong`,{className:`ss-rule-popover__headline`,children:e.headline}),(0,D.jsx)(`span`,{className:`ss-rule-popover__summary`,children:e.summary}),e.conditions.length>1&&(0,D.jsxs)(`span`,{className:`ss-rule-popover__section`,children:[(0,D.jsx)(`span`,{className:`ss-rule-popover__label`,children:`Matches when`}),(0,D.jsx)(`ul`,{className:`ss-rule-popover__list`,children:e.conditions.map((e,t)=>(0,D.jsx)(`li`,{children:e},t))})]}),e.hints.length>0&&(0,D.jsx)(`span`,{className:`ss-rule-popover__hints`,children:e.hints.map((e,t)=>(0,D.jsx)(`span`,{className:`ss-rule-popover__hint`,children:e},t))}),(0,D.jsx)(`span`,{className:`ss-rule-popover__foot`,children:(0,D.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.ruleId)}`,className:`ss-rule-popover__link`,children:`Open in Rules →`})})]})}var Zi={dashboard:`dashboard`,native:`native`,tty:`tty`,cli:`cli`},Qi={allow:`green`,block:`red`,force:`amber`,ask:`blue`,log:`gray`},$i=[`all`,`allow`,`block`,`ask`,`force`,`log`],ea={allow:`text-emerald-300`,block:`text-red-300`,ask:`text-sky-300`,force:`text-amber-300`,log:`text-[var(--color-fg-3)]`};function ta(e){return new Date(e*1e3).toLocaleString()}function na(e,t){if(!t)return``;let n=t-e;return n<60?`${n}s`:`${Math.round(n/60)}m`}async function ra(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:H()})}async function ia(e,t){try{return await(await fetch(`/api/rules/set-enabled`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...H()},body:JSON.stringify({ruleId:e,enabled:t})})).json()}catch(e){return{error:String(e)}}}function aa(e){try{let t=JSON.parse(e).input;return t&&typeof t==`object`?Wr(``,JSON.stringify(t)):Wr(``,e)}catch{return e.slice(0,80)}}function oa(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 sa({label:e,value:t,tone:n}){return(0,D.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,D.jsx)(`span`,{className:`font-mono text-sm tabular-nums ${n??`text-[var(--color-fg-0)]`}`,children:t}),(0,D.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-[var(--color-fg-3)]`,children:e})]})}function ca(e,t){let n=Math.floor(Date.now()/1e3),r=n-86400,i=new Map;for(let t of e){if(t.decision!==`ask`||t.created_at<r||!t.rule_id)continue;let e=i.get(t.rule_id);e?(e.count+=1,t.created_at>e.lastSeen&&(e.lastSeen=t.created_at)):i.set(t.rule_id,{ruleId:t.rule_id,ruleMessage:t.rule_message||t.rule_id,count:1,lastSeen:t.created_at})}for(let e of t){if(!e.ruleId)continue;let t=i.get(e.ruleId);t?(t.count+=1,t.lastSeen=n):i.set(e.ruleId,{ruleId:e.ruleId,ruleMessage:e.ruleMessage||e.ruleId,count:1,lastSeen:n})}return Array.from(i.values()).filter(e=>e.count>=3).sort((e,t)=>t.count-e.count||t.lastSeen-e.lastSeen).slice(0,5)}function la(e){let t=Math.max(0,Math.floor(Date.now()/1e3)-e);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function ua({ruleId:e,ruleMessage:t,onDismiss:n,onUndo:r}){let[i,a]=(0,_.useState)(!1),o=(0,_.useRef)(null);return(0,_.useEffect)(()=>(o.current=setTimeout(n,6e3),()=>{o.current&&clearTimeout(o.current)}),[n]),(0,D.jsxs)(`div`,{className:`fixed bottom-5 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 px-4 py-2.5 rounded-full border border-[var(--color-line-2)] bg-[var(--color-surface-1)] backdrop-blur-md shadow-lg`,children:[(0,D.jsxs)(`span`,{className:`text-xs text-[var(--color-fg-1)]`,children:[`Silenced`,` `,(0,D.jsx)(`span`,{className:`font-mono text-[var(--color-fg-0)]`,children:t})]}),(0,D.jsx)(`button`,{type:`button`,disabled:i,onClick:async()=>{a(!0),await r(),n()},className:`text-[11px] font-mono uppercase tracking-wider px-2.5 py-1 rounded-full border border-[var(--color-brand)]/40 text-[var(--color-brand)] hover:bg-[var(--color-brand)]/10 cursor-pointer disabled:opacity-50`,"aria-label":`Undo silencing ${e}`,children:`undo`}),(0,D.jsx)(`button`,{type:`button`,onClick:n,className:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer`,"aria-label":`Dismiss`,children:(0,D.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,D.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`}),(0,D.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`})]})})]})}function da({target:e,onClose:t,onConfirm:n}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null);return(0,_.useEffect)(()=>{o(null)},[]),e?(0,D.jsxs)($t,{open:!!e,onClose:t,size:`sm`,title:`Silence this rule?`,subtitle:`It won't ask for approval again until you re-enable it on the Rules page.`,footer:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--secondary`,disabled:r,onClick:t,children:`Cancel`}),(0,D.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--primary`,style:{"--tone":`#ff6f6f`},disabled:r,onClick:async()=>{i(!0),o(null);let r=await n(e);if(i(!1),!r.ok){o(r.message??`Could not silence rule.`);return}t()},children:r?`Silencing…`:`Disable rule`})]}),children:[(0,D.jsxs)(`div`,{className:`ss-list`,children:[(0,D.jsx)(`div`,{className:`ss-list-row`,style:{cursor:`default`},children:(0,D.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,D.jsx)(`div`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-1`,children:`rule`}),(0,D.jsx)(`div`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,D.jsx)(Yi,{ruleId:e.ruleId,children:(0,D.jsx)(`code`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] block mt-1 break-all`,children:e.ruleId})})]})}),(0,D.jsx)(`div`,{className:`ss-list-row`,style:{cursor:`default`},children:(0,D.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,D.jsx)(`div`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-1`,children:`recent activity`}),(0,D.jsxs)(`div`,{className:`text-sm text-[var(--color-fg-1)]`,children:[`Triggered`,` `,(0,D.jsx)(`strong`,{className:`text-[var(--color-fg-0)] tabular-nums`,children:e.fireCount}),` `,e.fireCount===1?`time`:`times`,` in the last 24 hours.`]})]})})]}),(0,D.jsxs)(`p`,{className:`text-xs text-[var(--color-fg-3)] mt-3 leading-relaxed`,children:[`Disabling a rule is fully reversible — head to`,` `,(0,D.jsx)(`a`,{href:`/rules`,className:`text-[var(--color-brand)] hover:underline`,children:`Rules`}),` `,`to switch it back on.`]}),a&&(0,D.jsx)(`p`,{className:`mt-3 text-xs text-red-300`,role:`alert`,children:a})]}):null}function fa(){let e=Bt([`pending-changed`,`rules-changed`]),{data:t,refetch:n}=V(`/api/json/pending`,[e[`pending-changed`]]),{data:r}=V(`/api/json/approvals`,[e[`pending-changed`]]),[i,a]=(0,_.useState)(`all`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(new Set),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),m=(0,_.useMemo)(()=>ca(r??[],t??[]),[r,t]),h=(0,_.useMemo)(()=>{let e=new Map;for(let t of m)e.set(t.ruleId,t.count);return e},[m]),g=Math.floor(Date.now()/1e3),v=(r??[]).filter(e=>e.created_at>=g-86400).length,y=(r??[]).reduce((e,t)=>(e[t.decision]=(e[t.decision]??0)+1,e),{}),b=(r??[]).filter(e=>{if(i!==`all`&&e.decision!==i)return!1;if(o){let t=o.toLowerCase(),n=aa(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 x(e){l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function S(e){let t=await ia(e.ruleId,!1);return t.error||t.ok===!1?{ok:!1,message:t.error??`Server rejected the request.`}:(e.pendingId&&await ra(e.pendingId,`block`),p({ruleId:e.ruleId,ruleMessage:e.ruleMessage}),n(),{ok:!0})}async function C(e){await ia(e,!0),n()}return(0,D.jsxs)(`div`,{className:`space-y-6`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h1`,{className:`overline text-[11px]`,children:`approvals`}),(0,D.jsx)(`p`,{className:`text-xs text-[var(--color-fg-3)] mt-1 font-mono`,children:`approve or deny pending tool calls · review past decisions · silence noisy rules`})]}),(0,D.jsxs)(`div`,{"data-tutorial":`appr-stats`,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,D.jsx)(sa,{label:`pending`,value:t?.length??0,tone:`text-amber-300`}),(0,D.jsx)(`span`,{className:`text-[var(--color-line-2)]`,children:`|`}),[`allow`,`block`,`ask`,`force`,`log`].map(e=>(0,D.jsx)(sa,{label:e,value:y[e]??0,tone:ea[e]},e)),(0,D.jsx)(`span`,{className:`text-[var(--color-line-2)]`,children:`|`}),(0,D.jsx)(sa,{label:`last 24h`,value:v})]}),m.length>0&&(0,D.jsxs)(`section`,{className:`ss-noisy-card`,"aria-label":`Noisy rules`,children:[(0,D.jsxs)(`div`,{className:`ss-noisy-card-head`,children:[(0,D.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M12 9v4`}),(0,D.jsx)(`path`,{d:`M12 17h.01`}),(0,D.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`})]}),`asking too often · last 24h`]}),m.map(e=>(0,D.jsxs)(`div`,{className:`ss-noisy-row`,children:[(0,D.jsx)(`span`,{className:`ss-noisy-count`,"aria-label":`${e.count} fires`,children:e.count}),(0,D.jsxs)(`div`,{className:`ss-noisy-text`,children:[(0,D.jsx)(`span`,{className:`ss-noisy-title`,children:e.ruleMessage}),(0,D.jsxs)(`span`,{className:`ss-noisy-sub`,children:[(0,D.jsx)(Yi,{ruleId:e.ruleId,children:(0,D.jsx)(`code`,{className:`font-mono`,children:e.ruleId})}),(0,D.jsx)(`span`,{style:{margin:`0 6px`},children:`·`}),`last fired `,la(e.lastSeen)]})]}),(0,D.jsxs)(`button`,{type:`button`,className:`ss-pill ss-pill--danger`,onClick:()=>d({ruleId:e.ruleId,ruleMessage:e.ruleMessage,fireCount:e.count}),"aria-label":`Silence rule ${e.ruleId}`,children:[(0,D.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,D.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,D.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]}),`Silence`]})]},e.ruleId))]}),t&&t.length>0&&(0,D.jsxs)(`section`,{"data-tutorial":`appr-pending`,children:[(0,D.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,D.jsxs)(`h2`,{className:`overline text-[11px]`,children:[`pending · `,t.length]})}),(0,D.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>{let t=h.get(e.ruleId)??0;return(0,D.jsxs)(Y,{className:`border-l-2 border-l-amber-400/60`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,D.jsxs)(`div`,{className:`flex gap-2 flex-wrap items-center`,children:[(0,D.jsx)(J,{size:`sm`,variant:`primary`,onClick:async()=>{await ra(e.id,`allow`),n()},children:`approve`}),(0,D.jsx)(J,{size:`sm`,variant:`danger`,onClick:async()=>{await ra(e.id,`block`),n()},children:`deny`}),(0,D.jsxs)(`button`,{type:`button`,className:`ss-pill ss-pill--danger`,onClick:()=>d({ruleId:e.ruleId,ruleMessage:e.ruleMessage,fireCount:t||1,pendingId:e.id}),"aria-label":`Disable rule ${e.ruleId}`,children:[(0,D.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,D.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,D.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]}),`Disable rule`]})]})]}),(0,D.jsxs)(Z,{className:`space-y-2 text-xs`,children:[(0,D.jsxs)(`div`,{className:`flex gap-3 flex-wrap items-center`,children:[(0,D.jsx)(`span`,{className:`overline`,children:`tool`}),(0,D.jsx)(`code`,{className:`text-[var(--color-brand)] font-mono`,children:e.toolCall.tool}),(0,D.jsx)(`span`,{className:`overline ml-2`,children:`rule`}),(0,D.jsx)(Yi,{ruleId:e.ruleId,children:(0,D.jsx)(`span`,{className:`font-mono text-[var(--color-fg-2)]`,children:e.ruleId})}),t>=3&&(0,D.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded-full`,style:{background:`color-mix(in oklab, #ffa657 14%, transparent)`,color:`#ffb27d`,border:`1px solid color-mix(in oklab, #ffa657 28%, transparent)`},title:`Fired ${t} times in the last 24h`,children:[`asks often · `,t,`×`]})]}),e.prompt&&(0,D.jsxs)(`div`,{className:`flex gap-2 items-start`,children:[(0,D.jsx)(`span`,{className:`overline pt-0.5 shrink-0`,children:`why`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.prompt})]}),(0,D.jsx)(Wi,{children:JSON.stringify(e.toolCall.input,null,2)})]})]},e.id)})})]}),(0,D.jsxs)(`section`,{"data-tutorial":`appr-history`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between mb-3 gap-3 flex-wrap`,children:[(0,D.jsx)(`h2`,{className:`overline text-[11px]`,children:`history`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,D.jsx)(`div`,{className:`flex gap-0.5 rounded-sm border border-[var(--color-line-1)] p-0.5 bg-[var(--color-surface-1)]`,children:$i.map(e=>(0,D.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,D.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,D.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`}):b.length===0?(0,D.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,D.jsx)(Y,{children:(0,D.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:b.map(e=>{let t=c.has(e.id),n=aa(e.input),r=na(e.created_at,e.resolved_at);return(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`button`,{onClick:()=>x(e.id),className:`w-full text-left px-3 py-2 hover:bg-[var(--color-surface-2)]/60 transition-colors cursor-pointer flex items-start gap-3`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-[10px] w-2.5 shrink-0 mt-1`,children:t?`▼`:`▶`}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col gap-1`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,D.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] whitespace-nowrap tabular-nums`,children:ta(e.resolved_at??e.created_at)}),(0,D.jsx)(q,{variant:Qi[e.decision]??`gray`,children:e.decision}),e.source&&(0,D.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded-sm border border-[var(--color-line-1)] text-[var(--color-fg-3)]`,title:`Approval source: ${e.source}`,children:Zi[e.source]??e.source}),(0,D.jsx)(`code`,{className:`text-xs text-[var(--color-brand)] font-mono`,children:e.tool}),r&&(0,D.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] ml-auto`,children:[`Δ`,r]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,D.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,D.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)] font-mono truncate flex-1 min-w-0 hidden md:block`,children:n})]})]})]}),t&&(0,D.jsxs)(`div`,{className:`px-3 pb-3 pt-1 space-y-2 bg-[var(--color-surface-0)]`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs font-mono items-center`,children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`rule`}),` `,e.rule_id?(0,D.jsx)(Yi,{ruleId:e.rule_id,children:(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.rule_id})}):(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:`—`})]}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`created`}),` `,(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:ta(e.created_at)})]}),e.resolved_at&&(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`resolved`}),` `,(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:ta(e.resolved_at)})]}),e.rule_id&&(0,D.jsxs)(`button`,{type:`button`,className:`ss-pill ss-pill--danger ml-auto`,onClick:()=>d({ruleId:e.rule_id,ruleMessage:e.rule_message||e.rule_id,fireCount:h.get(e.rule_id)??1}),"aria-label":`Silence rule ${e.rule_id}`,children:[(0,D.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,D.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,D.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]}),`Silence rule`]})]}),e.prompt&&(0,D.jsxs)(`div`,{className:`text-xs flex gap-2 items-start`,children:[(0,D.jsx)(`span`,{className:`overline pt-0.5 shrink-0`,children:`why`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.prompt})]}),(0,D.jsx)(Wi,{children:oa(e.input)})]})]},e.id)})})})]}),(0,D.jsx)(da,{target:u,onClose:()=>d(null),onConfirm:S}),f&&(0,D.jsx)(ua,{ruleId:f.ruleId,ruleMessage:f.ruleMessage,onDismiss:()=>p(null),onUndo:()=>C(f.ruleId)})]})}function pa(e){return e==null?`—`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function ma(e){if(e<60)return`${e}s`;let t=Math.floor(e/60);if(t<60)return`${t}m`;let n=Math.floor(t/60);return n<24?`${n}h`:`${Math.floor(n/24)}d ${n%24}h`}function ha(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(``),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(null),g=(0,_.useCallback)(async()=>{try{let e=await fetch(`/api/json/audit-config`);if(!e.ok)return;let n=await e.json();t(n),a(String(n.config.maxRows)),s(String(n.config.absoluteMaxRows)),l(String(n.config.minRetentionHours)),d(n.config.maxBytes==null?``:String(Math.round(n.config.maxBytes/(1024*1024))))}catch{}},[]);(0,_.useEffect)(()=>{g()},[g]);let v=(0,_.useMemo)(()=>!e?.usage.oldestTimestampSec||!e?.usage.newestTimestampSec?null:e.usage.newestTimestampSec-e.usage.oldestTimestampSec,[e]),y=async()=>{if(!e)return;p(!0),h(null);let t={},n=Number(i);Number.isFinite(n)&&n!==e.config.maxRows&&(t.maxRows=n);let r=Number(o);Number.isFinite(r)&&r!==e.config.absoluteMaxRows&&(t.absoluteMaxRows=r);let a=Number(c);if(Number.isFinite(a)&&a!==e.config.minRetentionHours&&(t.minRetentionHours=a),u.trim()===``)e.config.maxBytes!=null&&(t.maxBytes=null);else{let n=Number(u);if(Number.isFinite(n)){let r=Math.round(n*1024*1024);r!==e.config.maxBytes&&(t.maxBytes=r)}}if(Object.keys(t).length===0){h({kind:`ok`,text:`No changes.`}),p(!1);return}try{let e=await fetch(`/api/json/audit-config`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!e.ok){let t=await e.json();throw Error(t.error??`HTTP ${e.status}`)}await g(),h({kind:`ok`,text:`Saved. New budget applies within ~60 seconds.`})}catch(e){h({kind:`err`,text:e instanceof Error?e.message:String(e)})}finally{p(!1)}},b=async()=>{if(e){p(!0),h(null);try{let t=await fetch(`/api/json/audit-config`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e.defaults)});if(!t.ok){let e=await t.json();throw Error(e.error??`HTTP ${t.status}`)}await g(),h({kind:`ok`,text:`Reset to defaults.`})}catch(e){h({kind:`err`,text:e instanceof Error?e.message:String(e)})}finally{p(!1)}}};if(!e)return(0,D.jsx)(D.Fragment,{});let x=`w-32 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`,S=`text-[10.5px] uppercase tracking-wider text-[var(--color-fg-4)]`,C=`text-[10.5px] font-mono text-[var(--color-fg-4)] tabular-nums`;return(0,D.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,children:[(0,D.jsxs)(`button`,{onClick:()=>r(e=>!e),className:`w-full flex items-center justify-between px-3 py-2 hover:bg-white/[0.02] cursor-pointer`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 text-[11.5px]`,children:[(0,D.jsx)(`span`,{className:`font-medium text-[var(--color-fg-1)]`,children:`Storage budget`}),(0,D.jsxs)(`span`,{className:C,children:[e.usage.rows.toLocaleString(),` rows`,e.usage.bytes!=null&&` · ${pa(e.usage.bytes)}`,v!=null&&` · spans ${ma(v)}`]})]}),(0,D.jsx)(`span`,{className:C,children:n?`▾`:`▸`})]}),n&&(0,D.jsxs)(`div`,{className:`border-t border-[var(--color-line-1)] px-3 py-3 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-3`,children:[(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:S,children:`Soft row cap`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`input`,{type:`number`,value:i,min:e.limits.maxRows.min,max:e.limits.maxRows.max,onChange:e=>a(e.target.value),className:x}),(0,D.jsx)(`span`,{className:C,children:`rows`})]}),(0,D.jsx)(`p`,{className:`text-[10.5px] text-[var(--color-fg-4)] leading-relaxed`,children:`Above this, old rows are rotated — but never within the retention window.`})]}),(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:S,children:`Hard ceiling`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`input`,{type:`number`,value:o,min:e.limits.absoluteMaxRows.min,max:e.limits.absoluteMaxRows.max,onChange:e=>s(e.target.value),className:x}),(0,D.jsx)(`span`,{className:C,children:`rows`})]}),(0,D.jsx)(`p`,{className:`text-[10.5px] text-[var(--color-fg-4)] leading-relaxed`,children:`Pruned regardless of age once exceeded. Protects against runaway disk growth.`})]}),(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:S,children:`Retention floor`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`input`,{type:`number`,value:c,step:`0.5`,min:e.limits.minRetentionHours.min,max:e.limits.minRetentionHours.max,onChange:e=>l(e.target.value),className:x}),(0,D.jsx)(`span`,{className:C,children:`hours`})]}),(0,D.jsx)(`p`,{className:`text-[10.5px] text-[var(--color-fg-4)] leading-relaxed`,children:`Rows newer than this are never deleted by the soft cap. Set 0 to disable the floor.`})]}),(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:S,children:`Size cap (optional)`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`input`,{type:`number`,value:u,placeholder:`off`,min:1,onChange:e=>d(e.target.value),className:x}),(0,D.jsx)(`span`,{className:C,children:`MB`})]}),(0,D.jsx)(`p`,{className:`text-[10.5px] text-[var(--color-fg-4)] leading-relaxed`,children:`Bytes-based eviction. Leave blank to disable. Honors the retention floor like the soft cap.`})]})]}),m&&(0,D.jsx)(`p`,{className:`text-[11px] font-mono ${m.kind===`err`?`text-rose-300`:`text-emerald-300`}`,children:m.text}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,D.jsx)(`button`,{onClick:y,disabled:f,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-1)] hover:text-[var(--color-fg-0)] bg-[var(--color-surface-2)] hover:bg-[var(--color-surface-3)] border border-[var(--color-line-1)] rounded-sm px-3 py-1.5 disabled:opacity-50 cursor-pointer`,children:f?`saving…`:`save`}),(0,D.jsx)(`button`,{onClick:b,disabled:f,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] border border-[var(--color-line-1)] rounded-sm px-3 py-1.5 disabled:opacity-50 cursor-pointer`,children:`reset to defaults`})]})]})]})}var ga={"http-json":`HTTP webhook (generic JSON)`,"splunk-hec":`Splunk HEC`,datadog:`Datadog logs`,"file-jsonl":`Local JSONL file`};function _a(e){if(!e)return`never`;let t=Date.now()/1e3-e;return t<60?`${Math.floor(t)}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function va(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(``),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(null),y=async()=>{t(await(await fetch(`/api/json/audit-sinks`)).json())};(0,_.useEffect)(()=>{y()},[y]);let b=(0,_.useMemo)(()=>e?new Map(e.status.map(e=>[e.sink_id,e])):new Map,[e]),x=t=>{if(!e)return;let n=`${t}-${Date.now().toString(36).slice(-4)}`,r={id:n,name:ga[t],type:t,enabled:!1,endpoint:t===`file-jsonl`?void 0:``,path:t===`file-jsonl`?`~/.sigmashake/audit-export.jsonl`:void 0,auth:{type:`none`},batch:{maxEvents:100,maxBytes:1e6,intervalMs:3e4},retry:{maxAttempts:5,baseMs:1e3,maxMs:6e4},filter:{},payload:{template:e.starterTemplates[t]}};a(n),s(r),l(!1),d(JSON.stringify(r,null,2)),h(null),v(null)},S=e=>{a(e.id),s(JSON.parse(JSON.stringify(e))),l(!1),d(JSON.stringify(e,null,2)),h(null),v(null)},C=()=>{a(null),s(null),l(!1),d(``),h(null),v(null)},w=()=>{if(c)try{return JSON.parse(u)}catch{return null}return o},T=async()=>{let e=w();if(!e){h({kind:`err`,text:`JSON is invalid`});return}p(!0),h(null);try{let t=await fetch(`/api/json/audit-sinks`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json();throw Error(e.error??`HTTP ${t.status}`)}await y(),h({kind:`ok`,text:`Saved.`}),C()}catch(e){h({kind:`err`,text:e instanceof Error?e.message:String(e)})}finally{p(!1)}},E=async e=>{if(confirm(`Delete sink "${e}"? Forwarded events stay; new events won't be sent here.`)){p(!0);try{let t=await fetch(`/api/json/audit-sinks?id=${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok){let e=await t.json();throw Error(e.error??`HTTP ${t.status}`)}await y(),h({kind:`ok`,text:`Deleted.`})}catch(e){h({kind:`err`,text:e instanceof Error?e.message:String(e)})}finally{p(!1)}}},O=async()=>{let e=w();if(!e){h({kind:`err`,text:`JSON is invalid`});return}p(!0),v(null);try{let t=await(await fetch(`/api/json/audit-sinks/test`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})).json();v({...t.result,rendered:t.rendered})}catch(e){v({ok:!1,status:0,error:e instanceof Error?e.message:String(e)})}finally{p(!1)}},k=async e=>{p(!0);try{let t=await fetch(`/api/json/audit-sinks`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...e,enabled:!e.enabled})});if(!t.ok)throw Error(`HTTP ${t.status}`);await y()}catch(e){h({kind:`err`,text:e instanceof Error?e.message:String(e)})}finally{p(!1)}};if(!e)return(0,D.jsx)(D.Fragment,{});let ee=`text-[10.5px] font-mono text-[var(--color-fg-4)] tabular-nums`,A=`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`,j=`text-[10.5px] uppercase tracking-wider text-[var(--color-fg-4)]`,M=`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] border border-[var(--color-line-1)] rounded-sm px-3 py-1.5 disabled:opacity-50 cursor-pointer`;return(0,D.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,children:[(0,D.jsxs)(`button`,{onClick:()=>r(e=>!e),className:`w-full flex items-center justify-between px-3 py-2 hover:bg-white/[0.02] cursor-pointer`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 text-[11.5px]`,children:[(0,D.jsx)(`span`,{className:`font-medium text-[var(--color-fg-1)]`,children:`Centralized logging`}),(0,D.jsx)(`span`,{className:ee,children:e.sinks.length===0?`no destinations`:`${e.sinks.filter(e=>e.enabled).length} of ${e.sinks.length} active`})]}),(0,D.jsx)(`span`,{className:ee,children:n?`▾`:`▸`})]}),n&&(0,D.jsxs)(`div`,{className:`border-t border-[var(--color-line-1)] px-3 py-3 space-y-3`,children:[(0,D.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] leading-relaxed`,children:`Forward every audit event to your SIEM or log lake. Each destination has its own filter + payload template — edit the JSON directly to map fields to whatever shape your destination expects.`}),e.sinks.length>0&&(0,D.jsx)(`div`,{className:`space-y-1.5`,children:e.sinks.map(e=>{let t=b.get(e.id);return(0,D.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)]`,children:[(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.enabled?t?.last_status===`ok`?`bg-emerald-400`:t?.last_status===`dead-lettered`?`bg-rose-400`:`bg-amber-400`:`bg-[var(--color-fg-4)]`}`}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-[11.5px] font-mono`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,children:e.name}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:ga[e.type]})]}),(0,D.jsxs)(`div`,{className:`${ee} truncate`,children:[e.endpoint??e.path??``,t&&(0,D.jsxs)(D.Fragment,{children:[` · `,`sent: `,t.last_status??`—`,` · last:`,` `,_a(t.last_sent_at),t.dropped_count>0&&(0,D.jsxs)(`span`,{className:`text-rose-300`,children:[` · `,`dropped: `,t.dropped_count]})]})]}),t?.last_error&&(0,D.jsx)(`div`,{className:`text-[10.5px] font-mono text-rose-300 truncate`,children:t.last_error})]}),(0,D.jsx)(`button`,{onClick:()=>k(e),disabled:f,className:M,children:e.enabled?`disable`:`enable`}),(0,D.jsx)(`button`,{onClick:()=>S(e),disabled:f,className:M,children:`edit`}),(0,D.jsx)(`button`,{onClick:()=>E(e.id),disabled:f,className:`${M} hover:!text-rose-300`,children:`delete`})]},e.id)})}),i===null&&(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(`span`,{className:ee,children:`add destination:`}),(e.sinkTypes??[]).map(e=>(0,D.jsxs)(`button`,{onClick:()=>x(e),className:M,children:[`+ `,ga[e]]},e))]}),i!==null&&o&&(0,D.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-brand)]/30 bg-[var(--color-surface-0)] p-3 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsxs)(`div`,{className:`text-[11.5px] font-medium text-[var(--color-fg-1)]`,children:[i,` · `,ga[o.type]]}),(0,D.jsx)(`button`,{onClick:()=>l(e=>!e),className:M,children:c?`form view`:`raw JSON`})]}),!c&&(0,D.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-3`,children:[(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Display name`}),(0,D.jsx)(`input`,{type:`text`,value:o.name,onChange:e=>s({...o,name:e.target.value}),className:`${A} w-full`})]}),o.type!==`file-jsonl`&&(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Endpoint URL`}),(0,D.jsx)(`input`,{type:`text`,value:o.endpoint??``,placeholder:`https://…`,onChange:e=>s({...o,endpoint:e.target.value}),className:`${A} w-full`})]}),o.type===`file-jsonl`&&(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`File path`}),(0,D.jsx)(`input`,{type:`text`,value:o.path??``,onChange:e=>s({...o,path:e.target.value}),className:`${A} w-full`})]}),o.type!==`file-jsonl`&&(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Auth`}),(0,D.jsxs)(`select`,{value:o.auth.type,onChange:e=>{let t=e.target.value,n=t===`bearer`?{type:`bearer`,token:``}:t===`basic`?{type:`basic`,username:``,password:``}:t===`header`?{type:`header`,name:``,value:``}:{type:`none`};s({...o,auth:n})},className:`${A} w-full cursor-pointer`,children:[(0,D.jsx)(`option`,{value:`none`,children:`none`}),(0,D.jsx)(`option`,{value:`bearer`,children:`bearer token`}),(0,D.jsx)(`option`,{value:`basic`,children:`basic auth`}),(0,D.jsx)(`option`,{value:`header`,children:`custom header`})]})]}),o.auth.type===`bearer`&&(0,D.jsxs)(`div`,{className:`space-y-1 md:col-span-2`,children:[(0,D.jsx)(`label`,{className:j,children:`Token`}),(0,D.jsx)(`input`,{type:`password`,value:o.auth.token,onChange:e=>s({...o,auth:{type:`bearer`,token:e.target.value}}),className:`${A} w-full`})]}),o.auth.type===`basic`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Username`}),(0,D.jsx)(`input`,{type:`text`,value:o.auth.username,onChange:e=>o.auth.type===`basic`&&s({...o,auth:{...o.auth,username:e.target.value}}),className:`${A} w-full`})]}),(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Password`}),(0,D.jsx)(`input`,{type:`password`,value:o.auth.password,onChange:e=>o.auth.type===`basic`&&s({...o,auth:{...o.auth,password:e.target.value}}),className:`${A} w-full`})]})]}),o.auth.type===`header`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Header name`}),(0,D.jsx)(`input`,{type:`text`,value:o.auth.name,onChange:e=>o.auth.type===`header`&&s({...o,auth:{...o.auth,name:e.target.value}}),className:`${A} w-full`})]}),(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Header value`}),(0,D.jsx)(`input`,{type:`password`,value:o.auth.value,onChange:e=>o.auth.type===`header`&&s({...o,auth:{...o.auth,value:e.target.value}}),className:`${A} w-full`})]})]}),(0,D.jsxs)(`div`,{className:`space-y-1 md:col-span-2`,children:[(0,D.jsxs)(`label`,{className:j,children:[`Payload template (JSON; `,`{{field}}`,` placeholders)`]}),(0,D.jsx)(`textarea`,{value:JSON.stringify(o.payload.template??{},null,2),rows:10,onChange:e=>{try{let t=JSON.parse(e.target.value);s({...o,payload:{...o.payload,template:t}}),h(null)}catch{h({kind:`err`,text:`Template is not valid JSON`})}},className:`${A} w-full leading-snug`})]})]}),c&&(0,D.jsx)(`textarea`,{value:u,rows:20,onChange:e=>d(e.target.value),className:`${A} w-full leading-snug`}),g&&(0,D.jsxs)(`div`,{className:`rounded-sm border px-3 py-2 text-[11px] font-mono ${g.ok?`border-emerald-400/40 text-emerald-200 bg-emerald-400/5`:`border-rose-400/40 text-rose-200 bg-rose-400/5`}`,children:[(0,D.jsxs)(`div`,{children:[g.ok?`✓ delivered`:`✗ failed`,` (HTTP`,` `,g.status,`)`,g.error&&(0,D.jsx)(`span`,{className:`ml-2 text-rose-200`,children:g.error})]}),g.rendered!=null&&(0,D.jsxs)(`details`,{className:`mt-1`,children:[(0,D.jsx)(`summary`,{className:`cursor-pointer text-[10px] text-[var(--color-fg-4)]`,children:`payload sent`}),(0,D.jsx)(`pre`,{className:`mt-1 text-[10px] whitespace-pre-wrap break-all bg-black/30 rounded-sm px-2 py-1 max-h-48 overflow-y-auto`,children:JSON.stringify(g.rendered,null,2)})]})]}),m&&(0,D.jsx)(`p`,{className:`text-[11px] font-mono ${m.kind===`err`?`text-rose-300`:`text-emerald-300`}`,children:m.text}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`button`,{onClick:T,disabled:f,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-1)] hover:text-[var(--color-fg-0)] bg-[var(--color-surface-2)] hover:bg-[var(--color-surface-3)] border border-[var(--color-line-1)] rounded-sm px-3 py-1.5 disabled:opacity-50 cursor-pointer`,children:f?`saving…`:`save`}),(0,D.jsx)(`button`,{onClick:O,disabled:f,className:M,children:`send test event`}),(0,D.jsx)(`button`,{onClick:C,disabled:f,className:M,children:`cancel`})]})]})]})]})}var ya={__daemon:`SigmaShake itself`,bash:`Run a terminal command`,shell:`Run a terminal command`,run_command:`Run a terminal command`,exec:`Run a terminal command`,run_shell_command:`Run a terminal command`,read:`Read a file`,read_file:`Read a file`,view_file:`Read a file`,cat:`Read a file`,view:`Read a file`,write:`Save changes to a file`,write_to_file:`Save changes to a file`,create_file:`Create a new file`,edit:`Edit an existing file`,multiedit:`Edit several spots in a file`,patch:`Edit an existing file`,apply_patch:`Edit an existing file`,replace:`Edit an existing file`,grep:`Search the codebase`,ripgrep:`Search the codebase`,search:`Search the codebase`,search_codebase:`Search the codebase`,glob:`Find files by name`,find:`Find files by name`,list_files:`List files in a folder`,ls:`List files in a folder`,webfetch:`Read a webpage`,fetch:`Read a webpage`,websearch:`Search the web`,search_web:`Search the web`,browser_action:`Use a web browser`,agent:`Ask a helper AI to investigate`,spawn:`Ask a helper AI to investigate`,task:`Update its to-do list`,todowrite:`Update its to-do list`,todo_write:`Update its to-do list`,notebookedit:`Edit a Jupyter notebook`,notebook_edit:`Edit a Jupyter notebook`};function ba(e){return e?ya[e.toLowerCase()]||`Use the ${e.replace(/^_+/,``)} tool`:`Take an action`}function xa(e){return e?{"claude-code":`Claude Code`,claudecode:`Claude Code`,cursor:`Cursor`,copilot:`GitHub Copilot`,codex:`OpenAI Codex`,gemini:`Gemini`,antigravity:`Antigravity`,pi:`Pi`,generic:`AI agent`,daemon:`SigmaShake`}[e.toLowerCase()]??e:`AI agent`}function Sa(e){return e?e.startsWith(`__`):!1}function Ca(e){for(let t of[`file_path`,`path`,`TargetFile`,`AbsolutePath`,`filename`,`file`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function wa(e){for(let t of[`command`,`CommandLine`,`cmd`,`Input`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function Ta(e){for(let t of[`query`,`pattern`,`Query`,`q`,`search`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function Ea(e){for(let t of[`url`,`URL`,`Url`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function Da(e){let t=e.replace(/[\\/]+$/,``),n=t.lastIndexOf(`/`),r=t.lastIndexOf(`\\`),i=Math.max(n,r);return i>=0?t.slice(i+1):t}function Oa(e){let t=e.trim(),n=(t.split(/[|;&]/)[0]?.trim()??t).split(/\s+/),r=n[0]?.toLowerCase()??``,i=n[1]?.toLowerCase()??``,a=(e,t)=>({headline:e,detail:t});if(r===`rm`)return a(`Delete files`,`Deleting files from disk: \`${t}\``);if(r===`mkdir`)return a(`Create a folder`,`Creating a new folder: \`${t}\``);if(r===`mv`)return a(`Move or rename a file`,`Moving or renaming: \`${t}\``);if(r===`cp`)return a(`Copy a file`,`Copying files: \`${t}\``);if(r===`cat`||r===`head`||r===`tail`||r===`less`)return a(`Show file contents`,`Printing file contents: \`${t}\``);if(r===`ls`||r===`tree`||r===`find`)return a(`List files`,`Listing files: \`${t}\``);if(r===`cd`||r===`pwd`)return a(`Check the working folder`,`Checking or changing the current folder: \`${t}\``);if(r===`echo`||r===`printf`)return a(`Print a message`,`Printing a message: \`${t}\``);if(r===`curl`||r===`wget`)return a(`Download from the internet`,`Downloading something from the internet: \`${t}\``);if(r===`kill`||r===`pkill`)return a(`Stop a running program`,`Stopping a running program: \`${t}\``);if(r===`git`)return new Set([`status`,`log`,`diff`,`show`,`branch`,`remote`,`blame`,`config`]).has(i)?a(`Check git history`,`Reading git information (\`git ${i}\`) — no changes are made.`):i===`add`||i===`restore`||i===`reset`?a(`Stage or unstage changes`,`Preparing changes for commit (\`git ${i}\`).`):i===`commit`?a(`Save a checkpoint`,`Saving a snapshot of your changes to git history.`):i===`push`?a(`Send code to the remote`,`Uploading your commits to the remote git repository (e.g. GitHub).`):i===`pull`||i===`fetch`?a(`Get latest from the remote`,`Downloading the newest commits from the remote repository.`):i===`checkout`||i===`switch`?a(`Switch git branch`,`Switching which version of the code is loaded (\`git ${i}\`).`):i===`merge`||i===`rebase`?a(`Combine git branches`,`Combining changes from another branch (\`git ${i}\`).`):a(`Use git`,`Running a git command: \`${t}\``);if(r===`npm`||r===`bun`||r===`pnpm`||r===`yarn`){if(i===`install`||i===`i`||i===`add`)return a(`Install packages`,`Downloading project dependencies from the internet (\`${r} ${i}\`).`);if(i===`run`)return a(`Run a project script`,`Running a project script: \`${t}\``);if(i===`test`)return a(`Run automated tests`,`Running the project's automated tests.`);if(i===`build`)return a(`Build the project`,`Compiling the project for release.`)}return r===`pip`||r===`pip3`||r===`uv`?a(`Install Python packages`,`Installing Python packages: \`${t}\``):r===`pytest`||r===`jest`||r===`vitest`||r===`mocha`||r===`bun`&&i===`test`?a(`Run automated tests`,`Running automated tests: \`${t}\``):r===`docker`||r===`podman`?a(`Use Docker`,`Running a container command: \`${t}\``):r===`ssh`||r===`scp`||r===`rsync`?a(`Talk to another machine`,`Connecting to another computer over the network: \`${t}\``):a(`Run a terminal command`,`Running in the terminal: \`${t}\``)}function ka(e,t){let n=e??``,r=n.toLowerCase(),i=ba(n),a=null;try{let e=JSON.parse(t);e&&typeof e==`object`&&!Array.isArray(e)&&(a=e)}catch{}if(r===`__daemon`){let e=a?.event,t=a?.detail;return typeof e==`string`&&e.length>0?{headline:`SigmaShake itself`,detail:`SigmaShake ${e===`start`?`started`:e===`stop`?`stopped`:e}${typeof t==`string`&&t.length>0?` — ${t}`:``}.`}:{headline:`SigmaShake itself`,detail:`A SigmaShake lifecycle event.`}}if(!a)return{headline:i,detail:`${i}.`};if(r===`bash`||r===`shell`||r===`run_command`||r===`exec`||r===`run_shell_command`){let e=wa(a);return e?Oa(e):{headline:i,detail:`Running a terminal command.`}}if(r===`read`||r===`read_file`||r===`view_file`||r===`cat`||r===`view`){let e=Ca(a);return e?{headline:i,detail:`Reading the file \`${Da(e)}\` so it can understand the current code. No changes are made.`}:{headline:i,detail:`Reading a file. No changes are made.`}}if(r===`write`||r===`write_to_file`||r===`create_file`){let e=Ca(a);return e?{headline:`Save changes to a file`,detail:`Creating or overwriting the file \`${Da(e)}\`. This will replace anything that was there before.`}:{headline:i,detail:`Creating or overwriting a file.`}}if(r===`edit`||r===`multiedit`||r===`patch`||r===`apply_patch`||r===`replace`){let e=Ca(a);return e?{headline:i,detail:`Editing the file \`${Da(e)}\` — changing specific parts of it without rewriting the whole thing.`}:{headline:i,detail:`Editing a file in place.`}}if(r===`grep`||r===`ripgrep`||r===`search`||r===`search_codebase`){let e=Ta(a);return e?{headline:i,detail:`Searching the project for the text "${e}".`}:{headline:i,detail:`Searching the project for matching text.`}}if(r===`glob`||r===`find`||r===`list_files`||r===`ls`){let e=Ta(a)??Ca(a);return e?{headline:i,detail:`Looking for files matching "${e}".`}:{headline:i,detail:`Looking for files in the project.`}}if(r===`webfetch`||r===`fetch`||r===`browser_action`){let e=Ea(a);return e?{headline:i,detail:`Reading a webpage from the internet: ${e}`}:{headline:i,detail:`Reading a webpage from the internet.`}}if(r===`websearch`||r===`search_web`){let e=Ta(a);return e?{headline:i,detail:`Searching the web for "${e}".`}:{headline:i,detail:`Searching the web.`}}return r===`agent`||r===`spawn`?{headline:i,detail:`Asking a separate helper AI to investigate something on its own, then report back. Helps keep this conversation focused.`}:r===`task`||r===`todowrite`||r===`todo_write`?{headline:i,detail:`Updating its internal to-do list so it can keep track of progress on a multi-step task.`}:{headline:i,detail:`${i}.`}}function Aa({val:e}){return e==null?(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] italic font-mono text-xs`,children:`null`}):typeof e==`boolean`?(0,D.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,D.jsx)(`span`,{className:`font-mono tabular-nums text-violet-300 text-xs`,children:e}):typeof e==`string`?e.length===0?(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] italic text-xs font-mono`,children:`empty string`}):e.length>200?(0,D.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,D.jsx)(`span`,{className:`font-mono text-xs text-[var(--color-fg-1)] break-all`,children:e}):(0,D.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 ja({inputJson:e}){let t=[];try{let n=JSON.parse(e);n&&typeof n==`object`&&!Array.isArray(n)&&(t=Object.entries(n))}catch{return(0,D.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,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-xs italic font-mono`,children:`no input fields`}):(0,D.jsx)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] overflow-hidden text-xs`,children:t.map(([e,t],n)=>(0,D.jsxs)(`div`,{className:`flex gap-0 ${n>0?`border-t border-[var(--color-line-0)]`:``}`,children:[(0,D.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,D.jsx)(`div`,{className:`flex-1 min-w-0 px-3 py-2 leading-relaxed`,children:(0,D.jsx)(Aa,{val:t})})]},e))})}var Ma={allow:`green`,block:`red`,force:`amber`,ask:`blue`,log:`gray`},Na={allow:`Allowed`,block:`Blocked`,force:`Forced`,ask:`Held`,log:`Logged`},Pa={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 Fa(e){return e==null?null:e<1e6?`${(e/1e3).toFixed(0)}µs`:`${(e/1e6).toFixed(1)}ms`}function Ia({label:e,value:t,mono:n,children:r}){return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`overline mb-1`,children:e}),r??(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)] text-xs ${n?`font-mono`:``} break-all`,children:t??`—`})]})}function La({text:e}){let[t,n]=(0,_.useState)(!1);return(0,D.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 Ra({row:e,defaultExpanded:t=!1}){let[n,r]=(0,_.useState)(t),i=(0,_.useRef)(null),a=(0,_.useRef)(!0),o=Wr(e.tool,e.input),s=o&&o.length>0?o:e.input&&e.input!==`{}`&&e.input!==``?e.input:`—`,c=Ma[e.decision]??`gray`,l=Pa[e.decision]??`border-l-[var(--color-line-2)]`,u=Ur(e.timestamp),d=Fa(e.duration_ns),f=ka(e.tool,e.input);(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(Si()){e.style.maxHeight=n?`none`:`0`,e.style.opacity=n?`1`:`0`;return}if(n){let t=e.scrollHeight;Bi(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;Bi(e,{"max-height":[`${t}px`,`0px`],opacity:[1,0],duration:180,ease:`outCubic`})}}},[n]);let p=(()=>{try{return JSON.stringify(JSON.parse(e.input),null,2)}catch{return e.input}})();return(0,D.jsxs)(`div`,{className:`border border-[var(--color-line-1)] border-l-2 ${l} rounded-sm bg-[var(--color-surface-1)] overflow-hidden transition-colors hover:border-[var(--color-line-2)] hover:border-l-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer select-none group`,onClick:()=>r(e=>!e),role:`button`,"aria-expanded":n,children:[(0,D.jsx)(`svg`,{className:`shrink-0 w-3 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,D.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),(0,D.jsx)(`time`,{className:`shrink-0 font-mono text-[11px] text-[var(--color-fg-3)] w-14 tabular-nums`,title:u,dateTime:new Date(e.timestamp*1e3).toISOString(),children:Hr(e.timestamp)}),(0,D.jsx)(q,{variant:c,className:`shrink-0 w-20 justify-center`,children:Na[e.decision]??e.decision}),(0,D.jsxs)(`span`,{className:`flex-1 min-w-0 flex items-baseline gap-2`,title:`${f.headline} · ${e.tool}`,children:[(0,D.jsx)(`span`,{className:`text-[12px] text-[var(--color-fg-0)] font-medium truncate`,children:f.headline}),!Sa(e.tool)&&s!==`—`&&(0,D.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)] font-mono truncate hidden sm:inline`,title:s,children:s})]}),d&&(0,D.jsx)(`span`,{className:`shrink-0 hidden md:inline w-12 text-right font-mono text-[10px] text-[var(--color-fg-4)] tabular-nums`,title:`Eval latency: ${d}`,children:d}),(0,D.jsx)(`span`,{className:`shrink-0 w-24 text-right text-[10px] text-[var(--color-fg-3)] truncate`,title:e.client?`Adapter: ${e.client}`:`Unidentified caller`,children:xa(e.client)})]}),(0,D.jsx)(`div`,{ref:i,className:`border-t border-[var(--color-line-0)] overflow-hidden`,style:{maxHeight:n?`none`:`0`,opacity:+!!n},"aria-hidden":!n,children:n&&(0,D.jsxs)(`div`,{className:`px-3 py-3 space-y-4`,children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-3`,children:[(0,D.jsx)(Ia,{label:`When`,value:u}),(0,D.jsx)(Ia,{label:`Decision`,children:(0,D.jsx)(q,{variant:c,children:Na[e.decision]??e.decision})}),(0,D.jsx)(Ia,{label:`Action`,children:(0,D.jsxs)(`span`,{className:`text-xs text-[var(--color-fg-1)]`,children:[f.headline,(0,D.jsxs)(`span`,{className:`ml-2 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`(`,e.tool,`)`]})]})}),e.client&&(0,D.jsx)(Ia,{label:`AI agent`,value:xa(e.client)}),e.rule_id&&(0,D.jsx)(Ia,{label:`Rule ID`,children:(0,D.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,D.jsx)(Ia,{label:`Source File`,value:e.source_file,mono:!0}),d&&(0,D.jsx)(Ia,{label:`Latency`,value:d,mono:!0}),e.rules_evaluated!=null&&(0,D.jsx)(Ia,{label:`Rules Evaluated`,value:`${e.rules_evaluated}`,mono:!0})]}),(0,D.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-3 py-2.5`,children:[(0,D.jsx)(`div`,{className:`overline mb-1`,children:`In plain English`}),(0,D.jsx)(`div`,{className:`text-xs font-medium text-[var(--color-fg-1)] mb-1`,children:f.headline}),(0,D.jsx)(`p`,{className:`text-xs text-[var(--color-fg-2)] leading-relaxed`,children:f.detail})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`overline mb-2`,children:`Tool Input`}),(0,D.jsx)(ja,{inputJson:e.input})]}),(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.rule_id?(0,D.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,D.jsx)(`span`,{}),(0,D.jsx)(La,{text:p})]})]})})]})}var za=[``,`allow`,`block`,`force`,`ask`,`log`],Ba=[``,`claude-code`,`gemini`,`antigravity`,`cursor`,`copilot`,`codex`,`pi`,`generic`],Va=[50,100,250,500],Ha=100;function Ua(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(Ha),[u,d]=(0,_.useState)(0),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(null);Bt([`activity-updated`]),(0,_.useEffect)(()=>{let t=!1,r=new URLSearchParams;return e&&r.set(`decision`,e),n&&r.set(`tool`,n),i&&r.set(`client`,i),r.set(`limit`,String(c)),r.set(`offset`,String(u)),r.set(`envelope`,`1`),h(!0),v(null),fetch(`/api/state/activity?${r.toString()}`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{t||(p(e),h(!1))}).catch(e=>{t||(v(e instanceof Error?e.message:String(e)),h(!1))}),()=>{t=!0}},[e,n,i,c,u]);let y=e=>t=>{e(t.target.value),d(0)},b=(0,_.useMemo)(()=>{if(!f)return[];let e=o.trim().toLowerCase();return e?f.rows.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.rows},[f,o]),x=f?.total??0,S=Math.floor(u/c)+1,C=Math.max(1,Math.ceil(x/c)),w=x===0?0:u+1,T=Math.min(u+(f?.rows.length??0),x),E=`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`,O=`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-3 py-1.5 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed`;return(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h1`,{className:`text-[20px] font-semibold tracking-tight text-[var(--color-fg-0)] leading-tight`,children:`What your AI tried to do`}),(0,D.jsxs)(`p`,{className:`text-[12.5px] text-[var(--color-fg-3)] mt-1 leading-relaxed`,children:[`Every move your AI agent made — and what SigmaShake decided.`,f&&(0,D.jsxs)(`span`,{className:`text-[var(--color-fg-4)] tabular-nums ml-1.5`,children:[`· `,x.toLocaleString(),` action`,x===1?``:`s`,` on record`]})]})]}),(0,D.jsxs)(`div`,{"data-tutorial":`audit-filters`,className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(`select`,{id:`audit-filter-decision`,value:e,onChange:y(t),className:E,children:za.map(e=>(0,D.jsx)(`option`,{value:e,children:e===``?`All decisions`:e===`allow`?`Allowed`:e===`block`?`Blocked`:e===`force`?`Forced`:e===`ask`?`Held`:`Logged`},e))}),(0,D.jsx)(`select`,{id:`audit-filter-client`,value:i,onChange:y(a),className:E,children:Ba.map(e=>(0,D.jsx)(`option`,{value:e,children:e===``?`All AI agents`:e===`claude-code`?`Claude Code`:e===`copilot`?`GitHub Copilot`:e===`codex`?`OpenAI Codex`:e.charAt(0).toUpperCase()+e.slice(1)},e))}),(0,D.jsx)(`input`,{id:`audit-filter-tool`,type:`text`,placeholder:`Filter by tool…`,value:n,onChange:y(r),className:`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] 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,D.jsx)(`select`,{id:`audit-page-size`,value:c,onChange:e=>{l(Number(e.target.value)),d(0)},className:E,title:`Rows per page`,children:Va.map(e=>(0,D.jsxs)(`option`,{value:e,children:[e,` / page`]},e))})]})]}),(0,D.jsx)(`div`,{"data-tutorial":`audit-config`,children:(0,D.jsx)(ha,{})}),(0,D.jsx)(`div`,{"data-tutorial":`audit-sinks`,children:(0,D.jsx)(va,{})}),(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.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,D.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,D.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,D.jsx)(`input`,{id:`audit-search`,type:`text`,placeholder:`Search within this page…`,value:o,onChange:e=>s(e.target.value),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)] transition-colors`}),o&&(0,D.jsx)(`button`,{onClick:()=>s(``),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,D.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,D.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),f&&f.rows.length>0&&(0,D.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-[10px] uppercase tracking-widest text-[var(--color-fg-4)] select-none`,children:[(0,D.jsx)(`span`,{className:`w-3`}),(0,D.jsx)(`span`,{className:`w-14`,children:`When`}),(0,D.jsx)(`span`,{className:`w-20`,children:`Decision`}),(0,D.jsx)(`span`,{className:`flex-1 min-w-0`,children:`Action`}),(0,D.jsx)(`span`,{className:`hidden md:inline w-12 text-right`,children:`Time`}),(0,D.jsx)(`span`,{className:`w-24 text-right`,children:`AI agent`})]}),g&&(0,D.jsxs)(`p`,{className:`text-sm text-red-300 font-mono`,children:[`failed to load audit log: `,g]}),m&&!f&&(0,D.jsx)(`div`,{className:`space-y-1.5`,children:Array.from({length:10}).map((e,t)=>(0,D.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))}),!m&&!g&&b.length===0&&(0,D.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,D.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)]`,children:o?`No actions on this page match your search.`:x===0?`Nothing yet — connect an AI agent and its actions will show up here.`:`No rows on this page match the filter.`}),o&&(0,D.jsx)(`button`,{onClick:()=>s(``),className:`mt-3 text-[11.5px] text-[var(--color-brand)] hover:underline cursor-pointer`,children:`Clear search`})]}),b.length>0&&(0,D.jsx)(`div`,{className:`space-y-1.5`,children:b.map(e=>(0,D.jsx)(Ra,{row:e},e.id))}),f&&x>c&&(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-2`,children:[(0,D.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:[`showing `,w.toLocaleString(),`–`,T.toLocaleString(),` `,`of `,x.toLocaleString()]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`button`,{onClick:()=>d(0),disabled:u===0,className:O,children:`⟪ first`}),(0,D.jsx)(`button`,{onClick:()=>d(Math.max(0,u-c)),disabled:u===0,className:O,children:`‹ prev`}),(0,D.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[`page `,S,` / `,C]}),(0,D.jsx)(`button`,{onClick:()=>d(f.nextOffset==null?u:f.nextOffset),disabled:f.nextOffset==null,className:O,children:`next ›`}),(0,D.jsx)(`button`,{onClick:()=>d((C-1)*c),disabled:f.nextOffset==null,className:O,children:`last ⟫`})]})]})]})}var Wa=Object.freeze([`eval-burst`,`eval-burst-complete`,`counters-updated`]);function Ga(){(0,_.useEffect)(()=>It(Wa),[])}function Ka(){return Ga(),(0,_.useSyncExternalStore)(Dt,Ot).latestBurst}function qa(){return Ga(),(0,_.useSyncExternalStore)(Dt,Ot).burstRing}function Ja(){return Ga(),(0,_.useSyncExternalStore)(Dt,Ot).burstSeq}function Ya(e){return`${e.client}:${e.agent_id??`solo`}`}var Xa=Object.freeze({allow:`#22c55e`,block:`#ef4444`,ask:`#f59e0b`,log:`#60a5fa`,force:`#a855f7`,shadow:`#6b7280`}),Za=5*6e4,Qa=1200,$a=30*6e4,eo=1.4;function Q(e){let t=(e.input_tokens??0)+(e.output_tokens??0);if(t<=0)return 6;let n=6+Math.log2(1+t/50)*eo;return n<4?4:n>16?16:n}function to(e){let t=(e.input_tokens??0)+(e.output_tokens??0);if(t<=0)return 0;let n=Math.log2(1+t/50)*eo/10;return n<=0?0:n>=1?1:n}function no(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function ro(e,t){if(t<=0)return e;let n=e.startsWith(`#`)?e.slice(1):e;if(n.length!==6)return e;let r=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);if(Number.isNaN(r)||Number.isNaN(i)||Number.isNaN(a))return e;let o=Math.max(r,i,a);if(o===0)return e;let s=t>1?1:t,c=(255-o)*s,l=Math.round(r+r/o*c),u=Math.round(i+i/o*c),d=Math.round(a+a/o*c),f=e=>(e<0?0:e>255?255:e).toString(16).padStart(2,`0`);return`#${f(l)}${f(u)}${f(d)}`}var io=new Set([`compact`,`end`,`stop`,`subagent-stop`,`close`]),ao=Object.freeze([`session-lifecycle`]);function oo(e){(0,_.useEffect)(()=>It(ao),[]);let t=(0,_.useSyncExternalStore)(Dt,Ot),[n,r]=(0,_.useState)(new Map),i=(0,_.useRef)(0);(0,_.useEffect)(()=>{let e=t.lifecycleRing;if(e.length<=i.current)return;let n=e.slice(i.current);i.current=e.length,so(n,r)},[t.lifecycleRing]);let a=(0,_.useRef)(void 0);return(0,_.useEffect)(()=>{!e||e===a.current||(a.current=e,so(e,r))},[e]),{closedAt:n,isBurstActive(e,t){let r=n.get(e);return r===void 0||t>r}}}function so(e,t){let n=e.filter(e=>io.has(e.event));n.length!==0&&t(e=>{let t=!1,r=new Map(e);for(let e of n){let n=r.get(e.session_key);(n===void 0||e.ts_ms>n)&&(r.set(e.session_key,e.ts_ms),t=!0)}return t?r:e})}var co=1440*60*1e3,lo=1800*1e3,uo=3e3;function fo(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=po(o);n.has(s)||(n.add(s),r.push(o))}for(;i<e.length;i++){let t=e[i],a=po(t);n.has(a)||(n.add(a),r.push(t))}for(;a<t.length;a++){let e=t[a],i=po(e);n.has(i)||(n.add(i),r.push(e))}return r}function po(e){return e.audit_id??`${e.ts_ms}:${e.tool}:${e.client}`}function mo(e,t){if(e.length===0)return t.slice();if(t.length===0)return e.slice();let n=new Set,r=[];for(let i of[...e,...t]){let e=`${i.session_key}:${i.ts_ms}:${i.event}`;n.has(e)||(n.add(e),r.push(i))}return r}function ho(e,t,n,r=200,i=$a,a=12){let o=new Map,s=new Map;for(let r of e){if(r.ts_ms>n)break;if(Sa(r.tool))continue;let e=Ya(r);if(!t(e,r.ts_ms))continue;let i=o.get(e);i?i.push(r):o.set(e,[r]);let a=s.get(e);(a===void 0||r.ts_ms>a)&&s.set(e,r.ts_ms)}let c=n-i,l=[];for(let[e,t]of s)t<c&&l.push(e);for(let e of l)o.delete(e),s.delete(e);if(o.size>a){let e=new Set(Array.from(s.entries()).sort((e,t)=>t[1]-e[1]).slice(0,a).map(([e])=>e));for(let t of[...o.keys()])e.has(t)||o.delete(t)}let u=[];for(let e of o.values()){let t=e.length>r?e.slice(-r):e;u.push(...t)}return u.sort((e,t)=>e.ts_ms-t.ts_ms),u}function go(e={}){let t=e.windowMs??12e4,n=qa(),[r,i]=(0,_.useState)(()=>({mode:`live`,playhead_ms:Date.now(),window_ms:t})),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(!1);(0,_.useEffect)(()=>{p.current=n.length>0||a.length>0},[n,a]),(0,_.useEffect)(()=>{if(r.mode!==`live`)return;let e=()=>{if(!p.current)return;let e=Date.now();i(t=>t.mode===`live`?t.playhead_ms===e?t:{...t,playhead_ms:e}:t)};e();let t=setInterval(e,500);return()=>clearInterval(t)},[r.mode]);let m=(0,_.useMemo)(()=>fo(a,n),[a,n]),h=(0,_.useMemo)(()=>m.filter(e=>!Sa(e.tool)),[m]),{isBurstActive:g}=oo(s),v=(0,_.useMemo)(()=>ho(m,g,r.playhead_ms),[m,g,r.playhead_ms]),y=m.length>0?m[0]?.ts_ms:r.playhead_ms,b=m.length>0?m[m.length-1]?.ts_ms:r.playhead_ms,x=(0,_.useCallback)(async e=>{if(f.current)return;let t=y,n=Math.min(t,(d.current??Date.now())-e);if(n>=t)return;let r=new AbortController;f.current=r,u(!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&&o(e=>{let t=fo(e,i.bursts);return t.length>uo?t.slice(-uo):t}),Array.isArray(i.lifecycle)&&i.lifecycle.length>0&&c(e=>mo(e,i.lifecycle)),d.current=n}catch(e){e.name!==`AbortError`&&console.warn(`[graph] backfill failed`,e)}finally{f.current=null,u(!1)}},[y]);(0,_.useEffect)(()=>{r.playhead_ms-y<r.window_ms*.5&&x(Za)},[r.playhead_ms,r.window_ms,y,x]);let S=(0,_.useRef)(!1);(0,_.useEffect)(()=>{S.current||(S.current=!0,x(lo))},[x]),(0,_.useEffect)(()=>()=>{f.current?.abort(),f.current=null},[]);let C=(0,_.useCallback)(e=>{i(t=>e===`live`?{...t,mode:`live`}:{...t,mode:e})},[]),w=(0,_.useCallback)(e=>{i(t=>({...t,mode:t.mode===`live`?`scrubbing`:t.mode,playhead_ms:e}))},[]),T=(0,_.useCallback)(e=>{i(t=>({...t,window_ms:Math.max(1e3,e)}))},[]),E=(0,_.useCallback)(()=>{i(e=>({...e,mode:`live`,playhead_ms:Date.now()}))},[]),D=(0,_.useCallback)(()=>{i(e=>({...e,mode:`live`,playhead_ms:Date.now(),window_ms:co})),x(co)},[x]);return{snapshot:(0,_.useMemo)(()=>({bursts:v,playback:r,oldest_known_ms:y,newest_known_ms:b,loading_backfill:l}),[v,r,y,b,l]),allBursts:h,setMode:C,setPlayhead:w,setWindow:T,jumpToLive:E,requestBackfill:x,jumpTo24h:D}}function _o(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 vo={"claude-code":`C`,"claude-code-ide":`C`,cursor:`>`,copilot:`H`,codex:`X`,pi:`P`,gemini:`G`,antigravity:`A`};function yo(e){return vo[e.toLowerCase()]??`.`}function bo(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 xo(e,t,n){for(let[r,i]of t){let{x:t,y:a,n:o}=i,s=50+Math.min(o,12)*7,c=bo(r),l=n.get(r),u;l&&Math.abs(l.x-t)<2&&Math.abs(l.y-a)<2&&l.r===s?u=l.grad:(u=e.createRadialGradient(t,a,0,t,a,s),u.addColorStop(0,`hsla(${c},80%,55%,0.10)`),u.addColorStop(1,`hsla(${c},80%,55%,0)`),n.set(r,{grad:u,x:t,y:a,r:s})),e.fillStyle=u,e.beginPath(),e.arc(t,a,s,0,Math.PI*2),e.fill()}for(let e of n.keys())t.has(e)||n.delete(e)}function So(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 Co=`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,wo=`bold 10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,To=new Map,Eo=256;function Do(e,t){let n=To.get(t);if(n!==void 0)return n;let r=e.measureText(t).width;if(To.size>=Eo){let e=To.keys().next().value;e!==void 0&&To.delete(e)}return To.set(t,r),r}function Oo(e,t,n,r,i,a,o){let s=(r.split(`:`)[0]??r).slice(0,18),c=yo(s),l=bo(r),u=Xa[o]??`#6b7280`;e.save(),e.textAlign=`center`;let d=`[${c}] ${s}`,f=`${i.length>14?i.slice(0,14):i} · ${a}`;e.font=wo;let p=Do(e,d);e.font=Co;let m=Do(e,f),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=wo,e.fillText(d,t,n+10),e.globalAlpha=.72,e.fillStyle=u,e.font=Co,e.fillText(f,t,n+21),e.restore()}var ko=`bold 13px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,Ao=`bold 10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;function jo(e){if((!Number.isFinite(e)||e<0)&&(e=0),e<6e4)return`${(e/1e3).toFixed(3)}s`;if(e<36e5)return`${Math.floor(e/6e4)}:${(e%6e4/1e3).toFixed(3).padStart(6,`0`)}`;let t=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4),r=(e%6e4/1e3).toFixed(1).padStart(4,`0`);return`${t}:${String(n).padStart(2,`0`)}:${r}`}function Mo(e,t,n,r,i){e.save(),e.textAlign=`center`,e.font=Ao,e.globalAlpha=.7,e.fillStyle=`hsla(${i},78%,72%,0.55)`,e.fillText(`uptime`,t,n),e.font=ko,e.globalAlpha=.96,e.fillStyle=`hsla(${i},78%,82%,1)`,e.fillText(jo(r),t,n+13),e.restore()}function No(e,t,n,r){e.save(),e.textAlign=`right`,e.font=Ao,e.fillStyle=`rgba(148, 163, 184, 0.55)`,e.globalAlpha=.85,e.fillText(`LIVE`,t,n),e.font=`bold 16px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,e.fillStyle=`#e0e7ff`,e.globalAlpha=.92,e.fillText(jo(r),t,n+16),e.restore()}function Po(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 Fo={Read:`▣`,Write:`✎`,Edit:`✎`,MultiEdit:`✎`,NotebookEdit:`✎`,NotebookRead:`▣`,Glob:`✦`,Grep:`✦`,LS:`⊞`,Find:`✦`,ToolSearch:`⊕`,Bash:`$`,Skill:`◈`,WebFetch:`⌬`,WebSearch:`⌬`,Agent:`◇`,Task:`⌘`,TaskCreate:`⌘`,TaskUpdate:`⌘`,TaskList:`⌘`,TaskGet:`⌘`,TaskOutput:`⌘`,TaskStop:`⌘`,TodoWrite:`✓`,TodoRead:`✓`,AskUserQuestion:`?`,EnterPlanMode:`◐`,ExitPlanMode:`◑`,EnterWorktree:`⎇`,ExitWorktree:`⎇`,PushNotification:`⏰`,ScheduleWakeup:`⏰`,CronCreate:`⏰`,CronList:`⏰`,CronDelete:`⏰`,RemoteTrigger:`↗`,Monitor:`◉`};function Io(e){if(!e)return`·`;let t=e.lastIndexOf(`__`);return Fo[t>=0?e.slice(t+2):e]??Fo[e]??`·`}var Lo=2*Math.PI/6e4,Ro=2.3999632297286535,zo=16,Bo=22,Vo=.4,Ho=14,Uo=8,Wo=24;function Go(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])}if(r.size===0)return;for(let e of r.values())e.sort((e,t)=>e.ts_ms-t.ts_ms);let i=Math.min(t,n)-Wo,a=Array.from(r.keys()).sort(),o=a.length,s=0;for(let e of r.values())e.length>s&&(s=e.length);let c=Math.max(1,Math.min(Bo,(i-zo)/Math.max(1,s-1))),l=zo,u=zo+c,d=(l*l+u*u-Ho*Ho)/(2*l*u),f=Math.max(Vo,Math.acos(Math.min(1,Math.max(-1,d))));if(o<=Uo)for(let e=0;e<o;e++){let t=a[e];if(t===void 0)continue;let n=r.get(t);if(!n)continue;let i=e*2*Math.PI/o;for(let e=0;e<n.length;e++){let t=n[e];t&&(t.slotPhi=i+e*f,t.slotR=zo+e*c)}}else{let e=[];for(let t of r.values())for(let n of t)e.push(n);e.sort((e,t)=>e.ts_ms-t.ts_ms);let t=Math.max(1,Math.min(Bo,(i-zo)/Math.max(1,e.length-1)));for(let n=0;n<e.length;n++){let r=e[n];r&&(r.slotPhi=n*Ro,r.slotR=zo+n*t)}}}function Ko(e,t,n,r){for(let i of e)i.slotR==null||i.slotPhi==null||(i.x=t+i.slotR*Math.cos(i.slotPhi+r),i.y=n+i.slotR*Math.sin(i.slotPhi+r))}function qo(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 Jo(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}var Yo=new Set,Xo=0,Zo=0;function Qo(){for(let e of Yo)e();Yo.size>0&&(Xo=requestAnimationFrame(Qo))}function $o(e){let t=Zo++;return Yo.add(e),Yo.size===1&&(Xo=requestAnimationFrame(Qo)),[()=>{Yo.delete(e),Yo.size===0&&(cancelAnimationFrame(Xo),Xo=0)},t]}var es=820,ts=e=>Math.min(1,e),ns=620,rs=e=>1-(1-e)**3,is=mi({stiffness:120,damping:22,mass:1}),as=1800;function os(e){return e<=2?Math.min(window.devicePixelRatio,2):e<=4?Math.min(window.devicePixelRatio,1.5):Math.min(window.devicePixelRatio,1)}function ss(e){return e<=2?1:e<=4?2:3}function cs(e){return e<=2?24:e<=4?12:6}function ls(e){return e<=4}var us=!1,ds=!1;function fs(){if(ds||typeof window>`u`)return;ds=!0;let e=navigator;typeof e.getBattery==`function`&&e.getBattery().then(e=>{let t=()=>{us=!e.charging&&e.level<.2};t(),e.addEventListener(`chargingchange`,t),e.addEventListener(`levelchange`,t)}).catch(()=>{})}function ps(){return typeof window>`u`?!1:window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches||navigator.connection?.saveData?!0:us}var ms=typeof window<`u`&&new URLSearchParams(window.location.search).get(`fullrate`)===`1`,hs=typeof window<`u`&&new URLSearchParams(window.location.search).get(`rotate`)!==`0`,gs=typeof window<`u`&&new URLSearchParams(window.location.search).get(`probe`)===`1`;function _s(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=_o(s.ts_ms^e),i=n*.6+(t()-.5)*60,a=r/2+(t()-.5)*40,l=Ya(s);o.push({id:c,burst:s,ts_ms:s.ts_ms,session:l,x:i,y:a,vx:0,vy:0,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 vs(e){let{bursts:t,paused:n,selectedId:r,onSelect:i,compact:a=!1,activePanelCount:o=1,labelDensity:s=`normal`,onFrameTime:c}=e,l=(0,_.useRef)(c);l.current=c;let u=(0,_.useRef)(s);u.current=s;let d=(0,_.useRef)(null),f=(0,_.useRef)([]),p=(0,_.useRef)([]),m=(0,_.useRef)(null),h=(0,_.useRef)(null),g=(0,_.useRef)(0),v=(0,_.useRef)(0),y=(0,_.useRef)(0),b=(0,_.useRef)(new Map),x=(0,_.useRef)(new Set),S=(0,_.useRef)(new Set),C=(0,_.useRef)(new Set),[w,T]=(0,_.useState)({w:0,h:0}),E=(0,_.useRef)(0),O=(0,_.useRef)(0),k=(0,_.useRef)(null),ee=(0,_.useRef)(Date.now()),A=(0,_.useRef)(new Map),j=(0,_.useRef)({frame:0,cache:null});(0,_.useLayoutEffect)(()=>{let e=d.current?.parentElement;if(!e)return;let t=e.getBoundingClientRect();t.width>0&&t.height>0&&T({w:Math.max(40,t.width),h:Math.max(40,t.height)});let n=new ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;e<=0||n<=0||T({w:Math.max(40,e),h:Math.max(40,n)})}});return n.observe(e),()=>n.disconnect()},[]),(0,_.useEffect)(()=>{if(w.w<=0||w.h<=0)return;j.current.frame=0;let e=new Map;for(let t of f.current)e.set(t.id,t);f.current=_s(f.current,t,w.w,w.h),Go(f.current,w.w/2,w.h/2);let n=hs&&!Si()?performance.now()*Lo:0;for(let t of f.current){if(t.slotR==null||t.slotPhi==null)continue;let r=w.w/2+t.slotR*Math.cos(t.slotPhi+n),i=w.h/2+t.slotR*Math.sin(t.slotPhi+n),a=!e.has(t.id),o=Math.hypot(t.x-r,t.y-i);(a||o>40)&&(t.x=r,t.y=i,t.vx=0,t.vy=0)}if(p.current=Jo(f.current,1/0),!Si())for(let t=0;t<f.current.length;t++){let n=f.current[t];!n||e.has(n.id)||Ue(n.burst.decision)}let r=f.current.reduce((e,t)=>t.ts_ms>e?t.ts_ms:e,0);v.current=Math.max(performance.now()+es,performance.now()+Qa,r+1500),g.current=performance.now()},[t,w.w,w.h]),(0,_.useEffect)(()=>{let e=d.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;fs();let i=performance.now(),s=0,c=0,h=0,_=.1,[T,D]=$o(()=>{let d=performance.now();if(!ms&&ps()){if(s^=1,s===1)return}else s!==0&&(s=0);if(!ms){let e=ss(o);if(e>1&&(O.current=(O.current+1)%e,O.current!==0))return}let T=performance.now(),E=T<v.current,D=T-g.current<200,M=T-y.current>500,te=Si(),ne=hs&&!te;if(!ne&&!E&&!D&&!M)return;y.current=T;let N=d,P=Math.min(50,N-i);i=N;let F=f.current,re=p.current,I=ne?performance.now()*Lo:0;Ko(F,w.w/2,w.h/2,I);for(let e of F)e.age<1&&(e.age=Math.min(1,e.age+P/es));let L=typeof window<`u`?os(o):1,R=w.w,z=w.h;(e.width!==R*L||e.height!==z*L)&&(e.width=R*L,e.height=z*L,e.style.width=`${R}px`,e.style.height=`${z}px`,t.scale(L,L)),t.fillStyle=`#0a0a0f`,t.fillRect(0,0,R,z);let ie=`${R}x${z}`,B=k.current?.key===ie?k.current.grad:null;if(B||(B=t.createRadialGradient(R/2,z/2,0,R/2,z/2,Math.max(R,z)/1.2),B.addColorStop(0,`rgba(56, 189, 248, 0.06)`),B.addColorStop(1,`rgba(0, 0, 0, 0)`),k.current={key:ie,grad:B}),t.fillStyle=B,t.fillRect(0,0,R,z),!a){let e=j.current;(e.frame++%6==0||e.cache===null)&&(e.cache=qo(F));let n=e.cache;if(xo(t,n,A.current),!te){let e=new Map,r=new Map;for(let t of F)t.exitingAt??(r.set(t.session,(r.get(t.session)??0)+1),e.set(t.session,t));let i=new Map;for(let e of F){if(e.exitingAt!=null)continue;let t=i.get(e.session);(t===void 0||e.ts_ms<t)&&i.set(e.session,e.ts_ms)}let a=Date.now();for(let[o,s]of n){let n=e.get(o),c=r.get(o)??0;if(!n||c===0)continue;let l=50+Math.min(s.n,12)*7;Oo(t,s.x,s.y-l-34,o,n.burst.tool,c,n.burst.decision);let u=i.get(o);if(u!==void 0){let e=Math.max(0,a-u);Mo(t,s.x,s.y+l+12,e,bo(o))}}}}let ae=e=>e.exitingAt==null?1:Math.max(0,1-(N-e.exitingAt)/Qa),oe=cs(o),se=ls(o)&&!te,ce=x.current;if(ce.clear(),n)for(let e of F)ce.add(e.id);else{let e=0;for(let t=F.length-1;t>=0&&e<oe;t--){let n=F[t];!n||n.exitingAt!=null||(ce.add(n.id),e++)}}let le=b.current;le.clear();for(let e of F)le.set(e.id,e);t.lineWidth=2,t.lineCap=`round`,t.lineJoin=`round`;for(let e=0;e<re.length;e++){let n=re[e],r=le.get(n.source),i=le.get(n.target);if(!r||!i||ce.has(r.id)||ce.has(i.id))continue;let a=Math.max(ae(r),ae(i));a<=0||(t.globalAlpha=a,t.strokeStyle=`${Xa[i.burst.decision]??`#6b7280`}aa`,t.beginPath(),t.moveTo(r.x,r.y),t.lineTo(i.x,i.y),t.stroke())}t.globalAlpha=1;let ue=u.current===`large`,de=ue?`10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`:`8px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;for(let e=0;e<re.length;e++){let n=re[e],r=le.get(n.source),i=le.get(n.target);if(!r||!i||!ce.has(r.id)&&!ce.has(i.id))continue;let a=Xa[i.burst.decision]??`#6b7280`,o=Math.max(ae(r),ae(i));if(o<=0)continue;let s=ts(i.age),c=r.x+(i.x-r.x)*s,l=r.y+(i.y-r.y)*s;if(t.globalAlpha=o,t.strokeStyle=`${a}aa`,t.beginPath(),t.moveTo(r.x,r.y),t.lineTo(c,l),t.stroke(),t.globalAlpha=1,se){let n=Math.min(s,(N/as+e*.618033)%1),u=r.x+(i.x-r.x)*n,d=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(u,d,2.5,0,Math.PI*2),t.fill(),t.restore(),Po(t,r.x,r.y,c,l,a,o)}let u=i.ts_ms-r.ts_ms,d=u<1e3?`${u}ms`:u<6e4?`${(u/1e3).toFixed(1)}s`:`${Math.floor(u/6e4)}m${Math.floor(u%6e4/1e3)}s`,f=(r.x+c)/2,p=(r.y+l)/2;t.save(),t.globalAlpha=o*.65*s,t.font=de,t.fillStyle=`#94a3b8`,t.textAlign=`center`,t.textBaseline=`middle`,t.fillText(`${e+1} · ${d}`,f,p-(ue?8:7)),t.restore()}t.globalAlpha=1;let fe=S.current;fe.clear();let pe=C.current;pe.clear();let me=u.current===`large`?10:5;{let e=0;for(let t=F.length-1;t>=0;t--){let r=F[t];!r||r.exitingAt!=null||(!n&&e<3&&fe.add(r.id),e<me&&pe.add(r.id),e++)}}let he=r,ge=m.current;for(let e of F){let r=ae(e);if(r<=0)continue;t.globalAlpha=r;let i=Math.min(1,e.age),o=ts(i);e.displayedRadius=a?4:Q(e.burst);let s=e.displayedRadius,c=a?s*o:(s+2*Math.min(1,e.age))*o,l=Xa[e.burst.decision]??`#6b7280`,d=ro(l,to(e.burst));if((e.id===he||e.id===ge)&&(t.beginPath(),t.arc(e.x,e.y,c+6,0,Math.PI*2),t.fillStyle=`${d}33`,t.fill()),se&&(e.burst.decision===`allow`?So(t,e.x,e.y,i,`#22c55e`,14,.3):e.burst.decision===`ask`&&So(t,e.x,e.y,i,`#f59e0b`,14,.45)),se&&(e.burst.decision===`block`||e.burst.decision===`force`)){let n=i*es;if(n<ns){let r=n/ns,i=c+16*rs(r),a=Math.max(0,1-r)*.75;t.beginPath(),t.arc(e.x,e.y,i,0,Math.PI*2),t.strokeStyle=d+Math.floor(a*255).toString(16).padStart(2,`0`),t.lineWidth=1.5,t.stroke()}}if(!te&&fe.has(e.id)&&(t.beginPath(),t.arc(e.x,e.y,c+2,0,Math.PI*2),t.fillStyle=`${d}33`,t.fill()),t.beginPath(),t.arc(e.x,e.y,Math.max(.1,c),0,Math.PI*2),t.fillStyle=d,t.fill(),t.strokeStyle=l,t.lineWidth=1.5,t.beginPath(),t.arc(e.x,e.y,Math.max(.1,c),0,Math.PI*2),t.stroke(),pe.has(e.id)&&(n||ce.has(e.id))){let n=u.current===`large`;t.font=n?`11px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`:`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.textAlign=`center`,t.fillStyle=`${d}cc`,t.fillText(yo(e.burst.client),e.x,e.y-c-(n?4:3));let i=n?16:12,a=e.burst.tool.length>i?e.burst.tool.slice(0,i):e.burst.tool,o=Io(e.burst.tool),s=o===`·`?a:`${o} ${a}`;t.fillStyle=`${d}88`,t.fillText(s,e.x,e.y+c+(n?13:11));let l=e.burst.input_tokens??0,f=e.burst.output_tokens??0;(l>0||f>0)&&(t.globalAlpha=r*(ce.has(e.id)?.8:.35),t.font=n?`10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`:`8px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.fillStyle=`#94a3b8`,t.textAlign=`center`,t.fillText(`↓${no(l)} ↑${no(f)}`,e.x,e.y+c+(n?25:21)),t.globalAlpha=r),t.textAlign=`left`}(e.id===he||e.id===ge)&&(t.font=`11px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.fillStyle=`#e0e7ff`,t.fillText(e.burst.tool,e.x+c+6,e.y+3))}if(t.globalAlpha=1,se&&F.length>0){let e=null;for(let t=F.length-1;t>=0;t--)if(F[t].exitingAt==null){e=F[t];break}let n=e?Date.now()-e.ts_ms:1/0,r=5e3;if(e&&n<=r){let i=Math.max(0,1-n/r),a=1100,o=N%a/a,s=14+is.fn(o)*8,c=Math.max(0,1-o)*.85*i,l=Math.floor(c*255).toString(16).padStart(2,`0`);t.beginPath(),t.arc(e.x,e.y,s,0,Math.PI*2),t.strokeStyle=`#38bdf8${l}`,t.lineWidth=2,t.stroke();let u=N%800/800*Math.PI*2,d=100/360*Math.PI*2,f=.85*i,p=Math.floor(f*255).toString(16).padStart(2,`0`);t.save(),t.beginPath(),t.arc(e.x,e.y,22,u,u+d),t.strokeStyle=`#38bdf8${p}`,t.lineWidth=2.5,t.lineCap=`round`,t.stroke(),t.restore()}}if(!a&&R>220&&No(t,R-12,12,Date.now()-ee.current),gs){let t,n=0;for(let e of F)e.exitingAt??(n++,t||=e);e.dataset.probeCount=String(n),e.dataset.probeX0=(t?.x??0).toFixed(2),e.dataset.probeY0=(t?.y??0).toFixed(2)}c=c===0?P:c*(1-_)+P*_;let _e=l.current;_e&&N-h>250&&(h=N,_e(c))});return E.current=D,O.current=D,T},[n,r,w.w,w.h,a,o]);function M(e,t){let n=d.current;if(!n)return null;let r=n.getBoundingClientRect(),i=e-r.left,a=t-r.top,o=null,s=200;for(let e of f.current){let t=e.x-i,n=e.y-a,r=t*t+n*n;r<s&&(s=r,o=e.id)}return o}return(0,D.jsxs)(`div`,{className:`relative w-full h-full rounded-sm border border-[var(--color-line-1)] overflow-hidden bg-black`,children:[(0,D.jsx)(`canvas`,{ref:d,className:`block w-full h-full cursor-crosshair`,onMouseMove:e=>{let t=M(e.clientX,e.clientY);m.current=t;let n=h.current;if(!n)return;if(!t){n.style.display=`none`;return}let r=f.current.find(e=>e.id===t);if(!r){n.style.display=`none`;return}let i=r.burst,a=Xa[i.decision]??`#6b7280`,o;if(i.complete_duration_ms!=null&&i.complete_duration_ms>0){let e=i.complete_duration_ms;o=e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(0)}ms`}else{let e=i.duration_ns/1e6;o=e<1?`${(e*1e3).toFixed(0)}µs`:`${e.toFixed(1)}ms`}let s=[];i.input_tokens!=null&&s.push(`↓${no(i.input_tokens)}`),i.output_tokens!=null&&s.push(`↑${no(i.output_tokens)}`);let c=i.input_preview?` · "${i.input_preview.length>45?`${i.input_preview.slice(0,45)}…`:i.input_preview}"`:``,l=s.length>0?` · ${s.join(` `)}`:``;n.textContent=`${i.decision} ${i.tool} · ${o}${l}${c}`,n.style.borderColor=a,n.style.color=a;let u=Math.min(e.clientX+14,window.innerWidth-420),d=Math.max(8,e.clientY-36);n.style.left=`${u}px`,n.style.top=`${d}px`,n.style.display=`block`},onMouseLeave:()=>{m.current=null,h.current&&(h.current.style.display=`none`)},onClick:e=>{i(M(e.clientX,e.clientY),{x:e.clientX,y:e.clientY})}}),t.length===0&&(0,D.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center pointer-events-none px-4 text-center`,children:[(0,D.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`graph · idle`}),(0,D.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,D.jsx)(`br`,{}),`Color = the ssg rule decision · line = same agent's sequence.`]})]}),(0,D.jsx)(`div`,{ref:h,style:{display:`none`,position:`fixed`,zIndex:45,fontSize:`11px`,fontFamily:`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,padding:`4px 10px`,background:`rgba(10, 10, 15, 0.92)`,border:`1px solid`,borderRadius:`4px`,pointerEvents:`none`,whiteSpace:`nowrap`,maxWidth:`500px`,overflow:`hidden`,textOverflow:`ellipsis`}})]})}var ys=3e4,bs=6e4,xs=5e3;function Ss(e,t){let n=t?e.filter(e=>Ya(e)===t):e,r=Date.now(),i=n.length>0?n[n.length-1]:null;if(!i||r-i.ts_ms>xs||!i)return{idle:!0,client:``,tool:``,ruleId:null,decision:``,evalsPerSec:`0.0`,allowPct:0,agents:0,topRules:[]};let a=n.filter(e=>r-e.ts_ms<=ys),o=a.filter(e=>e.decision===`allow`).length,s=a.length>0?Math.round(o/a.length*100):0,c=(a.length/(ys/1e3)).toFixed(1),l=new Set(a.map(e=>`${e.client}:${e.agent_id??`solo`}`)).size,u=n.filter(e=>r-e.ts_ms<=bs&&e.rule_id),d=new Map;for(let e of u){let t=e.rule_id;t&&d.set(t,(d.get(t)??0)+1)}let f=[...d.entries()].sort((e,t)=>t[1]-e[1]).slice(0,4).map(([e])=>e);return{idle:!1,client:i.client,tool:i.tool,ruleId:i.rule_id,decision:i.decision,evalsPerSec:c,allowPct:s,agents:l,topRules:f}}var Cs={allow:`ALLOW`,block:`BLOCK`,ask:`ASK`,log:`LOG`,force:`FORCE`,shadow:`SHADOW`},ws={allow:`#22c55e`,block:`#ef4444`,ask:`#f59e0b`,log:`#60a5fa`,force:`#a855f7`,shadow:`#6b7280`};function Ts({className:e,sessionKey:t}){let n=qa(),r=Ja(),i=(0,_.useRef)(-1),a=(0,_.useRef)(null),o=(0,_.useMemo)(()=>{if(i.current===r&&a.current)return a.current;i.current=r;let e=Ss(n,t);return a.current=e,e},[n,r,t]),s=o.decision?ws[o.decision]??`#6b7280`:`#6b7280`,c=o.decision?Cs[o.decision]??o.decision:``,l=o.client?yo(o.client):``;return o.idle?(0,D.jsxs)(`div`,{className:K(`pointer-events-none select-none`,`flex items-center justify-center gap-2`,`px-4 py-2 rounded-sm`,`bg-[#0a0a0f]/95`,`border border-[var(--color-line-1,#242424)]`,`font-mono text-[11px] text-[var(--color-fg-4,#5a6071)]`,e),children:[(0,D.jsx)(`span`,{className:`status-dot bg-[var(--color-fg-4)] pulse-soft`}),(0,D.jsx)(`span`,{className:`uppercase tracking-wider`,children:`waiting for activity`})]}):(0,D.jsxs)(`div`,{className:K(`pointer-events-none select-none`,`flex flex-col gap-1 px-4 py-2.5 rounded-sm`,`bg-[#0a0a0f]/96`,`border border-[var(--color-line-1,#242424)]`,`font-mono`,!t&&`min-w-[280px] max-w-[460px]`,e),children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-widest text-[var(--color-fg-4,#5a6071)]`,children:[(0,D.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),(0,D.jsx)(`span`,{children:`now evaluating`}),(0,D.jsxs)(`span`,{className:`ml-auto tabular-nums`,children:[o.evalsPerSec,`/s · `,o.allowPct,`% allow · `,o.agents,` `,o.agents===1?`agent`:`agents`]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px] text-[var(--color-fg-0,#f5f5f5)] tracking-tight`,children:[(0,D.jsxs)(`span`,{className:`text-[var(--color-fg-3)] text-[11px] tabular-nums`,children:[`[`,l,`]`]}),(0,D.jsx)(`span`,{className:`text-sky-300`,children:o.client}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`·`}),(0,D.jsx)(`span`,{className:`text-white font-semibold`,children:o.tool}),o.ruleId&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`->`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] text-[12px]`,children:o.ruleId})]}),(0,D.jsx)(`span`,{className:`ml-auto text-[13px] font-bold tabular-nums`,style:{color:s},children:c})]}),o.topRules.length>0&&(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-[var(--color-fg-4)]`,children:[(0,D.jsx)(`span`,{className:`uppercase tracking-wider text-[9px]`,children:`rules`}),o.topRules.map(e=>(0,D.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 Es=(0,_.memo)(function({sessionKey:e,bursts:t,activePanelCount:n,selectedId:r,onSelect:i}){let a=t.length>0?t[t.length-1]?.ts_ms??0:0,o=e.indexOf(`:`),s=o>=0?e.slice(0,o):e,c=o>=0?e.slice(o+1):``,l=c!==``&&c!==`solo`,u=t[t.length-1],d=u?Xa[u.decision]??`#6b7280`:`#6b7280`,f=(0,_.useMemo)(()=>t.length>24?t.slice(t.length-24):t,[t]);return(0,D.jsxs)(`div`,{className:`flex flex-col min-h-0 min-w-0 rounded-sm border border-[var(--color-line-1)] bg-black/30 overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1 border-b border-[var(--color-line-1)] text-[10px] font-mono shrink-0`,children:[(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{background:d},title:u?`latest decision: ${u.decision}`:``}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] uppercase tracking-wider truncate`,children:s}),l&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate`,children:c})]}),(0,D.jsxs)(`span`,{className:`ml-auto text-[var(--color-fg-4)] tabular-nums shrink-0`,children:[t.length,`n`]})]}),(0,D.jsx)(`div`,{className:`flex-1 min-h-0 relative`,children:(0,D.jsx)(vs,{bursts:f,paused:!1,selectedId:r,onSelect:i,burstSeq:a,compact:!0,activePanelCount:n})})]})});function Ds(e){return e<=1?1:e<=4?2:3}function Os(){let e=qa(),t=Ja(),[n,r]=(0,_.useState)(null),{isBurstActive:i}=oo(),a=(0,_.useMemo)(()=>ho(e,i,Date.now()),[e,i]),o=(0,_.useRef)(new Map),s=(0,_.useMemo)(()=>{let e=new Map;for(let t of a){let n=Ya(t),r=e.get(n);r?r.push(t):e.set(n,[t])}let t=o.current;for(let[n,r]of e){let i=t.get(n);i&&i.length===r.length&&i[i.length-1]===r[r.length-1]&&e.set(n,i)}return o.current=e,Array.from(e.entries()).sort((e,t)=>{let n=e[1][e[1].length-1]?.ts_ms??0;return(t[1][t[1].length-1]?.ts_ms??0)-n})},[a]),c=(0,_.useMemo)(()=>{let e=new Map;for(let t of a){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},[a]),l=(0,_.useMemo)(()=>{let e={allow:0,block:0,ask:0,other:0};for(let t of a)t.decision===`allow`?e.allow++:t.decision===`block`||t.decision===`force`?e.block++:t.decision===`ask`?e.ask++:e.other++;return e},[a]),u=(0,_.useMemo)(()=>{let e=new Set,t=0;for(let n of a)n.rule_id&&(e.add(n.rule_id),t+=1);return{distinct:e.size,matched:t,topRule:e.values().next().value}},[a]),d=Ds(s.length);return(0,D.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,D.jsxs)(`header`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-[var(--color-line-1)]`,children:[(0,D.jsx)(`span`,{className:`overline text-[var(--color-fg-3)]`,children:`graph · live`}),(0,D.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[(0,D.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),a.length]}),(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] font-mono`,children:[(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:Xa.allow}}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.allow}),(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ml-1`,style:{background:Xa.block}}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.block}),(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ml-1`,style:{background:Xa.ask}}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.ask})]}),(0,D.jsx)(`span`,{className:`flex-1`}),(0,D.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 active sessions`,children:[u.distinct,` `,u.distinct===1?`rule`:`rules`]}),(0,D.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(`
12
- `),children:[c.size,` `,c.size===1?`agent`:`agents`]}),(0,D.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,D.jsxs)(`div`,{className:`flex-1 min-h-0 relative`,children:[s.length===0?(0,D.jsx)(vs,{bursts:a,paused:!1,selectedId:n,onSelect:r,burstSeq:t}):(0,D.jsx)(`div`,{className:`absolute inset-0 grid gap-1 p-1`,style:{gridTemplateColumns:`repeat(${d}, minmax(0, 1fr))`,gridAutoRows:`1fr`},children:s.map(([e,t])=>(0,D.jsx)(Es,{sessionKey:e,bursts:t,activePanelCount:s.length,selectedId:n,onSelect:r},e))}),(0,D.jsx)(Ts,{className:`absolute bottom-2 left-2 z-10 max-w-[calc(100%-1rem)]`})]})]})}function ks(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 As(e){return{id:e.id,x:e.x,y:e.y,w:e.w,h:e.h}}function js(e,t){let n=[As(e)],r=t.map(As);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(ks(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 Ms(e){if(e.length===0)return[];let t=[...e].map(As).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)ks(e,r)&&(e.y=r.y+r.h,t=!0)}n.push(e)}return n}function Ns(e,t,n){let r=e.findIndex(e=>e.id===t);if(r===-1)return{panels:e.map(As)};let i=js({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:Ms(e.map(e=>a.get(e.id)).filter(Boolean))}}function Ps({size:e=24,children:t,...n}){return(0,D.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...n,children:t})}var Fs=e=>(0,D.jsx)(Ps,{...e,children:(0,D.jsx)(`path`,{d:`M20 6 9 17l-5-5`})}),Is=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`path`,{d:`M18 6 6 18`}),(0,D.jsx)(`path`,{d:`m6 6 12 12`})]}),Ls=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,D.jsx)(`path`,{d:`M7 10l5 5 5-5`}),(0,D.jsx)(`path`,{d:`M12 15V3`})]}),Rs=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,D.jsx)(`path`,{d:`M17 8l-5-5-5 5`}),(0,D.jsx)(`path`,{d:`M12 3v12`})]}),zs=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`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`}),(0,D.jsx)(`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`}),(0,D.jsx)(`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`})]}),Bs=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`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`}),(0,D.jsx)(`path`,{d:`m15 5 4 4`})]}),Vs=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,D.jsx)(`path`,{d:`M3 3v5h5`})]}),Hs=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`path`,{d:`M3 6h18`}),(0,D.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),(0,D.jsx)(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}),(0,D.jsx)(`path`,{d:`M10 11v6`}),(0,D.jsx)(`path`,{d:`M14 11v6`})]}),Us=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`9`,r:`1`}),(0,D.jsx)(`circle`,{cx:`19`,cy:`9`,r:`1`}),(0,D.jsx)(`circle`,{cx:`5`,cy:`9`,r:`1`}),(0,D.jsx)(`circle`,{cx:`12`,cy:`15`,r:`1`}),(0,D.jsx)(`circle`,{cx:`19`,cy:`15`,r:`1`}),(0,D.jsx)(`circle`,{cx:`5`,cy:`15`,r:`1`})]}),Ws=[`hero-metrics`,`graph`,`latency-trace`,`throughput`,`decision-mix`,`telemetry-feed`,`system-pulse`,`pending-approvals`,`recent-blocks`],Gs={"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`},Ks={"hero-metrics":{minW:6,minH:2,defaultW:12,defaultH:2},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 qs({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,D.jsxs)(`div`,{ref:i,className:`grid-panel ${t?`grid-panel--edit`:``}`,style:a,role:t?`region`:void 0,"aria-label":t?Gs[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,D.jsx)(`button`,{type:`button`,className:`grid-panel__drag-handle`,title:`Drag ${Gs[e.id]} (or Arrow keys)`,"aria-label":`Drag ${Gs[e.id]}`,onPointerDown:t=>{let n=i.current;n&&r.onDragPointerDown(t,e.id,n)},children:(0,D.jsx)(Us,{size:12,strokeWidth:2})}),(0,D.jsx)(`div`,{className:`grid-panel__content`,"data-reveal":t?void 0:``,children:n}),t&&(0,D.jsx)(`button`,{type:`button`,className:`grid-panel__resize-handle`,title:`Resize ${Gs[e.id]} (or Shift+Arrow keys)`,"aria-label":`Resize ${Gs[e.id]}`,onPointerDown:t=>{let n=i.current;n&&r.onResizePointerDown(t,e.id,n)},children:(0,D.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,"aria-hidden":!0,children:[(0,D.jsx)(`path`,{d:`M10 0 L10 10 L0 10 Z`,fill:`currentColor`,fillOpacity:`0.4`}),(0,D.jsx)(`path`,{d:`M3 10 L10 3 M6 10 L10 6 M9 10 L10 9`,stroke:`currentColor`,strokeWidth:`0.8`,fill:`none`})]})})]})}var Js=(0,_.memo)(qs);function Ys(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 Xs(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=Ks[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=Ks[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}=Ys(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=Ks[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 Zs({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=Xs({gridRef:i,getPanel:(0,_.useCallback)(e=>o.get(e),[o]),onCommit:(0,_.useCallback)(e=>{let t=a.current,{panels:n}=Ns(t,e.id,{x:e.x,y:e.y,w:e.w,h:e.h});r(n)},[r]),enabled:t});return(0,D.jsx)(`div`,{ref:i,className:`grid-layout ${t?`grid-layout--editing`:``}`,"aria-live":t?`polite`:void 0,children:e.map(e=>(0,D.jsx)(Js,{panel:e,isEditing:t,drag:s,children:n[e.id]()},e.id))})}function Qs({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),[O,k]=(0,_.useState)(!1),ee=(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 A(){y.trim()&&(c(y.trim()),b(``),v(!1),h(`Saved "${y.trim()}"`))}function j(){C.trim()&&(l(C.trim()),S(!1),h(`Renamed`))}function M(){let e=i.name;u(i.id),k(!1),h(`Deleted "${e}"`)}function te(){d(),E(!1),h(`Reset to default`)}function ne(){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 N(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,D.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,D.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,D.jsx)(`span`,{className:`overline shrink-0`,children:`layout`}),(0,D.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,D.jsx)(`optgroup`,{label:`Built-in`,children:r.layouts.filter(e=>e.builtIn).map(e=>(0,D.jsx)(`option`,{value:e.id,children:e.name},e.id))}),r.layouts.some(e=>!e.builtIn)&&(0,D.jsx)(`optgroup`,{label:`Your layouts`,children:r.layouts.filter(e=>!e.builtIn).map(e=>(0,D.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),i.builtIn&&(0,D.jsx)(`span`,{className:`chip text-[var(--color-fg-3)]`,title:`Built-in preset`,children:`built-in`})]}),(0,D.jsx)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:t?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(J,{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,D.jsx)(zs,{size:11,strokeWidth:2.25}),`Save as`]}),!i.builtIn&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:()=>{w(i.name),S(!0)},children:[(0,D.jsx)(Bs,{size:11,strokeWidth:2.25}),`Rename`]}),(0,D.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:()=>k(!0),children:[(0,D.jsx)(Hs,{size:11,strokeWidth:2.25}),`Delete`]})]}),(0,D.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:()=>E(!0),title:`Replace the current layout with the Default preset`,children:[(0,D.jsx)(Vs,{size:11,strokeWidth:2.25}),`Reset`]}),(0,D.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:ne,title:`Download current layouts as JSON`,children:[(0,D.jsx)(Ls,{size:11,strokeWidth:2.25}),`Export`]}),(0,D.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:()=>ee.current?.click(),title:`Load layouts from a JSON file`,children:[(0,D.jsx)(Rs,{size:11,strokeWidth:2.25}),`Import`]}),(0,D.jsx)(`input`,{ref:ee,type:`file`,accept:`application/json,.json`,onChange:N,className:`hidden`,"aria-hidden":!0}),(0,D.jsxs)(J,{variant:`primary`,size:`sm`,onClick:()=>n(!1),children:[(0,D.jsx)(Fs,{size:11,strokeWidth:2.5}),`Done`]})]}):(0,D.jsxs)(J,{variant:`secondary`,size:`sm`,onClick:()=>n(!0),children:[(0,D.jsx)(Bs,{size:11,strokeWidth:2.25}),`Edit layout`]})}),g&&(0,D.jsx)($s,{title:`Save layout as`,value:y,placeholder:`My dashboard`,onChange:b,onConfirm:A,onCancel:()=>{v(!1),b(``)},confirmLabel:`Save`}),x&&(0,D.jsx)($s,{title:`Rename layout`,value:C,placeholder:i.name,onChange:w,onConfirm:j,onCancel:()=>S(!1),confirmLabel:`Rename`}),T&&(0,D.jsx)(ec,{title:`Reset this layout?`,body:`The current arrangement will be replaced with the Default preset. Saved layouts are not affected.`,confirmLabel:`Reset`,onConfirm:te,onCancel:()=>E(!1),destructive:!1}),O&&(0,D.jsx)(ec,{title:`Delete "${i.name}"?`,body:`This layout will be removed. You can always recreate it via Save as.`,confirmLabel:`Delete`,onConfirm:M,onCancel:()=>k(!1),destructive:!0}),m&&(0,D.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 $s({title:e,value:t,placeholder:n,onChange:r,onConfirm:i,onCancel:a,confirmLabel:o}){return(0,D.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,D.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,D.jsx)(`div`,{className:`overline mb-2`,children:e}),(0,D.jsx)(`input`,{value:t,onChange:e=>r(e.target.value),placeholder:n,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,D.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,D.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:a,children:[(0,D.jsx)(Is,{size:11,strokeWidth:2.25}),`Cancel`]}),(0,D.jsx)(J,{variant:`primary`,size:`sm`,onClick:i,children:o})]})]})})}function ec({title:e,body:t,confirmLabel:n,destructive:r,onConfirm:i,onCancel:a}){return(0,D.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,D.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,D.jsx)(`div`,{className:`overline mb-2`,children:e}),(0,D.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:t}),(0,D.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,D.jsx)(J,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),(0,D.jsx)(J,{variant:r?`danger`:`primary`,size:`sm`,onClick:i,children:n})]})]})})}var tc={default:`builtin-default`,focusLatency:`builtin-focus-latency`,focusApprovals:`builtin-focus-approvals`,compact:`builtin-compact`},nc={id:tc.default,name:`Default`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:2},{id:`graph`,x:0,y:2,w:8,h:5},{id:`latency-trace`,x:8,y:2,w:4,h:3},{id:`throughput`,x:8,y:5,w:2,h:2},{id:`decision-mix`,x:10,y:5,w:2,h:2},{id:`telemetry-feed`,x:0,y:7,w:12,h:3},{id:`system-pulse`,x:0,y:10,w:12,h:3},{id:`pending-approvals`,x:0,y:13,w:6,h:3},{id:`recent-blocks`,x:6,y:13,w:6,h:3}]},rc={id:tc.focusLatency,name:`Focus · Latency`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:2},{id:`latency-trace`,x:0,y:2,w:8,h:5},{id:`graph`,x:8,y:2,w:4,h:5},{id:`throughput`,x:0,y:7,w:6,h:2},{id:`decision-mix`,x:6,y:7,w:6,h:2},{id:`system-pulse`,x:0,y:9,w:12,h:3},{id:`telemetry-feed`,x:0,y:12,w:12,h:3},{id:`pending-approvals`,x:0,y:15,w:6,h:2},{id:`recent-blocks`,x:6,y:15,w:6,h:2}]},ic={id:tc.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:2},{id:`latency-trace`,x:0,y:9,w:6,h:3},{id:`telemetry-feed`,x:6,y:9,w:6,h:3},{id:`system-pulse`,x:0,y:12,w:12,h:3},{id:`throughput`,x:0,y:15,w:6,h:2},{id:`decision-mix`,x:6,y:15,w:6,h:2}]},ac={id:tc.compact,name:`Compact`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:2},{id:`graph`,x:0,y:2,w:8,h:3},{id:`latency-trace`,x:8,y:2,w:4,h:3},{id:`system-pulse`,x:0,y:5,w:12,h:3},{id:`throughput`,x:0,y:8,w:4,h:2},{id:`decision-mix`,x:4,y:8,w:4,h:2},{id:`telemetry-feed`,x:0,y:10,w:12,h:3},{id:`pending-approvals`,x:0,y:13,w:6,h:2},{id:`recent-blocks`,x:6,y:13,w:6,h:2}]},oc=Object.freeze([nc,rc,ic,ac]);function sc(){return oc.map(e=>({...e,panels:e.panels.map(e=>({...e}))}))}function cc(){return{version:1,activeLayoutId:tc.default,layouts:sc()}}function lc(e){return Object.values(tc).includes(e)}var uc=new Set(Ws),dc=new Set(oc.map(e=>e.id));function fc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pc(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 mc(e,t){let n=(typeof e==`string`?e:``).replace(/[\u0000-\u001F\u007F]/g,``).trim();return n.length===0?t:n.slice(0,40)}function hc(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 gc(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 _c(e){if(!fc(e))return null;let{id:t}=e;if(typeof t!=`string`||!uc.has(t))return null;let n=t,r=Ks[n],i=pc(e.x,0,11,0),a=pc(e.w,r.minW,12,r.defaultW);return{id:n,x:i+a>12?12-a:i,y:pc(e.y,0,999,0),w:a,h:pc(e.h,r.minH,99,r.defaultH)}}function vc(e,t){if(!fc(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=mc(e.name,t),i=dc.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=_c(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:hc(s)},droppedPanels:c}}function yc(e){if(!fc(e)||e.version!==1)return{config:cc(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0};let t=e.layouts;if(!Array.isArray(t)||t.length===0)return{config:cc(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0};let n=[],r=0,i=0,a=0;for(let e of t){let{layout:t,droppedPanels:o}=vc(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:cc(),droppedPanels:r,prunedLayouts:a,fellBackToDefault:!0};let o=new Set(n.map(e=>e.id));for(let e of oc)o.has(e.id)||n.push({...e,panels:e.panels.map(e=>({...e}))});let s=new Map(oc.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(gc(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:oc[0]?.id,layouts:n},droppedPanels:r,prunedLayouts:a,fellBackToDefault:!1,backfilledPanels:c,refreshedBuiltins:l}}var bc=`ssg:dashboard-layout:v1`,xc=300;function Sc(){if(typeof localStorage>`u`)return null;try{let e=`__ssg_probe__`;return localStorage.setItem(e,`1`),localStorage.removeItem(e),localStorage}catch{return null}}var Cc;function wc(){return Cc===void 0&&(Cc=Sc()),Cc}function Tc(){let e=wc();if(!e)return{config:cc(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!1};let t=null;try{t=e.getItem(bc)}catch{t=null}if(t===null)return{config:cc(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!1};let n=null;try{n=JSON.parse(t)}catch{return{config:cc(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0}}return yc(n)}var Ec=null,Dc=null,Oc=null;function kc(e){return Oc=e,()=>{Oc===e&&(Oc=null)}}function Ac(e){Oc?Oc(e):typeof console<`u`&&console.warn(`[ssg-layout]`,e)}function jc(){if(Dc=null,!Ec)return;let e=wc();if(!e){Ec=null;return}let t=Ec;Ec=null;try{e.setItem(bc,JSON.stringify(t))}catch(e){e instanceof Error&&e.name===`QuotaExceededError`?Ac(`Layout storage full — save skipped`):Ac(`Layout save failed: ${e instanceof Error?e.message:String(e)}`)}}function Mc(e){Ec=e,Dc===null&&(Dc=setTimeout(jc,xc))}function Nc(e){Ec=e,Dc!==null&&(clearTimeout(Dc),Dc=null),jc()}function Pc(e){let t=0;for(let n of e.layouts)n.builtIn||(t+=1);return t}function Fc(e){return e.map(e=>({...e}))}function Ic(){return`user-${Math.random().toString(16).slice(2,11)}`}function Lc(){let[e,t]=(0,_.useState)(()=>Tc().config),[n,r]=(0,_.useState)(null);(0,_.useEffect)(()=>kc(e=>r(e)),[]),(0,_.useEffect)(()=>{Mc(e)},[e]);let i=e.layouts.find(t=>t.id===e.activeLayoutId)??e.layouts[0]??sc()[0],a=Pc(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:Fc(e)}:t)}})},[]),c=(0,_.useCallback)(e=>{let n=e.trim();n&&t(e=>{if(Pc(e)>=12)return e;let t=e.layouts.find(t=>t.id===e.activeLayoutId)??e.layouts[0];if(!t)return e;let r={id:Ic(),name:n,builtIn:!1,panels:Fc(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??oc[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=lc(t.id)?oc.find(e=>e.id===t.id):oc[0];return n?{...e,layouts:e.layouts.map(e=>e.id===t.id?{...e,panels:Fc(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=yc(n);if(r.fellBackToDefault)return{ok:!1,message:`Import rejected: schema invalid, no changes applied`};t(r.config),Nc(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(cc())},[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 Rc=[`rules-changed`,`activity-updated`,`pending-changed`,`runtime-tick`,`limits-breach`],zc={critical:{border:`border-l-red-500/70`,iconBg:`bg-red-500/15`,iconFg:`text-red-400`,chipBg:`bg-red-500/10`,chipFg:`text-red-300`,label:`Critical`},warning:{border:`border-l-amber-400/70`,iconBg:`bg-amber-500/15`,iconFg:`text-amber-300`,chipBg:`bg-amber-500/10`,chipFg:`text-amber-200`,label:`Heads up`},info:{border:`border-l-sky-500/70`,iconBg:`bg-sky-500/15`,iconFg:`text-sky-300`,chipBg:`bg-sky-500/10`,chipFg:`text-sky-200`,label:`Tip`}};function Bc({severity:e}){return e===`critical`?(0,D.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,D.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,D.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}):e===`warning`?(0,D.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.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,D.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,D.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}):(0,D.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,D.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12`,y2:`12`}),(0,D.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12.01`,y2:`8`})]})}function Vc({notification:e,onAction:t}){let[n,r]=(0,_.useState)(`idle`),[i,a]=(0,_.useState)(null),o=zc[e.severity];return(0,D.jsxs)(`div`,{className:`hig-card border-l-2 ${o.border} flex items-start gap-3 px-3 py-2.5`,children:[(0,D.jsx)(`span`,{className:`shrink-0 mt-0.5 inline-flex items-center justify-center w-6 h-6 rounded-full ${o.iconBg} ${o.iconFg}`,"aria-hidden":!0,children:(0,D.jsx)(Bc,{severity:e.severity})}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,D.jsx)(`span`,{className:`text-[9px] font-mono font-medium uppercase tracking-wider px-1.5 py-0.5 rounded ${o.chipBg} ${o.chipFg}`,children:o.label}),(0,D.jsx)(`h3`,{className:`text-[13px] font-medium text-[var(--color-fg-0)] leading-tight`,children:e.title})]}),(0,D.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:e.detail}),n===`error`&&i&&(0,D.jsxs)(`p`,{className:`mt-1.5 text-[11px] font-mono text-red-300`,children:[`Failed: `,i]}),n===`done`&&(0,D.jsx)(`p`,{className:`mt-1.5 text-[11px] font-mono text-emerald-300`,children:`✓ Done — refreshing…`})]}),(0,D.jsx)(`div`,{className:`shrink-0 self-center`,children:e.action?(0,D.jsx)(`button`,{type:`button`,onClick:async()=>{if(e.action&&!(e.action.confirm&&!confirm(e.action.confirm))){r(`loading`),a(null);try{await t(e),r(`done`)}catch(e){r(`error`),a(e instanceof Error?e.message:String(e))}}},disabled:n===`loading`||n===`done`,className:`inline-flex items-center gap-1 h-8 px-3 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-[var(--color-surface-2)] text-[var(--color-fg-1)] border border-[var(--color-line-1)] hover:bg-[var(--color-surface-3)] hover:border-[var(--color-line-2)] transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap`,children:n===`loading`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`animate-spin`,children:`⟳`}),` working…`]}):n===`done`?(0,D.jsx)(D.Fragment,{children:`✓ done`}):e.action.label}):e.link?(0,D.jsxs)(`a`,{href:e.link.href,className:`inline-flex items-center gap-1 h-8 px-3 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-[var(--color-surface-2)] text-[var(--color-fg-1)] border border-[var(--color-line-1)] hover:bg-[var(--color-surface-3)] hover:border-[var(--color-line-2)] transition-colors whitespace-nowrap`,children:[e.link.label,` →`]}):null})]})}function Hc({showEmptyState:e=!1,hideHeader:t=!1}={}){let n=Bt(Rc),{data:r,refetch:i}=V(`/api/json/maintenance`,[n[`rules-changed`],n[`activity-updated`],n[`pending-changed`],n[`runtime-tick`],n[`limits-breach`]]),a=async e=>{if(!e.action)return;let t=await fetch(e.action.url,{method:e.action.method,headers:{Accept:`application/json`,"Content-Type":`application/json`,...H()}});if(!t.ok){let e=await t.text().catch(()=>``);throw Error(e||`HTTP ${t.status}`)}setTimeout(()=>i(),600)},o=r?.notifications??[];return o.length===0&&!e?null:(0,D.jsxs)(`section`,{"data-reveal":!0,children:[!t&&(0,D.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,D.jsx)(`h2`,{className:`overline text-[11px]`,children:o.length===0?`maintenance · all clear`:`maintenance · ${o.length} item${o.length===1?``:`s`}`}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>i(),className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] transition-colors cursor-pointer`,title:`Re-check now`,children:`refresh`})]}),o.length===0?(0,D.jsxs)(`div`,{className:`hig-card border-l-2 border-l-emerald-500/60 px-4 py-5 flex items-center gap-3`,children:[(0,D.jsx)(`span`,{className:`inline-flex items-center justify-center w-8 h-8 rounded-full bg-emerald-500/15 text-emerald-300 shrink-0`,children:(0,D.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,D.jsx)(`path`,{d:`M20 6L9 17l-5-5`})})}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h3`,{className:`text-[13px] font-medium text-[var(--color-fg-0)] leading-tight`,children:`Everything looks good`}),(0,D.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:`No drift, no capacity warnings, no stalled daemons. We'll let you know if anything changes.`})]})]}):(0,D.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,D.jsx)(Vc,{notification:e,onAction:a},e.id))})]})}var Uc=e=>Math.max(0,Math.round(e)).toLocaleString(void 0,{useGrouping:!0});function Wc(e,t){if(e===`spring`){let e=mi();return{ease:e.fn,durationMs:e.duration}}return e===`quart`?{ease:Xr.out,durationMs:t}:{ease:Yr.out,durationMs:t}}var Gc=250;function Kc({value:e,duration:t=320,format:n=Uc,className:r,curve:i=`cubic`}){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)(Si()),f=(0,_.useRef)(null),p=(0,_.useRef)(0);return p.current===0&&(p.current=performance.now()),(0,_.useEffect)(()=>{if(c.current===e)return;if(performance.now()-p.current<Gc){c.current=e,s.current=e,o(e);return}let n=f.current;if(n&&!d.current){for(let e of n.getAnimations())e.id===`lc-value-pulse`&&e.cancel();let e=n.animate([{textShadow:`0 0 0 rgba(245, 158, 11, 0)`},{textShadow:`0 0 10px rgba(245, 158, 11, 0.55)`,offset:.2},{textShadow:`0 0 0 rgba(245, 158, 11, 0)`}],{duration:520,easing:`ease-out`});e.id=`lc-value-pulse`}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:r,durationMs:m}=Wc(i,t),h=e=>{let t=Math.min(1,(e-l.current)/m),n=r(t);o(s.current+(c.current-s.current)*n),t<1?u.current=requestAnimationFrame(h):u.current=null};return u.current=requestAnimationFrame(h),()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null)}},[e,t,i,a]),(0,D.jsx)(`span`,{ref:f,className:K(`tabular-nums`,r),children:n(a)})}function qc({counters:e,className:t,showLegend:n=!0}){let r=[{key:`allow`,label:`Allow`,value:e.allow,color:`var(--color-decision-allow)`,textClass:`text-emerald-300`},{key:`ask`,label:`Ask`,value:e.ask,color:`var(--color-decision-ask)`,textClass:`text-amber-300`},{key:`block`,label:`Block`,value:e.block,color:`var(--color-decision-block)`,textClass:`text-red-300`},{key:`force`,label:`Force`,value:e.force,color:`var(--color-decision-force)`,textClass:`text-sky-300`},{key:`log`,label:`Log`,value:e.log,color:`var(--color-decision-log)`,textClass:`text-violet-300`},{key:`shadow`,label:`Shadow`,value:e.shadow,color:`var(--color-decision-shadow)`,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=Si();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;n||Math.abs(c-s)<.01?e.style.width=`${s}%`:Bi(e,{width:[`${c}%`,`${s}%`],duration:480,ease:`outExpo`}),o.current[t]=s})},[i,r.find]),(0,D.jsxs)(`div`,{className:K(`flex flex-col gap-2`,t),children:[(0,D.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,D.jsx)(`div`,{className:`w-full bg-[var(--color-surface-3)]`}):r.map(e=>(0,D.jsx)(`div`,{"data-seg":e.key,style:{width:`${i===0?0:e.value/i*100}%`,background:e.color}},e.key))}),n?(0,D.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-[11px] font-mono`,children:r.map(e=>(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2 min-w-0`,children:[(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,D.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-sm`,style:{background:e.color}}),(0,D.jsx)(`span`,{className:K(`uppercase tracking-wide truncate`,e.textClass),children:e.label})]}),(0,D.jsx)(Kc,{value:e.value,className:`shrink-0 tabular-nums text-[var(--color-fg-1)]`})]},e.key))}):null]})}function Jc({data:e,width:t=80,height:n=24,color:r=`#38bdf8`,threshold:i,maxValue:a}){if(e.length<2)return(0,D.jsx)(`svg`,{width:t,height:n,className:`shrink-0`,children:(0,D.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,D.jsxs)(`svg`,{width:t,height:n,className:`shrink-0`,children:[(0,D.jsx)(`polyline`,{points:l.join(` `),fill:`none`,stroke:r,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`}),u!==null&&(0,D.jsx)(`line`,{x1:1,y1:u,x2:t-1,y2:u,stroke:`var(--color-brand)`,strokeWidth:1,strokeDasharray:`3,2`,opacity:.7})]})}function Yc(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Xc({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)(Yc());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=()=>{let e=Date.now(),t=e-a,o;if(f.current){let e=f.current;o=[];for(let n of e)n.ts>=t&&o.push(n)}else{let n=d.current;for(;n.length>1&&n[1]?.ts<t;)n.shift();(n.length===0||n[n.length-1]?.ts<e-200)&&n.push({ts:e,v:p.current}),o=n.filter(e=>e.ts>=t)}if(o.length<2)l.current&&l.current.setAttribute(`points`,``),u.current&&u.current.setAttribute(`points`,``);else{let e=n??Math.max(1,...o.map(e=>e.v)),s=[];for(let n of o){let o=(n.ts-t)/a*r,c=i-n.v/e*(i-2)-1;s.push(`${o.toFixed(1)},${c.toFixed(1)}`)}let c=s.join(` `);if(l.current&&l.current.setAttribute(`points`,c),u.current){let e=s[0]?.split(`,`),t=s[s.length-1]?.split(`,`),n=`${e[0]},${i} ${c} ${t[0]},${i}`;u.current.setAttribute(`points`,n)}}};if(m.current){let t=window.setInterval(e,500);return()=>clearInterval(t)}let[t]=$o(e);return t},[r,i,a,n]),(0,D.jsxs)(`svg`,{width:`100%`,height:i,viewBox:`0 0 ${r} ${i}`,className:K(`block`,c),preserveAspectRatio:`none`,children:[(0,D.jsx)(`polygon`,{ref:u,fill:s,stroke:`none`}),(0,D.jsx)(`polyline`,{ref:l,fill:`none`,stroke:o,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`})]})}var Zc=vn(`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`}}),Qc={neutral:`var(--color-fg-1)`,amber:`var(--color-decision-ask)`,green:`var(--color-decision-allow)`,red:`var(--color-decision-block)`,blue:`var(--color-decision-force)`,purple:`var(--color-decision-log)`,gray:`var(--color-fg-3)`},$c={neutral:`color-mix(in srgb, var(--color-fg-1) 10%, transparent)`,amber:`color-mix(in srgb, var(--color-decision-ask) 14%, transparent)`,green:`color-mix(in srgb, var(--color-decision-allow) 14%, transparent)`,red:`color-mix(in srgb, var(--color-decision-block) 14%, transparent)`,blue:`color-mix(in srgb, var(--color-decision-force) 14%, transparent)`,purple:`color-mix(in srgb, var(--color-decision-log) 14%, transparent)`,gray:`color-mix(in srgb, var(--color-fg-3) 10%, transparent)`},el={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)]`},tl=1e3,nl=.35;function rl(e,t,n){let r=Date.now(),i=r-n,a=Math.max(2,Math.floor(n/tl)),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)/tl);e>=0&&e<a&&o[e]++}let s=Array(a),c=o[0];for(let e=0;e<a;e++)c=nl*o[e]+(1-nl)*c,s[e]={ts:i+(e+1)*tl,v:c};return s}function il({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=Qc[d]??Qc.neutral,p=$c[d]??$c.neutral,m=el[d]??el.neutral,h=(0,_.useRef)(null),g=(0,_.useRef)(t);(0,_.useEffect)(()=>{if(g.current===t)return;g.current=t;let e=h.current;e&&Bi(e,{"--tick":[0,1],duration:160,ease:`outCubic`,onComplete:()=>{Bi(e,{"--tick":[1,0],duration:520,ease:`outCubic`,onComplete:e=>{e.style.removeProperty(`--tick`)}})}})},[t]);let v=(0,_.useMemo)(()=>r?rl(r,i,a):null,[r,i,a]),y=v!==null,b=!y&&n&&n.length>=2;return(0,D.jsxs)(`div`,{ref:h,className:K(Zc({tone:s,className:l})),...u,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(`span`,{className:`overline`,children:e}),o?(0,D.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:o}):null]}),(0,D.jsxs)(`div`,{className:`flex items-end justify-between gap-3`,children:[(0,D.jsx)(Kc,{value:t,format:c,className:K(`text-[2.4rem] leading-none font-semibold tracking-tight`,m)}),y?(0,D.jsx)(Xc,{samples:v,width:108,height:36,windowMs:a,color:f,fillColor:p,className:`shrink-0`}):b?(0,D.jsx)(Jc,{data:n,width:96,height:28,color:f}):null]})]})}var al={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 ol(e,t,n=200){let r=Math.max(0,Math.floor(e)),i=Math.max(0,Math.floor(t)),a=Math.max(0,r-al.containerPaddingX),o=Math.max(0,i-al.containerPaddingY),s=o-(al.trendRowH*3+al.trendRowGap*2+al.trendTopPad+al.topToTrendGap),c=s-al.scatterHeaderH-al.scatterLegendH-al.scatterInnerGap>=al.scatterAcceptableMin,l=c?s:o,u=l-al.scatterHeaderH-al.scatterLegendH-al.scatterInnerGap,d=u>=al.scatterAbsoluteMin,f=u>=al.scatterAbsoluteMin&&l>=140,p=Math.floor(l/al.gaugeFootprintFactor),m=Math.floor(a*.45/al.gaugeFootprintFactor),h=Math.max(al.gaugeAbsoluteMin,Math.min(al.gaugeAbsoluteMax,n,p,m)),g=Math.ceil(h*al.gaugeFootprintFactor+8),_=l-(d?al.scatterHeaderH:0)-(f?al.scatterLegendH:0)-al.scatterInnerGap;return{gaugeSize:h,gaugeColumnMaxWidth:g,scatterMinHeight:Math.max(al.scatterAbsoluteMin,Math.min(160,_)),showTrendRows:c,showScatterHeader:d,showLegend:f,variant:o>=480?`wide`:o>=300?`normal`:`compact`}}var sl=135,cl=405,ll=cl-sl,ul=`#34d399`,dl=`#f59e0b`,fl=`#ef4444`;function pl(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 ml(e,t,n,r,i){let a=pl(e,t,n,r),o=pl(e,t,n,i),s=+(i-r>180);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 hl(e,t){return sl+Math.max(0,Math.min(1,e/Math.max(t,1e-9)))*ll}function gl(e,t,n){return e+(t-e)*n}function _l(e){let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]}function vl(e,t,n){let[r,i,a]=_l(e),[o,s,c]=_l(t);return`rgb(${Math.round(gl(r,o,n))},${Math.round(gl(i,s,n))},${Math.round(gl(a,c,n))})`}function yl(e,t,n){let r=.04;return e<t-r?ul:e<t+r?vl(ul,dl,(e-(t-r))/(r*2)):e<n-r?dl:e<n+r?vl(dl,fl,(e-(n-r))/(r*2)):fl}function bl(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var xl=0;function Sl(){return xl=xl+1|0,xl.toString(36)}function Cl({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)(()=>ml(x,S,C,sl,cl),[x,S,C]),E=(0,_.useMemo)(()=>ml(x,S,C-8,sl,cl),[x,S,C]),O=sl+n*ll,k=sl+r*ll,ee=(0,_.useMemo)(()=>ml(x,S,C,sl,O),[x,S,C,O]),A=(0,_.useMemo)(()=>ml(x,S,C,O,k),[x,S,C,O,k]),j=(0,_.useMemo)(()=>ml(x,S,C,k,cl),[x,S,C,k]),M=(0,_.useMemo)(()=>ml(x,S,C-14,300,420),[x,S,C]),te=sl+w*ll,ne=(0,_.useMemo)(()=>ml(x,S,C,sl,Math.max(sl+.01,te)),[x,S,C,te]),N=yl(w,n,r),P=(0,_.useMemo)(()=>Sl(),[]),F=`lgf-${P}`,re=`lgb-${P}`,I=`lgd-${P}`,L=`lgh-${P}`,R=`lgg-${P}`,z=`lgl-${P}`,ie=(0,_.useMemo)(()=>{if(u!==`needle`)return[];let e=[];for(let t=0;t<=10;t++)e.push(sl+t/10*ll);return e},[u]),B=(0,_.useMemo)(()=>{if(u!==`needle`)return[];let e=[];for(let t=0;t<=40;t++)t%4!=0&&e.push(sl+t/40*ll);return e},[u]),ae=(0,_.useRef)(null),oe=(0,_.useRef)(null),se=(0,_.useRef)(null),ce=(0,_.useRef)(null),le=(0,_.useRef)(null),ue=(0,_.useRef)(null),de=(0,_.useRef)(null),fe=(0,_.useRef)(null),pe=(0,_.useRef)([]),me=(0,_.useRef)(e),he=(0,_.useRef)(t),ge=(0,_.useRef)(n),_e=(0,_.useRef)(r);(0,_.useEffect)(()=>{me.current=e,he.current=t,ge.current=n,_e.current=r},[e,t,n,r]);let ve=(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=sl+(r+.5)/e*ll;n.push(pl(x,S,t,i))}return n},[p,m,u,x,S,C]);pe.current.length!==ve.length&&(pe.current.length=ve.length);let ye=x+C-6,be=x+d*.04,xe=Math.max(2,d*.016),Se=`${ye},${S} ${be},${S-xe} ${be},${S+xe}`,Ce=x-d*.04,we=x-C*.24,Te=Math.max(1.4,d*.012),Ee=`${we},${S} ${Ce},${S-Te} ${Ce},${S+Te}`,De=d*.48,Oe=d*.17,ke=x-De/2,Ae=S+d*.16,je=Ae+Oe*.68;return(0,_.useEffect)(()=>{let e=bl(),t=performance.now(),n=me.current,r=0,i=me.current,a=0,o=me.current,s=``,l=``,d=``,f=-1,m=``,h=``,[g]=$o(()=>{let g=performance.now(),_=(g-t)/1e3;t=g;let v=Math.min(.04,Math.max(.001,_)),y=me.current,b=he.current,w=ge.current,T=_e.current,E=Math.max(b,1e-9),D=y;if(e)n=y,i=y,o=y,r=0,a=0;else{let e=v/2;for(let t=0;t<2;t++){let t=-210*(n-D)-22*r;r+=t*e,n+=r*e;let o=-55*(i-n)-13*a;a+=o*e,i+=a*e}let t=1-Math.exp(-v*8);o+=(y-o)*t,Math.abs(n-y)<E*1e-5&&Math.abs(r)<1e-4&&(n=y,r=0),Math.abs(o-y)<E*1e-5&&(o=y)}let O=Math.max(0,Math.min(1,n/Math.max(b,1e-9))),k=sl+O*ll,ee=sl+Math.max(0,Math.min(1,i/Math.max(b,1e-9)))*ll,A=yl(O,w,T),j=`rotate(${(k-90).toFixed(3)} ${x} ${S})`;ae.current&&j!==s&&(ae.current.setAttribute(`transform`,j),s=j),A!==d&&(oe.current&&oe.current.setAttribute(`fill`,A),se.current&&se.current.setAttribute(`fill`,A),ce.current&&ce.current.setAttribute(`stroke`,A),ue.current&&ue.current.setAttribute(`fill`,A),d=A);let M=`rotate(${(ee-90).toFixed(3)} ${x} ${S})`;if(le.current&&M!==l&&(le.current.setAttribute(`transform`,M),l=M),de.current&&c){let e=c(o);e!==h&&(de.current.textContent=e,h=e)}if(fe.current&&u===`ring`){let e=ml(x,S,C,sl,Math.max(sl+.01,k));e!==m&&(fe.current.setAttribute(`d`,e),m=e)}if(p&&u===`needle`){let e=Math.round(O*1e3)/1e3;if(e!==f){f=e;let t=pe.current,n=t.length;if(n>0){let e=1/n;for(let r=0;r<n;r++){let i=t[r];if(!i)continue;let a=(r+.5)/n,o=O-a,s=Math.max(0,Math.min(1,.5+o/e));i.setAttribute(`fill`,yl(a,w,T)),i.setAttribute(`opacity`,s.toFixed(3))}}}}});return g},[x,S,C,u,p,c]),(0,D.jsxs)(`div`,{className:K(`flex flex-col items-center justify-center gap-1 min-h-0 min-w-0`,f),children:[(0,D.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,D.jsxs)(`defs`,{children:[(0,D.jsxs)(`filter`,{id:F,x:`-40%`,y:`-40%`,width:`180%`,height:`180%`,children:[(0,D.jsx)(`feGaussianBlur`,{stdDeviation:`1.2`,result:`blur`}),(0,D.jsxs)(`feMerge`,{children:[(0,D.jsx)(`feMergeNode`,{in:`blur`}),(0,D.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,D.jsxs)(`radialGradient`,{id:re,cx:`50%`,cy:`32%`,r:`80%`,children:[(0,D.jsx)(`stop`,{offset:`0%`,stopColor:`#4e535d`}),(0,D.jsx)(`stop`,{offset:`55%`,stopColor:`#2a2e36`}),(0,D.jsx)(`stop`,{offset:`100%`,stopColor:`#0b0d11`})]}),(0,D.jsxs)(`radialGradient`,{id:I,cx:`50%`,cy:`45%`,r:`75%`,children:[(0,D.jsx)(`stop`,{offset:`0%`,stopColor:`#1b1f27`}),(0,D.jsx)(`stop`,{offset:`80%`,stopColor:`#0a0c10`}),(0,D.jsx)(`stop`,{offset:`100%`,stopColor:`#05060a`})]}),(0,D.jsxs)(`radialGradient`,{id:L,cx:`40%`,cy:`30%`,r:`70%`,children:[(0,D.jsx)(`stop`,{offset:`0%`,stopColor:`#f4f5f8`}),(0,D.jsx)(`stop`,{offset:`45%`,stopColor:`#aab1bd`}),(0,D.jsx)(`stop`,{offset:`100%`,stopColor:`#1c1f26`})]}),(0,D.jsxs)(`linearGradient`,{id:R,x1:`50%`,y1:`0%`,x2:`50%`,y2:`100%`,children:[(0,D.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`0.22`}),(0,D.jsx)(`stop`,{offset:`100%`,stopColor:`#ffffff`,stopOpacity:`0`})]}),(0,D.jsxs)(`linearGradient`,{id:z,x1:`50%`,y1:`0%`,x2:`50%`,y2:`100%`,children:[(0,D.jsx)(`stop`,{offset:`0%`,stopColor:`#0a0c11`}),(0,D.jsx)(`stop`,{offset:`100%`,stopColor:`#15181f`})]})]}),u===`needle`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`circle`,{cx:x,cy:S,r:C+12,fill:`url(#${re})`,stroke:`#000`,strokeOpacity:.55,strokeWidth:1}),(0,D.jsx)(`circle`,{cx:x,cy:S,r:C+5,fill:`none`,stroke:`#0a0c11`,strokeWidth:1}),(0,D.jsx)(`circle`,{cx:x,cy:S,r:C-2,fill:`url(#${I})`})]}):null,(0,D.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,D.jsx)(`path`,{d:E,fill:`none`,stroke:`var(--color-line-0)`,strokeWidth:1,strokeLinecap:`round`,opacity:.55}):null,u===`needle`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`path`,{d:ee,fill:`none`,stroke:ul,strokeWidth:5,strokeLinecap:`round`,opacity:.78}),(0,D.jsx)(`path`,{d:A,fill:`none`,stroke:dl,strokeWidth:5,strokeLinecap:`round`,opacity:.82}),(0,D.jsx)(`path`,{d:j,fill:`none`,stroke:fl,strokeWidth:5,strokeLinecap:`round`,opacity:.9}),B.map((e,t)=>{let n=pl(x,S,C-4,e),r=pl(x,S,C+2,e);return(0,D.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}`)}),ie.map((e,t)=>{let n=pl(x,S,C-8,e),r=pl(x,S,C+4,e);return(0,D.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?ve.map((e,t)=>(0,D.jsx)(`circle`,{ref:e=>{pe.current[t]=e},cx:e.x,cy:e.y,r:Math.max(1.6,d*.013),fill:ul,opacity:0,filter:`url(#${F})`},t)):null,i===void 0?null:(0,D.jsx)(wl,{cx:x,cy:S,r:C,angle:hl(i,t),emphasis:!0}),a===void 0?null:(0,D.jsx)(wl,{cx:x,cy:S,r:C,angle:hl(a,t),emphasis:!0}),l?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Tl,{cx:x,cy:S,r:C,angle:O,text:l(n),size:d}),(0,D.jsx)(Tl,{cx:x,cy:S,r:C,angle:k,text:l(r),size:d}),(0,D.jsx)(Tl,{cx:x,cy:S,r:C,angle:cl,text:l(1),size:d})]}):null,(0,D.jsx)(`path`,{d:M,fill:`none`,stroke:`url(#${R})`,strokeWidth:d*.14,strokeLinecap:`butt`}),c||s!==void 0?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`rect`,{x:ke,y:Ae,width:De,height:Oe,rx:d*.022,ry:d*.022,fill:`url(#${z})`,stroke:`#242a33`,strokeWidth:1}),(0,D.jsx)(`rect`,{x:ke+1,y:Ae+1,width:De-2,height:1,fill:`#ffffff`,opacity:.08})]}):null,(0,D.jsx)(`g`,{ref:le,opacity:.28,children:(0,D.jsx)(`polygon`,{ref:ue,points:Se,fill:N})}),(0,D.jsxs)(`g`,{ref:ae,children:[(0,D.jsx)(`polygon`,{ref:oe,points:Se,fill:N,stroke:`#05070a`,strokeWidth:.6}),(0,D.jsx)(`polygon`,{ref:se,points:Ee,fill:N,opacity:.7})]}),(0,D.jsx)(`circle`,{cx:x,cy:S,r:d*.06,fill:`url(#${L})`,stroke:`#06080c`,strokeWidth:1}),(0,D.jsx)(`circle`,{ref:ce,cx:x,cy:S,r:d*.036,fill:`#0a0c11`,stroke:N,strokeWidth:1.4}),(0,D.jsx)(`circle`,{cx:x,cy:S,r:d*.012,fill:`#f5f7fb`,opacity:.9})]}):(0,D.jsx)(`path`,{ref:fe,d:ne,fill:`none`,stroke:N,strokeWidth:12,strokeLinecap:`round`}),u===`needle`&&(c||s!==void 0)?c?(0,D.jsx)(`text`,{ref:de,x,y:je,textAnchor:`middle`,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:d*.1,fontWeight:600,fill:`#e8ecf3`,children:c(e)}):(0,D.jsx)(`text`,{x,y:je,textAnchor:`middle`,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:d*.1,fontWeight:600,fill:`#e8ecf3`,children:s}):c?(0,D.jsx)(`text`,{ref:de,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,D.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,D.jsx)(`span`,{className:`overline shrink-0 tracking-[0.12em] uppercase`,children:o}):null]})}function wl({cx:e,cy:t,r:n,angle:r,emphasis:i=!1}){let a=pl(e,t,n-(i?10:6),r),o=pl(e,t,n+(i?8:6),r);return(0,D.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 Tl({cx:e,cy:t,r:n,angle:r,text:i,size:a}){let o=pl(e,t,n+Math.max(16,a*.1),r),s=r>=135&&r<215?`end`:r>=325?`start`:`middle`;return(0,D.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 El={allow:`#34d399`,block:`#ef4444`,ask:`#f59e0b`,log:`#a78bfa`,force:`#38bdf8`,shadow:`#6e7076`};function Dl(e){return!Number.isFinite(e)||e<=0?`—`:e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:`${(e/1e6).toFixed(2)} ms`}function Ol({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)(()=>ol(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/4)*4,i=Math.round(e.height/4)*4;t===n&&i===r||(n=t,r=i,p(ol(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:El[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=0,o=0,s=8e3,c=.25,l=1e3,u=n*1e6,d=Math.log10(l),f=Math.log10(u),[p]=$o(()=>{let n=window.devicePixelRatio||1,p=e.clientWidth,m=e.clientHeight;if(p===0||m===0)return;(p!==a||m!==o||n!==i)&&(e.width=Math.floor(p*n),e.height=Math.floor(m*n),t.setTransform(n,0,0,n,0,0),a=p,o=m,i=n),t.clearRect(0,0,p,m),t.strokeStyle=`rgba(110, 112, 118, 0.18)`,t.lineWidth=1,t.setLineDash([2,4]);let g=[{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 g){if(e.ns<l||e.ns>u)continue;let n=m-(Math.log10(e.ns)-d)/(f-d)*m;t.beginPath(),t.moveTo(0,n),t.lineTo(p-28,n),t.stroke(),t.fillText(e.label,p-26,n)}t.setLineDash([]);let _=Date.now(),v=_-r,y=h.current;for(;y.length&&y[0]?.ts<v;)y.shift();t.globalCompositeOperation=`source-over`;for(let e of y){let n=(e.ts-v)/r*p,i=Math.max(l,Math.min(u,e.durationNs)),a=m-(Math.log10(i)-d)/(f-d)*m,o=_-e.ts,h;if(o<=s)h=1-o/s*(1-c);else{let e=r-s;h=e>0?Math.max(0,c*(1-(o-s)/e)):0}h<=0||(t.globalAlpha=h,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,m-2),t.textAlign=`right`,t.fillText(`now →`,p-4,m-2),t.textAlign=`left`});return p},[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]}},[]);return(0,D.jsxs)(`div`,{ref:d,"data-lt-variant":f.variant,className:K(`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,D.jsxs)(`div`,{className:K(`grid gap-3 min-h-0 flex-1`,`grid-cols-[auto_1fr]`),children:[(0,D.jsx)(`div`,{className:`flex items-stretch justify-center overflow-hidden min-h-0 min-w-0`,style:{maxWidth:f.gaugeColumnMaxWidth},children:(0,D.jsx)(Cl,{value:l,max:n,warnAt:Math.min(.85,.5/n),critAt:Math.min(.92,2/n),marker50:c,marker99:u,displayFormat:e=>Dl(e*1e6),scaleLabels:f.gaugeSize>=130?e=>Dl(e*n*1e6):void 0,size:f.gaugeSize,label:`p95 latency`})}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0 min-h-0 flex-1`,children:[f.showScatterHeader?(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3 shrink-0 min-w-0`,children:[(0,D.jsx)(`span`,{className:`overline truncate min-w-0`,children:`live trace · 30 s scatter`}),(0,D.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,D.jsx)(`div`,{className:`shrink-0`,children:(0,D.jsx)(kl,{})}):null,(0,D.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,D.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,D.jsx)(Al,{label:`p50 · median`,value:Dl(e?.p50_ns??0),color:`#34d399`,fill:`rgba(52, 211, 153, 0.14)`,samples:y.p50,windowMs:i*1e3}),(0,D.jsx)(Al,{label:`p95 · 95th`,value:Dl(e?.p95_ns??0),color:`#38bdf8`,fill:`rgba(56, 189, 248, 0.14)`,samples:y.p95,windowMs:i*1e3}),(0,D.jsx)(Al,{label:`p99 · 99th`,value:Dl(e?.p99_ns??0),color:`#6366f1`,fill:`rgba(99, 102, 241, 0.14)`,samples:y.p99,windowMs:i*1e3})]}):null]})}function kl(){return(0,D.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:El.allow},{key:`ask`,color:El.ask},{key:`block`,color:El.block},{key:`force`,color:El.force},{key:`log`,color:El.log},{key:`shadow`,color:El.shadow}].map(e=>(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,D.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full`,style:{background:e.color}}),(0,D.jsx)(`span`,{className:`uppercase tracking-wide`,children:e.key})]},e.key))})}function Al({label:e,value:t,color:n,fill:r,samples:i,windowMs:a}){return(0,D.jsxs)(`div`,{className:`grid grid-cols-[72px_minmax(0,1fr)_92px] items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`overline text-right truncate min-w-0`,children:e}),(0,D.jsx)(Xc,{samples:i,width:1200,height:28,windowMs:a,color:n,fillColor:r,className:`w-full h-7`}),(0,D.jsx)(`span`,{className:`text-[11px] font-mono tabular-nums text-right truncate min-w-0`,style:{color:n},title:t,children:t})]})}function jl(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 Ml(e,t){if(t===void 0||t<=0)return`var(--color-brand)`;let n=e/t;return n>=.9?`var(--color-decision-block)`:n>=.7?`var(--color-decision-ask)`:`var(--color-decision-allow)`}function Nl(e){return e===`var(--color-decision-block)`?`color-mix(in srgb, var(--color-decision-block) 14%, transparent)`:e===`var(--color-decision-ask)`?`color-mix(in srgb, var(--color-decision-ask) 14%, transparent)`:e===`var(--color-decision-allow)`?`color-mix(in srgb, var(--color-decision-allow) 14%, transparent)`:e===`var(--color-decision-log)`?`color-mix(in srgb, var(--color-decision-log) 14%, transparent)`:`color-mix(in srgb, var(--color-brand) 12%, transparent)`}function $(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 Pl({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=Ml(e,n),p=Ml(r,a),m=`var(--color-decision-log)`,h=(0,_.useMemo)(()=>$(t,d),[t]),g=(0,_.useMemo)(()=>$(i,d),[i]),v=(0,_.useMemo)(()=>$(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=Bi(e,{translateY:[28,0],scale:[.94,1],opacity:[0,1],duration:720,delay:vi(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,D.jsx)(`div`,{className:K(`rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] p-3`,u),children:(0,D.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:[(0,D.jsx)(Fl,{registerRef:e=>y.current[0]=e,label:`CPU`,color:f,fill:Nl(f),pulse:b,valueNode:(0,D.jsxs)(`span`,{children:[(0,D.jsx)(Kc,{value:e,format:e=>e.toFixed(1),className:`text-[var(--color-fg-0)]`}),(0,D.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,D.jsx)(Fl,{registerRef:e=>y.current[1]=e,label:`Memory`,color:p,fill:Nl(p),pulse:x,valueNode:(0,D.jsxs)(`span`,{children:[(0,D.jsx)(Kc,{value:r,format:e=>e.toFixed(0),className:`text-[var(--color-fg-0)]`}),(0,D.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,D.jsx)(Fl,{registerRef:e=>y.current[2]=e,label:`Heap`,color:m,fill:Nl(m),valueNode:(0,D.jsxs)(`span`,{children:[(0,D.jsx)(Kc,{value:o,format:e=>e.toFixed(0),className:`text-[var(--color-fg-0)]`}),(0,D.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,D.jsx)(Fl,{registerRef:e=>y.current[3]=e,label:`Uptime`,color:`var(--color-fg-2)`,fill:`rgba(214, 215, 217, 0.04)`,valueNode:(0,D.jsx)(`span`,{className:`text-[var(--color-fg-0)] tabular-nums`,children:jl(l)}),subText:`since daemon start`})]})})}function Fl({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=Bi(u.current,{"--breach":[0,1],duration:420,ease:`outCubic`,onComplete:()=>{e||!u.current||(t=Bi(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,D.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,D.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,D.jsx)(`span`,{className:`overline`,children:e}),n?(0,D.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:n}):null]}),(0,D.jsx)(`span`,{className:`text-[1.9rem] leading-none font-semibold tracking-tight font-mono`,style:{color:r},children:t}),a&&a.length>=2?(0,D.jsx)(`div`,{className:`mt-auto`,children:(0,D.jsx)(Xc,{samples:a,width:320,height:64,windowMs:s??6e4,color:r,fillColor:i,maxValue:o,className:`w-full`})}):(0,D.jsx)(`div`,{className:`mt-auto h-[64px] flex items-end`,children:(0,D.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`— no series —`})})]})}var Il=vn(`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`}}),Ll={allow:`#34d399`,block:`#ef4444`,ask:`#f59e0b`,log:`#a78bfa`,force:`#38bdf8`,shadow:`#6e7076`},Rl={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 zl(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 Bl(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 Vl(e){return e.variant===`raw`?(0,D.jsx)(Ul,{...e}):(0,D.jsx)(Hl,{...e})}function Hl({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&&(Si()||Bi(t,{translateX:[-10,0],opacity:[0,1],duration:220,ease:`outExpo`}))},[d,s]),(0,D.jsxs)(`div`,{className:K(Il({density:a,className:i})),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,D.jsx)(`div`,{className:`overflow-auto`,style:{height:o},children:d.length===0?(0,D.jsx)(`div`,{className:`px-3 py-4 text-[var(--color-fg-4)]`,children:`— waiting for events —`}):d.map((e,t)=>{let n=e.input_preview&&e.input_preview.length>0?e.input_preview:e.rule_id?`rule: ${e.rule_id}`:`—`;return(0,D.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 minmax(80px, 130px) minmax(0, 1fr) 70px 80px`,borderLeft:`3px solid ${Ll[e.decision]??`#666`}`},children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:zl(e.ts_ms)}),(0,D.jsx)(`span`,{className:K(`uppercase tracking-wide font-medium`,Rl[e.decision]??`text-[var(--color-fg-2)]`),children:e.decision}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,title:e.tool?`${e.tool} — ${ba(e.tool)}`:`unknown tool`,children:e.tool||`—`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] truncate`,title:n,children:n}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums text-right`,children:Bl(e.duration_ns)}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate text-right`,title:e.client,children:e.client})]},e.audit_id??`${e.ts_ms}:${e.tool}`)})}),s?(0,D.jsx)(Wl,{}):null]})}function Ul({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,D.jsxs)(`div`,{className:K(Il({density:r,className:n})),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[(0,D.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,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`— empty —`}):l.map((e,t)=>(0,D.jsx)(`div`,{className:`hover:bg-[var(--color-surface-2)]`,children:e},`${t}:${e.slice(0,40)}`))}),a?(0,D.jsx)(Wl,{}):null]})}function Wl(){return(0,D.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`})}function Gl(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,Si()){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`}),Bi(Array.from(i),{opacity:[0,1],translateY:[c,0],duration:l,ease:`outBack(1.2)`,delay:vi(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(!Si()){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}var Kl=`ssg.sfx.enabled`;function ql(){if(typeof window>`u`)return!1;try{return window.localStorage.getItem(Kl)===`true`}catch{return!1}}function Jl(e){if(!(typeof window>`u`))try{window.localStorage.setItem(Kl,String(e))}catch{}}function Yl(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 Xl(){let[e,t]=(0,_.useState)(ql),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(Jl(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`:Yl(i,a,110,55,150,.08);break;case`force`:Yl(i,a,80,40,200,.1),Yl(i,a,160,80,200,.05,`square`);break;case`milestone`:{Yl(i,a,660,880,100,.06);let e=i,t=a;setTimeout(()=>{e.state!==`suspended`&&Yl(e,t,880,1320,100,.05)},115);break}case`record`:Yl(i,a,880,1320,350,.07);break}},[e])}}function Zl(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 Ql(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:H()})}var $l=e=>!0,eu=e=>e.decision===`allow`,tu=e=>e.decision===`block`,nu=e=>e.decision===`ask`,ru=e=>e.decision===`force`,iu=e=>e.decision===`log`;function au(){let e=new Date;return e.setHours(0,0,0,0),e.getTime()}function ou(){let e=Bt([`counters-updated`,`activity-updated`,`pending-changed`,`runtime-tick`]),t=Ka();Ja();let n=qa(),r=Xl();(0,_.useEffect)(()=>{t&&(t.decision===`block`?r.play(`block`):t.decision===`force`&&r.play(`force`))},[r.play,t]);let[i,a]=(0,_.useState)(()=>au());(0,_.useEffect)(()=>{let e=()=>{if(document.visibilityState!==`visible`)return;let e=au();a(t=>e===t?t:e)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let{data:o}=V(`/api/state/counters?since_ms=${i}`,[e[`counters-updated`],i]),{data:s}=V(`/api/state/runtime`,[e[`runtime-tick`]]),{data:c}=V(`/api/json/limits`,[e[`runtime-tick`]]),{data:l,refetch:u}=V(`/api/json/pending`,[e[`pending-changed`]]),{data:d}=V(`/api/json/blocked`,[e[`activity-updated`]]),f=Lc(),[p,m]=(0,_.useState)(!1),h=(0,_.useMemo)(()=>{let e=o?.allow??0,n=o?.block??0,r=o?.ask??0,i=o?.log??0,a=o?.force??0,s=e+n+r+i+a,c=t?.counters.total??0;return t&&c>=s&&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:s}},[t,o]),g=(0,_.useMemo)(()=>{if(n.length===0)return 0;let e=Date.now()-1e4;return n.filter(t=>t.ts_ms>=e).length/10},[n]),v=s?.history?.cpu_pct??[],y=s?.history?.memory_rss_mb??[],b=[],x=s?.latency,S=(0,_.useMemo)(()=>({"hero-metrics":()=>(0,D.jsx)(`div`,{className:`grid-bleed rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 h-full`,children:(0,D.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3 h-full`,children:[(0,D.jsx)(il,{label:`Total`,value:h.total,tone:`amber`,sub:t?Zl(t.duration_ns):void 0,burstRing:n,filter:$l}),(0,D.jsx)(il,{label:`Allow`,value:h.allow,tone:`green`,burstRing:n,filter:eu}),(0,D.jsx)(il,{label:`Block`,value:h.block,tone:`red`,burstRing:n,filter:tu}),(0,D.jsx)(il,{label:`Ask`,value:h.ask,tone:`amber`,burstRing:n,filter:nu}),(0,D.jsx)(il,{label:`Force`,value:h.force,tone:`blue`,burstRing:n,filter:ru}),(0,D.jsx)(il,{label:`Log`,value:h.log,tone:`purple`,burstRing:n,filter:iu})]})}),graph:()=>(0,D.jsx)(Os,{}),"latency-trace":()=>(0,D.jsx)(Ol,{latency:x,bursts:n,gaugeMaxMs:10,windowMs:3e4,trendWindowSec:60,gaugeSize:200}),throughput:()=>(0,D.jsxs)(Y,{className:`h-full`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`overline`,children:`throughput · evals/s`}),(0,D.jsxs)(q,{variant:`blue`,children:[g.toFixed(1),`/s`]})]}),(0,D.jsxs)(Z,{children:[(0,D.jsx)(Xc,{value:g,width:360,height:96,windowMs:6e4,className:`w-full`}),(0,D.jsx)(`p`,{className:`overline mt-2 text-center`,children:`60-second rolling window`})]})]}),"decision-mix":()=>(0,D.jsxs)(Y,{className:`h-full`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`overline`,children:`decision mix`}),(0,D.jsx)(q,{variant:`gray`,children:h.total.toLocaleString()})]}),(0,D.jsx)(Z,{children:(0,D.jsx)(qc,{counters:{allow:h.allow,block:h.block,ask:h.ask,log:h.log,force:h.force,shadow:h.shadow}})})]}),"telemetry-feed":()=>(0,D.jsxs)(Y,{variant:`flush`,className:`h-full flex flex-col`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`overline`,children:`telemetry · live · newest first`}),(0,D.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:[`hover to pause · scroll for history · `,n.length,` events buffered`]})]}),(0,D.jsx)(Z,{className:`p-0 flex-1 min-h-0`,children:(0,D.jsx)(Vl,{variant:`decision`,bursts:n,windowSize:80,height:360,className:`border-0 rounded-none`})})]}),"system-pulse":()=>(0,D.jsx)(Pl,{cpuPct:s?.cpu_pct??0,cpuSeries:v,cpuLimit:c?.config.cpuLimitPct,memMb:s?.memory_rss_mb??0,memSeries:y,memLimit:c?.config.memoryLimitMb,heapUsedMb:s?.heap_used_mb??0,heapTotalMb:s?.heap_total_mb??0,heapSeries:b,uptimeSec:(s?.uptime_ms??0)/1e3}),"pending-approvals":()=>(0,D.jsxs)(Y,{className:`h-full`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`overline`,children:`pending approvals`}),(0,D.jsx)(q,{variant:l&&l.length>0?`amber`:`gray`,children:l?.length??0})]}),(0,D.jsx)(Z,{children:l&&l.length>0?(0,D.jsx)(`ul`,{className:`space-y-2`,children:l.slice(0,5).map(e=>(0,D.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,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsxs)(`div`,{className:`text-[var(--color-fg-1)] truncate`,children:[e.toolCall.tool,` · `,e.ruleId]}),(0,D.jsx)(`div`,{className:`text-[var(--color-fg-3)] text-[11px] truncate`,children:Wr(e.toolCall.tool,JSON.stringify(e.toolCall.input??{}))})]}),(0,D.jsxs)(`div`,{className:`flex gap-1 shrink-0`,children:[(0,D.jsx)(J,{size:`sm`,variant:`primary`,onClick:()=>Ql(e.id,`allow`).then(u),children:`allow`}),(0,D.jsx)(J,{size:`sm`,variant:`ghost`,onClick:()=>Ql(e.id,`block`).then(u),children:`block`})]})]},e.id))}):(0,D.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] py-3 text-center`,children:`— no pending approvals —`})})]}),"recent-blocks":()=>(0,D.jsxs)(Y,{className:`h-full`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`overline`,children:`recent blocks & forces`}),(0,D.jsx)(q,{variant:d&&d.length>0?`red`:`gray`,children:d?.length??0})]}),(0,D.jsx)(Z,{children:d&&d.length>0?(0,D.jsx)(`ul`,{className:`space-y-1.5`,children:d.slice(0,6).map((e,t)=>(0,D.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,D.jsx)(q,{variant:e.decision===`force`?`amber`:`red`,children:e.decision}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate flex-1`,children:Wr(e.tool,e.input)}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate text-[11px] max-w-[120px]`,children:e.rule_id??`—`})]},`${e.timestamp}-${t}`))}):(0,D.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] py-3 text-center`,children:`— no recent blocks —`})})]})}),[h,t,n,x,g,s,v,y,b,c,l,d,u]),C=Gl({from:`first`,translateY:22,durationMs:640,staggerMs:80,maxStaggerMs:520});return(0,D.jsxs)(`div`,{ref:p?void 0:C,className:`space-y-5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`flex-1`,"data-tutorial":`cb-layout`,children:(0,D.jsx)(Qs,{manager:f,isEditing:p,onToggleEditing:m})}),(0,D.jsx)(`button`,{type:`button`,onClick:r.toggle,className:`chip cursor-pointer hover:border-sky-500/50 hover:text-sky-300 transition-colors shrink-0`,title:r.enabled?`Mute stream sounds`:`Enable stream sounds`,children:r.enabled?`SFX ON`:`SFX OFF`})]}),(0,D.jsx)(Hc,{}),(0,D.jsx)(`div`,{"data-tutorial":`cb-grid`,children:(0,D.jsx)(Zs,{panels:f.activeLayout.panels,isEditing:p,renderers:S,onPanelsChange:f.updateActivePanels})})]})}var su={centre:`#FF9500`,"cf-worker":`#5AC8FA`,bun:`#FFCC00`,elixir:`#AF52DE`,native:`#FF3B30`,unknown:`#8E8E93`},cu={centre:`monorepo`,"cf-worker":`CF Worker`,bun:`Bun / TS`,elixir:`Elixir`,native:`Native`,unknown:`Other`};function lu(e){let t=(0,_.useRef)(null),n=(0,_.useRef)(null),r=(0,_.useRef)([]),i=(0,_.useRef)(null),a=(0,_.useRef)(null),o=(0,_.useRef)(0),s=(0,_.useRef)(null),c=(0,_.useRef)({w:0,h:0}),l=(0,_.useRef)(!1),u=(0,_.useRef)(null),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)({centre:0,"cf-worker":0,bun:0,elixir:0,native:0,unknown:0});return(0,_.useEffect)(()=>{let e=!1;return m(!1),f(null),fetch(`/api/json/monorepo/graph`).then(async e=>{let t=e.headers.get(`content-type`)??``;if(!e.ok)throw Error(`HTTP ${e.status}`);if(!t.includes(`application/json`))throw Error(`expected JSON, got ${t||`unknown`}`);return e.json()}).then(t=>{if(e)return;let i=n.current?.clientWidth??800,a=n.current?.clientHeight??420,s=i/2,c=a/2,l=Math.min(i,a)*.36,u=t.projects,d=[{id:t.centre.id,label:t.centre.label,type:`centre`,description:`Monorepo root — every sigmashake-* project lives here`,isCentre:!0,x:s,y:c,vx:0,vy:0,radius:0,phase:0},...u.map((e,t)=>{let n=t/Math.max(1,u.length)*Math.PI*2;return{id:e.id,label:e.label.replace(/^sigmashake-/,``),type:e.type,description:e.description||`${cu[e.type]} project`,isCentre:!1,x:s+Math.cos(n)*l,y:c+Math.sin(n)*l,vx:0,vy:0,radius:l,phase:n}})];r.current=d,o.current=0,g(d.reduce((e,t)=>(e[t.type]=(e[t.type]??0)+1,e),{centre:0,"cf-worker":0,bun:0,elixir:0,native:0,unknown:0})),m(!0)}).catch(t=>{e||f(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[]),(0,_.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>{l.current=e.matches};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,_.useEffect)(()=>{let e=t.current,s=n.current;if(!e||!s)return;let u=e.getContext(`2d`,{alpha:!0});if(!u)return;let d=new ResizeObserver(t=>{for(let n of t){let t=n.contentRect,i=window.devicePixelRatio||1;c.current.w=t.width,c.current.h=t.height,e.width=Math.max(1,Math.floor(t.width*i)),e.height=Math.max(1,Math.floor(t.height*i)),e.style.width=`${t.width}px`,e.style.height=`${t.height}px`,u.setTransform(i,0,0,i,0,0);let a=r.current;if(a.length>0){let e=t.width/2,n=t.height/2,r=Math.min(t.width,t.height)*.36;for(let t of a){if(t.isCentre){t.x=e,t.y=n;continue}t.radius=r}}}});d.observe(s);let f=0,p=performance.now(),m=[],h=(e,t)=>{let n=new Map;e.forEach((e,t)=>n.set(e.id,t));let r=[];for(let e of t){let t=n.get(e.from),i=n.get(e.to);t===void 0||i===void 0||r.push([t,i])}return r},g=e=>{let t=Math.min(.05,(e-p)/1e3);p=e;let n=r.current,{w:s,h:d}=c.current,h=s/2,_=d/2,v=i.current,y=l.current||v?0:.06;o.current+=y*t;let b=5.5,x=.86;for(let e=0;e<n.length;e++){let r=n[e];if(r.isCentre||r.id===v)continue;let i=0,a=0;for(let t=0;t<n.length;t++){if(e===t)continue;let o=n[t];if(o.isCentre)continue;let s=r.x-o.x,c=r.y-o.y,l=s*s+c*c+.01,u=Math.sqrt(l),d=1700/l;i+=s/u*d,a+=c/u*d}let s=r.phase+o.current,c=h+Math.cos(s)*r.radius,l=_+Math.sin(s)*r.radius;i+=(c-r.x)*b,a+=(l-r.y)*b;let u=r.x-h,d=r.y-_,f=Math.sqrt(u*u+d*d)||1,p=r.radius-f;i+=u/f*p*.6,a+=d/f*p*.6,r.vx=(r.vx+i*t)*x,r.vy=(r.vy+a*t)*x,r.x+=r.vx*t,r.y+=r.vy*t}u.clearRect(0,0,s,d);let S=u.createRadialGradient(h,_,0,h,_,Math.max(s,d)/1.4);S.addColorStop(0,`rgba(255, 149, 0, 0.06)`),S.addColorStop(1,`rgba(255, 149, 0, 0)`),u.fillStyle=S,u.fillRect(0,0,s,d),u.lineCap=`round`;for(let e=1;e<n.length;e++){let t=n[0],r=n[e];uu(u,t,r,.1)}for(let[e,t]of m){let r=n[e],i=n[t];!r||!i||uu(u,r,i,.24,`#5AC8FA`)}let C=a.current;for(let e of n){let t=su[e.type],n=C===e.id,r=v===e.id,i=e.isCentre?22:11,a=n||r?i+4:i;if(n||r||e.isCentre){let n=e.isCentre?a+14:a+8,r=u.createRadialGradient(e.x,e.y,a,e.x,e.y,n);r.addColorStop(0,t),r.addColorStop(1,`rgba(0,0,0,0)`),u.globalAlpha=e.isCentre?.22:.32,u.fillStyle=r,u.beginPath(),u.arc(e.x,e.y,n,0,Math.PI*2),u.fill(),u.globalAlpha=1}if(u.fillStyle=t,u.beginPath(),u.arc(e.x,e.y,a,0,Math.PI*2),u.fill(),u.lineWidth=e.isCentre?2:1.25,u.strokeStyle=`rgba(0,0,0,0.18)`,u.stroke(),u.font=e.isCentre?`600 12px ui-sans-serif, system-ui`:`500 10.5px ui-sans-serif, system-ui`,u.fillStyle=`rgba(60,60,67,0.85)`,u.textBaseline=`middle`,u.textAlign=`center`,e.isCentre)u.fillText(e.label,e.x,e.y+a+14);else{let t=e.x-h,n=e.y-_,r=Math.sqrt(t*t+n*n)||1,i=e.x+t/r*(a+12),o=e.y+n/r*(a+12);u.textAlign=t>=0?`left`:`right`,u.textBaseline=n>=0?`top`:`bottom`,u.fillText(e.label,i,o)}}u.textAlign=`start`,u.textBaseline=`alphabetic`,f=requestAnimationFrame(g)};f=requestAnimationFrame(g);let _=-1,v=``,y=setInterval(()=>{let e=r.current,t=window.__SSG_MONOREPO_EDGES__??``;e.length===_&&t===v||(_=e.length,v=t,m=h(e,t?JSON.parse(t):[]))},250);return()=>{cancelAnimationFrame(f),clearInterval(y),d.disconnect()}},[]),(0,_.useEffect)(()=>{let e=t.current;if(!e)return;let n=t=>{let n=e.getBoundingClientRect();return{x:t.clientX-n.left,y:t.clientY-n.top}},o=(e,t)=>{let n=r.current;for(let r=n.length-1;r>=0;r--){let i=n[r],a=i.x-e,o=i.y-t,s=i.isCentre?26:14;if(a*a+o*o<=s*s)return i}return null},c=t=>{let{x:s,y:c}=n(t),l=i.current;if(l){let e=r.current.find(e=>e.id===l);if(e&&!e.isCentre){let t=e.x,n=e.y;e.x=s,e.y=c,e.vx=(s-t)*12,e.vy=(c-n)*12}return}let d=o(s,c);a.current=d?.id??null,e.style.cursor=d&&!d.isCentre?`grab`:`default`,d&&u.current?(u.current.style.display=`block`,u.current.style.left=`${s+14}px`,u.current.style.top=`${c+14}px`,u.current.innerHTML=`<strong>${du(d.id)}</strong><span class="mg-tooltip__kind">${cu[d.type]}</span>`+(d.description?`<p>${du(d.description)}</p>`:``)):u.current&&(u.current.style.display=`none`)},l=t=>{let{x:r,y:a}=n(t),c=o(r,a);c&&!c.isCentre&&(i.current=c.id,e.setPointerCapture(t.pointerId),e.style.cursor=`grabbing`,s.current={x:r,y:a,downX:r,downY:a,downAt:performance.now()})},d=t=>{if(i.current)try{e.releasePointerCapture(t.pointerId)}catch{}i.current=null,e.style.cursor=`default`},f=()=>{a.current=null,u.current&&(u.current.style.display=`none`)};return e.addEventListener(`pointermove`,c),e.addEventListener(`pointerdown`,l),e.addEventListener(`pointerup`,d),e.addEventListener(`pointercancel`,d),e.addEventListener(`pointerleave`,f),()=>{e.removeEventListener(`pointermove`,c),e.removeEventListener(`pointerdown`,l),e.removeEventListener(`pointerup`,d),e.removeEventListener(`pointercancel`,d),e.removeEventListener(`pointerleave`,f)}},[]),(0,_.useEffect)(()=>{p&&fetch(`/api/json/monorepo/graph`).then(e=>e.json()).then(e=>{window.__SSG_MONOREPO_EDGES__=JSON.stringify(e.serviceEdges??[])}).catch(()=>{window.__SSG_MONOREPO_EDGES__=`[]`})},[p]),(0,D.jsxs)(`div`,{className:`mg`,ref:n,children:[(0,D.jsx)(`canvas`,{ref:t,className:`mg__canvas`,"aria-label":`Monorepo dependency graph`}),(0,D.jsxs)(`div`,{className:`mg__overlay`,children:[(0,D.jsxs)(`div`,{className:`mg__title`,children:[(0,D.jsx)(`strong`,{children:`monorepo map`}),(0,D.jsx)(`span`,{className:`mg__hint`,children:`drag to pluck a project • hover for details`})]}),d&&(0,D.jsx)(`div`,{className:`mg__error`,children:d}),(0,D.jsx)(`ul`,{className:`mg__legend`,children:[`cf-worker`,`bun`,`elixir`,`native`,`unknown`].map(e=>h[e]>0?(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`mg__swatch`,style:{background:su[e]}}),(0,D.jsx)(`span`,{children:cu[e]}),(0,D.jsx)(`span`,{className:`mg__count`,children:h[e]})]},e):null)})]}),(0,D.jsx)(`div`,{ref:u,className:`mg-tooltip`})]})}function uu(e,t,n,r,i=`#FF9500`){let a=n.x-t.x,o=n.y-t.y,s=(t.x+n.x)/2-o*.05,c=(t.y+n.y)/2+a*.05;e.globalAlpha=r,e.strokeStyle=i,e.lineWidth=1.25,e.beginPath(),e.moveTo(t.x,t.y),e.quadraticCurveTo(s,c,n.x,n.y),e.stroke(),e.globalAlpha=1}function du(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function fu(e,t){let n=Array(t).fill(0);if(e.length===0)return n;let r=Date.now()-t*1e3;for(let i=e.length-1;i>=0;i--){let a=e[i];if(!a)continue;if(a.ts_ms<r)break;let o=Math.floor((a.ts_ms-r)/1e3);o>=0&&o<t&&n[o]++}return n}function pu({bins:e=60,height:t=38,className:n}){let r=qa(),i=(0,_.useRef)(null),a=(0,_.useRef)([]),o=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=i.current;if(!t)return;let n=t.getContext(`2d`);if(!n)return;let s=Math.min(window.devicePixelRatio??1,2),c=Si(),l=()=>{let i=fu(r,e);if(a.current.length!==e)a.current=i.slice();else if(c)a.current=i;else for(let t=0;t<e;t++){let e=a.current[t]??0,n=i[t]??0;a.current[t]=e+(n-e)*.18}let u=t.clientWidth,d=t.clientHeight;(t.width!==u*s||t.height!==d*s)&&(t.width=u*s,t.height=d*s,n.scale(s,s)),n.clearRect(0,0,u,d);let f=Math.max(1,...a.current),p=u/e;for(let t=0;t<e;t++){let e=a.current[t]??0,r=e/f*d,i=t*p,o=e/f;n.fillStyle=`rgba(${Math.round(56+o*199)},${Math.round(189-o*100)},${Math.round(248-o*200)},${.4+o*.55})`,n.fillRect(i+.5,d-r,Math.max(1,p-1),r)}n.strokeStyle=`rgba(148, 163, 184, 0.1)`,n.lineWidth=1,n.beginPath(),n.moveTo(0,d-.5),n.lineTo(u,d-.5),n.stroke(),o.current=requestAnimationFrame(l)};return o.current=requestAnimationFrame(l),()=>{o.current!==null&&cancelAnimationFrame(o.current),o.current=null}},[r,e]),(0,D.jsxs)(`div`,{className:K(`relative w-full`,n),style:{height:t},children:[(0,D.jsx)(`canvas`,{ref:i,className:`block w-full h-full`,style:{width:`100%`,height:`100%`}}),(0,D.jsxs)(`span`,{className:`absolute top-1 left-2 text-[9px] font-mono uppercase tracking-widest text-[var(--color-fg-4)] pointer-events-none`,children:[`bursts/sec · `,e,`s window`]})]})}var mu=8,hu=6,gu=Math.PI*.75,_u=Math.PI*2.25;function vu({size:e=110,className:t}){let n=qa(),r=(0,_.useRef)(null),i=(0,_.useRef)(0),a=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=r.current;if(!t)return;let o=t.getContext(`2d`);if(!o)return;let s=Math.min(window.devicePixelRatio??1,2),c=Si(),l=()=>{let r=Date.now()-1500,u=0;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){if(t.ts_ms<r)break;u++}}let d=u/1.5,f=Math.min(1,d/mu);c?i.current=f:i.current+=(f-i.current)*.16;let p=e,m=e;(t.width!==p*s||t.height!==m*s)&&(t.width=p*s,t.height=m*s,t.style.width=`${p}px`,t.style.height=`${m}px`,o.scale(s,s)),o.clearRect(0,0,p,m);let h=p/2,g=m/2+4,_=p/2-8;o.lineWidth=6,o.lineCap=`round`,o.strokeStyle=`rgba(148, 163, 184, 0.18)`,o.beginPath(),o.arc(h,g,_,gu,_u),o.stroke();let v=gu+hu/mu*(_u-gu);o.strokeStyle=`rgba(239, 68, 68, 0.45)`,o.beginPath(),o.arc(h,g,_,v,_u),o.stroke();let y=gu+i.current*(_u-gu),b=i.current*mu>=hu;o.strokeStyle=b?`rgba(239, 68, 68, 0.95)`:`rgba(56, 189, 248, 0.92)`,o.lineWidth=6,o.beginPath(),o.arc(h,g,_,gu,y),o.stroke();let x=h+Math.cos(y)*(_-2),S=g+Math.sin(y)*(_-2);o.strokeStyle=b?`#fca5a5`:`#e0e7ff`,o.lineWidth=2,o.beginPath(),o.moveTo(h,g),o.lineTo(x,S),o.stroke(),o.fillStyle=b?`#fca5a5`:`#e0e7ff`,o.beginPath(),o.arc(h,g,3,0,Math.PI*2),o.fill(),o.fillStyle=b?`#fca5a5`:`#e0e7ff`,o.font=`bold 20px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,o.textAlign=`center`,o.fillText(d.toFixed(1),h,g+_*.55),o.fillStyle=`rgba(148, 163, 184, 0.85)`,o.font=`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,o.fillText(`eps`,h,g+_*.55+12),a.current=requestAnimationFrame(l)};return a.current=requestAnimationFrame(l),()=>{a.current!==null&&cancelAnimationFrame(a.current),a.current=null}},[n,e]),(0,D.jsx)(`canvas`,{ref:r,className:K(`block`,t),style:{width:e,height:e}})}var yu={allow:`#22c55e`,block:`#ef4444`,force:`#a855f7`,ask:`#f59e0b`,log:`#60a5fa`,shadow:`#6b7280`},bu=[`allow`,`block`,`force`,`ask`,`log`];function xu({windowSec:e=30,height:t=14,className:n}){let r=qa(),[i,a]=(0,_.useState)({}),o=(0,_.useRef)(null);(0,_.useEffect)(()=>{let t=Si(),n=()=>{let i=Date.now()-e*1e3,s={},c=0;for(let e=r.length-1;e>=0;e--){let t=r[e];if(t){if(t.ts_ms<i)break;s[t.decision]=(s[t.decision]??0)+1,c++}}let l={};for(let e of bu)l[e]=c===0?0:(s[e]??0)/c;if(t){a(l);return}a(e=>{let t={};for(let n of bu){let r=e[n]??0;t[n]=r+((l[n]??0)-r)*.22}return t}),o.current=requestAnimationFrame(n)};return o.current=requestAnimationFrame(n),()=>{o.current!==null&&cancelAnimationFrame(o.current),o.current=null}},[r,e]);let s=bu.map(e=>({key:e,color:yu[e]??`#6b7280`,pct:Math.max(0,i[e]??0)})),c=s.reduce((e,t)=>e+t.pct,0)===0;return(0,D.jsxs)(`div`,{className:K(`w-full`,n),children:[(0,D.jsx)(`div`,{className:`flex w-full overflow-hidden rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,style:{height:t},title:`decision mix · last ${e}s`,children:c?(0,D.jsx)(`div`,{className:`w-full h-full flex items-center justify-center text-[9px] font-mono uppercase tracking-widest text-[var(--color-fg-4)]`,children:`— idle —`}):s.map(e=>(0,D.jsx)(`div`,{style:{width:`${e.pct*100}%`,background:e.color,transition:`width 240ms ease-out`},title:`${e.key} · ${(e.pct*100).toFixed(1)}%`},e.key))}),(0,D.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-0.5 text-[9px] font-mono uppercase tracking-widest text-[var(--color-fg-4)]`,children:s.map(e=>(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,D.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:e.color}}),e.key,` · `,(e.pct*100).toFixed(0),`%`]},e.key))})]})}var Su={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)]`},Cu={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)]`},wu=[{label:`User code`,color:`#451a03`},{label:`Runtime (bun:/node:)`,color:`#172554`},{label:`Native/other`,color:`#1f2937`},{label:`GC/idle`,color:`#450a0a`}],Tu={neutral:`#d0d0d0`,green:`#34d399`,red:`#f87171`,amber:`#fbbf24`,blue:`#38bdf8`,purple:`#a78bfa`,gray:`#6e7076`};function Eu({label:e,value:t,sub:n,tone:r=`neutral`,align:i=`left`,labelPlacement:a=`above`,labelClassName:o,valueClassName:s,subClassName:c,trend:l,trendColor:u}){let d=(0,D.jsx)(`div`,{className:K(a===`above`?`overline mb-1.5`:`mt-1 text-[11px] text-[var(--color-fg-3)]`,o),children:e}),f=(0,D.jsx)(`div`,{className:K(`font-mono font-medium tabular-nums`,i===`center`&&`text-center`,Su[r],s),children:t}),p=l&&l.length>1,m=u??Tu[r];return(0,D.jsxs)(D.Fragment,{children:[a===`above`&&d,p?(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[f,(0,D.jsx)(Jc,{data:l,width:48,height:18,color:m})]}):f,a===`below`&&d,n&&(0,D.jsx)(`div`,{className:K(`mt-1 text-[10px] font-mono text-[var(--color-fg-3)]`,i===`center`&&`text-center`,c),children:n})]})}function Du({className:e,contentClassName:t,label:n,value:r,sub:i,tone:a,align:o,labelPlacement:s,labelClassName:c,valueClassName:l,subClassName:u,trend:d,trendColor:f,...p}){return(0,D.jsx)(Y,{className:e,...p,children:(0,D.jsx)(Z,{className:K(`py-3`,o===`center`&&`text-center`,t),children:(0,D.jsx)(Eu,{label:n,value:r,sub:i,tone:a,align:o,labelPlacement:s,labelClassName:c,valueClassName:l,subClassName:u,trend:d,trendColor:f})})})}function Ou({className:e,...t}){return(0,D.jsx)(`div`,{className:K(`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)] p-3`,t.align===`center`&&`text-center`,e),children:(0,D.jsx)(Eu,{...t})})}function ku({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,D.jsxs)(`div`,{className:K(`relative w-full overflow-hidden rounded-sm bg-[var(--color-surface-3)]`,r),children:[(0,D.jsx)(`div`,{className:K(`h-full rounded-sm transition-all duration-500`,Cu[t],i),style:{width:`${o}%`}}),s!==null&&(0,D.jsx)(`div`,{className:`absolute top-0 h-full w-0.5 bg-[var(--color-brand)]/70`,style:{left:`${s}%`},title:a})]})}function Au({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,D.jsxs)(Y,{className:u,children:[(0,D.jsxs)(X,{className:`py-2`,children:[(0,D.jsx)(`span`,{className:`overline`,children:e}),r&&(0,D.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300`,children:i})]}),(0,D.jsxs)(Z,{children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,D.jsx)(`div`,{className:K(`text-2xl font-mono font-medium tabular-nums`,Su[n],d),children:t}),(a?.length??0)>1&&o&&(0,D.jsx)(Jc,{data:a??[],width:80,height:28,color:o,threshold:s,maxValue:c})]}),l]})]})}function ju({profile:e,children:t}){return(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] font-mono text-[var(--color-fg-3)]`,children:[(0,D.jsxs)(`span`,{children:[`nodes:`,` `,(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.nodes.length})]}),(0,D.jsxs)(`span`,{children:[`duration:`,` `,(0,D.jsxs)(`span`,{className:`text-[var(--color-fg-1)]`,children:[((e.endTime-e.startTime)/1e3).toFixed(0),`ms`]})]}),(0,D.jsxs)(`span`,{children:[`samples:`,` `,(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.samples?.length??0})]})]}),(0,D.jsx)(`div`,{className:`flex gap-3 text-[10px] font-mono text-[var(--color-fg-3)]`,children:wu.map(e=>(0,D.jsxs)(`span`,{className:`flex items-center`,children:[(0,D.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 Mu({memory:e,formatValue:t}){return(0,D.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,D.jsx)(Ou,{align:`center`,label:e.label,value:e.value,valueClassName:`text-lg font-medium text-[var(--color-fg-0)]`},e.label))})}var Nu=3;function Pu(e){return e===null?`—`:e<1e6?`${(e/1e3).toFixed(0)}µs`:`${(e/1e6).toFixed(1)}ms`}var Fu=[`counters-updated`,`activity-updated`,`pending-changed`,`runtime-tick`,`limits-breach`];function Iu({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,D.jsxs)(Y,{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,D.jsxs)(X,{children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`text-xs font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`license`}),(0,D.jsx)(q,{variant:t?`green`:n?`amber`:`blue`,children:e.tier_label}),e.fleet_enrolled&&(0,D.jsx)(q,{variant:`gray`,children:`fleet`})]}),e.email&&(0,D.jsx)(`span`,{className:`text-xs text-[var(--color-fg-3)]`,children:e.email})]}),(0,D.jsxs)(Z,{className:`space-y-3`,children:[n&&e.detail&&(0,D.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,D.jsx)(`code`,{className:`font-mono`,children:`ssg auth login`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex justify-between text-xs text-[var(--color-fg-2)]`,children:[(0,D.jsx)(`span`,{children:`evals today`}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(Kc,{value:e.evals_today,curve:`spring`}),e.eval_daily_limit!==null&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:` / `}),e.eval_daily_limit.toLocaleString()]}),e.eval_daily_limit===null&&(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:` · unlimited`})]})]}),e.eval_daily_limit!==null&&(0,D.jsx)(`div`,{className:`mt-1 h-1.5 w-full overflow-hidden rounded-full bg-[var(--color-bg-2)]`,children:(0,D.jsx)(`div`,{className:`h-full transition-all duration-700 ease-out ${i}`,style:{width:`${r}%`}})})]}),!t&&(0,D.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,D.jsxs)(`div`,{className:`text-[10px] text-[var(--color-fg-3)] font-mono uppercase tracking-wider`,children:[`cloud retention: `,e.retention_days,` days`]})]})]})}function Lu(e){return new Date(e*1e3).toLocaleTimeString()}function Ru(e,t=24){let n=(0,_.useRef)(null),[r,i]=(0,_.useState)([]);return(0,_.useEffect)(()=>{let r=n.current;if(n.current=e,r===null)return;let a=Math.max(0,e-r);i(e=>{let n=e.length>=t?e.slice(-(t-1)):e.slice();return n.push(a),n})},[e,t]),r}async function zu(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:H()})}async function Bu(e,t){let n=await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...H()},body:JSON.stringify({ruleId:e,file:t})});if(!n.ok)throw Error(`Toggle failed: ${n.status}`)}async function Vu(e,t){let n=await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...H()},body:JSON.stringify({ruleId:e,file:t})});if(!n.ok)throw Error(`Toggle failed: ${n.status}`)}async function Hu(e,t){let n=await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...H()},body:JSON.stringify({ruleId:e,file:t,decision:`ask`})});if(!n.ok)throw Error(`Update decision failed: ${n.status}`)}async function Uu(e,t){let n=await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...H()},body:JSON.stringify({ruleId:e,file:t,decision:`block`})});if(!n.ok)throw Error(`Update decision failed: ${n.status}`)}function Wu({ruleId:e}){return e?(0,D.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,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`—`})}function Gu({title:e,right:t}){return(0,D.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,D.jsx)(`h2`,{className:`overline text-[11px]`,children:e}),t]})}function Ku({children:e}){return(0,D.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 qu({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=Wr(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,D.jsx)(Y,{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,D.jsxs)(`div`,{className:`px-3 py-3`,children:[v&&(0,D.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,D.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,D.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,D.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,D.jsx)(`span`,{children:`failed to update rule — check server logs`}),(0,D.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,D.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5 flex-wrap`,children:[(0,D.jsx)(q,{variant:v?o===`done-ask`?`blue`:`gray`:p,children:v?o===`done-ask`?`ask`:`disabled`:f}),(0,D.jsx)(`code`,{className:`text-[var(--color-brand)] text-xs font-mono`,children:e.tool}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-xs`,children:`·`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] text-[11px] font-mono tabular-nums`,children:Lu(e.timestamp)}),e.repeat_count>1&&(0,D.jsxs)(q,{variant:`gray`,children:[`×`,e.repeat_count]})]}),(0,D.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,D.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pt-0.5`,children:[(0,D.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,D.jsx)(`span`,{className:`animate-spin`,children:`⟳`}):(0,D.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,D.jsx)(`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}),(0,D.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),`ask instead`]}),(0,D.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,D.jsx)(`span`,{className:`animate-spin`,children:`⟳`}):(0,D.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,D.jsx)(`line`,{x1:`15`,y1:`9`,x2:`9`,y2:`15`}),(0,D.jsx)(`line`,{x1:`9`,y1:`9`,x2:`15`,y2:`15`})]}),`disable rule`]})]})]}),(0,D.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,D.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`rule`}),(0,D.jsx)(Wu,{ruleId:e.rule_id})]}),e.source_file&&(0,D.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`src`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:e.source_file})]}),e.rules_evaluated!==null&&(0,D.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`evals`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums`,children:e.rules_evaluated})]}),(0,D.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`latency`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums`,children:Pu(e.duration_ns)})]}),(0,D.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,D.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,D.jsx)(`div`,{className:`overline mb-2`,children:`full input`}),(0,D.jsx)(Wi,{children:(()=>{try{return JSON.stringify(JSON.parse(e.input),null,2)}catch{return e.input}})()})]})]})})}function Ju(){let e=Bt(Fu),t=[e[`counters-updated`],e[`activity-updated`],e[`pending-changed`]],{data:n}=V(`/api/state/counters`,t),{data:r,refetch:i}=V(`/api/json/pending`,t),{data:a,refetch:o}=V(`/api/json/blocked`,t),{data:s}=V(`/api/state/activity`,t),{data:c}=V(`/api/state/runtime`,[e[`runtime-tick`]]),{data:l}=V(`/api/json/limits`,[e[`limits-breach`]]),{data:u}=V(`/api/json/license`,[e[`activity-updated`]]),[d,f]=(0,_.useState)(!1),p=a?.reduce((e,t)=>e+t.repeat_count,0)??0,m=n?.allow??0,h=(n?.block??0)+(n?.force??0),g=n?.force??0,v=n?.pending??0,y=n?.log??0,b=Ru(m),x=Ru(h),S=Ru(g),C=Ru(v),w=Ru(y),T=[{label:`allow`,value:m,tone:`green`,trend:b},{label:`block`,value:h,tone:`red`,trend:x},{label:`force`,value:g,tone:`amber`,trend:S},{label:`pending`,value:v,tone:`blue`,trend:C},{label:`log`,value:y,tone:`gray`,trend:w}];return(0,D.jsxs)(`div`,{ref:Gl({from:`first`}),className:`space-y-8`,children:[(0,D.jsx)(Hc,{}),(0,D.jsx)(`div`,{"data-reveal":!0,children:(0,D.jsx)(lu,{})}),(0,D.jsx)(`div`,{"data-tutorial":`dash-stats`,className:`grid grid-cols-2 sm:grid-cols-5 gap-2`,children:T.map(e=>(0,D.jsx)(Du,{align:`left`,label:e.label,value:(0,D.jsx)(Kc,{value:e.value,curve:`spring`}),tone:e.tone,labelPlacement:`above`,contentClassName:`py-3`,valueClassName:`text-2xl font-medium`,trend:e.trend,"data-reveal":!0},e.label))}),(0,D.jsxs)(`div`,{"data-reveal":!0,"data-tutorial":`dash-meters`,className:`grid grid-cols-12 gap-2 items-stretch`,children:[(0,D.jsxs)(`div`,{className:`col-span-12 md:col-span-7 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2 flex flex-col gap-2`,children:[(0,D.jsx)(pu,{bins:60,height:42}),(0,D.jsx)(xu,{windowSec:60,height:12})]}),(0,D.jsx)(`div`,{className:`col-span-12 md:col-span-5 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2 flex items-center justify-center`,children:(0,D.jsx)(vu,{size:130})})]}),u&&(0,D.jsx)(`div`,{"data-reveal":!0,children:(0,D.jsx)(Iu,{info:u})}),c&&(0,D.jsxs)(`div`,{"data-reveal":!0,className:`grid grid-cols-2 gap-2`,children:[(0,D.jsx)(Au,{label:`cpu`,value:c.cpu_pct==null?`—`:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Kc,{value:c.cpu_pct,format:e=>Math.round(e).toString()}),`%`]}),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,D.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,D.jsx)(Au,{label:`memory rss`,value:c.memory_rss_mb==null?`—`:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Kc,{value:c.memory_rss_mb,format:e=>Math.round(e).toString()}),(0,D.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,D.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,D.jsxs)(`section`,{"data-reveal":!0,"data-tutorial":`dash-approvals`,children:[(0,D.jsx)(Gu,{title:`pending approvals`}),!r||r.length===0?(0,D.jsx)(Ku,{children:`no pending approvals`}):(0,D.jsx)(`div`,{className:`space-y-2`,children:r.map(e=>(0,D.jsxs)(Y,{className:`border-l-2 border-l-sky-500/50`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(J,{size:`sm`,variant:`primary`,onClick:async()=>{await zu(e.id,`allow`),i()},children:`approve`}),(0,D.jsx)(J,{size:`sm`,variant:`danger`,onClick:async()=>{await zu(e.id,`block`),i()},children:`deny`})]})]}),(0,D.jsxs)(Z,{className:`space-y-2 text-xs`,children:[(0,D.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,D.jsx)(`span`,{className:`overline`,children:`tool`}),(0,D.jsx)(`code`,{className:`text-[var(--color-brand)] font-mono`,children:e.toolCall.tool})]}),e.prompt&&(0,D.jsxs)(`div`,{className:`flex gap-2 items-start`,children:[(0,D.jsx)(`span`,{className:`overline pt-0.5`,children:`prompt`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,children:e.prompt})]}),(0,D.jsx)(Wi,{children:JSON.stringify(e.toolCall.input,null,2)})]})]},e.id))})]}),a&&a.length>0&&(0,D.jsxs)(`section`,{"data-reveal":!0,children:[(0,D.jsx)(Gu,{title:`blocked actions`,right:(0,D.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:[a.length,` active`,p>a.length?` · ${p} total hits`:``]})}),(0,D.jsx)(`div`,{className:`space-y-2`,children:(d?a:a.slice(0,Nu)).map(e=>(0,D.jsx)(qu,{item:e,onDisable:async()=>{await Bu(e.rule_id,e.source_file),o()},onChangeToAsk:async()=>{await Hu(e.rule_id,e.source_file),o()},onUndo:async t=>{t===`disable`?await Vu(e.rule_id,e.source_file):await Uu(e.rule_id,e.source_file),o()}},`${e.decision}:${e.rule_id??`none`}:${e.tool}:${e.timestamp}:${e.input}`))}),a.length>Nu&&(0,D.jsx)(`div`,{className:`mt-3 flex justify-center`,children:(0,D.jsx)(J,{size:`sm`,variant:`secondary`,onClick:()=>f(e=>!e),children:d?`↑ show less`:`↓ show ${a.length-Nu} more`})})]}),(0,D.jsxs)(`section`,{"data-reveal":!0,"data-tutorial":`dash-audit`,children:[(0,D.jsx)(Gu,{title:`recent audit log`,right:s&&s.length>0?(0,D.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,D.jsx)(Ku,{children:`no audit entries yet`}):(0,D.jsx)(`div`,{className:`space-y-1.5`,children:s.slice(0,15).map(e=>(0,D.jsx)(Ra,{row:e},e.id))})]})]})}var Yu=[{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`}],Xu={rca:{title:`Root Cause Analysis`,body:`When an eval errors, an ssqa finding arrives, or a daemon-level error fires, SSG auto-composes a diagnosis with ranked hypotheses, evidence, and suggested next actions — the same pack Claude reads through MCP.`,useWhen:`Something just broke and you want the short version before grepping logs.`},timeline:{title:`Eval Timeline`,body:`Flame-chart of the last 1024 frames across every rule and tool call. Each row is one tool call (trace_id); each bar is one pipeline stage colored by kind; a red outline means that stage errored.`,useWhen:`You want to see which stages a rule went through and how long each took. Click a bar to inspect the frame.`},watch:{title:`Live URI Watch`,body:`Subscribe to any ssg:// resource and watch it update as the daemon emits events. Every CLI, MCP, and dashboard surface ultimately reads through these same URIs.`,useWhen:`You know exactly which internal resource (rules, audit rows, frames, RCA pack, native stats) you want to inspect.`},state:{title:`Daemon Snapshot`,body:`Live vitals for the SSG daemon process — uptime, rules loaded, native FFI availability, frame ring size, eval quotas, audit worker readiness.`,useWhen:`The daemon feels off (slow, dropping events, refusing calls) and you want to confirm it's healthy.`},metrics:{title:`Performance Counters`,body:`Latency distributions and event counters for the eval pipeline (per-stage timings, native call overhead, audit throughput).`,useWhen:`Evals feel slow and you want to find the hot stage before optimizing.`}};function Zu(){let[e,t]=(0,_.useState)(`rca`);return(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 min-h-[70vh]`,children:[(0,D.jsxs)(`header`,{className:`space-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`h1`,{className:`text-sm font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`ai-native debugger`}),(0,D.jsx)(`span`,{className:`chip text-sky-300 border-sky-500/30`,children:`ssg:// unified resolver`}),(0,D.jsx)(rd,{})]}),(0,D.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`one surface · cli · mcp · dashboard`})]}),(0,D.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-3)] max-w-3xl leading-snug`,children:`See exactly what happened inside SSG during recent rule evaluations — which stage ran, which rule matched, how long each step took, and what went wrong. The same data Claude reads via MCP.`})]}),(0,D.jsx)($u,{}),(0,D.jsx)(td,{}),(0,D.jsx)(`nav`,{"data-tutorial":`debug-tabs`,className:`flex items-center gap-1 border-b border-[var(--color-line-1)]`,children:Yu.map(n=>(0,D.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,D.jsx)(nd,{tab:e}),(0,D.jsxs)(`section`,{"data-tutorial":`debug-pane`,className:`flex-1 min-h-0`,children:[e===`rca`&&(0,D.jsx)(id,{}),e===`timeline`&&(0,D.jsx)(ld,{}),e===`watch`&&(0,D.jsx)(_d,{}),e===`state`&&(0,D.jsx)(vd,{uri:`ssg://daemon/state`}),e===`metrics`&&(0,D.jsx)(vd,{uri:`ssg://daemon/metrics`})]})]})}var Qu=`ssg.debug.intro.dismissed`;function $u(){let[e,t]=(0,_.useState)(()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(Qu)===`1`}catch{return!1}});return e?(0,D.jsx)(`div`,{className:`flex justify-end`,children:(0,D.jsx)(`button`,{type:`button`,onClick:()=>{t(!1);try{window.localStorage.removeItem(Qu)}catch{}},className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)]`,children:`what is this?`})}):(0,D.jsx)(`aside`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-4 space-y-3`,children:(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,D.jsxs)(`div`,{className:`space-y-3 min-w-0 flex-1`,children:[(0,D.jsx)(`p`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)]`,children:`who this page is for`}),(0,D.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:`SSG sits between your AI coding agent (Claude Code, Cursor, Copilot, …) and your filesystem/shell, deciding which tool calls to allow, block, or warn on. This page is the window into those decisions — useful any time SSG's behavior surprises you.`}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)] mb-1.5`,children:`what you'd use it for`}),(0,D.jsx)(`table`,{className:`text-[12px] text-[var(--color-fg-3)] w-full border-separate border-spacing-y-1`,children:(0,D.jsxs)(`tbody`,{children:[(0,D.jsx)(ed,{question:`Why did SSG block my agent from running this command?`,tab:`rca`,how:`open RCA — or find the trace in Timeline and read the deciding rule`}),(0,D.jsx)(ed,{question:`I just wrote a rule. Did it actually fire?`,tab:`timeline`,how:`trigger the tool call, find your trace, look for your rule_id in a match-stage bar`}),(0,D.jsx)(ed,{question:`Are my rules even loaded? Did a syntax error skip one?`,tab:`state`,how:`check the rules_loaded count — or open Watch and resolve ssg://rules/list`}),(0,D.jsx)(ed,{question:`My agent feels slow when SSG is on — is SSG the cause?`,tab:`metrics`,how:`look at per-stage latency; the hot stage tells you whether parse, match, native FFI, or audit is the culprit`}),(0,D.jsx)(ed,{question:`Something errored and I want a one-line diagnosis before reading logs`,tab:`rca`,how:`the latest RCA pack ranks hypotheses by confidence and suggests next actions`})]})})]}),(0,D.jsxs)(`p`,{className:`text-[11px] text-[var(--color-fg-4)] leading-relaxed`,children:[(0,D.jsx)(`span`,{className:`font-mono uppercase tracking-wider`,children:`heads up ·`}),` `,`The Timeline (every frame of every eval) is opt-in because it adds overhead. Restart the daemon with`,` `,(0,D.jsx)(`code`,{className:`text-amber-300 font-mono`,children:`SSG_DEBUG_ENABLED=1 ./ssg daemon`}),` `,`to turn it on. RCA, State, and Metrics work without it.`]})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>{t(!0);try{window.localStorage.setItem(Qu,`1`)}catch{}},className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)] shrink-0`,title:`Hide this panel`,children:`hide`})]})})}function ed({question:e,tab:t,how:n}){return(0,D.jsxs)(`tr`,{children:[(0,D.jsx)(`td`,{className:`align-top pr-3 text-[12px] text-[var(--color-fg-2)] w-[55%]`,children:e}),(0,D.jsx)(`td`,{className:`align-top pr-3 w-[80px]`,children:(0,D.jsx)(`span`,{className:`chip text-[10px] uppercase tracking-wider text-sky-300 border-sky-500/30`,children:t})}),(0,D.jsx)(`td`,{className:`align-top text-[11px] text-[var(--color-fg-4)] leading-snug`,children:n})]})}function td(){let{data:e}=V(`/api/json/debug?uri=ssg%3A%2F%2Fdaemon%2Fstate`,[]);return e?.data?.debug_enabled===!1?(0,D.jsxs)(`aside`,{className:`rounded-sm border border-amber-500/40 bg-amber-500/5 p-3 text-[12px] text-amber-200 space-y-1`,children:[(0,D.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-amber-300`,children:`timeline disabled · frame collection is off`}),(0,D.jsx)(`p`,{className:`text-[12px] leading-snug`,children:`The daemon is running but not capturing per-stage eval frames — so the Timeline tab will stay empty no matter how many tool calls fire. RCA, State, and Metrics still work.`}),(0,D.jsxs)(`p`,{className:`text-[12px] leading-snug`,children:[`To turn frame capture on, restart with`,` `,(0,D.jsx)(`code`,{className:`text-amber-100 font-mono bg-amber-900/30 px-1.5 py-0.5 rounded-sm`,children:`SSG_DEBUG_ENABLED=1 ./ssg daemon`}),`. It's opt-in because collecting every frame adds overhead on the hot path.`]})]}):null}function nd({tab:e}){let t=Xu[e];return(0,D.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2 space-y-1`,children:[(0,D.jsx)(`p`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)]`,children:t.title}),(0,D.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-snug`,children:t.body}),(0,D.jsxs)(`p`,{className:`text-[11px] text-[var(--color-fg-4)] leading-snug`,children:[(0,D.jsx)(`span`,{className:`font-mono uppercase tracking-wider`,children:`use when ·`}),` `,t.useWhen]})]})}function rd(){let e=Bt([`debug-frame`])[`debug-frame`]??0,{data:t}=V(`/api/json/debug?uri=ssg%3A%2F%2Fdaemon%2Fstate`,[e]),n=t?.data?.debug_enabled;return n===!1?(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-amber-300`,title:`Frame collection is OFF. Restart the daemon with SSG_DEBUG_ENABLED=1 to capture frames.`,children:[(0,D.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-sm bg-amber-400`}),`debug off`]}):n===void 0?(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-4)]`,children:[(0,D.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-sm bg-[var(--color-fg-4)]`}),`connecting…`]}):(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-emerald-300`,title:`Debug collection is on. ${e} debug-frame bursts received this session.`,children:[(0,D.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),`live · `,e]})}function id(){let e=Bt([`debug-frame`,`activity-updated`]),{data:t,loading:n,error:r,refetch:i}=V(`/api/json/debug?uri=ssg%3A%2F%2Frca%2Fcurrent`,[e[`debug-frame`],e[`activity-updated`]]),a=t?.data?.pack??null;return(0,D.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-[1fr_340px] gap-4`,children:[(0,D.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,D.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`loading RCA pack…`}),r&&(0,D.jsxs)(`p`,{className:`text-sm text-rose-300`,children:[`rca fetch error: `,r]}),!n&&!a&&(0,D.jsxs)(`div`,{className:`text-sm text-[var(--color-fg-3)] space-y-2`,children:[(0,D.jsx)(`p`,{className:`font-mono`,children:`no current RCA pack`}),(0,D.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,D.jsx)(od,{pack:a})]}),(0,D.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,D.jsx)(`p`,{className:`uppercase tracking-wider text-[var(--color-fg-2)]`,children:`how claude sees this`}),(0,D.jsxs)(`pre`,{className:`text-[10px] whitespace-pre-wrap leading-snug`,children:[`ssg debug rca --current --json`,`
11
+ `)})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>{s(null),t(!1)},className:`text-[11.5px] text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer`,children:`↺ Close`})]})]})}function gn(e,t){if(!e)return;let n=typeof e;if(n===`string`||n===`number`||n===`bigint`){t.push(String(e));return}if(Array.isArray(e)){for(let n of e)gn(n,t);return}if(n===`object`)for(let[n,r]of Object.entries(e))r&&t.push(n)}function _n(...e){let t=[];for(let n of e)gn(n,t);return t.join(` `)}function vn(e,t){return n=>{let r=[e],i=t?.variants;if(i){let e=i,a=t?.defaultVariants??{},o=n??{};for(let[t,n]of Object.entries(e)){let e=o[t]??a[t];typeof e==`string`&&r.push(n[e])}}return r.push(n?.class,n?.className),_n(...r)}}var yn=(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},bn=(e,t)=>({classGroupId:e,validator:t}),xn=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Sn=`-`,Cn=[],wn=`arbitrary..`,Tn=e=>{let t=On(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Dn(e);let n=e.split(Sn);return En(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?yn(i,t):t:i||Cn}return n[e]||Cn}}},En=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=En(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Sn):e.slice(t).join(Sn),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Dn=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?wn+r:void 0})(),On=e=>{let{theme:t,classGroups:n}=e;return kn(n,t)},kn=(e,t)=>{let n=xn();for(let r in e){let i=e[r];An(i,n,r,t)}return n},An=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];jn(i,t,n,r)}},jn=(e,t,n,r)=>{if(typeof e==`string`){Mn(e,t,n);return}if(typeof e==`function`){Nn(e,t,n,r);return}Pn(e,t,n,r)},Mn=(e,t,n)=>{let r=e===``?t:Fn(t,e);r.classGroupId=n},Nn=(e,t,n,r)=>{if(In(e)){An(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(bn(n,e))},Pn=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];An(o,Fn(t,a),n,r)}},Fn=(e,t)=>{let n=e,r=t.split(Sn),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=xn(),n.nextPart.set(t,i)),n=i}return n},In=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Ln=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=`!`,zn=`:`,Bn=[],Vn=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Hn=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===zn){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 Vn(t,l,c,u)};if(t){let e=t+zn,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Vn(Bn,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Un=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}},Wn=e=>({cache:Ln(e.cacheSize),parseClassName:Hn(e),sortModifiers:Un(e),...Tn(e)}),Gn=/\s+/,Kn=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Gn),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},qn=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Jn(n))&&(i&&(i+=` `),i+=r);return i},Jn=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Jn(e[r]))&&(n&&(n+=` `),n+=t);return n},Yn=(e,...t)=>{let n,r,i,a,o=o=>(n=Wn(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=Kn(e,n);return i(e,a),a};return a=o,(...e)=>a(qn(...e))},Xn=[],Zn=e=>{let t=t=>t[e]||Xn;return t.isThemeGetter=!0,t},Qn=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,$n=/^\((?:(\w[\w-]*):)?(.+)\)$/i,er=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,tr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,nr=/\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$/,rr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ir=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ar=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,or=e=>er.test(e),U=e=>!!e&&!Number.isNaN(Number(e)),sr=e=>!!e&&Number.isInteger(Number(e)),cr=e=>e.endsWith(`%`)&&U(e.slice(0,-1)),lr=e=>tr.test(e),ur=()=>!0,dr=e=>nr.test(e)&&!rr.test(e),fr=()=>!1,pr=e=>ir.test(e),mr=e=>ar.test(e),hr=e=>!W(e)&&!G(e),gr=e=>jr(e,Fr,fr),W=e=>Qn.test(e),_r=e=>jr(e,Ir,dr),vr=e=>jr(e,Lr,U),yr=e=>jr(e,zr,ur),br=e=>jr(e,Rr,fr),xr=e=>jr(e,Nr,fr),Sr=e=>jr(e,Pr,mr),Cr=e=>jr(e,Br,pr),G=e=>$n.test(e),wr=e=>Mr(e,Ir),Tr=e=>Mr(e,Rr),Er=e=>Mr(e,Nr),Dr=e=>Mr(e,Fr),Or=e=>Mr(e,Pr),kr=e=>Mr(e,Br,!0),Ar=e=>Mr(e,zr,!0),jr=(e,t,n)=>{let r=Qn.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Mr=(e,t,n=!1)=>{let r=$n.exec(e);return r?r[1]?t(r[1]):n:!1},Nr=e=>e===`position`||e===`percentage`,Pr=e=>e===`image`||e===`url`,Fr=e=>e===`length`||e===`size`||e===`bg-size`,Ir=e=>e===`length`,Lr=e=>e===`number`,Rr=e=>e===`family-name`,zr=e=>e===`number`||e===`weight`,Br=e=>e===`shadow`,Vr=Yn(()=>{let e=Zn(`color`),t=Zn(`font`),n=Zn(`text`),r=Zn(`font-weight`),i=Zn(`tracking`),a=Zn(`leading`),o=Zn(`breakpoint`),s=Zn(`container`),c=Zn(`spacing`),l=Zn(`radius`),u=Zn(`shadow`),d=Zn(`inset-shadow`),f=Zn(`text-shadow`),p=Zn(`drop-shadow`),m=Zn(`blur`),h=Zn(`perspective`),g=Zn(`aspect`),_=Zn(`ease`),v=Zn(`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(),G,W],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[G,W,c],T=()=>[or,`full`,`auto`,...w()],E=()=>[sr,`none`,`subgrid`,G,W],D=()=>[`auto`,{span:[`full`,sr,G,W]},sr,G,W],O=()=>[sr,`auto`,G,W],k=()=>[`auto`,`min`,`max`,`fr`,G,W],ee=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],A=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],j=()=>[`auto`,...w()],M=()=>[or,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],te=()=>[or,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ne=()=>[or,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],N=()=>[e,G,W],P=()=>[...b(),Er,xr,{position:[G,W]}],F=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],re=()=>[`auto`,`cover`,`contain`,Dr,gr,{size:[G,W]}],I=()=>[cr,wr,_r],L=()=>[``,`none`,`full`,l,G,W],R=()=>[``,U,wr,_r],z=()=>[`solid`,`dashed`,`dotted`,`double`],ie=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],B=()=>[U,cr,Er,xr],ae=()=>[``,`none`,m,G,W],oe=()=>[`none`,U,G,W],se=()=>[`none`,U,G,W],ce=()=>[U,G,W],le=()=>[or,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[lr],breakpoint:[lr],color:[ur],container:[lr],"drop-shadow":[lr],ease:[`in`,`out`,`in-out`],font:[hr],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[lr],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[lr],shadow:[lr],spacing:[`px`,U],text:[lr],"text-shadow":[lr],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,or,W,G,g]}],container:[`container`],columns:[{columns:[U,W,G,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:[sr,`auto`,G,W]}],basis:[{basis:[or,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[U,or,`auto`,`initial`,`none`,W]}],grow:[{grow:[``,U,G,W]}],shrink:[{shrink:[``,U,G,W]}],order:[{order:[sr,`first`,`last`,`none`,G,W]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ee(),`normal`]}],"justify-items":[{"justify-items":[...A(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...A()]}],"align-content":[{content:[`normal`,...ee()]}],"align-items":[{items:[...A(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...A(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...A(),`baseline`]}],"place-self":[{"place-self":[`auto`,...A()]}],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:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:M()}],"inline-size":[{inline:[`auto`,...te()]}],"min-inline-size":[{"min-inline":[`auto`,...te()]}],"max-inline-size":[{"max-inline":[`none`,...te()]}],"block-size":[{block:[`auto`,...ne()]}],"min-block-size":[{"min-block":[`auto`,...ne()]}],"max-block-size":[{"max-block":[`none`,...ne()]}],w:[{w:[s,`screen`,...M()]}],"min-w":[{"min-w":[s,`screen`,`none`,...M()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...M()]}],h:[{h:[`screen`,`lh`,...M()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...M()]}],"max-h":[{"max-h":[`screen`,`lh`,...M()]}],"font-size":[{text:[`base`,n,wr,_r]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Ar,yr]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,cr,W]}],"font-family":[{font:[Tr,br,t]}],"font-features":[{"font-features":[W]}],"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,G,W]}],"line-clamp":[{"line-clamp":[U,`none`,G,vr]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,G,W]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,G,W]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...z(),`wavy`]}],"text-decoration-thickness":[{decoration:[U,`from-font`,`auto`,G,_r]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[U,`auto`,G,W]}],"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`,G,W]}],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`,G,W]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:re()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},sr,G,W],radial:[``,G,W],conic:[sr,G,W]},Or,Sr]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:R()}],"border-w-x":[{"border-x":R()}],"border-w-y":[{"border-y":R()}],"border-w-s":[{"border-s":R()}],"border-w-e":[{"border-e":R()}],"border-w-bs":[{"border-bs":R()}],"border-w-be":[{"border-be":R()}],"border-w-t":[{"border-t":R()}],"border-w-r":[{"border-r":R()}],"border-w-b":[{"border-b":R()}],"border-w-l":[{"border-l":R()}],"divide-x":[{"divide-x":R()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":R()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...z(),`hidden`,`none`]}],"divide-style":[{divide:[...z(),`hidden`,`none`]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...z(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[U,G,W]}],"outline-w":[{outline:[``,U,wr,_r]}],"outline-color":[{outline:N()}],shadow:[{shadow:[``,`none`,u,kr,Cr]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":[`none`,d,kr,Cr]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:R()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[U,_r]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":[`none`,f,kr,Cr]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[U,G,W]}],"mix-blend":[{"mix-blend":[...ie(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ie()}],"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":[U]}],"mask-image-linear-from-pos":[{"mask-linear-from":B()}],"mask-image-linear-to-pos":[{"mask-linear-to":B()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":B()}],"mask-image-t-to-pos":[{"mask-t-to":B()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":B()}],"mask-image-r-to-pos":[{"mask-r-to":B()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":B()}],"mask-image-b-to-pos":[{"mask-b-to":B()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":B()}],"mask-image-l-to-pos":[{"mask-l-to":B()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":B()}],"mask-image-x-to-pos":[{"mask-x-to":B()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":B()}],"mask-image-y-to-pos":[{"mask-y-to":B()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[G,W]}],"mask-image-radial-from-pos":[{"mask-radial-from":B()}],"mask-image-radial-to-pos":[{"mask-radial-to":B()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"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":[U]}],"mask-image-conic-from-pos":[{"mask-conic-from":B()}],"mask-image-conic-to-pos":[{"mask-conic-to":B()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,G,W]}],filter:[{filter:[``,`none`,G,W]}],blur:[{blur:ae()}],brightness:[{brightness:[U,G,W]}],contrast:[{contrast:[U,G,W]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,kr,Cr]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:[``,U,G,W]}],"hue-rotate":[{"hue-rotate":[U,G,W]}],invert:[{invert:[``,U,G,W]}],saturate:[{saturate:[U,G,W]}],sepia:[{sepia:[``,U,G,W]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,G,W]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[U,G,W]}],"backdrop-contrast":[{"backdrop-contrast":[U,G,W]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,U,G,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[U,G,W]}],"backdrop-invert":[{"backdrop-invert":[``,U,G,W]}],"backdrop-opacity":[{"backdrop-opacity":[U,G,W]}],"backdrop-saturate":[{"backdrop-saturate":[U,G,W]}],"backdrop-sepia":[{"backdrop-sepia":[``,U,G,W]}],"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`,G,W]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[U,`initial`,G,W]}],ease:[{ease:[`linear`,`initial`,_,G,W]}],delay:[{delay:[U,G,W]}],animate:[{animate:[`none`,v,G,W]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,G,W]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:oe()}],"rotate-x":[{"rotate-x":oe()}],"rotate-y":[{"rotate-y":oe()}],"rotate-z":[{"rotate-z":oe()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":[`scale-3d`],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[G,W,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":[`translate-none`],accent:[{accent:N()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:N()}],"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`,G,W]}],"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`,G,W]}],fill:[{fill:[`none`,...N()]}],"stroke-w":[{stroke:[U,wr,_r,vr]}],stroke:[{stroke:[`none`,...N()]}],"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 K(...e){return Vr(_n(e))}function Hr(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 Ur(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 Wr(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 Gr=vn(`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 q({className:e,variant:t,...n}){return(0,D.jsx)(`span`,{className:K(Gr({variant:t,className:e})),...n})}var Kr=e=>e,qr=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}),Jr=qr(2),Yr=qr(3),Xr=qr(4),Zr=qr(5),Qr={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},$r={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},ei={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 ti(e=1.70158){let t=e;return e=>e*e*((t+1)*e-t)}function ni(e=1.70158){let t=e;return e=>{let n=e-1;return n*n*((t+1)*n+t)+1}}function ri(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 ii(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 ai(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 oi(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 si=7.5625,ci=2.75,li=e=>{if(e<1/ci)return si*e*e;if(e<2/ci){let t=e-1.5/ci;return si*t*t+.75}if(e<2.5/ci){let t=e-2.25/ci;return si*t*t+.9375}let t=e-2.625/ci;return si*t*t+.984375},ui=e=>1-li(1-e),di=e=>e<.5?(1-li(1-2*e))/2:(1+li(2*e-1))/2;function fi(e){let t=Math.max(1,Math.floor(e));return e=>e>=1?1:e<=0?0:Math.floor(e*t)/t}function pi(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 mi(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 hi={linear:Kr,inQuad:Jr.in,outQuad:Jr.out,inOutQuad:Jr.inOut,inCubic:Yr.in,outCubic:Yr.out,inOutCubic:Yr.inOut,inQuart:Xr.in,outQuart:Xr.out,inOutQuart:Xr.inOut,inQuint:Zr.in,outQuint:Zr.out,inOutQuint:Zr.inOut,inSine:Qr.in,outSine:Qr.out,inOutSine:Qr.inOut,inExpo:$r.in,outExpo:$r.out,inOutExpo:$r.inOut,inCirc:ei.in,outCirc:ei.out,inOutCirc:ei.inOut,inBack:ti(),outBack:ni(),inOutBack:ri(),inElastic:ai(),outElastic:ii(),inOutElastic:oi(),inBounce:ui,outBounce:li,inOutBounce:di};function gi(e){if(typeof e==`function`)return e;if(e===void 0)return hi.outCubic;let t=hi[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 ii(t[0],t[1]);case`inElastic`:return ai(t[0],t[1]);case`inOutElastic`:return oi(t[0],t[1]);case`outBack`:return ni(t[0]);case`inBack`:return ti(t[0]);case`inOutBack`:return ri(t[0]);case`steps`:return fi(t[0]??4);case`cubicBezier`:return t.length>=4?pi(t[0],t[1],t[2],t[3]):hi.outCubic;default:return hi.outCubic}}return hi.outCubic}function _i(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 vi(e,t={}){let n=t.start??0,r=t.direction===`reverse`;return(i,a)=>{if(a<=0)return n;let o=_i(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 yi=new Set([`duration`,`delay`,`ease`,`loop`,`alternate`,`onBegin`,`onUpdate`,`onComplete`]);function bi(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 xi(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 Si(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Ci=/^(-?\d*\.?\d+)([a-z%]*)$/i;function wi(e){if(typeof e==`number`)return{value:e,unit:``};let t=e.trim().match(Ci);return t?{value:parseFloat(t[1]),unit:t[2]??``}:{value:0,unit:``}}function Ti(e){return e.unit===``?`${e.value}`:`${e.value}${e.unit}`}var Ei=new Set([`translate`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`]),Di=new WeakMap;function Oi(e){let t=Di.get(e);return t||(t={values:{}},Di.set(e,t)),t}function ki(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 Ai(e,t,n){if(Ei.has(t)){let r=Oi(e);r.values[t]=n,e.style.transform=ki(r);return}if(t===`opacity`){e.style.opacity=`${n.value}`;return}e.style.setProperty(t,Ti(n))}function ji(e,t){return Ei.has(t)?Oi(e).values[t]||{value:+!!t.startsWith(`scale`),unit:``}:wi(e.style.getPropertyValue(t)||(typeof window<`u`?window.getComputedStyle(e).getPropertyValue(t):``)||(t===`opacity`?`1`:`0`))}function Mi(e,t,n){return e+(t-e)*n}function Ni(e,t,n){return e===void 0?0:typeof e==`number`?e:e(t,n)}function Pi(e){if(e&&typeof e==`object`&&`spring`in e){let t=mi(e.spring);return{ease:t.fn,duration:t.duration}}return{ease:gi(e),duration:null}}var Fi=0,Ii=new Set;function Li(e){for(let t of Ii){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)Ai(n.el,e.name,Ri(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&&Ai(n.el,e.name,Ri(e.from,e.to,t))}n.el!==null&&r.onUpdate?.(d,n.el,n.index)}for(let e of[...Ii])e.done&&Ii.delete(e);if(Ii.size===0){Fi=0;return}Fi=requestAnimationFrame(Li)}function Ri(e,t,n){let r=e.unit||t.unit;return{value:Mi(e.value,t.value,n),unit:r}}function zi(){Fi===0&&(typeof requestAnimationFrame>`u`||(Fi=requestAnimationFrame(Li)))}function Bi(e,t){let n=xi(e),r=n.length,i=Object.keys(t).filter(e=>!yi.has(e)),a=Si(),{ease:o,duration:s}=Pi(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=bi(r);if(i===null)continue;let s,c;Array.isArray(i)?(s=wi(i[0]),c=wi(i[1])):(s=ji(e,n),c=wi(i)),a.push({name:n,from:s,to:c,ease:o})}return{el:e,index:n,props:a,duration:c,delay:Ni(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)Ai(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)Ai(r,e.name,e.from);let s={target:i,start:o,options:t,done:!1};l.push(s),Ii.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 zi(),{cancel(){if(!p){p=!0;for(let e of l)e.done=!0,Ii.delete(e)}},finished:Promise.all(u).then(()=>void 0),get done(){return p||l.every(e=>e.done)}}}var Vi=vn(`hig-button relative overflow-hidden focus-visible:outline-none disabled:pointer-events-none disabled:opacity-45`,{variants:{variant:{primary:`hig-button-primary`,secondary:``,ghost:`hig-button-plain`,danger:`hig-button-destructive`},size:{sm:`hig-button-small`,md:``,icon:`!w-7 !h-7 !min-w-0 !p-0`}},defaultVariants:{variant:`primary`,size:`md`}});function Hi(e,t){if(Si())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),Bi(i,{scale:[0,1],opacity:[.22,0],duration:540,ease:`outExpo`,onComplete:()=>{i.remove()}})}var J=_.forwardRef(({className:e,variant:t,size:n,onMouseDown:r,onClick:i,...a},o)=>(0,D.jsx)(`button`,{ref:o,className:K(Vi({variant:t,size:n,className:e})),onMouseDown:e=>{Hi(e.currentTarget,e),r?.(e)},onClick:i,...a}));J.displayName=`Button`;var Ui=vn(`hig-card flex flex-col min-h-0 overflow-hidden`,{variants:{variant:{default:``,interactive:`hover:border-[var(--color-line-2)] hover:shadow-[var(--hig-shadow-2)] transition-all cursor-pointer`,flush:`bg-transparent border-[var(--color-line-0)] shadow-none`}},defaultVariants:{variant:`default`}});function Y({className:e,variant:t,...n}){return(0,D.jsx)(`div`,{className:K(Ui({variant:t,className:e})),...n})}function X({className:e,...t}){return(0,D.jsx)(`div`,{className:K(`flex items-center justify-between gap-2 px-4 pt-3 pb-2 shrink-0`,e),...t})}function Z({className:e,...t}){return(0,D.jsx)(`div`,{className:K(`px-4 py-3 flex-1 min-h-0 overflow-auto`,e),...t})}function Wi({className:e,children:t,...n}){return(0,D.jsx)(`pre`,{className:K(`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 Gi=new Map;async function Ki(e){let t=Gi.get(e);if(t)return t.status===`ok`?t.data:t.status===`error`?null:t.promise;let n=(async()=>{try{let t=await fetch(`/api/json/rule-explain?ruleId=${encodeURIComponent(e)}`,{headers:{Accept:`application/json`}});if(!t.ok)return Gi.set(e,{status:`error`,error:`HTTP ${t.status}`}),null;let n=await t.json();return Gi.set(e,{status:`ok`,data:n}),n}catch(t){return Gi.set(e,{status:`error`,error:String(t)}),null}})();return Gi.set(e,{status:`loading`,promise:n}),n}var qi=220,Ji=90;function Yi({ruleId:e,children:t,className:n}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=()=>{u.current&&clearTimeout(u.current),d.current&&clearTimeout(d.current),u.current=null,d.current=null},p=(0,_.useCallback)(()=>{let e=l.current;if(!e)return;let t=e.getBoundingClientRect(),n=t.left;n+320>window.innerWidth-12&&(n=Math.max(12,window.innerWidth-320-12));let r=t.bottom+8;r+200>window.innerHeight-12&&(r=Math.max(12,t.top-200-8)),c({top:r,left:n})},[]),m=(0,_.useCallback)(()=>{f(),u.current=setTimeout(()=>{p(),i(!0),Ki(e).then(e=>{e&&o(e)});let t=Gi.get(e);t&&t.status===`ok`&&o(t.data)},qi)},[e,p,f]),h=(0,_.useCallback)(()=>{f(),d.current=setTimeout(()=>{i(!1)},Ji)},[f]);return(0,_.useEffect)(()=>{if(!r)return;let e=()=>p(),t=()=>p(),n=e=>{e.key===`Escape`&&i(!1)};return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,t),window.addEventListener(`keydown`,n),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,t),window.removeEventListener(`keydown`,n)}},[r,p]),(0,_.useEffect)(()=>()=>f(),[f]),(0,D.jsxs)(`span`,{ref:l,className:`ss-rule-trigger${n?` ${n}`:``}`,onMouseEnter:m,onMouseLeave:h,onFocus:m,onBlur:h,"aria-describedby":r?`rule-popover-${e}`:void 0,children:[t,r&&s&&(0,D.jsx)(`span`,{id:`rule-popover-${e}`,role:`tooltip`,className:`ss-rule-popover`,style:{top:s.top,left:s.left},onMouseEnter:()=>f(),onMouseLeave:h,children:a?(0,D.jsx)(Xi,{data:a}):(0,D.jsx)(`span`,{className:`ss-rule-popover__loading`,children:`loading rule…`})})]})}function Xi({data:e}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`span`,{className:`ss-rule-popover__head`,children:[(0,D.jsx)(`code`,{className:`ss-rule-popover__id`,children:e.ruleId}),(0,D.jsx)(`span`,{className:`ss-rule-popover__pill ss-rule-popover__pill--${e.decision}`,children:e.decision}),(0,D.jsx)(`span`,{className:`ss-rule-popover__state ss-rule-popover__state--${e.enabled?`on`:`off`}`,children:e.enabled?`ON`:`OFF`})]}),(0,D.jsx)(`strong`,{className:`ss-rule-popover__headline`,children:e.headline}),(0,D.jsx)(`span`,{className:`ss-rule-popover__summary`,children:e.summary}),e.conditions.length>1&&(0,D.jsxs)(`span`,{className:`ss-rule-popover__section`,children:[(0,D.jsx)(`span`,{className:`ss-rule-popover__label`,children:`Matches when`}),(0,D.jsx)(`ul`,{className:`ss-rule-popover__list`,children:e.conditions.map((e,t)=>(0,D.jsx)(`li`,{children:e},t))})]}),e.hints.length>0&&(0,D.jsx)(`span`,{className:`ss-rule-popover__hints`,children:e.hints.map((e,t)=>(0,D.jsx)(`span`,{className:`ss-rule-popover__hint`,children:e},t))}),(0,D.jsx)(`span`,{className:`ss-rule-popover__foot`,children:(0,D.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.ruleId)}`,className:`ss-rule-popover__link`,children:`Open in Rules →`})})]})}var Zi={dashboard:`dashboard`,native:`native`,tty:`tty`,cli:`cli`},Qi={allow:`green`,block:`red`,force:`amber`,ask:`blue`,log:`gray`},$i=[`all`,`allow`,`block`,`ask`,`force`,`log`],ea={allow:`text-emerald-300`,block:`text-red-300`,ask:`text-sky-300`,force:`text-amber-300`,log:`text-[var(--color-fg-3)]`};function ta(e){return new Date(e*1e3).toLocaleString()}function na(e,t){if(!t)return``;let n=t-e;return n<60?`${n}s`:`${Math.round(n/60)}m`}async function ra(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:H()})}async function ia(e,t){try{return await(await fetch(`/api/rules/set-enabled`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...H()},body:JSON.stringify({ruleId:e,enabled:t})})).json()}catch(e){return{error:String(e)}}}function aa(e){try{let t=JSON.parse(e).input;return t&&typeof t==`object`?Wr(``,JSON.stringify(t)):Wr(``,e)}catch{return e.slice(0,80)}}function oa(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 sa({label:e,value:t,tone:n}){return(0,D.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,D.jsx)(`span`,{className:`font-mono text-sm tabular-nums ${n??`text-[var(--color-fg-0)]`}`,children:t}),(0,D.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-[var(--color-fg-3)]`,children:e})]})}function ca(e,t){let n=Math.floor(Date.now()/1e3),r=n-86400,i=new Map;for(let t of e){if(t.decision!==`ask`||t.created_at<r||!t.rule_id)continue;let e=i.get(t.rule_id);e?(e.count+=1,t.created_at>e.lastSeen&&(e.lastSeen=t.created_at)):i.set(t.rule_id,{ruleId:t.rule_id,ruleMessage:t.rule_message||t.rule_id,count:1,lastSeen:t.created_at})}for(let e of t){if(!e.ruleId)continue;let t=i.get(e.ruleId);t?(t.count+=1,t.lastSeen=n):i.set(e.ruleId,{ruleId:e.ruleId,ruleMessage:e.ruleMessage||e.ruleId,count:1,lastSeen:n})}return Array.from(i.values()).filter(e=>e.count>=3).sort((e,t)=>t.count-e.count||t.lastSeen-e.lastSeen).slice(0,5)}function la(e){let t=Math.max(0,Math.floor(Date.now()/1e3)-e);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function ua({ruleId:e,ruleMessage:t,onDismiss:n,onUndo:r}){let[i,a]=(0,_.useState)(!1),o=(0,_.useRef)(null);return(0,_.useEffect)(()=>(o.current=setTimeout(n,6e3),()=>{o.current&&clearTimeout(o.current)}),[n]),(0,D.jsxs)(`div`,{className:`fixed bottom-5 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 px-4 py-2.5 rounded-full border border-[var(--color-line-2)] bg-[var(--color-surface-1)] backdrop-blur-md shadow-lg`,children:[(0,D.jsxs)(`span`,{className:`text-xs text-[var(--color-fg-1)]`,children:[`Silenced`,` `,(0,D.jsx)(`span`,{className:`font-mono text-[var(--color-fg-0)]`,children:t})]}),(0,D.jsx)(`button`,{type:`button`,disabled:i,onClick:async()=>{a(!0),await r(),n()},className:`text-[11px] font-mono uppercase tracking-wider px-2.5 py-1 rounded-full border border-[var(--color-brand)]/40 text-[var(--color-brand)] hover:bg-[var(--color-brand)]/10 cursor-pointer disabled:opacity-50`,"aria-label":`Undo silencing ${e}`,children:`undo`}),(0,D.jsx)(`button`,{type:`button`,onClick:n,className:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer`,"aria-label":`Dismiss`,children:(0,D.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,D.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`}),(0,D.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`})]})})]})}function da({target:e,onClose:t,onConfirm:n}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null);return(0,_.useEffect)(()=>{o(null)},[]),e?(0,D.jsxs)($t,{open:!!e,onClose:t,size:`sm`,title:`Silence this rule?`,subtitle:`It won't ask for approval again until you re-enable it on the Rules page.`,footer:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--secondary`,disabled:r,onClick:t,children:`Cancel`}),(0,D.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--primary`,style:{"--tone":`#ff6f6f`},disabled:r,onClick:async()=>{i(!0),o(null);let r=await n(e);if(i(!1),!r.ok){o(r.message??`Could not silence rule.`);return}t()},children:r?`Silencing…`:`Disable rule`})]}),children:[(0,D.jsxs)(`div`,{className:`ss-list`,children:[(0,D.jsx)(`div`,{className:`ss-list-row`,style:{cursor:`default`},children:(0,D.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,D.jsx)(`div`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-1`,children:`rule`}),(0,D.jsx)(`div`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,D.jsx)(Yi,{ruleId:e.ruleId,children:(0,D.jsx)(`code`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] block mt-1 break-all`,children:e.ruleId})})]})}),(0,D.jsx)(`div`,{className:`ss-list-row`,style:{cursor:`default`},children:(0,D.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,D.jsx)(`div`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-1`,children:`recent activity`}),(0,D.jsxs)(`div`,{className:`text-sm text-[var(--color-fg-1)]`,children:[`Triggered`,` `,(0,D.jsx)(`strong`,{className:`text-[var(--color-fg-0)] tabular-nums`,children:e.fireCount}),` `,e.fireCount===1?`time`:`times`,` in the last 24 hours.`]})]})})]}),(0,D.jsxs)(`p`,{className:`text-xs text-[var(--color-fg-3)] mt-3 leading-relaxed`,children:[`Disabling a rule is fully reversible — head to`,` `,(0,D.jsx)(`a`,{href:`/rules`,className:`text-[var(--color-brand)] hover:underline`,children:`Rules`}),` `,`to switch it back on.`]}),a&&(0,D.jsx)(`p`,{className:`mt-3 text-xs text-red-300`,role:`alert`,children:a})]}):null}function fa(){let e=Bt([`pending-changed`,`rules-changed`]),{data:t,refetch:n}=V(`/api/json/pending`,[e[`pending-changed`]]),{data:r}=V(`/api/json/approvals`,[e[`pending-changed`]]),[i,a]=(0,_.useState)(`all`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(new Set),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),m=(0,_.useMemo)(()=>ca(r??[],t??[]),[r,t]),h=(0,_.useMemo)(()=>{let e=new Map;for(let t of m)e.set(t.ruleId,t.count);return e},[m]),g=Math.floor(Date.now()/1e3),v=(r??[]).filter(e=>e.created_at>=g-86400).length,y=(r??[]).reduce((e,t)=>(e[t.decision]=(e[t.decision]??0)+1,e),{}),b=(r??[]).filter(e=>{if(i!==`all`&&e.decision!==i)return!1;if(o){let t=o.toLowerCase(),n=aa(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 x(e){l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function S(e){let t=await ia(e.ruleId,!1);return t.error||t.ok===!1?{ok:!1,message:t.error??`Server rejected the request.`}:(e.pendingId&&await ra(e.pendingId,`block`),p({ruleId:e.ruleId,ruleMessage:e.ruleMessage}),n(),{ok:!0})}async function C(e){await ia(e,!0),n()}return(0,D.jsxs)(`div`,{className:`space-y-6`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h1`,{className:`overline text-[11px]`,children:`approvals`}),(0,D.jsx)(`p`,{className:`text-xs text-[var(--color-fg-3)] mt-1 font-mono`,children:`approve or deny pending tool calls · review past decisions · silence noisy rules`})]}),(0,D.jsxs)(`div`,{"data-tutorial":`appr-stats`,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,D.jsx)(sa,{label:`pending`,value:t?.length??0,tone:`text-amber-300`}),(0,D.jsx)(`span`,{className:`text-[var(--color-line-2)]`,children:`|`}),[`allow`,`block`,`ask`,`force`,`log`].map(e=>(0,D.jsx)(sa,{label:e,value:y[e]??0,tone:ea[e]},e)),(0,D.jsx)(`span`,{className:`text-[var(--color-line-2)]`,children:`|`}),(0,D.jsx)(sa,{label:`last 24h`,value:v})]}),m.length>0&&(0,D.jsxs)(`section`,{className:`ss-noisy-card`,"aria-label":`Noisy rules`,children:[(0,D.jsxs)(`div`,{className:`ss-noisy-card-head`,children:[(0,D.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M12 9v4`}),(0,D.jsx)(`path`,{d:`M12 17h.01`}),(0,D.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`})]}),`asking too often · last 24h`]}),m.map(e=>(0,D.jsxs)(`div`,{className:`ss-noisy-row`,children:[(0,D.jsx)(`span`,{className:`ss-noisy-count`,"aria-label":`${e.count} fires`,children:e.count}),(0,D.jsxs)(`div`,{className:`ss-noisy-text`,children:[(0,D.jsx)(`span`,{className:`ss-noisy-title`,children:e.ruleMessage}),(0,D.jsxs)(`span`,{className:`ss-noisy-sub`,children:[(0,D.jsx)(Yi,{ruleId:e.ruleId,children:(0,D.jsx)(`code`,{className:`font-mono`,children:e.ruleId})}),(0,D.jsx)(`span`,{style:{margin:`0 6px`},children:`·`}),`last fired `,la(e.lastSeen)]})]}),(0,D.jsxs)(`button`,{type:`button`,className:`ss-pill ss-pill--danger`,onClick:()=>d({ruleId:e.ruleId,ruleMessage:e.ruleMessage,fireCount:e.count}),"aria-label":`Silence rule ${e.ruleId}`,children:[(0,D.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,D.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,D.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]}),`Silence`]})]},e.ruleId))]}),t&&t.length>0&&(0,D.jsxs)(`section`,{"data-tutorial":`appr-pending`,children:[(0,D.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,D.jsxs)(`h2`,{className:`overline text-[11px]`,children:[`pending · `,t.length]})}),(0,D.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>{let t=h.get(e.ruleId)??0;return(0,D.jsxs)(Y,{className:`border-l-2 border-l-amber-400/60`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,D.jsxs)(`div`,{className:`flex gap-2 flex-wrap items-center`,children:[(0,D.jsx)(J,{size:`sm`,variant:`primary`,onClick:async()=>{await ra(e.id,`allow`),n()},children:`approve`}),(0,D.jsx)(J,{size:`sm`,variant:`danger`,onClick:async()=>{await ra(e.id,`block`),n()},children:`deny`}),(0,D.jsxs)(`button`,{type:`button`,className:`ss-pill ss-pill--danger`,onClick:()=>d({ruleId:e.ruleId,ruleMessage:e.ruleMessage,fireCount:t||1,pendingId:e.id}),"aria-label":`Disable rule ${e.ruleId}`,children:[(0,D.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,D.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,D.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]}),`Disable rule`]})]})]}),(0,D.jsxs)(Z,{className:`space-y-2 text-xs`,children:[(0,D.jsxs)(`div`,{className:`flex gap-3 flex-wrap items-center`,children:[(0,D.jsx)(`span`,{className:`overline`,children:`tool`}),(0,D.jsx)(`code`,{className:`text-[var(--color-brand)] font-mono`,children:e.toolCall.tool}),(0,D.jsx)(`span`,{className:`overline ml-2`,children:`rule`}),(0,D.jsx)(Yi,{ruleId:e.ruleId,children:(0,D.jsx)(`span`,{className:`font-mono text-[var(--color-fg-2)]`,children:e.ruleId})}),t>=3&&(0,D.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded-full`,style:{background:`color-mix(in oklab, #ffa657 14%, transparent)`,color:`#ffb27d`,border:`1px solid color-mix(in oklab, #ffa657 28%, transparent)`},title:`Fired ${t} times in the last 24h`,children:[`asks often · `,t,`×`]})]}),e.prompt&&(0,D.jsxs)(`div`,{className:`flex gap-2 items-start`,children:[(0,D.jsx)(`span`,{className:`overline pt-0.5 shrink-0`,children:`why`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.prompt})]}),(0,D.jsx)(Wi,{children:JSON.stringify(e.toolCall.input,null,2)})]})]},e.id)})})]}),(0,D.jsxs)(`section`,{"data-tutorial":`appr-history`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between mb-3 gap-3 flex-wrap`,children:[(0,D.jsx)(`h2`,{className:`overline text-[11px]`,children:`history`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,D.jsx)(`div`,{className:`flex gap-0.5 rounded-sm border border-[var(--color-line-1)] p-0.5 bg-[var(--color-surface-1)]`,children:$i.map(e=>(0,D.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,D.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,D.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`}):b.length===0?(0,D.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,D.jsx)(Y,{children:(0,D.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:b.map(e=>{let t=c.has(e.id),n=aa(e.input),r=na(e.created_at,e.resolved_at);return(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`button`,{onClick:()=>x(e.id),className:`w-full text-left px-3 py-2 hover:bg-[var(--color-surface-2)]/60 transition-colors cursor-pointer flex items-start gap-3`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-[10px] w-2.5 shrink-0 mt-1`,children:t?`▼`:`▶`}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col gap-1`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,D.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] whitespace-nowrap tabular-nums`,children:ta(e.resolved_at??e.created_at)}),(0,D.jsx)(q,{variant:Qi[e.decision]??`gray`,children:e.decision}),e.source&&(0,D.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded-sm border border-[var(--color-line-1)] text-[var(--color-fg-3)]`,title:`Approval source: ${e.source}`,children:Zi[e.source]??e.source}),(0,D.jsx)(`code`,{className:`text-xs text-[var(--color-brand)] font-mono`,children:e.tool}),r&&(0,D.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] ml-auto`,children:[`Δ`,r]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,D.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,D.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)] font-mono truncate flex-1 min-w-0 hidden md:block`,children:n})]})]})]}),t&&(0,D.jsxs)(`div`,{className:`px-3 pb-3 pt-1 space-y-2 bg-[var(--color-surface-0)]`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs font-mono items-center`,children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`rule`}),` `,e.rule_id?(0,D.jsx)(Yi,{ruleId:e.rule_id,children:(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.rule_id})}):(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:`—`})]}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`created`}),` `,(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:ta(e.created_at)})]}),e.resolved_at&&(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`resolved`}),` `,(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:ta(e.resolved_at)})]}),e.rule_id&&(0,D.jsxs)(`button`,{type:`button`,className:`ss-pill ss-pill--danger ml-auto`,onClick:()=>d({ruleId:e.rule_id,ruleMessage:e.rule_message||e.rule_id,fireCount:h.get(e.rule_id)??1}),"aria-label":`Silence rule ${e.rule_id}`,children:[(0,D.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,D.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,D.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]}),`Silence rule`]})]}),e.prompt&&(0,D.jsxs)(`div`,{className:`text-xs flex gap-2 items-start`,children:[(0,D.jsx)(`span`,{className:`overline pt-0.5 shrink-0`,children:`why`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.prompt})]}),(0,D.jsx)(Wi,{children:oa(e.input)})]})]},e.id)})})})]}),(0,D.jsx)(da,{target:u,onClose:()=>d(null),onConfirm:S}),f&&(0,D.jsx)(ua,{ruleId:f.ruleId,ruleMessage:f.ruleMessage,onDismiss:()=>p(null),onUndo:()=>C(f.ruleId)})]})}function pa(e){return e==null?`—`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function ma(e){if(e<60)return`${e}s`;let t=Math.floor(e/60);if(t<60)return`${t}m`;let n=Math.floor(t/60);return n<24?`${n}h`:`${Math.floor(n/24)}d ${n%24}h`}function ha(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(``),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(null),g=(0,_.useCallback)(async()=>{try{let e=await fetch(`/api/json/audit-config`);if(!e.ok)return;let n=await e.json();t(n),a(String(n.config.maxRows)),s(String(n.config.absoluteMaxRows)),l(String(n.config.minRetentionHours)),d(n.config.maxBytes==null?``:String(Math.round(n.config.maxBytes/(1024*1024))))}catch{}},[]);(0,_.useEffect)(()=>{g()},[g]);let v=(0,_.useMemo)(()=>!e?.usage.oldestTimestampSec||!e?.usage.newestTimestampSec?null:e.usage.newestTimestampSec-e.usage.oldestTimestampSec,[e]),y=async()=>{if(!e)return;p(!0),h(null);let t={},n=Number(i);Number.isFinite(n)&&n!==e.config.maxRows&&(t.maxRows=n);let r=Number(o);Number.isFinite(r)&&r!==e.config.absoluteMaxRows&&(t.absoluteMaxRows=r);let a=Number(c);if(Number.isFinite(a)&&a!==e.config.minRetentionHours&&(t.minRetentionHours=a),u.trim()===``)e.config.maxBytes!=null&&(t.maxBytes=null);else{let n=Number(u);if(Number.isFinite(n)){let r=Math.round(n*1024*1024);r!==e.config.maxBytes&&(t.maxBytes=r)}}if(Object.keys(t).length===0){h({kind:`ok`,text:`No changes.`}),p(!1);return}try{let e=await fetch(`/api/json/audit-config`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!e.ok){let t=await e.json();throw Error(t.error??`HTTP ${e.status}`)}await g(),h({kind:`ok`,text:`Saved. New budget applies within ~60 seconds.`})}catch(e){h({kind:`err`,text:e instanceof Error?e.message:String(e)})}finally{p(!1)}},b=async()=>{if(e){p(!0),h(null);try{let t=await fetch(`/api/json/audit-config`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e.defaults)});if(!t.ok){let e=await t.json();throw Error(e.error??`HTTP ${t.status}`)}await g(),h({kind:`ok`,text:`Reset to defaults.`})}catch(e){h({kind:`err`,text:e instanceof Error?e.message:String(e)})}finally{p(!1)}}};if(!e)return(0,D.jsx)(D.Fragment,{});let x=`w-32 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`,S=`text-[10.5px] uppercase tracking-wider text-[var(--color-fg-4)]`,C=`text-[10.5px] font-mono text-[var(--color-fg-4)] tabular-nums`;return(0,D.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,children:[(0,D.jsxs)(`button`,{onClick:()=>r(e=>!e),className:`w-full flex items-center justify-between px-3 py-2 hover:bg-white/[0.02] cursor-pointer`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 text-[11.5px]`,children:[(0,D.jsx)(`span`,{className:`font-medium text-[var(--color-fg-1)]`,children:`Storage budget`}),(0,D.jsxs)(`span`,{className:C,children:[e.usage.rows.toLocaleString(),` rows`,e.usage.bytes!=null&&` · ${pa(e.usage.bytes)}`,v!=null&&` · spans ${ma(v)}`]})]}),(0,D.jsx)(`span`,{className:C,children:n?`▾`:`▸`})]}),n&&(0,D.jsxs)(`div`,{className:`border-t border-[var(--color-line-1)] px-3 py-3 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-3`,children:[(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:S,children:`Soft row cap`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`input`,{type:`number`,value:i,min:e.limits.maxRows.min,max:e.limits.maxRows.max,onChange:e=>a(e.target.value),className:x}),(0,D.jsx)(`span`,{className:C,children:`rows`})]}),(0,D.jsx)(`p`,{className:`text-[10.5px] text-[var(--color-fg-4)] leading-relaxed`,children:`Above this, old rows are rotated — but never within the retention window.`})]}),(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:S,children:`Hard ceiling`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`input`,{type:`number`,value:o,min:e.limits.absoluteMaxRows.min,max:e.limits.absoluteMaxRows.max,onChange:e=>s(e.target.value),className:x}),(0,D.jsx)(`span`,{className:C,children:`rows`})]}),(0,D.jsx)(`p`,{className:`text-[10.5px] text-[var(--color-fg-4)] leading-relaxed`,children:`Pruned regardless of age once exceeded. Protects against runaway disk growth.`})]}),(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:S,children:`Retention floor`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`input`,{type:`number`,value:c,step:`0.5`,min:e.limits.minRetentionHours.min,max:e.limits.minRetentionHours.max,onChange:e=>l(e.target.value),className:x}),(0,D.jsx)(`span`,{className:C,children:`hours`})]}),(0,D.jsx)(`p`,{className:`text-[10.5px] text-[var(--color-fg-4)] leading-relaxed`,children:`Rows newer than this are never deleted by the soft cap. Set 0 to disable the floor.`})]}),(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:S,children:`Size cap (optional)`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`input`,{type:`number`,value:u,placeholder:`off`,min:1,onChange:e=>d(e.target.value),className:x}),(0,D.jsx)(`span`,{className:C,children:`MB`})]}),(0,D.jsx)(`p`,{className:`text-[10.5px] text-[var(--color-fg-4)] leading-relaxed`,children:`Bytes-based eviction. Leave blank to disable. Honors the retention floor like the soft cap.`})]})]}),m&&(0,D.jsx)(`p`,{className:`text-[11px] font-mono ${m.kind===`err`?`text-rose-300`:`text-emerald-300`}`,children:m.text}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,D.jsx)(`button`,{onClick:y,disabled:f,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-1)] hover:text-[var(--color-fg-0)] bg-[var(--color-surface-2)] hover:bg-[var(--color-surface-3)] border border-[var(--color-line-1)] rounded-sm px-3 py-1.5 disabled:opacity-50 cursor-pointer`,children:f?`saving…`:`save`}),(0,D.jsx)(`button`,{onClick:b,disabled:f,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] border border-[var(--color-line-1)] rounded-sm px-3 py-1.5 disabled:opacity-50 cursor-pointer`,children:`reset to defaults`})]})]})]})}var ga={"http-json":`HTTP webhook (generic JSON)`,"splunk-hec":`Splunk HEC`,datadog:`Datadog logs`,"file-jsonl":`Local JSONL file`};function _a(e){if(!e)return`never`;let t=Date.now()/1e3-e;return t<60?`${Math.floor(t)}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function va(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(``),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(null),y=async()=>{t(await(await fetch(`/api/json/audit-sinks`)).json())};(0,_.useEffect)(()=>{y()},[y]);let b=(0,_.useMemo)(()=>e?new Map(e.status.map(e=>[e.sink_id,e])):new Map,[e]),x=t=>{if(!e)return;let n=`${t}-${Date.now().toString(36).slice(-4)}`,r={id:n,name:ga[t],type:t,enabled:!1,endpoint:t===`file-jsonl`?void 0:``,path:t===`file-jsonl`?`~/.sigmashake/audit-export.jsonl`:void 0,auth:{type:`none`},batch:{maxEvents:100,maxBytes:1e6,intervalMs:3e4},retry:{maxAttempts:5,baseMs:1e3,maxMs:6e4},filter:{},payload:{template:e.starterTemplates[t]}};a(n),s(r),l(!1),d(JSON.stringify(r,null,2)),h(null),v(null)},S=e=>{a(e.id),s(JSON.parse(JSON.stringify(e))),l(!1),d(JSON.stringify(e,null,2)),h(null),v(null)},C=()=>{a(null),s(null),l(!1),d(``),h(null),v(null)},w=()=>{if(c)try{return JSON.parse(u)}catch{return null}return o},T=async()=>{let e=w();if(!e){h({kind:`err`,text:`JSON is invalid`});return}p(!0),h(null);try{let t=await fetch(`/api/json/audit-sinks`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json();throw Error(e.error??`HTTP ${t.status}`)}await y(),h({kind:`ok`,text:`Saved.`}),C()}catch(e){h({kind:`err`,text:e instanceof Error?e.message:String(e)})}finally{p(!1)}},E=async e=>{if(confirm(`Delete sink "${e}"? Forwarded events stay; new events won't be sent here.`)){p(!0);try{let t=await fetch(`/api/json/audit-sinks?id=${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok){let e=await t.json();throw Error(e.error??`HTTP ${t.status}`)}await y(),h({kind:`ok`,text:`Deleted.`})}catch(e){h({kind:`err`,text:e instanceof Error?e.message:String(e)})}finally{p(!1)}}},O=async()=>{let e=w();if(!e){h({kind:`err`,text:`JSON is invalid`});return}p(!0),v(null);try{let t=await(await fetch(`/api/json/audit-sinks/test`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})).json();v({...t.result,rendered:t.rendered})}catch(e){v({ok:!1,status:0,error:e instanceof Error?e.message:String(e)})}finally{p(!1)}},k=async e=>{p(!0);try{let t=await fetch(`/api/json/audit-sinks`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...e,enabled:!e.enabled})});if(!t.ok)throw Error(`HTTP ${t.status}`);await y()}catch(e){h({kind:`err`,text:e instanceof Error?e.message:String(e)})}finally{p(!1)}};if(!e)return(0,D.jsx)(D.Fragment,{});let ee=`text-[10.5px] font-mono text-[var(--color-fg-4)] tabular-nums`,A=`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`,j=`text-[10.5px] uppercase tracking-wider text-[var(--color-fg-4)]`,M=`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] border border-[var(--color-line-1)] rounded-sm px-3 py-1.5 disabled:opacity-50 cursor-pointer`;return(0,D.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,children:[(0,D.jsxs)(`button`,{onClick:()=>r(e=>!e),className:`w-full flex items-center justify-between px-3 py-2 hover:bg-white/[0.02] cursor-pointer`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 text-[11.5px]`,children:[(0,D.jsx)(`span`,{className:`font-medium text-[var(--color-fg-1)]`,children:`Centralized logging`}),(0,D.jsx)(`span`,{className:ee,children:e.sinks.length===0?`no destinations`:`${e.sinks.filter(e=>e.enabled).length} of ${e.sinks.length} active`})]}),(0,D.jsx)(`span`,{className:ee,children:n?`▾`:`▸`})]}),n&&(0,D.jsxs)(`div`,{className:`border-t border-[var(--color-line-1)] px-3 py-3 space-y-3`,children:[(0,D.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] leading-relaxed`,children:`Forward every audit event to your SIEM or log lake. Each destination has its own filter + payload template — edit the JSON directly to map fields to whatever shape your destination expects.`}),e.sinks.length>0&&(0,D.jsx)(`div`,{className:`space-y-1.5`,children:e.sinks.map(e=>{let t=b.get(e.id);return(0,D.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)]`,children:[(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.enabled?t?.last_status===`ok`?`bg-emerald-400`:t?.last_status===`dead-lettered`?`bg-rose-400`:`bg-amber-400`:`bg-[var(--color-fg-4)]`}`}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-[11.5px] font-mono`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,children:e.name}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:ga[e.type]})]}),(0,D.jsxs)(`div`,{className:`${ee} truncate`,children:[e.endpoint??e.path??``,t&&(0,D.jsxs)(D.Fragment,{children:[` · `,`sent: `,t.last_status??`—`,` · last:`,` `,_a(t.last_sent_at),t.dropped_count>0&&(0,D.jsxs)(`span`,{className:`text-rose-300`,children:[` · `,`dropped: `,t.dropped_count]})]})]}),t?.last_error&&(0,D.jsx)(`div`,{className:`text-[10.5px] font-mono text-rose-300 truncate`,children:t.last_error})]}),(0,D.jsx)(`button`,{onClick:()=>k(e),disabled:f,className:M,children:e.enabled?`disable`:`enable`}),(0,D.jsx)(`button`,{onClick:()=>S(e),disabled:f,className:M,children:`edit`}),(0,D.jsx)(`button`,{onClick:()=>E(e.id),disabled:f,className:`${M} hover:!text-rose-300`,children:`delete`})]},e.id)})}),i===null&&(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(`span`,{className:ee,children:`add destination:`}),(e.sinkTypes??[]).map(e=>(0,D.jsxs)(`button`,{onClick:()=>x(e),className:M,children:[`+ `,ga[e]]},e))]}),i!==null&&o&&(0,D.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-brand)]/30 bg-[var(--color-surface-0)] p-3 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsxs)(`div`,{className:`text-[11.5px] font-medium text-[var(--color-fg-1)]`,children:[i,` · `,ga[o.type]]}),(0,D.jsx)(`button`,{onClick:()=>l(e=>!e),className:M,children:c?`form view`:`raw JSON`})]}),!c&&(0,D.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-3`,children:[(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Display name`}),(0,D.jsx)(`input`,{type:`text`,value:o.name,onChange:e=>s({...o,name:e.target.value}),className:`${A} w-full`})]}),o.type!==`file-jsonl`&&(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Endpoint URL`}),(0,D.jsx)(`input`,{type:`text`,value:o.endpoint??``,placeholder:`https://…`,onChange:e=>s({...o,endpoint:e.target.value}),className:`${A} w-full`})]}),o.type===`file-jsonl`&&(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`File path`}),(0,D.jsx)(`input`,{type:`text`,value:o.path??``,onChange:e=>s({...o,path:e.target.value}),className:`${A} w-full`})]}),o.type!==`file-jsonl`&&(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Auth`}),(0,D.jsxs)(`select`,{value:o.auth.type,onChange:e=>{let t=e.target.value,n=t===`bearer`?{type:`bearer`,token:``}:t===`basic`?{type:`basic`,username:``,password:``}:t===`header`?{type:`header`,name:``,value:``}:{type:`none`};s({...o,auth:n})},className:`${A} w-full cursor-pointer`,children:[(0,D.jsx)(`option`,{value:`none`,children:`none`}),(0,D.jsx)(`option`,{value:`bearer`,children:`bearer token`}),(0,D.jsx)(`option`,{value:`basic`,children:`basic auth`}),(0,D.jsx)(`option`,{value:`header`,children:`custom header`})]})]}),o.auth.type===`bearer`&&(0,D.jsxs)(`div`,{className:`space-y-1 md:col-span-2`,children:[(0,D.jsx)(`label`,{className:j,children:`Token`}),(0,D.jsx)(`input`,{type:`password`,value:o.auth.token,onChange:e=>s({...o,auth:{type:`bearer`,token:e.target.value}}),className:`${A} w-full`})]}),o.auth.type===`basic`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Username`}),(0,D.jsx)(`input`,{type:`text`,value:o.auth.username,onChange:e=>o.auth.type===`basic`&&s({...o,auth:{...o.auth,username:e.target.value}}),className:`${A} w-full`})]}),(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Password`}),(0,D.jsx)(`input`,{type:`password`,value:o.auth.password,onChange:e=>o.auth.type===`basic`&&s({...o,auth:{...o.auth,password:e.target.value}}),className:`${A} w-full`})]})]}),o.auth.type===`header`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Header name`}),(0,D.jsx)(`input`,{type:`text`,value:o.auth.name,onChange:e=>o.auth.type===`header`&&s({...o,auth:{...o.auth,name:e.target.value}}),className:`${A} w-full`})]}),(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`label`,{className:j,children:`Header value`}),(0,D.jsx)(`input`,{type:`password`,value:o.auth.value,onChange:e=>o.auth.type===`header`&&s({...o,auth:{...o.auth,value:e.target.value}}),className:`${A} w-full`})]})]}),(0,D.jsxs)(`div`,{className:`space-y-1 md:col-span-2`,children:[(0,D.jsxs)(`label`,{className:j,children:[`Payload template (JSON; `,`{{field}}`,` placeholders)`]}),(0,D.jsx)(`textarea`,{value:JSON.stringify(o.payload.template??{},null,2),rows:10,onChange:e=>{try{let t=JSON.parse(e.target.value);s({...o,payload:{...o.payload,template:t}}),h(null)}catch{h({kind:`err`,text:`Template is not valid JSON`})}},className:`${A} w-full leading-snug`})]})]}),c&&(0,D.jsx)(`textarea`,{value:u,rows:20,onChange:e=>d(e.target.value),className:`${A} w-full leading-snug`}),g&&(0,D.jsxs)(`div`,{className:`rounded-sm border px-3 py-2 text-[11px] font-mono ${g.ok?`border-emerald-400/40 text-emerald-200 bg-emerald-400/5`:`border-rose-400/40 text-rose-200 bg-rose-400/5`}`,children:[(0,D.jsxs)(`div`,{children:[g.ok?`✓ delivered`:`✗ failed`,` (HTTP`,` `,g.status,`)`,g.error&&(0,D.jsx)(`span`,{className:`ml-2 text-rose-200`,children:g.error})]}),g.rendered!=null&&(0,D.jsxs)(`details`,{className:`mt-1`,children:[(0,D.jsx)(`summary`,{className:`cursor-pointer text-[10px] text-[var(--color-fg-4)]`,children:`payload sent`}),(0,D.jsx)(`pre`,{className:`mt-1 text-[10px] whitespace-pre-wrap break-all bg-black/30 rounded-sm px-2 py-1 max-h-48 overflow-y-auto`,children:JSON.stringify(g.rendered,null,2)})]})]}),m&&(0,D.jsx)(`p`,{className:`text-[11px] font-mono ${m.kind===`err`?`text-rose-300`:`text-emerald-300`}`,children:m.text}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`button`,{onClick:T,disabled:f,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-1)] hover:text-[var(--color-fg-0)] bg-[var(--color-surface-2)] hover:bg-[var(--color-surface-3)] border border-[var(--color-line-1)] rounded-sm px-3 py-1.5 disabled:opacity-50 cursor-pointer`,children:f?`saving…`:`save`}),(0,D.jsx)(`button`,{onClick:O,disabled:f,className:M,children:`send test event`}),(0,D.jsx)(`button`,{onClick:C,disabled:f,className:M,children:`cancel`})]})]})]})]})}var ya={__daemon:`SigmaShake itself`,bash:`Run a terminal command`,shell:`Run a terminal command`,run_command:`Run a terminal command`,exec:`Run a terminal command`,run_shell_command:`Run a terminal command`,read:`Read a file`,read_file:`Read a file`,view_file:`Read a file`,cat:`Read a file`,view:`Read a file`,write:`Save changes to a file`,write_to_file:`Save changes to a file`,create_file:`Create a new file`,edit:`Edit an existing file`,multiedit:`Edit several spots in a file`,patch:`Edit an existing file`,apply_patch:`Edit an existing file`,replace:`Edit an existing file`,grep:`Search the codebase`,ripgrep:`Search the codebase`,search:`Search the codebase`,search_codebase:`Search the codebase`,glob:`Find files by name`,find:`Find files by name`,list_files:`List files in a folder`,ls:`List files in a folder`,webfetch:`Read a webpage`,fetch:`Read a webpage`,websearch:`Search the web`,search_web:`Search the web`,browser_action:`Use a web browser`,agent:`Ask a helper AI to investigate`,spawn:`Ask a helper AI to investigate`,task:`Update its to-do list`,todowrite:`Update its to-do list`,todo_write:`Update its to-do list`,notebookedit:`Edit a Jupyter notebook`,notebook_edit:`Edit a Jupyter notebook`};function ba(e){return e?ya[e.toLowerCase()]||`Use the ${e.replace(/^_+/,``)} tool`:`Take an action`}function xa(e){return e?{"claude-code":`Claude Code`,claudecode:`Claude Code`,cursor:`Cursor`,copilot:`GitHub Copilot`,codex:`OpenAI Codex`,gemini:`Gemini`,antigravity:`Antigravity`,pi:`Pi`,generic:`AI agent`,daemon:`SigmaShake`}[e.toLowerCase()]??e:`AI agent`}function Sa(e){return e?e.startsWith(`__`):!1}function Ca(e){for(let t of[`file_path`,`path`,`TargetFile`,`AbsolutePath`,`filename`,`file`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function wa(e){for(let t of[`command`,`CommandLine`,`cmd`,`Input`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function Ta(e){for(let t of[`query`,`pattern`,`Query`,`q`,`search`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function Ea(e){for(let t of[`url`,`URL`,`Url`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function Da(e){let t=e.replace(/[\\/]+$/,``),n=t.lastIndexOf(`/`),r=t.lastIndexOf(`\\`),i=Math.max(n,r);return i>=0?t.slice(i+1):t}function Oa(e){let t=e.trim(),n=(t.split(/[|;&]/)[0]?.trim()??t).split(/\s+/),r=n[0]?.toLowerCase()??``,i=n[1]?.toLowerCase()??``,a=(e,t)=>({headline:e,detail:t});if(r===`rm`)return a(`Delete files`,`Deleting files from disk: \`${t}\``);if(r===`mkdir`)return a(`Create a folder`,`Creating a new folder: \`${t}\``);if(r===`mv`)return a(`Move or rename a file`,`Moving or renaming: \`${t}\``);if(r===`cp`)return a(`Copy a file`,`Copying files: \`${t}\``);if(r===`cat`||r===`head`||r===`tail`||r===`less`)return a(`Show file contents`,`Printing file contents: \`${t}\``);if(r===`ls`||r===`tree`||r===`find`)return a(`List files`,`Listing files: \`${t}\``);if(r===`cd`||r===`pwd`)return a(`Check the working folder`,`Checking or changing the current folder: \`${t}\``);if(r===`echo`||r===`printf`)return a(`Print a message`,`Printing a message: \`${t}\``);if(r===`curl`||r===`wget`)return a(`Download from the internet`,`Downloading something from the internet: \`${t}\``);if(r===`kill`||r===`pkill`)return a(`Stop a running program`,`Stopping a running program: \`${t}\``);if(r===`git`)return new Set([`status`,`log`,`diff`,`show`,`branch`,`remote`,`blame`,`config`]).has(i)?a(`Check git history`,`Reading git information (\`git ${i}\`) — no changes are made.`):i===`add`||i===`restore`||i===`reset`?a(`Stage or unstage changes`,`Preparing changes for commit (\`git ${i}\`).`):i===`commit`?a(`Save a checkpoint`,`Saving a snapshot of your changes to git history.`):i===`push`?a(`Send code to the remote`,`Uploading your commits to the remote git repository (e.g. GitHub).`):i===`pull`||i===`fetch`?a(`Get latest from the remote`,`Downloading the newest commits from the remote repository.`):i===`checkout`||i===`switch`?a(`Switch git branch`,`Switching which version of the code is loaded (\`git ${i}\`).`):i===`merge`||i===`rebase`?a(`Combine git branches`,`Combining changes from another branch (\`git ${i}\`).`):a(`Use git`,`Running a git command: \`${t}\``);if(r===`npm`||r===`bun`||r===`pnpm`||r===`yarn`){if(i===`install`||i===`i`||i===`add`)return a(`Install packages`,`Downloading project dependencies from the internet (\`${r} ${i}\`).`);if(i===`run`)return a(`Run a project script`,`Running a project script: \`${t}\``);if(i===`test`)return a(`Run automated tests`,`Running the project's automated tests.`);if(i===`build`)return a(`Build the project`,`Compiling the project for release.`)}return r===`pip`||r===`pip3`||r===`uv`?a(`Install Python packages`,`Installing Python packages: \`${t}\``):r===`pytest`||r===`jest`||r===`vitest`||r===`mocha`||r===`bun`&&i===`test`?a(`Run automated tests`,`Running automated tests: \`${t}\``):r===`docker`||r===`podman`?a(`Use Docker`,`Running a container command: \`${t}\``):r===`ssh`||r===`scp`||r===`rsync`?a(`Talk to another machine`,`Connecting to another computer over the network: \`${t}\``):a(`Run a terminal command`,`Running in the terminal: \`${t}\``)}function ka(e,t){let n=e??``,r=n.toLowerCase(),i=ba(n),a=null;try{let e=JSON.parse(t);e&&typeof e==`object`&&!Array.isArray(e)&&(a=e)}catch{}if(r===`__daemon`){let e=a?.event,t=a?.detail;return typeof e==`string`&&e.length>0?{headline:`SigmaShake itself`,detail:`SigmaShake ${e===`start`?`started`:e===`stop`?`stopped`:e}${typeof t==`string`&&t.length>0?` — ${t}`:``}.`}:{headline:`SigmaShake itself`,detail:`A SigmaShake lifecycle event.`}}if(!a)return{headline:i,detail:`${i}.`};if(r===`bash`||r===`shell`||r===`run_command`||r===`exec`||r===`run_shell_command`){let e=wa(a);return e?Oa(e):{headline:i,detail:`Running a terminal command.`}}if(r===`read`||r===`read_file`||r===`view_file`||r===`cat`||r===`view`){let e=Ca(a);return e?{headline:i,detail:`Reading the file \`${Da(e)}\` so it can understand the current code. No changes are made.`}:{headline:i,detail:`Reading a file. No changes are made.`}}if(r===`write`||r===`write_to_file`||r===`create_file`){let e=Ca(a);return e?{headline:`Save changes to a file`,detail:`Creating or overwriting the file \`${Da(e)}\`. This will replace anything that was there before.`}:{headline:i,detail:`Creating or overwriting a file.`}}if(r===`edit`||r===`multiedit`||r===`patch`||r===`apply_patch`||r===`replace`){let e=Ca(a);return e?{headline:i,detail:`Editing the file \`${Da(e)}\` — changing specific parts of it without rewriting the whole thing.`}:{headline:i,detail:`Editing a file in place.`}}if(r===`grep`||r===`ripgrep`||r===`search`||r===`search_codebase`){let e=Ta(a);return e?{headline:i,detail:`Searching the project for the text "${e}".`}:{headline:i,detail:`Searching the project for matching text.`}}if(r===`glob`||r===`find`||r===`list_files`||r===`ls`){let e=Ta(a)??Ca(a);return e?{headline:i,detail:`Looking for files matching "${e}".`}:{headline:i,detail:`Looking for files in the project.`}}if(r===`webfetch`||r===`fetch`||r===`browser_action`){let e=Ea(a);return e?{headline:i,detail:`Reading a webpage from the internet: ${e}`}:{headline:i,detail:`Reading a webpage from the internet.`}}if(r===`websearch`||r===`search_web`){let e=Ta(a);return e?{headline:i,detail:`Searching the web for "${e}".`}:{headline:i,detail:`Searching the web.`}}return r===`agent`||r===`spawn`?{headline:i,detail:`Asking a separate helper AI to investigate something on its own, then report back. Helps keep this conversation focused.`}:r===`task`||r===`todowrite`||r===`todo_write`?{headline:i,detail:`Updating its internal to-do list so it can keep track of progress on a multi-step task.`}:{headline:i,detail:`${i}.`}}function Aa({val:e}){return e==null?(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] italic font-mono text-xs`,children:`null`}):typeof e==`boolean`?(0,D.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,D.jsx)(`span`,{className:`font-mono tabular-nums text-violet-300 text-xs`,children:e}):typeof e==`string`?e.length===0?(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] italic text-xs font-mono`,children:`empty string`}):e.length>200?(0,D.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,D.jsx)(`span`,{className:`font-mono text-xs text-[var(--color-fg-1)] break-all`,children:e}):(0,D.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 ja({inputJson:e}){let t=[];try{let n=JSON.parse(e);n&&typeof n==`object`&&!Array.isArray(n)&&(t=Object.entries(n))}catch{return(0,D.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,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-xs italic font-mono`,children:`no input fields`}):(0,D.jsx)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] overflow-hidden text-xs`,children:t.map(([e,t],n)=>(0,D.jsxs)(`div`,{className:`flex gap-0 ${n>0?`border-t border-[var(--color-line-0)]`:``}`,children:[(0,D.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,D.jsx)(`div`,{className:`flex-1 min-w-0 px-3 py-2 leading-relaxed`,children:(0,D.jsx)(Aa,{val:t})})]},e))})}var Ma={allow:`green`,block:`red`,force:`amber`,ask:`blue`,log:`gray`},Na={allow:`Allowed`,block:`Blocked`,force:`Forced`,ask:`Held`,log:`Logged`},Pa={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 Fa(e){return e==null?null:e<1e6?`${(e/1e3).toFixed(0)}µs`:`${(e/1e6).toFixed(1)}ms`}function Ia({label:e,value:t,mono:n,children:r}){return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`overline mb-1`,children:e}),r??(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)] text-xs ${n?`font-mono`:``} break-all`,children:t??`—`})]})}function La({text:e}){let[t,n]=(0,_.useState)(!1);return(0,D.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 Ra({row:e,defaultExpanded:t=!1}){let[n,r]=(0,_.useState)(t),i=(0,_.useRef)(null),a=(0,_.useRef)(!0),o=Wr(e.tool,e.input),s=o&&o.length>0?o:e.input&&e.input!==`{}`&&e.input!==``?e.input:`—`,c=Ma[e.decision]??`gray`,l=Pa[e.decision]??`border-l-[var(--color-line-2)]`,u=Ur(e.timestamp),d=Fa(e.duration_ns),f=ka(e.tool,e.input);(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(Si()){e.style.maxHeight=n?`none`:`0`,e.style.opacity=n?`1`:`0`;return}if(n){let t=e.scrollHeight;Bi(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;Bi(e,{"max-height":[`${t}px`,`0px`],opacity:[1,0],duration:180,ease:`outCubic`})}}},[n]);let p=(()=>{try{return JSON.stringify(JSON.parse(e.input),null,2)}catch{return e.input}})();return(0,D.jsxs)(`div`,{className:`border border-[var(--color-line-1)] border-l-2 ${l} rounded-sm bg-[var(--color-surface-1)] overflow-hidden transition-colors hover:border-[var(--color-line-2)] hover:border-l-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer select-none group`,onClick:()=>r(e=>!e),role:`button`,"aria-expanded":n,children:[(0,D.jsx)(`svg`,{className:`shrink-0 w-3 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,D.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),(0,D.jsx)(`time`,{className:`shrink-0 font-mono text-[11px] text-[var(--color-fg-3)] w-14 tabular-nums`,title:u,dateTime:new Date(e.timestamp*1e3).toISOString(),children:Hr(e.timestamp)}),(0,D.jsx)(q,{variant:c,className:`shrink-0 w-20 justify-center`,children:Na[e.decision]??e.decision}),(0,D.jsxs)(`span`,{className:`flex-1 min-w-0 flex items-baseline gap-2`,title:`${f.headline} · ${e.tool}`,children:[(0,D.jsx)(`span`,{className:`text-[12px] text-[var(--color-fg-0)] font-medium truncate`,children:f.headline}),!Sa(e.tool)&&s!==`—`&&(0,D.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)] font-mono truncate hidden sm:inline`,title:s,children:s})]}),d&&(0,D.jsx)(`span`,{className:`shrink-0 hidden md:inline w-12 text-right font-mono text-[10px] text-[var(--color-fg-4)] tabular-nums`,title:`Eval latency: ${d}`,children:d}),(0,D.jsx)(`span`,{className:`shrink-0 w-24 text-right text-[10px] text-[var(--color-fg-3)] truncate`,title:e.client?`Adapter: ${e.client}`:`Unidentified caller`,children:xa(e.client)})]}),(0,D.jsx)(`div`,{ref:i,className:`border-t border-[var(--color-line-0)] overflow-hidden`,style:{maxHeight:n?`none`:`0`,opacity:+!!n},"aria-hidden":!n,children:n&&(0,D.jsxs)(`div`,{className:`px-3 py-3 space-y-4`,children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-3`,children:[(0,D.jsx)(Ia,{label:`When`,value:u}),(0,D.jsx)(Ia,{label:`Decision`,children:(0,D.jsx)(q,{variant:c,children:Na[e.decision]??e.decision})}),(0,D.jsx)(Ia,{label:`Action`,children:(0,D.jsxs)(`span`,{className:`text-xs text-[var(--color-fg-1)]`,children:[f.headline,(0,D.jsxs)(`span`,{className:`ml-2 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`(`,e.tool,`)`]})]})}),e.client&&(0,D.jsx)(Ia,{label:`AI agent`,value:xa(e.client)}),e.rule_id&&(0,D.jsx)(Ia,{label:`Rule ID`,children:(0,D.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,D.jsx)(Ia,{label:`Source File`,value:e.source_file,mono:!0}),d&&(0,D.jsx)(Ia,{label:`Latency`,value:d,mono:!0}),e.rules_evaluated!=null&&(0,D.jsx)(Ia,{label:`Rules Evaluated`,value:`${e.rules_evaluated}`,mono:!0})]}),(0,D.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-3 py-2.5`,children:[(0,D.jsx)(`div`,{className:`overline mb-1`,children:`In plain English`}),(0,D.jsx)(`div`,{className:`text-xs font-medium text-[var(--color-fg-1)] mb-1`,children:f.headline}),(0,D.jsx)(`p`,{className:`text-xs text-[var(--color-fg-2)] leading-relaxed`,children:f.detail})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`overline mb-2`,children:`Tool Input`}),(0,D.jsx)(ja,{inputJson:e.input})]}),(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.rule_id?(0,D.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,D.jsx)(`span`,{}),(0,D.jsx)(La,{text:p})]})]})})]})}var za=[``,`allow`,`block`,`force`,`ask`,`log`],Ba=[``,`claude-code`,`gemini`,`antigravity`,`cursor`,`copilot`,`codex`,`pi`,`generic`],Va=[50,100,250,500],Ha=100;function Ua(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(Ha),[u,d]=(0,_.useState)(0),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(null);Bt([`activity-updated`]),(0,_.useEffect)(()=>{let t=!1,r=new URLSearchParams;return e&&r.set(`decision`,e),n&&r.set(`tool`,n),i&&r.set(`client`,i),r.set(`limit`,String(c)),r.set(`offset`,String(u)),r.set(`envelope`,`1`),h(!0),v(null),fetch(`/api/state/activity?${r.toString()}`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{t||(p(e),h(!1))}).catch(e=>{t||(v(e instanceof Error?e.message:String(e)),h(!1))}),()=>{t=!0}},[e,n,i,c,u]);let y=e=>t=>{e(t.target.value),d(0)},b=(0,_.useMemo)(()=>{if(!f)return[];let e=o.trim().toLowerCase();return e?f.rows.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.rows},[f,o]),x=f?.total??0,S=Math.floor(u/c)+1,C=Math.max(1,Math.ceil(x/c)),w=x===0?0:u+1,T=Math.min(u+(f?.rows.length??0),x),E=`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`,O=`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-3 py-1.5 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed`;return(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h1`,{className:`text-[20px] font-semibold tracking-tight text-[var(--color-fg-0)] leading-tight`,children:`What your AI tried to do`}),(0,D.jsxs)(`p`,{className:`text-[12.5px] text-[var(--color-fg-3)] mt-1 leading-relaxed`,children:[`Every move your AI agent made — and what SigmaShake decided.`,f&&(0,D.jsxs)(`span`,{className:`text-[var(--color-fg-4)] tabular-nums ml-1.5`,children:[`· `,x.toLocaleString(),` action`,x===1?``:`s`,` on record`]})]})]}),(0,D.jsxs)(`div`,{"data-tutorial":`audit-filters`,className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(`select`,{id:`audit-filter-decision`,value:e,onChange:y(t),className:E,children:za.map(e=>(0,D.jsx)(`option`,{value:e,children:e===``?`All decisions`:e===`allow`?`Allowed`:e===`block`?`Blocked`:e===`force`?`Forced`:e===`ask`?`Held`:`Logged`},e))}),(0,D.jsx)(`select`,{id:`audit-filter-client`,value:i,onChange:y(a),className:E,children:Ba.map(e=>(0,D.jsx)(`option`,{value:e,children:e===``?`All AI agents`:e===`claude-code`?`Claude Code`:e===`copilot`?`GitHub Copilot`:e===`codex`?`OpenAI Codex`:e.charAt(0).toUpperCase()+e.slice(1)},e))}),(0,D.jsx)(`input`,{id:`audit-filter-tool`,type:`text`,placeholder:`Filter by tool…`,value:n,onChange:y(r),className:`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] 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,D.jsx)(`select`,{id:`audit-page-size`,value:c,onChange:e=>{l(Number(e.target.value)),d(0)},className:E,title:`Rows per page`,children:Va.map(e=>(0,D.jsxs)(`option`,{value:e,children:[e,` / page`]},e))})]})]}),(0,D.jsx)(`div`,{"data-tutorial":`audit-config`,children:(0,D.jsx)(ha,{})}),(0,D.jsx)(`div`,{"data-tutorial":`audit-sinks`,children:(0,D.jsx)(va,{})}),(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.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,D.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,D.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,D.jsx)(`input`,{id:`audit-search`,type:`text`,placeholder:`Search within this page…`,value:o,onChange:e=>s(e.target.value),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)] transition-colors`}),o&&(0,D.jsx)(`button`,{onClick:()=>s(``),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,D.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,D.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),f&&f.rows.length>0&&(0,D.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-[10px] uppercase tracking-widest text-[var(--color-fg-4)] select-none`,children:[(0,D.jsx)(`span`,{className:`w-3`}),(0,D.jsx)(`span`,{className:`w-14`,children:`When`}),(0,D.jsx)(`span`,{className:`w-20`,children:`Decision`}),(0,D.jsx)(`span`,{className:`flex-1 min-w-0`,children:`Action`}),(0,D.jsx)(`span`,{className:`hidden md:inline w-12 text-right`,children:`Time`}),(0,D.jsx)(`span`,{className:`w-24 text-right`,children:`AI agent`})]}),g&&(0,D.jsxs)(`p`,{className:`text-sm text-red-300 font-mono`,children:[`failed to load audit log: `,g]}),m&&!f&&(0,D.jsx)(`div`,{className:`space-y-1.5`,children:Array.from({length:10}).map((e,t)=>(0,D.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))}),!m&&!g&&b.length===0&&(0,D.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,D.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)]`,children:o?`No actions on this page match your search.`:x===0?`Nothing yet — connect an AI agent and its actions will show up here.`:`No rows on this page match the filter.`}),o&&(0,D.jsx)(`button`,{onClick:()=>s(``),className:`mt-3 text-[11.5px] text-[var(--color-brand)] hover:underline cursor-pointer`,children:`Clear search`})]}),b.length>0&&(0,D.jsx)(`div`,{className:`space-y-1.5`,children:b.map(e=>(0,D.jsx)(Ra,{row:e},e.id))}),f&&x>c&&(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-2`,children:[(0,D.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:[`showing `,w.toLocaleString(),`–`,T.toLocaleString(),` `,`of `,x.toLocaleString()]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`button`,{onClick:()=>d(0),disabled:u===0,className:O,children:`⟪ first`}),(0,D.jsx)(`button`,{onClick:()=>d(Math.max(0,u-c)),disabled:u===0,className:O,children:`‹ prev`}),(0,D.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[`page `,S,` / `,C]}),(0,D.jsx)(`button`,{onClick:()=>d(f.nextOffset==null?u:f.nextOffset),disabled:f.nextOffset==null,className:O,children:`next ›`}),(0,D.jsx)(`button`,{onClick:()=>d((C-1)*c),disabled:f.nextOffset==null,className:O,children:`last ⟫`})]})]})]})}var Wa=Object.freeze([`eval-burst`,`eval-burst-complete`,`counters-updated`]);function Ga(){(0,_.useEffect)(()=>It(Wa),[])}function Ka(){return Ga(),(0,_.useSyncExternalStore)(Dt,Ot).latestBurst}function qa(){return Ga(),(0,_.useSyncExternalStore)(Dt,Ot).burstRing}function Ja(){return Ga(),(0,_.useSyncExternalStore)(Dt,Ot).burstSeq}function Ya(e){return`${e.client}:${e.agent_id??`solo`}`}var Xa=Object.freeze({allow:`#22c55e`,block:`#ef4444`,ask:`#f59e0b`,log:`#60a5fa`,force:`#a855f7`,shadow:`#6b7280`}),Za=5*6e4,Qa=1200,$a=30*6e4,eo=1.4;function Q(e){let t=(e.input_tokens??0)+(e.output_tokens??0);if(t<=0)return 6;let n=6+Math.log2(1+t/50)*eo;return n<4?4:n>16?16:n}function to(e){let t=(e.input_tokens??0)+(e.output_tokens??0);if(t<=0)return 0;let n=Math.log2(1+t/50)*eo/10;return n<=0?0:n>=1?1:n}function no(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function ro(e,t){if(t<=0)return e;let n=e.startsWith(`#`)?e.slice(1):e;if(n.length!==6)return e;let r=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);if(Number.isNaN(r)||Number.isNaN(i)||Number.isNaN(a))return e;let o=Math.max(r,i,a);if(o===0)return e;let s=t>1?1:t,c=(255-o)*s,l=Math.round(r+r/o*c),u=Math.round(i+i/o*c),d=Math.round(a+a/o*c),f=e=>(e<0?0:e>255?255:e).toString(16).padStart(2,`0`);return`#${f(l)}${f(u)}${f(d)}`}var io=new Set([`compact`,`end`,`stop`,`subagent-stop`,`close`]),ao=Object.freeze([`session-lifecycle`]);function oo(e){(0,_.useEffect)(()=>It(ao),[]);let t=(0,_.useSyncExternalStore)(Dt,Ot),[n,r]=(0,_.useState)(new Map),i=(0,_.useRef)(0);(0,_.useEffect)(()=>{let e=t.lifecycleRing;if(e.length<=i.current)return;let n=e.slice(i.current);i.current=e.length,so(n,r)},[t.lifecycleRing]);let a=(0,_.useRef)(void 0);return(0,_.useEffect)(()=>{!e||e===a.current||(a.current=e,so(e,r))},[e]),{closedAt:n,isBurstActive(e,t){let r=n.get(e);return r===void 0||t>r}}}function so(e,t){let n=e.filter(e=>io.has(e.event));n.length!==0&&t(e=>{let t=!1,r=new Map(e);for(let e of n){let n=r.get(e.session_key);(n===void 0||e.ts_ms>n)&&(r.set(e.session_key,e.ts_ms),t=!0)}return t?r:e})}var co=1440*60*1e3,lo=1800*1e3,uo=3e3;function fo(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=po(o);n.has(s)||(n.add(s),r.push(o))}for(;i<e.length;i++){let t=e[i],a=po(t);n.has(a)||(n.add(a),r.push(t))}for(;a<t.length;a++){let e=t[a],i=po(e);n.has(i)||(n.add(i),r.push(e))}return r}function po(e){return e.audit_id??`${e.ts_ms}:${e.tool}:${e.client}`}function mo(e,t){if(e.length===0)return t.slice();if(t.length===0)return e.slice();let n=new Set,r=[];for(let i of[...e,...t]){let e=`${i.session_key}:${i.ts_ms}:${i.event}`;n.has(e)||(n.add(e),r.push(i))}return r}function ho(e,t,n,r=200,i=$a,a=12){let o=new Map,s=new Map;for(let r of e){if(r.ts_ms>n)break;if(Sa(r.tool))continue;let e=Ya(r);if(!t(e,r.ts_ms))continue;let i=o.get(e);i?i.push(r):o.set(e,[r]);let a=s.get(e);(a===void 0||r.ts_ms>a)&&s.set(e,r.ts_ms)}let c=n-i,l=[];for(let[e,t]of s)t<c&&l.push(e);for(let e of l)o.delete(e),s.delete(e);if(o.size>a){let e=new Set(Array.from(s.entries()).sort((e,t)=>t[1]-e[1]).slice(0,a).map(([e])=>e));for(let t of[...o.keys()])e.has(t)||o.delete(t)}let u=[];for(let e of o.values()){let t=e.length>r?e.slice(-r):e;u.push(...t)}return u.sort((e,t)=>e.ts_ms-t.ts_ms),u}function go(e={}){let t=e.windowMs??12e4,n=qa(),[r,i]=(0,_.useState)(()=>({mode:`live`,playhead_ms:Date.now(),window_ms:t})),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(!1);(0,_.useEffect)(()=>{p.current=n.length>0||a.length>0},[n,a]),(0,_.useEffect)(()=>{if(r.mode!==`live`)return;let e=()=>{if(!p.current)return;let e=Date.now();i(t=>t.mode===`live`?t.playhead_ms===e?t:{...t,playhead_ms:e}:t)};e();let t=setInterval(e,500);return()=>clearInterval(t)},[r.mode]);let m=(0,_.useMemo)(()=>fo(a,n),[a,n]),h=(0,_.useMemo)(()=>m.filter(e=>!Sa(e.tool)),[m]),{isBurstActive:g}=oo(s),v=(0,_.useMemo)(()=>ho(m,g,r.playhead_ms),[m,g,r.playhead_ms]),y=m.length>0?m[0].ts_ms:r.playhead_ms,b=m.length>0?m[m.length-1].ts_ms:r.playhead_ms,x=(0,_.useCallback)(async e=>{if(f.current)return;let t=y,n=Math.min(t,(d.current??Date.now())-e);if(n>=t)return;let r=new AbortController;f.current=r,u(!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&&o(e=>{let t=fo(e,i.bursts);return t.length>uo?t.slice(-uo):t}),Array.isArray(i.lifecycle)&&i.lifecycle.length>0&&c(e=>mo(e,i.lifecycle)),d.current=n}catch(e){e.name!==`AbortError`&&console.warn(`[graph] backfill failed`,e)}finally{f.current=null,u(!1)}},[y]);(0,_.useEffect)(()=>{r.playhead_ms-y<r.window_ms*.5&&x(Za)},[r.playhead_ms,r.window_ms,y,x]);let S=(0,_.useRef)(!1);(0,_.useEffect)(()=>{S.current||(S.current=!0,x(lo))},[x]),(0,_.useEffect)(()=>()=>{f.current?.abort(),f.current=null},[]);let C=(0,_.useCallback)(e=>{i(t=>e===`live`?{...t,mode:`live`}:{...t,mode:e})},[]),w=(0,_.useCallback)(e=>{i(t=>({...t,mode:t.mode===`live`?`scrubbing`:t.mode,playhead_ms:e}))},[]),T=(0,_.useCallback)(e=>{i(t=>({...t,window_ms:Math.max(1e3,e)}))},[]),E=(0,_.useCallback)(()=>{i(e=>({...e,mode:`live`,playhead_ms:Date.now()}))},[]),D=(0,_.useCallback)(()=>{i(e=>({...e,mode:`live`,playhead_ms:Date.now(),window_ms:co})),x(co)},[x]);return{snapshot:(0,_.useMemo)(()=>({bursts:v,playback:r,oldest_known_ms:y,newest_known_ms:b,loading_backfill:l}),[v,r,y,b,l]),allBursts:h,setMode:C,setPlayhead:w,setWindow:T,jumpToLive:E,requestBackfill:x,jumpTo24h:D}}function _o(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 vo={"claude-code":`C`,"claude-code-ide":`C`,cursor:`>`,copilot:`H`,codex:`X`,pi:`P`,gemini:`G`,antigravity:`A`};function yo(e){return vo[e.toLowerCase()]??`.`}function bo(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 xo(e,t,n){for(let[r,i]of t){let{x:t,y:a,n:o}=i,s=50+Math.min(o,12)*7,c=bo(r),l=n.get(r),u;l&&Math.abs(l.x-t)<2&&Math.abs(l.y-a)<2&&l.r===s?u=l.grad:(u=e.createRadialGradient(t,a,0,t,a,s),u.addColorStop(0,`hsla(${c},80%,55%,0.10)`),u.addColorStop(1,`hsla(${c},80%,55%,0)`),n.set(r,{grad:u,x:t,y:a,r:s})),e.fillStyle=u,e.beginPath(),e.arc(t,a,s,0,Math.PI*2),e.fill()}for(let e of n.keys())t.has(e)||n.delete(e)}function So(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 Co=`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,wo=`bold 10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,To=new Map,Eo=256;function Do(e,t){let n=To.get(t);if(n!==void 0)return n;let r=e.measureText(t).width;if(To.size>=Eo){let e=To.keys().next().value;e!==void 0&&To.delete(e)}return To.set(t,r),r}function Oo(e,t,n,r,i,a,o){let s=(r.split(`:`)[0]??r).slice(0,18),c=yo(s),l=bo(r),u=Xa[o]??`#6b7280`;e.save(),e.textAlign=`center`;let d=`[${c}] ${s}`,f=`${i.length>14?i.slice(0,14):i} · ${a}`;e.font=wo;let p=Do(e,d);e.font=Co;let m=Do(e,f),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=wo,e.fillText(d,t,n+10),e.globalAlpha=.72,e.fillStyle=u,e.font=Co,e.fillText(f,t,n+21),e.restore()}var ko=`bold 13px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,Ao=`bold 10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;function jo(e){if((!Number.isFinite(e)||e<0)&&(e=0),e<6e4)return`${(e/1e3).toFixed(3)}s`;if(e<36e5)return`${Math.floor(e/6e4)}:${(e%6e4/1e3).toFixed(3).padStart(6,`0`)}`;let t=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4),r=(e%6e4/1e3).toFixed(1).padStart(4,`0`);return`${t}:${String(n).padStart(2,`0`)}:${r}`}function Mo(e,t,n,r,i){e.save(),e.textAlign=`center`,e.font=Ao,e.globalAlpha=.7,e.fillStyle=`hsla(${i},78%,72%,0.55)`,e.fillText(`uptime`,t,n),e.font=ko,e.globalAlpha=.96,e.fillStyle=`hsla(${i},78%,82%,1)`,e.fillText(jo(r),t,n+13),e.restore()}function No(e,t,n,r){e.save(),e.textAlign=`right`,e.font=Ao,e.fillStyle=`rgba(148, 163, 184, 0.55)`,e.globalAlpha=.85,e.fillText(`LIVE`,t,n),e.font=`bold 16px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,e.fillStyle=`#e0e7ff`,e.globalAlpha=.92,e.fillText(jo(r),t,n+16),e.restore()}function Po(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 Fo={Read:`▣`,Write:`✎`,Edit:`✎`,MultiEdit:`✎`,NotebookEdit:`✎`,NotebookRead:`▣`,Glob:`✦`,Grep:`✦`,LS:`⊞`,Find:`✦`,ToolSearch:`⊕`,Bash:`$`,Skill:`◈`,WebFetch:`⌬`,WebSearch:`⌬`,Agent:`◇`,Task:`⌘`,TaskCreate:`⌘`,TaskUpdate:`⌘`,TaskList:`⌘`,TaskGet:`⌘`,TaskOutput:`⌘`,TaskStop:`⌘`,TodoWrite:`✓`,TodoRead:`✓`,AskUserQuestion:`?`,EnterPlanMode:`◐`,ExitPlanMode:`◑`,EnterWorktree:`⎇`,ExitWorktree:`⎇`,PushNotification:`⏰`,ScheduleWakeup:`⏰`,CronCreate:`⏰`,CronList:`⏰`,CronDelete:`⏰`,RemoteTrigger:`↗`,Monitor:`◉`};function Io(e){if(!e)return`·`;let t=e.lastIndexOf(`__`);return Fo[t>=0?e.slice(t+2):e]??Fo[e]??`·`}var Lo=2*Math.PI/6e4,Ro=2.3999632297286535,zo=16,Bo=22,Vo=.4,Ho=14,Uo=8,Wo=24;function Go(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])}if(r.size===0)return;for(let e of r.values())e.sort((e,t)=>e.ts_ms-t.ts_ms);let i=Math.min(t,n)-Wo,a=Array.from(r.keys()).sort(),o=a.length,s=0;for(let e of r.values())e.length>s&&(s=e.length);let c=Math.max(1,Math.min(Bo,(i-zo)/Math.max(1,s-1))),l=zo,u=zo+c,d=(l*l+u*u-Ho*Ho)/(2*l*u),f=Math.max(Vo,Math.acos(Math.min(1,Math.max(-1,d))));if(o<=Uo)for(let e=0;e<o;e++){let t=a[e];if(t===void 0)continue;let n=r.get(t);if(!n)continue;let i=e*2*Math.PI/o;for(let e=0;e<n.length;e++){let t=n[e];t&&(t.slotPhi=i+e*f,t.slotR=zo+e*c)}}else{let e=[];for(let t of r.values())for(let n of t)e.push(n);e.sort((e,t)=>e.ts_ms-t.ts_ms);let t=Math.max(1,Math.min(Bo,(i-zo)/Math.max(1,e.length-1)));for(let n=0;n<e.length;n++){let r=e[n];r&&(r.slotPhi=n*Ro,r.slotR=zo+n*t)}}}function Ko(e,t,n,r){for(let i of e)i.slotR==null||i.slotPhi==null||(i.x=t+i.slotR*Math.cos(i.slotPhi+r),i.y=n+i.slotR*Math.sin(i.slotPhi+r))}function qo(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 Jo(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}var Yo=new Set,Xo=0,Zo=0;function Qo(){for(let e of Yo)e();Yo.size>0&&(Xo=requestAnimationFrame(Qo))}function $o(e){let t=Zo++;return Yo.add(e),Yo.size===1&&(Xo=requestAnimationFrame(Qo)),[()=>{Yo.delete(e),Yo.size===0&&(cancelAnimationFrame(Xo),Xo=0)},t]}var es=820,ts=e=>Math.min(1,e),ns=620,rs=e=>1-(1-e)**3,is=mi({stiffness:120,damping:22,mass:1}),as=1800;function os(e){return e<=2?Math.min(window.devicePixelRatio,2):e<=4?Math.min(window.devicePixelRatio,1.5):Math.min(window.devicePixelRatio,1)}function ss(e){return e<=2?1:e<=4?2:3}function cs(e){return e<=2?24:e<=4?12:6}function ls(e){return e<=4}var us=!1,ds=!1;function fs(){if(ds||typeof window>`u`)return;ds=!0;let e=navigator;typeof e.getBattery==`function`&&e.getBattery().then(e=>{let t=()=>{us=!e.charging&&e.level<.2};t(),e.addEventListener(`chargingchange`,t),e.addEventListener(`levelchange`,t)}).catch(()=>{})}function ps(){return typeof window>`u`?!1:window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches||navigator.connection?.saveData?!0:us}var ms=typeof window<`u`&&new URLSearchParams(window.location.search).get(`fullrate`)===`1`,hs=typeof window<`u`&&new URLSearchParams(window.location.search).get(`rotate`)!==`0`,gs=typeof window<`u`&&new URLSearchParams(window.location.search).get(`probe`)===`1`;function _s(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=_o(s.ts_ms^e),i=n*.6+(t()-.5)*60,a=r/2+(t()-.5)*40,l=Ya(s);o.push({id:c,burst:s,ts_ms:s.ts_ms,session:l,x:i,y:a,vx:0,vy:0,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 vs(e){let{bursts:t,paused:n,selectedId:r,onSelect:i,compact:a=!1,activePanelCount:o=1,labelDensity:s=`normal`,onFrameTime:c}=e,l=(0,_.useRef)(c);l.current=c;let u=(0,_.useRef)(s);u.current=s;let d=(0,_.useRef)(null),f=(0,_.useRef)([]),p=(0,_.useRef)([]),m=(0,_.useRef)(null),h=(0,_.useRef)(null),g=(0,_.useRef)(0),v=(0,_.useRef)(0),y=(0,_.useRef)(0),b=(0,_.useRef)(new Map),x=(0,_.useRef)(new Set),S=(0,_.useRef)(new Set),C=(0,_.useRef)(new Set),[w,T]=(0,_.useState)({w:0,h:0}),E=(0,_.useRef)(0),O=(0,_.useRef)(0),k=(0,_.useRef)(null),ee=(0,_.useRef)(Date.now()),A=(0,_.useRef)(new Map),j=(0,_.useRef)({frame:0,cache:null});(0,_.useLayoutEffect)(()=>{let e=d.current?.parentElement;if(!e)return;let t=e.getBoundingClientRect();t.width>0&&t.height>0&&T({w:Math.max(40,t.width),h:Math.max(40,t.height)});let n=new ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;e<=0||n<=0||T({w:Math.max(40,e),h:Math.max(40,n)})}});return n.observe(e),()=>n.disconnect()},[]),(0,_.useEffect)(()=>{if(w.w<=0||w.h<=0)return;j.current.frame=0;let e=new Map;for(let t of f.current)e.set(t.id,t);f.current=_s(f.current,t,w.w,w.h),Go(f.current,w.w/2,w.h/2);let n=hs&&!Si()?performance.now()*Lo:0;for(let t of f.current){if(t.slotR==null||t.slotPhi==null)continue;let r=w.w/2+t.slotR*Math.cos(t.slotPhi+n),i=w.h/2+t.slotR*Math.sin(t.slotPhi+n),a=!e.has(t.id),o=Math.hypot(t.x-r,t.y-i);(a||o>40)&&(t.x=r,t.y=i,t.vx=0,t.vy=0)}if(p.current=Jo(f.current,1/0),!Si())for(let t=0;t<f.current.length;t++){let n=f.current[t];!n||e.has(n.id)||Ue(n.burst.decision)}let r=f.current.reduce((e,t)=>t.ts_ms>e?t.ts_ms:e,0);v.current=Math.max(performance.now()+es,performance.now()+Qa,r+1500),g.current=performance.now()},[t,w.w,w.h]),(0,_.useEffect)(()=>{let e=d.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;fs();let i=performance.now(),s=0,c=0,h=0,_=.1,[T,D]=$o(()=>{let d=performance.now();if(!ms&&ps()){if(s^=1,s===1)return}else s!==0&&(s=0);if(!ms){let e=ss(o);if(e>1&&(O.current=(O.current+1)%e,O.current!==0))return}let T=performance.now(),E=T<v.current,D=T-g.current<200,M=T-y.current>500,te=Si(),ne=hs&&!te;if(!ne&&!E&&!D&&!M)return;y.current=T;let N=d,P=Math.min(50,N-i);i=N;let F=f.current,re=p.current,I=ne?performance.now()*Lo:0;Ko(F,w.w/2,w.h/2,I);for(let e of F)e.age<1&&(e.age=Math.min(1,e.age+P/es));let L=typeof window<`u`?os(o):1,R=w.w,z=w.h;(e.width!==R*L||e.height!==z*L)&&(e.width=R*L,e.height=z*L,e.style.width=`${R}px`,e.style.height=`${z}px`,t.scale(L,L)),t.fillStyle=`#0a0a0f`,t.fillRect(0,0,R,z);let ie=`${R}x${z}`,B=k.current?.key===ie?k.current.grad:null;if(B||(B=t.createRadialGradient(R/2,z/2,0,R/2,z/2,Math.max(R,z)/1.2),B.addColorStop(0,`rgba(56, 189, 248, 0.06)`),B.addColorStop(1,`rgba(0, 0, 0, 0)`),k.current={key:ie,grad:B}),t.fillStyle=B,t.fillRect(0,0,R,z),!a){let e=j.current;(e.frame++%6==0||e.cache===null)&&(e.cache=qo(F));let n=e.cache;if(xo(t,n,A.current),!te){let e=new Map,r=new Map;for(let t of F)t.exitingAt??(r.set(t.session,(r.get(t.session)??0)+1),e.set(t.session,t));let i=new Map;for(let e of F){if(e.exitingAt!=null)continue;let t=i.get(e.session);(t===void 0||e.ts_ms<t)&&i.set(e.session,e.ts_ms)}let a=Date.now();for(let[o,s]of n){let n=e.get(o),c=r.get(o)??0;if(!n||c===0)continue;let l=50+Math.min(s.n,12)*7;Oo(t,s.x,s.y-l-34,o,n.burst.tool,c,n.burst.decision);let u=i.get(o);if(u!==void 0){let e=Math.max(0,a-u);Mo(t,s.x,s.y+l+12,e,bo(o))}}}}let ae=e=>e.exitingAt==null?1:Math.max(0,1-(N-e.exitingAt)/Qa),oe=cs(o),se=ls(o)&&!te,ce=x.current;if(ce.clear(),n)for(let e of F)ce.add(e.id);else{let e=0;for(let t=F.length-1;t>=0&&e<oe;t--){let n=F[t];!n||n.exitingAt!=null||(ce.add(n.id),e++)}}let le=b.current;le.clear();for(let e of F)le.set(e.id,e);t.lineWidth=2,t.lineCap=`round`,t.lineJoin=`round`;for(let e=0;e<re.length;e++){let n=re[e],r=le.get(n.source),i=le.get(n.target);if(!r||!i||ce.has(r.id)||ce.has(i.id))continue;let a=Math.max(ae(r),ae(i));a<=0||(t.globalAlpha=a,t.strokeStyle=`${Xa[i.burst.decision]??`#6b7280`}aa`,t.beginPath(),t.moveTo(r.x,r.y),t.lineTo(i.x,i.y),t.stroke())}t.globalAlpha=1;let ue=u.current===`large`,de=ue?`10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`:`8px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;for(let e=0;e<re.length;e++){let n=re[e],r=le.get(n.source),i=le.get(n.target);if(!r||!i||!ce.has(r.id)&&!ce.has(i.id))continue;let a=Xa[i.burst.decision]??`#6b7280`,o=Math.max(ae(r),ae(i));if(o<=0)continue;let s=ts(i.age),c=r.x+(i.x-r.x)*s,l=r.y+(i.y-r.y)*s;if(t.globalAlpha=o,t.strokeStyle=`${a}aa`,t.beginPath(),t.moveTo(r.x,r.y),t.lineTo(c,l),t.stroke(),t.globalAlpha=1,se){let n=Math.min(s,(N/as+e*.618033)%1),u=r.x+(i.x-r.x)*n,d=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(u,d,2.5,0,Math.PI*2),t.fill(),t.restore(),Po(t,r.x,r.y,c,l,a,o)}let u=i.ts_ms-r.ts_ms,d=u<1e3?`${u}ms`:u<6e4?`${(u/1e3).toFixed(1)}s`:`${Math.floor(u/6e4)}m${Math.floor(u%6e4/1e3)}s`,f=(r.x+c)/2,p=(r.y+l)/2;t.save(),t.globalAlpha=o*.65*s,t.font=de,t.fillStyle=`#94a3b8`,t.textAlign=`center`,t.textBaseline=`middle`,t.fillText(`${e+1} · ${d}`,f,p-(ue?8:7)),t.restore()}t.globalAlpha=1;let fe=S.current;fe.clear();let pe=C.current;pe.clear();let me=u.current===`large`?10:5;{let e=0;for(let t=F.length-1;t>=0;t--){let r=F[t];!r||r.exitingAt!=null||(!n&&e<3&&fe.add(r.id),e<me&&pe.add(r.id),e++)}}let he=r,ge=m.current;for(let e of F){let r=ae(e);if(r<=0)continue;t.globalAlpha=r;let i=Math.min(1,e.age),o=ts(i);e.displayedRadius=a?4:Q(e.burst);let s=e.displayedRadius,c=a?s*o:(s+2*Math.min(1,e.age))*o,l=Xa[e.burst.decision]??`#6b7280`,d=ro(l,to(e.burst));if((e.id===he||e.id===ge)&&(t.beginPath(),t.arc(e.x,e.y,c+6,0,Math.PI*2),t.fillStyle=`${d}33`,t.fill()),se&&(e.burst.decision===`allow`?So(t,e.x,e.y,i,`#22c55e`,14,.3):e.burst.decision===`ask`&&So(t,e.x,e.y,i,`#f59e0b`,14,.45)),se&&(e.burst.decision===`block`||e.burst.decision===`force`)){let n=i*es;if(n<ns){let r=n/ns,i=c+16*rs(r),a=Math.max(0,1-r)*.75;t.beginPath(),t.arc(e.x,e.y,i,0,Math.PI*2),t.strokeStyle=d+Math.floor(a*255).toString(16).padStart(2,`0`),t.lineWidth=1.5,t.stroke()}}if(!te&&fe.has(e.id)&&(t.beginPath(),t.arc(e.x,e.y,c+2,0,Math.PI*2),t.fillStyle=`${d}33`,t.fill()),t.beginPath(),t.arc(e.x,e.y,Math.max(.1,c),0,Math.PI*2),t.fillStyle=d,t.fill(),t.strokeStyle=l,t.lineWidth=1.5,t.beginPath(),t.arc(e.x,e.y,Math.max(.1,c),0,Math.PI*2),t.stroke(),pe.has(e.id)&&(n||ce.has(e.id))){let n=u.current===`large`;t.font=n?`11px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`:`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.textAlign=`center`,t.fillStyle=`${d}cc`,t.fillText(yo(e.burst.client),e.x,e.y-c-(n?4:3));let i=n?16:12,a=e.burst.tool.length>i?e.burst.tool.slice(0,i):e.burst.tool,o=Io(e.burst.tool),s=o===`·`?a:`${o} ${a}`;t.fillStyle=`${d}88`,t.fillText(s,e.x,e.y+c+(n?13:11));let l=e.burst.input_tokens??0,f=e.burst.output_tokens??0;(l>0||f>0)&&(t.globalAlpha=r*(ce.has(e.id)?.8:.35),t.font=n?`10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`:`8px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.fillStyle=`#94a3b8`,t.textAlign=`center`,t.fillText(`↓${no(l)} ↑${no(f)}`,e.x,e.y+c+(n?25:21)),t.globalAlpha=r),t.textAlign=`left`}(e.id===he||e.id===ge)&&(t.font=`11px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.fillStyle=`#e0e7ff`,t.fillText(e.burst.tool,e.x+c+6,e.y+3))}if(t.globalAlpha=1,se&&F.length>0){let e=null;for(let t=F.length-1;t>=0;t--)if(F[t].exitingAt==null){e=F[t];break}let n=e?Date.now()-e.ts_ms:1/0,r=5e3;if(e&&n<=r){let i=Math.max(0,1-n/r),a=1100,o=N%a/a,s=14+is.fn(o)*8,c=Math.max(0,1-o)*.85*i,l=Math.floor(c*255).toString(16).padStart(2,`0`);t.beginPath(),t.arc(e.x,e.y,s,0,Math.PI*2),t.strokeStyle=`#38bdf8${l}`,t.lineWidth=2,t.stroke();let u=N%800/800*Math.PI*2,d=100/360*Math.PI*2,f=.85*i,p=Math.floor(f*255).toString(16).padStart(2,`0`);t.save(),t.beginPath(),t.arc(e.x,e.y,22,u,u+d),t.strokeStyle=`#38bdf8${p}`,t.lineWidth=2.5,t.lineCap=`round`,t.stroke(),t.restore()}}if(!a&&R>220&&No(t,R-12,12,Date.now()-ee.current),gs){let t,n=0;for(let e of F)e.exitingAt??(n++,t||=e);e.dataset.probeCount=String(n),e.dataset.probeX0=(t?.x??0).toFixed(2),e.dataset.probeY0=(t?.y??0).toFixed(2)}c=c===0?P:c*(1-_)+P*_;let _e=l.current;_e&&N-h>250&&(h=N,_e(c))});return E.current=D,O.current=D,T},[n,r,w.w,w.h,a,o]);function M(e,t){let n=d.current;if(!n)return null;let r=n.getBoundingClientRect(),i=e-r.left,a=t-r.top,o=null,s=200;for(let e of f.current){let t=e.x-i,n=e.y-a,r=t*t+n*n;r<s&&(s=r,o=e.id)}return o}return(0,D.jsxs)(`div`,{className:`relative w-full h-full rounded-sm border border-[var(--color-line-1)] overflow-hidden bg-black`,children:[(0,D.jsx)(`canvas`,{ref:d,className:`block w-full h-full cursor-crosshair`,onMouseMove:e=>{let t=M(e.clientX,e.clientY);m.current=t;let n=h.current;if(!n)return;if(!t){n.style.display=`none`;return}let r=f.current.find(e=>e.id===t);if(!r){n.style.display=`none`;return}let i=r.burst,a=Xa[i.decision]??`#6b7280`,o;if(i.complete_duration_ms!=null&&i.complete_duration_ms>0){let e=i.complete_duration_ms;o=e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(0)}ms`}else{let e=i.duration_ns/1e6;o=e<1?`${(e*1e3).toFixed(0)}µs`:`${e.toFixed(1)}ms`}let s=[];i.input_tokens!=null&&s.push(`↓${no(i.input_tokens)}`),i.output_tokens!=null&&s.push(`↑${no(i.output_tokens)}`);let c=i.input_preview?` · "${i.input_preview.length>45?`${i.input_preview.slice(0,45)}…`:i.input_preview}"`:``,l=s.length>0?` · ${s.join(` `)}`:``;n.textContent=`${i.decision} ${i.tool} · ${o}${l}${c}`,n.style.borderColor=a,n.style.color=a;let u=Math.min(e.clientX+14,window.innerWidth-420),d=Math.max(8,e.clientY-36);n.style.left=`${u}px`,n.style.top=`${d}px`,n.style.display=`block`},onMouseLeave:()=>{m.current=null,h.current&&(h.current.style.display=`none`)},onClick:e=>{i(M(e.clientX,e.clientY),{x:e.clientX,y:e.clientY})}}),t.length===0&&(0,D.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center pointer-events-none px-4 text-center`,children:[(0,D.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`graph · idle`}),(0,D.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,D.jsx)(`br`,{}),`Color = the ssg rule decision · line = same agent's sequence.`]})]}),(0,D.jsx)(`div`,{ref:h,style:{display:`none`,position:`fixed`,zIndex:45,fontSize:`11px`,fontFamily:`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,padding:`4px 10px`,background:`rgba(10, 10, 15, 0.92)`,border:`1px solid`,borderRadius:`4px`,pointerEvents:`none`,whiteSpace:`nowrap`,maxWidth:`500px`,overflow:`hidden`,textOverflow:`ellipsis`}})]})}var ys=3e4,bs=6e4,xs=5e3;function Ss(e,t){let n=t?e.filter(e=>Ya(e)===t):e,r=Date.now(),i=n.length>0?n[n.length-1]:null;if(!i||r-i.ts_ms>xs||!i)return{idle:!0,client:``,tool:``,ruleId:null,decision:``,evalsPerSec:`0.0`,allowPct:0,agents:0,topRules:[]};let a=n.filter(e=>r-e.ts_ms<=ys),o=a.filter(e=>e.decision===`allow`).length,s=a.length>0?Math.round(o/a.length*100):0,c=(a.length/(ys/1e3)).toFixed(1),l=new Set(a.map(e=>`${e.client}:${e.agent_id??`solo`}`)).size,u=n.filter(e=>r-e.ts_ms<=bs&&e.rule_id),d=new Map;for(let e of u){let t=e.rule_id;t&&d.set(t,(d.get(t)??0)+1)}let f=[...d.entries()].sort((e,t)=>t[1]-e[1]).slice(0,4).map(([e])=>e);return{idle:!1,client:i.client,tool:i.tool,ruleId:i.rule_id,decision:i.decision,evalsPerSec:c,allowPct:s,agents:l,topRules:f}}var Cs={allow:`ALLOW`,block:`BLOCK`,ask:`ASK`,log:`LOG`,force:`FORCE`,shadow:`SHADOW`},ws={allow:`#22c55e`,block:`#ef4444`,ask:`#f59e0b`,log:`#60a5fa`,force:`#a855f7`,shadow:`#6b7280`};function Ts({className:e,sessionKey:t}){let n=qa(),r=Ja(),i=(0,_.useRef)(-1),a=(0,_.useRef)(null),o=(0,_.useMemo)(()=>{if(i.current===r&&a.current)return a.current;i.current=r;let e=Ss(n,t);return a.current=e,e},[n,r,t]),s=o.decision?ws[o.decision]??`#6b7280`:`#6b7280`,c=o.decision?Cs[o.decision]??o.decision:``,l=o.client?yo(o.client):``;return o.idle?(0,D.jsxs)(`div`,{className:K(`pointer-events-none select-none`,`flex items-center justify-center gap-2`,`px-4 py-2 rounded-sm`,`bg-[#0a0a0f]/95`,`border border-[var(--color-line-1,#242424)]`,`font-mono text-[11px] text-[var(--color-fg-4,#5a6071)]`,e),children:[(0,D.jsx)(`span`,{className:`status-dot bg-[var(--color-fg-4)] pulse-soft`}),(0,D.jsx)(`span`,{className:`uppercase tracking-wider`,children:`waiting for activity`})]}):(0,D.jsxs)(`div`,{className:K(`pointer-events-none select-none`,`flex flex-col gap-1 px-4 py-2.5 rounded-sm`,`bg-[#0a0a0f]/96`,`border border-[var(--color-line-1,#242424)]`,`font-mono`,!t&&`min-w-[280px] max-w-[460px]`,e),children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-widest text-[var(--color-fg-4,#5a6071)]`,children:[(0,D.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),(0,D.jsx)(`span`,{children:`now evaluating`}),(0,D.jsxs)(`span`,{className:`ml-auto tabular-nums`,children:[o.evalsPerSec,`/s · `,o.allowPct,`% allow · `,o.agents,` `,o.agents===1?`agent`:`agents`]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px] text-[var(--color-fg-0,#f5f5f5)] tracking-tight`,children:[(0,D.jsxs)(`span`,{className:`text-[var(--color-fg-3)] text-[11px] tabular-nums`,children:[`[`,l,`]`]}),(0,D.jsx)(`span`,{className:`text-sky-300`,children:o.client}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`·`}),(0,D.jsx)(`span`,{className:`text-white font-semibold`,children:o.tool}),o.ruleId&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`->`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] text-[12px]`,children:o.ruleId})]}),(0,D.jsx)(`span`,{className:`ml-auto text-[13px] font-bold tabular-nums`,style:{color:s},children:c})]}),o.topRules.length>0&&(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-[var(--color-fg-4)]`,children:[(0,D.jsx)(`span`,{className:`uppercase tracking-wider text-[9px]`,children:`rules`}),o.topRules.map(e=>(0,D.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 Es=(0,_.memo)(function({sessionKey:e,bursts:t,activePanelCount:n,selectedId:r,onSelect:i}){let a=t.length>0?t[t.length-1]?.ts_ms??0:0,o=e.indexOf(`:`),s=o>=0?e.slice(0,o):e,c=o>=0?e.slice(o+1):``,l=c!==``&&c!==`solo`,u=t[t.length-1],d=u?Xa[u.decision]??`#6b7280`:`#6b7280`,f=(0,_.useMemo)(()=>t.length>24?t.slice(t.length-24):t,[t]);return(0,D.jsxs)(`div`,{className:`flex flex-col min-h-0 min-w-0 rounded-sm border border-[var(--color-line-1)] bg-black/30 overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1 border-b border-[var(--color-line-1)] text-[10px] font-mono shrink-0`,children:[(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{background:d},title:u?`latest decision: ${u.decision}`:``}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] uppercase tracking-wider truncate`,children:s}),l&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate`,children:c})]}),(0,D.jsxs)(`span`,{className:`ml-auto text-[var(--color-fg-4)] tabular-nums shrink-0`,children:[t.length,`n`]})]}),(0,D.jsx)(`div`,{className:`flex-1 min-h-0 relative`,children:(0,D.jsx)(vs,{bursts:f,paused:!1,selectedId:r,onSelect:i,burstSeq:a,compact:!0,activePanelCount:n})})]})});function Ds(e){return e<=1?1:e<=4?2:3}function Os(){let e=qa(),t=Ja(),[n,r]=(0,_.useState)(null),{isBurstActive:i}=oo(),a=(0,_.useMemo)(()=>ho(e,i,Date.now()),[e,i]),o=(0,_.useRef)(new Map),s=(0,_.useMemo)(()=>{let e=new Map;for(let t of a){let n=Ya(t),r=e.get(n);r?r.push(t):e.set(n,[t])}let t=o.current;for(let[n,r]of e){let i=t.get(n);i&&i.length===r.length&&i[i.length-1]===r[r.length-1]&&e.set(n,i)}return o.current=e,Array.from(e.entries()).sort((e,t)=>{let n=e[1][e[1].length-1]?.ts_ms??0;return(t[1][t[1].length-1]?.ts_ms??0)-n})},[a]),c=(0,_.useMemo)(()=>{let e=new Map;for(let t of a){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},[a]),l=(0,_.useMemo)(()=>{let e={allow:0,block:0,ask:0,other:0};for(let t of a)t.decision===`allow`?e.allow++:t.decision===`block`||t.decision===`force`?e.block++:t.decision===`ask`?e.ask++:e.other++;return e},[a]),u=(0,_.useMemo)(()=>{let e=new Set,t=0;for(let n of a)n.rule_id&&(e.add(n.rule_id),t+=1);return{distinct:e.size,matched:t,topRule:e.values().next().value}},[a]),d=Ds(s.length);return(0,D.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,D.jsxs)(`header`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-[var(--color-line-1)]`,children:[(0,D.jsx)(`span`,{className:`overline text-[var(--color-fg-3)]`,children:`graph · live`}),(0,D.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[(0,D.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),a.length]}),(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] font-mono`,children:[(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:Xa.allow}}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.allow}),(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ml-1`,style:{background:Xa.block}}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.block}),(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ml-1`,style:{background:Xa.ask}}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.ask})]}),(0,D.jsx)(`span`,{className:`flex-1`}),(0,D.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 active sessions`,children:[u.distinct,` `,u.distinct===1?`rule`:`rules`]}),(0,D.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(`
12
+ `),children:[c.size,` `,c.size===1?`agent`:`agents`]}),(0,D.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,D.jsxs)(`div`,{className:`flex-1 min-h-0 relative`,children:[s.length===0?(0,D.jsx)(vs,{bursts:a,paused:!1,selectedId:n,onSelect:r,burstSeq:t}):(0,D.jsx)(`div`,{className:`absolute inset-0 grid gap-1 p-1`,style:{gridTemplateColumns:`repeat(${d}, minmax(0, 1fr))`,gridAutoRows:`1fr`},children:s.map(([e,t])=>(0,D.jsx)(Es,{sessionKey:e,bursts:t,activePanelCount:s.length,selectedId:n,onSelect:r},e))}),(0,D.jsx)(Ts,{className:`absolute bottom-2 left-2 z-10 max-w-[calc(100%-1rem)]`})]})]})}function ks(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 As(e){return{id:e.id,x:e.x,y:e.y,w:e.w,h:e.h}}function js(e,t){let n=[As(e)],r=t.map(As);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(ks(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 Ms(e){if(e.length===0)return[];let t=[...e].map(As).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)ks(e,r)&&(e.y=r.y+r.h,t=!0)}n.push(e)}return n}function Ns(e,t,n){let r=e.findIndex(e=>e.id===t);if(r===-1)return{panels:e.map(As)};let i=js({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:Ms(e.map(e=>a.get(e.id)).filter(Boolean))}}function Ps({size:e=24,children:t,...n}){return(0,D.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...n,children:t})}var Fs=e=>(0,D.jsx)(Ps,{...e,children:(0,D.jsx)(`path`,{d:`M20 6 9 17l-5-5`})}),Is=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`path`,{d:`M18 6 6 18`}),(0,D.jsx)(`path`,{d:`m6 6 12 12`})]}),Ls=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,D.jsx)(`path`,{d:`M7 10l5 5 5-5`}),(0,D.jsx)(`path`,{d:`M12 15V3`})]}),Rs=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,D.jsx)(`path`,{d:`M17 8l-5-5-5 5`}),(0,D.jsx)(`path`,{d:`M12 3v12`})]}),zs=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`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`}),(0,D.jsx)(`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`}),(0,D.jsx)(`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`})]}),Bs=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`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`}),(0,D.jsx)(`path`,{d:`m15 5 4 4`})]}),Vs=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,D.jsx)(`path`,{d:`M3 3v5h5`})]}),Hs=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`path`,{d:`M3 6h18`}),(0,D.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),(0,D.jsx)(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}),(0,D.jsx)(`path`,{d:`M10 11v6`}),(0,D.jsx)(`path`,{d:`M14 11v6`})]}),Us=e=>(0,D.jsxs)(Ps,{...e,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`9`,r:`1`}),(0,D.jsx)(`circle`,{cx:`19`,cy:`9`,r:`1`}),(0,D.jsx)(`circle`,{cx:`5`,cy:`9`,r:`1`}),(0,D.jsx)(`circle`,{cx:`12`,cy:`15`,r:`1`}),(0,D.jsx)(`circle`,{cx:`19`,cy:`15`,r:`1`}),(0,D.jsx)(`circle`,{cx:`5`,cy:`15`,r:`1`})]}),Ws=[`hero-metrics`,`graph`,`latency-trace`,`throughput`,`decision-mix`,`telemetry-feed`,`system-pulse`,`pending-approvals`,`recent-blocks`],Gs={"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`},Ks={"hero-metrics":{minW:6,minH:2,defaultW:12,defaultH:2},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 qs({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,D.jsxs)(`div`,{ref:i,className:`grid-panel ${t?`grid-panel--edit`:``}`,style:a,role:t?`region`:void 0,"aria-label":t?Gs[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,D.jsx)(`button`,{type:`button`,className:`grid-panel__drag-handle`,title:`Drag ${Gs[e.id]} (or Arrow keys)`,"aria-label":`Drag ${Gs[e.id]}`,onPointerDown:t=>{let n=i.current;n&&r.onDragPointerDown(t,e.id,n)},children:(0,D.jsx)(Us,{size:12,strokeWidth:2})}),(0,D.jsx)(`div`,{className:`grid-panel__content`,"data-reveal":t?void 0:``,children:n}),t&&(0,D.jsx)(`button`,{type:`button`,className:`grid-panel__resize-handle`,title:`Resize ${Gs[e.id]} (or Shift+Arrow keys)`,"aria-label":`Resize ${Gs[e.id]}`,onPointerDown:t=>{let n=i.current;n&&r.onResizePointerDown(t,e.id,n)},children:(0,D.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,"aria-hidden":!0,children:[(0,D.jsx)(`path`,{d:`M10 0 L10 10 L0 10 Z`,fill:`currentColor`,fillOpacity:`0.4`}),(0,D.jsx)(`path`,{d:`M3 10 L10 3 M6 10 L10 6 M9 10 L10 9`,stroke:`currentColor`,strokeWidth:`0.8`,fill:`none`})]})})]})}var Js=(0,_.memo)(qs);function Ys(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 Xs(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=Ks[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=Ks[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}=Ys(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=Ks[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 Zs({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=Xs({gridRef:i,getPanel:(0,_.useCallback)(e=>o.get(e),[o]),onCommit:(0,_.useCallback)(e=>{let t=a.current,{panels:n}=Ns(t,e.id,{x:e.x,y:e.y,w:e.w,h:e.h});r(n)},[r]),enabled:t});return(0,D.jsx)(`div`,{ref:i,className:`grid-layout ${t?`grid-layout--editing`:``}`,"aria-live":t?`polite`:void 0,children:e.map(e=>(0,D.jsx)(Js,{panel:e,isEditing:t,drag:s,children:n[e.id]()},e.id))})}function Qs({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),[O,k]=(0,_.useState)(!1),ee=(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 A(){y.trim()&&(c(y.trim()),b(``),v(!1),h(`Saved "${y.trim()}"`))}function j(){C.trim()&&(l(C.trim()),S(!1),h(`Renamed`))}function M(){let e=i.name;u(i.id),k(!1),h(`Deleted "${e}"`)}function te(){d(),E(!1),h(`Reset to default`)}function ne(){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 N(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,D.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,D.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,D.jsx)(`span`,{className:`overline shrink-0`,children:`layout`}),(0,D.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,D.jsx)(`optgroup`,{label:`Built-in`,children:r.layouts.filter(e=>e.builtIn).map(e=>(0,D.jsx)(`option`,{value:e.id,children:e.name},e.id))}),r.layouts.some(e=>!e.builtIn)&&(0,D.jsx)(`optgroup`,{label:`Your layouts`,children:r.layouts.filter(e=>!e.builtIn).map(e=>(0,D.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),i.builtIn&&(0,D.jsx)(`span`,{className:`chip text-[var(--color-fg-3)]`,title:`Built-in preset`,children:`built-in`})]}),(0,D.jsx)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:t?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(J,{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,D.jsx)(zs,{size:11,strokeWidth:2.25}),`Save as`]}),!i.builtIn&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:()=>{w(i.name),S(!0)},children:[(0,D.jsx)(Bs,{size:11,strokeWidth:2.25}),`Rename`]}),(0,D.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:()=>k(!0),children:[(0,D.jsx)(Hs,{size:11,strokeWidth:2.25}),`Delete`]})]}),(0,D.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:()=>E(!0),title:`Replace the current layout with the Default preset`,children:[(0,D.jsx)(Vs,{size:11,strokeWidth:2.25}),`Reset`]}),(0,D.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:ne,title:`Download current layouts as JSON`,children:[(0,D.jsx)(Ls,{size:11,strokeWidth:2.25}),`Export`]}),(0,D.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:()=>ee.current?.click(),title:`Load layouts from a JSON file`,children:[(0,D.jsx)(Rs,{size:11,strokeWidth:2.25}),`Import`]}),(0,D.jsx)(`input`,{ref:ee,type:`file`,accept:`application/json,.json`,onChange:N,className:`hidden`,"aria-hidden":!0}),(0,D.jsxs)(J,{variant:`primary`,size:`sm`,onClick:()=>n(!1),children:[(0,D.jsx)(Fs,{size:11,strokeWidth:2.5}),`Done`]})]}):(0,D.jsxs)(J,{variant:`secondary`,size:`sm`,onClick:()=>n(!0),children:[(0,D.jsx)(Bs,{size:11,strokeWidth:2.25}),`Edit layout`]})}),g&&(0,D.jsx)($s,{title:`Save layout as`,value:y,placeholder:`My dashboard`,onChange:b,onConfirm:A,onCancel:()=>{v(!1),b(``)},confirmLabel:`Save`}),x&&(0,D.jsx)($s,{title:`Rename layout`,value:C,placeholder:i.name,onChange:w,onConfirm:j,onCancel:()=>S(!1),confirmLabel:`Rename`}),T&&(0,D.jsx)(ec,{title:`Reset this layout?`,body:`The current arrangement will be replaced with the Default preset. Saved layouts are not affected.`,confirmLabel:`Reset`,onConfirm:te,onCancel:()=>E(!1),destructive:!1}),O&&(0,D.jsx)(ec,{title:`Delete "${i.name}"?`,body:`This layout will be removed. You can always recreate it via Save as.`,confirmLabel:`Delete`,onConfirm:M,onCancel:()=>k(!1),destructive:!0}),m&&(0,D.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 $s({title:e,value:t,placeholder:n,onChange:r,onConfirm:i,onCancel:a,confirmLabel:o}){return(0,D.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,D.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,D.jsx)(`div`,{className:`overline mb-2`,children:e}),(0,D.jsx)(`input`,{value:t,onChange:e=>r(e.target.value),placeholder:n,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,D.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,D.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:a,children:[(0,D.jsx)(Is,{size:11,strokeWidth:2.25}),`Cancel`]}),(0,D.jsx)(J,{variant:`primary`,size:`sm`,onClick:i,children:o})]})]})})}function ec({title:e,body:t,confirmLabel:n,destructive:r,onConfirm:i,onCancel:a}){return(0,D.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,D.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,D.jsx)(`div`,{className:`overline mb-2`,children:e}),(0,D.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:t}),(0,D.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,D.jsx)(J,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),(0,D.jsx)(J,{variant:r?`danger`:`primary`,size:`sm`,onClick:i,children:n})]})]})})}var tc={default:`builtin-default`,focusLatency:`builtin-focus-latency`,focusApprovals:`builtin-focus-approvals`,compact:`builtin-compact`},nc={id:tc.default,name:`Default`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:2},{id:`graph`,x:0,y:2,w:8,h:5},{id:`latency-trace`,x:8,y:2,w:4,h:3},{id:`throughput`,x:8,y:5,w:2,h:2},{id:`decision-mix`,x:10,y:5,w:2,h:2},{id:`telemetry-feed`,x:0,y:7,w:12,h:3},{id:`system-pulse`,x:0,y:10,w:12,h:3},{id:`pending-approvals`,x:0,y:13,w:6,h:3},{id:`recent-blocks`,x:6,y:13,w:6,h:3}]},rc={id:tc.focusLatency,name:`Focus · Latency`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:2},{id:`latency-trace`,x:0,y:2,w:8,h:5},{id:`graph`,x:8,y:2,w:4,h:5},{id:`throughput`,x:0,y:7,w:6,h:2},{id:`decision-mix`,x:6,y:7,w:6,h:2},{id:`system-pulse`,x:0,y:9,w:12,h:3},{id:`telemetry-feed`,x:0,y:12,w:12,h:3},{id:`pending-approvals`,x:0,y:15,w:6,h:2},{id:`recent-blocks`,x:6,y:15,w:6,h:2}]},ic={id:tc.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:2},{id:`latency-trace`,x:0,y:9,w:6,h:3},{id:`telemetry-feed`,x:6,y:9,w:6,h:3},{id:`system-pulse`,x:0,y:12,w:12,h:3},{id:`throughput`,x:0,y:15,w:6,h:2},{id:`decision-mix`,x:6,y:15,w:6,h:2}]},ac={id:tc.compact,name:`Compact`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:2},{id:`graph`,x:0,y:2,w:8,h:3},{id:`latency-trace`,x:8,y:2,w:4,h:3},{id:`system-pulse`,x:0,y:5,w:12,h:3},{id:`throughput`,x:0,y:8,w:4,h:2},{id:`decision-mix`,x:4,y:8,w:4,h:2},{id:`telemetry-feed`,x:0,y:10,w:12,h:3},{id:`pending-approvals`,x:0,y:13,w:6,h:2},{id:`recent-blocks`,x:6,y:13,w:6,h:2}]},oc=Object.freeze([nc,rc,ic,ac]);function sc(){return oc.map(e=>({...e,panels:e.panels.map(e=>({...e}))}))}function cc(){return{version:1,activeLayoutId:tc.default,layouts:sc()}}function lc(e){return Object.values(tc).includes(e)}var uc=new Set(Ws),dc=new Set(oc.map(e=>e.id));function fc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pc(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 mc(e,t){let n=(typeof e==`string`?e:``).replace(/[\u0000-\u001F\u007F]/g,``).trim();return n.length===0?t:n.slice(0,40)}function hc(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 gc(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 _c(e){if(!fc(e))return null;let{id:t}=e;if(typeof t!=`string`||!uc.has(t))return null;let n=t,r=Ks[n],i=pc(e.x,0,11,0),a=pc(e.w,r.minW,12,r.defaultW);return{id:n,x:i+a>12?12-a:i,y:pc(e.y,0,999,0),w:a,h:pc(e.h,r.minH,99,r.defaultH)}}function vc(e,t){if(!fc(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=mc(e.name,t),i=dc.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=_c(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:hc(s)},droppedPanels:c}}function yc(e){if(!fc(e)||e.version!==1)return{config:cc(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0};let t=e.layouts;if(!Array.isArray(t)||t.length===0)return{config:cc(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0};let n=[],r=0,i=0,a=0;for(let e of t){let{layout:t,droppedPanels:o}=vc(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:cc(),droppedPanels:r,prunedLayouts:a,fellBackToDefault:!0};let o=new Set(n.map(e=>e.id));for(let e of oc)o.has(e.id)||n.push({...e,panels:e.panels.map(e=>({...e}))});let s=new Map(oc.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(gc(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:oc[0].id,layouts:n},droppedPanels:r,prunedLayouts:a,fellBackToDefault:!1,backfilledPanels:c,refreshedBuiltins:l}}var bc=`ssg:dashboard-layout:v1`,xc=300;function Sc(){if(typeof localStorage>`u`)return null;try{let e=`__ssg_probe__`;return localStorage.setItem(e,`1`),localStorage.removeItem(e),localStorage}catch{return null}}var Cc;function wc(){return Cc===void 0&&(Cc=Sc()),Cc}function Tc(){let e=wc();if(!e)return{config:cc(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!1};let t=null;try{t=e.getItem(bc)}catch{t=null}if(t===null)return{config:cc(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!1};let n=null;try{n=JSON.parse(t)}catch{return{config:cc(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0}}return yc(n)}var Ec=null,Dc=null,Oc=null;function kc(e){return Oc=e,()=>{Oc===e&&(Oc=null)}}function Ac(e){Oc?Oc(e):typeof console<`u`&&console.warn(`[ssg-layout]`,e)}function jc(){if(Dc=null,!Ec)return;let e=wc();if(!e){Ec=null;return}let t=Ec;Ec=null;try{e.setItem(bc,JSON.stringify(t))}catch(e){e instanceof Error&&e.name===`QuotaExceededError`?Ac(`Layout storage full — save skipped`):Ac(`Layout save failed: ${e instanceof Error?e.message:String(e)}`)}}function Mc(e){Ec=e,Dc===null&&(Dc=setTimeout(jc,xc))}function Nc(e){Ec=e,Dc!==null&&(clearTimeout(Dc),Dc=null),jc()}function Pc(e){let t=0;for(let n of e.layouts)n.builtIn||(t+=1);return t}function Fc(e){return e.map(e=>({...e}))}function Ic(){return`user-${Math.random().toString(16).slice(2,11)}`}function Lc(){let[e,t]=(0,_.useState)(()=>Tc().config),[n,r]=(0,_.useState)(null);(0,_.useEffect)(()=>kc(e=>r(e)),[]),(0,_.useEffect)(()=>{Mc(e)},[e]);let i=e.layouts.find(t=>t.id===e.activeLayoutId)??e.layouts[0]??sc()[0],a=Pc(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:Fc(e)}:t)}})},[]),c=(0,_.useCallback)(e=>{let n=e.trim();n&&t(e=>{if(Pc(e)>=12)return e;let t=e.layouts.find(t=>t.id===e.activeLayoutId)??e.layouts[0];if(!t)return e;let r={id:Ic(),name:n,builtIn:!1,panels:Fc(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??oc[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=lc(t.id)?oc.find(e=>e.id===t.id):oc[0];return n?{...e,layouts:e.layouts.map(e=>e.id===t.id?{...e,panels:Fc(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=yc(n);if(r.fellBackToDefault)return{ok:!1,message:`Import rejected: schema invalid, no changes applied`};t(r.config),Nc(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(cc())},[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 Rc=[`rules-changed`,`activity-updated`,`pending-changed`,`runtime-tick`,`limits-breach`],zc={critical:{border:`border-l-red-500/70`,iconBg:`bg-red-500/15`,iconFg:`text-red-400`,chipBg:`bg-red-500/10`,chipFg:`text-red-300`,label:`Critical`},warning:{border:`border-l-amber-400/70`,iconBg:`bg-amber-500/15`,iconFg:`text-amber-300`,chipBg:`bg-amber-500/10`,chipFg:`text-amber-200`,label:`Heads up`},info:{border:`border-l-sky-500/70`,iconBg:`bg-sky-500/15`,iconFg:`text-sky-300`,chipBg:`bg-sky-500/10`,chipFg:`text-sky-200`,label:`Tip`}};function Bc({severity:e}){return e===`critical`?(0,D.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,D.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,D.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}):e===`warning`?(0,D.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.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,D.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,D.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}):(0,D.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,D.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12`,y2:`12`}),(0,D.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12.01`,y2:`8`})]})}function Vc({notification:e,onAction:t}){let[n,r]=(0,_.useState)(`idle`),[i,a]=(0,_.useState)(null),o=zc[e.severity];return(0,D.jsxs)(`div`,{className:`hig-card border-l-2 ${o.border} flex items-start gap-3 px-3 py-2.5`,children:[(0,D.jsx)(`span`,{className:`shrink-0 mt-0.5 inline-flex items-center justify-center w-6 h-6 rounded-full ${o.iconBg} ${o.iconFg}`,"aria-hidden":!0,children:(0,D.jsx)(Bc,{severity:e.severity})}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,D.jsx)(`span`,{className:`text-[9px] font-mono font-medium uppercase tracking-wider px-1.5 py-0.5 rounded ${o.chipBg} ${o.chipFg}`,children:o.label}),(0,D.jsx)(`h3`,{className:`text-[13px] font-medium text-[var(--color-fg-0)] leading-tight`,children:e.title})]}),(0,D.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:e.detail}),n===`error`&&i&&(0,D.jsxs)(`p`,{className:`mt-1.5 text-[11px] font-mono text-red-300`,children:[`Failed: `,i]}),n===`done`&&(0,D.jsx)(`p`,{className:`mt-1.5 text-[11px] font-mono text-emerald-300`,children:`✓ Done — refreshing…`})]}),(0,D.jsx)(`div`,{className:`shrink-0 self-center`,children:e.action?(0,D.jsx)(`button`,{type:`button`,onClick:async()=>{if(e.action&&!(e.action.confirm&&!confirm(e.action.confirm))){r(`loading`),a(null);try{await t(e),r(`done`)}catch(e){r(`error`),a(e instanceof Error?e.message:String(e))}}},disabled:n===`loading`||n===`done`,className:`inline-flex items-center gap-1 h-8 px-3 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-[var(--color-surface-2)] text-[var(--color-fg-1)] border border-[var(--color-line-1)] hover:bg-[var(--color-surface-3)] hover:border-[var(--color-line-2)] transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap`,children:n===`loading`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`animate-spin`,children:`⟳`}),` working…`]}):n===`done`?(0,D.jsx)(D.Fragment,{children:`✓ done`}):e.action.label}):e.link?(0,D.jsxs)(`a`,{href:e.link.href,className:`inline-flex items-center gap-1 h-8 px-3 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-[var(--color-surface-2)] text-[var(--color-fg-1)] border border-[var(--color-line-1)] hover:bg-[var(--color-surface-3)] hover:border-[var(--color-line-2)] transition-colors whitespace-nowrap`,children:[e.link.label,` →`]}):null})]})}function Hc({showEmptyState:e=!1,hideHeader:t=!1}={}){let n=Bt(Rc),{data:r,refetch:i}=V(`/api/json/maintenance`,[n[`rules-changed`],n[`activity-updated`],n[`pending-changed`],n[`runtime-tick`],n[`limits-breach`]]),a=async e=>{if(!e.action)return;let t=await fetch(e.action.url,{method:e.action.method,headers:{Accept:`application/json`,"Content-Type":`application/json`,...H()}});if(!t.ok){let e=await t.text().catch(()=>``);throw Error(e||`HTTP ${t.status}`)}setTimeout(()=>i(),600)},o=r?.notifications??[];return o.length===0&&!e?null:(0,D.jsxs)(`section`,{"data-reveal":!0,children:[!t&&(0,D.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,D.jsx)(`h2`,{className:`overline text-[11px]`,children:o.length===0?`maintenance · all clear`:`maintenance · ${o.length} item${o.length===1?``:`s`}`}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>i(),className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] transition-colors cursor-pointer`,title:`Re-check now`,children:`refresh`})]}),o.length===0?(0,D.jsxs)(`div`,{className:`hig-card border-l-2 border-l-emerald-500/60 px-4 py-5 flex items-center gap-3`,children:[(0,D.jsx)(`span`,{className:`inline-flex items-center justify-center w-8 h-8 rounded-full bg-emerald-500/15 text-emerald-300 shrink-0`,children:(0,D.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,D.jsx)(`path`,{d:`M20 6L9 17l-5-5`})})}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h3`,{className:`text-[13px] font-medium text-[var(--color-fg-0)] leading-tight`,children:`Everything looks good`}),(0,D.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:`No drift, no capacity warnings, no stalled daemons. We'll let you know if anything changes.`})]})]}):(0,D.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,D.jsx)(Vc,{notification:e,onAction:a},e.id))})]})}var Uc=e=>Math.max(0,Math.round(e)).toLocaleString(void 0,{useGrouping:!0});function Wc(e,t){if(e===`spring`){let e=mi();return{ease:e.fn,durationMs:e.duration}}return e===`quart`?{ease:Xr.out,durationMs:t}:{ease:Yr.out,durationMs:t}}var Gc=250;function Kc({value:e,duration:t=320,format:n=Uc,className:r,curve:i=`cubic`}){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)(Si()),f=(0,_.useRef)(null),p=(0,_.useRef)(0);return p.current===0&&(p.current=performance.now()),(0,_.useEffect)(()=>{if(c.current===e)return;if(performance.now()-p.current<Gc){c.current=e,s.current=e,o(e);return}let n=f.current;if(n&&!d.current){for(let e of n.getAnimations())e.id===`lc-value-pulse`&&e.cancel();let e=n.animate([{textShadow:`0 0 0 rgba(245, 158, 11, 0)`},{textShadow:`0 0 10px rgba(245, 158, 11, 0.55)`,offset:.2},{textShadow:`0 0 0 rgba(245, 158, 11, 0)`}],{duration:520,easing:`ease-out`});e.id=`lc-value-pulse`}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:r,durationMs:m}=Wc(i,t),h=e=>{let t=Math.min(1,(e-l.current)/m),n=r(t);o(s.current+(c.current-s.current)*n),t<1?u.current=requestAnimationFrame(h):u.current=null};return u.current=requestAnimationFrame(h),()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null)}},[e,t,i,a]),(0,D.jsx)(`span`,{ref:f,className:K(`tabular-nums`,r),children:n(a)})}function qc({counters:e,className:t,showLegend:n=!0}){let r=[{key:`allow`,label:`Allow`,value:e.allow,color:`var(--color-decision-allow)`,textClass:`text-emerald-300`},{key:`ask`,label:`Ask`,value:e.ask,color:`var(--color-decision-ask)`,textClass:`text-amber-300`},{key:`block`,label:`Block`,value:e.block,color:`var(--color-decision-block)`,textClass:`text-red-300`},{key:`force`,label:`Force`,value:e.force,color:`var(--color-decision-force)`,textClass:`text-sky-300`},{key:`log`,label:`Log`,value:e.log,color:`var(--color-decision-log)`,textClass:`text-violet-300`},{key:`shadow`,label:`Shadow`,value:e.shadow,color:`var(--color-decision-shadow)`,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=Si();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;n||Math.abs(c-s)<.01?e.style.width=`${s}%`:Bi(e,{width:[`${c}%`,`${s}%`],duration:480,ease:`outExpo`}),o.current[t]=s})},[i,r.find]),(0,D.jsxs)(`div`,{className:K(`flex flex-col gap-2`,t),children:[(0,D.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,D.jsx)(`div`,{className:`w-full bg-[var(--color-surface-3)]`}):r.map(e=>(0,D.jsx)(`div`,{"data-seg":e.key,style:{width:`${i===0?0:e.value/i*100}%`,background:e.color}},e.key))}),n?(0,D.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-[11px] font-mono`,children:r.map(e=>(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2 min-w-0`,children:[(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,D.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-sm`,style:{background:e.color}}),(0,D.jsx)(`span`,{className:K(`uppercase tracking-wide truncate`,e.textClass),children:e.label})]}),(0,D.jsx)(Kc,{value:e.value,className:`shrink-0 tabular-nums text-[var(--color-fg-1)]`})]},e.key))}):null]})}function Jc({data:e,width:t=80,height:n=24,color:r=`#38bdf8`,threshold:i,maxValue:a}){if(e.length<2)return(0,D.jsx)(`svg`,{width:t,height:n,className:`shrink-0`,children:(0,D.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,D.jsxs)(`svg`,{width:t,height:n,className:`shrink-0`,children:[(0,D.jsx)(`polyline`,{points:l.join(` `),fill:`none`,stroke:r,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`}),u!==null&&(0,D.jsx)(`line`,{x1:1,y1:u,x2:t-1,y2:u,stroke:`var(--color-brand)`,strokeWidth:1,strokeDasharray:`3,2`,opacity:.7})]})}function Yc(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Xc({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)(Yc());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=()=>{let e=Date.now(),t=e-a,o;if(f.current){let e=f.current;o=[];for(let n of e)n.ts>=t&&o.push(n)}else{let n=d.current;for(;n.length>1&&n[1]?.ts<t;)n.shift();(n.length===0||n[n.length-1]?.ts<e-200)&&n.push({ts:e,v:p.current}),o=n.filter(e=>e.ts>=t)}if(o.length<2)l.current&&l.current.setAttribute(`points`,``),u.current&&u.current.setAttribute(`points`,``);else{let e=n??Math.max(1,...o.map(e=>e.v)),s=[];for(let n of o){let o=(n.ts-t)/a*r,c=i-n.v/e*(i-2)-1;s.push(`${o.toFixed(1)},${c.toFixed(1)}`)}let c=s.join(` `);if(l.current&&l.current.setAttribute(`points`,c),u.current){let e=s[0]?.split(`,`),t=s[s.length-1]?.split(`,`),n=`${e[0]},${i} ${c} ${t[0]},${i}`;u.current.setAttribute(`points`,n)}}};if(m.current){let t=window.setInterval(e,500);return()=>clearInterval(t)}let[t]=$o(e);return t},[r,i,a,n]),(0,D.jsxs)(`svg`,{width:`100%`,height:i,viewBox:`0 0 ${r} ${i}`,className:K(`block`,c),preserveAspectRatio:`none`,children:[(0,D.jsx)(`polygon`,{ref:u,fill:s,stroke:`none`}),(0,D.jsx)(`polyline`,{ref:l,fill:`none`,stroke:o,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`})]})}var Zc=vn(`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`}}),Qc={neutral:`var(--color-fg-1)`,amber:`var(--color-decision-ask)`,green:`var(--color-decision-allow)`,red:`var(--color-decision-block)`,blue:`var(--color-decision-force)`,purple:`var(--color-decision-log)`,gray:`var(--color-fg-3)`},$c={neutral:`color-mix(in srgb, var(--color-fg-1) 10%, transparent)`,amber:`color-mix(in srgb, var(--color-decision-ask) 14%, transparent)`,green:`color-mix(in srgb, var(--color-decision-allow) 14%, transparent)`,red:`color-mix(in srgb, var(--color-decision-block) 14%, transparent)`,blue:`color-mix(in srgb, var(--color-decision-force) 14%, transparent)`,purple:`color-mix(in srgb, var(--color-decision-log) 14%, transparent)`,gray:`color-mix(in srgb, var(--color-fg-3) 10%, transparent)`},el={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)]`},tl=1e3,nl=.35;function rl(e,t,n){let r=Date.now(),i=r-n,a=Math.max(2,Math.floor(n/tl)),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)/tl);e>=0&&e<a&&o[e]++}let s=Array(a),c=o[0];for(let e=0;e<a;e++)c=nl*o[e]+(1-nl)*c,s[e]={ts:i+(e+1)*tl,v:c};return s}function il({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=Qc[d]??Qc.neutral,p=$c[d]??$c.neutral,m=el[d]??el.neutral,h=(0,_.useRef)(null),g=(0,_.useRef)(t);(0,_.useEffect)(()=>{if(g.current===t)return;g.current=t;let e=h.current;e&&Bi(e,{"--tick":[0,1],duration:160,ease:`outCubic`,onComplete:()=>{Bi(e,{"--tick":[1,0],duration:520,ease:`outCubic`,onComplete:e=>{e.style.removeProperty(`--tick`)}})}})},[t]);let v=(0,_.useMemo)(()=>r?rl(r,i,a):null,[r,i,a]),y=v!==null,b=!y&&n&&n.length>=2;return(0,D.jsxs)(`div`,{ref:h,className:K(Zc({tone:s,className:l})),...u,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(`span`,{className:`overline`,children:e}),o?(0,D.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:o}):null]}),(0,D.jsxs)(`div`,{className:`flex items-end justify-between gap-3`,children:[(0,D.jsx)(Kc,{value:t,format:c,className:K(`text-[2.4rem] leading-none font-semibold tracking-tight`,m)}),y?(0,D.jsx)(Xc,{samples:v,width:108,height:36,windowMs:a,color:f,fillColor:p,className:`shrink-0`}):b?(0,D.jsx)(Jc,{data:n,width:96,height:28,color:f}):null]})]})}var al={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 ol(e,t,n=200){let r=Math.max(0,Math.floor(e)),i=Math.max(0,Math.floor(t)),a=Math.max(0,r-al.containerPaddingX),o=Math.max(0,i-al.containerPaddingY),s=o-(al.trendRowH*3+al.trendRowGap*2+al.trendTopPad+al.topToTrendGap),c=s-al.scatterHeaderH-al.scatterLegendH-al.scatterInnerGap>=al.scatterAcceptableMin,l=c?s:o,u=l-al.scatterHeaderH-al.scatterLegendH-al.scatterInnerGap,d=u>=al.scatterAbsoluteMin,f=u>=al.scatterAbsoluteMin&&l>=140,p=Math.floor(l/al.gaugeFootprintFactor),m=Math.floor(a*.45/al.gaugeFootprintFactor),h=Math.max(al.gaugeAbsoluteMin,Math.min(al.gaugeAbsoluteMax,n,p,m)),g=Math.ceil(h*al.gaugeFootprintFactor+8),_=l-(d?al.scatterHeaderH:0)-(f?al.scatterLegendH:0)-al.scatterInnerGap;return{gaugeSize:h,gaugeColumnMaxWidth:g,scatterMinHeight:Math.max(al.scatterAbsoluteMin,Math.min(160,_)),showTrendRows:c,showScatterHeader:d,showLegend:f,variant:o>=480?`wide`:o>=300?`normal`:`compact`}}var sl=135,cl=405,ll=cl-sl,ul=`#34d399`,dl=`#f59e0b`,fl=`#ef4444`;function pl(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 ml(e,t,n,r,i){let a=pl(e,t,n,r),o=pl(e,t,n,i),s=+(i-r>180);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 hl(e,t){return sl+Math.max(0,Math.min(1,e/Math.max(t,1e-9)))*ll}function gl(e,t,n){return e+(t-e)*n}function _l(e){let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]}function vl(e,t,n){let[r,i,a]=_l(e),[o,s,c]=_l(t);return`rgb(${Math.round(gl(r,o,n))},${Math.round(gl(i,s,n))},${Math.round(gl(a,c,n))})`}function yl(e,t,n){let r=.04;return e<t-r?ul:e<t+r?vl(ul,dl,(e-(t-r))/(r*2)):e<n-r?dl:e<n+r?vl(dl,fl,(e-(n-r))/(r*2)):fl}function bl(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var xl=0;function Sl(){return xl=xl+1|0,xl.toString(36)}function Cl({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)(()=>ml(x,S,C,sl,cl),[x,S,C]),E=(0,_.useMemo)(()=>ml(x,S,C-8,sl,cl),[x,S,C]),O=sl+n*ll,k=sl+r*ll,ee=(0,_.useMemo)(()=>ml(x,S,C,sl,O),[x,S,C,O]),A=(0,_.useMemo)(()=>ml(x,S,C,O,k),[x,S,C,O,k]),j=(0,_.useMemo)(()=>ml(x,S,C,k,cl),[x,S,C,k]),M=(0,_.useMemo)(()=>ml(x,S,C-14,300,420),[x,S,C]),te=sl+w*ll,ne=(0,_.useMemo)(()=>ml(x,S,C,sl,Math.max(sl+.01,te)),[x,S,C,te]),N=yl(w,n,r),P=(0,_.useMemo)(()=>Sl(),[]),F=`lgf-${P}`,re=`lgb-${P}`,I=`lgd-${P}`,L=`lgh-${P}`,R=`lgg-${P}`,z=`lgl-${P}`,ie=(0,_.useMemo)(()=>{if(u!==`needle`)return[];let e=[];for(let t=0;t<=10;t++)e.push(sl+t/10*ll);return e},[u]),B=(0,_.useMemo)(()=>{if(u!==`needle`)return[];let e=[];for(let t=0;t<=40;t++)t%4!=0&&e.push(sl+t/40*ll);return e},[u]),ae=(0,_.useRef)(null),oe=(0,_.useRef)(null),se=(0,_.useRef)(null),ce=(0,_.useRef)(null),le=(0,_.useRef)(null),ue=(0,_.useRef)(null),de=(0,_.useRef)(null),fe=(0,_.useRef)(null),pe=(0,_.useRef)([]),me=(0,_.useRef)(e),he=(0,_.useRef)(t),ge=(0,_.useRef)(n),_e=(0,_.useRef)(r);(0,_.useEffect)(()=>{me.current=e,he.current=t,ge.current=n,_e.current=r},[e,t,n,r]);let ve=(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=sl+(r+.5)/e*ll;n.push(pl(x,S,t,i))}return n},[p,m,u,x,S,C]);pe.current.length!==ve.length&&(pe.current.length=ve.length);let ye=x+C-6,be=x+d*.04,xe=Math.max(2,d*.016),Se=`${ye},${S} ${be},${S-xe} ${be},${S+xe}`,Ce=x-d*.04,we=x-C*.24,Te=Math.max(1.4,d*.012),Ee=`${we},${S} ${Ce},${S-Te} ${Ce},${S+Te}`,De=d*.48,Oe=d*.17,ke=x-De/2,Ae=S+d*.16,je=Ae+Oe*.68;return(0,_.useEffect)(()=>{let e=bl(),t=performance.now(),n=me.current,r=0,i=me.current,a=0,o=me.current,s=``,l=``,d=``,f=-1,m=``,h=``,[g]=$o(()=>{let g=performance.now(),_=(g-t)/1e3;t=g;let v=Math.min(.04,Math.max(.001,_)),y=me.current,b=he.current,w=ge.current,T=_e.current,E=Math.max(b,1e-9),D=y;if(e)n=y,i=y,o=y,r=0,a=0;else{let e=v/2;for(let t=0;t<2;t++){let t=-210*(n-D)-22*r;r+=t*e,n+=r*e;let o=-55*(i-n)-13*a;a+=o*e,i+=a*e}let t=1-Math.exp(-v*8);o+=(y-o)*t,Math.abs(n-y)<E*1e-5&&Math.abs(r)<1e-4&&(n=y,r=0),Math.abs(o-y)<E*1e-5&&(o=y)}let O=Math.max(0,Math.min(1,n/Math.max(b,1e-9))),k=sl+O*ll,ee=sl+Math.max(0,Math.min(1,i/Math.max(b,1e-9)))*ll,A=yl(O,w,T),j=`rotate(${(k-90).toFixed(3)} ${x} ${S})`;ae.current&&j!==s&&(ae.current.setAttribute(`transform`,j),s=j),A!==d&&(oe.current&&oe.current.setAttribute(`fill`,A),se.current&&se.current.setAttribute(`fill`,A),ce.current&&ce.current.setAttribute(`stroke`,A),ue.current&&ue.current.setAttribute(`fill`,A),d=A);let M=`rotate(${(ee-90).toFixed(3)} ${x} ${S})`;if(le.current&&M!==l&&(le.current.setAttribute(`transform`,M),l=M),de.current&&c){let e=c(o);e!==h&&(de.current.textContent=e,h=e)}if(fe.current&&u===`ring`){let e=ml(x,S,C,sl,Math.max(sl+.01,k));e!==m&&(fe.current.setAttribute(`d`,e),m=e)}if(p&&u===`needle`){let e=Math.round(O*1e3)/1e3;if(e!==f){f=e;let t=pe.current,n=t.length;if(n>0){let e=1/n;for(let r=0;r<n;r++){let i=t[r];if(!i)continue;let a=(r+.5)/n,o=O-a,s=Math.max(0,Math.min(1,.5+o/e));i.setAttribute(`fill`,yl(a,w,T)),i.setAttribute(`opacity`,s.toFixed(3))}}}}});return g},[x,S,C,u,p,c]),(0,D.jsxs)(`div`,{className:K(`flex flex-col items-center justify-center gap-1 min-h-0 min-w-0`,f),children:[(0,D.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,D.jsxs)(`defs`,{children:[(0,D.jsxs)(`filter`,{id:F,x:`-40%`,y:`-40%`,width:`180%`,height:`180%`,children:[(0,D.jsx)(`feGaussianBlur`,{stdDeviation:`1.2`,result:`blur`}),(0,D.jsxs)(`feMerge`,{children:[(0,D.jsx)(`feMergeNode`,{in:`blur`}),(0,D.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,D.jsxs)(`radialGradient`,{id:re,cx:`50%`,cy:`32%`,r:`80%`,children:[(0,D.jsx)(`stop`,{offset:`0%`,stopColor:`#4e535d`}),(0,D.jsx)(`stop`,{offset:`55%`,stopColor:`#2a2e36`}),(0,D.jsx)(`stop`,{offset:`100%`,stopColor:`#0b0d11`})]}),(0,D.jsxs)(`radialGradient`,{id:I,cx:`50%`,cy:`45%`,r:`75%`,children:[(0,D.jsx)(`stop`,{offset:`0%`,stopColor:`#1b1f27`}),(0,D.jsx)(`stop`,{offset:`80%`,stopColor:`#0a0c10`}),(0,D.jsx)(`stop`,{offset:`100%`,stopColor:`#05060a`})]}),(0,D.jsxs)(`radialGradient`,{id:L,cx:`40%`,cy:`30%`,r:`70%`,children:[(0,D.jsx)(`stop`,{offset:`0%`,stopColor:`#f4f5f8`}),(0,D.jsx)(`stop`,{offset:`45%`,stopColor:`#aab1bd`}),(0,D.jsx)(`stop`,{offset:`100%`,stopColor:`#1c1f26`})]}),(0,D.jsxs)(`linearGradient`,{id:R,x1:`50%`,y1:`0%`,x2:`50%`,y2:`100%`,children:[(0,D.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`0.22`}),(0,D.jsx)(`stop`,{offset:`100%`,stopColor:`#ffffff`,stopOpacity:`0`})]}),(0,D.jsxs)(`linearGradient`,{id:z,x1:`50%`,y1:`0%`,x2:`50%`,y2:`100%`,children:[(0,D.jsx)(`stop`,{offset:`0%`,stopColor:`#0a0c11`}),(0,D.jsx)(`stop`,{offset:`100%`,stopColor:`#15181f`})]})]}),u===`needle`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`circle`,{cx:x,cy:S,r:C+12,fill:`url(#${re})`,stroke:`#000`,strokeOpacity:.55,strokeWidth:1}),(0,D.jsx)(`circle`,{cx:x,cy:S,r:C+5,fill:`none`,stroke:`#0a0c11`,strokeWidth:1}),(0,D.jsx)(`circle`,{cx:x,cy:S,r:C-2,fill:`url(#${I})`})]}):null,(0,D.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,D.jsx)(`path`,{d:E,fill:`none`,stroke:`var(--color-line-0)`,strokeWidth:1,strokeLinecap:`round`,opacity:.55}):null,u===`needle`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`path`,{d:ee,fill:`none`,stroke:ul,strokeWidth:5,strokeLinecap:`round`,opacity:.78}),(0,D.jsx)(`path`,{d:A,fill:`none`,stroke:dl,strokeWidth:5,strokeLinecap:`round`,opacity:.82}),(0,D.jsx)(`path`,{d:j,fill:`none`,stroke:fl,strokeWidth:5,strokeLinecap:`round`,opacity:.9}),B.map((e,t)=>{let n=pl(x,S,C-4,e),r=pl(x,S,C+2,e);return(0,D.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}`)}),ie.map((e,t)=>{let n=pl(x,S,C-8,e),r=pl(x,S,C+4,e);return(0,D.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?ve.map((e,t)=>(0,D.jsx)(`circle`,{ref:e=>{pe.current[t]=e},cx:e.x,cy:e.y,r:Math.max(1.6,d*.013),fill:ul,opacity:0,filter:`url(#${F})`},t)):null,i===void 0?null:(0,D.jsx)(wl,{cx:x,cy:S,r:C,angle:hl(i,t),emphasis:!0}),a===void 0?null:(0,D.jsx)(wl,{cx:x,cy:S,r:C,angle:hl(a,t),emphasis:!0}),l?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Tl,{cx:x,cy:S,r:C,angle:O,text:l(n),size:d}),(0,D.jsx)(Tl,{cx:x,cy:S,r:C,angle:k,text:l(r),size:d}),(0,D.jsx)(Tl,{cx:x,cy:S,r:C,angle:cl,text:l(1),size:d})]}):null,(0,D.jsx)(`path`,{d:M,fill:`none`,stroke:`url(#${R})`,strokeWidth:d*.14,strokeLinecap:`butt`}),c||s!==void 0?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`rect`,{x:ke,y:Ae,width:De,height:Oe,rx:d*.022,ry:d*.022,fill:`url(#${z})`,stroke:`#242a33`,strokeWidth:1}),(0,D.jsx)(`rect`,{x:ke+1,y:Ae+1,width:De-2,height:1,fill:`#ffffff`,opacity:.08})]}):null,(0,D.jsx)(`g`,{ref:le,opacity:.28,children:(0,D.jsx)(`polygon`,{ref:ue,points:Se,fill:N})}),(0,D.jsxs)(`g`,{ref:ae,children:[(0,D.jsx)(`polygon`,{ref:oe,points:Se,fill:N,stroke:`#05070a`,strokeWidth:.6}),(0,D.jsx)(`polygon`,{ref:se,points:Ee,fill:N,opacity:.7})]}),(0,D.jsx)(`circle`,{cx:x,cy:S,r:d*.06,fill:`url(#${L})`,stroke:`#06080c`,strokeWidth:1}),(0,D.jsx)(`circle`,{ref:ce,cx:x,cy:S,r:d*.036,fill:`#0a0c11`,stroke:N,strokeWidth:1.4}),(0,D.jsx)(`circle`,{cx:x,cy:S,r:d*.012,fill:`#f5f7fb`,opacity:.9})]}):(0,D.jsx)(`path`,{ref:fe,d:ne,fill:`none`,stroke:N,strokeWidth:12,strokeLinecap:`round`}),u===`needle`&&(c||s!==void 0)?c?(0,D.jsx)(`text`,{ref:de,x,y:je,textAnchor:`middle`,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:d*.1,fontWeight:600,fill:`#e8ecf3`,children:c(e)}):(0,D.jsx)(`text`,{x,y:je,textAnchor:`middle`,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:d*.1,fontWeight:600,fill:`#e8ecf3`,children:s}):c?(0,D.jsx)(`text`,{ref:de,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,D.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,D.jsx)(`span`,{className:`overline shrink-0 tracking-[0.12em] uppercase`,children:o}):null]})}function wl({cx:e,cy:t,r:n,angle:r,emphasis:i=!1}){let a=pl(e,t,n-(i?10:6),r),o=pl(e,t,n+(i?8:6),r);return(0,D.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 Tl({cx:e,cy:t,r:n,angle:r,text:i,size:a}){let o=pl(e,t,n+Math.max(16,a*.1),r),s=r>=135&&r<215?`end`:r>=325?`start`:`middle`;return(0,D.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 El={allow:`#34d399`,block:`#ef4444`,ask:`#f59e0b`,log:`#a78bfa`,force:`#38bdf8`,shadow:`#6e7076`};function Dl(e){return!Number.isFinite(e)||e<=0?`—`:e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:`${(e/1e6).toFixed(2)} ms`}function Ol({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)(()=>ol(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/4)*4,i=Math.round(e.height/4)*4;t===n&&i===r||(n=t,r=i,p(ol(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:El[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=0,o=0,s=8e3,c=.25,l=1e3,u=n*1e6,d=Math.log10(l),f=Math.log10(u),[p]=$o(()=>{let n=window.devicePixelRatio||1,p=e.clientWidth,m=e.clientHeight;if(p===0||m===0)return;(p!==a||m!==o||n!==i)&&(e.width=Math.floor(p*n),e.height=Math.floor(m*n),t.setTransform(n,0,0,n,0,0),a=p,o=m,i=n),t.clearRect(0,0,p,m),t.strokeStyle=`rgba(110, 112, 118, 0.18)`,t.lineWidth=1,t.setLineDash([2,4]);let g=[{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 g){if(e.ns<l||e.ns>u)continue;let n=m-(Math.log10(e.ns)-d)/(f-d)*m;t.beginPath(),t.moveTo(0,n),t.lineTo(p-28,n),t.stroke(),t.fillText(e.label,p-26,n)}t.setLineDash([]);let _=Date.now(),v=_-r,y=h.current;for(;y.length&&y[0]?.ts<v;)y.shift();t.globalCompositeOperation=`source-over`;for(let e of y){let n=(e.ts-v)/r*p,i=Math.max(l,Math.min(u,e.durationNs)),a=m-(Math.log10(i)-d)/(f-d)*m,o=_-e.ts,h;if(o<=s)h=1-o/s*(1-c);else{let e=r-s;h=e>0?Math.max(0,c*(1-(o-s)/e)):0}h<=0||(t.globalAlpha=h,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,m-2),t.textAlign=`right`,t.fillText(`now →`,p-4,m-2),t.textAlign=`left`});return p},[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]}},[]);return(0,D.jsxs)(`div`,{ref:d,"data-lt-variant":f.variant,className:K(`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,D.jsxs)(`div`,{className:K(`grid gap-3 min-h-0 flex-1`,`grid-cols-[auto_1fr]`),children:[(0,D.jsx)(`div`,{className:`flex items-stretch justify-center overflow-hidden min-h-0 min-w-0`,style:{maxWidth:f.gaugeColumnMaxWidth},children:(0,D.jsx)(Cl,{value:l,max:n,warnAt:Math.min(.85,.5/n),critAt:Math.min(.92,2/n),marker50:c,marker99:u,displayFormat:e=>Dl(e*1e6),scaleLabels:f.gaugeSize>=130?e=>Dl(e*n*1e6):void 0,size:f.gaugeSize,label:`p95 latency`})}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0 min-h-0 flex-1`,children:[f.showScatterHeader?(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3 shrink-0 min-w-0`,children:[(0,D.jsx)(`span`,{className:`overline truncate min-w-0`,children:`live trace · 30 s scatter`}),(0,D.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,D.jsx)(`div`,{className:`shrink-0`,children:(0,D.jsx)(kl,{})}):null,(0,D.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,D.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,D.jsx)(Al,{label:`p50 · median`,value:Dl(e?.p50_ns??0),color:`#34d399`,fill:`rgba(52, 211, 153, 0.14)`,samples:y.p50,windowMs:i*1e3}),(0,D.jsx)(Al,{label:`p95 · 95th`,value:Dl(e?.p95_ns??0),color:`#38bdf8`,fill:`rgba(56, 189, 248, 0.14)`,samples:y.p95,windowMs:i*1e3}),(0,D.jsx)(Al,{label:`p99 · 99th`,value:Dl(e?.p99_ns??0),color:`#6366f1`,fill:`rgba(99, 102, 241, 0.14)`,samples:y.p99,windowMs:i*1e3})]}):null]})}function kl(){return(0,D.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:El.allow},{key:`ask`,color:El.ask},{key:`block`,color:El.block},{key:`force`,color:El.force},{key:`log`,color:El.log},{key:`shadow`,color:El.shadow}].map(e=>(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,D.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full`,style:{background:e.color}}),(0,D.jsx)(`span`,{className:`uppercase tracking-wide`,children:e.key})]},e.key))})}function Al({label:e,value:t,color:n,fill:r,samples:i,windowMs:a}){return(0,D.jsxs)(`div`,{className:`grid grid-cols-[72px_minmax(0,1fr)_92px] items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`overline text-right truncate min-w-0`,children:e}),(0,D.jsx)(Xc,{samples:i,width:1200,height:28,windowMs:a,color:n,fillColor:r,className:`w-full h-7`}),(0,D.jsx)(`span`,{className:`text-[11px] font-mono tabular-nums text-right truncate min-w-0`,style:{color:n},title:t,children:t})]})}function jl(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 Ml(e,t){if(t===void 0||t<=0)return`var(--color-brand)`;let n=e/t;return n>=.9?`var(--color-decision-block)`:n>=.7?`var(--color-decision-ask)`:`var(--color-decision-allow)`}function Nl(e){return e===`var(--color-decision-block)`?`color-mix(in srgb, var(--color-decision-block) 14%, transparent)`:e===`var(--color-decision-ask)`?`color-mix(in srgb, var(--color-decision-ask) 14%, transparent)`:e===`var(--color-decision-allow)`?`color-mix(in srgb, var(--color-decision-allow) 14%, transparent)`:e===`var(--color-decision-log)`?`color-mix(in srgb, var(--color-decision-log) 14%, transparent)`:`color-mix(in srgb, var(--color-brand) 12%, transparent)`}function $(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 Pl({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=Ml(e,n),p=Ml(r,a),m=`var(--color-decision-log)`,h=(0,_.useMemo)(()=>$(t,d),[t]),g=(0,_.useMemo)(()=>$(i,d),[i]),v=(0,_.useMemo)(()=>$(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=Bi(e,{translateY:[28,0],scale:[.94,1],opacity:[0,1],duration:720,delay:vi(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,D.jsx)(`div`,{className:K(`rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] p-3`,u),children:(0,D.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:[(0,D.jsx)(Fl,{registerRef:e=>y.current[0]=e,label:`CPU`,color:f,fill:Nl(f),pulse:b,valueNode:(0,D.jsxs)(`span`,{children:[(0,D.jsx)(Kc,{value:e,format:e=>e.toFixed(1),className:`text-[var(--color-fg-0)]`}),(0,D.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,D.jsx)(Fl,{registerRef:e=>y.current[1]=e,label:`Memory`,color:p,fill:Nl(p),pulse:x,valueNode:(0,D.jsxs)(`span`,{children:[(0,D.jsx)(Kc,{value:r,format:e=>e.toFixed(0),className:`text-[var(--color-fg-0)]`}),(0,D.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,D.jsx)(Fl,{registerRef:e=>y.current[2]=e,label:`Heap`,color:m,fill:Nl(m),valueNode:(0,D.jsxs)(`span`,{children:[(0,D.jsx)(Kc,{value:o,format:e=>e.toFixed(0),className:`text-[var(--color-fg-0)]`}),(0,D.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,D.jsx)(Fl,{registerRef:e=>y.current[3]=e,label:`Uptime`,color:`var(--color-fg-2)`,fill:`rgba(214, 215, 217, 0.04)`,valueNode:(0,D.jsx)(`span`,{className:`text-[var(--color-fg-0)] tabular-nums`,children:jl(l)}),subText:`since daemon start`})]})})}function Fl({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=Bi(u.current,{"--breach":[0,1],duration:420,ease:`outCubic`,onComplete:()=>{e||!u.current||(t=Bi(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,D.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,D.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,D.jsx)(`span`,{className:`overline`,children:e}),n?(0,D.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:n}):null]}),(0,D.jsx)(`span`,{className:`text-[1.9rem] leading-none font-semibold tracking-tight font-mono`,style:{color:r},children:t}),a&&a.length>=2?(0,D.jsx)(`div`,{className:`mt-auto`,children:(0,D.jsx)(Xc,{samples:a,width:320,height:64,windowMs:s??6e4,color:r,fillColor:i,maxValue:o,className:`w-full`})}):(0,D.jsx)(`div`,{className:`mt-auto h-[64px] flex items-end`,children:(0,D.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`— no series —`})})]})}var Il=vn(`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`}}),Ll={allow:`#34d399`,block:`#ef4444`,ask:`#f59e0b`,log:`#a78bfa`,force:`#38bdf8`,shadow:`#6e7076`},Rl={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 zl(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 Bl(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 Vl(e){return e.variant===`raw`?(0,D.jsx)(Ul,{...e}):(0,D.jsx)(Hl,{...e})}function Hl({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&&(Si()||Bi(t,{translateX:[-10,0],opacity:[0,1],duration:220,ease:`outExpo`}))},[d,s]),(0,D.jsxs)(`div`,{className:K(Il({density:a,className:i})),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,D.jsx)(`div`,{className:`overflow-auto`,style:{height:o},children:d.length===0?(0,D.jsx)(`div`,{className:`px-3 py-4 text-[var(--color-fg-4)]`,children:`— waiting for events —`}):d.map((e,t)=>{let n=e.input_preview&&e.input_preview.length>0?e.input_preview:e.rule_id?`rule: ${e.rule_id}`:`—`;return(0,D.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 minmax(80px, 130px) minmax(0, 1fr) 70px 80px`,borderLeft:`3px solid ${Ll[e.decision]??`#666`}`},children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:zl(e.ts_ms)}),(0,D.jsx)(`span`,{className:K(`uppercase tracking-wide font-medium`,Rl[e.decision]??`text-[var(--color-fg-2)]`),children:e.decision}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,title:e.tool?`${e.tool} — ${ba(e.tool)}`:`unknown tool`,children:e.tool||`—`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] truncate`,title:n,children:n}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums text-right`,children:Bl(e.duration_ns)}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate text-right`,title:e.client,children:e.client})]},e.audit_id??`${e.ts_ms}:${e.tool}`)})}),s?(0,D.jsx)(Wl,{}):null]})}function Ul({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,D.jsxs)(`div`,{className:K(Il({density:r,className:n})),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[(0,D.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,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`— empty —`}):l.map((e,t)=>(0,D.jsx)(`div`,{className:`hover:bg-[var(--color-surface-2)]`,children:e},`${t}:${e.slice(0,40)}`))}),a?(0,D.jsx)(Wl,{}):null]})}function Wl(){return(0,D.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`})}function Gl(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,Si()){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`}),Bi(Array.from(i),{opacity:[0,1],translateY:[c,0],duration:l,ease:`outBack(1.2)`,delay:vi(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(!Si()){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}var Kl=`ssg.sfx.enabled`;function ql(){if(typeof window>`u`)return!1;try{return window.localStorage.getItem(Kl)===`true`}catch{return!1}}function Jl(e){if(!(typeof window>`u`))try{window.localStorage.setItem(Kl,String(e))}catch{}}function Yl(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 Xl(){let[e,t]=(0,_.useState)(ql),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(Jl(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`:Yl(i,a,110,55,150,.08);break;case`force`:Yl(i,a,80,40,200,.1),Yl(i,a,160,80,200,.05,`square`);break;case`milestone`:{Yl(i,a,660,880,100,.06);let e=i,t=a;setTimeout(()=>{e.state!==`suspended`&&Yl(e,t,880,1320,100,.05)},115);break}case`record`:Yl(i,a,880,1320,350,.07);break}},[e])}}function Zl(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 Ql(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:H()})}var $l=e=>!0,eu=e=>e.decision===`allow`,tu=e=>e.decision===`block`,nu=e=>e.decision===`ask`,ru=e=>e.decision===`force`,iu=e=>e.decision===`log`;function au(){let e=new Date;return e.setHours(0,0,0,0),e.getTime()}function ou(){let e=Bt([`counters-updated`,`activity-updated`,`pending-changed`,`runtime-tick`]),t=Ka();Ja();let n=qa(),r=Xl();(0,_.useEffect)(()=>{t&&(t.decision===`block`?r.play(`block`):t.decision===`force`&&r.play(`force`))},[r.play,t]);let[i,a]=(0,_.useState)(()=>au());(0,_.useEffect)(()=>{let e=()=>{if(document.visibilityState!==`visible`)return;let e=au();a(t=>e===t?t:e)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let{data:o}=V(`/api/state/counters?since_ms=${i}`,[e[`counters-updated`],i]),{data:s}=V(`/api/state/runtime`,[e[`runtime-tick`]]),{data:c}=V(`/api/json/limits`,[e[`runtime-tick`]]),{data:l,refetch:u}=V(`/api/json/pending`,[e[`pending-changed`]]),{data:d}=V(`/api/json/blocked`,[e[`activity-updated`]]),f=Lc(),[p,m]=(0,_.useState)(!1),h=(0,_.useMemo)(()=>{let e=o?.allow??0,n=o?.block??0,r=o?.ask??0,i=o?.log??0,a=o?.force??0,s=e+n+r+i+a,c=t?.counters.total??0;return t&&c>=s&&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:s}},[t,o]),g=(0,_.useMemo)(()=>{if(n.length===0)return 0;let e=Date.now()-1e4;return n.filter(t=>t.ts_ms>=e).length/10},[n]),v=s?.history?.cpu_pct??[],y=s?.history?.memory_rss_mb??[],b=[],x=s?.latency,S=(0,_.useMemo)(()=>({"hero-metrics":()=>(0,D.jsx)(`div`,{className:`grid-bleed rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 h-full`,children:(0,D.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3 h-full`,children:[(0,D.jsx)(il,{label:`Total`,value:h.total,tone:`amber`,sub:t?Zl(t.duration_ns):void 0,burstRing:n,filter:$l}),(0,D.jsx)(il,{label:`Allow`,value:h.allow,tone:`green`,burstRing:n,filter:eu}),(0,D.jsx)(il,{label:`Block`,value:h.block,tone:`red`,burstRing:n,filter:tu}),(0,D.jsx)(il,{label:`Ask`,value:h.ask,tone:`amber`,burstRing:n,filter:nu}),(0,D.jsx)(il,{label:`Force`,value:h.force,tone:`blue`,burstRing:n,filter:ru}),(0,D.jsx)(il,{label:`Log`,value:h.log,tone:`purple`,burstRing:n,filter:iu})]})}),graph:()=>(0,D.jsx)(Os,{}),"latency-trace":()=>(0,D.jsx)(Ol,{latency:x,bursts:n,gaugeMaxMs:10,windowMs:3e4,trendWindowSec:60,gaugeSize:200}),throughput:()=>(0,D.jsxs)(Y,{className:`h-full`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`overline`,children:`throughput · evals/s`}),(0,D.jsxs)(q,{variant:`blue`,children:[g.toFixed(1),`/s`]})]}),(0,D.jsxs)(Z,{children:[(0,D.jsx)(Xc,{value:g,width:360,height:96,windowMs:6e4,className:`w-full`}),(0,D.jsx)(`p`,{className:`overline mt-2 text-center`,children:`60-second rolling window`})]})]}),"decision-mix":()=>(0,D.jsxs)(Y,{className:`h-full`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`overline`,children:`decision mix`}),(0,D.jsx)(q,{variant:`gray`,children:h.total.toLocaleString()})]}),(0,D.jsx)(Z,{children:(0,D.jsx)(qc,{counters:{allow:h.allow,block:h.block,ask:h.ask,log:h.log,force:h.force,shadow:h.shadow}})})]}),"telemetry-feed":()=>(0,D.jsxs)(Y,{variant:`flush`,className:`h-full flex flex-col`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`overline`,children:`telemetry · live · newest first`}),(0,D.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:[`hover to pause · scroll for history · `,n.length,` events buffered`]})]}),(0,D.jsx)(Z,{className:`p-0 flex-1 min-h-0`,children:(0,D.jsx)(Vl,{variant:`decision`,bursts:n,windowSize:80,height:360,className:`border-0 rounded-none`})})]}),"system-pulse":()=>(0,D.jsx)(Pl,{cpuPct:s?.cpu_pct??0,cpuSeries:v,cpuLimit:c?.config.cpuLimitPct,memMb:s?.memory_rss_mb??0,memSeries:y,memLimit:c?.config.memoryLimitMb,heapUsedMb:s?.heap_used_mb??0,heapTotalMb:s?.heap_total_mb??0,heapSeries:b,uptimeSec:(s?.uptime_ms??0)/1e3}),"pending-approvals":()=>(0,D.jsxs)(Y,{className:`h-full`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`overline`,children:`pending approvals`}),(0,D.jsx)(q,{variant:l&&l.length>0?`amber`:`gray`,children:l?.length??0})]}),(0,D.jsx)(Z,{children:l&&l.length>0?(0,D.jsx)(`ul`,{className:`space-y-2`,children:l.slice(0,5).map(e=>(0,D.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,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsxs)(`div`,{className:`text-[var(--color-fg-1)] truncate`,children:[e.toolCall.tool,` · `,e.ruleId]}),(0,D.jsx)(`div`,{className:`text-[var(--color-fg-3)] text-[11px] truncate`,children:Wr(e.toolCall.tool,JSON.stringify(e.toolCall.input??{}))})]}),(0,D.jsxs)(`div`,{className:`flex gap-1 shrink-0`,children:[(0,D.jsx)(J,{size:`sm`,variant:`primary`,onClick:()=>Ql(e.id,`allow`).then(u),children:`allow`}),(0,D.jsx)(J,{size:`sm`,variant:`ghost`,onClick:()=>Ql(e.id,`block`).then(u),children:`block`})]})]},e.id))}):(0,D.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] py-3 text-center`,children:`— no pending approvals —`})})]}),"recent-blocks":()=>(0,D.jsxs)(Y,{className:`h-full`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`overline`,children:`recent blocks & forces`}),(0,D.jsx)(q,{variant:d&&d.length>0?`red`:`gray`,children:d?.length??0})]}),(0,D.jsx)(Z,{children:d&&d.length>0?(0,D.jsx)(`ul`,{className:`space-y-1.5`,children:d.slice(0,6).map((e,t)=>(0,D.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,D.jsx)(q,{variant:e.decision===`force`?`amber`:`red`,children:e.decision}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate flex-1`,children:Wr(e.tool,e.input)}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate text-[11px] max-w-[120px]`,children:e.rule_id??`—`})]},`${e.timestamp}-${t}`))}):(0,D.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] py-3 text-center`,children:`— no recent blocks —`})})]})}),[h,t,n,x,g,s,v,y,b,c,l,d,u]),C=Gl({from:`first`,translateY:22,durationMs:640,staggerMs:80,maxStaggerMs:520});return(0,D.jsxs)(`div`,{ref:p?void 0:C,className:`space-y-5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`flex-1`,"data-tutorial":`cb-layout`,children:(0,D.jsx)(Qs,{manager:f,isEditing:p,onToggleEditing:m})}),(0,D.jsx)(`button`,{type:`button`,onClick:r.toggle,className:`chip cursor-pointer hover:border-sky-500/50 hover:text-sky-300 transition-colors shrink-0`,title:r.enabled?`Mute stream sounds`:`Enable stream sounds`,children:r.enabled?`SFX ON`:`SFX OFF`})]}),(0,D.jsx)(Hc,{}),(0,D.jsx)(`div`,{"data-tutorial":`cb-grid`,children:(0,D.jsx)(Zs,{panels:f.activeLayout.panels,isEditing:p,renderers:S,onPanelsChange:f.updateActivePanels})})]})}var su={centre:`#FF9500`,"cf-worker":`#5AC8FA`,bun:`#FFCC00`,elixir:`#AF52DE`,native:`#FF3B30`,unknown:`#8E8E93`},cu={centre:`monorepo`,"cf-worker":`CF Worker`,bun:`Bun / TS`,elixir:`Elixir`,native:`Native`,unknown:`Other`};function lu(e){let t=(0,_.useRef)(null),n=(0,_.useRef)(null),r=(0,_.useRef)([]),i=(0,_.useRef)(null),a=(0,_.useRef)(null),o=(0,_.useRef)(0),s=(0,_.useRef)(null),c=(0,_.useRef)({w:0,h:0}),l=(0,_.useRef)(!1),u=(0,_.useRef)(null),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)({centre:0,"cf-worker":0,bun:0,elixir:0,native:0,unknown:0});return(0,_.useEffect)(()=>{let e=!1;return m(!1),f(null),fetch(`/api/json/monorepo/graph`).then(async e=>{let t=e.headers.get(`content-type`)??``;if(!e.ok)throw Error(`HTTP ${e.status}`);if(!t.includes(`application/json`))throw Error(`expected JSON, got ${t||`unknown`}`);return e.json()}).then(t=>{if(e)return;let i=n.current?.clientWidth??800,a=n.current?.clientHeight??420,s=i/2,c=a/2,l=Math.min(i,a)*.36,u=t.projects,d=[{id:t.centre.id,label:t.centre.label,type:`centre`,description:`Monorepo root — every sigmashake-* project lives here`,isCentre:!0,x:s,y:c,vx:0,vy:0,radius:0,phase:0},...u.map((e,t)=>{let n=t/Math.max(1,u.length)*Math.PI*2;return{id:e.id,label:e.label.replace(/^sigmashake-/,``),type:e.type,description:e.description||`${cu[e.type]} project`,isCentre:!1,x:s+Math.cos(n)*l,y:c+Math.sin(n)*l,vx:0,vy:0,radius:l,phase:n}})];r.current=d,o.current=0,g(d.reduce((e,t)=>(e[t.type]=(e[t.type]??0)+1,e),{centre:0,"cf-worker":0,bun:0,elixir:0,native:0,unknown:0})),m(!0)}).catch(t=>{e||f(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[]),(0,_.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>{l.current=e.matches};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,_.useEffect)(()=>{let e=t.current,s=n.current;if(!e||!s)return;let u=e.getContext(`2d`,{alpha:!0});if(!u)return;let d=new ResizeObserver(t=>{for(let n of t){let t=n.contentRect,i=window.devicePixelRatio||1;c.current.w=t.width,c.current.h=t.height,e.width=Math.max(1,Math.floor(t.width*i)),e.height=Math.max(1,Math.floor(t.height*i)),e.style.width=`${t.width}px`,e.style.height=`${t.height}px`,u.setTransform(i,0,0,i,0,0);let a=r.current;if(a.length>0){let e=t.width/2,n=t.height/2,r=Math.min(t.width,t.height)*.36;for(let t of a){if(t.isCentre){t.x=e,t.y=n;continue}t.radius=r}}}});d.observe(s);let f=0,p=performance.now(),m=[],h=(e,t)=>{let n=new Map;e.forEach((e,t)=>n.set(e.id,t));let r=[];for(let e of t){let t=n.get(e.from),i=n.get(e.to);t===void 0||i===void 0||r.push([t,i])}return r},g=e=>{let t=Math.min(.05,(e-p)/1e3);p=e;let n=r.current,{w:s,h:d}=c.current,h=s/2,_=d/2,v=i.current,y=l.current||v?0:.06;o.current+=y*t;let b=5.5,x=.86;for(let e=0;e<n.length;e++){let r=n[e];if(r.isCentre||r.id===v)continue;let i=0,a=0;for(let t=0;t<n.length;t++){if(e===t)continue;let o=n[t];if(o.isCentre)continue;let s=r.x-o.x,c=r.y-o.y,l=s*s+c*c+.01,u=Math.sqrt(l),d=1700/l;i+=s/u*d,a+=c/u*d}let s=r.phase+o.current,c=h+Math.cos(s)*r.radius,l=_+Math.sin(s)*r.radius;i+=(c-r.x)*b,a+=(l-r.y)*b;let u=r.x-h,d=r.y-_,f=Math.sqrt(u*u+d*d)||1,p=r.radius-f;i+=u/f*p*.6,a+=d/f*p*.6,r.vx=(r.vx+i*t)*x,r.vy=(r.vy+a*t)*x,r.x+=r.vx*t,r.y+=r.vy*t}u.clearRect(0,0,s,d);let S=u.createRadialGradient(h,_,0,h,_,Math.max(s,d)/1.4);S.addColorStop(0,`rgba(255, 149, 0, 0.06)`),S.addColorStop(1,`rgba(255, 149, 0, 0)`),u.fillStyle=S,u.fillRect(0,0,s,d),u.lineCap=`round`;for(let e=1;e<n.length;e++){let t=n[0],r=n[e];uu(u,t,r,.1)}for(let[e,t]of m){let r=n[e],i=n[t];!r||!i||uu(u,r,i,.24,`#5AC8FA`)}let C=a.current;for(let e of n){let t=su[e.type],n=C===e.id,r=v===e.id,i=e.isCentre?22:11,a=n||r?i+4:i;if(n||r||e.isCentre){let n=e.isCentre?a+14:a+8,r=u.createRadialGradient(e.x,e.y,a,e.x,e.y,n);r.addColorStop(0,t),r.addColorStop(1,`rgba(0,0,0,0)`),u.globalAlpha=e.isCentre?.22:.32,u.fillStyle=r,u.beginPath(),u.arc(e.x,e.y,n,0,Math.PI*2),u.fill(),u.globalAlpha=1}if(u.fillStyle=t,u.beginPath(),u.arc(e.x,e.y,a,0,Math.PI*2),u.fill(),u.lineWidth=e.isCentre?2:1.25,u.strokeStyle=`rgba(0,0,0,0.18)`,u.stroke(),u.font=e.isCentre?`600 12px ui-sans-serif, system-ui`:`500 10.5px ui-sans-serif, system-ui`,u.fillStyle=`rgba(60,60,67,0.85)`,u.textBaseline=`middle`,u.textAlign=`center`,e.isCentre)u.fillText(e.label,e.x,e.y+a+14);else{let t=e.x-h,n=e.y-_,r=Math.sqrt(t*t+n*n)||1,i=e.x+t/r*(a+12),o=e.y+n/r*(a+12);u.textAlign=t>=0?`left`:`right`,u.textBaseline=n>=0?`top`:`bottom`,u.fillText(e.label,i,o)}}u.textAlign=`start`,u.textBaseline=`alphabetic`,f=requestAnimationFrame(g)};f=requestAnimationFrame(g);let _=-1,v=``,y=setInterval(()=>{let e=r.current,t=window.__SSG_MONOREPO_EDGES__??``;e.length===_&&t===v||(_=e.length,v=t,m=h(e,t?JSON.parse(t):[]))},250);return()=>{cancelAnimationFrame(f),clearInterval(y),d.disconnect()}},[]),(0,_.useEffect)(()=>{let e=t.current;if(!e)return;let n=t=>{let n=e.getBoundingClientRect();return{x:t.clientX-n.left,y:t.clientY-n.top}},o=(e,t)=>{let n=r.current;for(let r=n.length-1;r>=0;r--){let i=n[r],a=i.x-e,o=i.y-t,s=i.isCentre?26:14;if(a*a+o*o<=s*s)return i}return null},c=t=>{let{x:s,y:c}=n(t),l=i.current;if(l){let e=r.current.find(e=>e.id===l);if(e&&!e.isCentre){let t=e.x,n=e.y;e.x=s,e.y=c,e.vx=(s-t)*12,e.vy=(c-n)*12}return}let d=o(s,c);a.current=d?.id??null,e.style.cursor=d&&!d.isCentre?`grab`:`default`,d&&u.current?(u.current.style.display=`block`,u.current.style.left=`${s+14}px`,u.current.style.top=`${c+14}px`,u.current.innerHTML=`<strong>${du(d.id)}</strong><span class="mg-tooltip__kind">${cu[d.type]}</span>`+(d.description?`<p>${du(d.description)}</p>`:``)):u.current&&(u.current.style.display=`none`)},l=t=>{let{x:r,y:a}=n(t),c=o(r,a);c&&!c.isCentre&&(i.current=c.id,e.setPointerCapture(t.pointerId),e.style.cursor=`grabbing`,s.current={x:r,y:a,downX:r,downY:a,downAt:performance.now()})},d=t=>{if(i.current)try{e.releasePointerCapture(t.pointerId)}catch{}i.current=null,e.style.cursor=`default`},f=()=>{a.current=null,u.current&&(u.current.style.display=`none`)};return e.addEventListener(`pointermove`,c),e.addEventListener(`pointerdown`,l),e.addEventListener(`pointerup`,d),e.addEventListener(`pointercancel`,d),e.addEventListener(`pointerleave`,f),()=>{e.removeEventListener(`pointermove`,c),e.removeEventListener(`pointerdown`,l),e.removeEventListener(`pointerup`,d),e.removeEventListener(`pointercancel`,d),e.removeEventListener(`pointerleave`,f)}},[]),(0,_.useEffect)(()=>{p&&fetch(`/api/json/monorepo/graph`).then(e=>e.json()).then(e=>{window.__SSG_MONOREPO_EDGES__=JSON.stringify(e.serviceEdges??[])}).catch(()=>{window.__SSG_MONOREPO_EDGES__=`[]`})},[p]),(0,D.jsxs)(`div`,{className:`mg`,ref:n,children:[(0,D.jsx)(`canvas`,{ref:t,className:`mg__canvas`,"aria-label":`Monorepo dependency graph`}),(0,D.jsxs)(`div`,{className:`mg__overlay`,children:[(0,D.jsxs)(`div`,{className:`mg__title`,children:[(0,D.jsx)(`strong`,{children:`monorepo map`}),(0,D.jsx)(`span`,{className:`mg__hint`,children:`drag to pluck a project • hover for details`})]}),d&&(0,D.jsx)(`div`,{className:`mg__error`,children:d}),(0,D.jsx)(`ul`,{className:`mg__legend`,children:[`cf-worker`,`bun`,`elixir`,`native`,`unknown`].map(e=>h[e]>0?(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`mg__swatch`,style:{background:su[e]}}),(0,D.jsx)(`span`,{children:cu[e]}),(0,D.jsx)(`span`,{className:`mg__count`,children:h[e]})]},e):null)})]}),(0,D.jsx)(`div`,{ref:u,className:`mg-tooltip`})]})}function uu(e,t,n,r,i=`#FF9500`){let a=n.x-t.x,o=n.y-t.y,s=(t.x+n.x)/2-o*.05,c=(t.y+n.y)/2+a*.05;e.globalAlpha=r,e.strokeStyle=i,e.lineWidth=1.25,e.beginPath(),e.moveTo(t.x,t.y),e.quadraticCurveTo(s,c,n.x,n.y),e.stroke(),e.globalAlpha=1}function du(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function fu(e,t){let n=Array(t).fill(0);if(e.length===0)return n;let r=Date.now()-t*1e3;for(let i=e.length-1;i>=0;i--){let a=e[i];if(!a)continue;if(a.ts_ms<r)break;let o=Math.floor((a.ts_ms-r)/1e3);o>=0&&o<t&&n[o]++}return n}function pu({bins:e=60,height:t=38,className:n}){let r=qa(),i=(0,_.useRef)(null),a=(0,_.useRef)([]),o=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=i.current;if(!t)return;let n=t.getContext(`2d`);if(!n)return;let s=Math.min(window.devicePixelRatio??1,2),c=Si(),l=()=>{let i=fu(r,e);if(a.current.length!==e)a.current=i.slice();else if(c)a.current=i;else for(let t=0;t<e;t++){let e=a.current[t]??0,n=i[t]??0;a.current[t]=e+(n-e)*.18}let u=t.clientWidth,d=t.clientHeight;(t.width!==u*s||t.height!==d*s)&&(t.width=u*s,t.height=d*s,n.scale(s,s)),n.clearRect(0,0,u,d);let f=Math.max(1,...a.current),p=u/e;for(let t=0;t<e;t++){let e=a.current[t]??0,r=e/f*d,i=t*p,o=e/f;n.fillStyle=`rgba(${Math.round(56+o*199)},${Math.round(189-o*100)},${Math.round(248-o*200)},${.4+o*.55})`,n.fillRect(i+.5,d-r,Math.max(1,p-1),r)}n.strokeStyle=`rgba(148, 163, 184, 0.1)`,n.lineWidth=1,n.beginPath(),n.moveTo(0,d-.5),n.lineTo(u,d-.5),n.stroke(),o.current=requestAnimationFrame(l)};return o.current=requestAnimationFrame(l),()=>{o.current!==null&&cancelAnimationFrame(o.current),o.current=null}},[r,e]),(0,D.jsxs)(`div`,{className:K(`relative w-full`,n),style:{height:t},children:[(0,D.jsx)(`canvas`,{ref:i,className:`block w-full h-full`,style:{width:`100%`,height:`100%`}}),(0,D.jsxs)(`span`,{className:`absolute top-1 left-2 text-[9px] font-mono uppercase tracking-widest text-[var(--color-fg-4)] pointer-events-none`,children:[`bursts/sec · `,e,`s window`]})]})}var mu=8,hu=6,gu=Math.PI*.75,_u=Math.PI*2.25;function vu({size:e=110,className:t}){let n=qa(),r=(0,_.useRef)(null),i=(0,_.useRef)(0),a=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=r.current;if(!t)return;let o=t.getContext(`2d`);if(!o)return;let s=Math.min(window.devicePixelRatio??1,2),c=Si(),l=()=>{let r=Date.now()-1500,u=0;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){if(t.ts_ms<r)break;u++}}let d=u/1.5,f=Math.min(1,d/mu);c?i.current=f:i.current+=(f-i.current)*.16;let p=e,m=e;(t.width!==p*s||t.height!==m*s)&&(t.width=p*s,t.height=m*s,t.style.width=`${p}px`,t.style.height=`${m}px`,o.scale(s,s)),o.clearRect(0,0,p,m);let h=p/2,g=m/2+4,_=p/2-8;o.lineWidth=6,o.lineCap=`round`,o.strokeStyle=`rgba(148, 163, 184, 0.18)`,o.beginPath(),o.arc(h,g,_,gu,_u),o.stroke();let v=gu+hu/mu*(_u-gu);o.strokeStyle=`rgba(239, 68, 68, 0.45)`,o.beginPath(),o.arc(h,g,_,v,_u),o.stroke();let y=gu+i.current*(_u-gu),b=i.current*mu>=hu;o.strokeStyle=b?`rgba(239, 68, 68, 0.95)`:`rgba(56, 189, 248, 0.92)`,o.lineWidth=6,o.beginPath(),o.arc(h,g,_,gu,y),o.stroke();let x=h+Math.cos(y)*(_-2),S=g+Math.sin(y)*(_-2);o.strokeStyle=b?`#fca5a5`:`#e0e7ff`,o.lineWidth=2,o.beginPath(),o.moveTo(h,g),o.lineTo(x,S),o.stroke(),o.fillStyle=b?`#fca5a5`:`#e0e7ff`,o.beginPath(),o.arc(h,g,3,0,Math.PI*2),o.fill(),o.fillStyle=b?`#fca5a5`:`#e0e7ff`,o.font=`bold 20px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,o.textAlign=`center`,o.fillText(d.toFixed(1),h,g+_*.55),o.fillStyle=`rgba(148, 163, 184, 0.85)`,o.font=`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,o.fillText(`eps`,h,g+_*.55+12),a.current=requestAnimationFrame(l)};return a.current=requestAnimationFrame(l),()=>{a.current!==null&&cancelAnimationFrame(a.current),a.current=null}},[n,e]),(0,D.jsx)(`canvas`,{ref:r,className:K(`block`,t),style:{width:e,height:e}})}var yu={allow:`#22c55e`,block:`#ef4444`,force:`#a855f7`,ask:`#f59e0b`,log:`#60a5fa`,shadow:`#6b7280`},bu=[`allow`,`block`,`force`,`ask`,`log`];function xu({windowSec:e=30,height:t=14,className:n}){let r=qa(),[i,a]=(0,_.useState)({}),o=(0,_.useRef)(null);(0,_.useEffect)(()=>{let t=Si(),n=()=>{let i=Date.now()-e*1e3,s={},c=0;for(let e=r.length-1;e>=0;e--){let t=r[e];if(t){if(t.ts_ms<i)break;s[t.decision]=(s[t.decision]??0)+1,c++}}let l={};for(let e of bu)l[e]=c===0?0:(s[e]??0)/c;if(t){a(l);return}a(e=>{let t={};for(let n of bu){let r=e[n]??0;t[n]=r+((l[n]??0)-r)*.22}return t}),o.current=requestAnimationFrame(n)};return o.current=requestAnimationFrame(n),()=>{o.current!==null&&cancelAnimationFrame(o.current),o.current=null}},[r,e]);let s=bu.map(e=>({key:e,color:yu[e]??`#6b7280`,pct:Math.max(0,i[e]??0)})),c=s.reduce((e,t)=>e+t.pct,0)===0;return(0,D.jsxs)(`div`,{className:K(`w-full`,n),children:[(0,D.jsx)(`div`,{className:`flex w-full overflow-hidden rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,style:{height:t},title:`decision mix · last ${e}s`,children:c?(0,D.jsx)(`div`,{className:`w-full h-full flex items-center justify-center text-[9px] font-mono uppercase tracking-widest text-[var(--color-fg-4)]`,children:`— idle —`}):s.map(e=>(0,D.jsx)(`div`,{style:{width:`${e.pct*100}%`,background:e.color,transition:`width 240ms ease-out`},title:`${e.key} · ${(e.pct*100).toFixed(1)}%`},e.key))}),(0,D.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-0.5 text-[9px] font-mono uppercase tracking-widest text-[var(--color-fg-4)]`,children:s.map(e=>(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,D.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:e.color}}),e.key,` · `,(e.pct*100).toFixed(0),`%`]},e.key))})]})}var Su={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)]`},Cu={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)]`},wu=[{label:`User code`,color:`#451a03`},{label:`Runtime (bun:/node:)`,color:`#172554`},{label:`Native/other`,color:`#1f2937`},{label:`GC/idle`,color:`#450a0a`}],Tu={neutral:`#d0d0d0`,green:`#34d399`,red:`#f87171`,amber:`#fbbf24`,blue:`#38bdf8`,purple:`#a78bfa`,gray:`#6e7076`};function Eu({label:e,value:t,sub:n,tone:r=`neutral`,align:i=`left`,labelPlacement:a=`above`,labelClassName:o,valueClassName:s,subClassName:c,trend:l,trendColor:u}){let d=(0,D.jsx)(`div`,{className:K(a===`above`?`overline mb-1.5`:`mt-1 text-[11px] text-[var(--color-fg-3)]`,o),children:e}),f=(0,D.jsx)(`div`,{className:K(`font-mono font-medium tabular-nums`,i===`center`&&`text-center`,Su[r],s),children:t}),p=l&&l.length>1,m=u??Tu[r];return(0,D.jsxs)(D.Fragment,{children:[a===`above`&&d,p?(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[f,(0,D.jsx)(Jc,{data:l,width:48,height:18,color:m})]}):f,a===`below`&&d,n&&(0,D.jsx)(`div`,{className:K(`mt-1 text-[10px] font-mono text-[var(--color-fg-3)]`,i===`center`&&`text-center`,c),children:n})]})}function Du({className:e,contentClassName:t,label:n,value:r,sub:i,tone:a,align:o,labelPlacement:s,labelClassName:c,valueClassName:l,subClassName:u,trend:d,trendColor:f,...p}){return(0,D.jsx)(Y,{className:e,...p,children:(0,D.jsx)(Z,{className:K(`py-3`,o===`center`&&`text-center`,t),children:(0,D.jsx)(Eu,{label:n,value:r,sub:i,tone:a,align:o,labelPlacement:s,labelClassName:c,valueClassName:l,subClassName:u,trend:d,trendColor:f})})})}function Ou({className:e,...t}){return(0,D.jsx)(`div`,{className:K(`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)] p-3`,t.align===`center`&&`text-center`,e),children:(0,D.jsx)(Eu,{...t})})}function ku({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,D.jsxs)(`div`,{className:K(`relative w-full overflow-hidden rounded-sm bg-[var(--color-surface-3)]`,r),children:[(0,D.jsx)(`div`,{className:K(`h-full rounded-sm transition-all duration-500`,Cu[t],i),style:{width:`${o}%`}}),s!==null&&(0,D.jsx)(`div`,{className:`absolute top-0 h-full w-0.5 bg-[var(--color-brand)]/70`,style:{left:`${s}%`},title:a})]})}function Au({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,D.jsxs)(Y,{className:u,children:[(0,D.jsxs)(X,{className:`py-2`,children:[(0,D.jsx)(`span`,{className:`overline`,children:e}),r&&(0,D.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300`,children:i})]}),(0,D.jsxs)(Z,{children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,D.jsx)(`div`,{className:K(`text-2xl font-mono font-medium tabular-nums`,Su[n],d),children:t}),(a?.length??0)>1&&o&&(0,D.jsx)(Jc,{data:a??[],width:80,height:28,color:o,threshold:s,maxValue:c})]}),l]})]})}function ju({profile:e,children:t}){return(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] font-mono text-[var(--color-fg-3)]`,children:[(0,D.jsxs)(`span`,{children:[`nodes:`,` `,(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.nodes.length})]}),(0,D.jsxs)(`span`,{children:[`duration:`,` `,(0,D.jsxs)(`span`,{className:`text-[var(--color-fg-1)]`,children:[((e.endTime-e.startTime)/1e3).toFixed(0),`ms`]})]}),(0,D.jsxs)(`span`,{children:[`samples:`,` `,(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.samples?.length??0})]})]}),(0,D.jsx)(`div`,{className:`flex gap-3 text-[10px] font-mono text-[var(--color-fg-3)]`,children:wu.map(e=>(0,D.jsxs)(`span`,{className:`flex items-center`,children:[(0,D.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 Mu({memory:e,formatValue:t}){return(0,D.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,D.jsx)(Ou,{align:`center`,label:e.label,value:e.value,valueClassName:`text-lg font-medium text-[var(--color-fg-0)]`},e.label))})}var Nu=3;function Pu(e){return e===null?`—`:e<1e6?`${(e/1e3).toFixed(0)}µs`:`${(e/1e6).toFixed(1)}ms`}var Fu=[`counters-updated`,`activity-updated`,`pending-changed`,`runtime-tick`,`limits-breach`];function Iu({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,D.jsxs)(Y,{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,D.jsxs)(X,{children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`text-xs font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`license`}),(0,D.jsx)(q,{variant:t?`green`:n?`amber`:`blue`,children:e.tier_label}),e.fleet_enrolled&&(0,D.jsx)(q,{variant:`gray`,children:`fleet`})]}),e.email&&(0,D.jsx)(`span`,{className:`text-xs text-[var(--color-fg-3)]`,children:e.email})]}),(0,D.jsxs)(Z,{className:`space-y-3`,children:[n&&e.detail&&(0,D.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,D.jsx)(`code`,{className:`font-mono`,children:`ssg auth login`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex justify-between text-xs text-[var(--color-fg-2)]`,children:[(0,D.jsx)(`span`,{children:`evals today`}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(Kc,{value:e.evals_today,curve:`spring`}),e.eval_daily_limit!==null&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:` / `}),e.eval_daily_limit.toLocaleString()]}),e.eval_daily_limit===null&&(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:` · unlimited`})]})]}),e.eval_daily_limit!==null&&(0,D.jsx)(`div`,{className:`mt-1 h-1.5 w-full overflow-hidden rounded-full bg-[var(--color-bg-2)]`,children:(0,D.jsx)(`div`,{className:`h-full transition-all duration-700 ease-out ${i}`,style:{width:`${r}%`}})})]}),!t&&(0,D.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,D.jsxs)(`div`,{className:`text-[10px] text-[var(--color-fg-3)] font-mono uppercase tracking-wider`,children:[`cloud retention: `,e.retention_days,` days`]})]})]})}function Lu(e){return new Date(e*1e3).toLocaleTimeString()}function Ru(e,t=24){let n=(0,_.useRef)(null),[r,i]=(0,_.useState)([]);return(0,_.useEffect)(()=>{let r=n.current;if(n.current=e,r===null)return;let a=Math.max(0,e-r);i(e=>{let n=e.length>=t?e.slice(-(t-1)):e.slice();return n.push(a),n})},[e,t]),r}async function zu(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:H()})}async function Bu(e,t){let n=await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...H()},body:JSON.stringify({ruleId:e,file:t})});if(!n.ok)throw Error(`Toggle failed: ${n.status}`)}async function Vu(e,t){let n=await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...H()},body:JSON.stringify({ruleId:e,file:t})});if(!n.ok)throw Error(`Toggle failed: ${n.status}`)}async function Hu(e,t){let n=await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...H()},body:JSON.stringify({ruleId:e,file:t,decision:`ask`})});if(!n.ok)throw Error(`Update decision failed: ${n.status}`)}async function Uu(e,t){let n=await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...H()},body:JSON.stringify({ruleId:e,file:t,decision:`block`})});if(!n.ok)throw Error(`Update decision failed: ${n.status}`)}function Wu({ruleId:e}){return e?(0,D.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,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`—`})}function Gu({title:e,right:t}){return(0,D.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,D.jsx)(`h2`,{className:`overline text-[11px]`,children:e}),t]})}function Ku({children:e}){return(0,D.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 qu({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=Wr(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,D.jsx)(Y,{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,D.jsxs)(`div`,{className:`px-3 py-3`,children:[v&&(0,D.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,D.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,D.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,D.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,D.jsx)(`span`,{children:`failed to update rule — check server logs`}),(0,D.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,D.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5 flex-wrap`,children:[(0,D.jsx)(q,{variant:v?o===`done-ask`?`blue`:`gray`:p,children:v?o===`done-ask`?`ask`:`disabled`:f}),(0,D.jsx)(`code`,{className:`text-[var(--color-brand)] text-xs font-mono`,children:e.tool}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-xs`,children:`·`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] text-[11px] font-mono tabular-nums`,children:Lu(e.timestamp)}),e.repeat_count>1&&(0,D.jsxs)(q,{variant:`gray`,children:[`×`,e.repeat_count]})]}),(0,D.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,D.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pt-0.5`,children:[(0,D.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,D.jsx)(`span`,{className:`animate-spin`,children:`⟳`}):(0,D.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,D.jsx)(`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}),(0,D.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),`ask instead`]}),(0,D.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,D.jsx)(`span`,{className:`animate-spin`,children:`⟳`}):(0,D.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,D.jsx)(`line`,{x1:`15`,y1:`9`,x2:`9`,y2:`15`}),(0,D.jsx)(`line`,{x1:`9`,y1:`9`,x2:`15`,y2:`15`})]}),`disable rule`]})]})]}),(0,D.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,D.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`rule`}),(0,D.jsx)(Wu,{ruleId:e.rule_id})]}),e.source_file&&(0,D.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`src`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:e.source_file})]}),e.rules_evaluated!==null&&(0,D.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`evals`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums`,children:e.rules_evaluated})]}),(0,D.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`latency`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums`,children:Pu(e.duration_ns)})]}),(0,D.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,D.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,D.jsx)(`div`,{className:`overline mb-2`,children:`full input`}),(0,D.jsx)(Wi,{children:(()=>{try{return JSON.stringify(JSON.parse(e.input),null,2)}catch{return e.input}})()})]})]})})}function Ju(){let e=Bt(Fu),t=[e[`counters-updated`],e[`activity-updated`],e[`pending-changed`]],{data:n}=V(`/api/state/counters`,t),{data:r,refetch:i}=V(`/api/json/pending`,t),{data:a,refetch:o}=V(`/api/json/blocked`,t),{data:s}=V(`/api/state/activity`,t),{data:c}=V(`/api/state/runtime`,[e[`runtime-tick`]]),{data:l}=V(`/api/json/limits`,[e[`limits-breach`]]),{data:u}=V(`/api/json/license`,[e[`activity-updated`]]),[d,f]=(0,_.useState)(!1),p=a?.reduce((e,t)=>e+t.repeat_count,0)??0,m=n?.allow??0,h=(n?.block??0)+(n?.force??0),g=n?.force??0,v=n?.pending??0,y=n?.log??0,b=Ru(m),x=Ru(h),S=Ru(g),C=Ru(v),w=Ru(y),T=[{label:`allow`,value:m,tone:`green`,trend:b},{label:`block`,value:h,tone:`red`,trend:x},{label:`force`,value:g,tone:`amber`,trend:S},{label:`pending`,value:v,tone:`blue`,trend:C},{label:`log`,value:y,tone:`gray`,trend:w}];return(0,D.jsxs)(`div`,{ref:Gl({from:`first`}),className:`space-y-8`,children:[(0,D.jsx)(Hc,{}),(0,D.jsx)(`div`,{"data-reveal":!0,children:(0,D.jsx)(lu,{})}),(0,D.jsx)(`div`,{"data-tutorial":`dash-stats`,className:`grid grid-cols-2 sm:grid-cols-5 gap-2`,children:T.map(e=>(0,D.jsx)(Du,{align:`left`,label:e.label,value:(0,D.jsx)(Kc,{value:e.value,curve:`spring`}),tone:e.tone,labelPlacement:`above`,contentClassName:`py-3`,valueClassName:`text-2xl font-medium`,trend:e.trend,"data-reveal":!0},e.label))}),(0,D.jsxs)(`div`,{"data-reveal":!0,"data-tutorial":`dash-meters`,className:`grid grid-cols-12 gap-2 items-stretch`,children:[(0,D.jsxs)(`div`,{className:`col-span-12 md:col-span-7 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2 flex flex-col gap-2`,children:[(0,D.jsx)(pu,{bins:60,height:42}),(0,D.jsx)(xu,{windowSec:60,height:12})]}),(0,D.jsx)(`div`,{className:`col-span-12 md:col-span-5 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2 flex items-center justify-center`,children:(0,D.jsx)(vu,{size:130})})]}),u&&(0,D.jsx)(`div`,{"data-reveal":!0,children:(0,D.jsx)(Iu,{info:u})}),c&&(0,D.jsxs)(`div`,{"data-reveal":!0,className:`grid grid-cols-2 gap-2`,children:[(0,D.jsx)(Au,{label:`cpu`,value:c.cpu_pct==null?`—`:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Kc,{value:c.cpu_pct,format:e=>Math.round(e).toString()}),`%`]}),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,D.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,D.jsx)(Au,{label:`memory rss`,value:c.memory_rss_mb==null?`—`:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Kc,{value:c.memory_rss_mb,format:e=>Math.round(e).toString()}),(0,D.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,D.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,D.jsxs)(`section`,{"data-reveal":!0,"data-tutorial":`dash-approvals`,children:[(0,D.jsx)(Gu,{title:`pending approvals`}),!r||r.length===0?(0,D.jsx)(Ku,{children:`no pending approvals`}):(0,D.jsx)(`div`,{className:`space-y-2`,children:r.map(e=>(0,D.jsxs)(Y,{className:`border-l-2 border-l-sky-500/50`,children:[(0,D.jsxs)(X,{children:[(0,D.jsx)(`span`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(J,{size:`sm`,variant:`primary`,onClick:async()=>{await zu(e.id,`allow`),i()},children:`approve`}),(0,D.jsx)(J,{size:`sm`,variant:`danger`,onClick:async()=>{await zu(e.id,`block`),i()},children:`deny`})]})]}),(0,D.jsxs)(Z,{className:`space-y-2 text-xs`,children:[(0,D.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,D.jsx)(`span`,{className:`overline`,children:`tool`}),(0,D.jsx)(`code`,{className:`text-[var(--color-brand)] font-mono`,children:e.toolCall.tool})]}),e.prompt&&(0,D.jsxs)(`div`,{className:`flex gap-2 items-start`,children:[(0,D.jsx)(`span`,{className:`overline pt-0.5`,children:`prompt`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,children:e.prompt})]}),(0,D.jsx)(Wi,{children:JSON.stringify(e.toolCall.input,null,2)})]})]},e.id))})]}),a&&a.length>0&&(0,D.jsxs)(`section`,{"data-reveal":!0,children:[(0,D.jsx)(Gu,{title:`blocked actions`,right:(0,D.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:[a.length,` active`,p>a.length?` · ${p} total hits`:``]})}),(0,D.jsx)(`div`,{className:`space-y-2`,children:(d?a:a.slice(0,Nu)).map(e=>(0,D.jsx)(qu,{item:e,onDisable:async()=>{await Bu(e.rule_id,e.source_file),o()},onChangeToAsk:async()=>{await Hu(e.rule_id,e.source_file),o()},onUndo:async t=>{t===`disable`?await Vu(e.rule_id,e.source_file):await Uu(e.rule_id,e.source_file),o()}},`${e.decision}:${e.rule_id??`none`}:${e.tool}:${e.timestamp}:${e.input}`))}),a.length>Nu&&(0,D.jsx)(`div`,{className:`mt-3 flex justify-center`,children:(0,D.jsx)(J,{size:`sm`,variant:`secondary`,onClick:()=>f(e=>!e),children:d?`↑ show less`:`↓ show ${a.length-Nu} more`})})]}),(0,D.jsxs)(`section`,{"data-reveal":!0,"data-tutorial":`dash-audit`,children:[(0,D.jsx)(Gu,{title:`recent audit log`,right:s&&s.length>0?(0,D.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,D.jsx)(Ku,{children:`no audit entries yet`}):(0,D.jsx)(`div`,{className:`space-y-1.5`,children:s.slice(0,15).map(e=>(0,D.jsx)(Ra,{row:e},e.id))})]})]})}var Yu=[{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`}],Xu={rca:{title:`Root Cause Analysis`,body:`When an eval errors, an ssqa finding arrives, or a daemon-level error fires, SSG auto-composes a diagnosis with ranked hypotheses, evidence, and suggested next actions — the same pack Claude reads through MCP.`,useWhen:`Something just broke and you want the short version before grepping logs.`},timeline:{title:`Eval Timeline`,body:`Flame-chart of the last 1024 frames across every rule and tool call. Each row is one tool call (trace_id); each bar is one pipeline stage colored by kind; a red outline means that stage errored.`,useWhen:`You want to see which stages a rule went through and how long each took. Click a bar to inspect the frame.`},watch:{title:`Live URI Watch`,body:`Subscribe to any ssg:// resource and watch it update as the daemon emits events. Every CLI, MCP, and dashboard surface ultimately reads through these same URIs.`,useWhen:`You know exactly which internal resource (rules, audit rows, frames, RCA pack, native stats) you want to inspect.`},state:{title:`Daemon Snapshot`,body:`Live vitals for the SSG daemon process — uptime, rules loaded, native FFI availability, frame ring size, eval quotas, audit worker readiness.`,useWhen:`The daemon feels off (slow, dropping events, refusing calls) and you want to confirm it's healthy.`},metrics:{title:`Performance Counters`,body:`Latency distributions and event counters for the eval pipeline (per-stage timings, native call overhead, audit throughput).`,useWhen:`Evals feel slow and you want to find the hot stage before optimizing.`}};function Zu(){let[e,t]=(0,_.useState)(`rca`);return(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 min-h-[70vh]`,children:[(0,D.jsxs)(`header`,{className:`space-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`h1`,{className:`text-sm font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`ai-native debugger`}),(0,D.jsx)(`span`,{className:`chip text-sky-300 border-sky-500/30`,children:`ssg:// unified resolver`}),(0,D.jsx)(rd,{})]}),(0,D.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`one surface · cli · mcp · dashboard`})]}),(0,D.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-3)] max-w-3xl leading-snug`,children:`See exactly what happened inside SSG during recent rule evaluations — which stage ran, which rule matched, how long each step took, and what went wrong. The same data Claude reads via MCP.`})]}),(0,D.jsx)($u,{}),(0,D.jsx)(td,{}),(0,D.jsx)(`nav`,{"data-tutorial":`debug-tabs`,className:`flex items-center gap-1 border-b border-[var(--color-line-1)]`,children:Yu.map(n=>(0,D.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,D.jsx)(nd,{tab:e}),(0,D.jsxs)(`section`,{"data-tutorial":`debug-pane`,className:`flex-1 min-h-0`,children:[e===`rca`&&(0,D.jsx)(id,{}),e===`timeline`&&(0,D.jsx)(ld,{}),e===`watch`&&(0,D.jsx)(_d,{}),e===`state`&&(0,D.jsx)(vd,{uri:`ssg://daemon/state`}),e===`metrics`&&(0,D.jsx)(vd,{uri:`ssg://daemon/metrics`})]})]})}var Qu=`ssg.debug.intro.dismissed`;function $u(){let[e,t]=(0,_.useState)(()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(Qu)===`1`}catch{return!1}});return e?(0,D.jsx)(`div`,{className:`flex justify-end`,children:(0,D.jsx)(`button`,{type:`button`,onClick:()=>{t(!1);try{window.localStorage.removeItem(Qu)}catch{}},className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)]`,children:`what is this?`})}):(0,D.jsx)(`aside`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-4 space-y-3`,children:(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,D.jsxs)(`div`,{className:`space-y-3 min-w-0 flex-1`,children:[(0,D.jsx)(`p`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)]`,children:`who this page is for`}),(0,D.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:`SSG sits between your AI coding agent (Claude Code, Cursor, Copilot, …) and your filesystem/shell, deciding which tool calls to allow, block, or warn on. This page is the window into those decisions — useful any time SSG's behavior surprises you.`}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)] mb-1.5`,children:`what you'd use it for`}),(0,D.jsx)(`table`,{className:`text-[12px] text-[var(--color-fg-3)] w-full border-separate border-spacing-y-1`,children:(0,D.jsxs)(`tbody`,{children:[(0,D.jsx)(ed,{question:`Why did SSG block my agent from running this command?`,tab:`rca`,how:`open RCA — or find the trace in Timeline and read the deciding rule`}),(0,D.jsx)(ed,{question:`I just wrote a rule. Did it actually fire?`,tab:`timeline`,how:`trigger the tool call, find your trace, look for your rule_id in a match-stage bar`}),(0,D.jsx)(ed,{question:`Are my rules even loaded? Did a syntax error skip one?`,tab:`state`,how:`check the rules_loaded count — or open Watch and resolve ssg://rules/list`}),(0,D.jsx)(ed,{question:`My agent feels slow when SSG is on — is SSG the cause?`,tab:`metrics`,how:`look at per-stage latency; the hot stage tells you whether parse, match, native FFI, or audit is the culprit`}),(0,D.jsx)(ed,{question:`Something errored and I want a one-line diagnosis before reading logs`,tab:`rca`,how:`the latest RCA pack ranks hypotheses by confidence and suggests next actions`})]})})]}),(0,D.jsxs)(`p`,{className:`text-[11px] text-[var(--color-fg-4)] leading-relaxed`,children:[(0,D.jsx)(`span`,{className:`font-mono uppercase tracking-wider`,children:`heads up ·`}),` `,`The Timeline (every frame of every eval) is opt-in because it adds overhead. Restart the daemon with`,` `,(0,D.jsx)(`code`,{className:`text-amber-300 font-mono`,children:`SSG_DEBUG_ENABLED=1 ./ssg daemon`}),` `,`to turn it on. RCA, State, and Metrics work without it.`]})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>{t(!0);try{window.localStorage.setItem(Qu,`1`)}catch{}},className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)] shrink-0`,title:`Hide this panel`,children:`hide`})]})})}function ed({question:e,tab:t,how:n}){return(0,D.jsxs)(`tr`,{children:[(0,D.jsx)(`td`,{className:`align-top pr-3 text-[12px] text-[var(--color-fg-2)] w-[55%]`,children:e}),(0,D.jsx)(`td`,{className:`align-top pr-3 w-[80px]`,children:(0,D.jsx)(`span`,{className:`chip text-[10px] uppercase tracking-wider text-sky-300 border-sky-500/30`,children:t})}),(0,D.jsx)(`td`,{className:`align-top text-[11px] text-[var(--color-fg-4)] leading-snug`,children:n})]})}function td(){let{data:e}=V(`/api/json/debug?uri=ssg%3A%2F%2Fdaemon%2Fstate`,[]);return e?.data?.debug_enabled===!1?(0,D.jsxs)(`aside`,{className:`rounded-sm border border-amber-500/40 bg-amber-500/5 p-3 text-[12px] text-amber-200 space-y-1`,children:[(0,D.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-amber-300`,children:`timeline disabled · frame collection is off`}),(0,D.jsx)(`p`,{className:`text-[12px] leading-snug`,children:`The daemon is running but not capturing per-stage eval frames — so the Timeline tab will stay empty no matter how many tool calls fire. RCA, State, and Metrics still work.`}),(0,D.jsxs)(`p`,{className:`text-[12px] leading-snug`,children:[`To turn frame capture on, restart with`,` `,(0,D.jsx)(`code`,{className:`text-amber-100 font-mono bg-amber-900/30 px-1.5 py-0.5 rounded-sm`,children:`SSG_DEBUG_ENABLED=1 ./ssg daemon`}),`. It's opt-in because collecting every frame adds overhead on the hot path.`]})]}):null}function nd({tab:e}){let t=Xu[e];return(0,D.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2 space-y-1`,children:[(0,D.jsx)(`p`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)]`,children:t.title}),(0,D.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-snug`,children:t.body}),(0,D.jsxs)(`p`,{className:`text-[11px] text-[var(--color-fg-4)] leading-snug`,children:[(0,D.jsx)(`span`,{className:`font-mono uppercase tracking-wider`,children:`use when ·`}),` `,t.useWhen]})]})}function rd(){let e=Bt([`debug-frame`])[`debug-frame`]??0,{data:t}=V(`/api/json/debug?uri=ssg%3A%2F%2Fdaemon%2Fstate`,[e]),n=t?.data?.debug_enabled;return n===!1?(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-amber-300`,title:`Frame collection is OFF. Restart the daemon with SSG_DEBUG_ENABLED=1 to capture frames.`,children:[(0,D.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-sm bg-amber-400`}),`debug off`]}):n===void 0?(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-4)]`,children:[(0,D.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-sm bg-[var(--color-fg-4)]`}),`connecting…`]}):(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-emerald-300`,title:`Debug collection is on. ${e} debug-frame bursts received this session.`,children:[(0,D.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),`live · `,e]})}function id(){let e=Bt([`debug-frame`,`activity-updated`]),{data:t,loading:n,error:r,refetch:i}=V(`/api/json/debug?uri=ssg%3A%2F%2Frca%2Fcurrent`,[e[`debug-frame`],e[`activity-updated`]]),a=t?.data?.pack??null;return(0,D.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-[1fr_340px] gap-4`,children:[(0,D.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,D.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`loading RCA pack…`}),r&&(0,D.jsxs)(`p`,{className:`text-sm text-rose-300`,children:[`rca fetch error: `,r]}),!n&&!a&&(0,D.jsxs)(`div`,{className:`text-sm text-[var(--color-fg-3)] space-y-2`,children:[(0,D.jsx)(`p`,{className:`font-mono`,children:`no current RCA pack`}),(0,D.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,D.jsx)(od,{pack:a})]}),(0,D.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,D.jsx)(`p`,{className:`uppercase tracking-wider text-[var(--color-fg-2)]`,children:`how claude sees this`}),(0,D.jsxs)(`pre`,{className:`text-[10px] whitespace-pre-wrap leading-snug`,children:[`ssg debug rca --current --json`,`
13
13
  `,`# or via MCP:`,`
14
14
  `,`ssg_debug_rca(`,`{`,`auto_current:true`,`}`,`)`]}),(0,D.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,D.jsxs)(`p`,{className:`text-[10px] opacity-60`,children:[`hash `,t.snapshot_hash.slice(0,12),`…`]})]})]})}function ad(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 od({pack:e}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`header`,{className:`flex items-start justify-between gap-4`,children:[(0,D.jsxs)(`div`,{children:[(0,D.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,D.jsx)(`h2`,{className:`text-[15px] font-medium text-[var(--color-fg-1)] mt-1`,children:e.summary}),e.trace_id&&(0,D.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] mt-1`,children:[`trace_id · `,e.trace_id]})]}),(0,D.jsx)(`span`,{className:`chip uppercase text-[10px] tracking-wider `+ad(e.severity),children:e.severity})]}),e.hypothesis&&e.hypothesis.length>0&&(0,D.jsxs)(`section`,{children:[(0,D.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`hypothesis`}),(0,D.jsx)(`ol`,{className:`space-y-2`,children:e.hypothesis.map((e,t)=>(0,D.jsxs)(`li`,{className:`p-2 rounded-sm bg-[var(--color-surface-2)] border border-[var(--color-line-1)]`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,D.jsx)(`p`,{className:`text-[13px] text-[var(--color-fg-1)]`,children:e.cause}),(0,D.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`conf `,(e.confidence*100).toFixed(0),`%`]})]}),e.evidence.length>0&&(0,D.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,D.jsx)(`li`,{children:e},t))})]},t))})]}),e.suggested_next_actions&&e.suggested_next_actions.length>0&&(0,D.jsxs)(`section`,{children:[(0,D.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`suggested next actions`}),(0,D.jsx)(`ul`,{className:`space-y-1 text-[13px] text-[var(--color-fg-2)]`,children:e.suggested_next_actions.map((e,t)=>(0,D.jsxs)(`li`,{className:`font-mono text-[12px]`,children:[`→ `,e]},t))})]}),e.state_snapshot&&e.state_snapshot.length>0&&(0,D.jsxs)(`section`,{children:[(0,D.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`expand`}),(0,D.jsx)(`ul`,{className:`space-y-1 text-[11px] font-mono`,children:e.state_snapshot.map(e=>(0,D.jsxs)(`li`,{className:`text-[var(--color-fg-3)]`,children:[(0,D.jsx)(`code`,{className:`text-sky-300`,children:e.uri}),(0,D.jsxs)(`span`,{className:`opacity-50 ml-2`,children:[e.hash.slice(0,10),`…`]})]},e.uri))})]})]})}var sd=[`hook-ingress`,`parse`,`match`,`ffi-call`,`decide`,`audit`,`respond`],cd={"hook-ingress":`#6ea8ff`,parse:`#a78bfa`,match:`#60d394`,"ffi-call":`#f59e0b`,decide:`#f472b6`,audit:`#94a3b8`,respond:`#22d3ee`};function ld(){let{data:e,loading:t,error:n}=V(`/api/json/debug?uri=ssg%3A%2F%2Fframes%2Frecent%3Flimit%3D1024`,[Bt([`debug-frame`])[`debug-frame`]]),r=e?.data?.frames??[],i=e?.data?.dropped??0,[a,o]=(0,_.useState)(null);return(0,D.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-[1fr_320px] gap-4`,children:[(0,D.jsxs)(`article`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsxs)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:[`frames · `,r.length,i>0&&(0,D.jsxs)(`span`,{className:`ml-2 text-amber-300`,children:[`dropped · `,i]})]}),(0,D.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`ssg://frames/recent`})]}),n&&(0,D.jsxs)(`p`,{className:`text-sm text-rose-300`,children:[`timeline fetch error: `,n]}),t&&r.length===0?(0,D.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`loading…`}):r.length===0?(0,D.jsx)(ud,{}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(fd,{frames:r,onSelect:o}),(0,D.jsx)(dd,{})]})]}),(0,D.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,D.jsx)(`p`,{className:`uppercase tracking-wider text-[var(--color-fg-2)]`,children:`frame inspector`}),a?(0,D.jsx)(pd,{frame:a}):(0,D.jsx)(`p`,{className:`opacity-60`,children:`click a bar to inspect`})]})]})}function ud(){return(0,D.jsxs)(`div`,{className:`text-[12px] text-[var(--color-fg-3)] space-y-2 py-4`,children:[(0,D.jsx)(`p`,{className:`text-[13px] text-[var(--color-fg-2)]`,children:`no frames captured yet`}),(0,D.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)] leading-relaxed`,children:`Frame collection is opt-in so it adds zero cost when off. Restart the daemon with the env var below, then any tool call (Bash, Read, Edit, MCP) will stream frames into this view in real time:`}),(0,D.jsx)(`pre`,{className:`text-[11px] text-amber-300 font-mono bg-[var(--color-surface-2)] border border-[var(--color-line-1)] rounded-sm px-2 py-1.5`,children:`SSG_DEBUG_ENABLED=1 ./ssg daemon`}),(0,D.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)]`,children:`Each bar = one stage of one eval. Click a bar to inspect the frame — rule that matched, duration, error type, input preview.`})]})}function dd(){return(0,D.jsx)(`div`,{className:`flex flex-wrap gap-3 text-[10px] font-mono text-[var(--color-fg-4)]`,children:sd.map(e=>(0,D.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,D.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm`,style:{background:cd[e]}}),e]},e))})}function fd({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)=>hd(e.ts_start_ns,t.ts_start_ns))}));n.sort((e,t)=>hd(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=cd[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,D.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 pd({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,D.jsxs)(`dl`,{className:`space-y-1`,children:[(0,D.jsxs)(md,{k:`stage`,children:[(0,D.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm mr-1 align-middle`,style:{background:cd[e.stage]??`#888`}}),e.stage]}),(0,D.jsx)(md,{k:`tool`,children:e.tool}),(0,D.jsx)(md,{k:`result`,children:(0,D.jsx)(`span`,{className:e.result===`error`?`text-rose-300`:e.result===`skip`?`text-[var(--color-fg-4)]`:`text-emerald-300`,children:e.result})}),(0,D.jsx)(md,{k:`dur`,children:n}),e.rule_id&&(0,D.jsx)(md,{k:`rule`,children:e.rule_id}),e.error&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(md,{k:`err.type`,children:(0,D.jsx)(`span`,{className:`text-rose-300`,children:e.error.type})}),(0,D.jsx)(md,{k:`err.msg`,children:(0,D.jsx)(`span`,{className:`text-rose-200`,children:e.error.message})})]}),e.input_preview&&(0,D.jsx)(md,{k:`input`,children:(0,D.jsx)(`code`,{className:`text-[10px] break-all`,children:e.input_preview})}),(0,D.jsx)(md,{k:`trace`,children:(0,D.jsx)(`code`,{className:`text-[10px]`,children:e.trace_id})}),(0,D.jsx)(md,{k:`frame`,children:(0,D.jsx)(`code`,{className:`text-[10px]`,children:e.frame_id})})]})}function md({k:e,children:t}){return(0,D.jsxs)(`div`,{className:`flex gap-2 text-[11px] leading-tight`,children:[(0,D.jsx)(`dt`,{className:`text-[var(--color-fg-4)] w-16 shrink-0 uppercase tracking-wider`,children:e}),(0,D.jsx)(`dd`,{className:`text-[var(--color-fg-2)] break-all min-w-0`,children:t})]})}function hd(e,t){let n=BigInt(e),r=BigInt(t);return n<r?-1:+(n>r)}var gd=[`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 _d(){let[e,t]=(0,_.useState)(`ssg://daemon/state`),[n,r]=(0,_.useState)(`ssg://daemon/state`);return(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:gd.map(e=>(0,D.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,D.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:t=>{t.preventDefault(),r(e)},children:[(0,D.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,D.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,D.jsx)(vd,{uri:n})]})}function vd({uri:e}){let t=Bt([`debug-frame`,`activity-updated`,`counters-updated`]),{data:n,loading:r,error:i,refetch:a}=V(`/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,D.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2`,children:[(0,D.jsxs)(`header`,{className:`flex items-center justify-between`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:e}),n?.snapshot_hash&&(0,D.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`hash `,n.snapshot_hash.slice(0,10),`…`]}),n?.stale&&(0,D.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,D.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,D.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`resolving…`}),i&&(0,D.jsx)(`p`,{className:`text-sm text-rose-300`,children:i}),o&&(0,D.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 yd=200;function bd(e){let t=Date.now()-e;return t<2e3?`now`:t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:`${Math.floor(t/36e5)}h ago`}function xd(e){let t=e/1e6;return t<1e3?`${Math.round(t)}ms`:t<6e4?`${(t/1e3).toFixed(1)}s`:`${Math.floor(t/6e4)}m${Math.floor(t%6e4/1e3)}s`}function Sd(e){let{bursts:t,selectedId:n,onSelect:r}=e,i=(0,_.useMemo)(()=>{let e=new Map;for(let n of t){if(Sa(n.tool))continue;let t=Ya(n),r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}let n=Array.from(e.entries());return n.sort((e,t)=>{let n=e[1][e[1].length-1]?.ts_ms??0;return(t[1][t[1].length-1]?.ts_ms??0)-n}),n},[t]);return t.length===0?(0,D.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-center px-4`,children:[(0,D.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`feed · idle`}),(0,D.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] max-w-[260px]`,children:[`Each entry is one tool call your AI agent made.`,(0,D.jsx)(`br`,{}),`Color = the ssg rule decision.`]})]}):(0,D.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-3 py-3 space-y-5`,children:i.map(([e,t])=>{let i=e.indexOf(`:`),a=i>=0?e.slice(0,i):e,o=t[t.length-1],s=o?Xa[o.decision]??`#6b7280`:`#6b7280`,c=t.slice(-yd).reverse();return(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 mb-2 pb-1 border-b border-[var(--color-line-1)] text-[11px]`,children:[(0,D.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:s}}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)] font-medium`,children:xa(a)}),(0,D.jsxs)(`span`,{className:`ml-auto text-[10px] text-[var(--color-fg-4)]`,children:[t.length,` `,t.length===1?`action`:`actions`]})]}),(0,D.jsxs)(`div`,{className:`relative pl-4`,children:[(0,D.jsx)(`div`,{className:`absolute left-[7px] top-0 bottom-0 w-px`,style:{background:`${s}33`}}),(0,D.jsx)(`div`,{className:`space-y-1.5`,children:c.map(e=>{let t=e.audit_id??`${e.ts_ms}:${e.tool}`,i=t===n,a=Xa[e.decision]??`#6b7280`,o=e.input_tokens??0,s=e.output_tokens??0,c=o>0||s>0;return(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(`span`,{className:`absolute -left-[9px] top-1/2 -translate-y-1/2 w-[6px] h-[6px] rounded-full border border-[var(--color-surface-1)]`,style:{background:a}}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>r(i?null:t),className:`w-full text-left flex items-center gap-2 px-2.5 py-1.5 rounded-sm border text-[11.5px] transition-colors ${i?`border-sky-500/50 bg-sky-500/5 text-[var(--color-fg-1)]`:`border-[var(--color-line-1)] bg-[var(--color-surface-1)] text-[var(--color-fg-2)] hover:bg-white/3 hover:border-[var(--color-line-2)]`}`,children:[(0,D.jsx)(`span`,{className:`flex-1 font-medium truncate text-[var(--color-fg-1)]`,title:e.tool,children:ba(e.tool)}),(0,D.jsxs)(`span`,{className:`shrink-0 flex items-center gap-2 text-[9px] text-[var(--color-fg-4)]`,children:[c&&(0,D.jsxs)(`span`,{className:`font-mono`,title:`Input: ${o} tokens · Output: ${s} tokens`,children:[`↓`,no(o),` ↑`,no(s)]}),e.duration_ns>0&&(0,D.jsx)(`span`,{children:xd(e.duration_ns)}),(0,D.jsx)(`span`,{className:`px-1.5 py-px rounded text-[9px] font-semibold tracking-wide`,style:{color:a,background:`${a}22`},children:e.decision===`allow`?`Allowed`:e.decision===`block`?`Blocked`:e.decision===`ask`?`Held`:e.decision===`force`?`Forced`:e.decision===`log`?`Logged`:e.decision}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:bd(e.ts_ms)})]})]})]},t)})})]})]},e)})})}function Cd(e){let{sessionKey:t,entries:n,loading:r,error:i,playingIndex:a}=e,o=(0,_.useRef)(null),s=(0,_.useRef)(new Map);(0,_.useEffect)(()=>{if(a<0)return;let e=s.current.get(a);e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},[a]);let c=e=>t=>{t?s.current.set(e,t):s.current.delete(e)};return(0,D.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] overflow-hidden`,children:[(0,D.jsxs)(`header`,{className:`flex items-center justify-between px-3 py-1.5 border-b border-[var(--color-line-1)] bg-black/30 shrink-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono`,children:[(0,D.jsx)(`span`,{className:`overline text-[var(--color-fg-3)]`,children:`audit log`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] truncate`,title:t,children:t})]}),(0,D.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:r?`loading…`:i?`error`:`${n.length} event${n.length===1?``:`s`}`})]}),(0,D.jsxs)(`div`,{ref:o,className:`flex-1 min-h-0 overflow-y-auto divide-y divide-[var(--color-line-1)]/40`,children:[i&&(0,D.jsx)(`div`,{className:`px-3 py-4 text-[11px] font-mono text-rose-300`,children:i}),!i&&!r&&n.length===0&&(0,D.jsx)(`div`,{className:`px-3 py-4 text-[11px] font-mono text-[var(--color-fg-4)]`,children:`No audit entries for this session yet.`}),n.map((e,t)=>{let n=Xa[e.decision]??`#6b7280`,r=t===a,i=e.duration_ns==null?null:e.duration_ns/1e6;return(0,D.jsxs)(`div`,{ref:c(t),className:`relative px-3 py-2 transition-colors ${r?`bg-white/[0.04] ring-1 ring-inset ring-sky-400/40`:`hover:bg-white/[0.02]`}`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-0 bottom-0 w-1`,style:{background:n}}),(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] font-mono`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,D.jsx)(`span`,{className:`uppercase tracking-wider shrink-0`,style:{color:n},children:e.decision}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,children:e.tool})]}),(0,D.jsx)(`span`,{className:`shrink-0 text-[10px] text-[var(--color-fg-4)] tabular-nums`,children:wd(e.ts_ms)})]}),(e.rule_id||i!=null)&&(0,D.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[e.rule_id&&(0,D.jsxs)(`span`,{className:`truncate`,title:e.rule_id,children:[`rule · `,e.rule_id]}),i!=null&&(0,D.jsx)(`span`,{className:`tabular-nums shrink-0`,children:i<1?`${(i*1e3).toFixed(0)}µs`:`${i.toFixed(2)}ms`})]}),e.rule_message&&(0,D.jsx)(`div`,{className:`mt-1 text-[10px] font-mono text-[var(--color-fg-3)] break-words`,children:e.rule_message}),e.input_preview&&(0,D.jsx)(`pre`,{className:`mt-1 text-[10px] text-[var(--color-fg-3)] whitespace-pre-wrap break-all bg-black/30 rounded-sm px-2 py-1 max-h-24 overflow-y-auto`,children:e.input_preview})]},e.id)})]})]})}function wd(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`)}`}var Td=[100,500,1e3,5e3,1e4,1e5];function Ed(e){return e>=1e5||e>=1e3?`${e/1e3|0}k`:String(e)}function Dd(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 Od(e){let t=Math.floor(e/100);return`${Math.floor(t/10)}.${t%10}s`}function kd({className:e,onMilestone:t,onRecord:n}){let r=(0,_.useRef)(null),i=(0,_.useRef)(null),[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)(``),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(!1),S=Ka(),C=Ja(),w=qa(),T=(0,_.useRef)(null),E=(0,_.useRef)(0),O=(0,_.useRef)(0),k=(0,_.useRef)(0),ee=(0,_.useRef)(0),A=(0,_.useRef)(new Set),j=(0,_.useRef)(performance.now());return(0,_.useEffect)(()=>{let e=performance.now();if(Si()){let t=setInterval(()=>{let t=performance.now();r.current&&(r.current.textContent=Dd(t-e)),i.current&&(i.current.textContent=Od(t-j.current))},1e3);return()=>clearInterval(t)}let[t]=$o(()=>{let t=performance.now();r.current&&(r.current.textContent=Dd(t-e)),i.current&&(i.current.textContent=Od(t-j.current))});return t},[]),(0,_.useEffect)(()=>{for(let e of w)e.rule_id&&A.current.add(e.rule_id);m(A.current.size)},[]),(0,_.useEffect)(()=>{let e=()=>{let e=Date.now(),t=w.filter(t=>e-t.ts_ms<=6e4),n=new Set(t.map(e=>`${e.client}:${e.agent_id??`solo`}`)).size;f(n)};e();let t=setInterval(e,1e3);return()=>clearInterval(t)},[w]),(0,_.useEffect)(()=>{if(T.current===null){T.current=C,E.current=C;return}if(C<=E.current)return;let e=C-E.current;E.current=C,u(n=>{let r=n+e,i=Td.find(e=>e>ee.current&&r>=e);return i&&(ee.current=i,g(Ed(i)),x(!0),t?.(),setTimeout(()=>{g(``),x(!1)},700)),r}),S?.rule_id&&A.current.add(S.rule_id),m(A.current.size),S&&(S.decision===`block`?(O.current=0,o(0),j.current=performance.now()):(O.current+=e,O.current>k.current&&(k.current=O.current,c(k.current),y(!0),n?.(),setTimeout(()=>y(!1),450)),o(O.current)))},[C,S,t,n]),(0,D.jsxs)(`div`,{className:K(`pointer-events-none select-none`,`flex flex-col gap-2 p-3 rounded-md`,`bg-[var(--color-bg-2,#0c0d12)]/95`,`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)]`,b&&`milestone-ring`,e),"aria-label":`Live engagement counters`,children:[(0,D.jsx)(Ad,{label:`uptime`,children:(0,D.jsx)(`span`,{ref:r,className:`tabular-nums text-[var(--color-fg-0,#e6e8ed)] text-[15px] tracking-tight`,children:`00:00.0`})}),(0,D.jsx)(Ad,{label:`evals`,children:(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,D.jsx)(Kc,{value:l,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`}),h&&(0,D.jsxs)(`span`,{className:`text-[10px] text-emerald-400 uppercase tracking-wide`,children:[`+`,h]})]})}),(0,D.jsx)(Ad,{label:`since block`,children:(0,D.jsx)(`span`,{ref:i,className:`tabular-nums text-emerald-300 text-[15px]`,children:`0.0s`})}),(0,D.jsx)(Ad,{label:`streak / best`,children:(0,D.jsxs)(`span`,{className:K(`tabular-nums text-[15px]`,v?`record-beat`:`text-[var(--color-fg-0,#e6e8ed)]`),children:[(0,D.jsx)(Kc,{value:a,curve:`spring`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4,#5a6071)] mx-1`,children:`/`}),(0,D.jsx)(Kc,{value:s})]})}),(0,D.jsx)(Ad,{label:`agents`,children:(0,D.jsx)(Kc,{value:d,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`})}),(0,D.jsx)(Ad,{label:`rules`,children:(0,D.jsx)(Kc,{value:p,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`})})]})}function Ad({label:e,children:t}){return(0,D.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,D.jsx)(`span`,{className:`uppercase tracking-wider text-[10px] text-[var(--color-fg-4,#5a6071)]`,children:e}),t]})}function jd(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 Md(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)(()=>jd(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 Xa[t];return`#6b7280`};return(0,D.jsxs)(`div`,{className:`flex flex-col gap-3 text-[11px] font-mono`,children:[(0,D.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,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`rules · `,o.length,` matched`,s>0&&(0,D.jsxs)(`span`,{className:`ml-2 text-[var(--color-fg-4)] normal-case tracking-normal`,children:[s,` unmatched`]})]}),o.length===0?(0,D.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no rules matched in window`}):(0,D.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,D.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,title:`${e.id} — decisions: ${Array.from(e.decisions).join(`, `)}`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,D.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:n},"aria-hidden":!0}),(0,D.jsx)(`a`,{href:`/rules#${encodeURIComponent(e.id)}`,className:`truncate text-[var(--color-fg-2)] hover:text-[var(--color-fg-1)]`,children:e.id}),(0,D.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,D.jsx)(`div`,{className:`h-full`,style:{background:n,width:`${t}%`,opacity:.6}})})]}),(0,D.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:e.count})]},e.id)})})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:`decisions`}),(0,D.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,D.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,D.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:Xa[e]},"aria-hidden":!0}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] uppercase tracking-wider`,children:e}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] tabular-nums`,children:t})]},e)})})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`agents · `,c.length,` active`,n&&n!==t&&(0,D.jsx)(`span`,{className:`ml-2 text-[var(--color-fg-4)] normal-case tracking-normal`,children:`roster: today`})]}),c.length===0?(0,D.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no agents in window`}):(0,D.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,D.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,D.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i?(0,D.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft shrink-0`,"aria-hidden":!0}):(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-[var(--color-fg-4)]/40`,"aria-hidden":!0}),(0,D.jsxs)(`span`,{className:`truncate text-[var(--color-fg-2)]`,children:[e.client,(0,D.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`:`,e.agent_id]})]}),(0,D.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,D.jsx)(`div`,{className:`h-full bg-violet-400/60`,style:{width:`${t}%`}})})]}),(0,D.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:e.count})]},n)})})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`tools · `,t.length,` in window`]}),i.length===0?(0,D.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no tool activity`}):(0,D.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,D.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,D.jsx)(`span`,{className:`truncate text-[var(--color-fg-2)]`,children:e}),(0,D.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,D.jsx)(`div`,{className:`h-full bg-sky-400/60`,style:{width:`${n}%`}})})]}),(0,D.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:t})]},e)})})]})]})}var Nd=320,Pd=8,Fd=12;function Id(e){let{burst:t,anchor:n,onClose:r}=e,i=(0,_.useRef)(null),[a,o]=(0,_.useState)({left:-9999,top:-9999});if((0,_.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&r()},n=e=>{i.current&&!i.current.contains(e.target)&&r()};return document.addEventListener(`keydown`,e),document.addEventListener(`mousedown`,n),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`mousedown`,n)}},[t,r]),(0,_.useLayoutEffect)(()=>{if(!t||!n||!i.current)return;let e=i.current.getBoundingClientRect(),r=window.innerWidth,a=window.innerHeight,s=e.height>0?e.height:280,c=n.x+Fd+Nd>r?n.x-Fd-Nd:n.x+Fd,l=n.y+Fd+s>a?n.y-Fd-s:n.y+Fd;c=Math.min(Math.max(Pd,c),r-Nd-Pd),l=Math.min(Math.max(Pd,l),a-s-Pd),o({left:c,top:l})},[t,n]),(0,_.useEffect)(()=>{o({left:-9999,top:-9999})},[]),!t||!n)return null;let s=Xa[t.decision]??`#6b7280`,c=t.duration_ns/1e6,l=Date.now()-t.ts_ms;return(0,D.jsxs)(`div`,{ref:i,className:`fixed z-50 flex flex-col gap-3 text-[12px] font-mono rounded-md border border-[var(--color-line-1)] bg-[var(--color-surface-1)] shadow-2xl p-4`,style:{left:a.left,top:a.top,width:Nd,maxHeight:`80vh`,overflowY:`auto`},children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(`span`,{className:`overline text-[var(--color-fg-3)]`,children:`node · inspect`}),(0,D.jsx)(`button`,{onClick:r,className:`text-[var(--color-fg-4)] hover:text-[var(--color-fg-1)] cursor-pointer`,title:`Close inspector`,children:`✕`})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{background:s},"aria-hidden":!0}),(0,D.jsx)(`span`,{className:`uppercase tracking-wider`,style:{color:s},children:t.decision}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:t.tool})]}),(0,D.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[11px]`,children:[(0,D.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`rule`}),(0,D.jsx)(`dd`,{className:`text-[var(--color-fg-2)] break-all`,children:t.rule_id??`—`}),(0,D.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`client`}),(0,D.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:t.client}),(0,D.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`agent`}),(0,D.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:t.agent_id?(0,D.jsx)(`span`,{className:`chip text-violet-300 border-violet-500/30`,children:t.agent_id}):(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`—`})}),(0,D.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`eval duration`}),(0,D.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:c<1?`${(c*1e3).toFixed(0)}µs`:`${c.toFixed(2)}ms`}),t.complete_duration_ms!=null&&t.complete_duration_ms>0&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`tool duration`}),(0,D.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:t.complete_duration_ms>=1e3?`${(t.complete_duration_ms/1e3).toFixed(2)}s`:`${t.complete_duration_ms.toFixed(0)}ms`})]}),t.message&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`reason`}),(0,D.jsx)(`dd`,{className:`text-[var(--color-fg-2)] break-words`,children:t.message})]}),(t.input_tokens!=null||t.output_tokens!=null)&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`tokens`}),(0,D.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:zd(t.input_tokens,t.output_tokens)})]}),(0,D.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`age`}),(0,D.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:Ld(l)}),(0,D.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`timestamp`}),(0,D.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:new Date(t.ts_ms).toLocaleString()})]}),t.input_preview&&(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:`input`}),(0,D.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,D.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[t.audit_id&&(0,D.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,D.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 Ld(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 Rd(e){return e<1e3?String(e):e<1e4?`${(e/1e3).toFixed(1)}K`:e<1e6?`${Math.round(e/1e3)}K`:`${(e/1e6).toFixed(1)}M`}function zd(e,t){let n=[];return e!=null&&n.push(`${Rd(e)} in`),t!=null&&n.push(`${Rd(t)} out`),n.length>0?n.join(` · `):`—`}var Bd=900,Vd=180,Hd=320,Ud=800,Wd=4;function Gd({sessionKey:e}={}){let t=Ka(),n=Ja(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(`idle`),s=(0,_.useRef)([]),c=(0,_.useRef)(-1),l=(0,_.useRef)(0),u=(0,_.useRef)(null);if((0,_.useEffect)(()=>{if(!t||n===c.current||(c.current=n,t.decision!==`block`&&t.decision!==`force`)||e&&Ya(t)!==e)return;let u=Date.now(),d=s.current,f=d[0];if(f&&u-l.current<Ud){f.extra+=1,f.burst=t,f.seq=n,l.current=u;return}if(d.length>=Wd&&d.shift(),d.push({seq:n,burst:t,extra:0}),l.current=u,a===`idle`&&!r){let e=d.shift()??null;e&&(i(e),o(`in`))}},[n,t,e,a,r]),(0,_.useEffect)(()=>{if(a===`idle`)return;let e=null;return a===`in`?e=setTimeout(()=>o(`visible`),Vd):a===`visible`?e=setTimeout(()=>o(`out`),Bd):a===`out`&&(e=setTimeout(()=>{let e=s.current.shift()??null;e?(i(e),o(`in`)):(i(null),o(`idle`))},Hd)),u.current=e,()=>{e&&clearTimeout(e)}},[a]),!r)return null;let{burst:d,extra:f}=r,p=Xa[d.decision]??`#ef4444`,m=Si(),h=+(a===`in`||a===`visible`),g=m||a===`in`||a===`visible`?0:-8,v=d.rule_id??`rule`,y=d.decision===`block`?`BLOCKED`:`FORCED`,b=f>0?`${d.tool} · +${f} more in this burst`:`${d.tool} · ${d.client}${d.agent_id?`:${d.agent_id}`:``}`;return(0,D.jsx)(`div`,{className:e?`pointer-events-none absolute top-2 left-1/2 z-30 select-none`:`pointer-events-none fixed top-20 left-1/2 z-40 select-none`,style:{transform:`translateX(-50%) translateY(${g}px) scale(1)`,opacity:h,transition:m?`opacity ${Vd}ms ease-out`:`opacity ${Vd}ms ease-out, transform ${Vd}ms cubic-bezier(0.34, 1.56, 0.64, 1)`},"aria-live":`polite`,"aria-atomic":`true`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-3 rounded-md border bg-black/95 shadow-2xl`,style:{borderColor:p},children:[(0,D.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full shrink-0`,style:{background:p,boxShadow:m?`none`:`0 0 16px ${p}`}}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-0.5 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`text-[11px] font-mono uppercase tracking-[0.18em]`,style:{color:p},children:[y,` BY SSG`]}),(0,D.jsx)(`div`,{className:`text-[14px] font-mono text-[var(--color-fg-1)] truncate max-w-[420px]`,children:v}),(0,D.jsx)(`div`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] truncate max-w-[420px]`,children:b})]})]})})}var Kd=(0,_.memo)(function(e){let{sessionKey:t,bursts:n,paused:r,selectedId:i,onSelect:a,burstSeq:o,isStale:s,isFadingOut:c,minHeight:l,pinned:u,minimized:d,isFullscreen:f,viewMode:p=`full`,thumbnail:m=!1,onPromote:h,activePanelCount:g=1,onTogglePin:v,onToggleMinimize:y,onToggleFullscreen:b,onClose:x,onFrameTime:S}=e,C=p===`broadcast`,w=!m&&(p===`stream`||p===`broadcast`||f)?`large`:`normal`,T=t.indexOf(`:`),E=T>=0?t.slice(0,T):t,O=T>=0?t.slice(T+1):``,k=(0,_.useRef)(null),[ee,A]=(0,_.useState)(!0),[j,M]=(0,_.useState)(null),te=()=>{let e=k.current;if(!e)return;let t=e.querySelector(`canvas`);t instanceof HTMLCanvasElement&&M(t.toDataURL(`image/png`))},ne=()=>{if(!j)return;let e=document.createElement(`a`),n=t.replace(/[^a-z0-9._-]+/gi,`-`);e.href=j,e.download=`ssg-graph-${n}-${Date.now()}.png`,document.body.appendChild(e),e.click(),e.remove()},N=()=>{!j||!navigator.clipboard?.write||fetch(j).then(e=>e.blob()).then(e=>{let t=new ClipboardItem({"image/png":e});return navigator.clipboard.write([t])}).catch(()=>{})},P=typeof navigator<`u`&&typeof navigator.clipboard?.write==`function`&&typeof ClipboardItem<`u`;(0,_.useEffect)(()=>{if(f){A(!0);return}let e=k.current;if(!e)return;let t=new IntersectionObserver(e=>{for(let t of e)A(t.isIntersecting)},{threshold:.01});return t.observe(e),()=>t.disconnect()},[f]);let F=n.length>0?n[n.length-1]:null,re=F?Xa[F.decision]??`#6b7280`:`#6b7280`,I=F?.decision??null,L=F?.tool??null,R=r||!ee||d,z=(0,_.useMemo)(()=>n.length>24?n.slice(n.length-24):n,[n]);return(0,D.jsxs)(`div`,{ref:k,className:`relative flex flex-col shrink-0 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] overflow-hidden${f?` flex-1 min-h-0`:``}`,style:{minHeight:d||f?void 0:l,opacity:+!c,transform:c?`scale(0.985)`:`scale(1)`,transformOrigin:`center center`,transition:`opacity 1100ms cubic-bezier(0.22, 1, 0.36, 1), transform 1100ms cubic-bezier(0.22, 1, 0.36, 1)`},children:[!C&&(0,D.jsxs)(`header`,{className:`group flex items-center justify-between px-3 py-1.5 border-b border-[var(--color-line-1)] bg-black/30 shrink-0 gap-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono min-w-0`,children:[u&&(0,D.jsx)(`span`,{className:`text-amber-300`,title:`Pinned`,children:`▲`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-2)] uppercase tracking-wider`,children:E}),O&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate`,children:O})]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono text-[var(--color-fg-4)]`,children:[L&&(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 max-w-[180px]`,title:I?`latest: ${L} → ${I}`:`latest: ${L}`,children:[(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{background:re}}),(0,D.jsx)(`span`,{className:`truncate text-[var(--color-fg-2)]`,children:L})]}),(0,D.jsxs)(`span`,{className:`hidden md:inline text-[var(--color-fg-4)]`,children:[n.length,`n`]}),s?(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-amber-300`,children:[(0,D.jsx)(`span`,{className:`status-dot bg-amber-400`}),(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`idle`})]}):(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-emerald-300`,children:[(0,D.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`live`})]}),!m&&(0,D.jsxs)(`div`,{className:`flex items-center gap-1 ml-1`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:v,className:`px-1.5 py-0.5 rounded border text-[10px] uppercase tracking-wider transition-colors ${u?`border-amber-500/60 text-amber-300`:`border-[var(--color-line-1)] text-[var(--color-fg-3)] hover:text-amber-300 hover:border-amber-500/40`}`,title:u?`Unpin`:`Pin to top`,children:`pin`}),(0,D.jsx)(`button`,{type:`button`,onClick:y,className:`px-1.5 py-0.5 rounded border border-[var(--color-line-1)] text-[10px] text-[var(--color-fg-3)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,title:d?`Expand`:`Minimize`,children:d?`+`:`–`}),(0,D.jsx)(`button`,{type:`button`,onClick:te,className:`px-1.5 py-0.5 rounded border border-[var(--color-line-1)] text-[10px] text-[var(--color-fg-3)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,title:`Preview PNG snapshot of this panel`,children:`▣`}),(0,D.jsx)(`button`,{type:`button`,onClick:b,className:`px-1.5 py-0.5 rounded border border-[var(--color-line-1)] text-[10px] text-[var(--color-fg-3)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,title:f?`Exit fullscreen`:`Fullscreen`,children:f?`×`:`⛶`}),x&&(0,D.jsx)(`button`,{type:`button`,onClick:x,"aria-label":`Close session ${t}`,className:`px-1.5 py-0.5 rounded border border-[var(--color-line-1)] text-[10px] text-[var(--color-fg-3)] hover:text-rose-300 hover:border-rose-500/40 transition-colors`,title:`End this session on the graph`,children:`╳`})]})]})]}),!d&&!m&&!C&&(0,D.jsx)(Ts,{sessionKey:t,className:`rounded-none border-x-0 border-t-0 border-b border-[var(--color-line-1)] shrink-0`}),j&&(0,D.jsxs)(`div`,{className:`absolute inset-0 z-40 flex flex-col items-center justify-center gap-3 bg-black/80 backdrop-blur-sm p-4`,children:[(0,D.jsx)(`img`,{src:j,alt:`Panel snapshot`,className:`max-w-full max-h-[60%] rounded-sm border border-[var(--color-line-1)] object-contain`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[P&&(0,D.jsx)(`button`,{type:`button`,onClick:N,className:`px-3 py-1.5 rounded border border-[var(--color-line-1)] text-[11px] font-mono text-[var(--color-fg-2)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,children:`copy`}),(0,D.jsx)(`button`,{type:`button`,onClick:ne,className:`px-3 py-1.5 rounded border border-[var(--color-line-1)] text-[11px] font-mono text-[var(--color-fg-2)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,children:`download`}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>M(null),className:`px-3 py-1.5 rounded border border-[var(--color-line-1)] text-[11px] font-mono text-[var(--color-fg-3)] hover:text-rose-300 hover:border-rose-500/40 transition-colors`,children:`close`})]})]}),!d&&(0,D.jsxs)(`div`,{className:`flex-1 min-h-0 relative`,children:[(0,D.jsx)(Gd,{sessionKey:t}),(0,D.jsx)(vs,{bursts:z,paused:R,selectedId:i,onSelect:a,burstSeq:o,compact:!0,activePanelCount:g,labelDensity:w,onFrameTime:S}),m&&(0,D.jsx)(`button`,{type:`button`,onClick:h,"aria-label":`Promote ${E} to spotlight`,title:`Spotlight ${E}${O?` · ${O}`:``}`,className:`absolute inset-0 cursor-pointer bg-transparent hover:bg-sky-400/5 transition-colors`})]})]})}),qd=200,Jd=.9,Yd=40,Xd=32,Zd=480,Qd=`transform 220ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease-out, fill 320ms ease-out`;function $d(e){let{playback:t,bursts:n,rangeStart:r,rangeEnd:i,loading:a,onPlayhead:o,onLive:s,onPause:c,onResume:l,on24h:u}=e,d=(0,_.useRef)(null),f=(0,_.useRef)(!1),[p,m]=(0,_.useState)(null),h=Math.max(1,i-r),g=(t.playhead_ms-r)/h*100,v=Math.max(0,Math.min(100,g)),y=(0,_.useMemo)(()=>{let e=[];for(let t=0;t<qd;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)/h*(qd-1))];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,h]),b=(0,_.useCallback)(e=>{let t=d.current;if(!t)return;let n=t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e-n.left)/n.width));if(i>=.98){s();return}o(r+i*h)},[r,h,o,s]),x=(0,_.useCallback)(e=>{let t=d.current;if(!t)return;let n=t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e-n.left)/n.width));m({rel:i,ts:r+i*h})},[r,h]);(0,_.useEffect)(()=>{let e=e=>{f.current&&b(e.clientX)},t=()=>{f.current=!1};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t)}},[b]);let S=t.mode===`live`,C=S?`left ${Zd}ms linear`:`none`;return(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono uppercase tracking-wider`,children:[(0,D.jsx)(`button`,{onClick:()=>S?c():l(),className:`px-2.5 py-1 rounded-sm border transition-colors cursor-pointer ${S?`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:S?`Pause the live stream`:`Resume updates at this playhead`,children:S?`⏸ pause`:`▶ resume`}),(0,D.jsx)(`button`,{onClick:s,disabled:S,className:`px-2.5 py-1 rounded-sm border transition-colors cursor-pointer ${S?`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,D.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 last 24h — window covers now−24h through now. Backfills audit_log so the scrubber shows all recent evals.`,children:`◉ 24h`}),(0,D.jsx)(`div`,{className:`flex-1`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`mode`}),(0,D.jsx)(`span`,{className:S?`text-emerald-300`:t.mode===`paused`?`text-amber-300`:`text-violet-300`,children:t.mode}),a&&(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)] animate-pulse`,children:`· backfilling`}),(0,D.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`· t=`,ef(t.playhead_ms)]})]}),(0,D.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),b(e.clientX)},onPointerMove:e=>x(e.clientX),onPointerLeave:()=>m(null),children:[a&&(0,D.jsx)(`div`,{className:`absolute inset-0 pointer-events-none opacity-40 shimmer`,"aria-hidden":!0}),(0,D.jsxs)(`svg`,{viewBox:`0 0 ${qd} ${Yd}`,preserveAspectRatio:`none`,className:`absolute inset-0 w-full h-full pointer-events-none`,"aria-hidden":!0,children:[[.25,.5,.75].map(e=>(0,D.jsx)(`line`,{x1:e*qd,x2:e*qd,y1:0,y2:Yd,stroke:`var(--color-line-1)`,strokeWidth:.3,strokeDasharray:`1,2`,opacity:.55},e)),y.map((e,t)=>{let n=e.allow+e.block+e.ask+e.other,r=Math.min(Xd,n*3),i=n===0?0:r/Xd,a=e.block>0?Xa.block:e.ask>0?Xa.ask:e.other>0&&e.allow===0?Xa.log:Xa.allow;return(0,D.jsx)(`rect`,{x:t+.05,y:Yd-Xd,width:Jd,height:Xd,rx:.3,fill:a,style:{opacity:n===0?0:.78,transform:`scaleY(${i})`,transformOrigin:`50% 100%`,transformBox:`fill-box`,transition:Qd}},t)})]}),p&&(0,D.jsx)(`div`,{className:`absolute top-0 bottom-0 w-px bg-white/15 pointer-events-none`,style:{left:`${p.rel*100}%`},"aria-hidden":!0}),(0,D.jsx)(`div`,{className:`absolute top-0 bottom-0 pointer-events-none`,style:{left:`${v}%`,width:`1px`,background:`linear-gradient(to bottom, rgba(125,211,252,0.85), rgba(56,189,248,1) 30%, rgba(56,189,248,0.85))`,boxShadow:`0 0 6px rgba(56,189,248,0.55)`,transition:C,willChange:`left`},children:(0,D.jsx)(`div`,{className:`absolute -top-0.5 -translate-x-1/2 w-2 h-2 rotate-45 bg-sky-300`,style:{boxShadow:`0 0 6px rgba(56,189,248,0.7)`}})}),S&&(0,D.jsx)(`div`,{className:`absolute top-0 right-0 bottom-0 pointer-events-none`,style:{width:`8px`,background:`linear-gradient(to left, rgba(74,222,128,0.55), rgba(74,222,128,0))`},"aria-hidden":!0,children:(0,D.jsx)(`div`,{className:`absolute top-0 right-0 bottom-0 w-[2px] bg-emerald-400 pulse-soft`})})]}),(0,D.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] font-mono text-[var(--color-fg-4)]`,children:[(0,D.jsx)(`span`,{children:tf(r)}),(0,D.jsx)(`span`,{className:`uppercase tracking-wider transition-colors ${p?`text-sky-300`:``}`,children:p?`↳ ${tf(p.ts)}`:`${nf(t.window_ms)} window`}),(0,D.jsx)(`span`,{children:tf(i)})]})]})}function ef(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 tf(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function nf(e){return e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:`${Math.round(e/36e5)}h`}var rf=80,af=600,of=Object.freeze({stop:()=>{},count:0}),sf=new Set([`allow`,`block`,`ask`,`log`,`force`,`shadow`]);function cf(e){if(!Le()||e.length===0)return of;let t=[],n=!1,r=0;for(let i=0;i<e.length;i++){let a=e[i];if(i>0){let t=e[i-1],n=Math.max(0,a.ts_ms-t.ts_ms),o=rf+Math.log2(1+n)*14;r+=Math.max(rf,Math.min(af,o))}let o=sf.has(a.decision)?a.decision:null;if(!o)continue;let s=setTimeout(()=>{n||Ue(o)},r);t.push(s)}return{count:t.length,stop(){if(!n){n=!0;for(let e of t)clearTimeout(e);t.length=0}}}}var lf=1200,uf=3e4,df=3e3,ff=6,pf=3,mf=`graph.panelState.v1`,hf=14400*1e3;function gf(e,t){let n=new Map;for(let t of e){let e=Ya(t),r=n.get(e);r?r.push(t):n.set(e,[t])}for(let[e,r]of n){let i=t.get(e);i&&i.length===r.length&&i[i.length-1]===r[r.length-1]&&n.set(e,i)}return n}function _f(){if(typeof window>`u`)return new Map;try{let e=window.localStorage.getItem(mf);if(!e)return new Map;let t=JSON.parse(e);return new Map(Object.entries(t))}catch{return new Map}}function vf(e){if(!(typeof window>`u`))try{let t={};for(let[n,r]of e)t[n]=r;window.localStorage.setItem(mf,JSON.stringify(t))}catch{}}function yf(){let e=go(),t=Ja(),n=Ka(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),s=(0,_.useCallback)((e,t)=>{i(e),o(t??null)},[]),c=Xl();(0,_.useEffect)(()=>{n&&(n.decision===`block`?c.play(`block`):n.decision===`force`&&c.play(`force`))},[c.play,n]);let l=(0,_.useCallback)(()=>c.play(`milestone`),[c]),u=(0,_.useCallback)(()=>c.play(`record`),[c]),[d,f]=(0,_.useState)(()=>{if(typeof window>`u`)return`full`;try{let e=window.localStorage.getItem(`graph.viewMode.v1`);if(e===`full`||e===`feed`||e===`stream`||e===`broadcast`)return e}catch{}return`full`});(0,_.useEffect)(()=>{if(!(typeof window>`u`))try{window.localStorage.setItem(`graph.viewMode.v1`,d)}catch{}},[d]),(0,_.useEffect)(()=>{let e=e=>e===`full`?`feed`:e===`feed`?`stream`:e===`stream`?`broadcast`:`full`,t=t=>{if(t.key===`Escape`&&d!==`full`){f(`full`);return}if(t.key===`b`||t.key===`B`){let n=t.target?.tagName;if(n===`INPUT`||n===`TEXTAREA`)return;f(e)}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[d]);let p=d===`broadcast`,m=d===`stream`,h=d===`feed`,g=m||p,v=p,y=m,[b,x]=(0,_.useState)(()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(`ssg.sfx.enabled`)===null}catch{return!1}}),S=(0,_.useCallback)(()=>{c.toggle(),x(!1)},[c]),[C,w]=(0,_.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: 767px)`).matches);(0,_.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),t=e=>w(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let[T,E]=(0,_.useState)(!1),O=(0,_.useRef)(null),k=(0,_.useCallback)(async e=>{try{await fetch(`/api/json/graph/close-sessions`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`same-origin`,body:JSON.stringify(e.length>0?{session_keys:e}:{})})}catch{}E(!1),O.current&&clearTimeout(O.current)},[]),ee=(0,_.useCallback)(e=>{if(!T){E(!0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>E(!1),3e3);return}k(e)},[T,k]);(0,_.useEffect)(()=>()=>{O.current&&clearTimeout(O.current)},[]);let A=(0,_.useRef)(new Map),j=(0,_.useRef)(0),[M,te]=(0,_.useState)({fps:0,active:0,hitches:0}),ne=(0,_.useCallback)((e,t)=>{A.current.set(e,t),t>33&&(j.current+=1)},[]);(0,_.useEffect)(()=>{let e=setInterval(()=>{let e=A.current,t=j.current;if(j.current=0,e.size===0){te(e=>e.active===0?e:{fps:0,active:0,hitches:0});return}let n=0;for(let t of e.values())n+=t;let r=n/e.size,i=r>0?Math.max(1,Math.round(1e3/r)):0;te(n=>n.fps===i&&n.active===e.size&&n.hitches===t?n:{fps:i,active:e.size,hitches:t})},1e3);return()=>clearInterval(e)},[]);let{bursts:N,playback:P,oldest_known_ms:F,newest_known_ms:re,loading_backfill:I}=e.snapshot,L=(0,_.useRef)(new Map),R=(0,_.useMemo)(()=>{let e=gf(N,L.current);return L.current=e,e},[N]),[z,ie]=(0,_.useState)(()=>_f()),[B,ae]=(0,_.useState)(null);(0,_.useEffect)(()=>{vf(z)},[z]),(0,_.useEffect)(()=>{let e=Date.now(),t=!1,n=new Map(z);for(let r of R.keys())n.has(r)||(n.set(r,{pinned:!1,pinnedAt:0,minimized:!1,firstSeenAt:e}),t=!0);for(let[r,i]of n)R.has(r)||i.pinned||e-i.firstSeenAt<hf||(n.delete(r),t=!0);t&&ie(n)},[R,z]);let oe=(0,_.useRef)(new Map),se=(0,_.useRef)(new Set),ce=(0,_.useRef)(new Map),[,le]=(0,_.useState)(0);(0,_.useEffect)(()=>{let e=performance.now(),t=oe.current,n=se.current,r=ce.current,i=new Set;for(let[e,n]of R)i.add(e),r.set(e,n.slice()),t.delete(e);for(let a of n)if(!i.has(a)&&!t.has(a)){let n=r.get(a)??[],i=n[n.length-1]?.ts_ms??0;t.set(a,{bursts:n,diedAt:e,newestTs:i})}for(let[n,i]of t)e-i.diedAt>=lf&&(t.delete(n),r.delete(n));if(se.current=i,t.size>0){let n=1/0;for(let e of t.values())n=Math.min(n,e.diedAt+lf);let r=Math.max(16,n-e+16),i=setTimeout(()=>le(e=>e+1),r);return()=>clearTimeout(i)}},[R]);let ue=(0,_.useCallback)(e=>{ie(t=>{let n=new Map(t),r=n.get(e)??{pinned:!1,pinnedAt:0,minimized:!1,firstSeenAt:Date.now()};return n.set(e,{...r,pinned:!r.pinned,pinnedAt:r.pinned?0:Date.now()}),n})},[]),de=(0,_.useCallback)(e=>{ie(t=>{let n=new Map(t),r=n.get(e)??{pinned:!1,pinnedAt:0,minimized:!1,firstSeenAt:Date.now()};return n.set(e,{...r,minimized:!r.minimized}),n})},[]),fe=(0,_.useCallback)(e=>{ae(t=>t===e?null:e)},[]);(0,_.useEffect)(()=>{if(!B)return;let e=e=>{e.key===`Escape`&&ae(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[B]);let pe=(0,_.useRef)(null),[me,he]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(!B){pe.current?.stop(),pe.current=null,he(null);return}let e=!1;he({sessionKey:B,entries:[],loading:!0,error:null});let t=`/api/json/graph/session-audit?session_key=${encodeURIComponent(B)}`;return fetch(t,{credentials:`same-origin`}).then(e=>e.ok?e.json():Promise.reject(Error(`HTTP ${e.status}`))).then(t=>{if(e)return;let n=Array.isArray(t.rows)?t.rows:[];he({sessionKey:B,entries:n,loading:!1,error:null});let r=n.map(e=>({ts_ms:e.ts_ms,decision:e.decision,tool:e.tool}));pe.current?.stop(),pe.current=cf(r)}).catch(t=>{e||he({sessionKey:B,entries:[],loading:!1,error:t instanceof Error?t.message:`failed to load audit log`})}),()=>{e=!0,pe.current?.stop(),pe.current=null}},[B]);let ge=(0,_.useMemo)(()=>{let e={pinned:!1,pinnedAt:0,minimized:!1,firstSeenAt:Date.now()},t=[];for(let[n,r]of R){let i=r[r.length-1]?.ts_ms??0;t.push({key:n,bursts:r,newestTs:i,fadingOutAt:null,state:z.get(n)??e})}for(let[n,r]of oe.current)R.has(n)||t.push({key:n,bursts:r.bursts,newestTs:r.newestTs,fadingOutAt:r.diedAt,state:z.get(n)??e});return t.sort((e,t)=>e.state.pinned===t.state.pinned?e.state.pinned&&t.state.pinned?e.state.pinnedAt-t.state.pinnedAt:e.state.firstSeenAt-t.state.firstSeenAt:e.state.pinned?-1:1),t},[R,z]),_e=(0,_.useMemo)(()=>{if(!r)return null;for(let e of N)if((e.audit_id??`${e.ts_ms}:${e.tool}`)===r||r.startsWith(`${e.ts_ms}:${e.tool}`))return e;return null},[N,r]),[ve,ye]=(0,_.useState)(null),be=(0,_.useRef)(null),xe=(0,_.useMemo)(()=>{if(ge.length===0)return be.current=null,null;if(ve!=null&&ge.some(e=>e.key===ve))return be.current=ve,ve;let e=ge.filter(e=>e.state.pinned);if(e.length>0)return e.sort((e,t)=>t.state.pinnedAt-e.state.pinnedAt),be.current=e[0].key,e[0].key;let t=ge[0];for(let e of ge)e.newestTs>t.newestTs&&(t=e);let n=be.current;if(n!=null&&n!==t.key){let e=ge.find(e=>e.key===n);if(e&&Date.now()-e.newestTs<df)return n}return be.current=t.key,t.key},[ge,ve]);(0,_.useEffect)(()=>{ve!=null&&(ge.some(e=>e.key===ve)||ye(null))},[ve,ge]),(0,_.useEffect)(()=>{ye(null)},[]);let Se=(0,_.useMemo)(()=>{if(ge.length===0)return{hero:null,grid:[],rail:[],overflow:[]};if(d===`full`||d===`feed`)return{hero:null,grid:ge.slice(0,ff),rail:ge.slice(ff),overflow:[]};let e=ge.find(e=>e.key===xe)??ge[ge.length-1],t=ge.filter(t=>t.key!==e.key);return d===`broadcast`?{hero:e,grid:[],rail:[],overflow:t}:{hero:e,grid:[],rail:t.slice(0,pf),overflow:t.slice(pf)}},[ge,d,xe]),Ce=(0,_.useCallback)(e=>{ye(e)},[]),we=(0,_.useCallback)(()=>{ye(null)},[]),Te=(0,_.useMemo)(()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Map,a=new Map;for(let o of ge){let s=o.key;e.set(s,()=>ue(s)),t.set(s,()=>de(s)),n.set(s,()=>fe(s)),r.set(s,()=>void k([s])),i.set(s,e=>ne(s,e)),a.set(s,()=>Ce(s))}return{onTogglePin:e,onToggleMinimize:t,onToggleFullscreen:n,onClose:r,onFrameTime:i,onPromote:a}},[ue,de,fe,k,ne,Ce,ge]);(0,_.useEffect)(()=>{let e=new Set(ge.map(e=>e.key)),t=A.current;for(let n of Array.from(t.keys()))e.has(n)||t.delete(n)},[ge]);let Ee=(0,_.useMemo)(()=>{let e=n?.counters,t=e?.total??0,r=(e?.block??0)+(e?.force??0),i=0;if(N.length>0){let e=0,t=N.slice(-100);for(let n of t)e+=n.duration_ns;i=e/t.length/1e6}return{evals:t,blocks:r,avgMs:i,agents:ge.length}},[n,N,ge.length]),De=Math.min(F,P.playhead_ms-P.window_ms),Oe=Math.max(re,P.playhead_ms),ke=Se.grid.length,Ae=C||ke<=1?1:ke<=4?2:3,je=Math.max(1,Math.ceil(Math.max(1,ke)/Ae)),Me=ke<=1||C?360:180,Ne=B?ge.find(e=>e.key===B):null,Pe=e=>e>=1e4?`${Math.round(e/1e3)}k`:e.toLocaleString();return(0,D.jsxs)(`div`,{className:`grid gap-3 md:h-[calc(100dvh-4.5rem)] md:min-h-[560px] ${g?`grid-rows-[auto_minmax(0,1fr)]`:`grid-rows-[auto_minmax(0,1fr)_auto]`} ${p?`bg-black`:``}`,children:[(0,D.jsxs)(`header`,{className:`flex items-center justify-between flex-wrap gap-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,D.jsx)(`h1`,{className:`text-sm font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`graph intelligence`}),!p&&(0,D.jsx)(`span`,{className:`chip text-sky-300 border-sky-500/30`,children:`real-time tool-use`}),P.mode===`live`?(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-emerald-300`,children:[(0,D.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),`streaming`]}):(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-amber-300`,children:[(0,D.jsx)(`span`,{className:`status-dot bg-amber-400`}),P.mode]}),(0,D.jsxs)(`span`,{className:`flex items-center gap-x-3 gap-y-1 flex-wrap text-[11px] font-mono text-[var(--color-fg-3)] pl-3 border-l border-[var(--color-line-1)]`,children:[(0,D.jsxs)(`span`,{title:`Total evaluations since daemon start`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`↑`}),` `,(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Pe(Ee.evals)}),` `,(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`evals`})]}),(0,D.jsxs)(`span`,{title:`Block + force decisions — dangerous tool calls intercepted by SSG rules`,children:[(0,D.jsx)(`span`,{className:`text-rose-400`,children:`⛔`}),` `,(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Pe(Ee.blocks)}),` `,(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`blocks`})]}),(0,D.jsxs)(`span`,{className:`hidden md:inline`,title:`Mean eval latency over the last 100 bursts`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`⏱`}),` `,(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Ee.avgMs<1?`${(Ee.avgMs*1e3).toFixed(0)}µs`:`${Ee.avgMs.toFixed(1)}ms`})]}),(0,D.jsxs)(`span`,{title:`Concurrent agent sessions in this window`,children:[(0,D.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`⌥`}),` `,(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Ee.agents}),` `,(0,D.jsxs)(`span`,{className:`hidden sm:inline`,children:[`agent`,Ee.agents===1?``:`s`]})]})]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!p&&(0,D.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:[N.length,`n · window `,Math.round(P.window_ms/1e3),`s`]}),(0,D.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] tabular-nums`,title:`Average RAF interval across ${M.active} canvas${M.active===1?``:`es`}${M.hitches>0?` · ${M.hitches} hitch${M.hitches===1?``:`es`} (>33ms frames)`:``}`,children:[M.active===0?`—`:`${M.fps}fps${M.hitches>0?` (${M.hitches}h)`:``}`,` · `,M.active,`/`,ge.length]}),(0,D.jsx)(`div`,{role:`group`,"aria-label":`Graph view mode`,"data-tutorial":`graph-views`,className:`inline-flex items-stretch rounded border border-[var(--color-line-1)] overflow-hidden text-[10px] font-mono uppercase tracking-wider`,title:`View mode — B cycles, Esc returns to full`,children:[`full`,`feed`,`stream`,`broadcast`].map(e=>{let t=d===e;return(0,D.jsx)(`button`,{type:`button`,onClick:()=>f(e),"aria-pressed":t,title:e===`full`?`Full dashboard — sidebar, timeline, all controls`:e===`feed`?`Feed mode — vertical timeline of tool calls for non-technical users`:e===`stream`?`Stream mode — spotlight layout for Twitch/YouTube viewers`:`Broadcast mode — pure canvas for OBS scenes (Esc to exit)`,className:`px-2 py-0.5 transition-colors cursor-pointer ${t?e===`broadcast`?`bg-amber-500/15 text-amber-300`:e===`stream`?`bg-sky-500/15 text-sky-300`:e===`feed`?`bg-emerald-500/15 text-emerald-300`:`bg-[var(--color-fg-4)]/10 text-[var(--color-fg-1)]`:`text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)] hover:bg-white/5`}`,children:e===`broadcast`?`cast`:e},e)})}),(0,D.jsx)(`button`,{type:`button`,onClick:S,className:`chip cursor-pointer transition-colors ${b&&!c.enabled?`border-amber-500/60 text-amber-300 animate-pulse`:`hover:border-sky-500/50 hover:text-sky-300`}`,title:c.enabled?`Mute stream sounds`:`Enable stream sounds`,children:c.enabled?`SFX ON`:b?`🔊 enable cues`:`SFX OFF`}),!p&&ge.length>0&&(0,D.jsx)(`div`,{"aria-live":`polite`,children:(0,D.jsx)(`button`,{type:`button`,"aria-label":`Clear all visible graph sessions`,"data-tutorial":`graph-clear`,onClick:()=>ee(ge.filter(e=>!e.fadingOutAt).map(e=>e.key)),className:`chip cursor-pointer transition-colors ${T?`border-rose-500/60 text-rose-300`:`hover:border-rose-500/40 hover:text-rose-300`}`,title:`Close all active sessions on the graph — equivalent to /clear but reflects on the graph`,children:T?`confirm clear ${ge.filter(e=>!e.fadingOutAt).length}`:`clear`})})]})]}),(0,D.jsxs)(`div`,{"data-tutorial":`graph-panels`,className:`grid grid-cols-1 ${v?``:y?`lg:grid-cols-[1fr_240px]`:`lg:grid-cols-[1fr_300px]`} gap-3 min-h-0 md:overflow-hidden`,children:[(0,D.jsx)(`div`,{className:`flex flex-col gap-3 min-h-0 min-w-0`,children:h?(0,D.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] overflow-hidden`,children:(0,D.jsx)(Sd,{bursts:N,selectedId:r,onSelect:s})}):ge.length===0?(0,D.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] text-center px-4`,style:{minHeight:240},children:[(0,D.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`graph · idle`}),(0,D.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] max-w-[280px]`,children:`No active sessions in the current window. Each session will render as its own tree as bursts arrive.`})]}):(0,D.jsxs)(D.Fragment,{children:[Se.hero&&(B==null||B===Se.hero.key)&&(0,D.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col gap-2`,children:[ve!=null&&(0,D.jsx)(`button`,{type:`button`,onClick:we,className:`self-end chip text-amber-300 border-amber-500/40 hover:border-amber-400 cursor-pointer text-[10px]`,title:`Release manual spotlight — return to auto-follow`,children:`spotlight: locked · release ↺`}),(0,D.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,D.jsx)(Kd,{sessionKey:Se.hero.key,bursts:Se.hero.bursts,paused:P.mode!==`live`||Se.hero.fadingOutAt!=null,selectedId:r,onSelect:s,burstSeq:t,isStale:Se.hero.fadingOutAt!=null||P.playhead_ms-Se.hero.newestTs>uf,isFadingOut:Se.hero.fadingOutAt!=null,minHeight:0,pinned:Se.hero.state.pinned,minimized:Se.hero.state.minimized,isFullscreen:!1,viewMode:d,activePanelCount:1,onTogglePin:Te.onTogglePin.get(Se.hero.key),onToggleMinimize:Te.onToggleMinimize.get(Se.hero.key),onToggleFullscreen:Te.onToggleFullscreen.get(Se.hero.key),onClose:Te.onClose.get(Se.hero.key),onFrameTime:Te.onFrameTime.get(Se.hero.key)},Se.hero.key)})]}),Se.grid.length>0&&(0,D.jsx)(`div`,{className:`flex-1 grid gap-3 min-h-0 min-w-0`,style:{gridTemplateColumns:`repeat(${Ae}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${je}, minmax(180px, 1fr))`},children:Se.grid.map(e=>{let n=e.fadingOutAt!=null||P.playhead_ms-e.newestTs>uf;return B!=null&&B!==e.key?null:(0,D.jsx)(Kd,{sessionKey:e.key,bursts:e.bursts,paused:P.mode!==`live`||e.fadingOutAt!=null,selectedId:r,onSelect:s,burstSeq:t,isStale:n,isFadingOut:e.fadingOutAt!=null,minHeight:Me,pinned:e.state.pinned,minimized:e.state.minimized,isFullscreen:!1,viewMode:d,activePanelCount:Se.grid.length,onTogglePin:Te.onTogglePin.get(e.key),onToggleMinimize:Te.onToggleMinimize.get(e.key),onToggleFullscreen:Te.onToggleFullscreen.get(e.key),onClose:Te.onClose.get(e.key),onFrameTime:Te.onFrameTime.get(e.key)},e.key)})}),Se.rail.length>0&&(0,D.jsxs)(`div`,{className:`shrink-0 flex flex-col gap-1`,children:[(0,D.jsxs)(`div`,{className:`flex items-baseline justify-between text-[10px] font-mono text-[var(--color-fg-4)] uppercase tracking-wider`,children:[(0,D.jsxs)(`span`,{children:[d===`full`?`overflow rail`:`spotlight rail`,` · `,Se.rail.length,` session`,Se.rail.length===1?``:`s`]}),Se.overflow.length>0&&(0,D.jsxs)(`span`,{title:Se.overflow.map(e=>e.key).join(`
15
15
  `),children:[`+`,Se.overflow.length,` more`]})]}),(0,D.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(${Math.min(Se.rail.length,4)}, minmax(0, 1fr))`,gridAutoRows:`110px`},children:Se.rail.map(e=>{let n=e.fadingOutAt!=null||P.playhead_ms-e.newestTs>uf;return B!=null&&B!==e.key?null:(0,D.jsx)(Kd,{sessionKey:e.key,bursts:e.bursts,paused:P.mode!==`live`||e.fadingOutAt!=null,selectedId:r,onSelect:s,burstSeq:t,isStale:n,isFadingOut:e.fadingOutAt!=null,minHeight:110,pinned:e.state.pinned,minimized:e.state.minimized,isFullscreen:!1,viewMode:d,thumbnail:!0,onPromote:Te.onPromote.get(e.key),activePanelCount:Se.rail.length+1,onTogglePin:Te.onTogglePin.get(e.key),onToggleMinimize:Te.onToggleMinimize.get(e.key),onToggleFullscreen:Te.onToggleFullscreen.get(e.key),onClose:Te.onClose.get(e.key),onFrameTime:Te.onFrameTime.get(e.key)},e.key)})})]}),d===`broadcast`&&Se.overflow.length>0&&(0,D.jsxs)(`div`,{className:`shrink-0 self-end pointer-events-none chip text-[var(--color-fg-3)] border-[var(--color-line-1)]`,children:[`+`,Se.overflow.length,` more session`,Se.overflow.length===1?``:`s`,` off-screen`]})]})}),!v&&(0,D.jsxs)(`aside`,{"data-tutorial":`graph-inspector`,className:`flex flex-col gap-2 min-w-0 min-h-0 overflow-y-auto`,children:[(0,D.jsx)(kd,{onMilestone:l,onRecord:u}),!y&&(0,D.jsx)(`section`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:(0,D.jsx)(Md,{bursts:N,allBursts:e.allBursts})}),(0,D.jsx)(Id,{burst:_e,anchor:a,onClose:()=>{i(null),o(null)}})]})]}),!g&&(0,D.jsx)(`section`,{"data-tutorial":`graph-timeline`,className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:(0,D.jsx)($d,{playback:P,bursts:N,rangeStart:De,rangeEnd:Oe,loading:I,onPlayhead:t=>e.setPlayhead(t),onLive:()=>e.jumpToLive(),onPause:()=>e.setMode(`paused`),onResume:()=>e.setMode(`scrubbing`),on24h:()=>e.jumpTo24h()})}),p&&(0,D.jsxs)(`div`,{className:`pointer-events-none fixed bottom-3 right-4 flex flex-col items-end gap-1 z-30`,children:[(0,D.jsx)(`span`,{className:`text-[11px] font-mono uppercase tracking-[0.18em] text-[var(--color-fg-3)]`,children:`sigmashake gov`}),(0,D.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`broadcast mode · press B or Esc to exit`})]}),Ne&&(0,D.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-black/90 backdrop-blur-sm flex p-6 gap-4`,children:[(0,D.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 min-h-0`,children:(0,D.jsx)(Kd,{sessionKey:Ne.key,bursts:Ne.bursts,paused:P.mode!==`live`||Ne.fadingOutAt!=null,selectedId:r,onSelect:s,burstSeq:t,isStale:Ne.fadingOutAt!=null||P.playhead_ms-Ne.newestTs>uf,isFadingOut:!1,minHeight:0,pinned:Ne.state.pinned,minimized:!1,isFullscreen:!0,viewMode:d,onTogglePin:()=>ue(Ne.key),onToggleMinimize:()=>de(Ne.key),onToggleFullscreen:()=>fe(Ne.key)},`fs-${Ne.key}`)}),(0,D.jsx)(`aside`,{className:`hidden md:flex shrink-0 w-[380px] lg:w-[420px] flex-col min-h-0`,children:(0,D.jsx)(Cd,{sessionKey:Ne.key,entries:me?.sessionKey===Ne.key?me.entries:[],loading:me?.sessionKey===Ne.key?me.loading:!0,error:me?.sessionKey===Ne.key?me.error:null,playingIndex:-1})})]})]})}function bf(){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`,...H()}}),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,D.jsxs)(`div`,{className:`max-w-lg mx-auto space-y-5`,children:[(0,D.jsxs)(`div`,{children:[(0,D.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,D.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,D.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}),`back to hub`]}),(0,D.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-2 text-[var(--color-fg-0)]`,children:`Connect GitHub`}),(0,D.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,D.jsx)(Y,{children:(0,D.jsxs)(Z,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,D.jsx)(`span`,{className:`text-amber-300 shrink-0 mt-0.5`,children:(0,D.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,D.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,D.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]})}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`text-sm font-medium text-[var(--color-fg-0)]`,children:`GitHub OAuth not configured`}),(0,D.jsx)(`p`,{className:`text-xs text-[var(--color-fg-2)] mt-1 leading-relaxed`,children:i})]})]}),(0,D.jsxs)(`div`,{className:`border-t border-[var(--color-line-0)] pt-4`,children:[(0,D.jsx)(`div`,{className:`overline mb-3`,children:`setup steps`}),(0,D.jsx)(`ol`,{className:`space-y-2`,children:o.map((e,t)=>(0,D.jsxs)(`li`,{className:`flex items-start gap-2.5 text-xs text-[var(--color-fg-1)]`,children:[(0,D.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,D.jsx)(`span`,{className:`mt-0.5 leading-relaxed`,children:e.replace(/^\d+\.\s+/,``)})]},t))})]}),(0,D.jsxs)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-3`,children:[(0,D.jsx)(`div`,{className:`overline mb-1.5`,children:`quick start`}),(0,D.jsx)(`code`,{className:`text-[11px] text-[var(--color-brand)]/90 font-mono`,children:`export SSG_GITHUB_CLIENT_ID=<your-client-id>`}),(0,D.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mt-1`,children:[`then restart:`,` `,(0,D.jsx)(`code`,{className:`text-[var(--color-fg-1)]`,children:`ssg serve`})]})]}),(0,D.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,D.jsx)(Y,{children:(0,D.jsxs)(Z,{children:[(0,D.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,D.jsx)(J,{onClick:u,disabled:c,variant:`primary`,children:c?`starting…`:`connect with github`})]})}),e&&n===`polling`&&(0,D.jsx)(Y,{children:(0,D.jsxs)(Z,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`text-center`,children:[(0,D.jsx)(`div`,{className:`overline mb-2`,children:`open this url in your browser`}),(0,D.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,D.jsxs)(`div`,{className:`border border-[var(--color-line-1)] bg-[var(--color-surface-0)] rounded-sm py-5 text-center`,children:[(0,D.jsx)(`div`,{className:`overline mb-3`,children:`enter this code`}),(0,D.jsx)(`div`,{className:`text-4xl font-mono font-bold tracking-[0.3em] text-[var(--color-fg-0)]`,children:e.user_code})]}),(0,D.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,D.jsx)(`svg`,{className:`animate-spin`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,D.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),`waiting for github authorization…`]})]})}),n===`done`&&(0,D.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,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,D.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),(0,D.jsx)(`span`,{className:`font-mono text-xs`,children:i})]}),(0,D.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,D.jsxs)(`div`,{className:`rounded-sm border border-red-500/25 bg-red-500/5 p-4`,children:[(0,D.jsx)(`p`,{className:`text-sm text-red-200 font-mono`,children:i}),(0,D.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`})]})]})}var xf={deny:`red`,block:`red`,ask:`amber`,allow:`green`,log:`gray`,force:`blue`};function Sf({id:e}){let{data:t,error:n}=V(`/api/json/hub/${e}`),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1);if(n)return(0,D.jsxs)(`div`,{className:`text-sm text-red-300 font-mono`,children:[(0,D.jsx)(`p`,{children:n}),(0,D.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,D.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`,...H()},body:JSON.stringify({id:e})})).ok&&i(!0)}finally{o(!1)}}return(0,D.jsxs)(`div`,{className:`space-y-5`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.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,D.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-1.5 text-[var(--color-fg-0)]`,children:t.title}),(0,D.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,D.jsx)(J,{variant:r?`secondary`:`primary`,onClick:s,disabled:a||r,children:r?`✓ installed`:a?`installing…`:`install`})]}),t.technologies.length>0&&(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.technologies.map(e=>(0,D.jsx)(q,{variant:`blue`,children:e},e))}),t.github_repo&&(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono`,children:[(0,D.jsx)(`span`,{className:`overline`,children:`source`}),(0,D.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:t.github_repo})]}),(0,D.jsxs)(Y,{children:[(0,D.jsx)(X,{children:(0,D.jsxs)(`span`,{className:`overline`,children:[`rules · `,t.rules.length]})}),(0,D.jsx)(Z,{className:`space-y-4`,children:t.rules.map((e,t)=>(0,D.jsxs)(`div`,{className:t>0?`border-t border-[var(--color-line-0)] pt-4`:void 0,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 mb-2 flex-wrap`,children:[(0,D.jsx)(q,{variant:xf[e.decision]??`gray`,children:e.decision}),(0,D.jsx)(`code`,{className:`text-xs text-[var(--color-brand)] font-mono`,children:e.name}),e.capability&&(0,D.jsx)(q,{variant:`gray`,children:e.capability})]}),(0,D.jsx)(`p`,{className:`text-sm text-[var(--color-fg-1)] mb-2`,children:e.message}),(0,D.jsx)(Wi,{children:e.raw_text})]},e.id))})]})]})}var Cf=[{id:`safe-writes`,title:`Protect your files from accidents`,plainDescription:`Asks before AI overwrites or erases anything important — so you stay in control of what changes.`,example:`If AI tries to overwrite a config file, you get to approve it first.`,hubRulesetId:`safe-writes`,scenario:`any`,emoji:`🛡️`,details:{protects:[`Asks first before editing project manifests & lockfiles — package.json, Cargo.toml, go.mod, and friends`,`Asks first before editing shell startup files — .bashrc, .zshrc, .profile`,`Asks first before editing git config or git hooks`,`Asks first before editing CI / build pipeline files`,`Asks first before editing AI-agent instruction files — CLAUDE.md, .cursorrules, AGENTS.md`],tryThis:`Ask your AI to add a dependency to package.json. Instead of saving silently, it pauses for your approval first.`}},{id:`no-destructive-fs`,title:`Stop AI from erasing files`,plainDescription:`Blocks the kind of filesystem operations that can permanently delete your work.`,example:`If AI tries to wipe a folder, SSG blocks it automatically.`,hubRulesetId:`no-destructive-fs`,scenario:`coding`,emoji:`🗑️`,details:{protects:[`Blocks recursive force-deletes that can wipe an entire directory tree in a single command`,`Blocks bulk deletes through find with delete or exec-remove predicates`,`Blocks disk-wipe, format & partition tools — dd, mkfs, shred, fdisk`,`Blocks Windows recursive deletes — Remove-Item with Recurse, rmdir /s, del /s`,`Blocks git clean with its force flags, which erases untracked and ignored files alike`],tryThis:`Ask your AI to recursively delete a throwaway folder. The attempt is blocked outright — it never reaches your shell.`}},{id:`secrets-guard`,title:`Keep secrets and credentials safe`,plainDescription:`Watches for AI trying to read or write your passwords, API keys, and private keys.`,example:`Reading your .env file, SSH keys, or .netrc triggers an approval request.`,hubRulesetId:`secrets-guard`,scenario:`any`,emoji:`🔑`,details:{protects:[`Blocks reading .env files`,`Blocks reading private keys, SSH keys, .netrc & .pgpass`,`Blocks reading cloud credential stores — AWS, GCP, Azure, kube, docker`,`Blocks dumping secret files through cat / head / tail / type`,`Blocks writing hardcoded API keys — AWS, Anthropic, OpenAI — into source`,`Blocks writing PEM private keys into source files`],tryThis:`Ask your AI to read your .env file. The read is blocked, so the contents never land in the chat transcript.`}},{id:`email-guardrails`,title:`Ask before AI sends emails`,plainDescription:`Makes sure AI never sends a message on your behalf without your explicit OK.`,example:`Any outbound email action is queued for your approval before it goes.`,hubRulesetId:`email-guardrails`,scenario:`knowledge-work`,emoji:`📧`,details:{protects:[`Asks first before local mail commands — mail, sendmail, mutt, msmtp`,`Asks first before curl is used to talk SMTP directly`,`Asks first before calls to transactional-email APIs — SendGrid, Mailgun, Postmark, Resend, SES, and more`],tryThis:`Ask your AI to send a quick test email. It pauses and asks you to confirm the recipient and body before anything goes out.`}},{id:`no-paid-apis`,title:`Block surprise charges from paid APIs`,plainDescription:`Blocks AI from calling APIs that can rack up unexpected bills — cloud storage, AI providers, payment services.`,example:`A call to OpenAI, AWS S3, or Stripe triggers a block until you allow it.`,hubRulesetId:`no-paid-apis`,scenario:`any`,emoji:`💳`,details:{protects:[`Asks first before calls to paid LLM APIs — OpenAI, Anthropic, Groq, Bedrock, and more`,`Asks first before payment APIs — Stripe, PayPal, Square, Adyen`,`Asks first before SMS / voice APIs — Twilio, Vonage, MessageBird`,`Asks first before cloud-storage writes — aws s3 cp/sync, gsutil, az storage`],tryThis:`Ask your AI to call the OpenAI API. It checks with you before sending — so a runaway loop cannot quietly rack up spend.`}},{id:`read-only-mode`,title:`Read-only mode (maximum safety)`,plainDescription:`AI can look but not touch — all write operations are blocked. Great when you just want to explore safely.`,example:`AI can read your codebase and answer questions but cannot change any files.`,hubRulesetId:`read-only`,scenario:`any`,emoji:`🔒`,details:{protects:[`Blocks every file write and edit`,`Blocks state-changing shell commands — file deletes & moves, package installs, sudo, docker, kubectl, terraform`,`Blocks shell redirection that writes to disk`,`Blocks git commands that change state — commit, push, reset, checkout`,`Blocks network requests that are not GET — no POST, PUT, PATCH, DELETE`],tryThis:`Ask your AI to edit any file. Every write is refused until you remove this pack — but reading code and answering questions still works.`}}];function wf(e){return e?Cf.filter(t=>t.scenario===`any`||t.scenario===e):Cf}function Tf({pack:e,installed:t,state:n,expanded:r,onInstall:i,onUninstall:a,onToggleDetails:o}){let s=n!==`idle`;return(0,D.jsxs)(`div`,{className:`ss-list-row ss-list-row--pack`,style:{cursor:`default`,background:t?`linear-gradient(180deg, color-mix(in oklab, var(--color-hig-green) 8%, transparent) 0%, transparent 60%), var(--color-surface-1)`:`var(--color-surface-1)`,borderColor:t?`color-mix(in oklab, var(--color-hig-green) 28%, var(--color-line-1))`:`var(--color-line-1)`},children:[(0,D.jsxs)(`div`,{className:`ss-pack-main`,children:[(0,D.jsx)(`span`,{className:`ss-pack-emoji`,"aria-hidden":`true`,children:e.emoji}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,D.jsx)(`h3`,{className:`ss-pack-title`,children:e.title}),t&&(0,D.jsxs)(`span`,{className:`agent-badge agent-badge--detected`,title:`This pack is currently active.`,children:[(0,D.jsx)(`span`,{className:`agent-badge-dot`}),`Installed`]})]}),(0,D.jsx)(`p`,{className:`ss-pack-desc`,children:e.plainDescription}),(0,D.jsxs)(`p`,{className:`ss-pack-example`,children:[(0,D.jsx)(`span`,{className:`ss-pack-example__label`,children:`Example`}),e.example]}),(0,D.jsx)(`button`,{type:`button`,className:`ss-pack-detail-toggle`,"aria-expanded":r,onClick:()=>o(e.id),children:r?`Hide details`:t?`What this is doing →`:`What's inside →`})]}),(0,D.jsx)(`div`,{className:`ss-pack-action`,children:t?(0,D.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>a(e.id),className:`ss-btn ss-btn--secondary`,style:{height:30,padding:`0 12px`,fontSize:11},title:`Remove this pack from your machine.`,children:n===`uninstalling`?`Removing…`:`Remove`}):(0,D.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>i(e.id),className:`ss-btn ss-btn--primary`,style:{height:30,padding:`0 14px`,fontSize:11},title:`Install this guardrail pack.`,children:n===`installing`?`Installing…`:`Install`})})]}),r&&(0,D.jsxs)(`div`,{className:`ss-pack-detail`,children:[(0,D.jsxs)(`div`,{className:`ss-pack-detail__section`,children:[(0,D.jsx)(`span`,{className:`ss-pack-detail__label`,children:t?`Installed`:`What gets installed`}),(0,D.jsxs)(`p`,{className:`ss-pack-detail__text`,children:[(0,D.jsxs)(`code`,{children:[e.hubRulesetId,`.rules`]}),` — one plain-text rules file`,t?` now living in `:`, written to `,`your `,(0,D.jsx)(`code`,{children:`.sigmashake/rules/`}),` folder.`,` `,t?`It's active right away — no restart needed.`:`Installing adds just this one file; removing the pack deletes it.`]})]}),(0,D.jsxs)(`div`,{className:`ss-pack-detail__section`,children:[(0,D.jsx)(`span`,{className:`ss-pack-detail__label`,children:`What it does`}),(0,D.jsx)(`ul`,{className:`ss-pack-detail__list`,children:e.details.protects.map(e=>(0,D.jsx)(`li`,{children:e},e))})]}),(0,D.jsxs)(`div`,{className:`ss-pack-detail__section`,children:[(0,D.jsx)(`span`,{className:`ss-pack-detail__label`,children:`See it working`}),(0,D.jsx)(`p`,{className:`ss-pack-detail__text`,children:e.details.tryThis}),(0,D.jsxs)(`p`,{className:`ss-pack-detail__hint`,children:[`Every block and approval prompt is logged on the`,` `,(0,D.jsx)(`a`,{href:`/audit`,children:`Activity`}),` page. To fire a rule on purpose without leaving the dashboard, open `,(0,D.jsx)(`a`,{href:`/try`,children:`Try It`}),`.`]})]})]})]})}function Ef(){let e=new URLSearchParams(window.location.search).get(`starter`),t=wf(e),[n,r]=(0,_.useState)(new Set),[i,a]=(0,_.useState)({}),[o,s]=(0,_.useState)(new Set),[c,l]=(0,_.useState)(null);function u(e){s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}(0,_.useEffect)(()=>{let e=!1;return fetch(`/api/json/hub/installed`).then(e=>e.json()).then(t=>{e||r(new Set(t.installed))}).catch(()=>{}),()=>{e=!0}},[]);function d(e,t){l({msg:e,type:t}),setTimeout(()=>l(null),5e3)}async function f(){try{let e=await(await fetch(`/api/json/hub/installed`)).json();r(new Set(e.installed))}catch{}}async function p(e){let t=Cf.find(t=>t.id===e);if(t){a(t=>({...t,[e]:`installing`}));try{let n=await fetch(`/api/hub/install`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...H()},body:JSON.stringify({id:t.hubRulesetId})}),i=await n.text(),a=n.headers.get(`Content-Type`)??``,o=null;if(a.includes(`application/json`))try{o=JSON.parse(i)}catch{}o?.ok?(r(e=>new Set([...e,t.hubRulesetId])),s(t=>new Set([...t,e])),d(o.already_installed?`${t.title} — already installed`:`${t.title} — installed`,`ok`)):d(o?o.error??`Could not install ${t.title}`:i.replace(/<[^>]+>/g,``).trim()||`Could not install ${t.title} (HTTP ${n.status})`,`error`)}catch(e){d(`Could not reach the dashboard server (${e instanceof Error?e.message:String(e)})`,`error`)}finally{a(t=>({...t,[e]:`idle`})),f()}}}async function m(e){let t=Cf.find(t=>t.id===e);if(t&&window.confirm(`Remove “${t.title}”?\n\nThe rules in this pack stop applying. You can install it again any time.`)){a(t=>({...t,[e]:`uninstalling`}));try{let e=await fetch(`/api/hub/uninstall`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...H()},body:JSON.stringify({id:t.hubRulesetId})}),n=await e.text(),i=e.headers.get(`Content-Type`)??``,a=null;if(i.includes(`application/json`))try{a=JSON.parse(n)}catch{}a?.ok||e.ok&&!a?(r(e=>{let n=new Set(e);return n.delete(t.hubRulesetId),n}),d(`${t.title} — removed`,`ok`)):d(a?a.error??`Could not remove ${t.title}`:n.replace(/<[^>]+>/g,``).trim()||`Could not remove ${t.title} (HTTP ${e.status})`,`error`)}catch(e){d(`Could not reach the dashboard server (${e instanceof Error?e.message:String(e)})`,`error`)}finally{a(t=>({...t,[e]:`idle`})),f()}}}let h={coding:`for coding with AI`,"knowledge-work":`for email and docs`},g=t.filter(e=>n.has(e.hubRulesetId)).length;return(0,D.jsxs)(`div`,{className:`max-w-3xl mx-auto space-y-6`,children:[(0,D.jsxs)(`section`,{"data-tutorial":`guard-hero`,className:`rounded-2xl p-5`,style:{border:`1px solid var(--color-line-1)`,background:`var(--color-surface-1)`},children:[(0,D.jsx)(`p`,{className:`ss-list-section-title`,style:{padding:0,marginBottom:8},children:`Guardrails`}),(0,D.jsxs)(`h1`,{className:`text-[18px] font-semibold text-[var(--color-fg-0)] tracking-tight`,children:[`One-tap protection`,e&&h[e]?` ${h[e]}`:``]}),(0,D.jsxs)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)] mt-1.5 leading-relaxed`,children:[`Each pack is a small set of rules that guard against a specific AI risk. Toggle them on and off — installing or removing only touches rule files in`,` `,(0,D.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`.sigmashake/`}),`.`]}),(0,D.jsxs)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mt-3`,children:[g,` of `,t.length,` active`]})]}),c&&(0,D.jsx)(`div`,{className:`rounded-xl px-4 py-2.5 text-[12px]`,style:{border:`1px solid ${c.type===`ok`?`color-mix(in oklab, var(--color-hig-green) 36%, transparent)`:`color-mix(in oklab, var(--color-hig-red) 36%, transparent)`}`,background:c.type===`ok`?`color-mix(in oklab, var(--color-hig-green) 12%, var(--color-surface-1))`:`color-mix(in oklab, var(--color-hig-red) 12%, var(--color-surface-1))`,color:c.type===`ok`?`var(--color-hig-green)`:`var(--color-hig-red)`,backdropFilter:`saturate(180%) blur(10px)`},children:c.msg}),(0,D.jsx)(`div`,{"data-tutorial":`guard-packs`,className:`ss-list`,children:t.map(e=>(0,D.jsx)(Tf,{pack:e,installed:n.has(e.hubRulesetId),state:i[e.id]??`idle`,expanded:o.has(e.id),onInstall:p,onUninstall:m,onToggleDetails:u},e.id))}),(0,D.jsx)(`div`,{"data-tutorial":`guard-advanced`,className:`rounded-xl p-4`,style:{border:`1px dashed var(--color-line-1)`,background:`color-mix(in oklab, var(--color-surface-1) 50%, transparent)`},children:(0,D.jsxs)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:[`Want more control? The`,` `,(0,D.jsx)(`a`,{href:`/hub`,className:`text-[var(--color-brand)] hover:underline`,children:`advanced library`}),` `,`has the full set of community rulesets and lets you preview every rule before installing.`]})})]})}function Df(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Of(e){let t=e;if(t.endsWith(`/.sigmashake/rules`)&&(t=t.slice(0,-18)),t.endsWith(`\\.sigmashake\\rules`)&&(t=t.slice(0,-18)),t.startsWith(`/home/`)){let e=t.slice(6),n=e.indexOf(`/`);return n>=0?`~/${e.slice(n+1)}`:`~`}if(t.startsWith(`C:\\Users\\`)){let e=t.slice(9),n=e.indexOf(`\\`);return n>=0?`~\\${e.slice(n+1)}`:`~`}if(t.length>40){let e=t.split(/[/\\]/);if(e.length>2)return`…/${e[e.length-1]}`}return t}var kf=[{value:`downloads`,label:`most downloaded`},{value:`newest`,label:`newest`},{value:`rules`,label:`most rules`}],Af=[``,`critical`,`high`,`medium`,`low`],jf=[``,`deny`,`ask`,`allow`,`log`];function Mf(){return(0,D.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)] p-4 space-y-3 shimmer`,children:[(0,D.jsx)(`div`,{className:`h-4 bg-[var(--color-surface-3)] rounded-sm w-2/3`}),(0,D.jsx)(`div`,{className:`h-3 bg-[var(--color-surface-2)] rounded-sm w-1/3`}),(0,D.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,D.jsx)(`div`,{className:`h-5 bg-[var(--color-surface-3)] rounded-sm w-14`}),(0,D.jsx)(`div`,{className:`h-5 bg-[var(--color-surface-3)] rounded-sm w-10`})]}),(0,D.jsx)(`div`,{className:`h-7 bg-[var(--color-surface-3)] rounded-sm`})]})}function Nf({tech:e}){return(0,D.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 Pf({install:e,onRemove:t,removing:n}){let r=Of(e.path),i=e.in_sync?`bg-emerald-400`:`bg-amber-400 animate-pulse`;return(0,D.jsxs)(`div`,{className:`group/chip inline-flex items-center gap-1.5 max-w-full pl-1.5 pr-0.5 py-0.5 rounded-sm bg-[var(--color-surface-2)] border border-[var(--color-line-1)] text-[10px] font-mono text-[var(--color-fg-2)]`,title:e.in_sync?`In sync — files present in ${e.path}`:`Drift — ${e.drift_reason??`files missing or empty`} (${e.path})`,children:[(0,D.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 ${i}`,"aria-hidden":!0}),(0,D.jsx)(`span`,{className:`truncate`,title:e.path,children:r}),(0,D.jsx)(`button`,{type:`button`,onClick:r=>{r.preventDefault(),r.stopPropagation(),n||t(e.path)},disabled:n,title:`Remove from this location`,"aria-label":`Uninstall from ${e.path}`,className:`shrink-0 inline-flex items-center justify-center w-4 h-4 rounded-sm text-[var(--color-fg-4)] hover:text-red-300 hover:bg-red-500/10 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed`,children:n?(0,D.jsx)(`svg`,{className:`animate-spin`,width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,D.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}):(0,D.jsxs)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,children:[(0,D.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,D.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}function Ff({isInstalling:e,hasInstalls:t,onInstallDefault:n,onPickPath:r}){let[i,a]=(0,_.useState)(!1),o=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!i)return;function e(e){o.current&&(o.current.contains(e.target)||a(!1))}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]),(0,D.jsxs)(`div`,{ref:o,className:`relative flex w-full`,children:[(0,D.jsx)(`button`,{onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},disabled:e,className:`flex-1 h-7 rounded-l-sm text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer