failproofai 1.0.13-beta.1 → 1.0.13-beta.2

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.
Files changed (115) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +1 -1
  5. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  6. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +2 -2
  10. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  11. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +2 -2
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.rsc +3 -3
  18. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  20. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  21. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
  30. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  32. package/.next/standalone/.next/server/app/index.html +1 -1
  33. package/.next/standalone/.next/server/app/index.rsc +3 -3
  34. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  35. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  36. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  37. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  38. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  40. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
  41. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  43. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  44. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  46. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  47. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  48. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  50. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  51. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  53. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +8 -8
  54. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  56. package/.next/standalone/.next/server/chunks/_0tovk6q0miud6._.js +1 -1
  57. package/.next/standalone/.next/server/chunks/_0trp3ycqv17cl._.js +1 -1
  58. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4vkpxxu7._.js +1 -1
  59. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08ch3staq3ejw._.js +1 -1
  60. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0bigvy9xmv2ka._.js +1 -1
  61. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h86bl2qf0k_o._.js +1 -1
  62. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pia5h3p8re4c._.js +1 -1
  63. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1-ey9fgesfbc0._.js +1 -1
  64. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__15usvs-ms-0hf._.js +1 -1
  65. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__16gb3_92zvk5x._.js +1 -1
  66. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0mhtkwwx1pxcq._.js → [root-of-the-server]__19nvo1qfswchs._.js} +2 -2
  67. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1avi2kypusyb_._.js +1 -1
  68. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1r7drlqli-ado._.js +1 -1
  69. package/.next/standalone/.next/server/chunks/ssr/_0eoura3_9gjb-._.js +1 -1
  70. package/.next/standalone/.next/server/chunks/ssr/_0ouu886szh6yj._.js +1 -1
  71. package/.next/standalone/.next/server/chunks/ssr/_0pedwblqdoh58._.js +1 -1
  72. package/.next/standalone/.next/server/chunks/ssr/_1djqs9i27e4kg._.js +1 -1
  73. package/.next/standalone/.next/server/chunks/ssr/{_0bc4f4quq6w47._.js → _1nvqg4si0splb._.js} +2 -2
  74. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo5_vm5f.js +2 -2
  75. package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9snixb5fd-._.js +1 -1
  76. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47q0xq5w._.js +1 -1
  77. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x33jqb6._.js +1 -1
  78. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpcz0uxur._.js +1 -1
  79. package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h47jmhhd._.js +1 -1
  80. package/.next/standalone/.next/server/chunks/ssr/{node_modules_html-to-image_es_index_1jwgv0pf-gy96.js → node_modules_html-to-image_es_index_1gk40bvx2bftt.js} +1 -1
  81. package/.next/standalone/.next/server/chunks/ssr/package_json_[json]_cjs_013tntikdft59._.js +1 -1
  82. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  83. package/.next/standalone/.next/server/pages/404.html +1 -1
  84. package/.next/standalone/.next/server/pages/500.html +1 -1
  85. package/.next/standalone/.next/server/preview-props.json +3 -3
  86. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  87. package/.next/standalone/.next/server/server-reference-manifest.json +23 -23
  88. package/.next/standalone/.next/static/chunks/{2n-bzb7pxe7hu.js → 061bksch79zq2.js} +1 -1
  89. package/.next/standalone/.next/static/chunks/{38u_i3j5funpi.js → 1l9lji2he-mbw.js} +1 -1
  90. package/.next/standalone/.next/static/chunks/{3vzut6zpdrvtx.js → 1mkf3bas1g5ka.js} +1 -1
  91. package/.next/standalone/.next/static/chunks/{0u5weo5jdn2s8.js → 22gs9785ug-vp.js} +1 -1
  92. package/.next/standalone/.next/static/chunks/{18-icoqze51kl.js → 2f9-xdgd1o3r5.js} +1 -1
  93. package/.next/standalone/.next/static/chunks/{2zc7lg-jq353g.js → 2q-6h4rclnu98.js} +1 -1
  94. package/.next/standalone/.next/static/chunks/{33djjf12bhcsv.js → 2x-77r0k0xm3b.js} +1 -1
  95. package/.next/standalone/.next/static/chunks/{3symuj7t4js-c.js → 2xox4fr0q-ftn.js} +1 -1
  96. package/.next/standalone/.next/static/chunks/{0cbom4-ijx_a_.js → 3lgxb73wehfv2.js} +1 -1
  97. package/.next/standalone/.next/static/chunks/{2d-u90dt4-8rd.js → 44rukkkzacqkl.js} +2 -2
  98. package/.next/standalone/hermes-plugin/plugin.yaml +1 -1
  99. package/.next/standalone/package.json +9 -9
  100. package/.next/standalone/sdk/python/uv.lock +3 -3
  101. package/.next/standalone/server.js +1 -1
  102. package/dist/cli.mjs +368 -221
  103. package/dist/worker.mjs +1 -1
  104. package/hermes-plugin/plugin.yaml +1 -1
  105. package/openclaw-plugin/index.js +211 -17
  106. package/package.json +9 -9
  107. package/src/hooks/daemon-service.ts +168 -3
  108. package/src/hooks/enforcement-capability.ts +1 -1
  109. package/src/hooks/integrations.ts +2 -5
  110. package/src/hooks/uninstall-cli.ts +3 -0
  111. package/openclaw-plugin/daemon-client.js +0 -254
  112. package/openclaw-plugin/hooks.js +0 -187
  113. /package/.next/standalone/.next/static/{1n2dyfTQb0MDajeqlipJy → TdOlUedz_AHC-0Ops67a_}/_buildManifest.js +0 -0
  114. /package/.next/standalone/.next/static/{1n2dyfTQb0MDajeqlipJy → TdOlUedz_AHC-0Ops67a_}/_clientMiddlewareManifest.js +0 -0
  115. /package/.next/standalone/.next/static/{1n2dyfTQb0MDajeqlipJy → TdOlUedz_AHC-0Ops67a_}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,36406,e=>{"use strict";let t,s;var n=e.i(43476),r=e.i(71645),l=e.i(74080);function i(e,t,s){let n,r=s.initialDeps??[],l=!0;function i(){let i=e();return(i.length!==r.length||i.some((e,t)=>r[t]!==e))&&(r=i,n=t(...i),(null==s?void 0:s.onChange)&&!(l&&s.skipInitialOnChange)&&s.onChange(n),l=!1),n}return i.updateDeps=e=>{r=e},i}function o(e,t){if(void 0!==e)return e;throw Error(`Unexpected undefined${t?`: ${t}`:""}`)}let a=(e,t)=>1.01>Math.abs(e-t),h=()=>{if(void 0!==t)return t;if("u"<typeof navigator)return t=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return t=!0;let e=navigator.maxTouchPoints;return t="MacIntel"===navigator.platform&&void 0!==e&&e>0},d={capture:!0,passive:!0};class c{constructor(e){this.host=e,this._touch=null,this.inMotion=()=>null!==this._touch&&"lateFling"!==this._touch.phase,this.dragging=()=>{var e;return(null==(e=this._touch)?void 0:e.phase)==="down"&&this._touch.moved},this.tail=()=>{var e;return(null==(e=this._touch)?void 0:e.phase)==="tail"?this._touch.moved?"fling":"tap":null},this.onScroll=({isScrolling:e,ownReadBack:t,moved:s,external:n})=>{var r,l,i;return e&&(null==(r=this._touch)?void 0:r.phase)==="tail"?this._openTail(this._touch.moved||!t,!1):(null==(l=this._touch)?void 0:l.phase)==="lateFling"&&(this.host.now()>this._touch.until?this._touch=null:n&&e&&s&&this._openTail(!0,!1)),!t&&!!e&&!!s&&(null==(i=this._touch)?void 0:i.phase)==="down"&&(this._touch.moved=!0,!0)},this.touchStart=()=>{this.end(),this._touch={phase:"down",moved:!1}},this.touchEnd=()=>{var e;let t=(null==(e=this._touch)?void 0:e.phase)==="down"&&this._touch.moved;this.end(),this._openTail(t,t)},this.end=()=>{var e;let t=this.host.getWindow();(null==(e=this._touch)?void 0:e.phase)==="tail"&&null!=t&&t.clearTimeout(this._touch.timerId),this._touch=null},this.listen=e=>{let t=()=>this.touchStart(),s=()=>this.touchEnd();return e.addEventListener("touchstart",t,d),e.addEventListener("touchend",s,d),e.addEventListener("touchcancel",s,d),()=>{e.removeEventListener("touchstart",t,d),e.removeEventListener("touchend",s,d),e.removeEventListener("touchcancel",s,d),this.end()}},this._openTail=(e,t)=>{let s=this.host.getWindow();if(!h()||null==s)return;this.end();let n={phase:"tail",moved:e,awaitingFling:t,timerId:s.setTimeout(()=>{this.host.tailStillMoving()?this._openTail(n.moved,n.awaitingFling):(this._touch=n.awaitingFling?{phase:"lateFling",until:this.host.now()+1e3}:null,this.host.onTailClosed())},150)};this._touch=n}}get touch(){return this._touch}}let u=e=>e,m=e=>{let t=e.overscan*Math.max(e.lanes??1,1),s=Math.max(e.startIndex-t,0),n=Math.min(e.endIndex+t,e.count-1)-s+1,r=Array(n);for(let e=0;e<n;e++)r[e]=s+e;return r},f={passive:!0},p=(e,t)=>{let s=e.scrollElement;if(!s)return;let n=()=>{t({width:s.innerWidth,height:s.innerHeight})};return n(),s.addEventListener("resize",n,f),()=>{s.removeEventListener("resize",n)}},g="u"<typeof window||"onscrollend"in window,x=(e,t)=>((e,t,s)=>{var n,r;let l,i=e.scrollElement;if(!i)return;let o=e.targetWindow;if(!o)return;let a=e.options.useScrollendEvent&&g,h=0,d=a?null:(n=()=>t(s(i),!1),r=e.options.isScrollingResetDelay,Object.assign(function(...e){o.clearTimeout(l),l=o.setTimeout(()=>n.apply(this,e),r)},{cancel:()=>{o.clearTimeout(l)}})),c=e=>()=>{h=s(i),null==d||d(),t(h,e)},u=c(!0),m=c(!1);return i.addEventListener("scroll",u,f),a&&i.addEventListener("scrollend",m,f),()=>{i.removeEventListener("scroll",u),a&&i.removeEventListener("scrollend",m),null==d||d.cancel()}})(e,t,t=>e.options.horizontal?t.scrollX:t.scrollY),y=(e,t,s)=>{if(s.options.useCachedMeasurements){let t=s.indexFromElement(e),n=s.options.getItemKey(t);return s.itemSizeCache.get(n)??s.options.estimateSize(t)}if(null==t?void 0:t.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[s.options.horizontal?"inlineSize":"blockSize"])}if(!t){let t=s.indexFromElement(e),n=s.options.getItemKey(t),r=s.itemSizeCache.get(n);if(void 0!==r)return r}return e[s.options.horizontal?"offsetWidth":"offsetHeight"]},v=(e,{adjustments:t=0,behavior:s},n)=>{var r,l;null==(l=null==(r=n.scrollElement)?void 0:r.scrollTo)||l.call(r,{[n.options.horizontal?"left":"top"]:e+t,behavior:s})},b=(e,t)=>"smooth"===e?t?"smoothLanded":"smooth":"instant",S=e=>(null==e?void 0:e.phase)==="smooth"||(null==e?void 0:e.phase)==="smoothLanded";class j{constructor(e){let t,s,n,r;this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._iosGesture=new c({getWindow:()=>this.targetWindow,now:()=>this.now(),tailStillMoving:()=>{let e=this.scrollState;if((null==e?void 0:e.phase)!=="queued"||null!==this.pendingWrite)return!1;let t=this._readElementOffset();return!(null===t||null===this._lastElementOffset||1>Math.abs(t-this._lastElementOffset))&&(this._lastElementOffset=t,e.samples=[...e.samples??[],{t:this.now(),offset:t}],!0)},onTailClosed:()=>{let e=this.scrollState;(null==e?void 0:e.phase)==="queued"&&function(e){let t=e[e.length-1];if(void 0===t)return!1;let s=e.length-2;for(;s>=0&&t.t-e[s].t<40;)s--;if(s<0)return!1;let n=e[s];return Math.abs(t.offset-n.offset)/(t.t-n.t)>=.05}(e.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand(),this._retryClampedAdjustment()}}),this._lastElementOffset=null,this.pendingWrite=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var e,t,s;return(null==(s=null==(t=null==(e=this.targetWindow)?void 0:e.performance)?void 0:t.now)?void 0:s.call(t))??Date.now()},this.observer=(t=null,s=null,n=()=>{let e;if(t)return t;let n=this.targetWindow;if(!n||!n.ResizeObserver)return null;let l=(e=new Set,s={schedule:t=>{let s=n.requestAnimationFrame(()=>{e.delete(s),t()});e.add(s)},cancel:()=>{e.forEach(e=>n.cancelAnimationFrame(e)),e.clear()}});return t=new n.ResizeObserver(e=>{let t=()=>{let t={sync:!1};this._resizeBatch=t;try{e.forEach(r)}finally{this._resizeBatch=null,t.notify&&(this.notify(t.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment())}};this.options.useAnimationFrameWithResizeObserver?l.schedule(t):t()})},r=e=>{let t=e.target,s=this.indexFromElement(t);if(!t.isConnected){for(let[e,s]of(this.observer.unobserve(t),this.elementsCache))if(s===t){this.elementsCache.delete(e);break}return}this.isIndexInRange(s)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,e,this))},{disconnect:()=>{var e;null==(e=n())||e.disconnect(),null==s||s.cancel(),t=null,s=null},observe:e=>{var t;return null==(t=n())?void 0:t.observe(e,{box:"border-box"})},unobserve:e=>{var t;return null==(t=n())?void 0:t.unobserve(e)}}),this.range=null,this.setOptions=e=>{var t;let s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:u,rangeExtractor:m,onChange:()=>{},measureElement:y,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(let t in e){let n=e[t];void 0!==n&&(s[t]=n)}let n=this.options,r=null,l=null,i=!1;if(void 0!==n&&n.enabled&&s.enabled&&"end"===s.anchorTo&&null!==this.scrollElement){let e=n.count,o=s.count,a=this.getMeasurements(),h=(null==(t=this._singleLaneMeasurements)?void 0:t.items)??a,d=e=>{var t;return"object"==typeof(t=h[e])?t.key:t},c=e>0?d(0):null,u=e>0?d(e-1):null;if(o!==e||e>0&&o>0&&(s.getItemKey(0)!==c||s.getItemKey(o-1)!==u)){i=!0;let t=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??a[0]:null;t&&(r=[t.key,this.getScrollOffset()-t.start]);let h=!0===s.followOnAppend?"auto":s.followOnAppend||null;h&&o>0&&this.isAtEnd(n.scrollEndThreshold)&&(0===e||s.getItemKey(o-1)!==u)&&(o>e||function(e,t,s,n){if(0===t)return!1;let r=n(0),l=new Set,i=0;for(;i<e;){let e=s(i);if(e===r)break;l.add(e),i++}let o=e-i;if(0===o||o>=t)return!1;for(let e=0;e<o;e++)if(n(e)!==s(i+e))return!1;for(let e=o;e<t;e++)if(l.has(n(e)))return!1;return!0}(e,o,d,s.getItemKey))&&(l=h)}}this.options=s,i&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=null;if(r&&null!==this.scrollOffset&&!this._awaitingCommandReadBack()){let[e,t]=r,s=this.getMeasurements(),{count:n,getItemKey:i}=this.options,a=0;for(;a<n&&i(a)!==e;)a++;if(a<n){let e=s[a];if(e){let s=Math.max(0,e.start+t);l||s===this.scrollOffset||(o=s-this.scrollOffset,this.scrollOffset=s)}}}l?this.pendingScrollAnchor={kind:"follow",behavior:l}:null!==o&&(this._canWriteScroll()?this.pendingScrollAnchor={kind:"anchor",delta:o}:(this._holdOffset+=o,this._followOffsetTarget(o)))},this.notify=e=>{var t,s;null==(s=(t=this.options).onChange)||s.call(t,this,e)},this.maybeNotify=i(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{var e;this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,null==(e=this._momentumStop)||e.restore(),this._momentumStop=null,this.isScrolling=!1,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._clampedAdjustment=null,this.pendingWrite=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;let t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t)return void this.maybeNotify();this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{var s,n,r,l;let i=t?this._elementMaxScrollOffset():null,o=this._reportedOverscroll;this._reportedOverscroll=e<0||null!==i&&e>i+1;let h=e;this._lastElementOffset=h,e=this._toLayoutOffset(e);let d=this._classifyScrollEvent(e,t,i);if("spurious"===d)return;"readBack"===d?e=this.pendingWrite.target:"clampedReadBack"===d&&(null==(s=this.scrollState)?void 0:s.index)!=null&&e<this.getMaxScrollOffset()-1.5?this.scrollState.lastTargetOffset=e:function({kind:e,offset:t,command:s,target:n}){let r;return"spurious"!==e&&"readBack"!==e&&"clampedReadBack"!==e&&(null==s?void 0:s.index)!=null&&"queued"!==s.phase&&"smooth"!==(r=s.phase)&&"smoothFinishing"!==r&&!a(t,s.lastTargetOffset)&&!a(t,n())&&"clampedEcho"!==e}({kind:d,offset:e,command:this.scrollState,target:()=>this.getScrollStateTarget(this.scrollState)})&&(this.scrollState=null),this.pendingWrite=null,null!==this._clampedAdjustment&&Math.abs(e-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null);let c=this.getScrollOffset(),u=this.scrollDirection;this.scrollDirection=t?c===e?this.scrollDirection:c<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t;let m=this.scrollState;if((null==m?void 0:m.phase)==="queued"&&"external"===d&&t)if(o||this._reportedOverscroll)m.samples=[];else{let e=this.now();m.samples=[...(m.samples??[]).filter(t=>e-t.t<=200),{t:e,offset:h}],(null!==u&&this.scrollDirection!==u||function(e){let t=e[e.length-1];if(void 0===t)return!1;let s=e.length-2;for(;s>=0&&t.t-e[s].t<40;)s--;if(s<0)return!1;let n=e[s],r=s-1;for(;r>=0&&n.t-e[r].t<40;)r--;if(r<0)return!1;let l=e[r],i=(t.offset-n.offset)/(t.t-n.t),o=(n.offset-l.offset)/(n.t-l.t);return i*o>=0&&Math.abs(i)>=2*Math.abs(o)&&Math.abs(i)-Math.abs(o)>=.8}(m.samples))&&(this.scrollState=null)}this._iosGesture.onScroll({isScrolling:t,ownReadBack:"readBack"===d,moved:e!==c,external:"external"===d&&(null==(n=this.scrollState)?void 0:n.phase)!=="smooth"&&(null==(r=this.scrollState)?void 0:r.phase)!=="smoothFinishing"})&&(null==(l=this.scrollState)?void 0:l.phase)==="queued"&&(this.scrollState=null),this._flushHoldIfReady(!0),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement&&this.unsubs.push(this._iosGesture.listen(this.scrollElement)),this._scrollToOffset(this.getScrollOffset())}this._noteClampMax();let s=this.pendingScrollAnchor;this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled&&("anchor"===s.kind?this._canWriteScroll()?S(this.scrollState)&&!a(this.getScrollOffset()-s.delta,this.scrollState.lastTargetOffset)||(this._followOffsetTarget(s.delta),this._scrollToOffset(this.getScrollOffset())):(this._holdOffset+=s.delta,this._followOffsetTarget(s.delta),this.notify(!1)):this.scrollToEnd({behavior:s.behavior})),this._flushHoldIfReady(!1),this._retryClampedAdjustment()},this._classifyScrollEvent=(e,t,s)=>{var n;return function({offset:e,isScrolling:t,elementMax:s,holdOffset:n,scrollOffset:r,pendingWrite:l,clampedMaxAtWrite:i}){var o;return t&&null===l&&e===r?"spurious":null!==l&&1.5>Math.abs(e-l.target)?"readBack":null!==l&&!l.smooth&&null!==s&&l.target>s+n+.5&&1.5>Math.abs(e-(s+n))||null!==l&&!l.smooth&&(null==(o=l.lowMaxes)?void 0:o.some(t=>1.5>Math.abs(e-t)))?"clampedReadBack":null!==i&&1.5>Math.abs(e-i)?"clampedEcho":"external"}({offset:e,isScrolling:t,elementMax:s,holdOffset:this._holdOffset,scrollOffset:this.scrollOffset,pendingWrite:this.pendingWrite,clampedMaxAtWrite:(null==(n=this._clampedAdjustment)?void 0:n.maxAtWrite)??null})},this._retryClampedAdjustment=()=>{if(null===this._clampedAdjustment||!this.scrollElement||!this.options.enabled||!this._canWriteScroll())return;let{target:e,maxAtWrite:t}=this._clampedAdjustment,s=this.getMaxScrollOffset();s>t+.5&&(this._clampedAdjustment=e>s+.5?{target:e,maxAtWrite:s}:null,this._scrollToOffset(e))},this._writeAwaitingCommand=()=>{let e=this.scrollState;if(null===e||"queued"!==e.phase)return;let{behavior:t}=e;this.getMeasurements();let s=this.getScrollStateTarget(e);e.lastTargetOffset=s,this._clampedAdjustment=null,e.phase=b(t,null!=e.index&&a(s,this.getScrollOffset())),this._scrollToOffset(s,{behavior:t}),this.scheduleScrollReconcile()},this._readElementOffset=()=>{let e=this.scrollElement;if(null==e)return null;let{horizontal:t,isRtl:s}=this.options;return"number"==typeof e.scrollTop?t?e.scrollLeft*(s&&-1||1):e.scrollTop:"number"==typeof e.scrollY?t?e.scrollX:e.scrollY:null},this._canWriteScroll=()=>!(h()&&this._iosGesture.inMotion())&&!this._reportedOverscroll,this._flushHoldIfReady=e=>{var t;if(0===this._holdOffset||!this.scrollElement||!this.options.enabled||!this._canWriteScroll()||(null==(t=this.scrollState)?void 0:t.phase)==="smooth")return;this._holdOffset=0,null!==this.scrollOffset&&this.scrollOffset<0&&(this.scrollOffset=0),this.notify(e);let s=this.getCommandWrittenOffset()??this.getScrollOffset();this._clampedAdjustment=this._clampedBy(s),this._scrollToOffset(s)},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=i(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,s,n,r,l,i,o)=>(void 0!==this.prevLanes&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:s,getItemKey:n,enabled:r,lanes:l,laneAssignmentMode:i,gap:o}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=i(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:s,getItemKey:n,enabled:r,lanes:l,laneAssignmentMode:i,gap:o},a)=>{var h,d;let c=this.itemSizeCache;if(!r)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),1===l){let r,l,i=2*e,a=null==(h=this._singleLaneMeasurements)?void 0:h.flat;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,2*u)),a=e}let m=0===u?Array(e):this._singleLaneMeasurements.items.slice();if(0===u)r=t+s;else{let e=u-1;r=a[2*e]+a[2*e+1]+o}for(let t=u;t<e;t++){let e=n(t);m[t]=e;let s=c.get(e),l="number"==typeof s?s:this.options.estimateSize(t);a[2*t]=r,a[2*t+1]=l,r+=l+o}this._singleLaneMeasurements={flat:a,items:m};let f=(d=a,l=m.length,new Proxy(m,{get(e,t,s){if("string"==typeof t){let s=t.charCodeAt(0);if(s>=48&&s<=57){let s=+t;if(Number.isInteger(s)&&s>=0&&s<l){let t=e[s];if("object"!=typeof t){let n=d[2*s];t=e[s]={index:s,key:t,start:n,size:d[2*s+1],end:n+d[2*s+1],lane:0}}return t}}if("length"===t)return l}return Reflect.get(e,t,s)}}));return this.measurementsCache=f,f}let m=this.measurementsCache.slice(0,u),f=Array(l).fill(void 0),p=new Float64Array(l),g=0;for(let e=0;e<u;e++){let t=m[e];t&&(void 0===f[t.lane]&&g++,f[t.lane]=e,p[t.lane]=t.end)}for(let r=u;r<e;r++){let e,a,h=n(r),d=this.laneAssignments.get(r),u="estimate"===i||c.has(h);if(void 0!==d&&this.options.lanes>1){let n=f[e=d],r=void 0!==n?m[n]:void 0;a=r?r.end+o:t+s}else if(g===l){let t=0,s=p[0],n=f[0];for(let e=1;e<l;e++){let r=p[e];(r<s||r===s&&f[e]<n)&&(t=e,s=r,n=f[e])}e=t,a=s+o,u&&this.laneAssignments.set(r,e)}else e=r%this.options.lanes,a=t+s,u&&this.laneAssignments.set(r,e);let x=c.get(h),y="number"==typeof x?x:this.options.estimateSize(r),v=a+y;m[r]={index:r,start:a,size:y,end:v,key:h,lane:e},void 0===f[e]&&g++,f[e]=r,p[e]=v}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=i(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,s,n)=>0===e.length||0===t?(this.range=null,null):(this.range=function(e,t,s,n,r){let l=e.length-1;if(e.length<=n)return{startIndex:0,endIndex:l};if(1===n&&null!==r){let e=function(e,t,s){let n=0;for(;n<=t;){let r=(n+t)/2|0,l=e[2*r];if(l<s)n=r+1;else{if(!(l>s))return r;t=r-1}}return n>0?n-1:0}(r,l,s),n=e,i=s+t;for(;n<l&&r[2*n]+r[2*n+1]<i;)n++;return{startIndex:e,endIndex:n}}let i=w(0,l,t=>e[t].start,s),o=i;if(1===n)for(;o<l&&e[o].end<s+t;)o++;else if(n>1){let r=Array(n).fill(0);for(;o<l&&r.some(e=>e<s+t);){let t=e[o];r[t.lane]=t.end,o++}let a=Array(n).fill(s+t);for(;i>=0&&a.some(e=>e>=s);){let t=e[i];a[t.lane]=t.start,i--}i=Math.max(0,i-i%n),o=Math.min(l,o+(n-1-o%n))}return{startIndex:i,endIndex:o}}(e,t,s,n,1===n&&null!==this._singleLaneMeasurements?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=i(()=>{let e=null,t=null,s=this.calculateRange();return s&&(e=s.startIndex,t=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t,this.options.lanes]},(e,t,s,n,r,l)=>null===n||null===r?[]:e({startIndex:n,endIndex:r,overscan:t,count:s,lanes:l}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,s=e.getAttribute(t);return s?parseInt(s,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var t;if(!S(this.scrollState))return!0;let s=this.scrollState.index??(null==(t=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:t.index);if(void 0!==s&&this.range){let t=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),n=Math.max(0,s-t),r=Math.min(this.options.count-1,s+t);return e>=n&&e<=r}return!0},this.measureElement=e=>{if(!e)return void this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let s=this.options.getItemKey(t),n=this.elementsCache.get(s);n!==e&&(n&&this.observer.unobserve(n),this.observer.observe(e),this.elementsCache.set(s,e)),e.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var s,n,r;let l,i,o;if(!this.isIndexInRange(e))return;(null==(s=this._resizeBatch)?void 0:s.sync)&&this.getMeasurements();let a=null==(n=this._singleLaneMeasurements)?void 0:n.flat;if(1===this.options.lanes&&null!=a)o=this.options.getItemKey(e),i=a[2*e],l=a[2*e+1];else{let t=this.measurementsCache[e];if(!t)return;o=t.key,i=t.start,l=t.size}let h=this.itemSizeCache.get(o)??l,d=t-h;if(0!==d){let s="end"===this.options.anchorTo&&!S(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,n=s?this._getLayoutTotalSize():0,a=this.getScrollOffset(),c=this.itemSizeCache.has(o)?i+h<=a&&"backward"!==this.scrollDirection:i<a,u=!S(this.scrollState)&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:o,start:i,size:l,end:i+l,lane:0},d,this):c);(null===this.pendingMin||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(o,t),this.itemSizeCacheVersion++;let m=!1;if(!this._awaitingCommandReadBack()&&(s?m=this.applyScrollAdjustment(this._getLayoutTotalSize()-n):u&&(m=this.applyScrollAdjustment(d))),this._resizeBatch){this._resizeBatch.notify=!0,(r=this._resizeBatch).sync||(r.sync=m);return}this.notify(m),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment()}},this.getVirtualItems=i(()=>[this.getVirtualIndexes(),this.getMeasurements(),this._holdOffset],(e,t,s)=>{let n=[];for(let r=0,l=e.length;r<l;r++){let l=t[e[r]];n.push(0===s?l:{...l,start:l.start-s,end:l.end-s})}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{var t;let s=this.getMeasurements();if(0===s.length)return;let n=null==(t=this._singleLaneMeasurements)?void 0:t.flat,r=1===this.options.lanes&&null!=n,l=w(0,s.length-1,r?e=>n[2*e]:e=>o(s[e]).start,e);return o(s[l])},this._noteClampMax=()=>{if(!this._awaitingCommandReadBack())return;let e=this._elementMaxScrollOffset();if(null===e)return;let t=this.pendingWrite,s=Math.max(e,0)+this._holdOffset;if(s>=t.target)return;let n=t.lowMaxes??(t.lowMaxes=[]);n[n.length-1]!==s&&n.push(s)},this.getMaxScrollOffset=()=>(this._elementMaxScrollOffset()??0)+this._holdOffset,this._toLayoutOffset=e=>{var t;let s=e+this._holdOffset;return(null==(t=this.pendingScrollAnchor)?void 0:t.kind)==="anchor"&&(s+=this.pendingScrollAnchor.delta),s},this._elementMaxScrollOffset=()=>{let e=this.scrollElement;if(null===e)return null;if("scrollHeight"in e)return this.options.horizontal?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight;if("document"in e){let t=e.document.documentElement;return this.options.horizontal?t.scrollWidth-e.innerWidth:t.scrollHeight-e.innerHeight}return null},this._momentumStop=null,this._stopMomentum=e=>{let t=this.scrollElement,s=this.targetWindow;if(null===t||null===s)return;let n="document"in t?t.document.scrollingElement:t;if(!(null==n?void 0:n.style))return;if(this._momentumStop){this._momentumStop.done=e;return}let{style:r}=n,l=this.options.horizontal?"overflow-x":"overflow-y",i=r.getPropertyValue(l),o=r.getPropertyPriority(l);r.setProperty(l,"hidden","important");let a={restore:()=>"hidden"===r.getPropertyValue(l)&&"important"===r.getPropertyPriority(l)&&(r.setProperty(l,i,o),!0),done:e};this._momentumStop=a,s.requestAnimationFrame(()=>s.requestAnimationFrame(()=>{this._momentumStop===a&&(this._momentumStop=null,a.restore()&&a.done())}))},this._clampedBy=e=>{let t=this._elementMaxScrollOffset();if(null===t)return null;let s=t+this._holdOffset;return e>s+.5?{target:e,maxAtWrite:s}:null},this.getVirtualDistanceFromEnd=()=>Math.max(this._getLayoutTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,s=0)=>{if(!this.scrollElement)return 0;let n=this.getSize(),r=this.getScrollOffset();return"auto"===t&&(t=e>=r+n?"end":"start"),"center"===t?e+=(s-n)/2:"end"===t&&(e-=n),Math.max(Math.min(this.getMaxScrollOffset(),e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));let s=this.getSize(),n=this.getScrollOffset(),r=this.measurementsCache[e];if(!r)return;if("auto"===t)if(r.end>=n+s-this.options.scrollPaddingEnd)t="end";else{if(!(r.start<=n+this.options.scrollPaddingStart))return[n,t];t="start"}if("end"===t&&e===this.options.count-1){let e=this.getMaxScrollOffset();return[Math.max(Math.min(e-this.options.paddingEnd+this.options.scrollPaddingEnd,e),0),t]}let l="end"===t?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,t,r.size),t]},this.scrollToOffset=(e,{align:t="start",behavior:s="auto"}={})=>{this._startScroll({index:null,align:t},this.getOffsetForAlignment(e,t),s,"absolute")},this.scrollToIndex=(e,{align:t="auto",behavior:s="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getOffsetForIndex(e,t);if(!n)return;let[r,l]=n;this._startScroll({index:e,align:l},r,s,"absolute")},this.scrollBy=(e,{behavior:t="auto"}={})=>{let s=this.getOffsetForAlignment((this.getCommandWrittenOffset()??this.getScrollOffset())+e,"start");this._startScroll({index:null,align:"start"},s,t,"relative")},this.scrollToEnd=({behavior:e="auto"}={})=>{this.options.count>0?this._startScroll({index:this.options.count-1,align:"end",toEnd:!0},Math.max(this.getMaxScrollOffset(),0),e,"absolute"):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.cancelScroll=()=>{null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>Math.max(this._getLayoutTotalSize()-this._holdOffset,0),this._getLayoutTotalSize=()=>{var e,t;let s,n=this.getMeasurements();if(0===n.length)s=this.options.paddingStart;else if(1===this.options.lanes){let r=n.length-1,l=null==(e=this._singleLaneMeasurements)?void 0:e.flat;s=null!=l?l[2*r]+l[2*r+1]:(null==(t=n[r])?void 0:t.end)??0}else{let e=Array(this.options.lanes).fill(null),t=n.length-1;for(;t>=0&&e.some(e=>null===e);){let s=n[t];null===e[s.lane]&&(e[s.lane]=s.end),t--}s=Math.max(...e.filter(e=>null!==e))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(0===this.itemSizeCache.size)return e;for(let t of this.getMeasurements())t&&this.itemSizeCache.has(t.key)&&e.push({index:t.index,key:t.key,start:t.start,size:t.size,end:t.end,lane:t.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:s}={})=>{let n={target:e+(t??0),smooth:"smooth"===s};return this.pendingWrite=n,this.options.scrollToFn(e-this._holdOffset,{behavior:s,adjustments:t},this),n},this.getCommandWrittenOffset=()=>null===this.scrollState||null===this.pendingWrite||this.pendingWrite.smooth?null:this.pendingWrite.target,this._awaitingCommandReadBack=()=>{let e=this.getCommandWrittenOffset();return!(h()&&this._iosGesture.dragging())&&null!==e&&!a(e,this.getScrollOffset())},this._followOffsetTarget=e=>{null!==this.scrollState&&null==this.scrollState.index&&(this.scrollState.lastTargetOffset+=e)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}get scrollAdjustments(){return 0}applyScrollAdjustment(e,t){if(0===e)return!1;if(this._followOffsetTarget(e),!this._canWriteScroll())return this._holdOffset+=e,null!==this.scrollOffset&&(this.scrollOffset+=e),!0;{let s=this.getScrollOffset();this._clampedAdjustment=this._clampedBy(s+e);let n=this._scrollToOffset(s,{adjustments:e,behavior:t});return null!==this.scrollOffset&&(this.pendingWrite===n&&(this.scrollOffset+=e),this.scrollOffset<0&&(this.scrollOffset=0)),!0}}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}getScrollStateTarget(e){let t=e.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:null!=e.index?this.getOffsetForIndex(e.index,e.align):void 0;return t?t[0]:e.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}if("queued"===this.scrollState.phase)return void this.scheduleScrollReconcile();this.getMeasurements();let e=this.getScrollStateTarget(this.scrollState),t=null==this.scrollState.index?1:this.options.useAnimationFrameWithResizeObserver?3:2,s=e!==this.scrollState.lastTargetOffset;if(!s&&a(e,this.getScrollOffset())){if("smooth"===this.scrollState.phase?this.scrollState.phase="smoothLanded":"smoothFinishing"===this.scrollState.phase&&(this.scrollState.phase="instant"),this.scrollState.stableFrames++,this.scrollState.stableFrames>=t){this.getScrollOffset()!==e&&this._scrollToOffset(e,{behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,s){let t=this.getSize()||600,s=Math.abs(e-this.getScrollOffset()),n=S(this.scrollState)&&s>t;this.scrollState.lastTargetOffset=e,n?this.scrollState.phase="smooth":"smooth"===this.scrollState.phase?this.scrollState.phase="smoothFinishing":"smoothLanded"===this.scrollState.phase&&(this.scrollState.phase="instant"),this._scrollToOffset(e,{behavior:n?"smooth":"auto"})}this.scheduleScrollReconcile()}_startScroll(e,t,n,r){this.pendingScrollAnchor=null,this._clampedAdjustment=null;let l=this._iosGesture.tail();if("absolute"===r&&null!==l){if("fling"===l&&(void 0!==s?s:s=h()&&"u">typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("overflow-anchor: auto"))){this._stopMomentum(()=>{let e=this.scrollState;(null==e?void 0:e.phase)!=="queued"||"fling"!==this._iosGesture.tail()||this._reportedOverscroll||(this._iosGesture.end(),this._flushHoldIfReady(!0),this._writeAwaitingCommand())}),this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,phase:"queued",behavior:n,samples:[]},this.scheduleScrollReconcile();return}this._iosGesture.end()}this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,behavior:n,phase:b(n,null!=e.index&&a(t,this.getScrollOffset()))},this._scrollToOffset(t,{behavior:n}),this.scheduleScrollReconcile()}}let w=(e,t,s,n)=>{for(;e<=t;){let r=(e+t)/2|0,l=s(r);if(l<n)e=r+1;else{if(!(l>n))return r;t=r-1}}return e>0?e-1:0},M="u">typeof document?r.useLayoutEffect:r.useEffect;var N=e.i(16327),_=e.i(56420);let O={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};O.node;let k=(0,_.f)(O);function E(e){let t=new Map,s=new Map;for(let n of e){let e=n.uuid||`${n._source}:${n.timestamp}`,r=s.get(e)??0;s.set(e,r+1),t.set(n,0===r?e:`${e}#${r}`)}return t}let C={name:"user",size:24,node:[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]};C.node;let I=(0,_.f)(C),T={name:"bot",size:24,node:[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]};T.node;let z=(0,_.f)(T),A={name:"cpu",size:24,node:[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]};A.node;let F=(0,_.f)(A),R={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};R.node;let W=(0,_.f)(R),L={name:"message-square",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]};L.node;let $=(0,_.f)(L),D={name:"workflow",size:24,node:[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]};D.node;let B=(0,_.f)(D);var P=e.i(34713);let q=r.default.memo(function({entries:e,compact:t=!1}){let s=(0,r.useMemo)(()=>(function(e){let t=0,s=0,n=0,r=0,l=0,i=new Set;for(let o of e)if("user"===o.type&&t++,"queue-operation"===o.type&&l++,"assistant"===o.type){for(let e of(s++,o.message.content))"tool_use"===e.type&&("Task"===e.name&&(e.subagentType||e.subagentId)?r++:n++);o.message.model&&i.add(o.message.model)}let o="";if(e.length>=2){let t=e[e.length-1].timestampMs-e[0].timestampMs;o=(0,P.M)(t)}return{turnCount:l,userCount:t,assistantCount:s,toolCallCount:n,subagentCount:r,duration:o,models:Array.from(i)}})(e),[e]),l=t?"w-3.5 h-3.5":"w-4 h-4",i=t?"text-xs font-medium":"text-sm font-medium",o=t?"text-[10px] text-muted-foreground":"text-xs text-muted-foreground",a=[...t?[]:[{Icon:$,color:"text-primary",v:s.turnCount,l:"Turns"}],{Icon:I,color:"text-[color:var(--chart-1)]",v:s.userCount,l:"User"},{Icon:z,color:"text-[color:var(--chart-2)]",v:s.assistantCount,l:"Assistant"},{Icon:k,color:"text-[color:var(--chart-3)]",v:s.toolCallCount,l:t?"Tools":"Tool Calls"},{Icon:B,color:"text-[color:var(--chart-5)]",v:s.subagentCount,l:"Subagents"},{Icon:W,color:"text-[color:var(--chart-4)]",v:s.duration||"—",l:"Duration"},{Icon:F,color:"text-[color:var(--chart-5)]",v:s.models.length>0?s.models.join(", "):"—",l:t?"Model":"Model(s)"}];return(0,n.jsx)("div",{className:t?"bg-muted/30 border border-border/50 rounded-lg p-3 mb-3":"bg-card border border-border rounded-lg p-4",children:(0,n.jsx)("div",{className:`grid grid-cols-2 ${t?"sm:grid-cols-6 gap-3":"sm:grid-cols-4 lg:grid-cols-7 gap-4"}`,children:a.map(({Icon:e,color:t,v:s,l:r})=>(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(e,{className:`${l} ${t}`}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:`${i} truncate max-w-[120px]`,children:s}),(0,n.jsx)("div",{className:o,children:r})]})]},r))})})}),U={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};U.node;let H=(0,_.f)(U);var V=e.i(67927);function K(e){return JSON.stringify(e.raw,null,2)}let G=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0});function Y(e){let t=new Date(e),s=G.format(t),n=t.getMilliseconds().toString().padStart(3,"0");return`${s}.${n}`}let J=r.default.memo(function({entry:e,isCollapsed:t,entryCount:s,onToggle:r}){let l="function"==typeof r,i=(0,n.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full bg-primary/10 border border-primary/20 text-primary text-xs font-medium${l?" group-hover:bg-primary/20 transition-colors":""}`,children:[l?(0,n.jsx)(V.f,{className:`w-3 h-3 transition-transform ${t?"":"rotate-90"}`}):(0,n.jsx)(H,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:e.label}),(0,n.jsx)("span",{className:"text-muted-foreground",children:Y(e.timestampMs)}),l&&t&&"number"==typeof s&&(0,n.jsxs)("span",{className:"ml-1 px-1.5 py-0.5 rounded bg-primary/20 text-[10px] leading-none",children:[s," ",1===s?"entry":"entries"]})]});return l?(0,n.jsxs)("button",{type:"button",onClick:r,className:"group flex items-center gap-3 py-3 px-4 w-full cursor-pointer",children:[(0,n.jsx)("div",{className:"flex-1 h-px bg-primary/30"}),i,(0,n.jsx)("div",{className:"flex-1 h-px bg-primary/30"})]}):(0,n.jsxs)("div",{className:"flex items-center gap-3 py-3 px-4",children:[(0,n.jsx)("div",{className:"flex-1 h-px bg-primary/30"}),i,(0,n.jsx)("div",{className:"flex-1 h-px bg-primary/30"})]})});var X=e.i(47163);let Q={user:"User",assistant:"Assistant","file-history-snapshot":"Snapshot",progress:"Progress",system:"System","queue-operation":"Queue"},Z={user:"bg-[color:var(--chart-1)]/20 text-[color:var(--chart-1)] border-[color:var(--chart-1)]/30",assistant:"bg-[color:var(--chart-2)]/20 text-[color:var(--chart-2)] border-[color:var(--chart-2)]/30","file-history-snapshot":"bg-[color:var(--chart-3)]/20 text-[color:var(--chart-3)] border-[color:var(--chart-3)]/30",progress:"bg-[color:var(--chart-5)]/20 text-[color:var(--chart-5)] border-[color:var(--chart-5)]/30",system:"bg-[color:var(--chart-4)]/20 text-[color:var(--chart-4)] border-[color:var(--chart-4)]/30","queue-operation":"bg-primary/20 text-primary border-primary/30"},ee={user:"border-l-[color:var(--chart-1)]",assistant:"border-l-[color:var(--chart-2)]","file-history-snapshot":"border-l-[color:var(--chart-3)]",progress:"border-l-[color:var(--chart-5)]",system:"border-l-[color:var(--chart-4)]","queue-operation":"border-l-primary"},et={name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]};et.node;let es=(0,_.f)(et),en={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};en.node;let er=(0,_.f)(en);var el=e.i(66794);function ei({type:e}){let t="w-4 h-4";switch(e){case"user":return(0,n.jsx)(I,{className:t});case"assistant":return(0,n.jsx)(z,{className:t});case"file-history-snapshot":return(0,n.jsx)(es,{className:t});case"progress":return(0,n.jsx)(er,{className:t});case"system":return(0,n.jsx)(el.f,{className:t});case"queue-operation":return(0,n.jsx)(H,{className:t})}}function eo({type:e}){return(0,n.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-xs font-mono rounded border ${Z[e]}`,children:[(0,n.jsx)(ei,{type:e}),Q[e]]})}var ea=e.i(24380);function eh({block:e}){let t=(0,r.useMemo)(()=>JSON.stringify(e.input,null,2),[e]);return(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("details",{open:!0,children:[(0,n.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:["Input",(0,n.jsx)(ea.CopyButton,{text:t})]})}),(0,n.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:t})]}),e.result?(0,n.jsxs)("div",{className:"border-l-2 border-primary/50 pl-3 space-y-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"inline-block px-2 py-0.5 text-xs font-mono rounded border bg-primary/20 text-primary border-primary/30",children:"Result"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:Y(new Date(e.result.timestamp).getTime())})]}),e.result.content&&(0,n.jsxs)("details",{open:!0,children:[(0,n.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:["Output",(0,n.jsx)(ea.CopyButton,{text:e.result.content})]})}),(0,n.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs whitespace-pre-wrap break-words max-h-48 overflow-y-auto",children:e.result.content})]}),e.result.images?.map((e,t)=>(0,n.jsx)("img",{src:`data:${e.mediaType};base64,${e.base64}`,alt:`Tool result image ${t+1}`,className:"mt-2 max-w-full rounded border border-border"},t))]}):(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:"Tool did not return a result"})]})}let ed={name:"brain",size:24,node:[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 01-3-4 4.17 4.17 0 01-3 4",key:"5nuw1p"}],["path",{d:"M17.707 6.294A3 3 0 1012 5a3 3 0 10-5.707 1.294",key:"18ldcf"}],["path",{d:"M17.996 5.125a4 4 0 012.526 5.77",key:"1sdu8q"}],["path",{d:"M18 18a4 4 0 002-7.465",key:"7xqqvr"}],["path",{d:"M19.967 17.482a4 4 0 11-7.967.517 4 4 0 11-7.967-.517",key:"t46ysz"}],["path",{d:"M6 18a4 4 0 01-2-7.465",key:"1y2m15"}],["path",{d:"M6.004 5.125a4 4 0 00-2.526 5.77",key:"3cw1ss"}]]};ed.node;let ec=(0,_.f)(ed),eu=r.default.memo(function({block:e,entriesBySource:t,projectName:s,sessionId:r,highlightedUuid:l,autoExpandForUuid:i}){switch(e.type){case"text":return(0,n.jsx)("p",{className:"whitespace-pre-wrap text-sm",children:e.text});case"tool_use":if("Task"===e.name&&(e.subagentType||e.subagentId)){let o=e.subagentId&&t?t.get(`agent-${e.subagentId}`):void 0;return(0,n.jsx)(eb,{block:e,subagentEntries:o,projectName:s,sessionId:r,highlightedUuid:l,autoExpandForUuid:i})}return(0,n.jsxs)("div",{className:"border border-border/50 rounded-lg p-3 bg-muted/10",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,n.jsx)(k,{className:"w-4 h-4 text-primary flex-shrink-0"}),(0,n.jsx)("span",{className:"font-mono text-sm text-primary truncate min-w-0",children:e.name}),e.result&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground ml-auto flex-shrink-0",children:e.result.durationFormatted})]}),(0,n.jsx)(eh,{block:e})]});case"thinking":return(0,n.jsx)("div",{className:"border border-[color:var(--chart-5)]/30 rounded-lg p-3 bg-[color:var(--chart-5)]/5",children:(0,n.jsxs)("details",{children:[(0,n.jsxs)("summary",{className:"flex items-center gap-2 text-xs cursor-pointer hover:text-foreground transition-colors text-[color:var(--chart-5)]",children:[(0,n.jsx)(ec,{className:"w-4 h-4"}),(0,n.jsx)("span",{children:"Thinking"}),(0,n.jsxs)("span",{className:"text-muted-foreground ml-1",children:["(",e.thinking.length.toLocaleString()," chars)"]})]}),(0,n.jsx)("p",{className:"mt-2 whitespace-pre-wrap text-xs text-muted-foreground p-2 bg-muted/30 rounded max-h-64 overflow-y-auto",children:e.thinking})]})})}});function em({entry:e}){return(0,n.jsx)("div",{children:e.message.content&&(0,n.jsx)("p",{className:"whitespace-pre-wrap text-sm",children:e.message.content})})}let ef=r.default.memo(function({entry:e,entriesBySource:t,projectName:s,sessionId:r,highlightedUuid:l,autoExpandForUuid:i}){let{content:o}=e.message;return(0,n.jsx)("div",{className:"space-y-3",children:o.map((e,o)=>(0,n.jsx)(eu,{block:e,entriesBySource:t,projectName:s,sessionId:r,highlightedUuid:l,autoExpandForUuid:i},o))})}),ep=r.default.memo(function({entry:e}){let t=(0,r.useMemo)(()=>{if("progress"===e.type){let t=e.raw.data,s=t?.agentId;return[t?.type,s&&`agent:${s}`].filter(Boolean).join(" | ")}return"file-history-snapshot"===e.type?"File history snapshot":e.type},[e.type,e.raw]);return(0,n.jsxs)("div",{className:"text-sm",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:t}),(0,n.jsxs)("details",{className:"mt-1",children:[(0,n.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:"Show raw JSON"}),(0,n.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:K(e)})]})]})}),eg={name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]};eg.node;let ex=(0,_.f)(eg);var ey=e.i(55574);function ev({uuid:e}){let t=(0,r.useCallback)(async()=>{window.history.replaceState(null,"",`#entry-${e}`);try{await navigator.clipboard.writeText(window.location.href)}catch{let e=document.createElement("textarea");e.value=window.location.href,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}(0,ey.toast)("Link copied")},[e]);return(0,n.jsx)("button",{onClick:t,title:"Copy link to entry",className:"inline-flex items-center justify-center rounded p-1 text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors opacity-0 group-hover:opacity-100 transition-opacity",children:(0,n.jsx)(ex,{className:"w-3.5 h-3.5"})})}function eb({block:e,subagentEntries:t,projectName:s,sessionId:l,highlightedUuid:i,autoExpandForUuid:o}){let a=!!(o&&t?.some(e=>e.uuid===o)),[h,d]=(0,r.useState)(a);(0,r.useEffect)(()=>{if(!a)return;let e=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(e)},[a]);let c=(0,r.useCallback)(()=>{d(e=>!e)},[]),u=t&&t.length>0,m=(0,r.useMemo)(()=>E(t??[]),[t]);return(0,n.jsxs)("div",{className:"border border-border/50 rounded-lg p-3 bg-muted/10",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,n.jsx)(B,{className:"w-4 h-4 text-[color:var(--chart-5)]"}),(0,n.jsx)("span",{className:"font-mono text-sm text-[color:var(--chart-5)]",children:"Subagent"}),e.subagentType&&(0,n.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 text-xs font-mono rounded border bg-[color:var(--chart-5)]/20 text-[color:var(--chart-5)] border-[color:var(--chart-5)]/30",children:e.subagentType}),e.result&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground ml-auto",children:e.result.durationFormatted})]}),e.subagentDescription&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:e.subagentDescription}),e.subagentId&&t&&(0,n.jsxs)("button",{onClick:c,className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded border border-primary/30 bg-primary/10 text-primary hover:bg-primary/20 transition-colors mb-2",children:[(0,n.jsx)(V.f,{className:(0,X.f)("w-3 h-3 transition-transform",h&&"rotate-90")}),(0,n.jsxs)("span",{children:["agent-",e.subagentId]}),(0,n.jsx)("span",{className:"text-muted-foreground",children:h?"Collapse":"View subagent log"})]}),h&&(0,n.jsxs)("div",{className:"ml-4 pl-3 border-l-2 border-primary/30 mt-2 space-y-2",children:[t&&0===t.length&&(0,n.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:"No entries found in subagent log."}),u&&(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(q,{entries:t,compact:!0})}),t&&t.map(e=>"queue-operation"===e.type?(0,n.jsx)(J,{entry:e},m.get(e)):(0,n.jsx)(ej,{entry:e,projectName:s,sessionId:l,isHighlighted:!!i&&e.uuid===i},m.get(e)))]}),(0,n.jsx)(eh,{block:e})]})}function eS({entry:e,entriesBySource:t,projectName:s,sessionId:r,highlightedUuid:l,autoExpandForUuid:i}){switch(e.type){case"user":return(0,n.jsx)(em,{entry:e});case"assistant":return(0,n.jsx)(ef,{entry:e,entriesBySource:t,projectName:s,sessionId:r,highlightedUuid:l,autoExpandForUuid:i});case"file-history-snapshot":case"progress":case"system":return(0,n.jsx)(ep,{entry:e})}}let ej=r.default.memo(function({entry:e,entriesBySource:t,projectName:s,sessionId:r,isHighlighted:l,highlightedUuid:i,autoExpandForUuid:o}){return(0,n.jsxs)("div",{id:e.uuid?`entry-${e.uuid}`:void 0,className:(0,X.f)(`group border-l-4 ${ee[e.type]} bg-card/50 rounded-r-lg mb-2 hover:bg-muted/30 transition-colors`,l&&"entry-highlighted"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border/30",children:[(0,n.jsx)(eo,{type:e.type}),(0,n.jsxs)("div",{className:"flex items-center gap-1 ml-auto",children:[e.uuid&&(0,n.jsx)(ev,{uuid:e.uuid}),(0,n.jsx)(ea.CopyButton,{text:function(e){switch(e.type){case"user":return e.message.content;case"assistant":return e.message.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n");case"file-history-snapshot":case"progress":case"system":return K(e);case"queue-operation":return e.label}}(e)}),(0,n.jsx)("span",{className:"text-xs font-mono text-muted-foreground whitespace-nowrap",children:Y(e.timestampMs)})]})]}),(0,n.jsx)("div",{className:"px-4 py-3",children:(0,n.jsx)(eS,{entry:e,entriesBySource:t,projectName:s,sessionId:r,highlightedUuid:i,autoExpandForUuid:o})})]})},(e,t)=>e.entry===t.entry&&e.entriesBySource===t.entriesBySource&&e.projectName===t.projectName&&e.sessionId===t.sessionId&&e.isHighlighted===t.isHighlighted&&e.highlightedUuid===t.highlightedUuid&&e.autoExpandForUuid===t.autoExpandForUuid);var ew=e.i(53539),eM=e.i(84026),eN=e.i(29407),e_=e.i(16306),eO=e.i(82954),ek=e.i(73520),eE=e.i(85881);function eC({decision:e}){return"deny"===e?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-red-500/10 text-red-400 border border-red-500/20",children:[(0,n.jsx)(eN.f,{className:"h-3 w-3"}),"Deny"]}):"instruct"===e?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[(0,n.jsx)(e_.f,{className:"h-3 w-3"}),"Instruct"]}):(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[(0,n.jsx)(eM.f,{className:"h-3 w-3"}),"Allow"]})}function eI({eventType:e}){return(0,n.jsx)("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium bg-muted text-muted-foreground border border-border/50",children:e})}function eT({mode:e}){let t="default"===e;return(0,n.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${t?"bg-sky-500/10 text-sky-400 border-sky-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:e})}function ez({ms:e}){return(0,n.jsx)("span",{className:`font-mono text-[0.7rem] ${e>500?"text-red-400":e>100?"text-amber-400":"text-muted-foreground"}`,children:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`})}function eA({value:e,onChange:t}){return(0,n.jsx)("div",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 p-0.5",children:[{label:"All",value:""},{label:"Allow",value:"allow"},{label:"Instruct",value:"instruct"},{label:"Deny",value:"deny"}].map(s=>(0,n.jsx)("button",{onClick:()=>t(s.value),className:`px-2.5 py-1 text-[0.65rem] font-medium rounded transition-all ${e===s.value?"deny"===s.value?"bg-red-500/15 text-red-400 shadow-sm":"allow"===s.value?"bg-emerald-500/15 text-emerald-400 shadow-sm":"instruct"===s.value?"bg-amber-500/15 text-amber-400 shadow-sm":"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:s.label},s.value))})}function eF({item:e}){return(0,n.jsx)("tr",{children:(0,n.jsx)("td",{colSpan:9,className:"px-0 py-0",children:(0,n.jsxs)("div",{className:"px-6 py-3 bg-muted/20 border-t border-border/30 space-y-2 text-xs animate-expand",children:[(0,n.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-1.5",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Session ID: "}),(0,n.jsx)("span",{className:"font-mono text-foreground",children:e.sessionId??"—"}),e.sessionId&&(0,n.jsx)(ea.CopyButton,{text:e.sessionId})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"CWD: "}),(0,n.jsx)("span",{className:"font-mono text-foreground",children:e.cwd??"—"}),e.cwd&&(0,n.jsx)(ea.CopyButton,{text:e.cwd})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Transcript: "}),(0,n.jsx)("span",{className:"font-mono text-foreground break-all",children:e.transcriptPath??"—"}),e.transcriptPath?.startsWith("opencode-db://")&&(0,n.jsx)("span",{className:"text-muted-foreground ml-1",children:"(stored in opencode DB)"})]})]}),e.policyNames&&e.policyNames.length>1&&(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Policies: "}),(0,n.jsx)("span",{className:"font-mono text-foreground",children:e.policyNames.join(", ")})]}),e.reason&&(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Full reason: "}),(0,n.jsx)("span",{className:"text-foreground",children:e.reason})]})]})})})}function eR({sessionId:e,initialData:t}){let{intervalSec:s}=(0,eE.useAutoRefresh)(),[l,i]=(0,r.useState)(!1),[o,a]=(0,r.useState)(1),[h,d]=(0,r.useState)(t),[c,u]=(0,r.useState)(null),[m,f]=(0,r.useState)(""),[p,g]=(0,r.useState)(""),[x,y]=(0,r.useState)(""),v=(0,r.useRef)(null),b=(0,r.useRef)({filterDecision:m,filterEventType:p,filterPolicy:x});b.current={filterDecision:m,filterEventType:p,filterPolicy:x};let S=""!==m||""!==p||""!==x,j=(0,r.useCallback)(async t=>{try{let{filterDecision:s,filterEventType:n,filterPolicy:r}=b.current,l=await (0,ew.f)({sessionId:e,decision:s||void 0,eventType:n||void 0,policyName:r||void 0},t);d(l)}catch{}},[e]);(0,r.useEffect)(()=>{j(o);let e=setInterval(()=>j(o),s>0?1e3*s:5e3);return()=>clearInterval(e)},[o,j,s]),(0,r.useEffect)(()=>(v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{a(1),u(null),j(1)},300),()=>{v.current&&clearTimeout(v.current)}),[m,p,x]);let w=h.entries,M=h.totalPages;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("button",{onClick:()=>i(e=>!e),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,n.jsx)(N.f,{className:`w-4 h-4 text-muted-foreground transition-transform ${l?"-rotate-90":""}`}),(0,n.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Hook Logs"})]}),!l&&(0,n.jsxs)("div",{className:"mt-2 bg-card border border-border rounded-lg overflow-hidden shadow-sm",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4 py-2.5 border-b border-border bg-muted/20",children:[(0,n.jsx)(eA,{value:m,onChange:f}),(0,n.jsxs)("select",{value:p,onChange:e=>g(e.target.value),className:"h-7 rounded-md border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/40 transition-shadow",children:[(0,n.jsx)("option",{value:"",children:"All Events"}),(0,n.jsx)("option",{value:"PreToolUse",children:"PreToolUse"}),(0,n.jsx)("option",{value:"PostToolUse",children:"PostToolUse"}),(0,n.jsx)("option",{value:"SessionStart",children:"SessionStart"}),(0,n.jsx)("option",{value:"SessionEnd",children:"SessionEnd"}),(0,n.jsx)("option",{value:"UserPromptSubmit",children:"UserPromptSubmit"}),(0,n.jsx)("option",{value:"PermissionRequest",children:"PermissionRequest"})]}),(0,n.jsx)("div",{className:"relative",children:(0,n.jsx)("input",{type:"text",value:x,onChange:e=>y(e.target.value),placeholder:"Filter by policy…",className:"h-7 rounded-md border border-border bg-background px-2.5 text-xs text-foreground placeholder:text-muted-foreground w-44 focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/40 transition-shadow"})})]}),0===w.length?(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 px-4",children:[(0,n.jsx)(eO.f,{className:"h-10 w-10 text-muted-foreground/30"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mt-3",children:S?"No matching hook events.":"No hook events found."})]}):(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)("table",{className:"w-full text-xs",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{className:"text-left text-muted-foreground border-b border-border bg-muted/30",children:[(0,n.jsx)("th",{className:"px-4 py-2.5 font-medium w-6"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Decision"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Event"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Tool"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Policy"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Reason"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Duration"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Mode"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium text-right",children:"Time"})]})}),(0,n.jsx)("tbody",{className:"divide-y divide-border/30",children:w.map((e,t)=>{let s="deny"===e.decision,l=c===t,i="instruct"===e.decision;return(0,n.jsxs)(r.default.Fragment,{children:[(0,n.jsxs)("tr",{onClick:()=>{u(e=>e===t?null:t)},className:`cursor-pointer transition-colors ${s?"bg-red-500/[0.03] hover:bg-red-500/[0.07] border-l-2 border-l-red-500/40":i?"bg-amber-500/[0.03] hover:bg-amber-500/[0.07] border-l-2 border-l-amber-500/40":t%2==0?"hover:bg-muted/30":"bg-muted/[0.04] hover:bg-muted/30"} ${l?"bg-muted/20":""}`,children:[(0,n.jsx)("td",{className:"px-4 py-2",children:(0,n.jsx)(N.f,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform duration-150 ${l?"rotate-0":"-rotate-90"}`})}),(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsx)(eC,{decision:e.decision})}),(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsx)(eI,{eventType:e.eventType})}),(0,n.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:e.toolName??"—"}),(0,n.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:e.policyNames&&e.policyNames.length>1?(0,n.jsxs)("span",{title:e.policyNames.join(", "),children:[e.policyNames[0],(0,n.jsxs)("span",{className:"text-muted-foreground text-[0.6rem]",children:[" +",e.policyNames.length-1]})]}):e.policyName??"—"}),(0,n.jsx)("td",{className:"px-3 py-2 text-muted-foreground truncate max-w-[240px]",title:e.reason??"",children:e.reason??"—"}),(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsx)(ez,{ms:e.durationMs})}),(0,n.jsx)("td",{className:"px-3 py-2",children:e.permissionMode?(0,n.jsx)(eT,{mode:e.permissionMode}):"—"}),(0,n.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground whitespace-nowrap",title:new Date(e.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),children:(0,P.g)(e.timestamp)})]}),l&&(0,n.jsx)(eF,{item:e})]},`${e.timestamp}-${t}`)})})]})}),(0,n.jsx)(ek.f,{currentPage:o,totalPages:M,onPageChange:e=>{a(e),u(null)}})]})]})}function eW(e){let t=new Map;for(let s of e)if("assistant"===s.type)for(let e of s.message.content){if("tool_use"!==e.type||"Task"===e.name&&(e.subagentType||e.subagentId))continue;let s=t.get(e.name)||{count:0,totalDurationMs:0};s.count++,e.result?.durationMs&&(s.totalDurationMs+=e.result.durationMs),t.set(e.name,s)}return Array.from(t.entries()).map(([e,t])=>({name:e,...t})).sort((e,t)=>t.count-e.count)}function eL({tools:e,compact:t}){return(0,n.jsx)("div",{className:`bg-card border border-border rounded-lg ${t?"p-3":"p-4"}`,children:(0,n.jsx)("div",{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] ${t?"gap-2":"gap-3"}`,children:e.map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,n.jsx)(k,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:`${t?"text-xs":"text-sm"} font-mono font-medium truncate`,children:e.name}),(0,n.jsxs)("div",{className:"text-xs text-muted-foreground truncate",children:[e.count," call",1!==e.count?"s":"",e.totalDurationMs>0&&` \xb7 ${(e.totalDurationMs/1e3).toFixed(1)}s`]})]})]},e.name))})})}function e$(e,t){return t.get(e)??`${e.uuid}-${e.timestampMs}`}function eD(){let e=window.location.hash;return e.startsWith("#entry-")?e.slice(7):null}function eB({entries:e,entriesBySource:t,projectName:s,sessionId:i}){let o=(0,r.useMemo)(()=>Array.from(t.values()).flat(),[t]),[a,h]=(0,r.useState)(new Set),[d,c]=(0,r.useState)(0),[u,m]=(0,r.useState)(()=>eD()),f=(0,r.useRef)(void 0),g=(0,r.useRef)(!1),y=(0,r.useRef)(null);(0,r.useLayoutEffect)(()=>{let e=y.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().top+window.scrollY;c(e=>e===t?e:t)};t();let s=new ResizeObserver(t);return s.observe(document.body),window.addEventListener("resize",t),()=>{s.disconnect(),window.removeEventListener("resize",t)}},[]);let b=(0,r.useMemo)(()=>E(e),[e]),S=(0,r.useMemo)(()=>(function(e,t){let s=new Map,n=null,r=0;for(let l of e)"queue-operation"===l.type?(null!==n&&s.set(n,r),n=e$(l,t),r=0):null!==n&&r++;return null!==n&&s.set(n,r),s})(e,b),[e,b]),w=(0,r.useMemo)(()=>{let t;return t=!1,e.filter(e=>"queue-operation"===e.type?(t=a.has(e$(e,b)),!0):!t)},[e,a,b]),N=(0,r.useMemo)(()=>{let e=new Map;return w.forEach((t,s)=>{t.uuid&&e.set(t.uuid,s)}),e},[w]),_=(0,r.useMemo)(()=>(function(e){let t=new Map;for(let s of e)if("assistant"===s.type&&s.uuid)for(let e of s.message.content)"tool_use"===e.type&&"Task"===e.name&&e.subagentId&&t.set(e.subagentId,s.uuid);let s=new Map;for(let n of e){if(!n._source?.startsWith("agent-")||!n.uuid)continue;let e=n._source.slice(6),r=t.get(e);r&&s.set(n.uuid,r)}return s})(o),[o]),O=(0,r.useMemo)(()=>u&&_.has(u)?u:null,[u,_]),k=O?_.get(O)??null:null;(0,r.useEffect)(()=>{if(u)return f.current=setTimeout(()=>m(null),4e3),()=>{f.current&&clearTimeout(f.current)}},[]),(0,r.useEffect)(()=>{let e=()=>{let e=eD();m(e),g.current=!1,f.current&&clearTimeout(f.current),e&&(f.current=setTimeout(()=>m(null),4e3))};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]);let C=(0,r.useMemo)(()=>{if(!u)return null;let t=k??u,s=e.some(e=>e.uuid===t),n=N.has(t);if(s&&!n){let s=null;for(let n of e)if("queue-operation"===n.type)s=e$(n,b);else if(n.uuid===t&&s)return s}return null},[u,k,e,N,b]);(0,r.useEffect)(()=>{if(!C)return;let e=requestAnimationFrame(()=>{h(e=>{if(!e.has(C))return e;let t=new Set(e);return t.delete(C),t})});return()=>cancelAnimationFrame(e)},[C]);let I=(0,r.useCallback)(e=>{h(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),T=(0,r.useCallback)(e=>b.get(w[e])??e,[b,w]),z=function({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:s="transform",...n}){let i=r.useReducer(e=>e+1,0)[1],o=r.useRef({enabled:t,mode:s,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});o.current.enabled=t,o.current.mode=s;let a=r.useRef(!1),h=e=>{let t=o.current;if(!t.enabled||!t.container)return;let s=e.getTotalSize();if(s!==t.lastSize){t.lastSize=s;let n=e.options.horizontal?"width":"height";t.container.style[n]=`${s}px`}},d=(e,t,s)=>{let n=o.current,r=!!e.options.horizontal,l=t.start-e.options.scrollMargin;n.lastPositions.get(s)!==l&&(n.lastPositions.set(s,l),"transform"===n.mode?s.style.transform=r?`translate3d(${l}px, 0, 0)`:`translate3d(0, ${l}px, 0)`:s.style[r?"left":"top"]=`${l}px`)},c=e=>{let t=o.current;if(t.enabled&&t.container)for(let t of(h(e),e.getVirtualItems())){let s=e.elementsCache.get(t.key);s&&d(e,t,s)}},u={...n,onChange:(t,s)=>{var r;let h=o.current,d=!0;if(h.enabled){c(t);let e=t.range,s=h.prevRange;(d=!s||s.isScrolling!==t.isScrolling||s.startIndex!==(null==e?void 0:e.startIndex)||s.endIndex!==(null==e?void 0:e.endIndex))&&(h.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}d&&(e&&s&&!a.current?(0,l.flushSync)(i):i()),null==(r=n.onChange)||r.call(n,t,s)}},[m]=r.useState(()=>{let e=new j(u),t=e.measureElement;return e.measureElement=s=>{a.current=!0;try{t(s)}finally{a.current=!1}let n=o.current;if(null!==s&&n.enabled&&n.container){let t=e.measurementsCache[e.indexFromElement(s)];t&&d(e,t,s)}},Object.assign(e,{containerRef:t=>{let s=o.current;s.container=t,s.lastSize=null,null!==t&&c(e)}})});return m.setOptions(u),M(()=>m._didMount(),[]),M(()=>(h(m),m._willUpdate())),M(()=>{c(m)}),m}({getScrollElement:()=>"u">typeof document?window:null,observeElementRect:p,observeElementOffset:x,scrollToFn:v,initialOffset:()=>"u">typeof document?window.scrollY:0,...{count:w.length,estimateSize:e=>(function(e){switch(e.type){case"queue-operation":return 48;case"user":return 90;case"assistant":return 80+120*e.message.content.length;default:return 100}})(w[e]),getItemKey:T,overscan:5,scrollMargin:d}});return(0,r.useEffect)(()=>{if(!u||g.current)return;let e=k??u,t=N.get(e);null!=t&&(g.current=!0,requestAnimationFrame(()=>{z.scrollToIndex(t,{align:"center"})}))},[u,k,N,z]),(0,n.jsx)("div",{ref:y,children:(0,n.jsx)("div",{style:{height:`${z.getTotalSize()}px`,width:"100%",position:"relative"},children:z.getVirtualItems().map(e=>{let r=w[e.index],l=!!u&&r.uuid===(k??u);return(0,n.jsx)("div",{"data-index":e.index,ref:z.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${e.start-z.options.scrollMargin}px)`},children:"queue-operation"===r.type?(0,n.jsx)(J,{entry:r,isCollapsed:a.has(e$(r,b)),entryCount:S.get(e$(r,b))??0,onToggle:()=>I(e$(r,b))}):(0,n.jsx)(ej,{entry:r,entriesBySource:t,projectName:s,sessionId:i,isHighlighted:!O&&l,highlightedUuid:O,autoExpandForUuid:O})},e.key)})})})}let eP=[];e.s(["default",0,function({entries:e,projectName:t,sessionId:s}){let l=(0,r.useMemo)(()=>{let t=new Map;for(let s of e){let e=t.get(s._source);e?e.push(s):t.set(s._source,[s])}return t},[e]),i=l.get("session")??eP,o=(0,r.useMemo)(()=>(function(e){let t=new Map;for(let s of e)if("assistant"===s.type)for(let e of s.message.content)"tool_use"===e.type&&"Task"===e.name&&e.subagentId&&(t.has(e.subagentId)||t.set(e.subagentId,{id:e.subagentId,type:e.subagentType||"unknown",description:e.subagentDescription||""}));return Array.from(t.values())})(e),[e]),a=(0,r.useMemo)(()=>eW(i),[i]),[h,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(new Set),[m,f]=(0,r.useState)(!1),[p,g]=(0,r.useState)(null);(0,r.useEffect)(()=>{(0,ew.f)({sessionId:s},1).then(e=>{e.entries.length>0&&g(e)}).catch(()=>{})},[s]),(0,r.useEffect)(()=>{let e=()=>{window.location.hash.startsWith("#entry-")&&f(!1)};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]);let x=(0,r.useCallback)(e=>{u(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(q,{entries:i}),p&&(0,n.jsx)(eR,{sessionId:s,initialData:p},s),o.length>0&&(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("button",{onClick:()=>d(e=>!e),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,n.jsx)(N.f,{className:`w-4 h-4 text-muted-foreground transition-transform ${h?"-rotate-90":""}`}),(0,n.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Subagents"}),(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",o.length,")"]})]}),!h&&o.map(e=>{let t;return(0,n.jsxs)("div",{className:"pl-3 border-l-2 border-primary/30 space-y-2",children:[(0,n.jsxs)("button",{onClick:()=>x(e.id),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,n.jsx)(N.f,{className:`w-3.5 h-3.5 text-muted-foreground transition-transform ${c.has(e.id)?"-rotate-90":""}`}),(0,n.jsx)("span",{className:"text-sm font-bold",children:e.type}),e.description&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground truncate max-w-[400px]",children:e.description})]}),!c.has(e.id)&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(q,{entries:l.get(`agent-${e.id}`)||[],compact:!0}),(t=eW(l.get(`agent-${e.id}`)||[])).length>0?(0,n.jsx)(eL,{tools:t,compact:!0}):null]})]},e.id)})]}),a.length>0&&(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Tools"}),(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",a.reduce((e,t)=>e+t.count,0),")"]})]}),(0,n.jsx)(eL,{tools:a})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("button",{onClick:()=>f(e=>!e),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,n.jsx)(N.f,{className:`w-4 h-4 text-muted-foreground transition-transform ${m?"-rotate-90":""}`}),(0,n.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Logs"})]}),!m&&(0,n.jsx)("div",{className:"mt-2 bg-card border border-border rounded-lg p-4 shadow-sm",children:0===i.length?(0,n.jsx)("p",{className:"text-muted-foreground text-center py-8",children:"No entries found."}):(0,n.jsx)(eB,{entries:i,entriesBySource:l,projectName:t,sessionId:s})})]})]})}],36406)},5780,function(e){e.n(e.i(36406))}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,36406,e=>{"use strict";let t,s;var n=e.i(43476),r=e.i(71645),l=e.i(74080);function i(e,t,s){let n,r=s.initialDeps??[],l=!0;function i(){let i=e();return(i.length!==r.length||i.some((e,t)=>r[t]!==e))&&(r=i,n=t(...i),(null==s?void 0:s.onChange)&&!(l&&s.skipInitialOnChange)&&s.onChange(n),l=!1),n}return i.updateDeps=e=>{r=e},i}function o(e,t){if(void 0!==e)return e;throw Error(`Unexpected undefined${t?`: ${t}`:""}`)}let a=(e,t)=>1.01>Math.abs(e-t),h=()=>{if(void 0!==t)return t;if("u"<typeof navigator)return t=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return t=!0;let e=navigator.maxTouchPoints;return t="MacIntel"===navigator.platform&&void 0!==e&&e>0},d={capture:!0,passive:!0};class c{constructor(e){this.host=e,this._touch=null,this.inMotion=()=>null!==this._touch&&"lateFling"!==this._touch.phase,this.dragging=()=>{var e;return(null==(e=this._touch)?void 0:e.phase)==="down"&&this._touch.moved},this.tail=()=>{var e;return(null==(e=this._touch)?void 0:e.phase)==="tail"?this._touch.moved?"fling":"tap":null},this.onScroll=({isScrolling:e,ownReadBack:t,moved:s,external:n})=>{var r,l,i;return e&&(null==(r=this._touch)?void 0:r.phase)==="tail"?this._openTail(this._touch.moved||!t,!1):(null==(l=this._touch)?void 0:l.phase)==="lateFling"&&(this.host.now()>this._touch.until?this._touch=null:n&&e&&s&&this._openTail(!0,!1)),!t&&!!e&&!!s&&(null==(i=this._touch)?void 0:i.phase)==="down"&&(this._touch.moved=!0,!0)},this.touchStart=()=>{this.end(),this._touch={phase:"down",moved:!1}},this.touchEnd=()=>{var e;let t=(null==(e=this._touch)?void 0:e.phase)==="down"&&this._touch.moved;this.end(),this._openTail(t,t)},this.end=()=>{var e;let t=this.host.getWindow();(null==(e=this._touch)?void 0:e.phase)==="tail"&&null!=t&&t.clearTimeout(this._touch.timerId),this._touch=null},this.listen=e=>{let t=()=>this.touchStart(),s=()=>this.touchEnd();return e.addEventListener("touchstart",t,d),e.addEventListener("touchend",s,d),e.addEventListener("touchcancel",s,d),()=>{e.removeEventListener("touchstart",t,d),e.removeEventListener("touchend",s,d),e.removeEventListener("touchcancel",s,d),this.end()}},this._openTail=(e,t)=>{let s=this.host.getWindow();if(!h()||null==s)return;this.end();let n={phase:"tail",moved:e,awaitingFling:t,timerId:s.setTimeout(()=>{this.host.tailStillMoving()?this._openTail(n.moved,n.awaitingFling):(this._touch=n.awaitingFling?{phase:"lateFling",until:this.host.now()+1e3}:null,this.host.onTailClosed())},150)};this._touch=n}}get touch(){return this._touch}}let u=e=>e,m=e=>{let t=e.overscan*Math.max(e.lanes??1,1),s=Math.max(e.startIndex-t,0),n=Math.min(e.endIndex+t,e.count-1)-s+1,r=Array(n);for(let e=0;e<n;e++)r[e]=s+e;return r},f={passive:!0},p=(e,t)=>{let s=e.scrollElement;if(!s)return;let n=()=>{t({width:s.innerWidth,height:s.innerHeight})};return n(),s.addEventListener("resize",n,f),()=>{s.removeEventListener("resize",n)}},g="u"<typeof window||"onscrollend"in window,x=(e,t)=>((e,t,s)=>{var n,r;let l,i=e.scrollElement;if(!i)return;let o=e.targetWindow;if(!o)return;let a=e.options.useScrollendEvent&&g,h=0,d=a?null:(n=()=>t(s(i),!1),r=e.options.isScrollingResetDelay,Object.assign(function(...e){o.clearTimeout(l),l=o.setTimeout(()=>n.apply(this,e),r)},{cancel:()=>{o.clearTimeout(l)}})),c=e=>()=>{h=s(i),null==d||d(),t(h,e)},u=c(!0),m=c(!1);return i.addEventListener("scroll",u,f),a&&i.addEventListener("scrollend",m,f),()=>{i.removeEventListener("scroll",u),a&&i.removeEventListener("scrollend",m),null==d||d.cancel()}})(e,t,t=>e.options.horizontal?t.scrollX:t.scrollY),y=(e,t,s)=>{if(s.options.useCachedMeasurements){let t=s.indexFromElement(e),n=s.options.getItemKey(t);return s.itemSizeCache.get(n)??s.options.estimateSize(t)}if(null==t?void 0:t.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[s.options.horizontal?"inlineSize":"blockSize"])}if(!t){let t=s.indexFromElement(e),n=s.options.getItemKey(t),r=s.itemSizeCache.get(n);if(void 0!==r)return r}return e[s.options.horizontal?"offsetWidth":"offsetHeight"]},v=(e,{adjustments:t=0,behavior:s},n)=>{var r,l;null==(l=null==(r=n.scrollElement)?void 0:r.scrollTo)||l.call(r,{[n.options.horizontal?"left":"top"]:e+t,behavior:s})},b=(e,t)=>"smooth"===e?t?"smoothLanded":"smooth":"instant",S=e=>(null==e?void 0:e.phase)==="smooth"||(null==e?void 0:e.phase)==="smoothLanded";class j{constructor(e){let t,s,n,r;this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._iosGesture=new c({getWindow:()=>this.targetWindow,now:()=>this.now(),tailStillMoving:()=>{let e=this.scrollState;if((null==e?void 0:e.phase)!=="queued"||null!==this.pendingWrite)return!1;let t=this._readElementOffset();return!(null===t||null===this._lastElementOffset||1>Math.abs(t-this._lastElementOffset))&&(this._lastElementOffset=t,e.samples=[...e.samples??[],{t:this.now(),offset:t}],!0)},onTailClosed:()=>{let e=this.scrollState;(null==e?void 0:e.phase)==="queued"&&function(e){let t=e[e.length-1];if(void 0===t)return!1;let s=e.length-2;for(;s>=0&&t.t-e[s].t<40;)s--;if(s<0)return!1;let n=e[s];return Math.abs(t.offset-n.offset)/(t.t-n.t)>=.05}(e.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand(),this._retryClampedAdjustment()}}),this._lastElementOffset=null,this.pendingWrite=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var e,t,s;return(null==(s=null==(t=null==(e=this.targetWindow)?void 0:e.performance)?void 0:t.now)?void 0:s.call(t))??Date.now()},this.observer=(t=null,s=null,n=()=>{let e;if(t)return t;let n=this.targetWindow;if(!n||!n.ResizeObserver)return null;let l=(e=new Set,s={schedule:t=>{let s=n.requestAnimationFrame(()=>{e.delete(s),t()});e.add(s)},cancel:()=>{e.forEach(e=>n.cancelAnimationFrame(e)),e.clear()}});return t=new n.ResizeObserver(e=>{let t=()=>{let t={sync:!1};this._resizeBatch=t;try{e.forEach(r)}finally{this._resizeBatch=null,t.notify&&(this.notify(t.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment())}};this.options.useAnimationFrameWithResizeObserver?l.schedule(t):t()})},r=e=>{let t=e.target,s=this.indexFromElement(t);if(!t.isConnected){for(let[e,s]of(this.observer.unobserve(t),this.elementsCache))if(s===t){this.elementsCache.delete(e);break}return}this.isIndexInRange(s)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,e,this))},{disconnect:()=>{var e;null==(e=n())||e.disconnect(),null==s||s.cancel(),t=null,s=null},observe:e=>{var t;return null==(t=n())?void 0:t.observe(e,{box:"border-box"})},unobserve:e=>{var t;return null==(t=n())?void 0:t.unobserve(e)}}),this.range=null,this.setOptions=e=>{var t;let s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:u,rangeExtractor:m,onChange:()=>{},measureElement:y,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(let t in e){let n=e[t];void 0!==n&&(s[t]=n)}let n=this.options,r=null,l=null,i=!1;if(void 0!==n&&n.enabled&&s.enabled&&"end"===s.anchorTo&&null!==this.scrollElement){let e=n.count,o=s.count,a=this.getMeasurements(),h=(null==(t=this._singleLaneMeasurements)?void 0:t.items)??a,d=e=>{var t;return"object"==typeof(t=h[e])?t.key:t},c=e>0?d(0):null,u=e>0?d(e-1):null;if(o!==e||e>0&&o>0&&(s.getItemKey(0)!==c||s.getItemKey(o-1)!==u)){i=!0;let t=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??a[0]:null;t&&(r=[t.key,this.getScrollOffset()-t.start]);let h=!0===s.followOnAppend?"auto":s.followOnAppend||null;h&&o>0&&this.isAtEnd(n.scrollEndThreshold)&&(0===e||s.getItemKey(o-1)!==u)&&(o>e||function(e,t,s,n){if(0===t)return!1;let r=n(0),l=new Set,i=0;for(;i<e;){let e=s(i);if(e===r)break;l.add(e),i++}let o=e-i;if(0===o||o>=t)return!1;for(let e=0;e<o;e++)if(n(e)!==s(i+e))return!1;for(let e=o;e<t;e++)if(l.has(n(e)))return!1;return!0}(e,o,d,s.getItemKey))&&(l=h)}}this.options=s,i&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=null;if(r&&null!==this.scrollOffset&&!this._awaitingCommandReadBack()){let[e,t]=r,s=this.getMeasurements(),{count:n,getItemKey:i}=this.options,a=0;for(;a<n&&i(a)!==e;)a++;if(a<n){let e=s[a];if(e){let s=Math.max(0,e.start+t);l||s===this.scrollOffset||(o=s-this.scrollOffset,this.scrollOffset=s)}}}l?this.pendingScrollAnchor={kind:"follow",behavior:l}:null!==o&&(this._canWriteScroll()?this.pendingScrollAnchor={kind:"anchor",delta:o}:(this._holdOffset+=o,this._followOffsetTarget(o)))},this.notify=e=>{var t,s;null==(s=(t=this.options).onChange)||s.call(t,this,e)},this.maybeNotify=i(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{var e;this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,null==(e=this._momentumStop)||e.restore(),this._momentumStop=null,this.isScrolling=!1,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._clampedAdjustment=null,this.pendingWrite=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;let t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t)return void this.maybeNotify();this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{var s,n,r,l;let i=t?this._elementMaxScrollOffset():null,o=this._reportedOverscroll;this._reportedOverscroll=e<0||null!==i&&e>i+1;let h=e;this._lastElementOffset=h,e=this._toLayoutOffset(e);let d=this._classifyScrollEvent(e,t,i);if("spurious"===d)return;"readBack"===d?e=this.pendingWrite.target:"clampedReadBack"===d&&(null==(s=this.scrollState)?void 0:s.index)!=null&&e<this.getMaxScrollOffset()-1.5?this.scrollState.lastTargetOffset=e:function({kind:e,offset:t,command:s,target:n}){let r;return"spurious"!==e&&"readBack"!==e&&"clampedReadBack"!==e&&(null==s?void 0:s.index)!=null&&"queued"!==s.phase&&"smooth"!==(r=s.phase)&&"smoothFinishing"!==r&&!a(t,s.lastTargetOffset)&&!a(t,n())&&"clampedEcho"!==e}({kind:d,offset:e,command:this.scrollState,target:()=>this.getScrollStateTarget(this.scrollState)})&&(this.scrollState=null),this.pendingWrite=null,null!==this._clampedAdjustment&&Math.abs(e-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null);let c=this.getScrollOffset(),u=this.scrollDirection;this.scrollDirection=t?c===e?this.scrollDirection:c<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t;let m=this.scrollState;if((null==m?void 0:m.phase)==="queued"&&"external"===d&&t)if(o||this._reportedOverscroll)m.samples=[];else{let e=this.now();m.samples=[...(m.samples??[]).filter(t=>e-t.t<=200),{t:e,offset:h}],(null!==u&&this.scrollDirection!==u||function(e){let t=e[e.length-1];if(void 0===t)return!1;let s=e.length-2;for(;s>=0&&t.t-e[s].t<40;)s--;if(s<0)return!1;let n=e[s],r=s-1;for(;r>=0&&n.t-e[r].t<40;)r--;if(r<0)return!1;let l=e[r],i=(t.offset-n.offset)/(t.t-n.t),o=(n.offset-l.offset)/(n.t-l.t);return i*o>=0&&Math.abs(i)>=2*Math.abs(o)&&Math.abs(i)-Math.abs(o)>=.8}(m.samples))&&(this.scrollState=null)}this._iosGesture.onScroll({isScrolling:t,ownReadBack:"readBack"===d,moved:e!==c,external:"external"===d&&(null==(n=this.scrollState)?void 0:n.phase)!=="smooth"&&(null==(r=this.scrollState)?void 0:r.phase)!=="smoothFinishing"})&&(null==(l=this.scrollState)?void 0:l.phase)==="queued"&&(this.scrollState=null),this._flushHoldIfReady(!0),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement&&this.unsubs.push(this._iosGesture.listen(this.scrollElement)),this._scrollToOffset(this.getScrollOffset())}this._noteClampMax();let s=this.pendingScrollAnchor;this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled&&("anchor"===s.kind?this._canWriteScroll()?S(this.scrollState)&&!a(this.getScrollOffset()-s.delta,this.scrollState.lastTargetOffset)||(this._followOffsetTarget(s.delta),this._scrollToOffset(this.getScrollOffset())):(this._holdOffset+=s.delta,this._followOffsetTarget(s.delta),this.notify(!1)):this.scrollToEnd({behavior:s.behavior})),this._flushHoldIfReady(!1),this._retryClampedAdjustment()},this._classifyScrollEvent=(e,t,s)=>{var n;return function({offset:e,isScrolling:t,elementMax:s,holdOffset:n,scrollOffset:r,pendingWrite:l,clampedMaxAtWrite:i}){var o;return t&&null===l&&e===r?"spurious":null!==l&&1.5>Math.abs(e-l.target)?"readBack":null!==l&&!l.smooth&&null!==s&&l.target>s+n+.5&&1.5>Math.abs(e-(s+n))||null!==l&&!l.smooth&&(null==(o=l.lowMaxes)?void 0:o.some(t=>1.5>Math.abs(e-t)))?"clampedReadBack":null!==i&&1.5>Math.abs(e-i)?"clampedEcho":"external"}({offset:e,isScrolling:t,elementMax:s,holdOffset:this._holdOffset,scrollOffset:this.scrollOffset,pendingWrite:this.pendingWrite,clampedMaxAtWrite:(null==(n=this._clampedAdjustment)?void 0:n.maxAtWrite)??null})},this._retryClampedAdjustment=()=>{if(null===this._clampedAdjustment||!this.scrollElement||!this.options.enabled||!this._canWriteScroll())return;let{target:e,maxAtWrite:t}=this._clampedAdjustment,s=this.getMaxScrollOffset();s>t+.5&&(this._clampedAdjustment=e>s+.5?{target:e,maxAtWrite:s}:null,this._scrollToOffset(e))},this._writeAwaitingCommand=()=>{let e=this.scrollState;if(null===e||"queued"!==e.phase)return;let{behavior:t}=e;this.getMeasurements();let s=this.getScrollStateTarget(e);e.lastTargetOffset=s,this._clampedAdjustment=null,e.phase=b(t,null!=e.index&&a(s,this.getScrollOffset())),this._scrollToOffset(s,{behavior:t}),this.scheduleScrollReconcile()},this._readElementOffset=()=>{let e=this.scrollElement;if(null==e)return null;let{horizontal:t,isRtl:s}=this.options;return"number"==typeof e.scrollTop?t?e.scrollLeft*(s&&-1||1):e.scrollTop:"number"==typeof e.scrollY?t?e.scrollX:e.scrollY:null},this._canWriteScroll=()=>!(h()&&this._iosGesture.inMotion())&&!this._reportedOverscroll,this._flushHoldIfReady=e=>{var t;if(0===this._holdOffset||!this.scrollElement||!this.options.enabled||!this._canWriteScroll()||(null==(t=this.scrollState)?void 0:t.phase)==="smooth")return;this._holdOffset=0,null!==this.scrollOffset&&this.scrollOffset<0&&(this.scrollOffset=0),this.notify(e);let s=this.getCommandWrittenOffset()??this.getScrollOffset();this._clampedAdjustment=this._clampedBy(s),this._scrollToOffset(s)},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=i(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,s,n,r,l,i,o)=>(void 0!==this.prevLanes&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:s,getItemKey:n,enabled:r,lanes:l,laneAssignmentMode:i,gap:o}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=i(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:s,getItemKey:n,enabled:r,lanes:l,laneAssignmentMode:i,gap:o},a)=>{var h,d;let c=this.itemSizeCache;if(!r)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),1===l){let r,l,i=2*e,a=null==(h=this._singleLaneMeasurements)?void 0:h.flat;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,2*u)),a=e}let m=0===u?Array(e):this._singleLaneMeasurements.items.slice();if(0===u)r=t+s;else{let e=u-1;r=a[2*e]+a[2*e+1]+o}for(let t=u;t<e;t++){let e=n(t);m[t]=e;let s=c.get(e),l="number"==typeof s?s:this.options.estimateSize(t);a[2*t]=r,a[2*t+1]=l,r+=l+o}this._singleLaneMeasurements={flat:a,items:m};let f=(d=a,l=m.length,new Proxy(m,{get(e,t,s){if("string"==typeof t){let s=t.charCodeAt(0);if(s>=48&&s<=57){let s=+t;if(Number.isInteger(s)&&s>=0&&s<l){let t=e[s];if("object"!=typeof t){let n=d[2*s];t=e[s]={index:s,key:t,start:n,size:d[2*s+1],end:n+d[2*s+1],lane:0}}return t}}if("length"===t)return l}return Reflect.get(e,t,s)}}));return this.measurementsCache=f,f}let m=this.measurementsCache.slice(0,u),f=Array(l).fill(void 0),p=new Float64Array(l),g=0;for(let e=0;e<u;e++){let t=m[e];t&&(void 0===f[t.lane]&&g++,f[t.lane]=e,p[t.lane]=t.end)}for(let r=u;r<e;r++){let e,a,h=n(r),d=this.laneAssignments.get(r),u="estimate"===i||c.has(h);if(void 0!==d&&this.options.lanes>1){let n=f[e=d],r=void 0!==n?m[n]:void 0;a=r?r.end+o:t+s}else if(g===l){let t=0,s=p[0],n=f[0];for(let e=1;e<l;e++){let r=p[e];(r<s||r===s&&f[e]<n)&&(t=e,s=r,n=f[e])}e=t,a=s+o,u&&this.laneAssignments.set(r,e)}else e=r%this.options.lanes,a=t+s,u&&this.laneAssignments.set(r,e);let x=c.get(h),y="number"==typeof x?x:this.options.estimateSize(r),v=a+y;m[r]={index:r,start:a,size:y,end:v,key:h,lane:e},void 0===f[e]&&g++,f[e]=r,p[e]=v}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=i(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,s,n)=>0===e.length||0===t?(this.range=null,null):(this.range=function(e,t,s,n,r){let l=e.length-1;if(e.length<=n)return{startIndex:0,endIndex:l};if(1===n&&null!==r){let e=function(e,t,s){let n=0;for(;n<=t;){let r=(n+t)/2|0,l=e[2*r];if(l<s)n=r+1;else{if(!(l>s))return r;t=r-1}}return n>0?n-1:0}(r,l,s),n=e,i=s+t;for(;n<l&&r[2*n]+r[2*n+1]<i;)n++;return{startIndex:e,endIndex:n}}let i=w(0,l,t=>e[t].start,s),o=i;if(1===n)for(;o<l&&e[o].end<s+t;)o++;else if(n>1){let r=Array(n).fill(0);for(;o<l&&r.some(e=>e<s+t);){let t=e[o];r[t.lane]=t.end,o++}let a=Array(n).fill(s+t);for(;i>=0&&a.some(e=>e>=s);){let t=e[i];a[t.lane]=t.start,i--}i=Math.max(0,i-i%n),o=Math.min(l,o+(n-1-o%n))}return{startIndex:i,endIndex:o}}(e,t,s,n,1===n&&null!==this._singleLaneMeasurements?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=i(()=>{let e=null,t=null,s=this.calculateRange();return s&&(e=s.startIndex,t=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t,this.options.lanes]},(e,t,s,n,r,l)=>null===n||null===r?[]:e({startIndex:n,endIndex:r,overscan:t,count:s,lanes:l}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,s=e.getAttribute(t);return s?parseInt(s,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var t;if(!S(this.scrollState))return!0;let s=this.scrollState.index??(null==(t=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:t.index);if(void 0!==s&&this.range){let t=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),n=Math.max(0,s-t),r=Math.min(this.options.count-1,s+t);return e>=n&&e<=r}return!0},this.measureElement=e=>{if(!e)return void this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let s=this.options.getItemKey(t),n=this.elementsCache.get(s);n!==e&&(n&&this.observer.unobserve(n),this.observer.observe(e),this.elementsCache.set(s,e)),e.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var s,n,r;let l,i,o;if(!this.isIndexInRange(e))return;(null==(s=this._resizeBatch)?void 0:s.sync)&&this.getMeasurements();let a=null==(n=this._singleLaneMeasurements)?void 0:n.flat;if(1===this.options.lanes&&null!=a)o=this.options.getItemKey(e),i=a[2*e],l=a[2*e+1];else{let t=this.measurementsCache[e];if(!t)return;o=t.key,i=t.start,l=t.size}let h=this.itemSizeCache.get(o)??l,d=t-h;if(0!==d){let s="end"===this.options.anchorTo&&!S(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,n=s?this._getLayoutTotalSize():0,a=this.getScrollOffset(),c=this.itemSizeCache.has(o)?i+h<=a&&"backward"!==this.scrollDirection:i<a,u=!S(this.scrollState)&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:o,start:i,size:l,end:i+l,lane:0},d,this):c);(null===this.pendingMin||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(o,t),this.itemSizeCacheVersion++;let m=!1;if(!this._awaitingCommandReadBack()&&(s?m=this.applyScrollAdjustment(this._getLayoutTotalSize()-n):u&&(m=this.applyScrollAdjustment(d))),this._resizeBatch){this._resizeBatch.notify=!0,(r=this._resizeBatch).sync||(r.sync=m);return}this.notify(m),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment()}},this.getVirtualItems=i(()=>[this.getVirtualIndexes(),this.getMeasurements(),this._holdOffset],(e,t,s)=>{let n=[];for(let r=0,l=e.length;r<l;r++){let l=t[e[r]];n.push(0===s?l:{...l,start:l.start-s,end:l.end-s})}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{var t;let s=this.getMeasurements();if(0===s.length)return;let n=null==(t=this._singleLaneMeasurements)?void 0:t.flat,r=1===this.options.lanes&&null!=n,l=w(0,s.length-1,r?e=>n[2*e]:e=>o(s[e]).start,e);return o(s[l])},this._noteClampMax=()=>{if(!this._awaitingCommandReadBack())return;let e=this._elementMaxScrollOffset();if(null===e)return;let t=this.pendingWrite,s=Math.max(e,0)+this._holdOffset;if(s>=t.target)return;let n=t.lowMaxes??(t.lowMaxes=[]);n[n.length-1]!==s&&n.push(s)},this.getMaxScrollOffset=()=>(this._elementMaxScrollOffset()??0)+this._holdOffset,this._toLayoutOffset=e=>{var t;let s=e+this._holdOffset;return(null==(t=this.pendingScrollAnchor)?void 0:t.kind)==="anchor"&&(s+=this.pendingScrollAnchor.delta),s},this._elementMaxScrollOffset=()=>{let e=this.scrollElement;if(null===e)return null;if("scrollHeight"in e)return this.options.horizontal?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight;if("document"in e){let t=e.document.documentElement;return this.options.horizontal?t.scrollWidth-e.innerWidth:t.scrollHeight-e.innerHeight}return null},this._momentumStop=null,this._stopMomentum=e=>{let t=this.scrollElement,s=this.targetWindow;if(null===t||null===s)return;let n="document"in t?t.document.scrollingElement:t;if(!(null==n?void 0:n.style))return;if(this._momentumStop){this._momentumStop.done=e;return}let{style:r}=n,l=this.options.horizontal?"overflow-x":"overflow-y",i=r.getPropertyValue(l),o=r.getPropertyPriority(l);r.setProperty(l,"hidden","important");let a={restore:()=>"hidden"===r.getPropertyValue(l)&&"important"===r.getPropertyPriority(l)&&(r.setProperty(l,i,o),!0),done:e};this._momentumStop=a,s.requestAnimationFrame(()=>s.requestAnimationFrame(()=>{this._momentumStop===a&&(this._momentumStop=null,a.restore()&&a.done())}))},this._clampedBy=e=>{let t=this._elementMaxScrollOffset();if(null===t)return null;let s=t+this._holdOffset;return e>s+.5?{target:e,maxAtWrite:s}:null},this.getVirtualDistanceFromEnd=()=>Math.max(this._getLayoutTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,s=0)=>{if(!this.scrollElement)return 0;let n=this.getSize(),r=this.getScrollOffset();return"auto"===t&&(t=e>=r+n?"end":"start"),"center"===t?e+=(s-n)/2:"end"===t&&(e-=n),Math.max(Math.min(this.getMaxScrollOffset(),e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));let s=this.getSize(),n=this.getScrollOffset(),r=this.measurementsCache[e];if(!r)return;if("auto"===t)if(r.end>=n+s-this.options.scrollPaddingEnd)t="end";else{if(!(r.start<=n+this.options.scrollPaddingStart))return[n,t];t="start"}if("end"===t&&e===this.options.count-1){let e=this.getMaxScrollOffset();return[Math.max(Math.min(e-this.options.paddingEnd+this.options.scrollPaddingEnd,e),0),t]}let l="end"===t?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,t,r.size),t]},this.scrollToOffset=(e,{align:t="start",behavior:s="auto"}={})=>{this._startScroll({index:null,align:t},this.getOffsetForAlignment(e,t),s,"absolute")},this.scrollToIndex=(e,{align:t="auto",behavior:s="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getOffsetForIndex(e,t);if(!n)return;let[r,l]=n;this._startScroll({index:e,align:l},r,s,"absolute")},this.scrollBy=(e,{behavior:t="auto"}={})=>{let s=this.getOffsetForAlignment((this.getCommandWrittenOffset()??this.getScrollOffset())+e,"start");this._startScroll({index:null,align:"start"},s,t,"relative")},this.scrollToEnd=({behavior:e="auto"}={})=>{this.options.count>0?this._startScroll({index:this.options.count-1,align:"end",toEnd:!0},Math.max(this.getMaxScrollOffset(),0),e,"absolute"):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.cancelScroll=()=>{null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>Math.max(this._getLayoutTotalSize()-this._holdOffset,0),this._getLayoutTotalSize=()=>{var e,t;let s,n=this.getMeasurements();if(0===n.length)s=this.options.paddingStart;else if(1===this.options.lanes){let r=n.length-1,l=null==(e=this._singleLaneMeasurements)?void 0:e.flat;s=null!=l?l[2*r]+l[2*r+1]:(null==(t=n[r])?void 0:t.end)??0}else{let e=Array(this.options.lanes).fill(null),t=n.length-1;for(;t>=0&&e.some(e=>null===e);){let s=n[t];null===e[s.lane]&&(e[s.lane]=s.end),t--}s=Math.max(...e.filter(e=>null!==e))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(0===this.itemSizeCache.size)return e;for(let t of this.getMeasurements())t&&this.itemSizeCache.has(t.key)&&e.push({index:t.index,key:t.key,start:t.start,size:t.size,end:t.end,lane:t.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:s}={})=>{let n={target:e+(t??0),smooth:"smooth"===s};return this.pendingWrite=n,this.options.scrollToFn(e-this._holdOffset,{behavior:s,adjustments:t},this),n},this.getCommandWrittenOffset=()=>null===this.scrollState||null===this.pendingWrite||this.pendingWrite.smooth?null:this.pendingWrite.target,this._awaitingCommandReadBack=()=>{let e=this.getCommandWrittenOffset();return!(h()&&this._iosGesture.dragging())&&null!==e&&!a(e,this.getScrollOffset())},this._followOffsetTarget=e=>{null!==this.scrollState&&null==this.scrollState.index&&(this.scrollState.lastTargetOffset+=e)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}get scrollAdjustments(){return 0}applyScrollAdjustment(e,t){if(0===e)return!1;if(this._followOffsetTarget(e),!this._canWriteScroll())return this._holdOffset+=e,null!==this.scrollOffset&&(this.scrollOffset+=e),!0;{let s=this.getScrollOffset();this._clampedAdjustment=this._clampedBy(s+e);let n=this._scrollToOffset(s,{adjustments:e,behavior:t});return null!==this.scrollOffset&&(this.pendingWrite===n&&(this.scrollOffset+=e),this.scrollOffset<0&&(this.scrollOffset=0)),!0}}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}getScrollStateTarget(e){let t=e.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:null!=e.index?this.getOffsetForIndex(e.index,e.align):void 0;return t?t[0]:e.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}if("queued"===this.scrollState.phase)return void this.scheduleScrollReconcile();this.getMeasurements();let e=this.getScrollStateTarget(this.scrollState),t=null==this.scrollState.index?1:this.options.useAnimationFrameWithResizeObserver?3:2,s=e!==this.scrollState.lastTargetOffset;if(!s&&a(e,this.getScrollOffset())){if("smooth"===this.scrollState.phase?this.scrollState.phase="smoothLanded":"smoothFinishing"===this.scrollState.phase&&(this.scrollState.phase="instant"),this.scrollState.stableFrames++,this.scrollState.stableFrames>=t){this.getScrollOffset()!==e&&this._scrollToOffset(e,{behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,s){let t=this.getSize()||600,s=Math.abs(e-this.getScrollOffset()),n=S(this.scrollState)&&s>t;this.scrollState.lastTargetOffset=e,n?this.scrollState.phase="smooth":"smooth"===this.scrollState.phase?this.scrollState.phase="smoothFinishing":"smoothLanded"===this.scrollState.phase&&(this.scrollState.phase="instant"),this._scrollToOffset(e,{behavior:n?"smooth":"auto"})}this.scheduleScrollReconcile()}_startScroll(e,t,n,r){this.pendingScrollAnchor=null,this._clampedAdjustment=null;let l=this._iosGesture.tail();if("absolute"===r&&null!==l){if("fling"===l&&(void 0!==s?s:s=h()&&"u">typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("overflow-anchor: auto"))){this._stopMomentum(()=>{let e=this.scrollState;(null==e?void 0:e.phase)!=="queued"||"fling"!==this._iosGesture.tail()||this._reportedOverscroll||(this._iosGesture.end(),this._flushHoldIfReady(!0),this._writeAwaitingCommand())}),this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,phase:"queued",behavior:n,samples:[]},this.scheduleScrollReconcile();return}this._iosGesture.end()}this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,behavior:n,phase:b(n,null!=e.index&&a(t,this.getScrollOffset()))},this._scrollToOffset(t,{behavior:n}),this.scheduleScrollReconcile()}}let w=(e,t,s,n)=>{for(;e<=t;){let r=(e+t)/2|0,l=s(r);if(l<n)e=r+1;else{if(!(l>n))return r;t=r-1}}return e>0?e-1:0},M="u">typeof document?r.useLayoutEffect:r.useEffect;var N=e.i(16327),_=e.i(56420);let O={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};O.node;let k=(0,_.f)(O);function E(e){let t=new Map,s=new Map;for(let n of e){let e=n.uuid||`${n._source}:${n.timestamp}`,r=s.get(e)??0;s.set(e,r+1),t.set(n,0===r?e:`${e}#${r}`)}return t}let C={name:"user",size:24,node:[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]};C.node;let I=(0,_.f)(C),T={name:"bot",size:24,node:[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]};T.node;let z=(0,_.f)(T),A={name:"cpu",size:24,node:[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]};A.node;let F=(0,_.f)(A),R={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};R.node;let W=(0,_.f)(R),L={name:"message-square",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]};L.node;let $=(0,_.f)(L),D={name:"workflow",size:24,node:[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]};D.node;let B=(0,_.f)(D);var P=e.i(34713);let q=r.default.memo(function({entries:e,compact:t=!1}){let s=(0,r.useMemo)(()=>(function(e){let t=0,s=0,n=0,r=0,l=0,i=new Set;for(let o of e)if("user"===o.type&&t++,"queue-operation"===o.type&&l++,"assistant"===o.type){for(let e of(s++,o.message.content))"tool_use"===e.type&&("Task"===e.name&&(e.subagentType||e.subagentId)?r++:n++);o.message.model&&i.add(o.message.model)}let o="";if(e.length>=2){let t=e[e.length-1].timestampMs-e[0].timestampMs;o=(0,P.M)(t)}return{turnCount:l,userCount:t,assistantCount:s,toolCallCount:n,subagentCount:r,duration:o,models:Array.from(i)}})(e),[e]),l=t?"w-3.5 h-3.5":"w-4 h-4",i=t?"text-xs font-medium":"text-sm font-medium",o=t?"text-[10px] text-muted-foreground":"text-xs text-muted-foreground",a=[...t?[]:[{Icon:$,color:"text-primary",v:s.turnCount,l:"Turns"}],{Icon:I,color:"text-[color:var(--chart-1)]",v:s.userCount,l:"User"},{Icon:z,color:"text-[color:var(--chart-2)]",v:s.assistantCount,l:"Assistant"},{Icon:k,color:"text-[color:var(--chart-3)]",v:s.toolCallCount,l:t?"Tools":"Tool Calls"},{Icon:B,color:"text-[color:var(--chart-5)]",v:s.subagentCount,l:"Subagents"},{Icon:W,color:"text-[color:var(--chart-4)]",v:s.duration||"—",l:"Duration"},{Icon:F,color:"text-[color:var(--chart-5)]",v:s.models.length>0?s.models.join(", "):"—",l:t?"Model":"Model(s)"}];return(0,n.jsx)("div",{className:t?"bg-muted/30 border border-border/50 rounded-lg p-3 mb-3":"bg-card border border-border rounded-lg p-4",children:(0,n.jsx)("div",{className:`grid grid-cols-2 ${t?"sm:grid-cols-6 gap-3":"sm:grid-cols-4 lg:grid-cols-7 gap-4"}`,children:a.map(({Icon:e,color:t,v:s,l:r})=>(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(e,{className:`${l} ${t}`}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:`${i} truncate max-w-[120px]`,children:s}),(0,n.jsx)("div",{className:o,children:r})]})]},r))})})}),U={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};U.node;let H=(0,_.f)(U);var V=e.i(67927);function K(e){return JSON.stringify(e.raw,null,2)}let G=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0});function Y(e){let t=new Date(e),s=G.format(t),n=t.getMilliseconds().toString().padStart(3,"0");return`${s}.${n}`}let J=r.default.memo(function({entry:e,isCollapsed:t,entryCount:s,onToggle:r}){let l="function"==typeof r,i=(0,n.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full bg-primary/10 border border-primary/20 text-primary text-xs font-medium${l?" group-hover:bg-primary/20 transition-colors":""}`,children:[l?(0,n.jsx)(V.f,{className:`w-3 h-3 transition-transform ${t?"":"rotate-90"}`}):(0,n.jsx)(H,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:e.label}),(0,n.jsx)("span",{className:"text-muted-foreground",children:Y(e.timestampMs)}),l&&t&&"number"==typeof s&&(0,n.jsxs)("span",{className:"ml-1 px-1.5 py-0.5 rounded bg-primary/20 text-[10px] leading-none",children:[s," ",1===s?"entry":"entries"]})]});return l?(0,n.jsxs)("button",{type:"button",onClick:r,className:"group flex items-center gap-3 py-3 px-4 w-full cursor-pointer",children:[(0,n.jsx)("div",{className:"flex-1 h-px bg-primary/30"}),i,(0,n.jsx)("div",{className:"flex-1 h-px bg-primary/30"})]}):(0,n.jsxs)("div",{className:"flex items-center gap-3 py-3 px-4",children:[(0,n.jsx)("div",{className:"flex-1 h-px bg-primary/30"}),i,(0,n.jsx)("div",{className:"flex-1 h-px bg-primary/30"})]})});var X=e.i(47163);let Q={user:"User",assistant:"Assistant","file-history-snapshot":"Snapshot",progress:"Progress",system:"System","queue-operation":"Queue"},Z={user:"bg-[color:var(--chart-1)]/20 text-[color:var(--chart-1)] border-[color:var(--chart-1)]/30",assistant:"bg-[color:var(--chart-2)]/20 text-[color:var(--chart-2)] border-[color:var(--chart-2)]/30","file-history-snapshot":"bg-[color:var(--chart-3)]/20 text-[color:var(--chart-3)] border-[color:var(--chart-3)]/30",progress:"bg-[color:var(--chart-5)]/20 text-[color:var(--chart-5)] border-[color:var(--chart-5)]/30",system:"bg-[color:var(--chart-4)]/20 text-[color:var(--chart-4)] border-[color:var(--chart-4)]/30","queue-operation":"bg-primary/20 text-primary border-primary/30"},ee={user:"border-l-[color:var(--chart-1)]",assistant:"border-l-[color:var(--chart-2)]","file-history-snapshot":"border-l-[color:var(--chart-3)]",progress:"border-l-[color:var(--chart-5)]",system:"border-l-[color:var(--chart-4)]","queue-operation":"border-l-primary"},et={name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]};et.node;let es=(0,_.f)(et),en={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};en.node;let er=(0,_.f)(en);var el=e.i(66794);function ei({type:e}){let t="w-4 h-4";switch(e){case"user":return(0,n.jsx)(I,{className:t});case"assistant":return(0,n.jsx)(z,{className:t});case"file-history-snapshot":return(0,n.jsx)(es,{className:t});case"progress":return(0,n.jsx)(er,{className:t});case"system":return(0,n.jsx)(el.f,{className:t});case"queue-operation":return(0,n.jsx)(H,{className:t})}}function eo({type:e}){return(0,n.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-xs font-mono rounded border ${Z[e]}`,children:[(0,n.jsx)(ei,{type:e}),Q[e]]})}var ea=e.i(24380);function eh({block:e}){let t=(0,r.useMemo)(()=>JSON.stringify(e.input,null,2),[e]);return(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("details",{open:!0,children:[(0,n.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:["Input",(0,n.jsx)(ea.CopyButton,{text:t})]})}),(0,n.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:t})]}),e.result?(0,n.jsxs)("div",{className:"border-l-2 border-primary/50 pl-3 space-y-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"inline-block px-2 py-0.5 text-xs font-mono rounded border bg-primary/20 text-primary border-primary/30",children:"Result"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:Y(new Date(e.result.timestamp).getTime())})]}),e.result.content&&(0,n.jsxs)("details",{open:!0,children:[(0,n.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:["Output",(0,n.jsx)(ea.CopyButton,{text:e.result.content})]})}),(0,n.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs whitespace-pre-wrap break-words max-h-48 overflow-y-auto",children:e.result.content})]}),e.result.images?.map((e,t)=>(0,n.jsx)("img",{src:`data:${e.mediaType};base64,${e.base64}`,alt:`Tool result image ${t+1}`,className:"mt-2 max-w-full rounded border border-border"},t))]}):(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:"Tool did not return a result"})]})}let ed={name:"brain",size:24,node:[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 01-3-4 4.17 4.17 0 01-3 4",key:"5nuw1p"}],["path",{d:"M17.707 6.294A3 3 0 1012 5a3 3 0 10-5.707 1.294",key:"18ldcf"}],["path",{d:"M17.996 5.125a4 4 0 012.526 5.77",key:"1sdu8q"}],["path",{d:"M18 18a4 4 0 002-7.465",key:"7xqqvr"}],["path",{d:"M19.967 17.482a4 4 0 11-7.967.517 4 4 0 11-7.967-.517",key:"t46ysz"}],["path",{d:"M6 18a4 4 0 01-2-7.465",key:"1y2m15"}],["path",{d:"M6.004 5.125a4 4 0 00-2.526 5.77",key:"3cw1ss"}]]};ed.node;let ec=(0,_.f)(ed),eu=r.default.memo(function({block:e,entriesBySource:t,projectName:s,sessionId:r,highlightedUuid:l,autoExpandForUuid:i}){switch(e.type){case"text":return(0,n.jsx)("p",{className:"whitespace-pre-wrap text-sm",children:e.text});case"tool_use":if("Task"===e.name&&(e.subagentType||e.subagentId)){let o=e.subagentId&&t?t.get(`agent-${e.subagentId}`):void 0;return(0,n.jsx)(eb,{block:e,subagentEntries:o,projectName:s,sessionId:r,highlightedUuid:l,autoExpandForUuid:i})}return(0,n.jsxs)("div",{className:"border border-border/50 rounded-lg p-3 bg-muted/10",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,n.jsx)(k,{className:"w-4 h-4 text-primary flex-shrink-0"}),(0,n.jsx)("span",{className:"font-mono text-sm text-primary truncate min-w-0",children:e.name}),e.result&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground ml-auto flex-shrink-0",children:e.result.durationFormatted})]}),(0,n.jsx)(eh,{block:e})]});case"thinking":return(0,n.jsx)("div",{className:"border border-[color:var(--chart-5)]/30 rounded-lg p-3 bg-[color:var(--chart-5)]/5",children:(0,n.jsxs)("details",{children:[(0,n.jsxs)("summary",{className:"flex items-center gap-2 text-xs cursor-pointer hover:text-foreground transition-colors text-[color:var(--chart-5)]",children:[(0,n.jsx)(ec,{className:"w-4 h-4"}),(0,n.jsx)("span",{children:"Thinking"}),(0,n.jsxs)("span",{className:"text-muted-foreground ml-1",children:["(",e.thinking.length.toLocaleString()," chars)"]})]}),(0,n.jsx)("p",{className:"mt-2 whitespace-pre-wrap text-xs text-muted-foreground p-2 bg-muted/30 rounded max-h-64 overflow-y-auto",children:e.thinking})]})})}});function em({entry:e}){return(0,n.jsx)("div",{children:e.message.content&&(0,n.jsx)("p",{className:"whitespace-pre-wrap text-sm",children:e.message.content})})}let ef=r.default.memo(function({entry:e,entriesBySource:t,projectName:s,sessionId:r,highlightedUuid:l,autoExpandForUuid:i}){let{content:o}=e.message;return(0,n.jsx)("div",{className:"space-y-3",children:o.map((e,o)=>(0,n.jsx)(eu,{block:e,entriesBySource:t,projectName:s,sessionId:r,highlightedUuid:l,autoExpandForUuid:i},o))})}),ep=r.default.memo(function({entry:e}){let t=(0,r.useMemo)(()=>{if("progress"===e.type){let t=e.raw.data,s=t?.agentId;return[t?.type,s&&`agent:${s}`].filter(Boolean).join(" | ")}return"file-history-snapshot"===e.type?"File history snapshot":e.type},[e.type,e.raw]);return(0,n.jsxs)("div",{className:"text-sm",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:t}),(0,n.jsxs)("details",{className:"mt-1",children:[(0,n.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:"Show raw JSON"}),(0,n.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:K(e)})]})]})}),eg={name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]};eg.node;let ex=(0,_.f)(eg);var ey=e.i(55574);function ev({uuid:e}){let t=(0,r.useCallback)(async()=>{window.history.replaceState(null,"",`#entry-${e}`);try{await navigator.clipboard.writeText(window.location.href)}catch{let e=document.createElement("textarea");e.value=window.location.href,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}(0,ey.toast)("Link copied")},[e]);return(0,n.jsx)("button",{onClick:t,title:"Copy link to entry",className:"inline-flex items-center justify-center rounded p-1 text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors opacity-0 group-hover:opacity-100 transition-opacity",children:(0,n.jsx)(ex,{className:"w-3.5 h-3.5"})})}function eb({block:e,subagentEntries:t,projectName:s,sessionId:l,highlightedUuid:i,autoExpandForUuid:o}){let a=!!(o&&t?.some(e=>e.uuid===o)),[h,d]=(0,r.useState)(a);(0,r.useEffect)(()=>{if(!a)return;let e=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(e)},[a]);let c=(0,r.useCallback)(()=>{d(e=>!e)},[]),u=t&&t.length>0,m=(0,r.useMemo)(()=>E(t??[]),[t]);return(0,n.jsxs)("div",{className:"border border-border/50 rounded-lg p-3 bg-muted/10",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,n.jsx)(B,{className:"w-4 h-4 text-[color:var(--chart-5)]"}),(0,n.jsx)("span",{className:"font-mono text-sm text-[color:var(--chart-5)]",children:"Subagent"}),e.subagentType&&(0,n.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 text-xs font-mono rounded border bg-[color:var(--chart-5)]/20 text-[color:var(--chart-5)] border-[color:var(--chart-5)]/30",children:e.subagentType}),e.result&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground ml-auto",children:e.result.durationFormatted})]}),e.subagentDescription&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:e.subagentDescription}),e.subagentId&&t&&(0,n.jsxs)("button",{onClick:c,className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded border border-primary/30 bg-primary/10 text-primary hover:bg-primary/20 transition-colors mb-2",children:[(0,n.jsx)(V.f,{className:(0,X.f)("w-3 h-3 transition-transform",h&&"rotate-90")}),(0,n.jsxs)("span",{children:["agent-",e.subagentId]}),(0,n.jsx)("span",{className:"text-muted-foreground",children:h?"Collapse":"View subagent log"})]}),h&&(0,n.jsxs)("div",{className:"ml-4 pl-3 border-l-2 border-primary/30 mt-2 space-y-2",children:[t&&0===t.length&&(0,n.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:"No entries found in subagent log."}),u&&(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(q,{entries:t,compact:!0})}),t&&t.map(e=>"queue-operation"===e.type?(0,n.jsx)(J,{entry:e},m.get(e)):(0,n.jsx)(ej,{entry:e,projectName:s,sessionId:l,isHighlighted:!!i&&e.uuid===i},m.get(e)))]}),(0,n.jsx)(eh,{block:e})]})}function eS({entry:e,entriesBySource:t,projectName:s,sessionId:r,highlightedUuid:l,autoExpandForUuid:i}){switch(e.type){case"user":return(0,n.jsx)(em,{entry:e});case"assistant":return(0,n.jsx)(ef,{entry:e,entriesBySource:t,projectName:s,sessionId:r,highlightedUuid:l,autoExpandForUuid:i});case"file-history-snapshot":case"progress":case"system":return(0,n.jsx)(ep,{entry:e})}}let ej=r.default.memo(function({entry:e,entriesBySource:t,projectName:s,sessionId:r,isHighlighted:l,highlightedUuid:i,autoExpandForUuid:o}){return(0,n.jsxs)("div",{id:e.uuid?`entry-${e.uuid}`:void 0,className:(0,X.f)(`group border-l-4 ${ee[e.type]} bg-card/50 rounded-r-lg mb-2 hover:bg-muted/30 transition-colors`,l&&"entry-highlighted"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border/30",children:[(0,n.jsx)(eo,{type:e.type}),(0,n.jsxs)("div",{className:"flex items-center gap-1 ml-auto",children:[e.uuid&&(0,n.jsx)(ev,{uuid:e.uuid}),(0,n.jsx)(ea.CopyButton,{text:function(e){switch(e.type){case"user":return e.message.content;case"assistant":return e.message.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n");case"file-history-snapshot":case"progress":case"system":return K(e);case"queue-operation":return e.label}}(e)}),(0,n.jsx)("span",{className:"text-xs font-mono text-muted-foreground whitespace-nowrap",children:Y(e.timestampMs)})]})]}),(0,n.jsx)("div",{className:"px-4 py-3",children:(0,n.jsx)(eS,{entry:e,entriesBySource:t,projectName:s,sessionId:r,highlightedUuid:i,autoExpandForUuid:o})})]})},(e,t)=>e.entry===t.entry&&e.entriesBySource===t.entriesBySource&&e.projectName===t.projectName&&e.sessionId===t.sessionId&&e.isHighlighted===t.isHighlighted&&e.highlightedUuid===t.highlightedUuid&&e.autoExpandForUuid===t.autoExpandForUuid);var ew=e.i(80745),eM=e.i(84026),eN=e.i(29407),e_=e.i(16306),eO=e.i(82954),ek=e.i(73520),eE=e.i(85881);function eC({decision:e}){return"deny"===e?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-red-500/10 text-red-400 border border-red-500/20",children:[(0,n.jsx)(eN.f,{className:"h-3 w-3"}),"Deny"]}):"instruct"===e?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[(0,n.jsx)(e_.f,{className:"h-3 w-3"}),"Instruct"]}):(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[(0,n.jsx)(eM.f,{className:"h-3 w-3"}),"Allow"]})}function eI({eventType:e}){return(0,n.jsx)("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium bg-muted text-muted-foreground border border-border/50",children:e})}function eT({mode:e}){let t="default"===e;return(0,n.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${t?"bg-sky-500/10 text-sky-400 border-sky-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:e})}function ez({ms:e}){return(0,n.jsx)("span",{className:`font-mono text-[0.7rem] ${e>500?"text-red-400":e>100?"text-amber-400":"text-muted-foreground"}`,children:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`})}function eA({value:e,onChange:t}){return(0,n.jsx)("div",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 p-0.5",children:[{label:"All",value:""},{label:"Allow",value:"allow"},{label:"Instruct",value:"instruct"},{label:"Deny",value:"deny"}].map(s=>(0,n.jsx)("button",{onClick:()=>t(s.value),className:`px-2.5 py-1 text-[0.65rem] font-medium rounded transition-all ${e===s.value?"deny"===s.value?"bg-red-500/15 text-red-400 shadow-sm":"allow"===s.value?"bg-emerald-500/15 text-emerald-400 shadow-sm":"instruct"===s.value?"bg-amber-500/15 text-amber-400 shadow-sm":"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:s.label},s.value))})}function eF({item:e}){return(0,n.jsx)("tr",{children:(0,n.jsx)("td",{colSpan:9,className:"px-0 py-0",children:(0,n.jsxs)("div",{className:"px-6 py-3 bg-muted/20 border-t border-border/30 space-y-2 text-xs animate-expand",children:[(0,n.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-1.5",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Session ID: "}),(0,n.jsx)("span",{className:"font-mono text-foreground",children:e.sessionId??"—"}),e.sessionId&&(0,n.jsx)(ea.CopyButton,{text:e.sessionId})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"CWD: "}),(0,n.jsx)("span",{className:"font-mono text-foreground",children:e.cwd??"—"}),e.cwd&&(0,n.jsx)(ea.CopyButton,{text:e.cwd})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Transcript: "}),(0,n.jsx)("span",{className:"font-mono text-foreground break-all",children:e.transcriptPath??"—"}),e.transcriptPath?.startsWith("opencode-db://")&&(0,n.jsx)("span",{className:"text-muted-foreground ml-1",children:"(stored in opencode DB)"})]})]}),e.policyNames&&e.policyNames.length>1&&(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Policies: "}),(0,n.jsx)("span",{className:"font-mono text-foreground",children:e.policyNames.join(", ")})]}),e.reason&&(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Full reason: "}),(0,n.jsx)("span",{className:"text-foreground",children:e.reason})]})]})})})}function eR({sessionId:e,initialData:t}){let{intervalSec:s}=(0,eE.useAutoRefresh)(),[l,i]=(0,r.useState)(!1),[o,a]=(0,r.useState)(1),[h,d]=(0,r.useState)(t),[c,u]=(0,r.useState)(null),[m,f]=(0,r.useState)(""),[p,g]=(0,r.useState)(""),[x,y]=(0,r.useState)(""),v=(0,r.useRef)(null),b=(0,r.useRef)({filterDecision:m,filterEventType:p,filterPolicy:x});b.current={filterDecision:m,filterEventType:p,filterPolicy:x};let S=""!==m||""!==p||""!==x,j=(0,r.useCallback)(async t=>{try{let{filterDecision:s,filterEventType:n,filterPolicy:r}=b.current,l=await (0,ew.f)({sessionId:e,decision:s||void 0,eventType:n||void 0,policyName:r||void 0},t);d(l)}catch{}},[e]);(0,r.useEffect)(()=>{j(o);let e=setInterval(()=>j(o),s>0?1e3*s:5e3);return()=>clearInterval(e)},[o,j,s]),(0,r.useEffect)(()=>(v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{a(1),u(null),j(1)},300),()=>{v.current&&clearTimeout(v.current)}),[m,p,x]);let w=h.entries,M=h.totalPages;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("button",{onClick:()=>i(e=>!e),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,n.jsx)(N.f,{className:`w-4 h-4 text-muted-foreground transition-transform ${l?"-rotate-90":""}`}),(0,n.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Hook Logs"})]}),!l&&(0,n.jsxs)("div",{className:"mt-2 bg-card border border-border rounded-lg overflow-hidden shadow-sm",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4 py-2.5 border-b border-border bg-muted/20",children:[(0,n.jsx)(eA,{value:m,onChange:f}),(0,n.jsxs)("select",{value:p,onChange:e=>g(e.target.value),className:"h-7 rounded-md border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/40 transition-shadow",children:[(0,n.jsx)("option",{value:"",children:"All Events"}),(0,n.jsx)("option",{value:"PreToolUse",children:"PreToolUse"}),(0,n.jsx)("option",{value:"PostToolUse",children:"PostToolUse"}),(0,n.jsx)("option",{value:"SessionStart",children:"SessionStart"}),(0,n.jsx)("option",{value:"SessionEnd",children:"SessionEnd"}),(0,n.jsx)("option",{value:"UserPromptSubmit",children:"UserPromptSubmit"}),(0,n.jsx)("option",{value:"PermissionRequest",children:"PermissionRequest"})]}),(0,n.jsx)("div",{className:"relative",children:(0,n.jsx)("input",{type:"text",value:x,onChange:e=>y(e.target.value),placeholder:"Filter by policy…",className:"h-7 rounded-md border border-border bg-background px-2.5 text-xs text-foreground placeholder:text-muted-foreground w-44 focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/40 transition-shadow"})})]}),0===w.length?(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 px-4",children:[(0,n.jsx)(eO.f,{className:"h-10 w-10 text-muted-foreground/30"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mt-3",children:S?"No matching hook events.":"No hook events found."})]}):(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)("table",{className:"w-full text-xs",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{className:"text-left text-muted-foreground border-b border-border bg-muted/30",children:[(0,n.jsx)("th",{className:"px-4 py-2.5 font-medium w-6"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Decision"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Event"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Tool"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Policy"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Reason"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Duration"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Mode"}),(0,n.jsx)("th",{className:"px-3 py-2.5 font-medium text-right",children:"Time"})]})}),(0,n.jsx)("tbody",{className:"divide-y divide-border/30",children:w.map((e,t)=>{let s="deny"===e.decision,l=c===t,i="instruct"===e.decision;return(0,n.jsxs)(r.default.Fragment,{children:[(0,n.jsxs)("tr",{onClick:()=>{u(e=>e===t?null:t)},className:`cursor-pointer transition-colors ${s?"bg-red-500/[0.03] hover:bg-red-500/[0.07] border-l-2 border-l-red-500/40":i?"bg-amber-500/[0.03] hover:bg-amber-500/[0.07] border-l-2 border-l-amber-500/40":t%2==0?"hover:bg-muted/30":"bg-muted/[0.04] hover:bg-muted/30"} ${l?"bg-muted/20":""}`,children:[(0,n.jsx)("td",{className:"px-4 py-2",children:(0,n.jsx)(N.f,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform duration-150 ${l?"rotate-0":"-rotate-90"}`})}),(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsx)(eC,{decision:e.decision})}),(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsx)(eI,{eventType:e.eventType})}),(0,n.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:e.toolName??"—"}),(0,n.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:e.policyNames&&e.policyNames.length>1?(0,n.jsxs)("span",{title:e.policyNames.join(", "),children:[e.policyNames[0],(0,n.jsxs)("span",{className:"text-muted-foreground text-[0.6rem]",children:[" +",e.policyNames.length-1]})]}):e.policyName??"—"}),(0,n.jsx)("td",{className:"px-3 py-2 text-muted-foreground truncate max-w-[240px]",title:e.reason??"",children:e.reason??"—"}),(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsx)(ez,{ms:e.durationMs})}),(0,n.jsx)("td",{className:"px-3 py-2",children:e.permissionMode?(0,n.jsx)(eT,{mode:e.permissionMode}):"—"}),(0,n.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground whitespace-nowrap",title:new Date(e.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),children:(0,P.g)(e.timestamp)})]}),l&&(0,n.jsx)(eF,{item:e})]},`${e.timestamp}-${t}`)})})]})}),(0,n.jsx)(ek.f,{currentPage:o,totalPages:M,onPageChange:e=>{a(e),u(null)}})]})]})}function eW(e){let t=new Map;for(let s of e)if("assistant"===s.type)for(let e of s.message.content){if("tool_use"!==e.type||"Task"===e.name&&(e.subagentType||e.subagentId))continue;let s=t.get(e.name)||{count:0,totalDurationMs:0};s.count++,e.result?.durationMs&&(s.totalDurationMs+=e.result.durationMs),t.set(e.name,s)}return Array.from(t.entries()).map(([e,t])=>({name:e,...t})).sort((e,t)=>t.count-e.count)}function eL({tools:e,compact:t}){return(0,n.jsx)("div",{className:`bg-card border border-border rounded-lg ${t?"p-3":"p-4"}`,children:(0,n.jsx)("div",{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] ${t?"gap-2":"gap-3"}`,children:e.map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,n.jsx)(k,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:`${t?"text-xs":"text-sm"} font-mono font-medium truncate`,children:e.name}),(0,n.jsxs)("div",{className:"text-xs text-muted-foreground truncate",children:[e.count," call",1!==e.count?"s":"",e.totalDurationMs>0&&` \xb7 ${(e.totalDurationMs/1e3).toFixed(1)}s`]})]})]},e.name))})})}function e$(e,t){return t.get(e)??`${e.uuid}-${e.timestampMs}`}function eD(){let e=window.location.hash;return e.startsWith("#entry-")?e.slice(7):null}function eB({entries:e,entriesBySource:t,projectName:s,sessionId:i}){let o=(0,r.useMemo)(()=>Array.from(t.values()).flat(),[t]),[a,h]=(0,r.useState)(new Set),[d,c]=(0,r.useState)(0),[u,m]=(0,r.useState)(()=>eD()),f=(0,r.useRef)(void 0),g=(0,r.useRef)(!1),y=(0,r.useRef)(null);(0,r.useLayoutEffect)(()=>{let e=y.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().top+window.scrollY;c(e=>e===t?e:t)};t();let s=new ResizeObserver(t);return s.observe(document.body),window.addEventListener("resize",t),()=>{s.disconnect(),window.removeEventListener("resize",t)}},[]);let b=(0,r.useMemo)(()=>E(e),[e]),S=(0,r.useMemo)(()=>(function(e,t){let s=new Map,n=null,r=0;for(let l of e)"queue-operation"===l.type?(null!==n&&s.set(n,r),n=e$(l,t),r=0):null!==n&&r++;return null!==n&&s.set(n,r),s})(e,b),[e,b]),w=(0,r.useMemo)(()=>{let t;return t=!1,e.filter(e=>"queue-operation"===e.type?(t=a.has(e$(e,b)),!0):!t)},[e,a,b]),N=(0,r.useMemo)(()=>{let e=new Map;return w.forEach((t,s)=>{t.uuid&&e.set(t.uuid,s)}),e},[w]),_=(0,r.useMemo)(()=>(function(e){let t=new Map;for(let s of e)if("assistant"===s.type&&s.uuid)for(let e of s.message.content)"tool_use"===e.type&&"Task"===e.name&&e.subagentId&&t.set(e.subagentId,s.uuid);let s=new Map;for(let n of e){if(!n._source?.startsWith("agent-")||!n.uuid)continue;let e=n._source.slice(6),r=t.get(e);r&&s.set(n.uuid,r)}return s})(o),[o]),O=(0,r.useMemo)(()=>u&&_.has(u)?u:null,[u,_]),k=O?_.get(O)??null:null;(0,r.useEffect)(()=>{if(u)return f.current=setTimeout(()=>m(null),4e3),()=>{f.current&&clearTimeout(f.current)}},[]),(0,r.useEffect)(()=>{let e=()=>{let e=eD();m(e),g.current=!1,f.current&&clearTimeout(f.current),e&&(f.current=setTimeout(()=>m(null),4e3))};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]);let C=(0,r.useMemo)(()=>{if(!u)return null;let t=k??u,s=e.some(e=>e.uuid===t),n=N.has(t);if(s&&!n){let s=null;for(let n of e)if("queue-operation"===n.type)s=e$(n,b);else if(n.uuid===t&&s)return s}return null},[u,k,e,N,b]);(0,r.useEffect)(()=>{if(!C)return;let e=requestAnimationFrame(()=>{h(e=>{if(!e.has(C))return e;let t=new Set(e);return t.delete(C),t})});return()=>cancelAnimationFrame(e)},[C]);let I=(0,r.useCallback)(e=>{h(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),T=(0,r.useCallback)(e=>b.get(w[e])??e,[b,w]),z=function({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:s="transform",...n}){let i=r.useReducer(e=>e+1,0)[1],o=r.useRef({enabled:t,mode:s,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});o.current.enabled=t,o.current.mode=s;let a=r.useRef(!1),h=e=>{let t=o.current;if(!t.enabled||!t.container)return;let s=e.getTotalSize();if(s!==t.lastSize){t.lastSize=s;let n=e.options.horizontal?"width":"height";t.container.style[n]=`${s}px`}},d=(e,t,s)=>{let n=o.current,r=!!e.options.horizontal,l=t.start-e.options.scrollMargin;n.lastPositions.get(s)!==l&&(n.lastPositions.set(s,l),"transform"===n.mode?s.style.transform=r?`translate3d(${l}px, 0, 0)`:`translate3d(0, ${l}px, 0)`:s.style[r?"left":"top"]=`${l}px`)},c=e=>{let t=o.current;if(t.enabled&&t.container)for(let t of(h(e),e.getVirtualItems())){let s=e.elementsCache.get(t.key);s&&d(e,t,s)}},u={...n,onChange:(t,s)=>{var r;let h=o.current,d=!0;if(h.enabled){c(t);let e=t.range,s=h.prevRange;(d=!s||s.isScrolling!==t.isScrolling||s.startIndex!==(null==e?void 0:e.startIndex)||s.endIndex!==(null==e?void 0:e.endIndex))&&(h.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}d&&(e&&s&&!a.current?(0,l.flushSync)(i):i()),null==(r=n.onChange)||r.call(n,t,s)}},[m]=r.useState(()=>{let e=new j(u),t=e.measureElement;return e.measureElement=s=>{a.current=!0;try{t(s)}finally{a.current=!1}let n=o.current;if(null!==s&&n.enabled&&n.container){let t=e.measurementsCache[e.indexFromElement(s)];t&&d(e,t,s)}},Object.assign(e,{containerRef:t=>{let s=o.current;s.container=t,s.lastSize=null,null!==t&&c(e)}})});return m.setOptions(u),M(()=>m._didMount(),[]),M(()=>(h(m),m._willUpdate())),M(()=>{c(m)}),m}({getScrollElement:()=>"u">typeof document?window:null,observeElementRect:p,observeElementOffset:x,scrollToFn:v,initialOffset:()=>"u">typeof document?window.scrollY:0,...{count:w.length,estimateSize:e=>(function(e){switch(e.type){case"queue-operation":return 48;case"user":return 90;case"assistant":return 80+120*e.message.content.length;default:return 100}})(w[e]),getItemKey:T,overscan:5,scrollMargin:d}});return(0,r.useEffect)(()=>{if(!u||g.current)return;let e=k??u,t=N.get(e);null!=t&&(g.current=!0,requestAnimationFrame(()=>{z.scrollToIndex(t,{align:"center"})}))},[u,k,N,z]),(0,n.jsx)("div",{ref:y,children:(0,n.jsx)("div",{style:{height:`${z.getTotalSize()}px`,width:"100%",position:"relative"},children:z.getVirtualItems().map(e=>{let r=w[e.index],l=!!u&&r.uuid===(k??u);return(0,n.jsx)("div",{"data-index":e.index,ref:z.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${e.start-z.options.scrollMargin}px)`},children:"queue-operation"===r.type?(0,n.jsx)(J,{entry:r,isCollapsed:a.has(e$(r,b)),entryCount:S.get(e$(r,b))??0,onToggle:()=>I(e$(r,b))}):(0,n.jsx)(ej,{entry:r,entriesBySource:t,projectName:s,sessionId:i,isHighlighted:!O&&l,highlightedUuid:O,autoExpandForUuid:O})},e.key)})})})}let eP=[];e.s(["default",0,function({entries:e,projectName:t,sessionId:s}){let l=(0,r.useMemo)(()=>{let t=new Map;for(let s of e){let e=t.get(s._source);e?e.push(s):t.set(s._source,[s])}return t},[e]),i=l.get("session")??eP,o=(0,r.useMemo)(()=>(function(e){let t=new Map;for(let s of e)if("assistant"===s.type)for(let e of s.message.content)"tool_use"===e.type&&"Task"===e.name&&e.subagentId&&(t.has(e.subagentId)||t.set(e.subagentId,{id:e.subagentId,type:e.subagentType||"unknown",description:e.subagentDescription||""}));return Array.from(t.values())})(e),[e]),a=(0,r.useMemo)(()=>eW(i),[i]),[h,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(new Set),[m,f]=(0,r.useState)(!1),[p,g]=(0,r.useState)(null);(0,r.useEffect)(()=>{(0,ew.f)({sessionId:s},1).then(e=>{e.entries.length>0&&g(e)}).catch(()=>{})},[s]),(0,r.useEffect)(()=>{let e=()=>{window.location.hash.startsWith("#entry-")&&f(!1)};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]);let x=(0,r.useCallback)(e=>{u(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(q,{entries:i}),p&&(0,n.jsx)(eR,{sessionId:s,initialData:p},s),o.length>0&&(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("button",{onClick:()=>d(e=>!e),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,n.jsx)(N.f,{className:`w-4 h-4 text-muted-foreground transition-transform ${h?"-rotate-90":""}`}),(0,n.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Subagents"}),(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",o.length,")"]})]}),!h&&o.map(e=>{let t;return(0,n.jsxs)("div",{className:"pl-3 border-l-2 border-primary/30 space-y-2",children:[(0,n.jsxs)("button",{onClick:()=>x(e.id),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,n.jsx)(N.f,{className:`w-3.5 h-3.5 text-muted-foreground transition-transform ${c.has(e.id)?"-rotate-90":""}`}),(0,n.jsx)("span",{className:"text-sm font-bold",children:e.type}),e.description&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground truncate max-w-[400px]",children:e.description})]}),!c.has(e.id)&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(q,{entries:l.get(`agent-${e.id}`)||[],compact:!0}),(t=eW(l.get(`agent-${e.id}`)||[])).length>0?(0,n.jsx)(eL,{tools:t,compact:!0}):null]})]},e.id)})]}),a.length>0&&(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Tools"}),(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",a.reduce((e,t)=>e+t.count,0),")"]})]}),(0,n.jsx)(eL,{tools:a})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("button",{onClick:()=>f(e=>!e),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,n.jsx)(N.f,{className:`w-4 h-4 text-muted-foreground transition-transform ${m?"-rotate-90":""}`}),(0,n.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Logs"})]}),!m&&(0,n.jsx)("div",{className:"mt-2 bg-card border border-border rounded-lg p-4 shadow-sm",children:0===i.length?(0,n.jsx)("p",{className:"text-muted-foreground text-center py-8",children:"No entries found."}):(0,n.jsx)(eB,{entries:i,entriesBySource:l,projectName:t,sessionId:s})})]})]})}],36406)},5780,function(e){e.n(e.i(36406))}]);
@@ -1 +1 @@
1
- (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,64237,e=>{var t=e.i(43476),s=e.i(71645),a=e.i(12344),n=e.i(29054);let l=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function i(e){if((0,n.c)(e))return"request timed out. check your network and try again.";let t=e instanceof Error?e.message:String(e);return`network error: ${t}`}e.s(["f",0,function({open:e,headline:r="where to route the reminder?",subhead:o="we'll send a one-time code to confirm.",onClose:c,onAuthed:d,source:u="unknown"}){let{capture:h}=(0,a.usePostHog)(),[m,f]=(0,s.useState)({kind:"email",error:null}),[v,b]=(0,s.useState)(!1),p=(0,s.useRef)(!1),x=(0,s.useRef)(null),j=(0,s.useRef)(null);(0,s.useEffect)(()=>{e&&(f({kind:"email",error:null}),b(!1),p.current=!1,h("audit_auth_dialog_opened",{source:u}))},[h,e,u]);let w=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(e){w.current=!0;return}w.current&&!p.current&&h("audit_auth_dialog_dismissed",{source:u,step:m.kind}),w.current=!1},[h,e,u,m.kind]),(0,s.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{"email"===m.kind?x.current?.focus():"code"===m.kind&&j.current?.focus()},50);return()=>clearTimeout(t)},[e,m.kind]),(0,s.useEffect)(()=>{if(!e)return;let t=e=>{"Escape"!==e.key||v||c()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,v,c]);let g="code"===m.kind&&m.resendIn>0;(0,s.useEffect)(()=>{if(!g)return;let e=setInterval(()=>{f(e=>"code"===e.kind?{...e,resendIn:Math.max(0,e.resendIn-1)}:e)},1e3);return()=>clearInterval(e)},[g]);let y=(0,s.useCallback)(async(e,t={})=>{let{isResend:s=!1}=t,a=e=>{s?f(t=>"code"===t.kind?{...t,error:e}:t):f({kind:"email",error:e})};b(!0);try{let t=await (0,n.q)("/api/auth/login-request",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:e})}),s=await t.json().catch(()=>({}));if(!t.ok){let e=s.message??"could not send code.";"rate_limited"===s.code&&void 0!==s.retry_after_secs?e=`too many tries. wait ${s.retry_after_secs}s and try again.`:"upstream_unreachable"===s.code&&(e="api-server unreachable. check your network."),a(e);return}f({kind:"code",email:e,error:null,expiresIn:s.expires_in??600,resendIn:s.resend_available_in??30})}catch(e){a(i(e))}finally{b(!1)}},[]),k=(0,s.useCallback)(async(e,t)=>{b(!0);try{let s=await (0,n.q)("/api/auth/login-verify",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:e,code:t})}),a=await s.json().catch(()=>({}));if(!s.ok||!a.authenticated||!a.user){let e=a.message??"invalid code.";"invalid_code"===a.code&&(e="wrong code, or it expired. try again."),f(t=>"code"===t.kind?{...t,error:e}:t);return}p.current=!0,h("audit_auth_dialog_succeeded",{source:u}),f({kind:"done",user:a.user}),d(a.user)}catch(t){let e=i(t);f(t=>"code"===t.kind?{...t,error:e}:t)}finally{b(!1)}},[h,d,u]),N=(0,s.useCallback)(async e=>{if(e.preventDefault(),v||"email"!==m.kind)return;let t=String(new FormData(e.currentTarget).get("email")??"").trim().toLowerCase();l.test(t)?await y(t):f({kind:"email",error:"that doesn't look like an email."})},[v,m,y]),C=(0,s.useCallback)(async e=>{if(e.preventDefault(),v||"code"!==m.kind)return;let t=String(new FormData(e.currentTarget).get("code")??"").trim();t.length<4||t.length>12?f(e=>"code"===e.kind?{...e,error:"code is 4–12 characters."}:e):await k(m.email,t)},[v,m,k]),S=(0,s.useCallback)(async()=>{"code"!==m.kind||m.resendIn>0||v||await y(m.email,{isResend:!0})},[m,v,y]);return e?(0,t.jsx)("div",{className:"auth-dialog-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"auth-dialog-title",onClick:e=>{v||e.target!==e.currentTarget||c()},children:(0,t.jsxs)("div",{className:"auth-dialog",children:[(0,t.jsx)("button",{type:"button",className:"auth-close",onClick:c,disabled:v,"aria-label":"close",children:"×"}),(0,t.jsx)("h2",{id:"auth-dialog-title",className:"auth-headline",children:r}),"email"===m.kind&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"auth-sub",children:o}),(0,t.jsxs)("form",{onSubmit:N,className:"auth-form",children:[(0,t.jsx)("input",{ref:x,id:"auth-dialog-email",name:"email",type:"email",autoComplete:"email",inputMode:"email",spellCheck:!1,placeholder:"you@yourdomain.com",disabled:v,className:"auth-input",required:!0}),m.error&&(0,t.jsx)("div",{className:"auth-error",children:m.error}),(0,t.jsxs)("div",{className:"auth-actions",children:[(0,t.jsx)("button",{type:"submit",className:"auth-btn primary",disabled:v,children:v?"sending…":"send code"}),(0,t.jsx)("button",{type:"button",className:"auth-btn",onClick:c,disabled:v,children:"cancel"})]})]})]}),"code"===m.kind&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{className:"auth-sub",children:["code sent to ",(0,t.jsx)("span",{className:"auth-email",children:m.email}),". expires in ",Math.ceil(m.expiresIn/60)," min."]}),(0,t.jsxs)("form",{onSubmit:C,className:"auth-form",children:[(0,t.jsx)("input",{ref:j,id:"auth-dialog-code",name:"code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",spellCheck:!1,placeholder:"123456",disabled:v,className:"auth-input auth-input-code",maxLength:12,required:!0}),m.error&&(0,t.jsx)("div",{className:"auth-error",children:m.error}),(0,t.jsxs)("div",{className:"auth-actions",children:[(0,t.jsx)("button",{type:"submit",className:"auth-btn primary",disabled:v,children:v?"verifying…":"verify"}),(0,t.jsx)("button",{type:"button",className:"auth-btn",onClick:S,disabled:v||m.resendIn>0,children:m.resendIn>0?`resend in ${m.resendIn}s`:"resend code"})]}),(0,t.jsx)("button",{type:"button",className:"auth-back",onClick:()=>f({kind:"email",error:null}),disabled:v,children:"← use a different email"})]})]}),"done"===m.kind&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{className:"auth-sub",children:[(0,t.jsx)("span",{className:"auth-ok",children:"✓"})," signed in as"," ",(0,t.jsx)("span",{className:"auth-email",children:m.user.email}),"."]}),(0,t.jsx)("div",{className:"auth-actions",children:(0,t.jsx)("button",{type:"button",className:"auth-btn primary",onClick:c,children:"continue"})})]})]})}):null}])},86616,e=>{var t=e.i(29054);class s extends Error{kind;constructor(e,t){super(t),this.kind=e,this.name="RerunError"}}async function a(e){try{let a=await (0,t.q)("/api/audit/run",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({cli:e.cli.length>0?e.cli:void 0,since:"all"===e.since?void 0:e.since,noCache:!!e.noCache||void 0})});if(!a.ok&&409!==a.status){let e=await a.text().catch(()=>"");throw console.error("audit run failed:",a.status,e),new s("post_failed",`audit run failed (${a.status})`)}}catch(e){if(e instanceof s)throw e;throw console.error("audit run request failed:",e),new s((0,t.c)(e)?"timeout":"network","audit run request failed")}let a=0;for(;;){await new Promise(e=>setTimeout(e,1e3));let e=null;try{let s=await (0,t.q)("/api/audit/status",{cache:"no-store"});s.ok&&(e=await s.json())}catch{}if(null===e){if(++a>=10)throw new s("network","audit status poll lost the server");continue}if(a=0,!e.running){if(e.error)throw new s("post_failed",e.error);return}}}e.s(["t",0,s,"s",0,a])},2917,e=>{var t=e.i(43476),s=e.i(71645),a=e.i(95187);let n=(0,a.createServerReference)("00c3af59fa8e1de0119bb1fe817668ec06cb8a4605",a.callServer,void 0,a.findSourceMapURL,"getJevSettingsAction"),l=(0,a.createServerReference)("0047fd092a1a052fc7f900a32408f97ba325d79b3f",a.callServer,void 0,a.findSourceMapURL,"removeJevConfigAction"),i=(0,a.createServerReference)("4052842fecf4b148e907bc0c886df80fb39faa6d59",a.callServer,void 0,a.findSourceMapURL,"saveJevConfigAction"),r=(0,a.createServerReference)("40a78d81dd412795d01458823dbb50a655ef8afcee",a.callServer,void 0,a.findSourceMapURL,"setJevModeAction");var o=e.i(55574);let c=[{value:"typesafe",label:"typesafe"},{value:"openrouter",label:"openrouter"},{value:"vercel",label:"vercel ai gateway"},{value:"cloudflare",label:"cloudflare workers ai"},{value:"custom",label:"custom endpoint"}],d=[{value:"enforce",label:"enforce — jev's verdict counts"},{value:"observe",label:"observe — log only, regex decides"},{value:"off",label:"off — keep this config, don't ask jev"}],u="failproofai";function h(e){return{provider:e.provider&&e.provider!==u?e.provider:"typesafe",baseUrl:e.baseUrl,accountId:e.accountId,mode:e.mode}}function m({id:e,label:s,hint:a,children:n}){return(0,t.jsxs)("div",{className:"set-field",children:[(0,t.jsx)("label",{className:"set-field-label",htmlFor:e,children:s}),n,a?(0,t.jsx)("span",{className:"set-hint",children:a}):null]})}e.s(["default",0,function({initial:e}){var a,f,v;let b,[p,x]=(0,s.useState)(e),[j,w]=(0,s.useState)(e?h(e):{provider:"typesafe",baseUrl:"",accountId:"",mode:"enforce"}),[g,y]=(0,s.useState)(""),[k,N]=(0,s.useState)(!1),[C,S]=(0,s.useState)(null),[M,A]=(0,s.useState)(!1),$=(0,s.useRef)(!0),I=(0,s.useRef)(!1),E=(0,s.useCallback)(async()=>{try{let e=await n();if(!$.current)return;x(e),I.current||w(h(e))}catch{}},[]);(0,s.useEffect)(()=>($.current=!0,E(),()=>{$.current=!1}),[E]),(0,s.useEffect)(()=>{let e=()=>void E();return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[E]);let R=(0,s.useCallback)((e,t)=>{I.current=!0,w(s=>({...s,[e]:t}))},[]),_=(0,s.useCallback)(async()=>{N(!0),S(null);try{let e=await i({provider:j.provider,baseUrl:j.baseUrl,accountId:j.accountId,mode:j.mode,token:g});if(!e.ok){S(e.problem),A(!0===e.needsToken);return}I.current=!1,A(!1),y(""),x(e.view),w(h(e.view)),(0,o.toast)(e.view.on?"jev is on.":"saved.")}catch{S("could not save that.")}finally{N(!1)}},[j,g]),F=(0,s.useCallback)(async e=>{N(!0),S(null);try{let t=await r(e);if(!t.ok)return void S(t.problem);I.current=!1,x(t.view),w(h(t.view)),(0,o.toast)("off"===e?"jev is off. hooks run the regex policies.":`jev is on, in ${e} mode.`)}catch{S("could not switch that.")}finally{N(!1)}},[]),D=(0,s.useCallback)(async()=>{N(!0),S(null),A(!1);try{let e=await l();if(!e.ok)return void S(e.problem);I.current=!1,y(""),x(e.view),w(h(e.view)),(0,o.toast)("jev is off. hooks run the regex policies.")}catch{S("could not turn that off.")}finally{N(!1)}},[]),L=null!==p&&"absent"!==p.status,U=p?.provider===u,T=p?.token,q=M?"needed for this save — type the token for this endpoint":T?"cloud"===T.source?"from this machine's FailproofAI Cloud connection":"env"===T.source?"configured, read from the environment — leave blank to keep it":"configured — leave blank to keep it":p?.status==="key-missing"?"read from the environment, which is not set in this shell — leave blank to keep it that way":"sent as a bearer token; stored owner-only at 0600";return(0,t.jsxs)("div",{className:"set-cell set-jev",children:[(0,t.jsx)("h2",{className:"set-cell-title",children:"jev · semantic evaluation"}),(0,t.jsx)("div",{className:"set-row set-row-main",children:(0,t.jsxs)("div",{className:"set-row-copy",children:[(0,t.jsx)("span",{className:p?.on?"set-strong":"set-dim",children:null===p?"reading…":p.on?`on. every judged command is also asked of ${(a=p.provider)===u?"FailproofAI Cloud":a??""}.`:"off"===p.status?"off — switched off. hooks run the regex policies exactly as before.":"not-connected"===p.status?"off — this machine is not connected to FailproofAI Cloud. hooks run the regex policies.":"key-lacks-jev"===p.status?"off — no jev key is stored for this machine's FailproofAI Cloud connection. hooks run the regex policies.":"key-missing"===p.status?"off for this dashboard — FAILPROOFAI_JEV_API_KEY is not set in its environment. hooks run the regex policies wherever it is unset, including under the daemon; a session that sets it still consults jev.":"off. hooks run the regex policies exactly as before."}),(0,t.jsx)("span",{className:"set-dim",children:p?.on?"observe"===p.mode?"observe: jev's answers are logged, the regex result is what gets enforced.":"enforce: jev's answers can clear a reviewable deny.":U?"through FailproofAI Cloud, on your org's plan — no endpoint or token of your own.":"a second opinion on the commands the regex policies flag. needs your own endpoint and token."})]})}),p&&(0,t.jsx)("dl",{className:"set-how-list set-jev-cloud",children:(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:"FailproofAI Cloud connection"}),(0,t.jsx)("dd",{className:"set-how-body",children:function(e){if(!e||!e.connected)return e?.jev==="yes"?"a jev key is stored, but no connection is":"not connected";let t=e.org??e.host??"connected",s="yes"===e.jev?"key carries jev":"refused"===e.jev?"jev key refused — credentials.json is not owner-only":"no jev key stored";return`connected to ${t} \xb7 ${s}`}(p.cloud)})]})}),p&&L&&(0,t.jsxs)("dl",{className:"set-how-list",children:[U&&(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:"provider"}),(0,t.jsx)("dd",{className:"set-how-body",children:p.cloud?.host?`FailproofAI Cloud \xb7 ${p.cloud.host}`:"FailproofAI Cloud"})]}),(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:"model"}),(0,t.jsx)("dd",{className:"set-how-body",children:function(e){switch(e.kind){case"id":return e.id;case"withheld":return"set to something that is not a model id — not shown here, in case it is a key";default:return"the provider's default"}}(p.model)})]}),(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:"token"}),(0,t.jsx)("dd",{className:"set-how-body",children:T?"cloud"===T.source?"FailproofAI Cloud connection":"env"===T.source?"from FAILPROOFAI_JEV_API_KEY":"configured":U?p.cloud?.connected?"none stored for this connection":"none — this machine is not connected":"none stored"})]}),p.reviewable&&(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:"reviewable"}),(0,t.jsx)("dd",{className:"set-how-body",children:p.reviewable.summary})]}),p.stats&&p.stats.total>0&&(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:"fallbacks"}),(0,t.jsx)("dd",{className:"set-how-body",children:`${(f=p.stats.fallbackRate,`${Math.round(100*f)}%`)} of ${p.stats.total} calls in the last ${Number.isInteger(b=(v=p.stats.windowMs)/36e5)&&b>=1?b%24==0?`${b/24}d`:`${b}h`:`${Math.max(1,Math.round(v/6e4))}m`} fell back to the regex engine.`})]})]}),p?.problem&&(0,t.jsxs)("p",{className:"set-warn",children:[p.problem,p.fix?` — ${p.fix}`:""]}),p?.reviewable?.problem&&(0,t.jsx)("p",{className:"set-warn",children:p.reviewable.problem}),(0,t.jsx)("div",{className:"set-rule"}),U?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"set-jev-fields",children:(0,t.jsx)(m,{id:"jev-cloud-mode",label:"mode",hint:"the endpoint and key come from this machine's FailproofAI Cloud connection",children:(0,t.jsx)("select",{id:"jev-cloud-mode",className:"set-select",value:p?.mode==="enforce"?"enforce":"observe",disabled:k||p?.mode==="off",onChange:e=>void F("enforce"===e.target.value?"enforce":"observe"),children:d.filter(e=>"off"!==e.value).map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})})}),C&&(0,t.jsx)("p",{className:"set-warn",children:C}),(0,t.jsx)("div",{className:"set-actions set-jev-actions",children:(0,t.jsx)("button",{type:"button",className:"btn btn-press",disabled:k,onClick:()=>void F(p?.mode==="off"?"observe":"off"),children:k?"[ switching… ]":p?.mode==="off"?"[ turn jev on ]":"[ turn jev off ]"})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"set-jev-fields",children:[(0,t.jsx)(m,{id:"jev-provider",label:"provider",children:(0,t.jsx)("select",{id:"jev-provider",className:"set-select",value:j.provider,disabled:k,onChange:e=>R("provider",e.target.value),children:c.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})}),(0,t.jsx)(m,{id:"jev-url",label:"endpoint url",hint:["custom"===j.provider?"required — https, or http to localhost in observe mode":"leave blank for the provider's own api",p?.baseUrlQueryWithheld?"the stored url's query string is not shown here — leave the url as it is to keep it":null].filter(Boolean).join(" · "),children:(0,t.jsx)("input",{id:"jev-url",type:"text",className:"set-text",inputMode:"url",autoComplete:"off",spellCheck:!1,placeholder:"custom"===j.provider?"https://…":"the provider's own api",value:j.baseUrl,disabled:k,onChange:e=>R("baseUrl",e.target.value)})}),"cloudflare"===j.provider&&(0,t.jsx)(m,{id:"jev-account",label:"account id",hint:"32 lowercase hex characters",children:(0,t.jsx)("input",{id:"jev-account",type:"text",className:"set-text",autoComplete:"off",spellCheck:!1,value:j.accountId,disabled:k,onChange:e=>R("accountId",e.target.value)})}),(0,t.jsx)(m,{id:"jev-token",label:"token",hint:q,children:(0,t.jsx)("input",{id:"jev-token",type:"password",className:"set-text",autoComplete:"off",spellCheck:!1,placeholder:T?"•••• kept":"",value:g,disabled:k,"aria-invalid":M||void 0,onChange:e=>{I.current=!0,y(e.target.value)}})}),(0,t.jsx)(m,{id:"jev-mode",label:"mode",children:(0,t.jsx)("select",{id:"jev-mode",className:"set-select",value:j.mode,disabled:k,onChange:e=>R("mode",e.target.value),children:d.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})})]}),C&&(0,t.jsx)("p",{className:"set-warn",children:C}),(0,t.jsxs)("div",{className:"set-actions set-jev-actions",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-press",disabled:k,onClick:()=>void _(),children:k?"[ saving… ]":L?"[ save changes ]":"[ turn jev on ]"}),L&&(0,t.jsx)("button",{type:"button",className:"set-link",disabled:k,onClick:()=>void D(),children:"turn jev off"})]})]})]})}],2917)},93237,e=>{var t=e.i(43476),s=e.i(71645),a=e.i(95187);let n=(0,a.createServerReference)("008e87611efa13718fd2b3c4e455420e3ff3a55897",a.callServer,void 0,a.findSourceMapURL,"getScheduledAuditAction"),l=(0,a.createServerReference)("400881c58a356997ca19d266ede6ccdfe5e61e3efd",a.callServer,void 0,a.findSourceMapURL,"setAutoAuditAction"),i=(0,a.createServerReference)("40a0c205fbe91869dd881be2c2fc2dca7c7d48f1d2",a.callServer,void 0,a.findSourceMapURL,"setAuditIntervalAction");var r=e.i(86616),o=e.i(64237),c=e.i(55574),d=e.i(34713);function u(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function h(e,t){let s=e-t;if(s<=0)return"now";let a=Math.floor(s/864e5),n=Math.floor(s%864e5/36e5);return a>0?n>0?`${a}d ${n}h`:`${a}d`:n>0?`${n}h`:`${Math.max(1,Math.floor(s/6e4))}m`}function m(e){return e.toLocaleString("en-US")}function f({label:e,value:s,sub:a,tone:n}){return(0,t.jsxs)("div",{className:"set-stat",children:[(0,t.jsx)("div",{className:"set-stat-label",children:e}),(0,t.jsx)("div",{className:`set-stat-value${n?` ${n}`:""}`,children:s}),(0,t.jsx)("div",{className:"set-stat-sub",children:a??" "})]})}function v({lastRunAtMs:e,nextDueAtMs:s,now:a}){if(null==e||null==s||s<=e)return null;let n=Math.min(100,Math.max(0,(a-e)/(s-e)*100));return(0,t.jsxs)("div",{className:"tape","aria-hidden":"true",children:[(0,t.jsxs)("div",{className:"tape-rail",children:[(0,t.jsx)("div",{className:"tape-fill",style:{width:`${n}%`}}),(0,t.jsx)("div",{className:"tape-now",style:{left:`${n}%`}})]}),(0,t.jsxs)("div",{className:"tape-ends",children:[(0,t.jsxs)("span",{children:["last scan · ",u(e)]}),(0,t.jsxs)("span",{className:"tape-next",children:["next · ",h(s,a)]})]})]})}function b({enabled:e,onChange:s,disabled:a,label:n}){return(0,t.jsx)("button",{type:"button",role:"switch","aria-checked":e,"aria-label":n,disabled:a,onClick:s,className:"sw","data-on":e?"true":"false",children:(0,t.jsx)("span",{className:"sw-knob"})})}let p=[{label:"reads",body:"every session transcript on disk — your prompts, the files your agents read and wrote, and command output."},{label:"runs",body:"entirely on this machine. the transcripts never leave it."},{label:"sends",body:"counts, redacted examples, and this machine's name — and only when a scan finds something harmful."}];e.s(["default",0,function({initial:e,jevPanel:a}){let[x,j]=(0,s.useState)(e),[w,g]=(0,s.useState)(e?.auto??!1),[y,k]=(0,s.useState)(e?.intervalDays??7),[N,C]=(0,s.useState)(!1),[S,M]=(0,s.useState)(!1),[A,$]=(0,s.useState)(!1),[I,E]=(0,s.useState)(null===e),[R,_]=(0,s.useState)(0),F=(0,s.useRef)(!0),D=(0,s.useRef)(null!==e),L=(0,s.useCallback)(async()=>{try{let e=await n();if(!F.current)return;j(e),D.current=!0,g(e.auto),k(e.intervalDays),_(Date.now()),E(!1)}catch{F.current&&!D.current&&E(!0)}},[]);(0,s.useEffect)(()=>(F.current=!0,L(),()=>{F.current=!1}),[L]),(0,s.useEffect)(()=>{let e=()=>void L();return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[L]);let U=x?.signedInAs??null,T=x?.daemon==="running",q=x?.daemon==="unsupported-platform",O=x?.schedule??null,P=x?.lastScan??null,J=O?.lastExitCode!=null&&0!==O.lastExitCode&&75!==O.lastExitCode,B=(0,s.useCallback)(async()=>{C(!0);try{let e=await l(!0);if(!e.ok){if(g(!1),"unreachable"===e.reason)return void(0,c.toast)("could not reach the server. check your connection and try again.");await L(),$(!0),(0,c.toast)("that sign-in expired. one more code and it's on.");return}g(e.auto),(0,c.toast)("scheduled audits on."),await L()}catch{g(!1),(0,c.toast)("could not turn that on.")}finally{C(!1)}},[L]),K=(0,s.useCallback)(async()=>{if(w){C(!0);try{let e=await l(!1);e.ok&&g(e.auto),(0,c.toast)("scheduled audits off."),await L()}catch{(0,c.toast)("could not turn that off.")}finally{C(!1)}return}U?await B():$(!0)},[w,B,L,U]),V=(0,s.useCallback)(async e=>{C(!0);try{let t=await i(e);k(t.intervalDays),j(e=>e?{...e,intervalDays:t.intervalDays}:e),(0,c.toast)(`scanning every ${t.intervalDays} day${1===t.intervalDays?"":"s"}.`)}catch{k(x?.intervalDays??7),(0,c.toast)("could not save that.")}finally{C(!1)}},[x?.intervalDays]),Y=(0,s.useCallback)(async()=>{C(!0);try{await fetch("/api/auth/logout",{method:"POST"}),(0,c.toast)("signed out. scans continue; digests pause."),await L()}catch{(0,c.toast)("could not sign out.")}finally{C(!1)}},[L]),H=(0,s.useCallback)(async()=>{if(!S){M(!0);try{await (0,r.s)({cli:[],since:"all",noCache:!1}),(0,c.toast)("scan complete."),await L()}catch(e){(0,c.toast)(e instanceof r.t&&"timeout"===e.kind?"the scan is taking a while — it will finish in the background.":"the scan could not be completed.")}finally{M(!1)}}},[L,S]),Q=(0,s.useCallback)(async e=>{$(!1),await L(),await B()},[B,L]),W=x?T?{value:"running",sub:null!=x.daemonStartedAtMs&&R>0?`up ${function(e){let t=Math.floor(e/864e5);if(t>0)return`${t}d`;let s=Math.floor(e/36e5);return s>0?`${s}h`:`${Math.max(1,Math.floor(e/6e4))}m`}(Math.max(0,R-x.daemonStartedAtMs))}`:"",tone:"ok"}:q?{value:"unavailable",sub:"not on this platform"}:"not-installed"===x.daemon?{value:"not installed",sub:"run failproofai config",tone:"warn"}:"unknown"===x.daemon?{value:"unknown",sub:"could not read it"}:{value:"stopped",sub:"run failproofai config",tone:"warn"}:{value:"…",sub:"reading"},z=w?O?.nextDueAtMs==null?{value:"pending",sub:"after the next scan"}:{value:R>0?h(O.nextDueAtMs,R):"—",sub:u(O.nextDueAtMs)}:{value:"off",sub:"nothing scheduled"},G=P?{value:(0,d.g)(Date.parse(P.finishedAt)),sub:null!=P.sessionsScanned?`${m(P.sessionsScanned)} sessions`:"scanned"}:{value:"none yet",sub:"run one below"},X=P?null==P.findings?{value:"—",sub:"unreadable"}:{value:m(P.findings),sub:"this scan",...P.findings>0?{tone:"warn"}:{}}:{value:"—",sub:"no scan yet"};return(0,t.jsxs)("main",{className:"report",children:[(0,t.jsxs)("section",{className:"section set-sec",children:[(0,t.jsxs)("div",{className:"set-mast",children:[(0,t.jsx)("h1",{className:"set-title",children:"settings"}),(0,t.jsx)("p",{className:"set-lede",children:"keeping watch, so you don't have to."})]}),I?(0,t.jsxs)("div",{className:"set-console",children:[(0,t.jsx)("div",{className:"set-cell",children:(0,t.jsxs)("p",{className:"set-warn",children:["could not read this machine's settings. check that the dashboard can reach ",(0,t.jsx)("code",{children:"~/.failproofai/config.json"}),"."]})}),a]}):(0,t.jsxs)("div",{className:"set-console",children:[(0,t.jsxs)("div",{className:"set-stats",children:[(0,t.jsx)(f,{label:"daemon",...W}),(0,t.jsx)(f,{label:"next scan",...z}),(0,t.jsx)(f,{label:"last scan",...G}),(0,t.jsx)(f,{label:"findings",...X})]}),(0,t.jsxs)("div",{className:"set-cols",children:[(0,t.jsxs)("div",{className:"set-cell set-config",children:[(0,t.jsx)("h2",{className:"set-cell-title",children:"scheduled audit"}),(0,t.jsxs)("div",{className:"set-row set-row-main",children:[(0,t.jsx)(b,{enabled:w,disabled:N||null===x,onChange:()=>void K(),label:w?"turn off scheduled audits":"turn on scheduled audits"}),(0,t.jsxs)("div",{className:"set-row-copy",children:[(0,t.jsx)("span",{className:"set-strong",children:w?"scanning on a schedule.":"scan on a schedule."}),(0,t.jsx)("span",{className:"set-dim",children:w?"you'll get an email only when a scan finds something.":"off. nothing runs and nothing is sent."})]})]}),(0,t.jsxs)("div",{className:"set-row set-row-interval",children:[(0,t.jsx)("span",{className:"set-dim",children:"scan every"}),(0,t.jsx)("input",{type:"number",className:"set-num",min:1,max:90,value:y,disabled:N||null===x,"aria-label":"days between scheduled scans",onChange:e=>k(Number(e.target.value)),onBlur:e=>{let t=Number(e.target.value);Number.isFinite(t)?t!==x?.intervalDays&&V(t):k(x?.intervalDays??7)}}),(0,t.jsx)("span",{className:"set-dim",children:"days"}),(0,t.jsxs)("span",{className:"set-hint",children:[1,"–",90]})]}),(0,t.jsx)("div",{className:"set-rule"}),(0,t.jsx)("div",{className:"set-row set-row-identity",children:U?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"set-dim",children:"reports go to"}),(0,t.jsx)("span",{className:"set-email",children:U.email}),(0,t.jsx)("button",{type:"button",className:"set-link",disabled:N,onClick:()=>void Y(),children:"sign out"})]}):w?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"set-warn",children:"signed out — scans continue, digests are paused."}),(0,t.jsx)("button",{type:"button",className:"set-link",disabled:N,onClick:()=>$(!0),children:"sign in to resume"})]}):(0,t.jsx)("span",{className:"set-dim",children:"turning this on asks for an email, so there is somewhere to send the report."})}),w&&x&&!T&&(0,t.jsx)("p",{className:"set-warn",children:q?"the background service isn't available on this platform, so scheduled scans can't run here. you can still run one now.":"not-installed"===x.daemon?"the background service isn't installed, so nothing will run on the timer. install it with `failproofai config`.":"the background service is stopped, so nothing will run until it starts. repair it with `failproofai config`."}),J&&(0,t.jsxs)("p",{className:"set-warn",children:["the last scheduled scan exited ",O?.lastExitCode,". the next one will still run."]}),(0,t.jsx)("div",{className:"set-actions",children:(0,t.jsx)("button",{type:"button",className:"btn btn-press",disabled:S,onClick:()=>void H(),children:S?"[ scanning… ]":"[ run a scan now ]"})})]}),(0,t.jsxs)("div",{className:"set-cell set-how",children:[(0,t.jsx)("h2",{className:"set-cell-title",children:"how it works"}),(0,t.jsx)("dl",{className:"set-how-list",children:p.map(e=>(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:e.label}),(0,t.jsx)("dd",{className:"set-how-body",children:e.body})]},e.label))})]})]}),a]}),w&&R>0&&(0,t.jsx)(v,{lastRunAtMs:O?.lastRunAtMs??null,nextDueAtMs:O?.nextDueAtMs??null,now:R})]}),(0,t.jsx)(o.f,{open:A,source:"settings_scheduled_audit",headline:"where should the report go?",subhead:"we'll send a one-time code to confirm.",onClose:()=>$(!1),onAuthed:e=>void Q(e)})]})}],93237)},29054,e=>{e.s(["q",0,function(e,t={},s=15e3){let a=AbortSignal.timeout(s),n=t.signal?AbortSignal.any([t.signal,a]):a;return fetch(e,{...t,signal:n})},"c",0,function(e){if(null===e||"object"!=typeof e)return!1;let t=e.name;return"AbortError"===t||"TimeoutError"===t}])},34713,e=>{e.s(["M",0,function(e){if(e<1e3)return`${e}ms`;let t=Math.round(e/100);if(t<600)return`${(t/10).toFixed(1)}s`;let s=Math.round(e/1e3);if(s<3600){let e=Math.floor(s/60);return`${e}m ${s%60}s`}let a=Math.round(e/6e4),n=Math.floor(a/60);return`${n}h ${a%60}m`},"g",0,function(e){let t=Date.now()-e;return t<6e4?`${Math.max(1,Math.floor(t/1e3))}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}])}])})();
1
+ (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,64237,e=>{var t=e.i(43476),s=e.i(71645),a=e.i(12344),n=e.i(29054);let l=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function i(e){if((0,n.c)(e))return"request timed out. check your network and try again.";let t=e instanceof Error?e.message:String(e);return`network error: ${t}`}e.s(["f",0,function({open:e,headline:r="where to route the reminder?",subhead:o="we'll send a one-time code to confirm.",onClose:c,onAuthed:d,source:u="unknown"}){let{capture:h}=(0,a.usePostHog)(),[m,f]=(0,s.useState)({kind:"email",error:null}),[v,b]=(0,s.useState)(!1),p=(0,s.useRef)(!1),x=(0,s.useRef)(null),j=(0,s.useRef)(null);(0,s.useEffect)(()=>{e&&(f({kind:"email",error:null}),b(!1),p.current=!1,h("audit_auth_dialog_opened",{source:u}))},[h,e,u]);let w=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(e){w.current=!0;return}w.current&&!p.current&&h("audit_auth_dialog_dismissed",{source:u,step:m.kind}),w.current=!1},[h,e,u,m.kind]),(0,s.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{"email"===m.kind?x.current?.focus():"code"===m.kind&&j.current?.focus()},50);return()=>clearTimeout(t)},[e,m.kind]),(0,s.useEffect)(()=>{if(!e)return;let t=e=>{"Escape"!==e.key||v||c()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,v,c]);let g="code"===m.kind&&m.resendIn>0;(0,s.useEffect)(()=>{if(!g)return;let e=setInterval(()=>{f(e=>"code"===e.kind?{...e,resendIn:Math.max(0,e.resendIn-1)}:e)},1e3);return()=>clearInterval(e)},[g]);let y=(0,s.useCallback)(async(e,t={})=>{let{isResend:s=!1}=t,a=e=>{s?f(t=>"code"===t.kind?{...t,error:e}:t):f({kind:"email",error:e})};b(!0);try{let t=await (0,n.q)("/api/auth/login-request",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:e})}),s=await t.json().catch(()=>({}));if(!t.ok){let e=s.message??"could not send code.";"rate_limited"===s.code&&void 0!==s.retry_after_secs?e=`too many tries. wait ${s.retry_after_secs}s and try again.`:"upstream_unreachable"===s.code&&(e="api-server unreachable. check your network."),a(e);return}f({kind:"code",email:e,error:null,expiresIn:s.expires_in??600,resendIn:s.resend_available_in??30})}catch(e){a(i(e))}finally{b(!1)}},[]),k=(0,s.useCallback)(async(e,t)=>{b(!0);try{let s=await (0,n.q)("/api/auth/login-verify",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:e,code:t})}),a=await s.json().catch(()=>({}));if(!s.ok||!a.authenticated||!a.user){let e=a.message??"invalid code.";"invalid_code"===a.code&&(e="wrong code, or it expired. try again."),f(t=>"code"===t.kind?{...t,error:e}:t);return}p.current=!0,h("audit_auth_dialog_succeeded",{source:u}),f({kind:"done",user:a.user}),d(a.user)}catch(t){let e=i(t);f(t=>"code"===t.kind?{...t,error:e}:t)}finally{b(!1)}},[h,d,u]),N=(0,s.useCallback)(async e=>{if(e.preventDefault(),v||"email"!==m.kind)return;let t=String(new FormData(e.currentTarget).get("email")??"").trim().toLowerCase();l.test(t)?await y(t):f({kind:"email",error:"that doesn't look like an email."})},[v,m,y]),C=(0,s.useCallback)(async e=>{if(e.preventDefault(),v||"code"!==m.kind)return;let t=String(new FormData(e.currentTarget).get("code")??"").trim();t.length<4||t.length>12?f(e=>"code"===e.kind?{...e,error:"code is 4–12 characters."}:e):await k(m.email,t)},[v,m,k]),S=(0,s.useCallback)(async()=>{"code"!==m.kind||m.resendIn>0||v||await y(m.email,{isResend:!0})},[m,v,y]);return e?(0,t.jsx)("div",{className:"auth-dialog-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"auth-dialog-title",onClick:e=>{v||e.target!==e.currentTarget||c()},children:(0,t.jsxs)("div",{className:"auth-dialog",children:[(0,t.jsx)("button",{type:"button",className:"auth-close",onClick:c,disabled:v,"aria-label":"close",children:"×"}),(0,t.jsx)("h2",{id:"auth-dialog-title",className:"auth-headline",children:r}),"email"===m.kind&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"auth-sub",children:o}),(0,t.jsxs)("form",{onSubmit:N,className:"auth-form",children:[(0,t.jsx)("input",{ref:x,id:"auth-dialog-email",name:"email",type:"email",autoComplete:"email",inputMode:"email",spellCheck:!1,placeholder:"you@yourdomain.com",disabled:v,className:"auth-input",required:!0}),m.error&&(0,t.jsx)("div",{className:"auth-error",children:m.error}),(0,t.jsxs)("div",{className:"auth-actions",children:[(0,t.jsx)("button",{type:"submit",className:"auth-btn primary",disabled:v,children:v?"sending…":"send code"}),(0,t.jsx)("button",{type:"button",className:"auth-btn",onClick:c,disabled:v,children:"cancel"})]})]})]}),"code"===m.kind&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{className:"auth-sub",children:["code sent to ",(0,t.jsx)("span",{className:"auth-email",children:m.email}),". expires in ",Math.ceil(m.expiresIn/60)," min."]}),(0,t.jsxs)("form",{onSubmit:C,className:"auth-form",children:[(0,t.jsx)("input",{ref:j,id:"auth-dialog-code",name:"code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",spellCheck:!1,placeholder:"123456",disabled:v,className:"auth-input auth-input-code",maxLength:12,required:!0}),m.error&&(0,t.jsx)("div",{className:"auth-error",children:m.error}),(0,t.jsxs)("div",{className:"auth-actions",children:[(0,t.jsx)("button",{type:"submit",className:"auth-btn primary",disabled:v,children:v?"verifying…":"verify"}),(0,t.jsx)("button",{type:"button",className:"auth-btn",onClick:S,disabled:v||m.resendIn>0,children:m.resendIn>0?`resend in ${m.resendIn}s`:"resend code"})]}),(0,t.jsx)("button",{type:"button",className:"auth-back",onClick:()=>f({kind:"email",error:null}),disabled:v,children:"← use a different email"})]})]}),"done"===m.kind&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{className:"auth-sub",children:[(0,t.jsx)("span",{className:"auth-ok",children:"✓"})," signed in as"," ",(0,t.jsx)("span",{className:"auth-email",children:m.user.email}),"."]}),(0,t.jsx)("div",{className:"auth-actions",children:(0,t.jsx)("button",{type:"button",className:"auth-btn primary",onClick:c,children:"continue"})})]})]})}):null}])},86616,e=>{var t=e.i(29054);class s extends Error{kind;constructor(e,t){super(t),this.kind=e,this.name="RerunError"}}async function a(e){try{let a=await (0,t.q)("/api/audit/run",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({cli:e.cli.length>0?e.cli:void 0,since:"all"===e.since?void 0:e.since,noCache:!!e.noCache||void 0})});if(!a.ok&&409!==a.status){let e=await a.text().catch(()=>"");throw console.error("audit run failed:",a.status,e),new s("post_failed",`audit run failed (${a.status})`)}}catch(e){if(e instanceof s)throw e;throw console.error("audit run request failed:",e),new s((0,t.c)(e)?"timeout":"network","audit run request failed")}let a=0;for(;;){await new Promise(e=>setTimeout(e,1e3));let e=null;try{let s=await (0,t.q)("/api/audit/status",{cache:"no-store"});s.ok&&(e=await s.json())}catch{}if(null===e){if(++a>=10)throw new s("network","audit status poll lost the server");continue}if(a=0,!e.running){if(e.error)throw new s("post_failed",e.error);return}}}e.s(["t",0,s,"s",0,a])},2917,e=>{var t=e.i(43476),s=e.i(71645),a=e.i(95187);let n=(0,a.createServerReference)("004891b2f0596515ce7b80c59e2926bd60c96e7b55",a.callServer,void 0,a.findSourceMapURL,"getJevSettingsAction"),l=(0,a.createServerReference)("006b2b51e8b1612b80ea38c29161a9c2222486a210",a.callServer,void 0,a.findSourceMapURL,"removeJevConfigAction"),i=(0,a.createServerReference)("40489ad2dc9b21cb8a87ae664fb1eb7c69714d04d2",a.callServer,void 0,a.findSourceMapURL,"saveJevConfigAction"),r=(0,a.createServerReference)("4023db6878495a79ce86f77709a9932cc723cb7b29",a.callServer,void 0,a.findSourceMapURL,"setJevModeAction");var o=e.i(55574);let c=[{value:"typesafe",label:"typesafe"},{value:"openrouter",label:"openrouter"},{value:"vercel",label:"vercel ai gateway"},{value:"cloudflare",label:"cloudflare workers ai"},{value:"custom",label:"custom endpoint"}],d=[{value:"enforce",label:"enforce — jev's verdict counts"},{value:"observe",label:"observe — log only, regex decides"},{value:"off",label:"off — keep this config, don't ask jev"}],u="failproofai";function h(e){return{provider:e.provider&&e.provider!==u?e.provider:"typesafe",baseUrl:e.baseUrl,accountId:e.accountId,mode:e.mode}}function m({id:e,label:s,hint:a,children:n}){return(0,t.jsxs)("div",{className:"set-field",children:[(0,t.jsx)("label",{className:"set-field-label",htmlFor:e,children:s}),n,a?(0,t.jsx)("span",{className:"set-hint",children:a}):null]})}e.s(["default",0,function({initial:e}){var a,f,v;let b,[p,x]=(0,s.useState)(e),[j,w]=(0,s.useState)(e?h(e):{provider:"typesafe",baseUrl:"",accountId:"",mode:"enforce"}),[g,y]=(0,s.useState)(""),[k,N]=(0,s.useState)(!1),[C,S]=(0,s.useState)(null),[M,A]=(0,s.useState)(!1),$=(0,s.useRef)(!0),I=(0,s.useRef)(!1),E=(0,s.useCallback)(async()=>{try{let e=await n();if(!$.current)return;x(e),I.current||w(h(e))}catch{}},[]);(0,s.useEffect)(()=>($.current=!0,E(),()=>{$.current=!1}),[E]),(0,s.useEffect)(()=>{let e=()=>void E();return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[E]);let R=(0,s.useCallback)((e,t)=>{I.current=!0,w(s=>({...s,[e]:t}))},[]),_=(0,s.useCallback)(async()=>{N(!0),S(null);try{let e=await i({provider:j.provider,baseUrl:j.baseUrl,accountId:j.accountId,mode:j.mode,token:g});if(!e.ok){S(e.problem),A(!0===e.needsToken);return}I.current=!1,A(!1),y(""),x(e.view),w(h(e.view)),(0,o.toast)(e.view.on?"jev is on.":"saved.")}catch{S("could not save that.")}finally{N(!1)}},[j,g]),F=(0,s.useCallback)(async e=>{N(!0),S(null);try{let t=await r(e);if(!t.ok)return void S(t.problem);I.current=!1,x(t.view),w(h(t.view)),(0,o.toast)("off"===e?"jev is off. hooks run the regex policies.":`jev is on, in ${e} mode.`)}catch{S("could not switch that.")}finally{N(!1)}},[]),D=(0,s.useCallback)(async()=>{N(!0),S(null),A(!1);try{let e=await l();if(!e.ok)return void S(e.problem);I.current=!1,y(""),x(e.view),w(h(e.view)),(0,o.toast)("jev is off. hooks run the regex policies.")}catch{S("could not turn that off.")}finally{N(!1)}},[]),L=null!==p&&"absent"!==p.status,U=p?.provider===u,T=p?.token,q=M?"needed for this save — type the token for this endpoint":T?"cloud"===T.source?"from this machine's FailproofAI Cloud connection":"env"===T.source?"configured, read from the environment — leave blank to keep it":"configured — leave blank to keep it":p?.status==="key-missing"?"read from the environment, which is not set in this shell — leave blank to keep it that way":"sent as a bearer token; stored owner-only at 0600";return(0,t.jsxs)("div",{className:"set-cell set-jev",children:[(0,t.jsx)("h2",{className:"set-cell-title",children:"jev · semantic evaluation"}),(0,t.jsx)("div",{className:"set-row set-row-main",children:(0,t.jsxs)("div",{className:"set-row-copy",children:[(0,t.jsx)("span",{className:p?.on?"set-strong":"set-dim",children:null===p?"reading…":p.on?`on. every judged command is also asked of ${(a=p.provider)===u?"FailproofAI Cloud":a??""}.`:"off"===p.status?"off — switched off. hooks run the regex policies exactly as before.":"not-connected"===p.status?"off — this machine is not connected to FailproofAI Cloud. hooks run the regex policies.":"key-lacks-jev"===p.status?"off — no jev key is stored for this machine's FailproofAI Cloud connection. hooks run the regex policies.":"key-missing"===p.status?"off for this dashboard — FAILPROOFAI_JEV_API_KEY is not set in its environment. hooks run the regex policies wherever it is unset, including under the daemon; a session that sets it still consults jev.":"off. hooks run the regex policies exactly as before."}),(0,t.jsx)("span",{className:"set-dim",children:p?.on?"observe"===p.mode?"observe: jev's answers are logged, the regex result is what gets enforced.":"enforce: jev's answers can clear a reviewable deny.":U?"through FailproofAI Cloud, on your org's plan — no endpoint or token of your own.":"a second opinion on the commands the regex policies flag. needs your own endpoint and token."})]})}),p&&(0,t.jsx)("dl",{className:"set-how-list set-jev-cloud",children:(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:"FailproofAI Cloud connection"}),(0,t.jsx)("dd",{className:"set-how-body",children:function(e){if(!e||!e.connected)return e?.jev==="yes"?"a jev key is stored, but no connection is":"not connected";let t=e.org??e.host??"connected",s="yes"===e.jev?"key carries jev":"refused"===e.jev?"jev key refused — credentials.json is not owner-only":"no jev key stored";return`connected to ${t} \xb7 ${s}`}(p.cloud)})]})}),p&&L&&(0,t.jsxs)("dl",{className:"set-how-list",children:[U&&(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:"provider"}),(0,t.jsx)("dd",{className:"set-how-body",children:p.cloud?.host?`FailproofAI Cloud \xb7 ${p.cloud.host}`:"FailproofAI Cloud"})]}),(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:"model"}),(0,t.jsx)("dd",{className:"set-how-body",children:function(e){switch(e.kind){case"id":return e.id;case"withheld":return"set to something that is not a model id — not shown here, in case it is a key";default:return"the provider's default"}}(p.model)})]}),(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:"token"}),(0,t.jsx)("dd",{className:"set-how-body",children:T?"cloud"===T.source?"FailproofAI Cloud connection":"env"===T.source?"from FAILPROOFAI_JEV_API_KEY":"configured":U?p.cloud?.connected?"none stored for this connection":"none — this machine is not connected":"none stored"})]}),p.reviewable&&(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:"reviewable"}),(0,t.jsx)("dd",{className:"set-how-body",children:p.reviewable.summary})]}),p.stats&&p.stats.total>0&&(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:"fallbacks"}),(0,t.jsx)("dd",{className:"set-how-body",children:`${(f=p.stats.fallbackRate,`${Math.round(100*f)}%`)} of ${p.stats.total} calls in the last ${Number.isInteger(b=(v=p.stats.windowMs)/36e5)&&b>=1?b%24==0?`${b/24}d`:`${b}h`:`${Math.max(1,Math.round(v/6e4))}m`} fell back to the regex engine.`})]})]}),p?.problem&&(0,t.jsxs)("p",{className:"set-warn",children:[p.problem,p.fix?` — ${p.fix}`:""]}),p?.reviewable?.problem&&(0,t.jsx)("p",{className:"set-warn",children:p.reviewable.problem}),(0,t.jsx)("div",{className:"set-rule"}),U?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"set-jev-fields",children:(0,t.jsx)(m,{id:"jev-cloud-mode",label:"mode",hint:"the endpoint and key come from this machine's FailproofAI Cloud connection",children:(0,t.jsx)("select",{id:"jev-cloud-mode",className:"set-select",value:p?.mode==="enforce"?"enforce":"observe",disabled:k||p?.mode==="off",onChange:e=>void F("enforce"===e.target.value?"enforce":"observe"),children:d.filter(e=>"off"!==e.value).map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})})}),C&&(0,t.jsx)("p",{className:"set-warn",children:C}),(0,t.jsx)("div",{className:"set-actions set-jev-actions",children:(0,t.jsx)("button",{type:"button",className:"btn btn-press",disabled:k,onClick:()=>void F(p?.mode==="off"?"observe":"off"),children:k?"[ switching… ]":p?.mode==="off"?"[ turn jev on ]":"[ turn jev off ]"})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"set-jev-fields",children:[(0,t.jsx)(m,{id:"jev-provider",label:"provider",children:(0,t.jsx)("select",{id:"jev-provider",className:"set-select",value:j.provider,disabled:k,onChange:e=>R("provider",e.target.value),children:c.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})}),(0,t.jsx)(m,{id:"jev-url",label:"endpoint url",hint:["custom"===j.provider?"required — https, or http to localhost in observe mode":"leave blank for the provider's own api",p?.baseUrlQueryWithheld?"the stored url's query string is not shown here — leave the url as it is to keep it":null].filter(Boolean).join(" · "),children:(0,t.jsx)("input",{id:"jev-url",type:"text",className:"set-text",inputMode:"url",autoComplete:"off",spellCheck:!1,placeholder:"custom"===j.provider?"https://…":"the provider's own api",value:j.baseUrl,disabled:k,onChange:e=>R("baseUrl",e.target.value)})}),"cloudflare"===j.provider&&(0,t.jsx)(m,{id:"jev-account",label:"account id",hint:"32 lowercase hex characters",children:(0,t.jsx)("input",{id:"jev-account",type:"text",className:"set-text",autoComplete:"off",spellCheck:!1,value:j.accountId,disabled:k,onChange:e=>R("accountId",e.target.value)})}),(0,t.jsx)(m,{id:"jev-token",label:"token",hint:q,children:(0,t.jsx)("input",{id:"jev-token",type:"password",className:"set-text",autoComplete:"off",spellCheck:!1,placeholder:T?"•••• kept":"",value:g,disabled:k,"aria-invalid":M||void 0,onChange:e=>{I.current=!0,y(e.target.value)}})}),(0,t.jsx)(m,{id:"jev-mode",label:"mode",children:(0,t.jsx)("select",{id:"jev-mode",className:"set-select",value:j.mode,disabled:k,onChange:e=>R("mode",e.target.value),children:d.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})})]}),C&&(0,t.jsx)("p",{className:"set-warn",children:C}),(0,t.jsxs)("div",{className:"set-actions set-jev-actions",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-press",disabled:k,onClick:()=>void _(),children:k?"[ saving… ]":L?"[ save changes ]":"[ turn jev on ]"}),L&&(0,t.jsx)("button",{type:"button",className:"set-link",disabled:k,onClick:()=>void D(),children:"turn jev off"})]})]})]})}],2917)},93237,e=>{var t=e.i(43476),s=e.i(71645),a=e.i(95187);let n=(0,a.createServerReference)("000c4fd5e37e67898d3e6d840cb11d15bb0074cea6",a.callServer,void 0,a.findSourceMapURL,"getScheduledAuditAction"),l=(0,a.createServerReference)("40b064cfa0a455852f5df3f016eb29f241938f2d26",a.callServer,void 0,a.findSourceMapURL,"setAutoAuditAction"),i=(0,a.createServerReference)("40b82f04ec309b9f383e9a7d8382f4d2959f3eb12d",a.callServer,void 0,a.findSourceMapURL,"setAuditIntervalAction");var r=e.i(86616),o=e.i(64237),c=e.i(55574),d=e.i(34713);function u(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function h(e,t){let s=e-t;if(s<=0)return"now";let a=Math.floor(s/864e5),n=Math.floor(s%864e5/36e5);return a>0?n>0?`${a}d ${n}h`:`${a}d`:n>0?`${n}h`:`${Math.max(1,Math.floor(s/6e4))}m`}function m(e){return e.toLocaleString("en-US")}function f({label:e,value:s,sub:a,tone:n}){return(0,t.jsxs)("div",{className:"set-stat",children:[(0,t.jsx)("div",{className:"set-stat-label",children:e}),(0,t.jsx)("div",{className:`set-stat-value${n?` ${n}`:""}`,children:s}),(0,t.jsx)("div",{className:"set-stat-sub",children:a??" "})]})}function v({lastRunAtMs:e,nextDueAtMs:s,now:a}){if(null==e||null==s||s<=e)return null;let n=Math.min(100,Math.max(0,(a-e)/(s-e)*100));return(0,t.jsxs)("div",{className:"tape","aria-hidden":"true",children:[(0,t.jsxs)("div",{className:"tape-rail",children:[(0,t.jsx)("div",{className:"tape-fill",style:{width:`${n}%`}}),(0,t.jsx)("div",{className:"tape-now",style:{left:`${n}%`}})]}),(0,t.jsxs)("div",{className:"tape-ends",children:[(0,t.jsxs)("span",{children:["last scan · ",u(e)]}),(0,t.jsxs)("span",{className:"tape-next",children:["next · ",h(s,a)]})]})]})}function b({enabled:e,onChange:s,disabled:a,label:n}){return(0,t.jsx)("button",{type:"button",role:"switch","aria-checked":e,"aria-label":n,disabled:a,onClick:s,className:"sw","data-on":e?"true":"false",children:(0,t.jsx)("span",{className:"sw-knob"})})}let p=[{label:"reads",body:"every session transcript on disk — your prompts, the files your agents read and wrote, and command output."},{label:"runs",body:"entirely on this machine. the transcripts never leave it."},{label:"sends",body:"counts, redacted examples, and this machine's name — and only when a scan finds something harmful."}];e.s(["default",0,function({initial:e,jevPanel:a}){let[x,j]=(0,s.useState)(e),[w,g]=(0,s.useState)(e?.auto??!1),[y,k]=(0,s.useState)(e?.intervalDays??7),[N,C]=(0,s.useState)(!1),[S,M]=(0,s.useState)(!1),[A,$]=(0,s.useState)(!1),[I,E]=(0,s.useState)(null===e),[R,_]=(0,s.useState)(0),F=(0,s.useRef)(!0),D=(0,s.useRef)(null!==e),L=(0,s.useCallback)(async()=>{try{let e=await n();if(!F.current)return;j(e),D.current=!0,g(e.auto),k(e.intervalDays),_(Date.now()),E(!1)}catch{F.current&&!D.current&&E(!0)}},[]);(0,s.useEffect)(()=>(F.current=!0,L(),()=>{F.current=!1}),[L]),(0,s.useEffect)(()=>{let e=()=>void L();return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[L]);let U=x?.signedInAs??null,T=x?.daemon==="running",q=x?.daemon==="unsupported-platform",O=x?.schedule??null,P=x?.lastScan??null,J=O?.lastExitCode!=null&&0!==O.lastExitCode&&75!==O.lastExitCode,B=(0,s.useCallback)(async()=>{C(!0);try{let e=await l(!0);if(!e.ok){if(g(!1),"unreachable"===e.reason)return void(0,c.toast)("could not reach the server. check your connection and try again.");await L(),$(!0),(0,c.toast)("that sign-in expired. one more code and it's on.");return}g(e.auto),(0,c.toast)("scheduled audits on."),await L()}catch{g(!1),(0,c.toast)("could not turn that on.")}finally{C(!1)}},[L]),K=(0,s.useCallback)(async()=>{if(w){C(!0);try{let e=await l(!1);e.ok&&g(e.auto),(0,c.toast)("scheduled audits off."),await L()}catch{(0,c.toast)("could not turn that off.")}finally{C(!1)}return}U?await B():$(!0)},[w,B,L,U]),V=(0,s.useCallback)(async e=>{C(!0);try{let t=await i(e);k(t.intervalDays),j(e=>e?{...e,intervalDays:t.intervalDays}:e),(0,c.toast)(`scanning every ${t.intervalDays} day${1===t.intervalDays?"":"s"}.`)}catch{k(x?.intervalDays??7),(0,c.toast)("could not save that.")}finally{C(!1)}},[x?.intervalDays]),Y=(0,s.useCallback)(async()=>{C(!0);try{await fetch("/api/auth/logout",{method:"POST"}),(0,c.toast)("signed out. scans continue; digests pause."),await L()}catch{(0,c.toast)("could not sign out.")}finally{C(!1)}},[L]),H=(0,s.useCallback)(async()=>{if(!S){M(!0);try{await (0,r.s)({cli:[],since:"all",noCache:!1}),(0,c.toast)("scan complete."),await L()}catch(e){(0,c.toast)(e instanceof r.t&&"timeout"===e.kind?"the scan is taking a while — it will finish in the background.":"the scan could not be completed.")}finally{M(!1)}}},[L,S]),Q=(0,s.useCallback)(async e=>{$(!1),await L(),await B()},[B,L]),W=x?T?{value:"running",sub:null!=x.daemonStartedAtMs&&R>0?`up ${function(e){let t=Math.floor(e/864e5);if(t>0)return`${t}d`;let s=Math.floor(e/36e5);return s>0?`${s}h`:`${Math.max(1,Math.floor(e/6e4))}m`}(Math.max(0,R-x.daemonStartedAtMs))}`:"",tone:"ok"}:q?{value:"unavailable",sub:"not on this platform"}:"not-installed"===x.daemon?{value:"not installed",sub:"run failproofai config",tone:"warn"}:"unknown"===x.daemon?{value:"unknown",sub:"could not read it"}:{value:"stopped",sub:"run failproofai config",tone:"warn"}:{value:"…",sub:"reading"},z=w?O?.nextDueAtMs==null?{value:"pending",sub:"after the next scan"}:{value:R>0?h(O.nextDueAtMs,R):"—",sub:u(O.nextDueAtMs)}:{value:"off",sub:"nothing scheduled"},G=P?{value:(0,d.g)(Date.parse(P.finishedAt)),sub:null!=P.sessionsScanned?`${m(P.sessionsScanned)} sessions`:"scanned"}:{value:"none yet",sub:"run one below"},X=P?null==P.findings?{value:"—",sub:"unreadable"}:{value:m(P.findings),sub:"this scan",...P.findings>0?{tone:"warn"}:{}}:{value:"—",sub:"no scan yet"};return(0,t.jsxs)("main",{className:"report",children:[(0,t.jsxs)("section",{className:"section set-sec",children:[(0,t.jsxs)("div",{className:"set-mast",children:[(0,t.jsx)("h1",{className:"set-title",children:"settings"}),(0,t.jsx)("p",{className:"set-lede",children:"keeping watch, so you don't have to."})]}),I?(0,t.jsxs)("div",{className:"set-console",children:[(0,t.jsx)("div",{className:"set-cell",children:(0,t.jsxs)("p",{className:"set-warn",children:["could not read this machine's settings. check that the dashboard can reach ",(0,t.jsx)("code",{children:"~/.failproofai/config.json"}),"."]})}),a]}):(0,t.jsxs)("div",{className:"set-console",children:[(0,t.jsxs)("div",{className:"set-stats",children:[(0,t.jsx)(f,{label:"daemon",...W}),(0,t.jsx)(f,{label:"next scan",...z}),(0,t.jsx)(f,{label:"last scan",...G}),(0,t.jsx)(f,{label:"findings",...X})]}),(0,t.jsxs)("div",{className:"set-cols",children:[(0,t.jsxs)("div",{className:"set-cell set-config",children:[(0,t.jsx)("h2",{className:"set-cell-title",children:"scheduled audit"}),(0,t.jsxs)("div",{className:"set-row set-row-main",children:[(0,t.jsx)(b,{enabled:w,disabled:N||null===x,onChange:()=>void K(),label:w?"turn off scheduled audits":"turn on scheduled audits"}),(0,t.jsxs)("div",{className:"set-row-copy",children:[(0,t.jsx)("span",{className:"set-strong",children:w?"scanning on a schedule.":"scan on a schedule."}),(0,t.jsx)("span",{className:"set-dim",children:w?"you'll get an email only when a scan finds something.":"off. nothing runs and nothing is sent."})]})]}),(0,t.jsxs)("div",{className:"set-row set-row-interval",children:[(0,t.jsx)("span",{className:"set-dim",children:"scan every"}),(0,t.jsx)("input",{type:"number",className:"set-num",min:1,max:90,value:y,disabled:N||null===x,"aria-label":"days between scheduled scans",onChange:e=>k(Number(e.target.value)),onBlur:e=>{let t=Number(e.target.value);Number.isFinite(t)?t!==x?.intervalDays&&V(t):k(x?.intervalDays??7)}}),(0,t.jsx)("span",{className:"set-dim",children:"days"}),(0,t.jsxs)("span",{className:"set-hint",children:[1,"–",90]})]}),(0,t.jsx)("div",{className:"set-rule"}),(0,t.jsx)("div",{className:"set-row set-row-identity",children:U?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"set-dim",children:"reports go to"}),(0,t.jsx)("span",{className:"set-email",children:U.email}),(0,t.jsx)("button",{type:"button",className:"set-link",disabled:N,onClick:()=>void Y(),children:"sign out"})]}):w?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"set-warn",children:"signed out — scans continue, digests are paused."}),(0,t.jsx)("button",{type:"button",className:"set-link",disabled:N,onClick:()=>$(!0),children:"sign in to resume"})]}):(0,t.jsx)("span",{className:"set-dim",children:"turning this on asks for an email, so there is somewhere to send the report."})}),w&&x&&!T&&(0,t.jsx)("p",{className:"set-warn",children:q?"the background service isn't available on this platform, so scheduled scans can't run here. you can still run one now.":"not-installed"===x.daemon?"the background service isn't installed, so nothing will run on the timer. install it with `failproofai config`.":"the background service is stopped, so nothing will run until it starts. repair it with `failproofai config`."}),J&&(0,t.jsxs)("p",{className:"set-warn",children:["the last scheduled scan exited ",O?.lastExitCode,". the next one will still run."]}),(0,t.jsx)("div",{className:"set-actions",children:(0,t.jsx)("button",{type:"button",className:"btn btn-press",disabled:S,onClick:()=>void H(),children:S?"[ scanning… ]":"[ run a scan now ]"})})]}),(0,t.jsxs)("div",{className:"set-cell set-how",children:[(0,t.jsx)("h2",{className:"set-cell-title",children:"how it works"}),(0,t.jsx)("dl",{className:"set-how-list",children:p.map(e=>(0,t.jsxs)("div",{className:"set-how-row",children:[(0,t.jsx)("dt",{className:"set-how-label",children:e.label}),(0,t.jsx)("dd",{className:"set-how-body",children:e.body})]},e.label))})]})]}),a]}),w&&R>0&&(0,t.jsx)(v,{lastRunAtMs:O?.lastRunAtMs??null,nextDueAtMs:O?.nextDueAtMs??null,now:R})]}),(0,t.jsx)(o.f,{open:A,source:"settings_scheduled_audit",headline:"where should the report go?",subhead:"we'll send a one-time code to confirm.",onClose:()=>$(!1),onAuthed:e=>void Q(e)})]})}],93237)},29054,e=>{e.s(["q",0,function(e,t={},s=15e3){let a=AbortSignal.timeout(s),n=t.signal?AbortSignal.any([t.signal,a]):a;return fetch(e,{...t,signal:n})},"c",0,function(e){if(null===e||"object"!=typeof e)return!1;let t=e.name;return"AbortError"===t||"TimeoutError"===t}])},34713,e=>{e.s(["M",0,function(e){if(e<1e3)return`${e}ms`;let t=Math.round(e/100);if(t<600)return`${(t/10).toFixed(1)}s`;let s=Math.round(e/1e3);if(s<3600){let e=Math.floor(s/60);return`${e}m ${s%60}s`}let a=Math.round(e/6e4),n=Math.floor(a/60);return`${n}h ${a%60}m`},"g",0,function(e){let t=Date.now()-e;return t<6e4?`${Math.max(1,Math.floor(t/1e3))}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}])}])})();