frizz-server 0.15.13 → 0.15.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/claude-agent-broker.js +5411 -5340
- package/dist/dev-child.js +5930 -5851
- package/package.json +1 -1
- package/web-dist/assets/{abnfDiagram-VRR7QNED-BBUrh3y4.js → abnfDiagram-VRR7QNED-DhfveBnK.js} +1 -1
- package/web-dist/assets/{arc-CzSC2w85.js → arc-CyAhw_PT.js} +1 -1
- package/web-dist/assets/architecture-TIHT7OUA-C1SxnjA-.js +1 -0
- package/web-dist/assets/{architectureDiagram-ZJ3FMSHR-BZdFvCPS.js → architectureDiagram-ZJ3FMSHR-DwWGlWWh.js} +1 -1
- package/web-dist/assets/{blockDiagram-677ZJIJ3-CFw4HlAZ.js → blockDiagram-677ZJIJ3-DaZjGZtu.js} +1 -1
- package/web-dist/assets/{c4Diagram-LMCZKHZV-BeWg4GGT.js → c4Diagram-LMCZKHZV-BRMup1j9.js} +1 -1
- package/web-dist/assets/channel-BF49lwbq.js +1 -0
- package/web-dist/assets/{chunk-32BRIVSS-Q_OGIKCm.js → chunk-32BRIVSS-DQwcDwtE.js} +1 -1
- package/web-dist/assets/{chunk-52WLFC77-C2ghSBWi.js → chunk-52WLFC77-CgGBFwno.js} +1 -1
- package/web-dist/assets/{chunk-C7G6YPKG-E7JHlQhC.js → chunk-C7G6YPKG-CuxheuT5.js} +1 -1
- package/web-dist/assets/{chunk-EX3LRPZG-c7FlR3e8.js → chunk-EX3LRPZG-BUJla0kp.js} +1 -1
- package/web-dist/assets/{chunk-FWX5IMBZ-1mU_aS7O.js → chunk-FWX5IMBZ-B0zpcsgr.js} +2 -2
- package/web-dist/assets/{chunk-HOUHSVGY-DLJJRwLZ.js → chunk-HOUHSVGY-Rmt15rW3.js} +1 -1
- package/web-dist/assets/{chunk-ICXQ74PX-D7jDcuWv.js → chunk-ICXQ74PX-DhfK6S2X.js} +1 -1
- package/web-dist/assets/{chunk-MOJQB5TN-C-KYsjX1.js → chunk-MOJQB5TN-DPeso190.js} +1 -1
- package/web-dist/assets/{chunk-OGEWGWER-Dnfz8Ffe.js → chunk-OGEWGWER-Dnxu3oeq.js} +1 -1
- package/web-dist/assets/{chunk-PUDLZKDR-BdzmoKkv.js → chunk-PUDLZKDR-JzuUO3j2.js} +1 -1
- package/web-dist/assets/{chunk-Q4XR5HBZ-HNAZNAAv.js → chunk-Q4XR5HBZ-CM6ZXGkW.js} +1 -1
- package/web-dist/assets/{chunk-RYQCIY6F-e5BApeF1.js → chunk-RYQCIY6F--6BdDOKZ.js} +1 -1
- package/web-dist/assets/{chunk-V7JOEXUC-cK1Hu1b4.js → chunk-V7JOEXUC-Dq3E-pJp.js} +1 -1
- package/web-dist/assets/{chunk-VAUOI2AC-Df9HZp6Z.js → chunk-VAUOI2AC-Cd8PGNlH.js} +1 -1
- package/web-dist/assets/{chunk-VR4S4FIN-D6CAtMMq.js → chunk-VR4S4FIN-dwYLlPtI.js} +1 -1
- package/web-dist/assets/{chunk-WYO6CB5R-JyE0Wb29.js → chunk-WYO6CB5R-CycRCrJb.js} +1 -1
- package/web-dist/assets/{chunk-XXDRQBXY-D_O0RmZ-.js → chunk-XXDRQBXY-BHkd_B7T.js} +1 -1
- package/web-dist/assets/{chunk-ZGVPDNZ5-TKNm5tbx.js → chunk-ZGVPDNZ5-w1E_2-n0.js} +1 -1
- package/web-dist/assets/classDiagram-OUVF2IWQ-CBnpuahb.js +1 -0
- package/web-dist/assets/classDiagram-v2-EOCWNBFH-CBnpuahb.js +1 -0
- package/web-dist/assets/{cose-bilkent-JH36ORCC-aJ2vJo3h.js → cose-bilkent-JH36ORCC-DT58QUJH.js} +1 -1
- package/web-dist/assets/{cynefin-VYW2F7L2-BzC5SCFm.js → cynefin-VYW2F7L2-DJBWvYfG.js} +1 -1
- package/web-dist/assets/{cynefinDiagram-TSTJHNR4-BUBneCyZ.js → cynefinDiagram-TSTJHNR4-BgZsBMC5.js} +1 -1
- package/web-dist/assets/{dagre-VKFMJZFB-CyqWV8--.js → dagre-VKFMJZFB-BsUdprP7.js} +1 -1
- package/web-dist/assets/{diagram-FQU43EPY-4Mmv21C-.js → diagram-FQU43EPY-AYwXc4ap.js} +1 -1
- package/web-dist/assets/{diagram-G47NLZAW-C2RFiyED.js → diagram-G47NLZAW--4o6VVV_.js} +1 -1
- package/web-dist/assets/{diagram-NH7WQ7WH-hZnAY_wV.js → diagram-NH7WQ7WH-B0_Gu4SY.js} +1 -1
- package/web-dist/assets/{diagram-OA4YK3LP-K1Zd1JAb.js → diagram-OA4YK3LP-DIdSWxbC.js} +1 -1
- package/web-dist/assets/{diagram-WEI45ONY-CHKaRrZp.js → diagram-WEI45ONY-ZggLbvMN.js} +1 -1
- package/web-dist/assets/{dist-ImoGVzkQ.js → dist-Bx4dBZZj.js} +1 -1
- package/web-dist/assets/{ebnfDiagram-CCIWWBDH-BMR3sXl5.js → ebnfDiagram-CCIWWBDH-D4mwPGRz.js} +1 -1
- package/web-dist/assets/{erDiagram-Q63AITRT-DZmU3YbK.js → erDiagram-Q63AITRT-BdVxVYVS.js} +1 -1
- package/web-dist/assets/eventmodeling-45OFAUF4-DmV5Ki1T.js +1 -0
- package/web-dist/assets/flowDiagram-23GEKE2U-BIo9OVTK.js +1 -0
- package/web-dist/assets/{ganttDiagram-NO4QXBWP-0cAynm96.js → ganttDiagram-NO4QXBWP-1ch3s-Lp.js} +1 -1
- package/web-dist/assets/{gitGraph-TEB2WS4Q-DQgaAaBP.js → gitGraph-TEB2WS4Q-OYci86fv.js} +1 -1
- package/web-dist/assets/{gitGraphDiagram-IHSO6WYX-BnULFM88.js → gitGraphDiagram-IHSO6WYX-C0vyzUeM.js} +1 -1
- package/web-dist/assets/{index-Cs3gPFNZ.js → index-DDIB2iVX.js} +2 -2
- package/web-dist/assets/{index-DA4tWPyA.css → index-DcU5Cvjj.css} +1 -1
- package/web-dist/assets/{info-DKCQHKI2-DlvSk8u3.js → info-DKCQHKI2-Di5Jz1rS.js} +1 -1
- package/web-dist/assets/{infoDiagram-FWYZ7A6U-CV-UmITw.js → infoDiagram-FWYZ7A6U-CFb6Kd3F.js} +1 -1
- package/web-dist/assets/{ishikawaDiagram-FXEZZL3T-xQWAaJiF.js → ishikawaDiagram-FXEZZL3T-DcfyEKeu.js} +1 -1
- package/web-dist/assets/{journeyDiagram-5HDEW3XC-DJK8kVzY.js → journeyDiagram-5HDEW3XC-DKXBMkLI.js} +1 -1
- package/web-dist/assets/{kanban-definition-HUTT4EX6-moIoFsSZ.js → kanban-definition-HUTT4EX6-B369XB3j.js} +1 -1
- package/web-dist/assets/{line-B9t5KW3M.js → line-CHcvip-O.js} +1 -1
- package/web-dist/assets/{linear-p05acNA3.js → linear-DQNyozJe.js} +1 -1
- package/web-dist/assets/{mermaid-parser.core-Db7dttgI.js → mermaid-parser.core-BjxGpEg5.js} +3 -3
- package/web-dist/assets/{mermaid.core-BFbkt8RT.js → mermaid.core-DrLahovt.js} +3 -3
- package/web-dist/assets/{mindmap-definition-LN4V7U3C-dOYDtsm4.js → mindmap-definition-LN4V7U3C-MZ52F91o.js} +1 -1
- package/web-dist/assets/{packet-7NZHBO7P-Y34L2B_H.js → packet-7NZHBO7P-CjyAw65k.js} +1 -1
- package/web-dist/assets/{pegDiagram-2B236MQR-BlI8nWnE.js → pegDiagram-2B236MQR-DLWhOQnL.js} +1 -1
- package/web-dist/assets/{pie-RZYD4A2V-n-Qg1sTG.js → pie-RZYD4A2V-Bo059ddI.js} +1 -1
- package/web-dist/assets/{pieDiagram-ENE6RG2P-DoHW9Gyq.js → pieDiagram-ENE6RG2P-Bn4xh59c.js} +1 -1
- package/web-dist/assets/{quadrantDiagram-ABIIQ3AL-BMUuqVdW.js → quadrantDiagram-ABIIQ3AL-yL39XUy5.js} +1 -1
- package/web-dist/assets/{radar-I7S5WNFK-skxmXNaM.js → radar-I7S5WNFK-Ck7WdZik.js} +1 -1
- package/web-dist/assets/{railroad-3IZDKUUU-LfjLO5Ny.js → railroad-3IZDKUUU-iyRvRPSM.js} +1 -1
- package/web-dist/assets/railroad-abnf-AHOZXSZD-CbUyyZcZ.js +1 -0
- package/web-dist/assets/railroad-ebnf-EBAXGLYW-Cw1S-tc2.js +1 -0
- package/web-dist/assets/railroad-peg-LSFZ7HO6-BEpXiF80.js +1 -0
- package/web-dist/assets/{railroadDiagram-RFXS5EU6-Zdj5BMQG.js → railroadDiagram-RFXS5EU6-BxVsxOmr.js} +1 -1
- package/web-dist/assets/{requirementDiagram-TGXJPOKE-DcFm1DAf.js → requirementDiagram-TGXJPOKE-D66pmX1H.js} +1 -1
- package/web-dist/assets/{sankeyDiagram-HTMAVEWB-BcRmQRQe.js → sankeyDiagram-HTMAVEWB-BvgsAMO2.js} +1 -1
- package/web-dist/assets/{sequenceDiagram-DBY2YBRQ-bET8bpzv.js → sequenceDiagram-DBY2YBRQ-BhNfNIv2.js} +1 -1
- package/web-dist/assets/{src-CUSFAnq6.js → src-CjLI2OlU.js} +1 -1
- package/web-dist/assets/{stateDiagram-2N3HPSRC-AGBIK4Rz.js → stateDiagram-2N3HPSRC-vnAKWHvS.js} +1 -1
- package/web-dist/assets/stateDiagram-v2-6OUMAXLB-D-SWO5VU.js +1 -0
- package/web-dist/assets/{swimlanes-5IMT3BWC-BrxNGoSO.js → swimlanes-5IMT3BWC-CB-Yj_fF.js} +1 -1
- package/web-dist/assets/swimlanesDiagram-G3AALYLV-PjEPG6SC.js +8 -0
- package/web-dist/assets/{timeline-definition-FHXFAJF6-Dqoh4MQ-.js → timeline-definition-FHXFAJF6-CvLWFhRF.js} +1 -1
- package/web-dist/assets/{treeView-QDETBFTQ-C_vYdzCy.js → treeView-QDETBFTQ-BDE_I1pO.js} +1 -1
- package/web-dist/assets/{treemap-6X3UGDF4-B_o40Eep.js → treemap-6X3UGDF4-FQ6gU3Zd.js} +1 -1
- package/web-dist/assets/{vennDiagram-L72KCM5P-AHb21nUH.js → vennDiagram-L72KCM5P-BVrnKEXl.js} +1 -1
- package/web-dist/assets/{wardley-OPB4EBWU-CDvRbffW.js → wardley-OPB4EBWU-BXDzR7qq.js} +1 -1
- package/web-dist/assets/{wardleyDiagram-EHGQE667-DmLMQrCO.js → wardleyDiagram-EHGQE667-DbUiehJp.js} +1 -1
- package/web-dist/assets/{xychartDiagram-FW5EYKEG-CBq8Fuud.js → xychartDiagram-FW5EYKEG-BTwgjd1B.js} +1 -1
- package/web-dist/index.html +2 -2
- package/web-dist/assets/architecture-TIHT7OUA-Bkytur05.js +0 -1
- package/web-dist/assets/channel-CRbCFAU9.js +0 -1
- package/web-dist/assets/classDiagram-OUVF2IWQ-DV4x88Gs.js +0 -1
- package/web-dist/assets/classDiagram-v2-EOCWNBFH-DV4x88Gs.js +0 -1
- package/web-dist/assets/eventmodeling-45OFAUF4-DGvQ-Cb8.js +0 -1
- package/web-dist/assets/flowDiagram-23GEKE2U-COGNeA6-.js +0 -1
- package/web-dist/assets/railroad-abnf-AHOZXSZD-D4N57HJe.js +0 -1
- package/web-dist/assets/railroad-ebnf-EBAXGLYW-kukg91Jv.js +0 -1
- package/web-dist/assets/railroad-peg-LSFZ7HO6-4UH_xlt7.js +0 -1
- package/web-dist/assets/stateDiagram-v2-6OUMAXLB-CGZk-pxB.js +0 -1
- package/web-dist/assets/swimlanesDiagram-G3AALYLV-tBUJkYsP.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-DrLahovt.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-CjLI2OlU.js","assets/chunk-WYO6CB5R-CycRCrJb.js","assets/chunk-ICXQ74PX-DhfK6S2X.js","assets/dist-Bx4dBZZj.js","assets/chunk-VAUOI2AC-Cd8PGNlH.js","assets/chunk-HOUHSVGY-Rmt15rW3.js","assets/chunk-Q4XR5HBZ-CM6ZXGkW.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-OGEWGWER-Dnxu3oeq.js","assets/chunk-C7G6YPKG-CuxheuT5.js","assets/chunk-ZGVPDNZ5-w1E_2-n0.js","assets/rough.esm-CSKSodPl.js","assets/chunk-52WLFC77-CgGBFwno.js","assets/line-CHcvip-O.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-FWX5IMBZ-B0zpcsgr.js","assets/chunk-ZIRB5QZD-C6fEPe3t.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ee={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ee,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=f();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),m=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=u(),n=f(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},ne=[],re=-1;function ie(e){return{current:e}}function ae(e){0>re||(e.current=ne[re],ne[re]=null,re--)}function oe(e,t){re++,ne[re]=e.current,e.current=t}var se=ie(null),ce=ie(null),le=ie(null),ue=ie(null);function de(e,t){switch(oe(le,t),oe(ce,e),oe(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Kd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Kd(t),e=qd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ae(se),oe(se,e)}function fe(){ae(se),ae(ce),ae(le)}function pe(e){e.memoizedState!==null&&oe(ue,e);var t=se.current,n=qd(t,e.type);t!==n&&(oe(ce,e),oe(se,n))}function me(e){ce.current===e&&(ae(se),ae(ce)),ue.current===e&&(ae(ue),rp._currentValue=te)}var he,ge;function _e(e){if(he===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);he=t&&t[1]||``,ge=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+he+e+ge}var ve=!1;function ye(e,t){if(!e||ve)return``;ve=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -320,7 +320,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
|
|
|
320
320
|
|
|
321
321
|
`);return(0,R.jsxs)(`button`,{type:`button`,role:t?`checkbox`:`radio`,"aria-checked":n,"data-answer-option":!0,"data-on":n||void 0,onClick:e=>{e.target.closest(`[data-lightbox-tile], img[data-local-path]`)||r()},className:`${c0} text-left`,children:[(0,R.jsx)(d0,{multi:t,on:n}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`span`,{className:`block text-[15.5px] font-medium leading-[21px] text-fg`,children:[e.label,e.recommended&&(0,R.jsx)(`span`,{className:`ml-1.5 text-[11px] font-bold tracking-[0.02em] text-accent`,children:`RECOMMENDED`})]}),i&&(0,R.jsx)(`span`,{className:`mt-px block text-[13px] leading-[18px] text-muted`,children:i}),a&&(0,R.jsx)(u0,{md:a})]})]})}function u0({md:e}){return(0,R.jsx)(`div`,{className:`card-md mt-1 text-muted`,children:(0,R.jsx)(GZ,{className:`md-body`,html:rX(e)})})}function d0({multi:e,on:t,dashed:n=!1}){return(0,R.jsx)(`span`,{"aria-hidden":!0,className:`mt-[0.5px] flex size-5 shrink-0 items-center justify-center border-[1.5px] ${e?`rounded-[5px]`:`rounded-full`} ${n?`border-dashed`:``} ${t?e?`border-fg bg-fg text-bg`:`border-fg`:`border-border-strong`}`,children:t&&(e?(0,R.jsx)(Jg,{size:14,strokeWidth:3}):(0,R.jsx)(`span`,{className:`size-2.5 rounded-full bg-fg`}))})}function f0({a:e,step:t,autoFocus:n,placeholder:r}){let i=(0,L.useRef)(null),a=e.answerFor(t.q,t.path).text,o=t.spec.kind===`multi`;return(0,L.useLayoutEffect)(()=>{let e=i.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)},[a]),(0,L.useEffect)(()=>{n&&i.current?.focus()},[n]),(0,R.jsx)(`div`,{className:`px-[18px] ${(t.spec.options??[]).length===0?``:`pt-3`}`,children:(0,R.jsx)(`textarea`,{ref:i,"data-answer-text":!0,"data-1p-ignore":!0,"data-claims-escape":!0,rows:(t.spec.options??[]).length===0?3:1,value:a,placeholder:r,onChange:n=>e.onText(t.q,t.path,o,n.target.value),onFocus:()=>{o||e.onText(t.q,t.path,!1,a)},className:`block max-h-[40vh] w-full resize-none overflow-y-auto rounded-[12px] border border-border-strong bg-bg px-3 py-[11px] text-[16px] leading-[22px] text-fg outline-none placeholder:text-faint focus:border-fg/40`})})}function p0({a:e,step:t,first:n,writing:r,onBack:i,onNext:a}){let o=e.answerFor(t.q,t.path),s=F1(t.spec,o),c=t.spec.options??[],l=t.spec.kind!==`multi`&&o.chosen===null&&o.text.trim()!==``,u=t.spec.kind===`multi`||c.length===0||r||l;return(0,R.jsxs)(y0,{children:[(0,R.jsx)(`button`,{type:`button`,"data-answer-back":!0,disabled:n,onClick:i,className:`${g0} ${_0} disabled:opacity-35`,children:`Back`}),(0,R.jsx)(`span`,{className:`flex-1`}),!(u&&s)&&(0,R.jsx)(`button`,{type:`button`,"data-answer-skip":!0,onClick:a,className:`${g0} ${_0}`,children:s?`Next`:`Skip`}),u&&(0,R.jsx)(`button`,{type:`button`,"data-answer-continue":!0,disabled:!s,onClick:a,className:`${g0} ${v0} px-6 disabled:opacity-35`,children:`Continue`})]})}function m0({a:e,steps:t,onChange:n}){let r=t.map(t=>({s:t,said:U1(t.spec,e.answerFor(t.q,t.path))})),i=r.filter(e=>e.said!==null).length;return(0,R.jsxs)(`div`,{"data-answer-review":!0,children:[(0,R.jsx)(`div`,{className:`px-[18px] pb-3 pt-1 text-[17px] font-semibold leading-[23px] text-fg`,children:i===0?`No answers yet`:`${i} answer${i===1?``:`s`}`}),(0,R.jsx)(`div`,{className:`border-b border-border`,children:r.map(({s:e,said:t})=>(0,R.jsxs)(`button`,{type:`button`,"data-answer-change":e.key,onClick:()=>n(e.key),className:`block w-full border-t border-border px-[18px] py-2.5 text-left outline-none active:bg-hover focus-visible:bg-hover`,children:[(0,R.jsx)(`span`,{className:`line-clamp-2 block text-[13px] leading-[18px] text-muted`,children:b0(e.spec.question)}),(0,R.jsxs)(`span`,{className:`mt-0.5 flex items-baseline justify-between gap-2.5`,children:[(0,R.jsx)(`span`,{className:`min-w-0 break-words text-[15.5px] leading-[21px] ${t===null?`text-muted`:`font-medium text-fg`}`,children:t??`Skipped`}),(0,R.jsx)(`span`,{className:`shrink-0 text-[13.5px] text-muted`,children:`Change`})]})]},e.key))})]})}function h0({a:e,onSent:t}){return(0,R.jsx)(y0,{children:(0,R.jsx)(`button`,{type:`button`,"data-answer-send":!0,disabled:e.staged===0||e.sending,onClick:()=>{e.submit(),t()},className:`${g0} ${v0} flex-1 disabled:opacity-35`,children:e.sending?`Sending…`:`Send answers`})})}var g0=`flex h-[46px] shrink-0 items-center justify-center rounded-[12px] text-[15.5px] font-semibold outline-none`,_0=`px-[18px] text-muted active:bg-hover focus-visible:bg-hover`,v0=`bg-fg text-bg active:opacity-90`;function y0({children:e}){let t=(0,L.useRef)(null),[n,r]=(0,L.useState)(!1);(0,L.useEffect)(()=>{let e=0,n=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e=document.activeElement;r(e instanceof HTMLTextAreaElement&&t.current?.parentElement?.contains(e)===!0)})};return n(),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),()=>{cancelAnimationFrame(e),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)}},[]);let i=Sz(t,n);return(0,R.jsxs)(`div`,{ref:t,"data-answer-footer":!0,className:`shrink-0`,children:[(0,R.jsx)(`div`,{className:`flex items-center gap-2.5 px-[18px] pt-3.5`,children:e}),i>0&&(0,R.jsx)(`div`,{"aria-hidden":!0,style:{height:i}})]})}function b0(e){return(e.trim().split(/\n\s*\n/)[0]??``).replace(/[`*_~]/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/\s+/g,` `).trim()}function x0(e){return(0,L.useSyncExternalStore)(e=>pr(X,e),()=>e?S0(e)!==`codex`:!1,()=>!1)}function S0(e){return gg(X.board,e)?.backend}function C0(e,t,n,r){let i=XV.followUp(e,t,n);return JV(i,r),i}function w0(e){if(!(typeof document>`u`)){for(let t=e;t;t=t.parentElement){let e=t.querySelector(`[data-thread-composer-box] textarea`);if(e){e.focus(),e.setSelectionRange(e.value.length,e.value.length);return}}document.getElementById(`followup-input`)?.focus()}}function T0(e){let t=qe(),n=ZV(),[r,i]=(0,L.useState)(!1);return{unqueue:(0,L.useCallback)(a=>{if(!e||r)return;let o=gg(X.board,e)?.sessionId;if(!o){Z(`This thread has no live session to unqueue from`);return}i(!0),Y.unqueueFollowUp({slug:e,sessionId:o,deliveryId:a.deliveryId}).then(r=>{if(i(!1),!r.unqueued){Z(r.reason??`That message could not be taken back`);return}zE(t,e,a.rawText,a.deliveryId),C0(n,e,o,a.text),w0(a.from)},e=>{i(!1),Z(`Couldn't unqueue — ${(e instanceof Error?e.message:String(e)).slice(0,160)}`)})},[r,n,t,e]),pending:r}}function E0(e){let t=qe(),n=ZV(),[r,i]=(0,L.useState)(!1),a=(0,L.useCallback)(n=>{!e||r||QU(t,e,n.text,{supersedes:n.deliveryId,failureToast:e=>`Retry failed — ${e.slice(0,160)}`})},[r,t,e]),o=(0,L.useCallback)(async t=>{if(!e)return!1;i(!0);try{return await Y.dismissFailedFollowUp({slug:e,deliveryId:t}),!0}catch(e){return Z(`Couldn't dismiss — ${(e instanceof Error?e.message:String(e)).slice(0,160)}`),!1}finally{i(!1)}},[e]);return{retry:a,edit:(0,L.useCallback)(t=>{!e||r||(C0(n,e,gg(X.board,e)?.sessionId,t.text),w0(t.from),o(t.deliveryId))},[o,r,n,e]),dismiss:(0,L.useCallback)(t=>{!e||r||o(t.deliveryId)},[o,r,e]),pending:r}}var D0=new Map;function O0(e,t){let n=(D0.get(e)??[]).filter(e=>e.deliveryId!==t.deliveryId);n.push(t),D0.set(e,n.slice(-8))}var k0=e=>e.replace(/\s+/g,` `).trim();function A0(e,t){let n=D0.get(e);if(!n?.length)return;let r=k0(t);for(let t=n.length-1;t>=0;t--){let i=k0(n[t].text);if(!i||!r.includes(i))continue;let[a]=n.splice(t,1);return n.length||D0.delete(e),a.deliveryId}}function j0(e){return(0,L.useSyncExternalStore)(e=>pr(X,e),()=>{if(!e)return!1;let t=gg(X.board,e);return t?.backend!==`codex`&&t?.runtime===`running`},()=>!1)}function M0(e){let[t,n]=(0,L.useState)(!1);return{deliverNow:(0,L.useCallback)(()=>{if(!e||t)return;let r=gg(X.board,e)?.sessionId;if(!r){Z(`This thread has no live session to interrupt`);return}n(!0),Y.deliverQueuedNow({slug:e,sessionId:r}).then(e=>{n(!1),e.interrupted||Z(e.reason??`That message could not be pushed through`)},e=>{n(!1),Z(`Couldn't push it through — ${(e instanceof Error?e.message:String(e)).slice(0,160)}`)})},[t,e]),pending:t}}function N0(e){return e.displayText??e.text}function P0(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.role===`user`&&!n.queued&&!n.peerFrom&&!n.agentInstruction)return t}return-1}function F0(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.role!==`user`||n.queued||n.peerFrom||n.agentInstruction)&&!(n.wake&&!n$(n)))return t}return 0}function ine(e,t){if(e.kind===`event`||e.kind===`reasoning`||e.role!==`user`)return!1;let n=N0(e).replace(/\r\n?/g,`
|
|
322
322
|
`);return(t===void 0?$Q(n):t)?!0:!(e.wake||e.peerFrom)}function I0(e,t){return ine(e,t)?`bubble`:`prose`}var L0=`icon-label-nudge`,R0=`frizz-theme`,z0=`#0d0e10`,B0=`#f7f7f7`,V0=new Set,H0={preference:`system`,resolved:`dark`},U0,W0;function G0(e){return e===`light`||e===`dark`||e===`system`?e:`system`}function K0(e,t=q0()){return e===`system`?t?`dark`:`light`:e}function q0(){try{return U0?.matches??window.matchMedia(`(prefers-color-scheme: dark)`).matches}catch{return!1}}function J0(){try{return G0(localStorage.getItem(R0))}catch{return`system`}}function Y0(e){let t=document.documentElement;t.dataset.theme=e.resolved,t.style.colorScheme=e.resolved,document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,e.resolved===`dark`?z0:B0)}function X0(e,t=q0()){let n={preference:e,resolved:K0(e,t)},r=n.preference!==H0.preference||n.resolved!==H0.resolved;if(r&&(H0=n),Y0(n),r)for(let e of V0)e()}function Z0(){return H0}function Q0(e){X0(G0(e));try{localStorage.setItem(R0,H0.preference)}catch{}}function $0(e){return V0.add(e),()=>V0.delete(e)}function e2(){if(W0||typeof window>`u`)return W0;try{U0=window.matchMedia(`(prefers-color-scheme: dark)`)}catch{U0=void 0}X0(J0());let e=e=>{H0.preference===`system`&&X0(`system`,e.matches)};U0?.addEventListener(`change`,e);let t=e=>{try{if(e.storageArea&&e.storageArea!==localStorage)return}catch{return}e.key===`frizz-theme`?X0(G0(e.newValue)):e.key===null&&X0(`system`)};return window.addEventListener(`storage`,t),W0=()=>{U0?.removeEventListener(`change`,e),window.removeEventListener(`storage`,t),W0=void 0,U0=void 0},W0}function t2(e,t,n){return{type:`frizz-inline-vis-theme`,requestId:e,colorScheme:t,vars:n}}function n2(e,t){return typeof e==`object`&&!!e&&e.type===`frizz-inline-vis-applied`&&e.requestId===t}var r2=new Set([`planning`,`planned`,`active`,`needs-human`,`blocked`]);function i2(e){return!!(e&&e.kind===`legacy`&&!e.foreign&&e.runtime===`none`&&!e.sessionId&&!e.threadName&&!e.owner&&e.agents.length===0&&e.errors.length===0&&r2.has(e.status))}var a2=`sticky top-0 z-10 flex min-w-0 shrink-0 items-center gap-2.5 border-b border-border bg-panel px-3 ${iv} max-[640px]:h-auto max-[640px]:min-h-12 max-[640px]:flex-wrap max-[640px]:items-start max-[640px]:gap-y-2 max-[640px]:px-4 max-[640px]:py-2.5`,o2=`min-w-0 flex-1 pl-1 max-[640px]:basis-full`,s2=`flex shrink-0 items-center max-[640px]:w-full max-[640px]:justify-between`;function c2(e){return e?.trim()?{kind:`profile-error`,message:`Profile controls unavailable: ${e.trim().slice(0,160)}`}:null}function l2(e){if(e.foreign)return`Read-only external thread`;if(e.permissionChangePending||e.permissionPending)return`A permission change is already in progress`;if(e.profileChangePending)return`A model and effort change is already in progress`;if(e.runtimeControlPending)return`Another runtime control is already in progress`;if(e.pendingAsk||e.runtime===`perm-prompt`)return`Resolve the current terminal approval or question first`;if(e.backend===`codex`||e.backend===`acp`)return null;let t=[...e.subAgents??[],...e.bgShells??[]].filter(e=>e.state===`running`||e.state===`stale`).length;return t>0?`Wait for ${t} unresolved background operation${t===1?``:`s`}`:e.runtime===`running`||e.runtime===`spawning`?`Wait for the current turn to finish`:null}function u2(e){return e.permissionChangePending===!0||e.permissionPending!==void 0||e.profileChangePending===!0||e.runtimeControlPending===!0}function d2(e,t){let n=t===`codex`?`Sandbox`:`Permissions`;return e===`applied`?`${n} applied to the live session`:e===`next-turn`?t===`codex`?`${n} applied — takes effect on the next turn`:`${n} saved — the worker restarts on the next turn`:`${n} saved for the next resume`}function f2(e,t,n,r){let i=e.find(e=>e.model===t),a=!!i,o=!!(i&&n&&i.efforts.includes(n)),s=a&&o;return{selectedProfile:i,modelKnown:a,effortKnown:o,profileKnown:s,modelSelectable:r||a,effortSelectable:!!i&&(r||s)}}function p2(e){let t=gr(X).board?.threads.find(t=>t.id===e),n=ct({queryKey:[`threadProfileOptions`,e],queryFn:()=>Y.threadProfileOptions({slug:e}),enabled:!!(t&&!t.foreign&&t.kind===`session`),staleTime:5e3}),r=pt({mutationFn:t=>Y.setThreadProfile({slug:e,model:t.model,...t.effort?{effort:t.effort}:{}})}),i=pt({mutationFn:t=>Y.setThreadPermission({slug:e,permissionMode:t})}),a=pt({mutationFn:t=>Y.upgradeThreadModel({slug:e,sessionId:t})}),o=r.isPending||i.isPending||a.isPending,s=t?.backend===`codex`?`codex`:t?.backend===`acp`?`acp`:`claude`,c=ct({queryKey:[`acpAgents`],queryFn:()=>Y.acpAgents(),enabled:!!t&&s===`acp`});if(!t||t.foreign||t.kind!==`session`)return{busy:o,footer:null,phoneTools:null,status:null};let l=o||u2(t),u=t.model?.trim(),d=t.effort?.trim(),f=s===`acp`?wu(u):void 0,p=s===`acp`?Tu(u):void 0,m=r.isPending?r.variables:void 0,h=t.profilePendingModel??m?.model,g=t.profilePendingEffort??m?.effort,_=s===`acp`&&m?Tu(m.model):void 0,v=n.data?.options??[],{modelSelectable:y}=f2(v,u,d,t.runtime===`exited`),b=n.data!==void 0,x=c.data?.find(e=>e.id===f)?.label??f,S=[{id:s,label:s===`codex`?`Codex`:`Claude Code`,options:v}],C=c2(n.isError?n.error.message:void 0),w=t.permissionMode?uB(t.permissionMode):`auto`,T=sB.some(e=>e.value===w)?w:`auto`,E=i.isPending?i.variables:T,D=l2(t);function O(e){e!==T&&i.mutate(e,{onSuccess:e=>Z(d2(e.effect,`claude`)),onError:e=>Z(`Permission change failed: ${e.message.slice(0,120)}`)})}let k=s===`claude`?l2(t):null;function A(){t?.sessionId&&a.mutate(t.sessionId,{onSuccess:e=>Z(`${e.label} from the next turn — the worker restarts then`),onError:e=>Z(`Upgrade failed: ${e.message.slice(0,120)}`)})}function j(e){r.mutate(e,{onSuccess:e=>Z(s===`acp`?e.effect===`next-resume`?`Model saved for the next resume`:`Model applied`:e.effect===`next-resume`?`Model and effort saved for the next resume`:`Model and effort applied`),onError:e=>Z(`Profile change failed: ${e.message.slice(0,120)}`)})}let M=(0,R.jsxs)(R.Fragment,{children:[s!==`acp`&&(0,R.jsx)(SV,{groups:S,value:{provider:s,model:u,effort:d},pending:h||g?{provider:s,model:h,effort:g}:void 0,onValueChange:({model:e,effort:t})=>j({model:e,effort:t}),placeholder:n.isPending?`Profile loading…`:`Profile unknown`,ariaLabel:`Thread model and effort`,menuAriaLabel:`Choose ${s===`codex`?`Codex`:`Claude Code`} model and effort`,title:y?t.runtime===`exited`?`Saved per thread and applied when this conversation resumes`:`Change this idle conversation's model and reasoning effort`:`The current live backend profile is unavailable; controls fail closed`,disabled:l||!b||!y||n.isError,compact:!0,side:`top`,className:`min-w-0 max-w-[min(72%,20rem)] px-1.5 py-0.5`,runningModelLabel:t.runningModelLabel,upgrade:t.modelUpgrade&&t.runningModelLabel?{latest:t.modelUpgrade.label,staged:t.modelUpgrade.staged,blockedReason:k,pending:a.isPending,onUpgrade:A}:void 0}),s===`acp`&&f&&(0,R.jsx)(EV,{agentId:f,agentLabel:x??f,modelId:_??p,onValueChange:e=>j({model:Su(f,e),effort:``}),disabled:l,side:`top`,className:`min-w-0 max-w-[min(72%,20rem)] px-1.5 py-0.5`})]});return{busy:l,footer:(0,R.jsxs)(`div`,{"data-thread-composer-controls":!0,className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[M,s===`claude`&&(0,R.jsx)(cV,{variant:`readout`,side:`top`,value:E,onValueChange:e=>O(e),options:sB,ariaLabel:`Thread permission mode`,title:D?`${D} — changing permissions restarts this thread's worker process`:E===`bypassPermissions`?`Bypass: the worker never asks for approval. Changing this restarts the worker process; the conversation resumes from disk on the next turn.`:`Auto: risky actions raise an approval card here. Changing this restarts the worker process; the conversation resumes from disk on the next turn.`,disabled:l||D!==null,className:`shrink-0`}),h&&g&&(0,R.jsxs)(`span`,{className:`min-w-0 truncate text-[9px] text-muted-50`,children:[`→ `,h,` · `,g,` pending`]})]}),phoneTools:M,status:C?(0,R.jsx)(`div`,{"data-thread-control-error":``,className:`px-1 pt-1 text-[9.5px] leading-tight text-muted-65`,children:C.message}):null}}function m2(e,t=GD.queueOrder){let n=TO(e,t),r=n.active.filter(vf),i=n.active.filter(e=>!vf(e));return[...n.pinned,...r,...i]}function h2(e,t,n=GD.queueOrder,r=CW()){return m2(e.map(e=>TW(e,r[e.id])),n).find(e=>e.id!==t&&e.needsYou===!0)}function g2(e){let t=h2(X.board?.threads??[],e);if(JE()){t&&window.addEventListener(`popstate`,()=>setTimeout(()=>Gh(t.id),0),{once:!0}),history.back();return}if(t){Gh(t.id);return}let n=X.drawers.filter(e=>!e.closing).map(e=>e.id);n.length&&ug(n)}var _2=new Map;async function v2(e,t={}){let n=e.id,r=t.terminateLive===!0,i=r||hK(e),a=YD(e),o=()=>{xW(n),g2(n),Z(`“${a}” marked done`,{action:{label:`Undo`,run:()=>void y2(n)}})};i&&o();let s=Y.completeThread({slug:n,sessionId:e.sessionId??``,terminateLive:r});_2.set(n,s);try{let e=await s;return e.needsConfirmation?(SW(n),i?(Z(e.hold?.cutOff?`Cut off mid-turn — open the thread to retry it, or to mark it done anyway`:`Still running — open the thread to finish it`,{link:{label:`Open`,slug:n}}),{kind:`declined`}):{kind:`needs-confirmation`,hold:e.hold}):(i||o(),{kind:`done`})}catch(e){return SW(n),Z(`Couldn’t finish: ${e.message.slice(0,80)}`,i?{link:{label:`Open`,slug:n}}:void 0),{kind:`failed`}}finally{_2.get(n)===s&&_2.delete(n)}}async function y2(e){await _2.get(e)?.catch(()=>void 0);try{await Y.setThreadState({slug:e,state:`open`}),SW(e),Gh(e)}catch(e){Z(`Couldn’t undo: ${e.message.slice(0,80)}`)}}function b2({thread:e,compact:t}){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(null);async function o(t){r(!0),t&&a(null);let n=await v2(e,{terminateLive:t});n.kind===`needs-confirmation`&&a({hold:n.hold}),n.kind!==`done`&&r(!1)}let s=gK(i?.hold);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`button`,{type:`button`,"data-phone-done":!0,onMouseDown:e=>e.preventDefault(),onClick:()=>void o(!1),disabled:n,"aria-label":`Mark as done`,className:`flex shrink-0 items-center justify-center gap-1 rounded-full bg-fg font-semibold text-bg disabled:opacity-45 ${t?`relative h-[36px] pl-[11px] pr-[14px] text-[14px] after:absolute after:inset-x-0 after:-inset-y-[4px] after:content-['']`:`h-[42px] pl-[13px] pr-[16px] text-[15px]`}`,children:[n&&!i?(0,R.jsx)(E_,{"aria-hidden":!0,size:t?15:17,className:`animate-spin`}):(0,R.jsx)(Jg,{"aria-hidden":!0,size:t?15:17,strokeWidth:2.6,className:`translate-y-[0.1em]`}),`Done`]}),(0,R.jsx)(rq,{open:i!==null,onOpenChange:e=>{!e&&!n&&a(null)},title:i?.hold?.cutOff?`Mark an unfinished thread done?`:`End this session?`,className:`w-[390px] max-w-[92vw]`,footer:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>a(null),className:`button-outline h-[40px] rounded-md px-4 text-[14px] text-muted outline-none disabled:opacity-45`,children:`Cancel`}),(0,R.jsxs)(`button`,{type:`button`,"data-phone-done-confirm":!0,disabled:n,onClick:()=>void o(!0),className:`button-outline flex h-[40px] items-center gap-1.5 rounded-md bg-fg px-4 text-[14px] font-medium text-bg outline-none disabled:opacity-45`,children:[n&&(0,R.jsx)(E_,{size:14,className:`animate-spin`}),i?.hold?.cutOff?`Mark done anyway`:`End session & mark done`]})]}),children:(0,R.jsxs)(`div`,{"data-completion-hold":!0,className:`flex flex-col gap-2 p-4 text-[14px] leading-relaxed text-muted`,children:[(0,R.jsx)(`p`,{children:s.lead}),s.groups.map(e=>(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,R.jsx)(`div`,{className:`text-[12px] font-medium text-fg/70`,children:e.heading}),(0,R.jsxs)(`ul`,{className:`flex flex-col gap-0.5`,children:[e.items.map((e,t)=>(0,R.jsxs)(`li`,{className:`min-w-0 truncate text-fg/80`,children:[e.label,e.stale&&(0,R.jsx)(`span`,{className:`text-muted-60`,children:` · no recent output`})]},`${e.label}-${t}`)),e.overflow>0&&(0,R.jsxs)(`li`,{className:`text-muted-60`,children:[`+`,e.overflow,` more`]})]})]},e.kind)),(0,R.jsx)(`p`,{children:s.trailer})]})})]})}var x2=new Map;function S2(e){let t=x2.get(e);if(t)return t;let n=Y.threadSkills({slug:e}).then(e=>e.skills,()=>(x2.delete(e),[]));return x2.set(e,n),n}function C2({slug:e,surface:t,placeholder:n,className:r,id:i,ops:a,above:o,submitOverride:s,phoneBarOverride:c,phoneChrome:l}){let u=gr(X),d=u.board?.threads.find(t=>t.id===e),f=ZV(),p=XV.followUp(f,e,d?.sessionId),[m,h,g]=$V(p),_=p2(e),v=$U(e),[y,b]=(0,L.useState)(null),x=(0,L.useMemo)(()=>()=>S2(e),[e]),[S,C]=(0,L.useState)(null),w=u.composerContext[e],T=(0,L.useMemo)(()=>w?.map(e=>e.token)??[],[w]);(0,L.useEffect)(()=>{let t=X.composerContext[e];if(!t?.length)return;let{prose:n}=fz(m),r=t.filter(e=>_z(n,e.token));r.length!==t.length&&(X.composerContext[e]=r)},[e,m,w]);let E=Ate(d,s!==void 0),D=Og(),O=(l??D)&&t===`chatComposer`,k=d?.runtime===`running`||d?.runtime===`spawning`,A=d?.lastFence?.kind===`awaiting`&&Gu(d.lastFence.hints).length>0,j=d?mK(d).archive&&!k&&!A:!1,M=d&&d.kind===`session`&&d.foreign!==!0?(0,R.jsx)(WK,{thread:d}):void 0;function N(t=!1){let n=m.trim();if(!n)return;let r=jV(n);if(r){if(g(),d?.backend===`acp`){Z(`An ACP agent signs in through its own CLI — Frizz holds no account for it`);return}let e=d?.backend===`codex`?`codex`:`claude`;r===`login`?b(e):C(e);return}let i=ag(e),a=Tte(n,i,f),o={onOptimistic:g,supersedes:A0(p,a),onRollback:t=>{JV(p,m),og(e,i),O0(p,{...t,text:m})}};s?s(a,o):v.submit(a,{...o,interrupt:t})}return O?(0,R.jsxs)(`div`,{"data-thread-composer-box":t,"data-thread-action-bar":``,"data-phone-thread-bar":``,children:[(0,R.jsx)(Tz,{contextTokens:T,id:i,surface:t,value:m,onChange:h,onSubmit:()=>N(),onInterruptSubmit:E?()=>N(!0):void 0,slashSuggest:x,placeholder:d?.foreign?n:k?`Steer…`:`Reply…`,busy:_.busy,phone:{layout:`bar`,tools:_.phoneTools,idlePrimary:j&&d?e=>(0,R.jsx)(b2,{thread:d,compact:e}):void 0,override:c,onLongPressSend:E?()=>N(!0):void 0}}),_.status,(0,R.jsx)(`div`,{className:`ops-column-optical-inset empty:hidden`,children:a}),y&&(0,R.jsx)(MV,{backend:y,onClose:()=>b(null),onAuthed:()=>b(null)}),S&&(0,R.jsx)(NV,{backend:S,onClose:()=>C(null)})]}):(0,R.jsxs)(`div`,{"data-thread-composer-box":t,...t===`chatComposer`?{"data-thread-action-bar":``}:{},className:r,children:[o,(0,R.jsx)(Tz,{contextTokens:T,id:i,surface:t,value:m,onChange:h,onSubmit:()=>N(),onInterruptSubmit:E?()=>N(!0):void 0,slashSuggest:x,placeholder:n,busy:_.busy,footer:_.footer,railLead:M}),_.status,(0,R.jsx)(`div`,{className:`ops-column-optical-inset empty:hidden`,children:a}),y&&(0,R.jsx)(MV,{backend:y,onClose:()=>b(null),onAuthed:()=>b(null)}),S&&(0,R.jsx)(NV,{backend:S,onClose:()=>C(null)})]})}function w2({slug:e,ops:t,phoneBarOverride:n,phoneChrome:r}){let i=gr(X).board?.threads.find(t=>t.id===e);return i?(0,R.jsx)(C2,{slug:e,surface:`chatComposer`,id:`followup-input`,placeholder:i.foreign?`Send a message to take over this session…`:`Follow up…`,className:`shrink-0 px-3 py-3`,ops:t,phoneBarOverride:n,phoneChrome:r}):null}function T2({slug:e,onClose:t}){let n=gg(wE(),e),[r,i]=(0,L.useState)(!1),a=VO(),o=FE(e,{poll:n?.runtime===`running`||n?.runtime===`spawning`}),s=(0,L.useMemo)(()=>LK(o.data?.messages??[]),[o.data]),c=yq(n);if(!n)return null;let l=jK(n),u=NK(n,l,s,a),d=l===`needs-you`?`font-semibold text-accent`:l===`working`?`font-semibold text-live`:``,f=YD(n);return(0,R.jsxs)(`header`,{"data-thread-header":!0,"data-mobile-thread-header":!0,className:`flex min-h-14 shrink-0 items-center gap-0.5 border-b border-border bg-panel py-1 pl-1 pr-[5px]`,children:[(0,R.jsx)(`button`,{type:`button`,"aria-label":`Back`,"data-mobile-thread-back":!0,onClick:()=>{JE()?history.back():t()},className:`flex size-11 shrink-0 items-center justify-center rounded-full text-fg/90 outline-none active:bg-hover focus-visible:bg-hover`,children:(0,R.jsx)(Gg,{size:21,strokeWidth:2.1})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1 pl-0.5 leading-[1.25]`,children:[(0,R.jsx)(`div`,{"data-mobile-thread-title":!0,className:`truncate text-[16.5px] font-semibold tracking-[-0.01em]`,title:f,children:f}),(0,R.jsxs)(`div`,{"data-mobile-thread-subtitle":!0,"data-state":l,className:`truncate text-[13px] text-muted`,children:[(0,R.jsx)(`span`,{className:d,children:MK[l]}),u&&(0,R.jsxs)(R.Fragment,{children:[` · `,u]}),c&&(0,R.jsxs)(R.Fragment,{children:[` · `,c]})]})]}),(0,R.jsx)(`button`,{type:`button`,"aria-label":`Thread actions`,"aria-haspopup":`dialog`,"aria-expanded":r,"data-mobile-thread-more":!0,onClick:()=>i(!0),className:`flex size-11 shrink-0 items-center justify-center rounded-full text-fg/90 outline-none active:bg-hover focus-visible:bg-hover`,children:(0,R.jsx)(l_,{size:21,strokeWidth:2.1})}),r&&(0,R.jsx)(lq,{slug:e,onClose:()=>i(!1),onArchived:()=>g2(e)})]})}function E2({thread:e}){let[t,n]=(0,L.useState)(!1);if(!OK(e))return null;async function r(){n(!0);try{await AK(e)}finally{n(!1)}}return(0,R.jsx)(VP,{label:`Reload plugins — hooks, skills, agents and MCP re-read from disk, same conversation`,side:`top`,children:(0,R.jsx)(`button`,{type:`button`,"data-reload-plugins":!0,disabled:t,"aria-label":`Reload plugins`,onMouseDown:e=>e.preventDefault(),onClick:()=>void r(),className:Rk,children:(0,R.jsx)(z_,{size:14,strokeWidth:2})})})}function D2({thread:e}){let t=qe(),[n,r]=(0,L.useState)(!1);return kK(e,DK())?(0,R.jsx)(VP,{label:`Restart worker — same conversation, fresh process on current tooling`,side:`top`,children:(0,R.jsx)(`button`,{type:`button`,disabled:n,"aria-label":`Restart worker`,onMouseDown:e=>e.preventDefault(),onClick:()=>{r(!0),EK(t,e.id).finally(()=>r(!1))},className:`${Rk} mx-[2px]`,children:n?(0,R.jsx)(E_,{size:14,strokeWidth:2,className:`animate-spin`}):(0,R.jsx)(V_,{size:14,strokeWidth:2})})}):null}function O2(e){return Lk(e)??HE(`/`)}function k2(e){qE(O2(e),{viewTransition:!Dh()})}function A2({slug:e,label:t=`Exit fullscreen`}){let n=O2(e);function r(t){om(t)&&(t.preventDefault(),k2(e))}return(0,R.jsx)(VP,{label:t,children:(0,R.jsx)(`a`,{href:n,"aria-label":t,"data-standalone-return":!0,onMouseDown:e=>e.preventDefault(),onClick:r,className:Rk,children:(0,R.jsx)(j_,{size:14})})})}function j2({thread:e,expand:t,collapse:n,onDoc:r,onDone:i,onCollapse:a,collapsed:o,doneBusy:s,onStatusMutate:c,onStatusApplied:l,onStatusFailed:u}){let d=e.kind===`session`;return(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[a&&(0,R.jsx)(N2,{label:o?`Expand`:`Collapse`,icon:o?$g:Qg,size:13,onClick:a}),(0,R.jsx)(E2,{thread:e}),(0,R.jsx)(D2,{thread:e}),r&&(0,R.jsx)(N2,{label:`Frizz document`,icon:f_,size:14,onClick:r}),t&&(0,R.jsx)(HP,{slug:e.id}),n&&(0,R.jsx)(A2,{slug:e.id}),d?SO(e)?(0,R.jsx)(M2,{slug:e.id}):null:(0,R.jsx)(`div`,{className:`ml-1`,children:(0,R.jsx)(mR,{slug:e.id,onDone:i,doneBusy:s,onMutateStart:c,onApplied:l,onFailed:u})})]})}function M2({slug:e}){let t=qe(),[n,r]=(0,L.useState)(!1);return(0,R.jsx)(VP,{label:`Retry — resume this session where it left off`,children:(0,R.jsxs)(`button`,{onClick:()=>{r(!0),eW(t,e).finally(()=>r(!1))},disabled:n,"aria-label":`Retry exited session`,"data-header-pill":!0,onMouseDown:e=>e.preventDefault(),className:`ml-1 flex items-center gap-1.5 rounded-md border border-accent/45 bg-accent/10 px-2.5 py-1 text-[12px] font-medium text-accent outline-none transition-colors hover:border-accent/70 hover:bg-accent/15 disabled:opacity-50`,children:[n?(0,R.jsx)(E_,{size:12,className:`animate-spin`}):(0,R.jsx)(U_,{size:12}),`Retry`]})})}function N2({label:e,icon:t,size:n,busy:r,...i}){return(0,R.jsx)(VP,{label:e,children:(0,R.jsx)(`button`,{...i,"aria-label":e,onMouseDown:e=>e.preventDefault(),className:Rk,children:r?(0,R.jsx)(E_,{size:n,strokeWidth:2,className:`animate-spin`}):(0,R.jsx)(t,{size:n,strokeWidth:2})})})}function P2({at:e,fallbackAt:t,className:n=``}){let r=VO(),i=EO(e,t),a=$ee(i,r);return!a||!i?null:(0,R.jsx)(`time`,{dateTime:i,className:n,children:a})}var F2=1.25,I2=7.5-F2/2,L2=2*Math.PI*I2;function R2(e,t){return Math.max(0,Math.min(100,Math.floor(e/t*100)))}var z2=150;function B2(e){return!!e.context&&e.context.window>0}function V2({thread:e}){let[t,n]=(0,L.useState)(!1),r=(0,L.useRef)(void 0),i=(0,L.useRef)(null),a=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>clearTimeout(r.current),[]);let o=e.context;if(!o||!B2(e))return null;let s=()=>{clearTimeout(r.current),n(!0)},c=()=>{clearTimeout(r.current),r.current=setTimeout(()=>n(!1),z2)},l=e=>{i.current?.contains(e.target)&&e.preventDefault()},u=G2(e,o.tokens),d=R2(o.tokens,o.window),f=Math.max(0,Math.min(1,o.tokens/o.window)),p=`Context ${d}% full`,m=`${o.tokens.toLocaleString()} of ${o.window.toLocaleString()} tokens`;return(0,R.jsxs)(XB,{open:t,onOpenChange:n,children:[(0,R.jsx)(QB,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,"data-context-meter":!0,"data-context-percent":d,"aria-label":`${p}\n${m}`,"aria-haspopup":`dialog`,"aria-expanded":t,onMouseEnter:s,onMouseLeave:c,onFocus:s,ref:i,onClick:e=>{e.stopPropagation(),s(),e.detail===0&&requestAnimationFrame(()=>a.current?.querySelector(`button:not(:disabled)`)?.focus())},className:`flex shrink-0 items-baseline gap-1 rounded-sm outline-none transition-colors hover:text-fg/85 focus-visible:ring-1 focus-visible:ring-focus-ink-60 ${t?`text-fg/85`:``}`,children:[(0,R.jsxs)(`svg`,{viewBox:`0 0 16 16`,className:`-mt-[1em] h-[1.05em] w-[1.05em] shrink-0 self-baseline translate-y-[calc(0.525em_-_0.5cap)]`,"aria-hidden":!0,children:[(0,R.jsx)(`circle`,{cx:`8`,cy:`8`,r:I2,fill:`none`,stroke:`currentColor`,strokeOpacity:.3,strokeWidth:F2}),(0,R.jsx)(`circle`,{cx:`8`,cy:`8`,r:I2,fill:`none`,stroke:`currentColor`,strokeWidth:F2,strokeDasharray:`${L2*f} ${L2}`,transform:`rotate(-90 8 8)`})]}),(0,R.jsxs)(`span`,{children:[d,`% context`]})]})}),(0,R.jsxs)($B,{side:`bottom`,align:`start`,sideOffset:5,ref:a,"data-context-panel":!0,"aria-label":p,onInteractOutside:e=>l({target:e.detail.originalEvent.target,preventDefault:()=>e.preventDefault()}),onMouseEnter:s,onMouseLeave:c,onOpenAutoFocus:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),className:`flex w-max max-w-[min(22rem,calc(100vw-1.5rem))] flex-col gap-2 px-3 py-2 text-[11px] leading-relaxed text-fg`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col`,children:[(0,R.jsx)(`span`,{children:p}),(0,R.jsx)(`span`,{className:`text-muted`,children:m})]}),jf(e)&&(0,R.jsx)(K2,{thread:e,compacting:u,onRequested:()=>n(!1)})]})]})}function H2(e){return e.runtime===`running`||e.runtime===`spawning`||e.runtime===`perm-prompt`}var U2=new Map,W2=2*6e4;function G2(e,t){let n=e.sessionId;if(!n)return!1;let r=U2.get(n);return r?!H2(e)&&(r.tokens!==t||e.lastActivityAt!==r.activity)||Date.now()-r.at>W2?(U2.delete(n),!1):!0:!1}function K2({thread:e,compacting:t,onRequested:n}){let[r,i]=(0,L.useState)(!1),a=e.context?.tokens??0,o=H2(e)&&!t;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`button`,{type:`button`,"data-compact-now":!0,disabled:o||r||t||!e.sessionId,onClick:()=>{let t=e.sessionId;t&&(i(!0),Y.compactThread({slug:e.id,sessionId:t}).then(()=>{U2.set(t,{tokens:a,activity:e.lastActivityAt,at:Date.now()}),Z(`Compacting context`),n()}).catch(e=>Z(`Couldn’t compact: ${e.message.slice(0,80)}`)).finally(()=>i(!1)))},onMouseDown:e=>e.preventDefault(),className:`flex items-center justify-center gap-1 rounded-md border border-border-strong bg-panel-2/60 px-2.5 py-1 text-[12px] font-medium text-fg/80 outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60 disabled:opacity-45 disabled:hover:bg-panel-2/60 disabled:hover:text-fg/80`,children:[(r||t)&&(0,R.jsx)(E_,{size:12,className:`animate-spin`}),t?`Compacting…`:`Compact now`]}),o&&(0,R.jsx)(`span`,{className:`text-muted`,children:`Available once the current turn ends`})]})}function q2({thread:e}){return(0,R.jsxs)(`div`,{"data-thread-header-facts":!0,className:`mt-0.5 flex min-w-0 items-center gap-1.5 text-[11px] leading-tight text-muted-75 empty:hidden`,children:[(0,R.jsx)(P2,{at:aO(e),fallbackAt:e.spawnedAt,className:`min-w-0 truncate`}),B2(e)&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`hidden shrink-0 text-muted-45 [time+&]:inline`,children:`·`}),(0,R.jsx)(V2,{thread:e})]})]})}function J2({thread:e,hidden:t=!1}){let n=pt({mutationFn:()=>Y.aiRenameThread({slug:e.id}),onSuccess:({title:e})=>Z(`Renamed to “${e}”`),onError:e=>Z(e instanceof Error?e.message:`Could not rename with Claude`,{duration:7e3})}),r=bK(e);if(!r.show||t)return null;let i=n.isPending?`Claude is generating a title…`:n.error instanceof Error?n.error.message:r.label,a=n.isPending||!!n.error;return(0,R.jsx)(VP,{label:i,children:(0,R.jsx)(`button`,{type:`button`,"data-ai-rename":!0,"aria-label":n.isPending?`Renaming with Claude`:r.label,"aria-busy":n.isPending,"aria-disabled":!r.enabled,onMouseDown:e=>e.preventDefault(),onClick:()=>{if(!n.isPending){if(!r.enabled){Z(r.label);return}n.reset(),n.mutate()}},className:`title-refresh-offset -mx-[7px] -my-3 flex h-6 w-6 shrink-0 items-center justify-center rounded-md outline-none transition-[color,background-color,opacity] focus-visible:opacity-100 group-hover/thread-title:opacity-100 ${a?`opacity-100`:`opacity-0`} ${n.error?`text-danger hover:bg-danger-fill/10`:r.enabled?`text-muted hover:bg-panel-2 hover:text-fg`:`cursor-not-allowed text-muted-50 hover:bg-panel-2`}`,children:n.isPending?(0,R.jsx)(E_,{size:12,className:`animate-spin`}):(0,R.jsx)(W_,{size:12})})})}function Y2({thread:e,className:t=``}){let n=e.id,r=pt({mutationFn:e=>Y.renameThread({slug:n,title:e})}),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(``),c=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(!i)return;let e=requestAnimationFrame(()=>{c.current?.focus(),c.current?.select()});return()=>cancelAnimationFrame(e)},[i]),(0,L.useEffect)(()=>{a(!1),s(``)},[n]);let l=e.kind===`session`&&e.foreign!==!0,u=YD(e);function d(){a(!1),s(``)}function f(){let e=vK(o,u);if(a(!1),!e){s(``);return}r.mutate(e,{onSuccess:()=>{s(``),Z(`Thread renamed`)},onError:t=>{s(e),a(!0),Z(t instanceof Error?t.message:`Could not rename thread`)}})}return(0,R.jsxs)(`div`,{className:`group/thread-title flex min-w-0 items-center gap-2`,children:[i?(0,R.jsx)(`input`,{ref:c,"aria-label":`Thread title`,value:o,maxLength:200,onChange:e=>s(e.target.value),onBlur:f,"data-claims-escape":!0,onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),d())},className:`min-w-0 flex-1 -mx-1.5 -my-px rounded-md border border-border bg-elevated px-1.5 py-0 font-semibold text-[15px] text-fg outline-none focus:border-accent ${t}`}):l?(0,R.jsx)(`button`,{type:`button`,title:`Edit title`,"aria-label":`Edit thread title: ${u}`,disabled:r.isPending,onClick:()=>{s(yK(u,n)),a(!0)},className:`min-w-0 max-w-full shrink truncate rounded px-0.5 -mx-0.5 font-semibold text-[15px] text-left outline-none transition-colors hover:bg-panel-2 focus-visible:ring-1 focus-visible:ring-focus-ink-60 disabled:cursor-not-allowed disabled:opacity-40 ${t}`,children:u}):(0,R.jsx)(`div`,{className:`min-w-0 max-w-full shrink truncate px-0.5 -mx-0.5 font-semibold text-[15px] ${t}`,title:u,children:u}),(0,R.jsx)(J2,{thread:e,hidden:i})]})}var X2=new Set([`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]);function Z2(e,t){let n=e.lastIndexOf(t);if(n<=0)return{model:e};let r=e.slice(n+1);return X2.has(r)?{model:e.slice(0,n),effort:r}:{model:e}}function Q2(e){let t=e?.trim();if(!t)return`Profile unknown`;if(t.startsWith(`frizz:`)){let{model:e,effort:n}=Z2(t.slice(6).replace(/^frizz-/,``),`-`);return n?`${e} › ${n}`:e}let n=t.split(/\s+/),{model:r,effort:i}=Z2(n.at(-1)??t,`/`);if(!i)return t;let a=n.slice(0,-1).join(` `);return`${a?`${a} · `:``}${r} › ${i}`}function $2(e){return e?.trim()?Q2(e):void 0}function e4(e){if(e.kind!==void 0||e.role!==`assistant`||e.text.trim())return;let t=e.parts??[],n=t.length>0?t.length===1&&t[0].kind===`tools`?t[0].tools:[]:e.tools??[],r=n.length===1?n[0]:void 0;return r?.agentCompletion?r:void 0}var t4={completed:`finished`,killed:`stopped`,failed:`failed`};function n4(e){let t=t4[e.agentStatus??`completed`],n=e.agentElapsedMs===void 0?void 0:tk(e.agentElapsedMs);return{outcome:t,tail:`${t}${n?` · ${n}`:``}`}}var r4=e=>e===void 0?void 0:XO(e),i4=e=>{if(e!==void 0)return tk(e)||void 0};function a4(e){let{agentStatus:t,agentElapsedMs:n,liveState:r,liveElapsedMs:i,status:a,durationMs:o}=e;if(t){let e=t===`killed`,r=t===`failed`,i=r4(n);return{label:t===`completed`?void 0:t4[t],duration:i4(n),tone:r?`failed`:`muted`,title:`${e?`Stopped`:r?`Failed`:`Ran for`}${e||r?` after`:``} ${i??`an unknown time`}`}}if(r){let e=r4(i);return{label:void 0,duration:i4(i),tone:`muted`,title:r===`running`?`Working for ${e??`an unknown time`}`:`Dispatched ${e??`an unknown time`} ago`}}if(a===`pending`||a!==`failed`&&a!==`cancelled`)return null;let s=a===`failed`,c=a===`cancelled`,l=r4(o);return{label:c?t4.killed:s?t4.failed:void 0,duration:i4(o),tone:s?`failed`:`muted`,title:`${c?`Stopped after`:s?`Failed after`:`Ran for`} ${l??`an unknown time`}`}}var o4=`group flex min-w-0 items-baseline gap-1.5 rounded-sm text-left text-[11.5px] outline-none focus-visible:ring-1 focus-visible:ring-focus-ink-60`,s4=`${ck} -mt-[1em] self-baseline`,c4=`h-[1em] w-[1em] shrink-0 translate-y-[calc(0.5em_-_0.5cap)] text-muted-45`;function l4({links:e}){return e.length?(0,R.jsx)(`div`,{"data-thread-links":!0,"aria-label":`Registered links`,className:`mt-2 flex min-w-0 flex-col gap-0.5 border-t border-border pt-1.5`,children:e.map(e=>{let t=e.kind===`link`,n=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:ok,children:`⤷`}),(0,R.jsx)(`span`,{className:s4,children:(0,R.jsx)(t?u_:f_,{"aria-hidden":!0,className:c4})}),(0,R.jsx)(`span`,{"data-link-kind":!0,className:sk,children:t?`Link`:`File`}),(0,R.jsx)(`span`,{"data-link-label":!0,className:`min-w-0 flex-1 truncate text-muted-70 group-hover:text-fg/80 group-hover:underline`,children:e.label}),t&&(0,R.jsx)(`span`,{"data-link-destination":!0,className:`font-mono-keep ml-auto -mb-[0.5em] max-w-[45%] min-w-0 truncate text-right text-[10px] text-muted-45`,children:e.target})]});return t?(0,R.jsx)(`a`,{"data-thread-link":e.id,href:e.target,target:`_blank`,rel:`noopener noreferrer`,title:e.target,className:o4,onClick:e=>e.stopPropagation(),children:n},e.id):(0,R.jsx)(`button`,{"data-thread-link":e.id,type:`button`,title:e.target,className:`${o4} cursor-pointer`,onClick:t=>{t.stopPropagation(),wK(e.target)},children:n},e.id)})}):null}function u4({at:e,host:t}){let n=tte(e);return!n||!e?null:(0,R.jsx)(`time`,{dateTime:e,"aria-hidden":`true`,className:`!pointer-events-none absolute right-6 top-full z-10 ${t===`bubble`?`mt-[2px]`:`-mt-[5px]`} select-none text-[11px] leading-4 [font-variant-numeric:tabular-nums] text-muted-70 opacity-0 transition-opacity group-hover/ts:opacity-100`,children:n})}function d4({at:e,host:t,gap:n,children:r}){return(0,R.jsxs)(`div`,{className:`group/ts relative flex flex-col px-6`,style:{paddingTop:n},children:[r,(0,R.jsx)(u4,{at:e,host:t})]})}var f4=`text-[14px] leading-5 text-muted`,p4=`size-[1em] shrink-0 self-baseline -mt-[calc(1em_-_1cap)] translate-y-[calc(0.5em_-_0.5cap)] text-muted-70 transition-transform group-hover:text-fg`;function m4(e){return`${p4} ${e?`-mx-[0.208em] rotate-90`:`-mx-[0.333em]`}`}var $=L.createElement;function h4({payload:e}){return e.kind===`command-approval`?$(L.Fragment,null,$(`div`,{className:`text-[12px] text-muted`},`Command`),$(`div`,{className:`mt-0.5 break-words text-[13px] font-medium text-fg`},e.command.summary),e.command.workingDirectoryLabel?$(`div`,{className:`mt-1 break-all text-[10.5px] text-muted-70`},`Working directory: `,e.command.workingDirectoryLabel):null,$(g4,{label:`Redacted command preview`,text:e.command.preview}),e.command.actions?$(_4,{actions:e.command.actions}):null,e.capabilities?$(y4,{capabilities:e.capabilities}):null):e.kind===`file-approval`?$(L.Fragment,null,$(`div`,{className:`text-[12px] text-muted`},C4(e.operation)),$(`div`,{className:`mt-0.5 break-all font-mono-keep text-[12px] text-fg`},e.pathLabel),e.destinationLabel?$(`div`,{className:`mt-1 break-all font-mono-keep text-[11px] text-muted`},`→ `,e.destinationLabel):null,e.grantRootLabel?$(`section`,{"aria-label":`Requested session write root`,className:`mt-2.5 min-w-0 rounded-md border border-attention/35 bg-attention-fill/[0.06] px-2.5 py-2`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-attention-soft-80`},`Requested session write root`),$(`div`,{className:`mt-1 min-w-0 break-all font-mono-keep text-[10.5px] text-fg/85`},e.grantRootLabel),e.scopeLabel?$(`div`,{className:`mt-1.5 whitespace-pre-wrap break-words text-[10.5px] leading-snug text-attention-soft-75`},e.scopeLabel):null):null,e.diffPreview?$(g4,{label:`Plain-text diff preview`,text:e.diffPreview}):null,e.changes?$(v4,{changes:e.changes}):null):$(L.Fragment,null,e.preview?$(`pre`,{className:`max-h-64 max-w-full min-w-0 overflow-auto rounded-md border border-border/70 bg-bg/40 px-2.5 py-2 whitespace-pre-wrap break-words font-mono-keep text-[11.5px] leading-relaxed text-fg/90`},e.promptLabel?$(`span`,{className:`text-shell/90`},e.promptLabel):null,e.promptLabel?$(`span`,{className:`text-accent`},` ❯ `):null,e.preview):null,e.resourceLabel?$(`div`,{className:`mt-1 break-all text-[11px] text-muted`},`Resource: `,e.resourceLabel):null,e.workingDirectoryLabel?$(`div`,{className:`mt-1.5 break-all text-[10.5px] text-muted-70`},`Working directory: `,e.workingDirectoryLabel):null,e.scopeLabel?$(`div`,{className:`mt-2 whitespace-pre-wrap break-words text-[11px] leading-snug text-muted`},e.scopeLabel):null,e.capabilities?$(y4,{capabilities:e.capabilities}):null)}function g4({label:e,text:t}){return $(`details`,{className:`mt-2.5 min-w-0 rounded-md border border-border/70 bg-bg/35`,open:t.length<1200},$(`summary`,{className:`cursor-pointer px-2.5 py-2 text-[10.5px] text-muted outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-50`},e),$(`pre`,{className:`max-h-64 max-w-full min-w-0 overflow-auto border-t border-border/60 px-2.5 py-2 whitespace-pre-wrap break-words font-mono-keep text-[11px] leading-relaxed text-fg/80`},t))}function _4({actions:e}){return $(`section`,{"aria-label":`Parsed command actions`,className:`mt-3 min-w-0`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-muted-75`},`Parsed actions`),$(`ul`,{className:`mt-1.5 flex min-w-0 flex-col gap-2`},e.map((e,t)=>$(`li`,{key:t,className:`min-w-0 rounded-md border border-border/65 bg-bg/25 px-2.5 py-2`},$(`div`,{className:`text-[11px] font-medium text-fg/90`},S4(e.kind)),e.resourceLabel?$(`div`,{className:`mt-0.5 break-all font-mono-keep text-[10.5px] text-muted`},e.resourceLabel):null,e.queryLabel?$(`div`,{className:`mt-0.5 break-all text-[10.5px] text-muted`},`Query: `,e.queryLabel):null,$(g4,{label:`${S4(e.kind)} command detail`,text:e.commandPreview})))))}function v4({changes:e}){return $(`section`,{"aria-label":`Affected file changes`,className:`mt-3 min-w-0`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-muted-75`},`Affected changes`),$(`ol`,{className:`mt-1.5 flex min-w-0 flex-col gap-2`},e.map((e,t)=>$(`li`,{key:t,className:`min-w-0 rounded-md border border-border/65 bg-bg/25 px-2.5 py-2`},$(`div`,{className:`text-[11px] font-medium text-fg/90`},C4(e.operation)),$(`div`,{className:`mt-0.5 break-all font-mono-keep text-[10.5px] text-fg/80`},e.pathLabel),e.destinationLabel?$(`div`,{className:`mt-0.5 min-w-0 break-all font-mono-keep text-[10.5px] text-muted`},`→ `,e.destinationLabel):null,e.diffPreview?$(g4,{label:`${C4(e.operation)} plain-text diff`,text:e.diffPreview}):null))))}function y4({capabilities:e}){return $(`section`,{"aria-label":`Requested capabilities`,className:`mt-3 min-w-0`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-muted-75`},`Requested capabilities`),$(`ul`,{className:`mt-1.5 flex min-w-0 flex-col gap-2`},e.map((e,t)=>$(`li`,{key:t,className:`min-w-0 rounded-md border border-border/65 bg-bg/25 px-2.5 py-2`},$(b4,{capability:e})))))}function b4({capability:e}){if(e.kind===`network`){let t=e.enabled===!0?`Enable network access`:e.enabled===!1?`Disable network access`:`Network access request`;return $(L.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},t),e.hosts.length>0?$(x4,{label:`Hosts and protocols`,values:e.hosts}):null)}if(e.kind===`filesystem`){let t=e.access===`read`?`Read filesystem paths`:e.access===`write`?`Write filesystem paths`:`Deny filesystem paths`;return $(L.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},t),$(x4,{label:`Paths`,values:e.resources}))}return e.kind===`glob-scan`?$(L.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},`Filesystem glob scanning`),$(`div`,{className:`mt-0.5 text-[10.5px] text-muted`},`Maximum depth: `,String(e.depth))):e.kind===`exec-policy`?$(L.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},`Future command policy amendment`),$(x4,{label:`Command prefix tokens`,values:e.prefixes})):$(L.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},e.access===`allow`?`Allow future network hosts`:`Deny future network hosts`),$(x4,{label:`Hosts`,values:e.hosts}))}function x4({label:e,values:t}){return $(`div`,{className:`mt-1 min-w-0`},$(`div`,{className:`sr-only`},e),$(`ul`,{"aria-label":e,className:`flex min-w-0 flex-col gap-0.5`},t.map((e,t)=>$(`li`,{key:t,className:`min-w-0 break-all font-mono-keep text-[10.5px] text-muted`},e))))}function S4(e){switch(e){case`read`:return`Read a file`;case`list-files`:return`List files`;case`search`:return`Search files`;case`unknown`:return`Unclassified command`}}function C4(e){switch(e){case`read`:return`Read file`;case`create`:return`Create file`;case`write`:return`Modify file`;case`move`:return`Move file`;case`delete`:return`Delete file`;case`execute`:return`Execute file`;case`other`:return`File operation`}}function w4(e){return e===`sending`?{actionsEnabled:!1,status:`Sending to runtime…`}:e===`reconnect-required`?{actionsEnabled:!1,status:`Runtime reconnect required before this request can be answered.`}:{actionsEnabled:!0}}var T4={semantic:`approve`,label:`Approve once`,order:10,tone:`primary`,durable:!1,scope:`Applies only to this request.`},E4={semantic:`approve`,label:`Approve for session`,order:20,tone:`primary`,durable:!0,scope:`Persists for later matching requests in this thread session.`},D4={semantic:`approve`,label:`Grant for turn`,order:10,tone:`primary`,durable:!1,scope:`Applies to this turn only.`},O4={semantic:`approve`,label:`Grant for session`,order:20,tone:`primary`,durable:!0,scope:`Persists until this thread session ends.`},k4={semantic:`deny`,label:`Deny`,order:70,tone:`danger`,durable:!1,scope:`Rejects this request.`},A4={semantic:`decline`,label:`Decline`,order:70,tone:`danger`,durable:!1,scope:`Declines this request.`},j4={semantic:`cancel`,label:`Cancel request`,order:80,tone:`neutral`,durable:!1,scope:`Cancels this pending request.`};function M4(e,t){let{id:n,semantic:r}=t;if(e.kind===`command-approval`||e.kind===`file-approval`)return(n===`accept`||n===`approve-once`)&&r===`approve`?T4:n===`acceptForSession`&&r===`approve`?E4:(n===`decline`||n===`deny`)&&r===`deny`?k4:n===`cancel`&&r===`cancel`?j4:void 0;if(e.kind===`permission-approval`)return n===`grant-turn`&&r===`approve`?D4:n===`grant-session`&&r===`approve`?O4:(n===`deny`||n===`decline`)&&r===`deny`?k4:n===`cancel`&&r===`cancel`?j4:void 0;if(e.kind===`mcp-elicitation-form`||e.kind===`mcp-elicitation-url`)return n===`accept`&&r===`accept`?{semantic:`accept`,label:e.kind===`mcp-elicitation-form`?`Submit`:`Continue`,order:10,tone:`primary`,durable:!1,scope:`Applies only to this request.`}:n===`decline`&&r===`decline`?A4:n===`cancel`&&r===`cancel`?j4:void 0;if(n===`answer`&&r===`answer`)return{semantic:`answer`,label:`Send answer`,order:10,tone:`primary`,durable:!1,scope:`Sends these answers to this request only.`};if(n===`decline`&&r===`decline`)return A4;if(n===`cancel`&&r===`cancel`)return j4}function N4(e){let t=t=>e.payload.kind===`mcp-elicitation-form`&&t===`accept`||e.payload.kind===`agent-question`&&t===`answer`;return e.allowedDecisions.flatMap(n=>{let r=M4(e.payload,n);return r?[{...r,id:n.id,semantic:n.semantic,requiresValues:t(n.semantic)}]:[]}).sort((e,t)=>e.order-t.order||e.id.localeCompare(t.id))}function P4(e){switch(e){case`claude`:return`Claude`;case`codex`:return`Codex`;case`acp`:return`ACP agent`;case`frizz`:return`Frizz`}}function F4(e){switch(e){case`runtime`:return`Runtime`;case`agent`:return`Agent`;case`tool`:return`Tool`;case`mcp-server`:return`MCP server`;case`frizz`:return`Frizz`}}function I4(e,t){let n=e.options.findIndex(e=>JSON.stringify(e.value)===JSON.stringify(t));return n<0?``:String(n)}function L4(e){let t=Object.create(null);for(let n of e)if(n.input===`text`||n.input===`multiline`)t[n.id]=n.default??``;else if(n.input===`number`||n.input===`integer`)t[n.id]=n.default===void 0?``:String(n.default);else if(n.input===`boolean`)t[n.id]=n.default??!1;else if(n.input===`select`)t[n.id]=n.default===void 0?``:I4(n,n.default);else if(n.input===`multi-select`){let e=new Set(n.default??[]);t[n.id]=n.options.flatMap((t,n)=>e.has(t.value)?[String(n)]:[])}return t}function R4(e,t,n){let r=Object.create(null);for(let t of Object.keys(e))r[t]=e[t];return r[t]=n,r}function z4(e,t){if(e.some(e=>e.secret))return{errors:{},formError:`Secret responses cannot be sent through this Frizz connection.`};let n=Object.create(null),r={};for(let i of e){let e=t[i.id],a;if(i.input===`text`||i.input===`multiline`){let t=typeof e==`string`?e:``;if(!i.required&&t===``)continue;i.required&&t===``?r[i.id]=`This field is required.`:a=t}else if(i.input===`number`||i.input===`integer`){let t=typeof e==`string`?e.trim():``;if(!i.required&&t===``)continue;if(t===``)r[i.id]=`This field is required.`;else{let e=Number(t);Number.isFinite(e)?a=e:r[i.id]=`Enter a valid number.`}}else if(i.input===`boolean`)a=e===!0;else if(i.input===`select`){let t=typeof e==`string`&&/^\d+$/.test(e)?Number(e):-1;if(t<0||t>=i.options.length)if(i.required)r[i.id]=`Choose an option.`;else continue;else a=i.options[t].value}else if(i.input===`multi-select`){let t=(Array.isArray(e)?e:[]).flatMap(e=>/^\d+$/.test(e)?[Number(e)]:[]);if(t.some(e=>e<0||e>=i.options.length))r[i.id]=`Choose only advertised options.`;else if(i.required&&t.length===0)r[i.id]=`Choose at least one option.`;else if(t.length>0)a=t.map(e=>i.options[e].value);else continue}if(a!==void 0&&!r[i.id]){let e=Tl(i,a);e?r[i.id]=`Value ${e}.`:n[i.id]=a}}if(Object.keys(r).length>0)return{errors:r};let i=zl.safeParse(n);return i.success?{errors:r,values:i.data}:{errors:r,formError:`The response is too large or contains invalid values.`}}function B4(e,t){return JSON.stringify([e,t??null])}function V4(e,t){try{let n=new URL(e,t);return n.protocol===`http:`||n.protocol===`https:`?n.toString():null}catch{return null}}function H4(e,t){let n=e.getAttribute(`href`);if(!n)return!1;let r=V4(n,t);if(!r)return!1;let i;try{i=new URL(t)}catch{return!1}if(new URL(r).origin===i.origin)return!1;e.setAttribute(`target`,`_blank`);let a=new Set((e.getAttribute(`rel`)??``).split(/\s+/u).filter(Boolean));return a.add(`noopener`),a.add(`noreferrer`),e.setAttribute(`rel`,[...a].join(` `)),!0}function U4(e=()=>location.href){return t=>{if(t.defaultPrevented||t.button!==0)return;let n=G4(t);n&&H4(n,e())}}function W4(){let e=U4();return document.addEventListener(`click`,e,!0),()=>document.removeEventListener(`click`,e,!0)}function G4(e){let t=typeof e.composedPath==`function`?e.composedPath():[];for(let e of t)if(K4(e))return e;let n=e.target?.closest?.(`a[href]`);return K4(n)?n:null}function K4(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.tagName?.toLowerCase()===`a`&&typeof t.getAttribute==`function`&&typeof t.setAttribute==`function`&&typeof t.hasAttribute==`function`&&t.hasAttribute(`href`)}function q4(e){let t=e,n=``;do n=String.fromCharCode(65+t%26)+n,t=Math.floor(t/26)-1;while(t>=0);return`${n}.`}function J4(e,t){let n=e??t;if(!n)return null;let r=e&&(e.input===`select`||e.input===`multi-select`)?e.options:[];return{question:{kind:e?.input===`multi-select`?`multi`:`question`,danger:!1,contextMd:n.description??n.label,options:r.map((e,t)=>`${q4(t)} ${e.label}`),recommendedIdx:null},...e?{optionFieldId:e.id}:{},optionValues:r.map(e=>e.value),...t?{notesFieldId:t.id}:{}}}function Y4(e){if(e.payload.kind!==`agent-question`)return null;let t=e.payload.fields,n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.secret)return null;if(r.id.endsWith(`_notes`))continue;let i=t[e+1],a=i&&i.id===`${r.id}_notes`?i:void 0;if(r.input===`select`||r.input===`multi-select`){let e=J4(r,a);if(!e)return null;n.push(e)}else if(r.input===`text`||r.input===`multiline`){let e=J4(void 0,r);if(!e)return null;n.push(e)}else return null}return n.length>0?n:null}function X4(e,t){let n=[],r;if(t){let i=e.multiSelect?t.split(`, `):[t];e.options.forEach((e,t)=>{i.includes(e.label)&&n.push(t)}),n.length===0&&(r=t)}return{question:{kind:e.multiSelect?`multi`:`question`,danger:!1,contextMd:e.question,options:e.options.map((e,t)=>`${q4(t)} ${e.label}${e.description?` — ${e.description}`:``}`),recommendedIdx:null},chosenIdxs:n,text:r}}function Z4(e,t){let n={};return e.forEach((e,r)=>{let i=t[r];if(!i)return;let a=i.text.trim();if(e.question.kind===`multi`){let t=(i.chosenSet??[]).slice().sort((e,t)=>e-t).flatMap(t=>{let n=e.optionValues[t];return n===void 0?[]:[n]});e.optionFieldId&&t.length>0&&(n[e.optionFieldId]=t),e.notesFieldId&&a&&(n[e.notesFieldId]=a);return}let o=i.chosen;if(e.optionFieldId&&o!==null&&e.optionValues[o]!==void 0){n[e.optionFieldId]=e.optionValues[o];return}a&&e.notesFieldId&&(n[e.notesFieldId]=a)}),Object.keys(n).length>0?n:void 0}function Q4(e){let t=e instanceof Error?e.message:`The request could not be updated.`;return t.length>240?`${t.slice(0,239)}…`:t}function $4(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`frizz-response-${Date.now()}-${Math.random().toString(36).slice(2)}`}function e3({thread:e,className:t=``,autoFocusFirst:n=!1}){let r=kE(e),i=Jee(e),a=(0,L.useMemo)(()=>[...i.data?.interactions??[]].sort((e,t)=>e.createdAt.localeCompare(t.createdAt)||e.id.localeCompare(t.id)),[i.data?.interactions]);return r?i.isError&&a.length===0?(0,R.jsxs)(`div`,{"data-interactions-error":!0,role:`alert`,className:`${TQ} border border-attention-fill/35 bg-attention-fill/[0.07] p-4 text-[12px] text-attention-soft ${t}`,children:[(0,R.jsx)(`div`,{className:`font-medium`,children:`Pending requests could not be loaded.`}),(0,R.jsx)(`div`,{className:`mt-1 break-words text-attention-soft-75`,children:Q4(i.error)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void i.refetch(),className:`mt-2 rounded-md border border-attention/40 px-2 py-1 text-[11px] hover:bg-attention-fill/10`,children:`Try again`})]}):a.length===0?null:(0,R.jsx)(`section`,{"data-typed-interactions":!0,"aria-label":`${a.length} pending request${a.length===1?``:`s`}`,className:`flex min-w-0 flex-col gap-3 ${t}`,children:a.map((e,t)=>(0,R.jsx)(n3,{record:e,autoFocus:n&&t===0,siblings:a},e.id))}):null}function t3({record:e,questions:t,autoFocus:n,siblings:r}){let i=qe(),a=o3(e,r),o=(0,L.useRef)(null),s=(0,L.useRef)(new Map),c=ZV(),l=w4(e.delivery?.effect),u=(0,L.useMemo)(()=>N4(e).find(e=>e.semantic===`answer`),[e]),d=eH(t.flatMap(t=>t.notesFieldId?[XV.interaction(c,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId)]:[])),[f,p]=(0,L.useState)(()=>t.map(()=>({chosen:null,chosenSet:[]}))),m=t.map((t,n)=>({chosen:f[n]?.chosen??null,chosenSet:f[n]?.chosenSet??[],text:t.notesFieldId?d.get(XV.interaction(c,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId))??``:``})),h=Z4(t,m),[g,_]=(0,L.useState)(),[v,y]=(0,L.useState)(!1);(0,L.useEffect)(()=>{if(!n)return;let e=document.activeElement;e&&e!==document.body||requestAnimationFrame(()=>o.current?.focus())},[n,e.id]);let b=pt({mutationFn:async t=>Y.interactionResolve({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id,sessionEpoch:e.owner.sessionEpoch,capabilityRevision:e.owner.capabilityRevision,expectedRecordRevision:e.recordRevision,responseId:t.responseId,decisionId:t.decisionId,values:t.values}),onSuccess:t=>{y(!0),vC(i,t.interaction),i.invalidateQueries({queryKey:gC(e.owner.threadSlug,e.owner.sessionId)}),i.invalidateQueries({queryKey:_C(e.owner.threadSlug,e.owner.sessionId,e.id)})},onError:t=>{yC(i,e),a.rollback(),_(Q4(t))}}),x=()=>{if(!u||!h||b.isPending||v||!l.actionsEnabled)return;_(void 0);let e=B4(u.id,h),t=s.current.get(e)??$4();s.current.set(e,t),a.release(!0),b.mutate({decisionId:u.id,values:h,responseId:t})},S=(t,n)=>{t.notesFieldId&&qV.set(XV.interaction(c,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId),n)};return(0,R.jsxs)(`article`,{ref:o,tabIndex:-1,"data-interaction-id":e.id,"data-interaction-kind":e.payload.kind,"data-interaction-question":`native`,"data-delivery-effect":e.delivery?.effect,className:`flex min-w-0 flex-col gap-2 outline-none`,children:[t.map((e,t)=>(0,R.jsx)(g1,{question:e.question,interactive:l.actionsEnabled&&!v?{answer:m[t],onChip:n=>{p(r=>r.map((r,i)=>{if(i!==t)return r;if(e.question.kind===`multi`){let e=r.chosenSet.includes(n)?r.chosenSet.filter(e=>e!==n):[...r.chosenSet,n];return{...r,chosenSet:e}}return{...r,chosen:r.chosen===n?null:n}}))},onText:n=>{S(e,n),e.question.kind!==`multi`&&p(e=>e[t]?.chosen===null||e[t]===void 0?e:e.map((e,n)=>n===t?{...e,chosen:null}:e))},onSubmit:x}:void 0},e.optionFieldId??e.notesFieldId??t)),g&&(0,R.jsx)(`div`,{role:`alert`,className:`break-words text-[11px] leading-snug text-danger-soft`,children:g}),(l.status||b.isPending||v)&&(0,R.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`text-[11px] leading-snug text-muted`,children:l.status??(v?`Answer sent.`:`Sending…`)}),l.actionsEnabled&&!v&&(0,R.jsx)(`div`,{className:`flex justify-start`,children:(0,R.jsx)(`button`,{type:`button`,"data-send-answers":!0,disabled:!h||b.isPending,onClick:x,onMouseDown:e=>e.preventDefault(),className:`button-outline rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-all hover:opacity-90 active:scale-95 disabled:opacity-30 disabled:hover:opacity-30`,children:`Send answers`})})]})}function n3({record:e,autoFocus:t=!1,siblings:n}){let r=(0,L.useMemo)(()=>Y4(e),[e]),i=n??[e];return r?(0,R.jsx)(t3,{record:e,questions:r,autoFocus:t,siblings:i}):(0,R.jsx)(s3,{record:e,autoFocus:t,siblings:i})}function r3(e){return e.semantic!==`cancel`}var i3=new Set,a3=new Set;function o3(e,t){let n=(0,L.useContext)(r8),r=e.owner.threadSlug;return{release:i=>{i3.add(e.id),i&&t.every(t=>t.id===e.id||i3.has(t.id)||t.delivery?.effect===`sending`)&&(a3.add(r),FU(r),n?.dismiss())},rollback:()=>{i3.delete(e.id),a3.delete(r)&&(IU(r),n?.cancel())}}}function s3({record:e,autoFocus:t=!1,siblings:n}){let r=qe(),i=o3(e,n),a=(0,L.useId)(),o=(0,L.useRef)(null),s=(0,L.useRef)(new Map),c=e.payload.kind===`mcp-elicitation-form`||e.payload.kind===`agent-question`?e.payload.fields:[],l=c.some(e=>e.secret),u=ZV(),d=c.filter(e=>!e.secret&&(e.input===`text`||e.input===`multiline`)).map(t=>XV.interaction(u,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.id)),f=eH(d),[p,m]=(0,L.useState)(()=>L4(c)),h=(0,L.useMemo)(()=>{let t={...p};return c.forEach(n=>{if(!n.secret&&(n.input===`text`||n.input===`multiline`)){let r=XV.interaction(u,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,n.id);t[n.id]=f.get(r)??``}}),t},[c,p,f,u,e.id,e.owner]),[g,_]=(0,L.useState)({}),[v,y]=(0,L.useState)(),[b,x]=(0,L.useState)(),[S,C]=(0,L.useState)(!1),[w,T]=(0,L.useState)(),[E,D]=(0,L.useState)(!1),O=w4(e.delivery?.effect),k=(0,L.useMemo)(()=>N4(e),[e]).filter(e=>!(l&&e.requiresValues)),A=e.allowedDecisions.length-k.length,j=(0,L.useCallback)(t=>{for(let n of c)if(!n.secret&&(n.input===`text`||n.input===`multiline`)){let r=t[n.id];typeof r==`string`&&qV.set(XV.interaction(u,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,n.id),r)}m(t)},[c,u,e.id,e.owner]);(0,L.useEffect)(()=>{if(!t)return;let e=document.activeElement;e&&e!==document.body||requestAnimationFrame(()=>o.current?.focus())},[t,e.id]),(0,L.useEffect)(()=>{O.actionsEnabled||(T(void 0),D(!1))},[O.actionsEnabled]);let M=pt({mutationFn:async({decision:t,values:n,responseId:r})=>{if(t.semantic===`cancel`&&e.provider.kind===`frizz`){let t=await Y.interactionCancel({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id,sessionEpoch:e.owner.sessionEpoch,capabilityRevision:e.owner.capabilityRevision,expectedRecordRevision:e.recordRevision});return{effect:t.effect,interaction:t.interaction,waitingForProvider:!1}}let i=await Y.interactionResolve({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id,sessionEpoch:e.owner.sessionEpoch,capabilityRevision:e.owner.capabilityRevision,expectedRecordRevision:e.recordRevision,responseId:r,decisionId:t.id,...n===void 0?{}:{values:n}});return{effect:i.effect,interaction:i.interaction,waitingForProvider:i.interaction.delivery?.effect===`sending`||i.effect===`queued`||i.effect===`already-queued`}},onSuccess:(t,n)=>{t.waitingForProvider||s.current.delete(B4(n.decision.id,n.values)),y(void 0),T(void 0),D(!1),C(!0),d.forEach(e=>qV.clear(e)),x(t.waitingForProvider?`Response sent. Waiting for the provider to acknowledge it…`:`Request completed.`),vC(r,t.interaction),r.setQueryData(_C(e.owner.threadSlug,e.owner.sessionId,e.id),{interaction:t.interaction}),r.invalidateQueries({queryKey:gC(e.owner.threadSlug,e.owner.sessionId),exact:!0}),t.waitingForProvider&&window.setTimeout(()=>{r.invalidateQueries({queryKey:gC(e.owner.threadSlug,e.owner.sessionId),exact:!0})},1e3)},onError:t=>{x(void 0),i.rollback(),y(Q4(t)),yC(r,e),Y.interactionGet({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id}).then(({interaction:t})=>{vC(r,t),r.setQueryData(_C(e.owner.threadSlug,e.owner.sessionId,e.id),{interaction:t}),t.delivery?.effect===`sending`?(y(void 0),x(void 0),C(!0)):t.delivery?.effect===`reconnect-required`?(y(void 0),x(void 0)):(t.lifecycle!==`pending`||t.recordRevision!==e.recordRevision)&&(y(void 0),x(t.lifecycle===`expired`?`This request expired.`:`This request changed in another client.`),r.invalidateQueries({queryKey:gC(e.owner.threadSlug,e.owner.sessionId),exact:!0})),r.invalidateQueries({queryKey:gC(e.owner.threadSlug,e.owner.sessionId),exact:!0})}).catch(()=>{})}});function N(e){if(!e.requiresValues){_({});return}let t=z4(c,h);return _(t.errors),t.formError?(y(t.formError),null):t.values?t.values:null}function P(e,t=!1){if(!O.actionsEnabled||M.isPending||S)return;y(void 0);let n=N(e);if(n===null)return;if(e.durable&&!t){T(e),D(!1);return}let r=B4(e.id,n),a=s.current.get(r)??$4();s.current.set(r,a),i.release(r3(e)),M.mutate({decision:e,values:n,responseId:a})}let F=k.find(e=>e.requiresValues&&e.tone===`primary`);function I(e){e.preventDefault(),O.actionsEnabled&&F&&P(F)}return(0,R.jsxs)(`article`,{ref:o,tabIndex:-1,"aria-labelledby":a,"data-interaction-id":e.id,"data-interaction-kind":e.payload.kind,"data-delivery-effect":e.delivery?.effect,className:`min-w-0 ${TQ} border border-question-border bg-question outline-none focus-visible:ring-2 focus-visible:ring-focus-accent-60`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 border-b border-question-border px-4 py-3`,children:[(0,R.jsx)(K_,{"aria-hidden":`true`,size:16,className:`shrink-0 text-accent`}),(0,R.jsx)(`h3`,{id:a,className:`min-w-0 flex-1 break-words text-[14px] font-semibold leading-snug text-fg`,children:e.payload.title})]}),(0,R.jsx)(`form`,{onSubmit:I,onKeyDown:e=>{e.target instanceof HTMLButtonElement||xz({key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing,keyCode:e.nativeEvent.keyCode})&&(e.preventDefault(),O.actionsEnabled&&F&&P(F))},className:`min-w-0 px-4 py-3.5`,noValidate:!0,children:(0,R.jsxs)(`fieldset`,{disabled:!O.actionsEnabled,className:`min-w-0 border-0 p-0`,children:[(0,R.jsx)(`legend`,{className:`sr-only`,children:`Interaction request`}),(0,R.jsx)(l3,{record:e,instanceId:a,draft:h,setDraft:j,errors:g,autoFocus:t}),l&&(0,R.jsxs)(`div`,{"data-secret-fallback":!0,className:`mt-3 rounded-md border border-attention-fill/35 bg-attention-fill/[0.07] p-3 text-[12px] leading-snug text-attention-soft-90`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(T_,{"aria-hidden":`true`,size:14,className:`mt-0.5 shrink-0`}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-medium`,children:`Secret input is unavailable in this page.`}),(0,R.jsx)(`div`,{className:`mt-1 text-attention-soft-70`,children:`Frizz will not persist or send secret values through the current RPC.`})]})]}),(0,R.jsx)(`div`,{className:`mt-2 font-medium`,children:`Use the provider's trusted secret-input flow. The thread terminal cannot answer this typed request.`})]}),A>0&&(0,R.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-md border border-attention-fill/25 bg-attention-fill/[0.05] px-3 py-2 text-[11px] leading-snug text-attention-soft-75`,children:[(0,R.jsx)($_,{"aria-hidden":`true`,size:13,className:`mt-0.5 shrink-0`}),(0,R.jsxs)(`span`,{children:[A===1?`One advertised choice`:`${A} advertised choices`,` cannot be safely labeled or delivered in Frizz and is not shown.`]})]}),w&&(0,R.jsxs)(`div`,{"data-durable-confirmation":!0,role:`group`,"aria-label":`Confirm ${w.label}`,className:`mt-3 rounded-md border border-attention/45 bg-attention-fill/[0.08] p-3`,children:[(0,R.jsx)(`div`,{className:`text-[12px] font-semibold text-attention-soft`,children:`This approval persists beyond the current request.`}),(0,R.jsx)(`div`,{className:`mt-1 text-[11px] leading-snug text-attention-soft-75`,children:w.scope}),(0,R.jsxs)(`label`,{className:`mt-2.5 flex cursor-pointer items-start gap-2 text-[11px] leading-snug text-fg/85`,children:[(0,R.jsx)(`input`,{type:`checkbox`,autoFocus:!0,checked:E,onChange:e=>D(e.target.checked),className:`mt-0.5 accent-[var(--color-accent)]`}),(0,R.jsx)(`span`,{children:`I understand this may authorize later matching actions in this session.`})]}),(0,R.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-start gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>{T(void 0),D(!1)},className:`rounded-md border border-border px-2.5 py-1.5 text-[11px] text-muted hover:bg-panel-2 hover:text-fg`,children:`Back`}),(0,R.jsxs)(`button`,{type:`button`,disabled:!E||M.isPending,onClick:()=>P(w,!0),className:`rounded-md border border-attention/50 bg-attention-fill/15 px-2.5 py-1.5 text-[11px] font-semibold text-attention-faint hover:bg-attention-fill/25 disabled:opacity-35`,children:[`Confirm `,w.label.toLowerCase()]})]})]}),v&&(0,R.jsx)(`div`,{role:`alert`,className:`mt-3 break-words text-[11px] leading-snug text-danger-soft`,children:v}),(O.status??b)&&(0,R.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`mt-3 text-[11px] leading-snug text-muted`,children:O.status??b}),O.actionsEnabled&&!w&&!S&&k.length>0&&(0,R.jsxs)(`div`,{className:`mt-4 flex flex-wrap justify-start gap-2`,children:[k.map(e=>(0,R.jsxs)(`button`,{type:e===F?`submit`:`button`,"data-interaction-decision":e.id,disabled:M.isPending,"aria-describedby":e.durable?`${a}-scope-${e.id}`:void 0,onClick:e===F?void 0:()=>P(e),className:c3(e),children:[M.isPending?`Sending…`:e.label,e.durable&&(0,R.jsx)(`span`,{className:`sr-only`,children:`; persistent approval`})]},e.id)),k.filter(e=>e.durable).map(e=>(0,R.jsx)(`span`,{id:`${a}-scope-${e.id}`,className:`sr-only`,children:e.scope},`scope-${e.id}`))]}),!u3.has(e.payload.kind)&&(0,R.jsx)(p3,{record:e})]})})]})}function c3(e){let t=`rounded-md border px-2.5 py-1.5 text-[11px] font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-focus-ink-50 disabled:opacity-40`;return e.tone===`primary`?`${t} border-border-strong bg-panel-2 text-fg hover:bg-inset`:e.tone===`danger`?`${t} border-danger/35 bg-danger-fill/[0.07] text-danger-faint hover:bg-danger-fill/15`:`${t} border-border bg-panel text-muted hover:bg-panel-2 hover:text-fg`}function l3({record:e,instanceId:t,draft:n,setDraft:r,errors:i,autoFocus:a}){let o=e.payload,s=(e,t)=>r(R4(n,e,t)),c;return c=o.kind===`command-approval`||o.kind===`file-approval`||o.kind===`permission-approval`?(0,R.jsx)(h4,{payload:o}):o.kind===`mcp-elicitation-url`?(0,R.jsx)(f3,{url:o.url}):(0,R.jsx)(m3,{instanceId:t,fields:o.fields,draft:n,setValue:s,errors:i,autoFocus:a}),(0,R.jsxs)(R.Fragment,{children:[`message`in o&&o.message&&(0,R.jsx)(d3,{text:o.message}),(0,R.jsx)(`div`,{className:`message`in o&&o.message?`mt-3`:``,children:c})]})}var u3=new Set([`command-approval`,`file-approval`,`permission-approval`]);function d3({text:e}){return e.length>600||e.split(`
|
|
323
|
-
`).length>6?(0,R.jsxs)(`details`,{className:`rounded-md border border-border/70 bg-panel/60`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer px-2.5 py-2 text-[11px] text-muted outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-50`,children:`Request message`}),(0,R.jsx)(`div`,{className:`max-h-52 overflow-auto border-t border-border/60 px-2.5 py-2 whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})]}):(0,R.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})}function f3({url:e}){let t=V4(e,location.href);return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[11px] font-medium text-fg`,children:`Open this page to continue`}),(0,R.jsx)(`code`,{className:`mt-1.5 block max-h-24 overflow-auto break-all rounded-md border border-border bg-bg/40 px-2.5 py-2 font-mono-keep text-[10.5px] text-fg/80`,children:e}),t?(0,R.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 inline-flex items-center gap-1.5 rounded-md border border-border bg-panel px-2.5 py-1.5 text-[11px] font-medium text-fg hover:bg-panel-2`,children:[(0,R.jsx)(u_,{"aria-hidden":`true`,size:12}),`Open page`]}):(0,R.jsx)(`div`,{role:`alert`,className:`mt-1.5 break-words text-[11px] text-danger-soft`,children:`This request did not provide a safe http(s) URL.`})]})}function p3({record:e}){return(0,R.jsxs)(`details`,{className:`mt-3 border-t border-border/50 pt-2 text-[10.5px] text-muted-70`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer w-fit outline-none hover:text-muted focus-visible:ring-1 focus-visible:ring-focus-ink-50`,children:`Request details`}),(0,R.jsxs)(`dl`,{className:`mt-2 grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1`,children:[(0,R.jsx)(`dt`,{children:`Provider`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:P4(e.provider.kind)}),e.provider.name&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Reported name`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.name})]}),e.provider.version&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Reported version`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.version})]}),(0,R.jsx)(`dt`,{children:`Source`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:F4(e.source.kind)}),e.source.label&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Reported source`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.source.label})]}),(0,R.jsx)(`dt`,{children:`Scope`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:`This thread · this request`}),e.expiresAt&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Expires`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.expiresAt})]})]})]})}function m3({instanceId:e,fields:t,draft:n,setValue:r,errors:i,autoFocus:a}){let o=t.findIndex(e=>!e.secret);return(0,R.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,R.jsx)(`legend`,{className:`sr-only`,children:`Requested information`}),(0,R.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:t.map((t,s)=>(0,R.jsx)(h3,{instanceId:e,field:t,value:n[t.id],setValue:e=>r(t.id,e),error:i[t.id],autoFocus:a&&s===o},t.id))})]})}function h3({instanceId:e,field:t,value:n,setValue:r,error:i,autoFocus:a}){let o=`${e}-${t.id}`,s=t.description?`${o}-description`:void 0,c=i?`${o}-error`:void 0,l=[s,c].filter(Boolean).join(` `)||void 0,u=(0,R.jsxs)(R.Fragment,{children:[t.label,t.required&&(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`ml-0.5 text-accent`,children:`*`})]}),d=`mt-1 w-full min-w-0 rounded-md border border-border bg-bg/45 px-2.5 py-2 text-[12px] text-fg outline-none focus:border-accent focus:ring-1 focus:ring-focus-accent-40`,f;if(t.secret)f=(0,R.jsx)(`div`,{className:`mt-1 text-[11px] text-attention-soft-70`,children:`Use the secure fallback below.`});else if(t.input===`multiline`)f=(0,R.jsx)(`textarea`,{id:o,name:t.id,"data-1p-ignore":!0,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,minLength:t.minLength,maxLength:t.maxLength,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,rows:4,className:`${d} resize-y`});else if(t.input===`text`){let e=t.format===`email`?`email`:t.format===`uri`?`url`:t.format===`date`?`date`:`text`;f=(0,R.jsx)(`input`,{id:o,name:t.id,type:e,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,minLength:t.minLength,maxLength:t.maxLength,placeholder:t.format===`date-time`?`2026-07-13T12:00:00Z`:void 0,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d})}else if(t.input===`number`||t.input===`integer`)f=(0,R.jsx)(`input`,{id:o,name:t.id,type:`number`,step:t.input===`integer`?1:`any`,min:t.minimum,max:t.maximum,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d});else if(t.input===`boolean`)f=(0,R.jsxs)(`label`,{htmlFor:o,className:`mt-1 flex cursor-pointer items-center gap-2 rounded-md border border-border bg-bg/30 px-2.5 py-2 text-[12px] text-fg/85`,children:[(0,R.jsx)(`input`,{id:o,name:t.id,type:`checkbox`,checked:n===!0,onChange:e=>r(e.target.checked),"aria-describedby":l,autoFocus:a,className:`accent-[var(--color-accent)]`}),(0,R.jsx)(`span`,{children:u})]});else if(t.input===`select`)f=(0,R.jsxs)(`select`,{id:o,name:t.id,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d,children:[(0,R.jsx)(`option`,{value:``,children:`Choose an option…`}),t.options.map((e,t)=>(0,R.jsx)(`option`,{value:String(t),children:e.label},t))]});else if(t.input===`multi-select`){let e=Array.isArray(n)?n:[];f=(0,R.jsxs)(`fieldset`,{id:o,"aria-describedby":l,className:`mt-1 rounded-md border border-border bg-bg/30 px-2.5 py-2`,children:[(0,R.jsx)(`legend`,{className:`px-1 text-[11px] font-medium text-fg/85`,children:u}),(0,R.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.options.map((n,i)=>{let o=String(i);return(0,R.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-[12px] text-fg/85`,children:[(0,R.jsx)(`input`,{type:`checkbox`,name:t.id,value:o,checked:e.includes(o),onChange:t=>r(t.target.checked?[...e,o]:e.filter(e=>e!==o)),autoFocus:a&&i===0,className:`mt-0.5 accent-[var(--color-accent)]`}),(0,R.jsx)(`span`,{children:n.label})]},o)})})]})}return(0,R.jsxs)(`div`,{className:`min-w-0`,children:[t.secret?(0,R.jsx)(`div`,{className:`text-[11px] font-medium text-fg/85`,children:u}):t.input!==`boolean`&&t.input!==`multi-select`?(0,R.jsx)(`label`,{htmlFor:o,className:`block text-[11px] font-medium text-fg/85`,children:u}):null,t.description&&(0,R.jsx)(`div`,{id:s,className:`mt-0.5 whitespace-pre-wrap break-words text-[10.5px] leading-snug text-muted`,children:t.description}),f,i&&(0,R.jsx)(`div`,{id:c,role:`alert`,className:`mt-1 text-[10.5px] text-danger-soft`,children:i})]})}function g3({steps:e}){return(0,R.jsx)(`div`,{"data-awaiting-steps":!0,className:`md-body ${wQ} mt-[var(--md-step)] first:mt-0`,children:(0,R.jsx)(`ol`,{children:e.map((e,t)=>(0,R.jsx)(_3,{md:e},t))})})}function _3({md:e}){return(0,R.jsx)(`li`,{children:(0,R.jsx)(GZ,{className:`md-body`,html:rX(e)})})}function v3({slug:e,onReplied:t,onReplyFailed:n}){let r=$U(e),[i,a]=(0,L.useState)(!1);return(0,R.jsx)(RQ,{"data-awaiting-steps-reply":!0,children:(0,R.jsx)(`button`,{type:`button`,"data-steps-done":!0,disabled:i,onClick:()=>{a(!0),r.submit(`Done`,{onOptimistic:()=>t?.(),onRollback:()=>{a(!1),n?.()}})||a(!1)},onMouseDown:e=>e.preventDefault(),className:`${VQ} disabled:opacity-60`,children:iW})})}function y3(e){return(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).length}function b3(e,t={}){let n=(e.subAgents??[]).filter(e=>Au(e)&&e.state===`running`).length,r=(e.bgShells??[]).filter(e=>e.state===`running`).length,i=t.watchers===!1?0:y3(e),a=[n>0?`${n} sub-agent${n===1?``:`s`}`:null,r>0?`${r} background shell${r===1?``:`s`}`:null,i>0?`${i} PR watcher${i===1?``:`s`}`:null].filter(e=>e!==null);return a.length===0?`0 background shells`:a.length===1?a[0]:`${a.slice(0,-1).join(`, `)} and ${a[a.length-1]}`}function x3(e){return(e.subAgents??[]).some(e=>Au(e)&&e.state===`running`)}function S3(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length}function C3(e){return x3(e)||S3(e)>0}function w3(e,t){return Yu(t)??(T3(e)?`Background shells running`:`Awaiting`)}function T3(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length>0&&!x3(e)&&y3(e)===0&&E3(e).length===0}function E3(e){return(e.watches??[]).filter(e=>e.kind===`timer`&&e.state===`armed`)}var D3={id:``,subAgents:[],bgShells:[],watches:[]},O3=[];function k3(e,t){if(t.length===0||e?.runtime!==`turn-idle`||e.lastFence?.kind!==`awaiting`)return!1;let n=Gu(e.lastFence.hints);return n.length===t.length&&n.every((e,n)=>e===t[n])}function A3(e,t){let n=new Set((e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).map(e=>e.target));return aW(t).filter(e=>!n.has(e.ref))}function j3({watch:e}){return(0,L.useEffect)(()=>{e.url&&Ym([e.ref])},[e.url,e.ref]),e.url?(0,R.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,"data-gh-ref":e.ref,className:`${BQ} text-[12px]`,children:e.ref}):(0,R.jsx)(`span`,{className:`text-[12px] text-muted`,children:e.ref})}var M3={mergeable:`no conflicts`,blocked:`merge blocked`,conflicting:`has conflicts`,unknown:null};function N3(e){return e.state!==`open`||e.merge===`blocked`&&e.checks!==`passing`&&e.checks!==`none`?null:M3[e.merge]}var P3=`shrink-0 self-baseline translate-y-[calc(0.5em_-_0.5cap)]`;function F3({tone:e}){return(0,R.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-3 rounded-full border ${e} border-t-transparent motion-safe:animate-spin ${P3}`})}function I3(){return(0,R.jsxs)(`svg`,{"aria-hidden":!0,viewBox:`0 0 16 16`,width:12,height:12,fill:`none`,stroke:`currentColor`,overflow:`visible`,className:P3,style:{color:ak.fgAttention},children:[(0,R.jsx)(`circle`,{cx:`8`,cy:`8`,r:`4`,fill:`currentColor`,stroke:`none`}),(0,R.jsxs)(`g`,{strokeWidth:`2`,className:`origin-center motion-safe:animate-spin`,children:[(0,R.jsx)(`circle`,{cx:`8`,cy:`8`,r:`7`,opacity:`0.25`}),(0,R.jsx)(`path`,{d:`M15 8A7 7 0 0 1 8 15`})]})]})}function L3({status:e}){return e?e.state===`merged`?(0,R.jsx)(g_,{size:12,className:P3,style:{color:ak.fgDone}}):e.state===`closed`?(0,R.jsx)(__,{size:12,className:P3,style:{color:ak.fgDanger}}):e.checks===`failing`?(0,R.jsx)(o_,{size:12,className:P3,style:{color:ak.fgDanger}}):e.checks===`passing`?(0,R.jsx)(t_,{size:12,className:P3,style:{color:ak.fgSuccess}}):e.gated>0&&e.running===0?(0,R.jsx)(e_,{size:12,className:P3,style:{color:ak.fgAttention}}):e.checks===`running`?(0,R.jsx)(I3,{}):(0,R.jsx)(n_,{size:12,className:`${P3} text-muted-60`}):(0,R.jsx)(n_,{size:12,className:`${P3} text-muted-60`})}function R3(e){return[e.failed>0?`${e.failed} failing`:null,e.gated>0?`${e.gated} awaiting approval`:null,e.running>0?`${e.running} in progress`:null,e.passed>0?`${e.passed} successful`:null,e.skipped>0?`${e.skipped} skipped`:null].filter(e=>e!==null).join(`, `)}function z3(e){if(!e)return`Checking…`;if(e.state===`merged`)return`Merged`;if(e.state===`closed`)return`Closed`;let t=R3(e),n=N3(e);return[t||`No checks`,n].filter(e=>e!==null).join(` · `)}var B3=`group relative col-span-4 grid grid-cols-subgrid items-baseline rounded-sm text-[12px] leading-5`,V3=`group relative col-span-4 flex items-baseline rounded-sm text-[12px] leading-5`,H3=`ml-1.5 min-w-0 truncate font-medium text-fg/90`,U3=`ml-3 min-w-0 truncate text-right text-muted-70`,W3=`outline-none after:absolute after:inset-0 after:rounded-sm focus-visible:after:ring-1 focus-visible:after:ring-fg/60`;function G3(){return(0,R.jsx)(Zg,{size:13,"aria-hidden":!0,className:`${P3} ml-[3px] -mr-[4px] text-muted-35 transition-colors group-hover:text-muted-70`})}function K3({mark:e,name:t,status:n,onOpen:r,onPrewarm:i,href:a,ghRef:o,title:s,testKind:c,testId:l,indent:u,dismiss:d}){let f=u!==void 0,p=f?`${H3} flex-1`:H3,m=a?(0,R.jsx)(`a`,{href:a,target:`_blank`,rel:`noreferrer noopener`,title:s,"data-gh-ref":o,onMouseDown:e=>e.stopPropagation(),className:`${p} ${W3} group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):r?(0,R.jsx)(`button`,{type:`button`,onClick:r,onMouseDown:e=>e.stopPropagation(),title:s,className:`${p} ${W3} text-left group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):(0,R.jsx)(`span`,{className:p,title:s,children:t}),h=!!(a||r),g=d&&(0,R.jsx)(`button`,{type:`button`,onClick:d.onDismiss,onMouseDown:e=>e.stopPropagation(),title:d.title,"aria-label":d.label,className:`relative ml-0.5 shrink-0 self-center rounded-sm p-0.5 text-muted-45 outline-none transition-colors hover:text-fg focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:(0,R.jsx)(tv,{size:11})});return(0,R.jsxs)(`div`,{"data-wait-row":l,"data-wait-kind":c,onMouseEnter:i,onFocus:i,style:f?{paddingLeft:u}:void 0,className:`${f?V3:B3} ${h?`cursor-pointer transition-colors hover:bg-fg/[0.045]`:``}`,children:[(0,R.jsx)(`span`,{className:`flex shrink-0`,children:e}),g?(0,R.jsxs)(`span`,{className:`flex min-w-0 items-baseline`,children:[m,g]}):m,(0,R.jsx)(`span`,{"data-wait-status":!0,className:U3,children:n}),h?(0,R.jsx)(G3,{}):(0,R.jsx)(`span`,{})]})}function q3({status:e}){return e?e.state===`closed`?e.stateReason===`not_planned`||e.stateReason===`duplicate`?(0,R.jsx)(a_,{size:12,className:`${P3} text-muted`}):(0,R.jsx)(t_,{size:12,className:P3,style:{color:ak.fgDone}}):(0,R.jsx)(r_,{size:12,className:P3,style:{color:ak.fgSuccess}}):(0,R.jsx)(n_,{size:12,className:`${P3} text-muted-60`})}function J3(e){if(!e)return`Checking…`;if(e.state===`closed`){let t=e.stateReason===`not_planned`?`not planned`:e.stateReason===`duplicate`?`duplicate`:null;return t?`Closed as ${t}`:`Closed`}return`Open · ${e.comments} comment${e.comments===1?``:`s`}`}function Y3({watch:e}){if(e.subject===`issue`)return(0,R.jsx)(X3,{watch:e});let t=e.github,n=tW(e.target);return(0,L.useEffect)(()=>{n&&Ym([e.target])},[n,e.target]),(0,R.jsx)(K3,{testKind:`github`,testId:e.target,mark:(0,R.jsx)(L3,{status:t}),name:e.target,href:n??void 0,ghRef:n?e.target:void 0,title:n?`Open ${e.target} on GitHub`:e.target,status:(0,R.jsxs)(R.Fragment,{children:[z3(t),t&&t.failing.length>0&&n&&(0,R.jsxs)(R.Fragment,{children:[` · `,(0,R.jsx)(`a`,{href:`${n}/checks`,target:`_blank`,rel:`noreferrer noopener`,onMouseDown:e=>e.stopPropagation(),className:`relative underline underline-offset-2 text-[color:var(--gh-danger-link-fg)] decoration-[color:color-mix(in_srgb,var(--gh-danger-link)_30%,transparent)] hover:decoration-[color:var(--gh-danger-link)]`,children:`view failures`})]})]})})}function X3({watch:e}){let t=e.issue,n=tW(e.target,`issue`);return(0,L.useEffect)(()=>{n&&Ym([e.target])},[n,e.target]),(0,R.jsx)(K3,{testKind:`github`,testId:`issue:${e.target}`,mark:(0,R.jsx)(q3,{status:t}),name:t?.title?`${e.target} ${t.title}`:e.target,href:n??void 0,ghRef:n?e.target:void 0,title:n?`Open ${e.target} on GitHub`:e.target,status:J3(t)})}function Z3(e,t){return(e.bgShells??[]).find(e=>e.id===t||e.taskId===t||e.label===t)}function Q3(e){return(e.watches??[]).filter(e=>e.kind===`shell`&&e.state===`armed`)}function $3({watch:e,thread:t,slug:n,now:r}){let i=Z3(t,e.target);if(i)return(0,R.jsx)(t6,{shell:i,slug:n,now:r,testId:e.target});let a=ek(e.createdAt,r);return(0,R.jsx)(K3,{testKind:`shell`,testId:e.target,mark:(0,R.jsx)(X_,{size:12,className:`${P3} text-shell`}),name:e.target,title:e.target,status:a?`running · ${a}`:`running`})}function e6(e,t,n,r){if(!e)return;let i=t?`running`:`settled`;return{onDismiss:e,title:yk[i],label:`${bk[i]} ${xk[n]}: ${r}`}}function t6({shell:e,slug:t,now:n,testId:r,onDismiss:i}){let a=ek(e.startedAt,n),o=e.state===`running`,s=o?`running`:`stale`,c=e.id&&!e.outputUnavailable,l=o?`running for ${a}`:pk;return(0,R.jsx)(K3,{testKind:`shell`,testId:r??e.id??e.label,mark:(0,R.jsx)(X_,{size:12,className:`${P3} ${o?`text-shell`:`text-muted-60`}`}),name:e.label,onOpen:c?()=>Wh(t,e.id,{label:e.label,startedAt:e.startedAt}):void 0,title:c?`Read this shell's output — ${l}`:o?e.label:`${e.label} — ${l}`,status:a?`${s} · ${a}`:s,dismiss:e6(i,o,`SHELL`,e.label)})}function n6({watch:e,now:t}){let n=Date.parse(e.timer?.fireAt??``),r=Number.isFinite(n)?n>t?`fires in ${QO(n-t)}`:`firing…`:`armed`;return(0,R.jsx)(K3,{testKind:`timer`,testId:e.target,mark:(0,R.jsx)(s_,{size:12,className:`${P3} text-muted-60`}),name:e.timer?.prompt||e.target,title:e.timer?.fireAt?`One-off timer, set for ${e.timer.fireAt}`:e.target,status:r})}function r6(e){return(e.subAgents??[]).filter(e=>Au(e)&&e.state===`running`)}function i6({agent:e,slug:t,now:n,onDismiss:r}){let i=ek(e.startedAt,n),a=e.subagentType?.replace(/^frizz:/,``),o=e.state===`stale`;return(0,R.jsx)(K3,{testKind:`agent`,testId:e.id??e.label,mark:o?(0,R.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-3 p-[3px] ${P3}`,children:(0,R.jsx)(`span`,{className:lk})}):(0,R.jsx)(F3,{tone:`border-accent`}),name:e.label,onOpen:e.id?()=>Uh(t,e.id,{label:e.label,subagentType:e.subagentType,startedAt:e.startedAt}):void 0,title:e.id?`Open this sub-agent — ${o?uk:`working for ${i}`}`:e.label,status:[o?`stale`:void 0,a,i].filter(Boolean).join(` · `),dismiss:e6(r,e.state===`running`,`AGENT`,e.label)})}function a6(e,t,n){let r=new Set(n.map(e=>e.target)),i=[];for(let n of t){if(n.kind!==`shell`)continue;let t=n.value.trim();if(!t||r.has(t))continue;let a=Z3(e,t);!a||a.state!==`running`||(r.add(t),i.push({id:`shell:${e.id}:${t}`,kind:`shell`,target:t,state:`armed`,createdAt:a.startedAt}))}return i}function o6(e,t={}){let n=(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`),r=n.filter(e=>e.subject!==`issue`),i=n.filter(e=>e.subject===`issue`),a=Q3(e);return{prs:r,issues:i,shells:[...a,...a6(e,t.hints??[],a)],agents:r6(e),timers:E3(e)}}function s6(e,t,n={}){let{prs:r,issues:i,shells:a,agents:o,timers:s}=o6(e,n);return[{head:`Sub-agents`,rows:o.map(n=>(0,R.jsx)(i6,{agent:n,slug:e.id,now:t},n.id??n.label))},{head:`Background shells`,rows:a.map(n=>(0,R.jsx)($3,{watch:n,thread:e,slug:e.id,now:t},n.id))},{head:`Pull requests`,rows:r.map(e=>(0,R.jsx)(Y3,{watch:e},e.id))},{head:`Issues`,rows:i.map(e=>(0,R.jsx)(Y3,{watch:e},e.id))},{head:`Timers`,rows:s.map(e=>(0,R.jsx)(n6,{watch:e,now:t},e.id))}].filter(e=>e.rows.length>0)}function c6({group:e,first:t}){let n=`col-span-4 text-[10.5px] uppercase tracking-wide text-muted-45 ${t?``:`mt-2.5`}`;return e.onToggle?(0,R.jsxs)(`button`,{type:`button`,onClick:e.onToggle,"aria-expanded":!e.collapsed,onMouseDown:e=>e.stopPropagation(),className:`${n} flex items-baseline rounded-sm text-left transition-colors hover:text-muted-80`,children:[(0,R.jsx)(`span`,{children:e.head}),e.count!==void 0&&(0,R.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.count}),(0,R.jsx)(Zg,{size:10,"aria-hidden":!0,className:`${P3} ml-[5px] transition-transform ${e.collapsed?``:`rotate-90`}`})]}):(0,R.jsx)(`div`,{className:n,children:e.head})}function l6({groups:e,divider:t}){return e.length===0?null:(0,R.jsxs)(R.Fragment,{children:[t&&(0,R.jsx)(`div`,{"aria-hidden":!0,className:`-mx-4 mt-3 border-t border-border`}),(0,R.jsx)(`div`,{className:`mt-3 grid grid-cols-[auto_1fr_fit-content(50%)_auto] gap-y-px`,children:e.map((e,t)=>(0,R.jsxs)(L.Fragment,{children:[(0,R.jsx)(c6,{group:e,first:t===0}),!e.collapsed&&e.rows]},e.head))})]})}function u6(e){return e?.awaitingBackground===!0&&e.runtime===`turn-idle`&&e.bgSnoozed!==!0}var d6=`Hides card until new activity is detected`;function f6({thread:e,onSnooze:t,onSnoozeFailed:n}){let[r,i]=(0,L.useState)(!1);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{i(!0),t?.(),Y.snoozeAwaitingBackground({slug:e.id,sessionId:e.sessionId??``}).then(()=>Z(`Snoozed until the background work returns`)).catch(e=>{n?.(),Z(`Couldn’t snooze: ${e.message.slice(0,80)}`),i(!1)})},disabled:r,onMouseDown:e=>e.preventDefault(),title:d6,className:`disabled:opacity-45 ${VQ}`,children:[(0,R.jsx)(x_,{size:12,className:L0}),`Snooze`]}),(0,R.jsx)(`span`,{className:zQ,children:d6})]})}function p6({thread:e,fence:t,onSnooze:n,onSnoozeFailed:r,onReplied:i,onReplyFailed:a}){let o=e??D3,s=t??(e?.lastFence?.kind===`awaiting`?e.lastFence:void 0),c=s?.hints??O3,l=Gu(c),u=l.length>0?Yu(c):null,d=e!==void 0&&k3(e,l),f=x3(o),p=dW(s?.body),m=rX(p??``),h=s6(o,VO(),{hints:c}),g=A3(o,c),_=e!==void 0&&l.length===0&&e.waitStatus!==`watching`&&u6(e)&&mK(e).snooze;return(0,R.jsxs)(IQ,{"data-awaiting-background":!0,icon:l.length>0?mee:T3(o)?X_:x_,chip:l.length>0?rW:void 0,label:l.length>0?u?(0,R.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:u}):null:(0,R.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:w3(o,c)}),aside:g.length===1?(0,R.jsx)(j3,{watch:g[0]}):void 0,children:[p?(0,R.jsx)(GZ,{className:`md-body ${wQ}`,html:m}):h.length===0&&!C3(o)&&l.length===0?(0,R.jsx)(`p`,{className:LQ,children:nW}):null,l.length>0&&(0,R.jsx)(g3,{steps:l}),g.length>1&&(0,R.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:g.map(e=>(0,R.jsx)(j3,{watch:e},e.ref))}),h.length===0&&C3(o)&&(0,R.jsx)(`p`,{className:`block min-w-0 text-[13px] leading-5 text-fg/75`,children:f?(0,R.jsxs)(R.Fragment,{children:[`It’s awaiting the results from `,b3(o,{watchers:!1}),` it dispatched. It returns to the queue on its own when the work comes back.`]}):(0,R.jsxs)(R.Fragment,{children:[b3(o,{watchers:!1}),` `,S3(o)===1?`is`:`are`,` still running. It resumes on its own when`,` `,S3(o)===1?`it finishes`:`one of them finishes`,`.`]})}),(0,R.jsx)(l6,{groups:h,divider:!!p}),d?(0,R.jsx)(v3,{slug:e.id,onReplied:i,onReplyFailed:a}):_?(0,R.jsx)(RQ,{"data-awaiting-snooze":!0,children:(0,R.jsx)(f6,{thread:e,onSnooze:n,onSnoozeFailed:r})}):null]})}function m6(e,t=Date.now()){return e!==void 0&&ff(e,t)!==void 0}function h6(){let[e,t]=(0,L.useState)(()=>Date.now());return(0,L.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function g6({thread:e}){let t=h6(),[n,r]=(0,L.useState)(!1),i=ff(e,t);if(!i)return null;let a=Date.parse(i),o=PD(i,t).replace(/^(Today|Tomorrow)/,e=>e.toLowerCase()),s=e.snoozePrompt?.trim();async function c(){r(!0);try{await Y.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:null,prompt:null}),Z(`Snooze cleared`)}catch(e){Z((e instanceof Error?e.message:`Wake failed`).slice(0,100))}finally{r(!1)}}return(0,R.jsxs)(IQ,{"data-snooze-card":!0,icon:Wg,label:`Snoozed`,children:[(0,R.jsx)(`div`,{"data-snooze-countdown":!0,title:new Date(a).toLocaleString(),className:`text-[22px] font-semibold leading-8 tracking-tight text-fg tabular-nums`,children:nk(a-t)}),(0,R.jsx)(`p`,{className:LQ,children:s?(0,R.jsxs)(R.Fragment,{children:[`Resumes `,o,` and sends: “`,RD(s),`”`]}):(0,R.jsxs)(R.Fragment,{children:[`Returns to the queue `,o,`.`]})}),e.foreign!==!0&&(0,R.jsx)(RQ,{children:(0,R.jsx)(`button`,{type:`button`,"data-snooze-wake-now":!0,disabled:n,onClick:()=>void c(),className:`${VQ} disabled:cursor-not-allowed disabled:opacity-45`,children:`Wake now`})})]})}var _6=1500;function v6(e,t){let n=0,r;function i(){r!==void 0&&(t.clearTimeout(r),r=void 0)}return{begin(){let a=++n;return e(!0),i(),r=t.setTimeout(()=>{a===n&&e(!1),r=void 0},_6),a},fail(t){t===n&&(i(),e(!1))},dispose(){n++,i()}}}var y6=`Could not copy terminal command`,b6={attach:`Attach command copied`,resume:`Resume command copied`},x6={attach:`Copy command to attach to this thread's live terminal`,resume:`Copy command to resume this thread in a new terminal`},S6=e=>[`terminalCommand`,e];function C6(e){return Y.threadTerminalCommand({slug:e}).then(e=>{if(!e.command)throw Error(e.reason??`No verified provider session is available to resume`);return{command:e.command,mode:e.mode===`attach`?`attach`:`resume`}})}async function w6(e){let t=C6(e);if(typeof ClipboardItem<`u`&&navigator.clipboard?.write)return await navigator.clipboard.write([new ClipboardItem({"text/plain":t.then(({command:e})=>new Blob([e],{type:`text/plain`}))})]),(await t).mode;let{command:n,mode:r}=await t;return await DV(n),r}function T6(e){let t=pt({mutationFn:()=>w6(e)});return e=>t.mutate(void 0,{onSuccess:t=>{e?.onSuccess?.(),Z(b6[t])},onError:t=>{e?.onError?.(),Z(t instanceof Error?`${y6}: ${t.message}`:y6,{duration:7e3})}})}function E6({slug:e}){let[t,n]=(0,L.useState)(!1),r=(0,L.useRef)(null);r.current||=v6(n,{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)});let i=qe(),a=T6(e);(0,L.useEffect)(()=>()=>r.current?.dispose(),[]);function o(){i.prefetchQuery({queryKey:S6(e),queryFn:()=>C6(e),staleTime:15e3})}function s(){let t=i.getQueryData(S6(e));if(t){DV(t.command).then(()=>{r.current?.begin(),Z(b6[t.mode])},()=>Z(y6,{duration:7e3}));return}a({onSuccess:()=>r.current?.begin()})}let c=i.getQueryData(S6(e)),l=t?c?b6[c.mode]:`Terminal command copied`:c?x6[c.mode]:`Copy terminal command`;return(0,R.jsx)(VP,{label:l,children:(0,R.jsx)(`button`,{type:`button`,"aria-label":l,title:l,onClick:s,onPointerEnter:o,onFocus:o,className:Rk,children:t?(0,R.jsx)(Jg,{size:14,strokeWidth:2.2,className:`text-fg`}):(0,R.jsx)(X_,{size:14,strokeWidth:1.8})})})}function D6(e){let t=Math.max(e.scrollHeight-e.clientHeight,0),n=t-e.scrollTop,r=e.scrollHeight!==e.previousScrollHeight,i=r&&!e.readerMoved?e.following||n<=1:n<=4;return!i||!r||t<=0||n<=1?{following:i,scrollTop:null}:{following:i,scrollTop:t}}function O6(e){let t=e.scrollTop>640?!0:e.armed,n=t&&e.readerMoved&&e.scrollTop<=480&&e.hasEarlier&&!e.loading;return{armed:n?!1:t,shouldLoad:n}}function k6(e){return`legacy:${e.role}:${e.kind??`message`}:${e.at??``}:${e.text}`}function A6(e,t,n){let r=[],i=new Map,a=null;return e.forEach((e,o)=>{if(e.queued||t(e))return;let s=e.sourceId??k6(e),c=i.get(s)??0;i.set(s,c+1),r.push({key:c===0?s:`${s}:${c}`,message:e,messageIndex:o,gap:a===null?0:n(a,e)}),a=e}),r}function j6(e,t,n){let r=e[t];if(!r||r.kind!==`event`||r.boundary!==`rest`)return!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(!(t.queued||n(t)))return!!t.boundary||t.wake===!0}return!0}function M6(e,t){let n=e.map(e=>e.message);return e.filter((e,r)=>!j6(n,r,t))}function N6(e,t){let n=Promise.resolve();function r(r){let i={...r,palette:{...r.palette}},a=n.then(async()=>{try{return await e(i)}finally{t(i.id)}});return n=a.then(()=>void 0,()=>void 0),a}return{enqueue:r}}function P6(e,t){let n=e[t];return typeof n==`string`&&n?n:void 0}function F6(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function I6(e,t){let n=P6(e,t);if(n)try{let e=new URL(n);return e.protocol===`https:`||e.protocol===`http:`?e.href:void 0}catch{return}}function L6({directive:e,icon:t,title:n,meta:r,children:i}){return(0,R.jsxs)(`section`,{"data-codex-directive":e.name,className:`min-w-0 ${TQ} border border-border bg-panel-2/75 p-4`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-muted`,"aria-hidden":!0,children:t}),(0,R.jsx)(`div`,{className:`max-w-[calc(100%-1.5rem)] shrink-0 break-words text-[12px] font-medium leading-4 text-fg`,children:n}),r&&(0,R.jsx)(`div`,{className:`min-w-0 truncate text-[11px] font-normal leading-4 text-muted`,children:r})]}),i]})}function R6({children:e,mono:t=!1}){return(0,R.jsx)(`div`,{className:`ml-6 mt-1 break-words text-[11px] leading-4 text-muted${t?` font-mono-keep`:``}`,children:e})}function z6({directive:e}){let t=e.attrs,n=P6(t,`display_name`)??P6(t,`skill_name`)??`Artifact template`,r=P6(t,`artifact_kind`),i=P6(t,`skill_name`),a=P6(t,`skill_directory`),[o,s]=(0,L.useState)(!!a);return(0,R.jsxs)(L6,{directive:e,icon:(0,R.jsx)(fee,{size:15}),title:n,meta:r?`${r} template`:`Template`,children:[i&&(0,R.jsx)(R6,{mono:!0,children:i.startsWith(`$`)?i:`$${i}`}),o&&a&&(0,R.jsx)(`img`,{src:MT(`${a}/assets/preview.png`),alt:`${n} template preview`,loading:`lazy`,onError:()=>s(!1),className:`ml-6 mt-2 max-h-44 max-w-[calc(100%-1.5rem)] rounded-md border border-border object-contain`})]})}function B6({directive:e}){let t=e.attrs,n=P6(t,`file`),r=F6(t,`start`),i=F6(t,`end`)??r,a=F6(t,`priority`),o=n?`${n}${r?`:${r}${i&&i!==r?`-${i}`:``}`:``}`:`Code location unavailable`;return(0,R.jsxs)(L6,{directive:e,icon:(0,R.jsx)(k_,{size:15}),title:P6(t,`title`)??`Review finding`,meta:a===void 0?void 0:`P${a}`,children:[P6(t,`body`)&&(0,R.jsx)(R6,{children:P6(t,`body`)}),n?(0,R.jsx)(`button`,{type:`button`,className:`local-file-action ml-6 mt-1 max-w-[calc(100%-1.5rem)] break-all text-left font-mono-keep text-[11px] leading-4 text-accent underline decoration-dotted underline-offset-2`,"data-local-path":n,title:o,children:o}):(0,R.jsx)(R6,{mono:!0,children:o})]})}var V6={"git-stage":[N_,`Changes staged`],"git-commit":[h_,`Commit created`],"git-create-branch":[m_,`Branch created`],"git-push":[ev,`Branch pushed`],"git-create-pr":[y_,`Pull request created`]};function H6({directive:e}){let[t,n]=V6[e.name],r=P6(e.attrs,`branch`),i=I6(e.attrs,`url`),a=`${n}${e.attrs.isDraft===!0?` as draft`:``}`;return(0,R.jsx)(L6,{directive:e,icon:(0,R.jsx)(t,{size:15}),title:i?(0,R.jsx)(`a`,{className:`text-accent underline underline-offset-2`,href:i,target:`_blank`,rel:`noopener noreferrer`,children:a}):a,meta:r&&(0,R.jsx)(`span`,{className:`font-mono-keep`,children:r})})}function U6({directive:e}){let t=P6(e.attrs,`threadId`),n=P6(e.attrs,`pendingWorktreeId`);return(0,R.jsx)(L6,{directive:e,icon:(0,R.jsx)(M_,{size:15}),title:n?`Thread setup queued`:`Thread created`,meta:(t||n)&&(0,R.jsx)(`span`,{className:`font-mono-keep`,children:t??n})})}function W6({directive:e}){let t=P6(e.attrs,`reason`);return(0,R.jsx)(L6,{directive:e,icon:(0,R.jsx)(oee,{size:15}),title:`Archive suggested`,meta:t})}function G6(e){if(typeof e!=`string`||!e)return;let t=e.match(/(?:^|;)INTERVAL=(\d+)(?:;|$)/)?.[1];return/(?:^|;)FREQ=HOURLY(?:;|$)/.test(e)?`Every ${t??`1`} hour${t===`1`||t===void 0?``:`s`}`:/(?:^|;)FREQ=WEEKLY(?:;|$)/.test(e)?`Weekly schedule`:`Custom schedule`}function K6({directive:e}){let t=e.attrs,n=P6(t,`mode`),r=P6(t,`name`)??`Automation`,i=G6(t.rrule),a=[r,n,P6(t,`status`),i].filter(Boolean).join(` · `);return(0,R.jsx)(L6,{directive:e,icon:(0,R.jsx)(uee,{size:15}),title:`Automation suggested`,meta:a,children:P6(t,`prompt`)&&(0,R.jsx)(R6,{children:P6(t,`prompt`)})})}function q6({directive:e}){return e.name===`artifact-template`?(0,R.jsx)(z6,{directive:e}):e.name===`code-comment`?(0,R.jsx)(B6,{directive:e}):e.name.startsWith(`git-`)?(0,R.jsx)(H6,{directive:e}):e.name===`created-thread`?(0,R.jsx)(U6,{directive:e}):e.name===`archive`||e.name===`archive-thread`?(0,R.jsx)(W6,{directive:e}):(0,R.jsx)(K6,{directive:e})}var J6,Y6=0;function X6(){return J6??=wS(async()=>{let{default:e}=await import(`./mermaid.core-BFbkt8RT.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(({default:e})=>e),J6}function Z6(){let e=getComputedStyle(document.documentElement),t=t=>e.getPropertyValue(t).trim();return{background:t(`--color-panel-2`),primaryColor:t(`--color-panel-2`),primaryTextColor:t(`--color-fg`),primaryBorderColor:t(`--color-control-strong`),lineColor:t(`--color-muted`),secondaryColor:t(`--color-border`),tertiaryColor:t(`--color-bg`),fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`}}var Q6=N6(async e=>{let t=await X6();return t.initialize({startOnLoad:!1,securityLevel:`strict`,theme:e.resolved===`dark`?`dark`:`base`,themeVariables:e.palette}),t.render(e.id,e.source)},e=>document.getElementById(`d${e}`)?.remove());function $6({source:e}){let t=(0,L.useId)(),{resolved:n}=(0,L.useSyncExternalStore)($0,Z0,Z0),[r,i]=(0,L.useState)({}),a=(0,L.useRef)(0),o=RX(r.html??``);return(0,L.useEffect)(()=>{let r=!0,o=++a.current;if(i(e=>e.error?{html:e.html}:e),e.length>5e4)return i({error:`Diagram source exceeds the 50 KB rendering limit`}),()=>{r=!1};let s=`frizz-mermaid-${t.replace(/[^a-zA-Z0-9]/g,``)}-${++Y6}`;return Q6.enqueue({id:s,source:e,resolved:n,palette:Z6()}).then(({svg:e})=>{r&&a.current===o&&i({html:e})}).catch(e=>{if(!r||a.current!==o)return;let t=e instanceof Error?e.message.split(/\n| for text:/,1)[0]:`Unknown diagram error`;i({error:t.slice(0,240)})}),()=>{r=!1}},[t,n,e]),r.error?(0,R.jsxs)(`section`,{"data-mermaid-state":`error`,className:`${TQ} border border-border bg-panel-2/75 p-4`,children:[(0,R.jsx)(`div`,{className:`text-[12px] font-medium text-fg`,children:`Diagram unavailable`}),(0,R.jsx)(`div`,{className:`mt-1 text-[11px] text-muted`,children:r.error}),(0,R.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap rounded-md bg-bg p-2 font-mono-keep text-[11px] text-muted`,children:e})]}):r.html?(0,R.jsx)(`div`,{"data-mermaid-state":`ready`,className:`overflow-x-auto ${TQ} border border-border bg-panel-2/75 p-4 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:o}):(0,R.jsx)(`div`,{"data-mermaid-state":`loading`,role:`status`,"aria-label":`Rendering diagram`,className:`h-24 animate-pulse ${TQ} bg-panel-2`})}var e8=(0,L.createContext)(null),t8=(0,L.createContext)(null);function n8(){let e=(0,L.useContext)(e8),t=(0,L.useContext)(t8);return e??t}var r8=(0,L.createContext)(null);function i8(e){return e.status===`pending`&&e.backgroundState===`background`}function a8(e){let t=[];for(let n of e)for(let e of n.tools)i8(e)&&n.at&&t.push({label:e.desc??e.detail??e.command??`Background command`,startedAt:n.at,state:`running`,...e.shellId?{launchId:e.shellId}:{},...e.command?{command:e.command}:{}});return t}function o8(e){return e.map(e=>{if(!e.tools.some(i8))return e;let t=e.tools.filter(e=>!i8(e)),n=e.parts?.map(e=>e.kind===`tools`?{...e,tools:e.tools.filter(e=>!i8(e))}:e).filter(e=>e.kind!==`tools`||e.tools.length>0);return{...e,tools:t,parts:n}})}function s8({slug:e,onStatusApplied:t,onClose:n,virtualized:r=!1,showReturnToQueue:i=!1}){gg(wE(),e);let a=Og()&&n!==void 0,{splitFileViewer:o}=gr(X);return(0,R.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[a?(0,R.jsx)(T2,{slug:e,onClose:n}):(0,R.jsx)(b8,{slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:i}),(0,R.jsx)(c8,{slug:e,virtualized:r,phone:a,railBeside:i&&o})]})}function c8({slug:e,virtualized:t,phone:n=!1,railBeside:r=!1}){let i=wE(),a=gg(i,e),o=Z1(a),s=(0,L.useMemo)(()=>$1(a,o),[a,o]),c=(0,L.useMemo)(()=>n?{numberOf:e=>s.findIndex(t=>t.id===e)+1}:null,[n,s]),[l,u]=(0,L.useState)(!1),d=a?.runtime===`running`||a?.runtime===`spawning`,f=T6(e),p=FE(e,{poll:d}),m=qe(),h=(0,L.useRef)(!1),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(null),b=(0,L.useMemo)(()=>p.data?.messages??[],[p.data]),x=(0,L.useMemo)(()=>a8(b),[b]),S=(0,L.useMemo)(()=>o8(b),[b]),C=(0,L.useMemo)(()=>P8(S),[S]),w=d?S.length:C,T=(0,L.useMemo)(()=>FG(S),[S]),E=d?RG(T):void 0,D=d?LG(T):void 0,O=D?JG(D,i?.projectDir):void 0,k=d?BG(T):void 0,A=u6(a),j=(0,L.useMemo)(()=>{let e=d?UG(T):T;return M6(e,F8(e,w,A))},[T,d,w,A]),M=d,N=(0,L.useMemo)(()=>l$(b),[b]),P=(0,L.useMemo)(()=>i$(b,a?.answersInFlight),[b,a?.answersInFlight]),F=(0,L.useMemo)(()=>P0(b),[b]),I=CQ(a,C>=0?S[C]?.text:void 0),ee=(0,L.useMemo)(()=>E$(b,s),[b,s]),te={thread:a,showWorking:M,registeredDone:I,restedCard:HQ(a,C>=0?S[C]?.text:void 0,ee),errorVisible:WQ(S,a?.providerError)},{answeringForMessage:ne}=f1(e,b),re=(0,L.useMemo)(()=>_$(b,s),[b,s]),ie=(0,L.useMemo)(()=>T$(b,s),[b,s]),ae=(0,L.useMemo)(()=>j$(b,o),[b,o]),oe=Vd(a?.spawnedAt),se=(0,L.useRef)(null),[ce,le]=(0,L.useState)(null),ue=p.data?.messages.length??0,de=!p.isLoading;(0,L.useEffect)(()=>{if(t)return;let e=se.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<=4&&(e.scrollTop=e.scrollHeight)},[ue,d,t]);let fe=(0,L.useCallback)(async()=>{if(h.current)return;let t=m.getQueryData([`transcript`,e]),n=t?.beforeCursor,r=t?.transcriptKey;if(!(!t?.hasEarlier||!n||!r)){h.current=!0,_(!0),y(null);try{let t=await Y.threadTranscriptEarlier({slug:e,cursor:n}),i=m.getQueryData([`transcript`,e]);if(!i?.transcriptKey||i.transcriptKey!==r||t.transcriptKey!==r){await p.refetch(),Z(`Transcript changed while loading history; refreshed the current session`);return}m.setQueryData([`transcript`,e],QC(i,t))}catch(e){let t=e instanceof Error?e.message:`Could not load earlier transcript history`;y(t)}finally{h.current=!1,_(!1)}}},[p,m,e]);return(0,R.jsx)(e8.Provider,{value:e,children:(0,R.jsx)(n0,{thread:a,children:(0,R.jsx)(x1.Provider,{value:c,children:(0,R.jsxs)(`div`,{"data-drawer-scroll-ready":p.isPending?`false`:`true`,className:`flex-1 min-h-0 flex flex-col overflow-hidden outline-none`,children:[(0,R.jsxs)(`div`,{className:`relative min-h-0 flex-1 flex flex-col`,children:[(0,R.jsx)(`div`,{ref:se,"data-drawer-transcript-scroll":!0,"data-virtualized-transcript-scroll":t||void 0,tabIndex:t?0:void 0,role:t?`region`:void 0,"aria-label":t?`Thread conversation`:void 0,"aria-busy":t&&g?!0:void 0,className:`relative min-h-0 flex-1 overflow-y-auto pb-3 outline-none [overflow-anchor:none] focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-60`,children:t&&ue>0?(0,R.jsx)(v8,{slug:e,transcriptRef:se,transcriptKey:p.data?.transcriptKey,messages:S,paired:N,inFlightAnswers:P,answeringForMessage:ne,placement:ie,settledPlacement:ae,openQuestions:s,fencesLive:oe,thread:a,running:d,copyTerminalCommand:f,transportFallback:p.transportFallback,isFetching:p.isFetching,refresh:()=>void p.refetch(),retryLiveUpdates:p.retryLiveUpdates,hasEarlier:p.data?.hasEarlier===!0,beforeCursor:p.data?.beforeCursor,loadingEarlier:g,earlierError:v,loadEarlier:()=>void fe(),jumpOverlay:ce,openAtLastMessage:n&&!d}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(e3,{thread:a,className:`px-6 pt-5`,autoFocusFirst:!0}),(0,R.jsx)(i0,{thread:a,inFlight:P,className:`px-6 pt-5`}),p.transportFallback&&(0,R.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`mx-6 mt-3 flex flex-wrap items-center gap-2.5 rounded-xl border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:p.transportFallback.kind===`payload-too-large`?`Live payload ${p.transportFallback.actualBytes} bytes; socket limit ${p.transportFallback.maxBytes} bytes`:`Transcript read budget reached (${p.transportFallback.scope}); retry after about ${p.transportFallback.retryAfterMs}ms`,children:[(0,R.jsx)($_,{size:13,className:`shrink-0 text-muted`}),(0,R.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,p.transportFallback.kind===`payload-too-large`?`The transcript is too large for push; it refreshes over HTTP each time the thread moves.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,R.jsx)(`button`,{type:`button`,disabled:p.isFetching,onClick:()=>void p.refetch(),className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-40`,children:p.isFetching?`Refreshing…`:`Refresh once`}),(0,R.jsx)(`button`,{type:`button`,onClick:p.retryLiveUpdates,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`,children:`Retry live`})]}),(0,R.jsx)(`div`,{"data-transcript-column":!0,className:`flex min-h-full flex-col px-6 py-5`,children:ue===0?(0,R.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted`,children:p.isPending?(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(B5,{}),` Loading…`]}):d?(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(B5,{}),` Session starting…`]}):i2(a)?(0,R.jsxs)(`div`,{className:`text-center`,children:[(0,R.jsx)(`p`,{className:`mb-3`,children:`No session is attached to this thread yet.`}),(0,R.jsx)(`button`,{className:`btn-ghost border border-border text-[12px]`,onClick:()=>Y.adoptThread({slug:e}).catch(()=>{}),children:`Start a session on this thread`})]}):`No conversation yet.`}):(0,R.jsxs)(R.Fragment,{children:[z8(j.map(e=>e.message),(e,t)=>{let n=j[t].messageIndex;return(0,R.jsx)(x5,{m:e,answering:oe?ne(e):void 0,showSendButton:!0,paired:N[n],staleAwaiting:w>=0&&n<w,restingCardShown:n===C&&A,shadowedBy:re.get(n),placed:ie.placed.get(n),settledPlaced:ae.placed.get(n),thread:a},t)},e=>!!e.queued),de&&h8(te)!==null&&(0,R.jsx)(M$,{h:g8(te,j.map(e=>e.message))}),de&&(0,R.jsx)(_8,{state:te,slug:e,retryText:F>=0?b[F]?.text:void 0,onTerminal:f,liveRuntimeStart:k,liveActivityLabel:O,liveToolRun:E}),a?.permPolicy?(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(M5,{policy:a.permPolicy,denies:a.permDenies})}):null,b.some(e=>e.queued)&&(0,R.jsx)(M$,{}),(0,R.jsx)(`div`,{className:`flex flex-col gap-3.5`,children:b.map((e,t)=>e.queued?(0,R.jsx)(x5,{m:e,paired:N[t]},`q${t}`):null)})]})})]})}),(0,R.jsx)(`div`,{ref:le,"data-transcript-overlay":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-end p-4 [&>*]:pointer-events-auto`})]}),(0,R.jsx)(`div`,{"data-thread-chat-footer":!0,className:`z-10 shrink-0 border-t border-border/60 bg-panel ${n?``:`pb-[env(safe-area-inset-bottom)]`}`,children:(0,R.jsx)(w2,{slug:e,onTerminal:f,ops:n||r?void 0:(0,R.jsx)(N5,{slug:e,transcriptShells:x,className:`px-1 pt-1.5`}),phoneBarOverride:n&&s.length>0?e=>(0,R.jsx)(D1,{count:s.length,onAnswer:()=>u(!0),onReply:e.editReply}):void 0,phoneChrome:n})}),n&&l&&(0,R.jsx)(o0,{questions:s,onClose:()=>u(!1)})]})})})})}var l8=700,u8=250,d8=900,f8=(()=>{try{return localStorage.getItem(`frizz.debugScroll`)===`1`}catch{return!1}})();function p8(e){return e?.pendingInteraction===!0}function m8(e){return p8(e)?void 0:e?.pendingAsk}function h8({thread:e,showWorking:t,registeredDone:n,restedCard:r,errorVisible:i}){return e?.providerError?.retrying?`provider-error`:e?.providerFault&&!e.foreign?`provider-fault`:e?.limitPause&&!e.foreign?`limit-pause`:m8(e)?`pending-ask`:e?.runtime===`perm-prompt`&&!p8(e)?`perm-prompt`:t?`working`:e?.providerError?i?null:`provider-error`:m6(e)?`snooze`:u6(e)?`resting`:n?`registered-done`:r?`rested`:null}function g8(e,t){return h8(e)===`working`?R8(t):14}function _8({state:e,slug:t,retryText:n,onTerminal:r,liveRuntimeStart:i,liveActivityLabel:a,liveToolRun:o}){let s=e.thread;switch(h8(e)){case`provider-fault`:return(0,R.jsx)(k5,{slug:t,sessionId:s.sessionId,fault:s.providerFault,retryText:n});case`provider-error`:return(0,R.jsx)(GQ,{error:s.providerError});case`limit-pause`:return(0,R.jsx)(A5,{slug:t,sessionId:s.sessionId,pause:s.limitPause});case`pending-ask`:return(0,R.jsx)(P5,{ask:m8(s),onTerminal:r});case`perm-prompt`:return(0,R.jsx)(j5,{onTerminal:r});case`working`:return(0,R.jsx)(V5,{since:s?.lastUserAt,startedAt:i,activityLabel:a,run:o});case`snooze`:return(0,R.jsx)(g6,{thread:s});case`resting`:return(0,R.jsx)(p6,{thread:s});case`registered-done`:return(0,R.jsx)(O5,{fenceKind:`done`,body:s.lastFence.body,hints:[]});case`rested`:return(0,R.jsx)(UQ,{thread:s});default:return null}}function v8({slug:e,transcriptRef:t,transcriptKey:n,messages:r,paired:i,inFlightAnswers:a,answeringForMessage:o,placement:s,settledPlacement:c,openQuestions:l,fencesLive:u,thread:d,running:f,copyTerminalCommand:p,transportFallback:m,isFetching:h,refresh:g,retryLiveUpdates:_,hasEarlier:v,beforeCursor:y,loadingEarlier:b,earlierError:x,loadEarlier:S,jumpOverlay:C,openAtLastMessage:w=!1}){let T=TE(),E=(0,L.useMemo)(()=>FG(r),[r]),D=f?RG(E):void 0,O=f?LG(E):void 0,k=O?JG(O,T):void 0,A=f?BG(E):void 0,j=(0,L.useMemo)(()=>P8(r),[r]),M=f?r.length:j,N=u6(d),P=(0,L.useMemo)(()=>{let e=f?UG(E):E;return M6(e,F8(e,M,N))},[E,f,M,N]),F=f,I=(0,L.useMemo)(()=>A6(P.map(e=>e.message),F8(P,M,N),M8).map(e=>{let t=P[e.messageIndex];return{...e,messageIndex:t.messageIndex,stampAt:VG(t)}}),[P,M,N]),ee=(0,L.useMemo)(()=>P0(r),[r]),te=CQ(d,j>=0?r[j]?.text:void 0),ne=(0,L.useMemo)(()=>E$(r,l),[r,l]),re=HQ(d,j>=0?r[j]?.text:void 0,ne),ie=WQ(r,d?.providerError),ae={thread:d,showWorking:F,registeredDone:te,restedCard:re,errorVisible:ie},oe=h8(ae)!==null,se=(0,L.useMemo)(()=>g8({thread:d,showWorking:F,registeredDone:te,restedCard:re,errorVisible:ie},P.map(e=>e.message)),[P,F,d,te,re,ie]),ce=(0,L.useMemo)(()=>{let e=[],t=new Map,n=r.length-1,i=e=>{let t=-1;for(let n=0;n<I.length&&!(I[n].messageIndex>e);n++)t=n;return t},a=l.filter(e=>!s.placedIds.has(e.id));for(let[o,s]of m$(r,a)){if(o>=n){e.push(...s);continue}let r=i(o),a=t.get(r);a?a.push(...s):t.set(r,[...s])}let o=!1,c=new Set;for(let e of O$(r,s)){if(e>=n){o=!0;continue}let r=i(e);c.add(r),t.has(r)||t.set(r,[])}return{byRow:t,tail:e,tailSend:o,sendRows:c}},[I,r,l,s]),le=(0,L.useMemo)(()=>{let e=new Map;for(let[t,n]of c.anchored){let r=-1;for(let e=0;e<I.length&&!(I[e].messageIndex>t);e++)r=e;if(r<0)continue;let i=e.get(r);i?i.push(...n):e.set(r,[...n])}return e},[I,c.anchored]),ue=(0,L.useMemo)(()=>_$(r,l),[r,l]),de=(0,L.useMemo)(()=>{let e=[{key:`head-anchor`,kind:`head-anchor`}];m&&e.push({key:`transport-fallback`,kind:`transport-fallback`}),(v||b||x)&&e.push({key:`earlier-history:${y??`complete`}`,kind:`earlier-history`});let t=ce.byRow.get(-1);t&&e.push({key:`questions:head`,kind:`questions`,questions:t,send:ce.sendRows.has(-1)}),I.forEach((t,n)=>{e.push({...t,kind:`message`});let r=le.get(n);r&&e.push({key:`settled-questions:${t.key}`,kind:`settled-questions`,questions:r});let i=ce.byRow.get(n);i&&e.push({key:`questions:${t.key}`,kind:`questions`,questions:i,send:ce.sendRows.has(n)})}),e.push({key:`interactions`,kind:`interactions`}),oe&&e.push({key:`runtime-status`,kind:`runtime-status`});let n=oe||I.length>0?14:0;return r.forEach((t,r)=>{if(!t.queued)return;let i=`queued:${t.deliveryId??t.sourceId??r}`;e.push({key:i,kind:`queued`,message:t,messageIndex:r,gap:n}),n=14}),e},[y,x,v,oe,b,I,r,ce,le,m]),fe=SD({count:de.length,getScrollElement:()=>t.current,getItemKey:e=>de[e]?.key??e,estimateSize:e=>{let t=de[e];return t?t.kind===`head-anchor`||t.kind===`interactions`?1:t.kind===`earlier-history`?42:t.kind===`transport-fallback`?76:t.kind===`runtime-status`?54:t.kind===`questions`?220:t.kind===`settled-questions`?140:t.kind===`message`?108+t.gap:82+t.gap:80},overscan:8,paddingStart:20,paddingEnd:20,anchorTo:`end`,followOnAppend:!0,scrollEndThreshold:4,scrollToFn:(e,{adjustments:t,behavior:n},r)=>{let i=r.scrollElement;i&&i.scrollTo({top:t===void 0?e:i.scrollTop+t,behavior:n})}}),[pe,me]=(0,L.useState)(!0),he=(0,L.useRef)(!0),ge=(0,L.useRef)(-1),_e=(0,L.useRef)(0),ve=(0,L.useRef)(null),ye=(0,L.useRef)(!1),be=(0,L.useRef)(!1),xe=(0,L.useRef)(!0),Se=(0,L.useRef)(null),Ce=(0,L.useRef)(void 0),we=(0,L.useRef)(null),Te=(0,L.useRef)(void 0),Ee=(0,L.useRef)(0),De=(0,L.useRef)(0),Oe=(0,L.useCallback)(()=>{let e=t.current;if(e){let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-transcript-source-id]`)).find(e=>e.getBoundingClientRect().bottom>t+1),r=n?.dataset.transcriptRowKey;n&&r&&(Se.current={rowKey:r,viewportTop:n.getBoundingClientRect().top-t})}S()},[S,t]),ke=(0,L.useCallback)((e,n)=>{let r=t.current;if(!r)return;let i=Array.from(r.querySelectorAll(`[data-transcript-source-id]`)).find(t=>t.dataset.transcriptSourceId===e);i&&(r.scrollTop+=i.getBoundingClientRect().top-n)},[t]);(0,L.useLayoutEffect)(()=>{if(!n||de.length===0||Ce.current===n)return;Ce.current=n,ye.current=!1,be.current=!1,xe.current=!0;let r=Pk(e)?.candidates.map(e=>({candidate:e,index:de.findIndex(t=>t.kind===`message`&&t.message.sourceId===e.sourceId)})).find(e=>e.index>=0),i=!r&&w&&j>=0?de.reduce((e,t,n)=>t.kind===`message`&&t.messageIndex<=j&&t.message.role===`assistant`&&t.message.kind!==`event`?n:e,-1):-1,a=requestAnimationFrame(()=>{if(!r&&i>=0){let e=de[i].key;fe.scrollToIndex(i,{align:`start`,behavior:`instant`}),he.current=!1,me(!1),ye.current=!0;let n=performance.now()+d8;Ee.current=n;let r=()=>{let i=t.current;if(!i||performance.now()>=n||performance.now()<_e.current){Ee.current=0,De.current=0,i&&i.scrollHeight-i.clientHeight-i.scrollTop<=4&&(he.current=!0,ge.current=i.scrollHeight,me(!0));return}let a=i.querySelector(`[data-transcript-row-key="${CSS.escape(e)}"]`);a&&(i.scrollTop+=a.getBoundingClientRect().top-i.getBoundingClientRect().top),De.current=requestAnimationFrame(r)};r();return}if(!r){fe.scrollToEnd({behavior:`instant`}),me(!0),ye.current=!0;return}fe.scrollToIndex(r.index,{align:`start`,behavior:`instant`}),he.current=!1,me(!1),ye.current=!0;let e=performance.now()+u8;Ee.current=e;let n=()=>{performance.now()>=e||performance.now()<_e.current||(ke(r.candidate.sourceId,r.candidate.screenTop),a=requestAnimationFrame(n))};n()});return()=>cancelAnimationFrame(a)},[ke,de.length,e,n,fe]),(0,L.useEffect)(()=>()=>cancelAnimationFrame(De.current),[]),(0,L.useLayoutEffect)(()=>{let e=Se.current,n=t.current;if(!e||!n||b)return;let r=()=>{let t=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey);if(!t)return;let r=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=r-e.viewportTop};r();let i=0,a=requestAnimationFrame(()=>{r(),i=requestAnimationFrame(()=>{r(),Se.current===e&&(Se.current=null)})});return()=>{cancelAnimationFrame(a),cancelAnimationFrame(i)}},[b,I.length,t]);let Ae=(0,L.useCallback)(()=>{let e=t.current;if(!e)return null;let n=e.getBoundingClientRect().top,r=Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.getBoundingClientRect().bottom>n+1),i=r?.dataset.transcriptRowKey;return!r||!i?null:{rowKey:i,viewportTop:r.getBoundingClientRect().top-n}},[t]),je=(0,L.useCallback)(e=>{let n=t.current;if(!n)return;let r=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey);if(!r)return;let i=r.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=i-e.viewportTop},[t]),Me=I[0]?.key;(0,L.useLayoutEffect)(()=>{let e=Te.current;if(Te.current=Me,e===void 0||e===Me||!ye.current||he.current||Se.current)return;let t=we.current;if(!t)return;je(t);let n=()=>{if(performance.now()<_e.current)return;let e=we.current;e&&je(e)},r=0,i=requestAnimationFrame(()=>{n(),r=requestAnimationFrame(n)});return()=>{cancelAnimationFrame(i),cancelAnimationFrame(r)}},[je,Me]);let Ne=(0,L.useCallback)(()=>{let e=t.current;if(!e||Se.current||performance.now()<Ee.current)return;let n=D6({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,previousScrollHeight:ge.current,following:he.current,readerMoved:performance.now()<_e.current});if(he.current=n.following,n.scrollTop!==null&&(e.scrollTop=n.scrollTop),ge.current=e.scrollHeight,me(e=>e===n.following?e:n.following),f8&&!n.following&&performance.now()>=_e.current){let t=we.current,n=t&&Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.dataset.transcriptRowKey===t.rowKey);if(t&&n){let r=Math.round(n.getBoundingClientRect().top-e.getBoundingClientRect().top-t.viewportTop);Math.abs(r)>2&&console.warn(`[frizz] transcript moved ${r}px under a still reader — row=${t.rowKey}`)}}we.current=Ae()??we.current},[Ae,t]);(0,L.useLayoutEffect)(Ne),(0,L.useEffect)(()=>{let e=ve.current;if(!e)return;let t=new ResizeObserver(Ne);return t.observe(e),()=>t.disconnect()},[Ne]),(0,L.useEffect)(()=>{let e=t.current;if(!e)return;let n=()=>{Ne();let t=O6({armed:xe.current,scrollTop:e.scrollTop,readerMoved:ye.current&&be.current,hasEarlier:v,loading:b});xe.current=t.armed,t.shouldLoad&&Oe()},r=()=>{be.current=!0,_e.current=performance.now()+l8,requestAnimationFrame(n)},i=t=>{[`ArrowUp`,`PageUp`,`Home`,` `].includes(t.key)&&(e.scrollTop<=480&&(xe.current=!0),r())},a=t=>{t.deltaY<0&&e.scrollTop<=480&&(xe.current=!0),r()},o=()=>{e.scrollTop<=480&&(xe.current=!0),r()};e.addEventListener(`scroll`,n,{passive:!0}),e.addEventListener(`wheel`,a,{passive:!0}),e.addEventListener(`touchstart`,o,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!0}),e.addEventListener(`pointerdown`,r,{passive:!0}),e.addEventListener(`keydown`,i);let s=requestAnimationFrame(n);return()=>{cancelAnimationFrame(s),e.removeEventListener(`scroll`,n),e.removeEventListener(`wheel`,a),e.removeEventListener(`touchstart`,o),e.removeEventListener(`touchmove`,o),e.removeEventListener(`pointerdown`,r),e.removeEventListener(`keydown`,i)}},[v,b,Oe,Ne,t]);let Pe=fe.getVirtualItems(),Fe=fe.getTotalSize();return(0,R.jsxs)(`div`,{ref:ve,"data-virtualized-transcript":!0,"data-virtual-row-count":Pe.length,className:`relative w-full`,style:{height:Fe},children:[Pe.map(t=>{let n=de[t.index];return n?(0,R.jsx)(`div`,{ref:fe.measureElement,"data-index":t.index,"data-transcript-row-key":n.key,"data-transcript-source-id":n.kind===`message`?n.message.sourceId:void 0,className:`absolute left-0 top-0 w-full hover:z-[1]`,style:{transform:`translateY(${t.start}px)`},children:n.kind===`head-anchor`?null:n.kind===`interactions`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(e3,{thread:d,className:`px-6 pt-5`,autoFocusFirst:!0}),(0,R.jsx)(i0,{thread:d,questions:ce.tail,inFlight:a,showSend:ce.tailSend,className:`px-6 pt-5`})]}):n.kind===`questions`?(0,R.jsx)(i0,{thread:d,questions:n.questions,showSend:n.send,className:`px-6 pt-5`}):n.kind===`settled-questions`?(0,R.jsx)(t0,{questions:n.questions,className:`px-6 pt-5`}):n.kind===`transport-fallback`?m?(0,R.jsx)(`div`,{className:`px-6 pt-3`,children:(0,R.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`flex flex-wrap items-center gap-2.5 ${TQ} border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:m.kind===`payload-too-large`?`Live payload ${m.actualBytes} bytes; socket limit ${m.maxBytes} bytes`:`Transcript read budget reached (${m.scope}); retry after about ${m.retryAfterMs}ms`,children:[(0,R.jsx)($_,{size:13,className:`shrink-0 text-muted`}),(0,R.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,m.kind===`payload-too-large`?`The transcript is too large for push; it refreshes over HTTP each time the thread moves.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,R.jsx)(`button`,{type:`button`,disabled:h,onClick:g,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-40`,children:h?`Refreshing…`:`Refresh once`}),(0,R.jsx)(`button`,{type:`button`,onClick:_,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`,children:`Retry live`})]})}):null:n.kind===`earlier-history`?(0,R.jsx)(`div`,{className:`flex min-h-10 items-center justify-center px-6 text-[11px] text-muted`,role:`status`,children:x?(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-2 text-center`,children:[(0,R.jsx)(`span`,{children:x}),(0,R.jsx)(`button`,{type:`button`,onClick:Oe,className:`rounded-md border border-border px-2 py-1 text-fg/90 hover:bg-panel-2`,children:`Retry`})]}):b?(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(E_,{size:12,className:`animate-spin`}),` Loading earlier messages…`]}):(0,R.jsx)(`button`,{type:`button`,onClick:Oe,className:`button-outline rounded-md px-2 py-1 outline-none hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:`Load earlier messages`})}):n.kind===`message`?(0,R.jsx)(d4,{at:n.stampAt,host:I0(n.message,i[n.messageIndex]),gap:n.gap,children:(0,R.jsx)(x5,{m:n.message,answering:u?o(n.message):void 0,showSendButton:!0,paired:i[n.messageIndex],staleAwaiting:M>=0&&n.messageIndex<M,restingCardShown:n.messageIndex===j&&N,shadowedBy:ue.get(n.messageIndex),placed:s.placed.get(n.messageIndex),settledPlaced:c.placed.get(n.messageIndex),thread:d})}):n.kind===`runtime-status`?(0,R.jsxs)(`div`,{className:`px-6`,style:{paddingTop:se},children:[(0,R.jsx)(_8,{state:ae,slug:e,retryText:ee>=0?r[ee]?.text:void 0,onTerminal:p,liveRuntimeStart:A,liveActivityLabel:k,liveToolRun:D}),d?.permPolicy?(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(M5,{policy:d.permPolicy,denies:d.permDenies})}):null]}):(0,R.jsx)(d4,{at:n.message.at,host:I0(n.message,i[n.messageIndex]),gap:n.gap,children:(0,R.jsx)(x5,{m:n.message,paired:i[n.messageIndex]})})},n.key):null}),(0,R.jsx)(y8,{overlay:C,hidden:pe,onJump:()=>fe.scrollToEnd({behavior:`smooth`})})]})}function y8({overlay:e,hidden:t,onJump:n}){return!e||t?null:(0,Tn.createPortal)((0,R.jsxs)(`button`,{type:`button`,"data-jump-to-latest":!0,onClick:n,className:`flex items-center gap-1.5 rounded-full border border-border-strong bg-elevated px-3 py-1.5 text-[11px] font-medium text-fg shadow-lg shadow-shadow-ink/30 hover:bg-panel-2`,children:[(0,R.jsx)(see,{size:12}),`Jump to latest`]}),e)}function b8({slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:r=!1}){let i=gg(wE(),e),a=pt({mutationFn:()=>Y.markComplete({slug:e})}),o=WY(ct({queryKey:[`threadBody`,e],queryFn:()=>Y.threadBody({slug:e})}).data?.markdown??``).trim().length>0;if(!i)return null;let s=i.kind===`session`&&i.foreign!==!0;return(0,R.jsxs)(`header`,{"data-thread-header":!0,className:a2,children:[(0,R.jsx)(`div`,{className:o2,children:(0,R.jsxs)(`div`,{className:`min-w-0 leading-tight`,children:[(0,R.jsx)(Y2,{thread:i}),(0,R.jsx)(q2,{thread:i})]})}),(0,R.jsxs)(`div`,{className:s2,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[s&&(0,R.jsx)(E6,{slug:e}),(0,R.jsx)(j2,{thread:i,collapse:r,onDoc:o?()=>Hh(`doc`,i.id):void 0,onDone:()=>a.mutate(void 0,{onSuccess:t}),doneBusy:a.isPending,onStatusApplied:t}),n&&(0,R.jsx)(HP,{slug:e}),(0,R.jsx)(aq,{thread:i,onArchived:t})]}),n&&(0,R.jsx)(`span`,{"aria-hidden":!0,"data-close-rule":!0,className:`ml-3 mr-2.5 h-4 w-px shrink-0 bg-border max-[640px]:hidden`}),n&&(0,R.jsx)(`button`,{type:`button`,"aria-label":`Close`,"data-dialog-initial-focus":!0,onClick:n,className:`icon-hover-outline shrink-0 rounded-md p-1.5 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,R.jsx)(tv,{size:15})})]})]})}function x8(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||e4(e))return null;if(e.parts&&e.parts.length>0){for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.kind===`tools`?n.tools.length>0:n.text.trim())return n.kind===`tools`?n.tools:null}return null}return(e.tools?.length??0)>0&&!e.text.trim()?e.tools:null}function S8(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||e4(e))return null;if(e.parts&&e.parts.length>0){for(let t of e.parts)if(t.kind===`tools`?t.tools.length>0:t.text.trim())return t.kind===`tools`?t.tools:null;return null}return(e.tools?.length??0)>0?e.tools:null}function C8(e){return x8(e)!==null}function w8(e){return S8(e)!==null}function T8(e){return e.kind===`event`&&!e.boundary||e.kind===`reasoning`}function E8(e){return T8(e)||C8(e)}function D8(e){return T8(e)||w8(e)}function O8(e){if(T8(e))return!0;let t=x8(e);return t!==null&&!SG(t[t.length-1])}function k8(e){if(T8(e))return!0;let t=S8(e);return t!==null&&!SG(t[0])}function A8(e){let t=x8(e);return t!==null&&TG(t[t.length-1])}function j8(e){let t=S8(e);return t!==null&&TG(t[0])}function M8(e,t){let n=A8(e)||j8(t),r=!n&&E8(e)&&D8(t)&&!(O8(e)&&k8(t));return(n?22:r?6:14)+(e.role===`user`&&t.role!==`user`?3:0)}function N8(e,t){return e.kind===`event`||e.kind===`reasoning`||e.role===`user`?!1:e.parts&&e.parts.length>0?e.parts.every(n=>n.kind===`tools`?n.tools.length===0:I8(e,n.text,t)):(e.tools?.length??0)===0&&I8(e,e.text,t)}function P8(e){for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`&&e[t].kind!==`event`)return t;return-1}function F8(e,t,n=!1){let r=new WeakSet;if(t>=0)for(let n of e)n.messageIndex<t&&r.add(n.message);if(t>=0&&n)for(let n of e)n.messageIndex===t&&r.add(n.message);return e=>N8(e,r.has(e))}function I8(e,t,n){return!e.fenceRefused&&!n?!t.trim():SQ(t).every(e=>e.kind===`fence`&&e.fenceKind===`awaiting`)}function L8(e,t){return e.kind===`event`||e.kind===`reasoning`||e.role===`user`?!1:e.parts&&e.parts.length>0?e.parts.some(n=>n.kind===`text`&&!I8(e,n.text,t)):typeof e.text==`string`&&!I8(e,e.text,t)}function R8(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.queued||N8(n)))return A8(n)?22:E8(n)&&!O8(n)?6:14+(n.role===`user`?3:0)}return 0}function z8(e,t,n){let r=[],i=null;return e.forEach((e,a)=>{n?.(e,a)||N8(e)||(i!==null&&r.push((0,R.jsx)(M$,{h:M8(i,e)},`s${a}`)),r.push(t(e,a)),i=e)}),r}function B8(e){let t=[];for(let n of e){if(n.kind===`text`){if(!n.text.trim())continue;t.push(n);continue}if(n.tools.length===0)continue;let e=t[t.length-1];e&&e.kind===`tools`?t[t.length-1]={kind:`tools`,tools:[...e.tools,...n.tools]}:t.push(n)}return t}function V8(e,t=14){let n=e.filter(e=>e!=null&&e!==!1),r=[];return n.forEach((e,n)=>{n>0&&r.push((0,R.jsx)(M$,{h:typeof t==`number`?t:t(n)},`vs${n}`)),r.push(e)}),r}var H8={head:!1,tail:!1};function U8(e,t){return n=>e[n-1]?.tail||e[n]?.head?22:t}function W8(e){return{head:TG(e[0]),tail:TG(e[e.length-1])}}function G8(e){let t=[];for(let n of e){let e=t[t.length-1];if(n.edit){let r=!!(n.input||n.output||n.status||n.exitCode!==void 0);e&&e.edits&&!r&&!e.input&&!e.output&&!e.status&&e.edits[0].file===n.edit.file?e.edits.push(n.edit):t.push({name:n.name,detail:n.detail,edits:[n.edit],input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}else n.command?t.push({name:n.name,detail:n.detail,command:n.command,desc:n.desc,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):n.outputImage?t.push({name:n.name,detail:n.detail,outputImage:n.outputImage,output:n.output??n.read,status:n.status,durationMs:n.durationMs,count:1}):n.read?t.push({name:n.name,detail:n.detail,read:n.read,status:n.status,durationMs:n.durationMs,count:1}):n.prompt||n.agentId?t.push({name:n.name,detail:n.detail,prompt:n.prompt,input:n.input,subagentType:n.subagentType,agentId:n.agentId,agentStatus:n.agentStatus,agentElapsedMs:n.agentElapsedMs,output:n.output,status:n.status,durationMs:n.durationMs,count:1}):n.sendTo!==void 0||n.sendBody!==void 0?t.push({name:n.name,detail:n.detail,sendTo:n.sendTo,sendSummary:n.sendSummary,sendBody:n.sendBody,sendType:n.sendType,sendDispatchId:n.sendDispatchId,sendTargetLabel:n.sendTargetLabel,status:n.status,durationMs:n.durationMs,count:1}):n.todos?t.push({name:n.name,detail:n.detail,todos:n.todos,input:n.input,status:n.status,durationMs:n.durationMs,count:1}):wG(n)?t.push({name:n.name,detail:n.detail,ask:n.ask,askAnswers:n.askAnswers,status:n.status,durationMs:n.durationMs,count:1}):n.sentImages||n.sentFiles?t.push({name:n.name,detail:n.detail,sentImages:n.sentImages,sentFiles:n.sentFiles,caption:n.caption,status:n.status,durationMs:n.durationMs,count:1}):n.input||n.output?t.push({name:n.name,detail:n.detail,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):e&&!e.edits&&!e.command&&!e.input&&!e.output&&!e.read&&!e.prompt&&!e.outputImage&&!e.sentImages&&!e.sentFiles&&e.sendTo===void 0&&e.sendBody===void 0&&e.name===n.name&&e.detail===n.detail&&e.status===n.status&&e.backgroundState===n.backgroundState&&e.exitCode===n.exitCode&&e.cwd===n.cwd&&e.sessionId===n.sessionId&&e.durationMs===n.durationMs?e.count++:t.push({name:n.name,detail:n.detail,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}return t}function K8(e){return e.split(`__`).pop()||e}function q8(e){let t=X.board?.projectDir;return t&&e.startsWith(t+`/`)?e.slice(t.length+1):e}function J8({tools:e,at:t}){let[n,r]=(0,L.useState)(!1),i=(0,L.useId)(),a=e.reduce((e,t)=>e+t.count,0),o=$G(a,ZG(e));return(0,R.jsxs)(`div`,{"data-tool-activity":!0,"data-tool-activity-state":`settled`,className:`flex min-w-0 flex-col`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":i,"aria-expanded":n,"aria-label":`${n?`Collapse`:`Expand`} ${a} tool ${a===1?`call`:`calls`}: ${o}`,className:`group flex w-full min-w-0 items-baseline gap-1.5 rounded py-0.5 text-left outline-none transition-colors hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60 ${f4}`,children:[(0,R.jsx)(`span`,{"data-tool-activity-label":!0,title:o,className:`min-w-0 truncate text-muted`,children:o}),(0,R.jsx)(Zg,{"data-tool-activity-chevron":!0,"aria-hidden":`true`,size:13,className:m4(n)})]}),n&&(0,R.jsx)(`div`,{id:i,className:`mt-1.5 flex flex-col`,children:V8(e.map((e,n)=>(0,R.jsx)(X8,{t:e,startedAt:t},n)),6)}),!n&&(0,R.jsx)(`div`,{id:i,hidden:!0})]})}function Y8({tools:e,at:t}){let n=[];for(let t of e){let e=SG(t),r=n[n.length-1];r?.exceptional===e?r.tools.push(t):n.push({exceptional:e,tools:[t]})}return(0,R.jsx)(`div`,{className:`flex flex-col`,children:V8(n.map((e,n)=>e.exceptional?(0,R.jsx)(`div`,{className:`flex flex-col`,children:V8(e.tools.map((e,n)=>(0,R.jsx)(X8,{t:e,startedAt:t},n)),U8(e.tools.map(e=>W8([e])),6))},`exceptions-${n}`):(0,R.jsx)(J8,{tools:e.tools,at:t},`activity-${n}`)),U8(n.map(e=>W8(e.tools)),6))})}function X8({t:e,startedAt:t}){let n=(0,L.useContext)(e8),r=wE(),i=YO(e,(n?gg(r,n):void 0)?.bgShells??[]);return e.edits&&e.status!==`failed`&&e.status!==`cancelled`?(0,R.jsx)(FX,{edits:e.edits,meta:(0,R.jsx)(t5,{status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,durationMs:e.durationMs})}):e.command?(0,R.jsx)(l5,{command:e.command,desc:e.desc??e.detail,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t}):e.outputImage?(0,R.jsx)(o5,{name:e.name,detail:e.detail,outputImage:e.outputImage,output:e.output,status:e.status,durationMs:e.durationMs}):e.read?(0,R.jsx)(d5,{detail:e.detail,read:e.read,status:e.status,durationMs:e.durationMs}):e.prompt||e.agentId?(0,R.jsx)(p5,{detail:e.detail,prompt:e.prompt,subagentType:e.subagentType,agentId:e.agentId,agentStatus:e.agentStatus,agentElapsedMs:e.agentElapsedMs,status:e.status,durationMs:e.durationMs}):e.sendTo!==void 0||e.sendBody!==void 0?(0,R.jsx)(h5,{to:e.sendTo,summary:e.sendSummary,body:e.sendBody??``,type:e.sendType,dispatchId:e.sendDispatchId,targetLabel:e.sendTargetLabel,status:e.status,durationMs:e.durationMs,at:t}):e.sentImages||e.sentFiles?(0,R.jsx)(s5,{images:e.sentImages??[],files:e.sentFiles??[],caption:e.caption,status:e.status,durationMs:e.durationMs}):e.todos?(0,R.jsx)(QZ,{todos:e.todos,note:e.input,meta:(0,R.jsx)(t5,{status:e.status,durationMs:e.durationMs})}):wG(e)?(0,R.jsx)(Z8,{ask:e.ask??[],askAnswers:e.askAnswers}):e.input||e.output?(0,R.jsx)(l5,{name:e.name,command:e.input??``,desc:e.detail,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,inputLabel:`input`,startedAt:t}):(0,R.jsx)(a5,{name:e.name,detail:e.detail,count:e.count,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,cwd:e.cwd,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t})}function Z8({ask:e,askAnswers:t}){return(0,R.jsx)(`div`,{"data-settled-ask":!0,className:`flex flex-col gap-1.5`,children:e.map((e,n)=>{let r=X4(e,t?.[n]);return(0,R.jsx)(g1,{question:r.question,settled:{chosenIdxs:r.chosenIdxs,text:r.text}},n)})})}function Q8({tone:e,indicator:t,label:n,duration:r,title:i}){return(0,R.jsxs)(`span`,{className:`petite-caps frizz-tool-header-caps flex shrink-0 items-center gap-1 whitespace-nowrap text-[11.5px] leading-none ${e}`,title:i,"aria-label":i,children:[t,(0,R.jsx)(`span`,{children:[n,r].filter(Boolean).join(` · `)})]})}function $8(e,t,n){let[r,i]=(0,L.useState)(()=>Date.now()),a=KO(e,t),o=qO(e,t,n,r);return(0,L.useEffect)(()=>{if(!a||o)return;let e=n?Date.parse(n):NaN;if(!Number.isFinite(e))return;let t=setTimeout(()=>i(Date.now()),Math.max(GO-(Date.now()-e),0));return()=>clearTimeout(t)},[a,o,n]),o}function e5({status:e,backgroundState:t,liveBackgroundState:n,startedAt:r}){let i=$8(e,t,r),a=n===`running`?(0,R.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):n===`stale`?(0,R.jsx)(`span`,{className:lk,title:pk}):WO(e,t)||i?(0,R.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):null;return a?(0,R.jsx)(`span`,{className:`frizz-tool-mark -mr-1 flex w-[9px] shrink-0 justify-center`,children:a}):null}function t5({status:e,backgroundState:t,liveBackgroundState:n,exitCode:r,durationMs:i}){if(!e&&i===void 0)return null;let[a,o]=n===`running`?[`running`,`background running`]:n===`stale`?[`stale`,`background stale`]:e===`pending`?t===`unknown`?[`unknown`,`background / unknown`]:[`running`,t===`background`?`background running`:`running`]:e===`failed`?r===void 0?[`failed`,`failed`]:[`exit ${r}`,`exit ${r}`]:e===`cancelled`?[`cancelled`,`cancelled`]:e===`completed`?[`done`,`done`]:[void 0,void 0],s=i===void 0?void 0:XO(i),c=[o,s].filter(Boolean).join(` · `);return(0,R.jsx)(Q8,{tone:e===`failed`?`frizz-tool-failed`:e===`cancelled`?`text-attention`:`text-muted-55`,title:c,label:a,duration:s})}function n5(e,t,n){let r=t?Date.parse(t):NaN,i=e===`pending`&&Number.isFinite(r),[a,o]=(0,L.useState)(()=>Date.now());return(0,L.useEffect)(()=>{if(!i)return;let e=()=>o(Date.now()),t,n=setTimeout(()=>{e(),t=setInterval(e,1e3)},1e3-Date.now()%1e3);return()=>{clearTimeout(n),t&&clearInterval(t)}},[i,t]),i?Math.max(a-r,0):n}function r5(e,t,n){let r=t&&t!==X.board?.projectDir?`in ${q8(t)}`:void 0;return[e,t?r:n!==void 0&&!e?.includes(String(n))?`session ${n}`:void 0].filter(Boolean).join(` · `)||void 0}function i5(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.includes(`…`)}function a5({name:e,detail:t,count:n,status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,cwd:s,sessionId:c,durationMs:l,startedAt:u}){let d=r5(t,s,c),f=d?q8(d):void 0,p=t&&i5(t)?t:void 0;return(0,R.jsx)(`div`,{className:`frizz-bash`,title:d,children:(0,R.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(e5,{status:r,backgroundState:i,liveBackgroundState:a,startedAt:u}),(0,R.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:K8(e)}),f&&(p?(0,R.jsx)(`span`,{className:`min-w-0 truncate`,onClick:e=>e.stopPropagation(),children:(0,R.jsx)(PX,{path:p,className:`text-[11.5px] text-muted`,children:f})}):(0,R.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:f}))]}),(0,R.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,R.jsx)(t5,{status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,durationMs:l}),n>1&&(0,R.jsxs)(`span`,{className:`tabular-nums text-[11px] text-muted-45`,children:[`×`,n]})]})]})})}function o5({name:e,detail:t,outputImage:n,output:r,status:i,durationMs:a}){let[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),u=(0,L.useId)(),d=K8(e),f=t?q8(t):void 0;return(0,R.jsxs)(`div`,{"data-tool-image":!0,className:`frizz-bash`,children:[(0,R.jsxs)(NX,{className:`frizz-bash-header`,controls:u,expanded:o,label:`${o?`Collapse`:`Expand`} ${d}${t?`: ${t}`:``}`,onToggle:()=>s(e=>!e),meta:(0,R.jsx)(t5,{status:i,durationMs:a}),children:[(0,R.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:d}),f&&(0,R.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,title:t,children:f})]}),(0,R.jsx)(`div`,{id:u,hidden:!o,children:o&&(0,R.jsxs)(R.Fragment,{children:[c?(0,R.jsx)(`div`,{className:`frizz-bash-body break-all text-muted-70`,children:n}):(0,R.jsx)(`div`,{className:`flex justify-center bg-panel-2 p-1.5`,children:(0,R.jsx)(`img`,{src:MT(n),alt:f?`${d}: ${f}`:d,"data-local-path":n,"data-local-image":`true`,onError:()=>l(!0),className:`cursor-zoom-in block max-h-[420px] max-w-full w-auto rounded-md object-contain`})}),r&&(0,R.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body`,children:r})]})})]})}function s5({images:e,files:t,caption:n,status:r,durationMs:i}){let[a,o]=(0,L.useState)(!0),s=(0,L.useId)(),c=(0,L.useMemo)(()=>e.map(e=>({target:e,title:n??`Delivered image`})),[e,n]),l=[e.length?`${e.length} image${e.length===1?``:`s`}`:``,t.length?`${t.length} file${t.length===1?``:`s`}`:``].filter(Boolean).join(` · `);return(0,R.jsxs)(`div`,{className:`frizz-bash`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":s,"aria-expanded":a,"aria-label":`${a?`Collapse`:`Expand`} files sent to you${l?`: ${l}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-60`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Sent to you`}),l&&(0,R.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:l})]}),(0,R.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,R.jsx)(t5,{status:r,durationMs:i}),(0,R.jsx)(Zg,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${a?`rotate-90`:``}`})]})]}),(0,R.jsx)(`div`,{id:s,hidden:!a,children:a&&(0,R.jsxs)(R.Fragment,{children:[e.length>0&&(0,R.jsx)(hZ,{entries:c,framed:!1}),(t.length>0||n)&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5 px-2.5 pb-2.5 pt-1.5`,children:[t.length>0&&(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map((e,t)=>(0,R.jsx)(w5,{path:e},`f${t}`))}),n&&(0,R.jsx)(`div`,{className:`max-w-[65%] text-[12px] leading-snug text-muted`,children:n})]})]})})]})}var c5=16;function l5({command:e,desc:t,output:n,name:r=`Bash`,status:i,backgroundState:a,liveBackgroundState:o,exitCode:s,sessionId:c,durationMs:l,inputLabel:u,startedAt:d}){let[f,p]=(0,L.useState)(!1),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(!1),v=(0,L.useId)(),y=n5(i,d,l),b=(0,L.useMemo)(()=>e.split(`
|
|
323
|
+
`).length>6?(0,R.jsxs)(`details`,{className:`rounded-md border border-border/70 bg-panel/60`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer px-2.5 py-2 text-[11px] text-muted outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-50`,children:`Request message`}),(0,R.jsx)(`div`,{className:`max-h-52 overflow-auto border-t border-border/60 px-2.5 py-2 whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})]}):(0,R.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})}function f3({url:e}){let t=V4(e,location.href);return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[11px] font-medium text-fg`,children:`Open this page to continue`}),(0,R.jsx)(`code`,{className:`mt-1.5 block max-h-24 overflow-auto break-all rounded-md border border-border bg-bg/40 px-2.5 py-2 font-mono-keep text-[10.5px] text-fg/80`,children:e}),t?(0,R.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 inline-flex items-center gap-1.5 rounded-md border border-border bg-panel px-2.5 py-1.5 text-[11px] font-medium text-fg hover:bg-panel-2`,children:[(0,R.jsx)(u_,{"aria-hidden":`true`,size:12}),`Open page`]}):(0,R.jsx)(`div`,{role:`alert`,className:`mt-1.5 break-words text-[11px] text-danger-soft`,children:`This request did not provide a safe http(s) URL.`})]})}function p3({record:e}){return(0,R.jsxs)(`details`,{className:`mt-3 border-t border-border/50 pt-2 text-[10.5px] text-muted-70`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer w-fit outline-none hover:text-muted focus-visible:ring-1 focus-visible:ring-focus-ink-50`,children:`Request details`}),(0,R.jsxs)(`dl`,{className:`mt-2 grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1`,children:[(0,R.jsx)(`dt`,{children:`Provider`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:P4(e.provider.kind)}),e.provider.name&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Reported name`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.name})]}),e.provider.version&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Reported version`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.version})]}),(0,R.jsx)(`dt`,{children:`Source`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:F4(e.source.kind)}),e.source.label&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Reported source`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.source.label})]}),(0,R.jsx)(`dt`,{children:`Scope`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:`This thread · this request`}),e.expiresAt&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Expires`}),(0,R.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.expiresAt})]})]})]})}function m3({instanceId:e,fields:t,draft:n,setValue:r,errors:i,autoFocus:a}){let o=t.findIndex(e=>!e.secret);return(0,R.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,R.jsx)(`legend`,{className:`sr-only`,children:`Requested information`}),(0,R.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:t.map((t,s)=>(0,R.jsx)(h3,{instanceId:e,field:t,value:n[t.id],setValue:e=>r(t.id,e),error:i[t.id],autoFocus:a&&s===o},t.id))})]})}function h3({instanceId:e,field:t,value:n,setValue:r,error:i,autoFocus:a}){let o=`${e}-${t.id}`,s=t.description?`${o}-description`:void 0,c=i?`${o}-error`:void 0,l=[s,c].filter(Boolean).join(` `)||void 0,u=(0,R.jsxs)(R.Fragment,{children:[t.label,t.required&&(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`ml-0.5 text-accent`,children:`*`})]}),d=`mt-1 w-full min-w-0 rounded-md border border-border bg-bg/45 px-2.5 py-2 text-[12px] text-fg outline-none focus:border-accent focus:ring-1 focus:ring-focus-accent-40`,f;if(t.secret)f=(0,R.jsx)(`div`,{className:`mt-1 text-[11px] text-attention-soft-70`,children:`Use the secure fallback below.`});else if(t.input===`multiline`)f=(0,R.jsx)(`textarea`,{id:o,name:t.id,"data-1p-ignore":!0,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,minLength:t.minLength,maxLength:t.maxLength,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,rows:4,className:`${d} resize-y`});else if(t.input===`text`){let e=t.format===`email`?`email`:t.format===`uri`?`url`:t.format===`date`?`date`:`text`;f=(0,R.jsx)(`input`,{id:o,name:t.id,type:e,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,minLength:t.minLength,maxLength:t.maxLength,placeholder:t.format===`date-time`?`2026-07-13T12:00:00Z`:void 0,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d})}else if(t.input===`number`||t.input===`integer`)f=(0,R.jsx)(`input`,{id:o,name:t.id,type:`number`,step:t.input===`integer`?1:`any`,min:t.minimum,max:t.maximum,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d});else if(t.input===`boolean`)f=(0,R.jsxs)(`label`,{htmlFor:o,className:`mt-1 flex cursor-pointer items-center gap-2 rounded-md border border-border bg-bg/30 px-2.5 py-2 text-[12px] text-fg/85`,children:[(0,R.jsx)(`input`,{id:o,name:t.id,type:`checkbox`,checked:n===!0,onChange:e=>r(e.target.checked),"aria-describedby":l,autoFocus:a,className:`accent-[var(--color-accent)]`}),(0,R.jsx)(`span`,{children:u})]});else if(t.input===`select`)f=(0,R.jsxs)(`select`,{id:o,name:t.id,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d,children:[(0,R.jsx)(`option`,{value:``,children:`Choose an option…`}),t.options.map((e,t)=>(0,R.jsx)(`option`,{value:String(t),children:e.label},t))]});else if(t.input===`multi-select`){let e=Array.isArray(n)?n:[];f=(0,R.jsxs)(`fieldset`,{id:o,"aria-describedby":l,className:`mt-1 rounded-md border border-border bg-bg/30 px-2.5 py-2`,children:[(0,R.jsx)(`legend`,{className:`px-1 text-[11px] font-medium text-fg/85`,children:u}),(0,R.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.options.map((n,i)=>{let o=String(i);return(0,R.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-[12px] text-fg/85`,children:[(0,R.jsx)(`input`,{type:`checkbox`,name:t.id,value:o,checked:e.includes(o),onChange:t=>r(t.target.checked?[...e,o]:e.filter(e=>e!==o)),autoFocus:a&&i===0,className:`mt-0.5 accent-[var(--color-accent)]`}),(0,R.jsx)(`span`,{children:n.label})]},o)})})]})}return(0,R.jsxs)(`div`,{className:`min-w-0`,children:[t.secret?(0,R.jsx)(`div`,{className:`text-[11px] font-medium text-fg/85`,children:u}):t.input!==`boolean`&&t.input!==`multi-select`?(0,R.jsx)(`label`,{htmlFor:o,className:`block text-[11px] font-medium text-fg/85`,children:u}):null,t.description&&(0,R.jsx)(`div`,{id:s,className:`mt-0.5 whitespace-pre-wrap break-words text-[10.5px] leading-snug text-muted`,children:t.description}),f,i&&(0,R.jsx)(`div`,{id:c,role:`alert`,className:`mt-1 text-[10.5px] text-danger-soft`,children:i})]})}function g3({steps:e}){return(0,R.jsx)(`div`,{"data-awaiting-steps":!0,className:`md-body ${wQ} mt-[var(--md-step)] first:mt-0`,children:(0,R.jsx)(`ol`,{children:e.map((e,t)=>(0,R.jsx)(_3,{md:e},t))})})}function _3({md:e}){return(0,R.jsx)(`li`,{children:(0,R.jsx)(GZ,{className:`md-body`,html:rX(e)})})}function v3({slug:e,onReplied:t,onReplyFailed:n}){let r=$U(e),[i,a]=(0,L.useState)(!1);return(0,R.jsx)(RQ,{"data-awaiting-steps-reply":!0,children:(0,R.jsx)(`button`,{type:`button`,"data-steps-done":!0,disabled:i,onClick:()=>{a(!0),r.submit(`Done`,{onOptimistic:()=>t?.(),onRollback:()=>{a(!1),n?.()}})||a(!1)},onMouseDown:e=>e.preventDefault(),className:`${VQ} disabled:opacity-60`,children:iW})})}function y3(e){return(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).length}function b3(e,t={}){let n=(e.subAgents??[]).filter(e=>Au(e)&&e.state===`running`).length,r=(e.bgShells??[]).filter(e=>e.state===`running`).length,i=t.watchers===!1?0:y3(e),a=[n>0?`${n} sub-agent${n===1?``:`s`}`:null,r>0?`${r} background shell${r===1?``:`s`}`:null,i>0?`${i} PR watcher${i===1?``:`s`}`:null].filter(e=>e!==null);return a.length===0?`0 background shells`:a.length===1?a[0]:`${a.slice(0,-1).join(`, `)} and ${a[a.length-1]}`}function x3(e){return(e.subAgents??[]).some(e=>Au(e)&&e.state===`running`)}function S3(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length}function C3(e){return x3(e)||S3(e)>0}function w3(e,t){return Yu(t)??(T3(e)?`Background shells running`:`Awaiting`)}function T3(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length>0&&!x3(e)&&y3(e)===0&&E3(e).length===0}function E3(e){return(e.watches??[]).filter(e=>e.kind===`timer`&&e.state===`armed`)}var D3={id:``,subAgents:[],bgShells:[],watches:[]},O3=[];function k3(e,t){if(t.length===0||e?.runtime!==`turn-idle`||e.lastFence?.kind!==`awaiting`)return!1;let n=Gu(e.lastFence.hints);return n.length===t.length&&n.every((e,n)=>e===t[n])}function A3(e,t){let n=new Set((e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).map(e=>e.target));return aW(t).filter(e=>!n.has(e.ref))}function j3({watch:e}){return(0,L.useEffect)(()=>{e.url&&Ym([e.ref])},[e.url,e.ref]),e.url?(0,R.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,"data-gh-ref":e.ref,className:`${BQ} text-[12px]`,children:e.ref}):(0,R.jsx)(`span`,{className:`text-[12px] text-muted`,children:e.ref})}var M3={mergeable:`no conflicts`,blocked:`merge blocked`,conflicting:`has conflicts`,unknown:null};function N3(e){return e.state!==`open`||e.merge===`blocked`&&e.checks!==`passing`&&e.checks!==`none`?null:M3[e.merge]}var P3=`shrink-0 self-baseline translate-y-[calc(0.5em_-_0.5cap)]`;function F3({tone:e}){return(0,R.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-3 rounded-full border ${e} border-t-transparent motion-safe:animate-spin ${P3}`})}function I3(){return(0,R.jsxs)(`svg`,{"aria-hidden":!0,viewBox:`0 0 16 16`,width:12,height:12,fill:`none`,stroke:`currentColor`,overflow:`visible`,className:P3,style:{color:ak.fgAttention},children:[(0,R.jsx)(`circle`,{cx:`8`,cy:`8`,r:`4`,fill:`currentColor`,stroke:`none`}),(0,R.jsxs)(`g`,{strokeWidth:`2`,className:`origin-center motion-safe:animate-spin`,children:[(0,R.jsx)(`circle`,{cx:`8`,cy:`8`,r:`7`,opacity:`0.25`}),(0,R.jsx)(`path`,{d:`M15 8A7 7 0 0 1 8 15`})]})]})}function L3({status:e}){return e?e.state===`merged`?(0,R.jsx)(g_,{size:12,className:P3,style:{color:ak.fgDone}}):e.state===`closed`?(0,R.jsx)(__,{size:12,className:P3,style:{color:ak.fgDanger}}):e.checks===`failing`?(0,R.jsx)(o_,{size:12,className:P3,style:{color:ak.fgDanger}}):e.checks===`passing`?(0,R.jsx)(t_,{size:12,className:P3,style:{color:ak.fgSuccess}}):e.gated>0&&e.running===0?(0,R.jsx)(e_,{size:12,className:P3,style:{color:ak.fgAttention}}):e.checks===`running`?(0,R.jsx)(I3,{}):(0,R.jsx)(n_,{size:12,className:`${P3} text-muted-60`}):(0,R.jsx)(n_,{size:12,className:`${P3} text-muted-60`})}function R3(e){return[e.failed>0?`${e.failed} failing`:null,e.gated>0?`${e.gated} awaiting approval`:null,e.running>0?`${e.running} in progress`:null,e.passed>0?`${e.passed} successful`:null,e.skipped>0?`${e.skipped} skipped`:null].filter(e=>e!==null).join(`, `)}function z3(e){if(!e)return`Checking…`;if(e.state===`merged`)return`Merged`;if(e.state===`closed`)return`Closed`;let t=R3(e),n=N3(e);return[t||`No checks`,n].filter(e=>e!==null).join(` · `)}var B3=`group relative col-span-4 grid grid-cols-subgrid items-baseline rounded-sm text-[12px] leading-5`,V3=`group relative col-span-4 flex items-baseline rounded-sm text-[12px] leading-5`,H3=`ml-1.5 min-w-0 truncate font-medium text-fg/90`,U3=`ml-3 min-w-0 truncate text-right text-muted-70`,W3=`outline-none after:absolute after:inset-0 after:rounded-sm focus-visible:after:ring-1 focus-visible:after:ring-fg/60`;function G3(){return(0,R.jsx)(Zg,{size:13,"aria-hidden":!0,className:`${P3} ml-[3px] -mr-[4px] text-muted-35 transition-colors group-hover:text-muted-70`})}function K3({mark:e,name:t,status:n,onOpen:r,onPrewarm:i,href:a,ghRef:o,title:s,testKind:c,testId:l,indent:u,dismiss:d}){let f=u!==void 0,p=f?`${H3} flex-1`:H3,m=a?(0,R.jsx)(`a`,{href:a,target:`_blank`,rel:`noreferrer noopener`,title:s,"data-gh-ref":o,onMouseDown:e=>e.stopPropagation(),className:`${p} ${W3} group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):r?(0,R.jsx)(`button`,{type:`button`,onClick:r,onMouseDown:e=>e.stopPropagation(),title:s,className:`${p} ${W3} text-left group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):(0,R.jsx)(`span`,{className:p,title:s,children:t}),h=!!(a||r),g=d&&(0,R.jsx)(`button`,{type:`button`,onClick:d.onDismiss,onMouseDown:e=>e.stopPropagation(),title:d.title,"aria-label":d.label,className:`relative ml-0.5 shrink-0 self-center rounded-sm p-0.5 text-muted-45 outline-none transition-colors hover:text-fg focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:(0,R.jsx)(tv,{size:11})});return(0,R.jsxs)(`div`,{"data-wait-row":l,"data-wait-kind":c,onMouseEnter:i,onFocus:i,style:f?{paddingLeft:u}:void 0,className:`${f?V3:B3} ${h?`cursor-pointer transition-colors hover:bg-fg/[0.045]`:``}`,children:[(0,R.jsx)(`span`,{className:`flex shrink-0`,children:e}),g?(0,R.jsxs)(`span`,{className:`flex min-w-0 items-baseline`,children:[m,g]}):m,(0,R.jsx)(`span`,{"data-wait-status":!0,className:U3,children:n}),h?(0,R.jsx)(G3,{}):(0,R.jsx)(`span`,{})]})}function q3({status:e}){return e?e.state===`closed`?e.stateReason===`not_planned`||e.stateReason===`duplicate`?(0,R.jsx)(a_,{size:12,className:`${P3} text-muted`}):(0,R.jsx)(t_,{size:12,className:P3,style:{color:ak.fgDone}}):(0,R.jsx)(r_,{size:12,className:P3,style:{color:ak.fgSuccess}}):(0,R.jsx)(n_,{size:12,className:`${P3} text-muted-60`})}function J3(e){if(!e)return`Checking…`;if(e.state===`closed`){let t=e.stateReason===`not_planned`?`not planned`:e.stateReason===`duplicate`?`duplicate`:null;return t?`Closed as ${t}`:`Closed`}return`Open · ${e.comments} comment${e.comments===1?``:`s`}`}function Y3({watch:e}){if(e.subject===`issue`)return(0,R.jsx)(X3,{watch:e});let t=e.github,n=tW(e.target);return(0,L.useEffect)(()=>{n&&Ym([e.target])},[n,e.target]),(0,R.jsx)(K3,{testKind:`github`,testId:e.target,mark:(0,R.jsx)(L3,{status:t}),name:e.target,href:n??void 0,ghRef:n?e.target:void 0,title:n?`Open ${e.target} on GitHub`:e.target,status:(0,R.jsxs)(R.Fragment,{children:[z3(t),t&&t.failing.length>0&&n&&(0,R.jsxs)(R.Fragment,{children:[` · `,(0,R.jsx)(`a`,{href:`${n}/checks`,target:`_blank`,rel:`noreferrer noopener`,onMouseDown:e=>e.stopPropagation(),className:`relative underline underline-offset-2 text-[color:var(--gh-danger-link-fg)] decoration-[color:color-mix(in_srgb,var(--gh-danger-link)_30%,transparent)] hover:decoration-[color:var(--gh-danger-link)]`,children:`view failures`})]})]})})}function X3({watch:e}){let t=e.issue,n=tW(e.target,`issue`);return(0,L.useEffect)(()=>{n&&Ym([e.target])},[n,e.target]),(0,R.jsx)(K3,{testKind:`github`,testId:`issue:${e.target}`,mark:(0,R.jsx)(q3,{status:t}),name:t?.title?`${e.target} ${t.title}`:e.target,href:n??void 0,ghRef:n?e.target:void 0,title:n?`Open ${e.target} on GitHub`:e.target,status:J3(t)})}function Z3(e,t){return(e.bgShells??[]).find(e=>e.id===t||e.taskId===t||e.label===t)}function Q3(e){return(e.watches??[]).filter(e=>e.kind===`shell`&&e.state===`armed`)}function $3({watch:e,thread:t,slug:n,now:r}){let i=Z3(t,e.target);if(i)return(0,R.jsx)(t6,{shell:i,slug:n,now:r,testId:e.target});let a=ek(e.createdAt,r);return(0,R.jsx)(K3,{testKind:`shell`,testId:e.target,mark:(0,R.jsx)(X_,{size:12,className:`${P3} text-shell`}),name:e.target,title:e.target,status:a?`running · ${a}`:`running`})}function e6(e,t,n,r){if(!e)return;let i=t?`running`:`settled`;return{onDismiss:e,title:yk[i],label:`${bk[i]} ${xk[n]}: ${r}`}}function t6({shell:e,slug:t,now:n,testId:r,onDismiss:i}){let a=ek(e.startedAt,n),o=e.state===`running`,s=o?`running`:`stale`,c=e.id&&!e.outputUnavailable,l=o?`running for ${a}`:pk;return(0,R.jsx)(K3,{testKind:`shell`,testId:r??e.id??e.label,mark:(0,R.jsx)(X_,{size:12,className:`${P3} ${o?`text-shell`:`text-muted-60`}`}),name:e.label,onOpen:c?()=>Wh(t,e.id,{label:e.label,startedAt:e.startedAt}):void 0,title:c?`Read this shell's output — ${l}`:o?e.label:`${e.label} — ${l}`,status:a?`${s} · ${a}`:s,dismiss:e6(i,o,`SHELL`,e.label)})}function n6({watch:e,now:t}){let n=Date.parse(e.timer?.fireAt??``),r=Number.isFinite(n)?n>t?`fires in ${QO(n-t)}`:`firing…`:`armed`;return(0,R.jsx)(K3,{testKind:`timer`,testId:e.target,mark:(0,R.jsx)(s_,{size:12,className:`${P3} text-muted-60`}),name:e.timer?.prompt||e.target,title:e.timer?.fireAt?`One-off timer, set for ${e.timer.fireAt}`:e.target,status:r})}function r6(e){return(e.subAgents??[]).filter(e=>Au(e)&&e.state===`running`)}function i6({agent:e,slug:t,now:n,onDismiss:r}){let i=ek(e.startedAt,n),a=e.subagentType?.replace(/^frizz:/,``),o=e.state===`stale`;return(0,R.jsx)(K3,{testKind:`agent`,testId:e.id??e.label,mark:o?(0,R.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-3 p-[3px] ${P3}`,children:(0,R.jsx)(`span`,{className:lk})}):(0,R.jsx)(F3,{tone:`border-accent`}),name:e.label,onOpen:e.id?()=>Uh(t,e.id,{label:e.label,subagentType:e.subagentType,startedAt:e.startedAt}):void 0,title:e.id?`Open this sub-agent — ${o?uk:`working for ${i}`}`:e.label,status:[o?`stale`:void 0,a,i].filter(Boolean).join(` · `),dismiss:e6(r,e.state===`running`,`AGENT`,e.label)})}function a6(e,t,n){let r=new Set(n.map(e=>e.target)),i=[];for(let n of t){if(n.kind!==`shell`)continue;let t=n.value.trim();if(!t||r.has(t))continue;let a=Z3(e,t);!a||a.state!==`running`||(r.add(t),i.push({id:`shell:${e.id}:${t}`,kind:`shell`,target:t,state:`armed`,createdAt:a.startedAt}))}return i}function o6(e,t={}){let n=(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`),r=n.filter(e=>e.subject!==`issue`),i=n.filter(e=>e.subject===`issue`),a=Q3(e);return{prs:r,issues:i,shells:[...a,...a6(e,t.hints??[],a)],agents:r6(e),timers:E3(e)}}function s6(e,t,n={}){let{prs:r,issues:i,shells:a,agents:o,timers:s}=o6(e,n);return[{head:`Sub-agents`,rows:o.map(n=>(0,R.jsx)(i6,{agent:n,slug:e.id,now:t},n.id??n.label))},{head:`Background shells`,rows:a.map(n=>(0,R.jsx)($3,{watch:n,thread:e,slug:e.id,now:t},n.id))},{head:`Pull requests`,rows:r.map(e=>(0,R.jsx)(Y3,{watch:e},e.id))},{head:`Issues`,rows:i.map(e=>(0,R.jsx)(Y3,{watch:e},e.id))},{head:`Timers`,rows:s.map(e=>(0,R.jsx)(n6,{watch:e,now:t},e.id))}].filter(e=>e.rows.length>0)}function c6({group:e,first:t}){let n=`col-span-4 text-[10.5px] uppercase tracking-wide text-muted-45 ${t?``:`mt-2.5`}`;return e.onToggle?(0,R.jsxs)(`button`,{type:`button`,onClick:e.onToggle,"aria-expanded":!e.collapsed,onMouseDown:e=>e.stopPropagation(),className:`${n} flex items-baseline rounded-sm text-left transition-colors hover:text-muted-80`,children:[(0,R.jsx)(`span`,{children:e.head}),e.count!==void 0&&(0,R.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.count}),(0,R.jsx)(Zg,{size:10,"aria-hidden":!0,className:`${P3} ml-[5px] transition-transform ${e.collapsed?``:`rotate-90`}`})]}):(0,R.jsx)(`div`,{className:n,children:e.head})}function l6({groups:e,divider:t}){return e.length===0?null:(0,R.jsxs)(R.Fragment,{children:[t&&(0,R.jsx)(`div`,{"aria-hidden":!0,className:`-mx-4 mt-3 border-t border-border`}),(0,R.jsx)(`div`,{className:`mt-3 grid grid-cols-[auto_1fr_fit-content(50%)_auto] gap-y-px`,children:e.map((e,t)=>(0,R.jsxs)(L.Fragment,{children:[(0,R.jsx)(c6,{group:e,first:t===0}),!e.collapsed&&e.rows]},e.head))})]})}function u6(e){return e?.awaitingBackground===!0&&e.runtime===`turn-idle`&&e.bgSnoozed!==!0}var d6=`Hides card until new activity is detected`;function f6({thread:e,onSnooze:t,onSnoozeFailed:n}){let[r,i]=(0,L.useState)(!1);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{i(!0),t?.(),Y.snoozeAwaitingBackground({slug:e.id,sessionId:e.sessionId??``}).then(()=>Z(`Snoozed until the background work returns`)).catch(e=>{n?.(),Z(`Couldn’t snooze: ${e.message.slice(0,80)}`),i(!1)})},disabled:r,onMouseDown:e=>e.preventDefault(),title:d6,className:`disabled:opacity-45 ${VQ}`,children:[(0,R.jsx)(x_,{size:12,className:L0}),`Snooze`]}),(0,R.jsx)(`span`,{className:zQ,children:d6})]})}function p6({thread:e,fence:t,onSnooze:n,onSnoozeFailed:r,onReplied:i,onReplyFailed:a}){let o=e??D3,s=t??(e?.lastFence?.kind===`awaiting`?e.lastFence:void 0),c=s?.hints??O3,l=Gu(c),u=l.length>0?Yu(c):null,d=e!==void 0&&k3(e,l),f=x3(o),p=dW(s?.body),m=rX(p??``),h=s6(o,VO(),{hints:c}),g=A3(o,c),_=e!==void 0&&l.length===0&&e.waitStatus!==`watching`&&u6(e)&&mK(e).snooze;return(0,R.jsxs)(IQ,{"data-awaiting-background":!0,icon:l.length>0?mee:T3(o)?X_:x_,chip:l.length>0?rW:void 0,label:l.length>0?u?(0,R.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:u}):null:(0,R.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:w3(o,c)}),aside:g.length===1?(0,R.jsx)(j3,{watch:g[0]}):void 0,children:[p?(0,R.jsx)(GZ,{className:`md-body ${wQ}`,html:m}):h.length===0&&!C3(o)&&l.length===0?(0,R.jsx)(`p`,{className:LQ,children:nW}):null,l.length>0&&(0,R.jsx)(g3,{steps:l}),g.length>1&&(0,R.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:g.map(e=>(0,R.jsx)(j3,{watch:e},e.ref))}),h.length===0&&C3(o)&&(0,R.jsx)(`p`,{className:`block min-w-0 text-[13px] leading-5 text-fg/75`,children:f?(0,R.jsxs)(R.Fragment,{children:[`It’s awaiting the results from `,b3(o,{watchers:!1}),` it dispatched. It returns to the queue on its own when the work comes back.`]}):(0,R.jsxs)(R.Fragment,{children:[b3(o,{watchers:!1}),` `,S3(o)===1?`is`:`are`,` still running. It resumes on its own when`,` `,S3(o)===1?`it finishes`:`one of them finishes`,`.`]})}),(0,R.jsx)(l6,{groups:h,divider:!!p}),d?(0,R.jsx)(v3,{slug:e.id,onReplied:i,onReplyFailed:a}):_?(0,R.jsx)(RQ,{"data-awaiting-snooze":!0,children:(0,R.jsx)(f6,{thread:e,onSnooze:n,onSnoozeFailed:r})}):null]})}function m6(e,t=Date.now()){return e!==void 0&&ff(e,t)!==void 0}function h6(){let[e,t]=(0,L.useState)(()=>Date.now());return(0,L.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function g6({thread:e}){let t=h6(),[n,r]=(0,L.useState)(!1),i=ff(e,t);if(!i)return null;let a=Date.parse(i),o=PD(i,t).replace(/^(Today|Tomorrow)/,e=>e.toLowerCase()),s=e.snoozePrompt?.trim();async function c(){r(!0);try{await Y.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:null,prompt:null}),Z(`Snooze cleared`)}catch(e){Z((e instanceof Error?e.message:`Wake failed`).slice(0,100))}finally{r(!1)}}return(0,R.jsxs)(IQ,{"data-snooze-card":!0,icon:Wg,label:`Snoozed`,children:[(0,R.jsx)(`div`,{"data-snooze-countdown":!0,title:new Date(a).toLocaleString(),className:`text-[22px] font-semibold leading-8 tracking-tight text-fg tabular-nums`,children:nk(a-t)}),(0,R.jsx)(`p`,{className:LQ,children:s?(0,R.jsxs)(R.Fragment,{children:[`Resumes `,o,` and sends: “`,RD(s),`”`]}):(0,R.jsxs)(R.Fragment,{children:[`Returns to the queue `,o,`.`]})}),e.foreign!==!0&&(0,R.jsx)(RQ,{children:(0,R.jsx)(`button`,{type:`button`,"data-snooze-wake-now":!0,disabled:n,onClick:()=>void c(),className:`${VQ} disabled:cursor-not-allowed disabled:opacity-45`,children:`Wake now`})})]})}var _6=1500;function v6(e,t){let n=0,r;function i(){r!==void 0&&(t.clearTimeout(r),r=void 0)}return{begin(){let a=++n;return e(!0),i(),r=t.setTimeout(()=>{a===n&&e(!1),r=void 0},_6),a},fail(t){t===n&&(i(),e(!1))},dispose(){n++,i()}}}var y6=`Could not copy terminal command`,b6={attach:`Attach command copied`,resume:`Resume command copied`},x6={attach:`Copy command to attach to this thread's live terminal`,resume:`Copy command to resume this thread in a new terminal`},S6=e=>[`terminalCommand`,e];function C6(e){return Y.threadTerminalCommand({slug:e}).then(e=>{if(!e.command)throw Error(e.reason??`No verified provider session is available to resume`);return{command:e.command,mode:e.mode===`attach`?`attach`:`resume`}})}async function w6(e){let t=C6(e);if(typeof ClipboardItem<`u`&&navigator.clipboard?.write)return await navigator.clipboard.write([new ClipboardItem({"text/plain":t.then(({command:e})=>new Blob([e],{type:`text/plain`}))})]),(await t).mode;let{command:n,mode:r}=await t;return await DV(n),r}function T6(e){let t=pt({mutationFn:()=>w6(e)});return e=>t.mutate(void 0,{onSuccess:t=>{e?.onSuccess?.(),Z(b6[t])},onError:t=>{e?.onError?.(),Z(t instanceof Error?`${y6}: ${t.message}`:y6,{duration:7e3})}})}function E6({slug:e}){let[t,n]=(0,L.useState)(!1),r=(0,L.useRef)(null);r.current||=v6(n,{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)});let i=qe(),a=T6(e);(0,L.useEffect)(()=>()=>r.current?.dispose(),[]);function o(){i.prefetchQuery({queryKey:S6(e),queryFn:()=>C6(e),staleTime:15e3})}function s(){let t=i.getQueryData(S6(e));if(t){DV(t.command).then(()=>{r.current?.begin(),Z(b6[t.mode])},()=>Z(y6,{duration:7e3}));return}a({onSuccess:()=>r.current?.begin()})}let c=i.getQueryData(S6(e)),l=t?c?b6[c.mode]:`Terminal command copied`:c?x6[c.mode]:`Copy terminal command`;return(0,R.jsx)(VP,{label:l,children:(0,R.jsx)(`button`,{type:`button`,"aria-label":l,title:l,onClick:s,onPointerEnter:o,onFocus:o,className:Rk,children:t?(0,R.jsx)(Jg,{size:14,strokeWidth:2.2,className:`text-fg`}):(0,R.jsx)(X_,{size:14,strokeWidth:1.8})})})}function D6(e){let t=Math.max(e.scrollHeight-e.clientHeight,0),n=t-e.scrollTop,r=e.scrollHeight!==e.previousScrollHeight,i=r&&!e.readerMoved?e.following||n<=1:n<=4;return!i||!r||t<=0||n<=1?{following:i,scrollTop:null}:{following:i,scrollTop:t}}function O6(e){let t=e.scrollTop>640?!0:e.armed,n=t&&e.readerMoved&&e.scrollTop<=480&&e.hasEarlier&&!e.loading;return{armed:n?!1:t,shouldLoad:n}}function k6(e){return`legacy:${e.role}:${e.kind??`message`}:${e.at??``}:${e.text}`}function A6(e,t,n){let r=[],i=new Map,a=null;return e.forEach((e,o)=>{if(e.queued||t(e))return;let s=e.sourceId??k6(e),c=i.get(s)??0;i.set(s,c+1),r.push({key:c===0?s:`${s}:${c}`,message:e,messageIndex:o,gap:a===null?0:n(a,e)}),a=e}),r}function j6(e,t,n){let r=e[t];if(!r||r.kind!==`event`||r.boundary!==`rest`)return!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(!(t.queued||n(t)))return!!t.boundary||t.wake===!0}return!0}function M6(e,t){let n=e.map(e=>e.message);return e.filter((e,r)=>!j6(n,r,t))}function N6(e,t){let n=Promise.resolve();function r(r){let i={...r,palette:{...r.palette}},a=n.then(async()=>{try{return await e(i)}finally{t(i.id)}});return n=a.then(()=>void 0,()=>void 0),a}return{enqueue:r}}function P6(e,t){let n=e[t];return typeof n==`string`&&n?n:void 0}function F6(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function I6(e,t){let n=P6(e,t);if(n)try{let e=new URL(n);return e.protocol===`https:`||e.protocol===`http:`?e.href:void 0}catch{return}}function L6({directive:e,icon:t,title:n,meta:r,children:i}){return(0,R.jsxs)(`section`,{"data-codex-directive":e.name,className:`min-w-0 ${TQ} border border-border bg-panel-2/75 p-4`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-muted`,"aria-hidden":!0,children:t}),(0,R.jsx)(`div`,{className:`max-w-[calc(100%-1.5rem)] shrink-0 break-words text-[12px] font-medium leading-4 text-fg`,children:n}),r&&(0,R.jsx)(`div`,{className:`min-w-0 truncate text-[11px] font-normal leading-4 text-muted`,children:r})]}),i]})}function R6({children:e,mono:t=!1}){return(0,R.jsx)(`div`,{className:`ml-6 mt-1 break-words text-[11px] leading-4 text-muted${t?` font-mono-keep`:``}`,children:e})}function z6({directive:e}){let t=e.attrs,n=P6(t,`display_name`)??P6(t,`skill_name`)??`Artifact template`,r=P6(t,`artifact_kind`),i=P6(t,`skill_name`),a=P6(t,`skill_directory`),[o,s]=(0,L.useState)(!!a);return(0,R.jsxs)(L6,{directive:e,icon:(0,R.jsx)(fee,{size:15}),title:n,meta:r?`${r} template`:`Template`,children:[i&&(0,R.jsx)(R6,{mono:!0,children:i.startsWith(`$`)?i:`$${i}`}),o&&a&&(0,R.jsx)(`img`,{src:MT(`${a}/assets/preview.png`),alt:`${n} template preview`,loading:`lazy`,onError:()=>s(!1),className:`ml-6 mt-2 max-h-44 max-w-[calc(100%-1.5rem)] rounded-md border border-border object-contain`})]})}function B6({directive:e}){let t=e.attrs,n=P6(t,`file`),r=F6(t,`start`),i=F6(t,`end`)??r,a=F6(t,`priority`),o=n?`${n}${r?`:${r}${i&&i!==r?`-${i}`:``}`:``}`:`Code location unavailable`;return(0,R.jsxs)(L6,{directive:e,icon:(0,R.jsx)(k_,{size:15}),title:P6(t,`title`)??`Review finding`,meta:a===void 0?void 0:`P${a}`,children:[P6(t,`body`)&&(0,R.jsx)(R6,{children:P6(t,`body`)}),n?(0,R.jsx)(`button`,{type:`button`,className:`local-file-action ml-6 mt-1 max-w-[calc(100%-1.5rem)] break-all text-left font-mono-keep text-[11px] leading-4 text-accent underline decoration-dotted underline-offset-2`,"data-local-path":n,title:o,children:o}):(0,R.jsx)(R6,{mono:!0,children:o})]})}var V6={"git-stage":[N_,`Changes staged`],"git-commit":[h_,`Commit created`],"git-create-branch":[m_,`Branch created`],"git-push":[ev,`Branch pushed`],"git-create-pr":[y_,`Pull request created`]};function H6({directive:e}){let[t,n]=V6[e.name],r=P6(e.attrs,`branch`),i=I6(e.attrs,`url`),a=`${n}${e.attrs.isDraft===!0?` as draft`:``}`;return(0,R.jsx)(L6,{directive:e,icon:(0,R.jsx)(t,{size:15}),title:i?(0,R.jsx)(`a`,{className:`text-accent underline underline-offset-2`,href:i,target:`_blank`,rel:`noopener noreferrer`,children:a}):a,meta:r&&(0,R.jsx)(`span`,{className:`font-mono-keep`,children:r})})}function U6({directive:e}){let t=P6(e.attrs,`threadId`),n=P6(e.attrs,`pendingWorktreeId`);return(0,R.jsx)(L6,{directive:e,icon:(0,R.jsx)(M_,{size:15}),title:n?`Thread setup queued`:`Thread created`,meta:(t||n)&&(0,R.jsx)(`span`,{className:`font-mono-keep`,children:t??n})})}function W6({directive:e}){let t=P6(e.attrs,`reason`);return(0,R.jsx)(L6,{directive:e,icon:(0,R.jsx)(oee,{size:15}),title:`Archive suggested`,meta:t})}function G6(e){if(typeof e!=`string`||!e)return;let t=e.match(/(?:^|;)INTERVAL=(\d+)(?:;|$)/)?.[1];return/(?:^|;)FREQ=HOURLY(?:;|$)/.test(e)?`Every ${t??`1`} hour${t===`1`||t===void 0?``:`s`}`:/(?:^|;)FREQ=WEEKLY(?:;|$)/.test(e)?`Weekly schedule`:`Custom schedule`}function K6({directive:e}){let t=e.attrs,n=P6(t,`mode`),r=P6(t,`name`)??`Automation`,i=G6(t.rrule),a=[r,n,P6(t,`status`),i].filter(Boolean).join(` · `);return(0,R.jsx)(L6,{directive:e,icon:(0,R.jsx)(uee,{size:15}),title:`Automation suggested`,meta:a,children:P6(t,`prompt`)&&(0,R.jsx)(R6,{children:P6(t,`prompt`)})})}function q6({directive:e}){return e.name===`artifact-template`?(0,R.jsx)(z6,{directive:e}):e.name===`code-comment`?(0,R.jsx)(B6,{directive:e}):e.name.startsWith(`git-`)?(0,R.jsx)(H6,{directive:e}):e.name===`created-thread`?(0,R.jsx)(U6,{directive:e}):e.name===`archive`||e.name===`archive-thread`?(0,R.jsx)(W6,{directive:e}):(0,R.jsx)(K6,{directive:e})}var J6,Y6=0;function X6(){return J6??=wS(async()=>{let{default:e}=await import(`./mermaid.core-DrLahovt.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(({default:e})=>e),J6}function Z6(){let e=getComputedStyle(document.documentElement),t=t=>e.getPropertyValue(t).trim();return{background:t(`--color-panel-2`),primaryColor:t(`--color-panel-2`),primaryTextColor:t(`--color-fg`),primaryBorderColor:t(`--color-control-strong`),lineColor:t(`--color-muted`),secondaryColor:t(`--color-border`),tertiaryColor:t(`--color-bg`),fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`}}var Q6=N6(async e=>{let t=await X6();return t.initialize({startOnLoad:!1,securityLevel:`strict`,theme:e.resolved===`dark`?`dark`:`base`,themeVariables:e.palette}),t.render(e.id,e.source)},e=>document.getElementById(`d${e}`)?.remove());function $6({source:e}){let t=(0,L.useId)(),{resolved:n}=(0,L.useSyncExternalStore)($0,Z0,Z0),[r,i]=(0,L.useState)({}),a=(0,L.useRef)(0),o=RX(r.html??``);return(0,L.useEffect)(()=>{let r=!0,o=++a.current;if(i(e=>e.error?{html:e.html}:e),e.length>5e4)return i({error:`Diagram source exceeds the 50 KB rendering limit`}),()=>{r=!1};let s=`frizz-mermaid-${t.replace(/[^a-zA-Z0-9]/g,``)}-${++Y6}`;return Q6.enqueue({id:s,source:e,resolved:n,palette:Z6()}).then(({svg:e})=>{r&&a.current===o&&i({html:e})}).catch(e=>{if(!r||a.current!==o)return;let t=e instanceof Error?e.message.split(/\n| for text:/,1)[0]:`Unknown diagram error`;i({error:t.slice(0,240)})}),()=>{r=!1}},[t,n,e]),r.error?(0,R.jsxs)(`section`,{"data-mermaid-state":`error`,className:`${TQ} border border-border bg-panel-2/75 p-4`,children:[(0,R.jsx)(`div`,{className:`text-[12px] font-medium text-fg`,children:`Diagram unavailable`}),(0,R.jsx)(`div`,{className:`mt-1 text-[11px] text-muted`,children:r.error}),(0,R.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap rounded-md bg-bg p-2 font-mono-keep text-[11px] text-muted`,children:e})]}):r.html?(0,R.jsx)(`div`,{"data-mermaid-state":`ready`,className:`overflow-x-auto ${TQ} border border-border bg-panel-2/75 p-4 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:o}):(0,R.jsx)(`div`,{"data-mermaid-state":`loading`,role:`status`,"aria-label":`Rendering diagram`,className:`h-24 animate-pulse ${TQ} bg-panel-2`})}var e8=(0,L.createContext)(null),t8=(0,L.createContext)(null);function n8(){let e=(0,L.useContext)(e8),t=(0,L.useContext)(t8);return e??t}var r8=(0,L.createContext)(null);function i8(e){return e.status===`pending`&&e.backgroundState===`background`}function a8(e){let t=[];for(let n of e)for(let e of n.tools)i8(e)&&n.at&&t.push({label:e.desc??e.detail??e.command??`Background command`,startedAt:n.at,state:`running`,...e.shellId?{launchId:e.shellId}:{},...e.command?{command:e.command}:{}});return t}function o8(e){return e.map(e=>{if(!e.tools.some(i8))return e;let t=e.tools.filter(e=>!i8(e)),n=e.parts?.map(e=>e.kind===`tools`?{...e,tools:e.tools.filter(e=>!i8(e))}:e).filter(e=>e.kind!==`tools`||e.tools.length>0);return{...e,tools:t,parts:n}})}function s8({slug:e,onStatusApplied:t,onClose:n,virtualized:r=!1,showReturnToQueue:i=!1}){gg(wE(),e);let a=Og()&&n!==void 0,{splitFileViewer:o}=gr(X);return(0,R.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[a?(0,R.jsx)(T2,{slug:e,onClose:n}):(0,R.jsx)(b8,{slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:i}),(0,R.jsx)(c8,{slug:e,virtualized:r,phone:a,railBeside:i&&o})]})}function c8({slug:e,virtualized:t,phone:n=!1,railBeside:r=!1}){let i=wE(),a=gg(i,e),o=Z1(a),s=(0,L.useMemo)(()=>$1(a,o),[a,o]),c=(0,L.useMemo)(()=>n?{numberOf:e=>s.findIndex(t=>t.id===e)+1}:null,[n,s]),[l,u]=(0,L.useState)(!1),d=a?.runtime===`running`||a?.runtime===`spawning`,f=T6(e),p=FE(e,{poll:d}),m=qe(),h=(0,L.useRef)(!1),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(null),b=(0,L.useMemo)(()=>p.data?.messages??[],[p.data]),x=(0,L.useMemo)(()=>a8(b),[b]),S=(0,L.useMemo)(()=>o8(b),[b]),C=(0,L.useMemo)(()=>P8(S),[S]),w=d?S.length:C,T=(0,L.useMemo)(()=>FG(S),[S]),E=d?RG(T):void 0,D=d?LG(T):void 0,O=D?JG(D,i?.projectDir):void 0,k=d?BG(T):void 0,A=u6(a),j=(0,L.useMemo)(()=>{let e=d?UG(T):T;return M6(e,F8(e,w,A))},[T,d,w,A]),M=d,N=(0,L.useMemo)(()=>l$(b),[b]),P=(0,L.useMemo)(()=>i$(b,a?.answersInFlight),[b,a?.answersInFlight]),F=(0,L.useMemo)(()=>P0(b),[b]),I=CQ(a,C>=0?S[C]?.text:void 0),ee=(0,L.useMemo)(()=>E$(b,s),[b,s]),te={thread:a,showWorking:M,registeredDone:I,restedCard:HQ(a,C>=0?S[C]?.text:void 0,ee),errorVisible:WQ(S,a?.providerError)},{answeringForMessage:ne}=f1(e,b),re=(0,L.useMemo)(()=>_$(b,s),[b,s]),ie=(0,L.useMemo)(()=>T$(b,s),[b,s]),ae=(0,L.useMemo)(()=>j$(b,o),[b,o]),oe=Vd(a?.spawnedAt),se=(0,L.useRef)(null),[ce,le]=(0,L.useState)(null),ue=p.data?.messages.length??0,de=!p.isLoading;(0,L.useEffect)(()=>{if(t)return;let e=se.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<=4&&(e.scrollTop=e.scrollHeight)},[ue,d,t]);let fe=(0,L.useCallback)(async()=>{if(h.current)return;let t=m.getQueryData([`transcript`,e]),n=t?.beforeCursor,r=t?.transcriptKey;if(!(!t?.hasEarlier||!n||!r)){h.current=!0,_(!0),y(null);try{let t=await Y.threadTranscriptEarlier({slug:e,cursor:n}),i=m.getQueryData([`transcript`,e]);if(!i?.transcriptKey||i.transcriptKey!==r||t.transcriptKey!==r){await p.refetch(),Z(`Transcript changed while loading history; refreshed the current session`);return}m.setQueryData([`transcript`,e],QC(i,t))}catch(e){let t=e instanceof Error?e.message:`Could not load earlier transcript history`;y(t)}finally{h.current=!1,_(!1)}}},[p,m,e]);return(0,R.jsx)(e8.Provider,{value:e,children:(0,R.jsx)(n0,{thread:a,children:(0,R.jsx)(x1.Provider,{value:c,children:(0,R.jsxs)(`div`,{"data-drawer-scroll-ready":p.isPending?`false`:`true`,className:`flex-1 min-h-0 flex flex-col overflow-hidden outline-none`,children:[(0,R.jsxs)(`div`,{className:`relative min-h-0 flex-1 flex flex-col`,children:[(0,R.jsx)(`div`,{ref:se,"data-drawer-transcript-scroll":!0,"data-virtualized-transcript-scroll":t||void 0,tabIndex:t?0:void 0,role:t?`region`:void 0,"aria-label":t?`Thread conversation`:void 0,"aria-busy":t&&g?!0:void 0,className:`relative min-h-0 flex-1 overflow-y-auto pb-3 outline-none [overflow-anchor:none] focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-60`,children:t&&ue>0?(0,R.jsx)(v8,{slug:e,transcriptRef:se,transcriptKey:p.data?.transcriptKey,messages:S,paired:N,inFlightAnswers:P,answeringForMessage:ne,placement:ie,settledPlacement:ae,openQuestions:s,fencesLive:oe,thread:a,running:d,copyTerminalCommand:f,transportFallback:p.transportFallback,isFetching:p.isFetching,refresh:()=>void p.refetch(),retryLiveUpdates:p.retryLiveUpdates,hasEarlier:p.data?.hasEarlier===!0,beforeCursor:p.data?.beforeCursor,loadingEarlier:g,earlierError:v,loadEarlier:()=>void fe(),jumpOverlay:ce,openAtLastMessage:n&&!d}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(e3,{thread:a,className:`px-6 pt-5`,autoFocusFirst:!0}),(0,R.jsx)(i0,{thread:a,inFlight:P,className:`px-6 pt-5`}),p.transportFallback&&(0,R.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`mx-6 mt-3 flex flex-wrap items-center gap-2.5 rounded-xl border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:p.transportFallback.kind===`payload-too-large`?`Live payload ${p.transportFallback.actualBytes} bytes; socket limit ${p.transportFallback.maxBytes} bytes`:`Transcript read budget reached (${p.transportFallback.scope}); retry after about ${p.transportFallback.retryAfterMs}ms`,children:[(0,R.jsx)($_,{size:13,className:`shrink-0 text-muted`}),(0,R.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,p.transportFallback.kind===`payload-too-large`?`The transcript is too large for push; it refreshes over HTTP each time the thread moves.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,R.jsx)(`button`,{type:`button`,disabled:p.isFetching,onClick:()=>void p.refetch(),className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-40`,children:p.isFetching?`Refreshing…`:`Refresh once`}),(0,R.jsx)(`button`,{type:`button`,onClick:p.retryLiveUpdates,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`,children:`Retry live`})]}),(0,R.jsx)(`div`,{"data-transcript-column":!0,className:`flex min-h-full flex-col px-6 py-5`,children:ue===0?(0,R.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted`,children:p.isPending?(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(B5,{}),` Loading…`]}):d?(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(B5,{}),` Session starting…`]}):i2(a)?(0,R.jsxs)(`div`,{className:`text-center`,children:[(0,R.jsx)(`p`,{className:`mb-3`,children:`No session is attached to this thread yet.`}),(0,R.jsx)(`button`,{className:`btn-ghost border border-border text-[12px]`,onClick:()=>Y.adoptThread({slug:e}).catch(()=>{}),children:`Start a session on this thread`})]}):`No conversation yet.`}):(0,R.jsxs)(R.Fragment,{children:[z8(j.map(e=>e.message),(e,t)=>{let n=j[t].messageIndex;return(0,R.jsx)(x5,{m:e,answering:oe?ne(e):void 0,showSendButton:!0,paired:N[n],staleAwaiting:w>=0&&n<w,restingCardShown:n===C&&A,shadowedBy:re.get(n),placed:ie.placed.get(n),settledPlaced:ae.placed.get(n),thread:a},t)},e=>!!e.queued),de&&h8(te)!==null&&(0,R.jsx)(M$,{h:g8(te,j.map(e=>e.message))}),de&&(0,R.jsx)(_8,{state:te,slug:e,retryText:F>=0?b[F]?.text:void 0,onTerminal:f,liveRuntimeStart:k,liveActivityLabel:O,liveToolRun:E}),a?.permPolicy?(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(M5,{policy:a.permPolicy,denies:a.permDenies})}):null,b.some(e=>e.queued)&&(0,R.jsx)(M$,{}),(0,R.jsx)(`div`,{className:`flex flex-col gap-3.5`,children:b.map((e,t)=>e.queued?(0,R.jsx)(x5,{m:e,paired:N[t]},`q${t}`):null)})]})})]})}),(0,R.jsx)(`div`,{ref:le,"data-transcript-overlay":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-end p-4 [&>*]:pointer-events-auto`})]}),(0,R.jsx)(`div`,{"data-thread-chat-footer":!0,className:`z-10 shrink-0 border-t border-border/60 bg-panel ${n?``:`pb-[env(safe-area-inset-bottom)]`}`,children:(0,R.jsx)(w2,{slug:e,onTerminal:f,ops:n||r?void 0:(0,R.jsx)(N5,{slug:e,transcriptShells:x,className:`px-1 pt-1.5`}),phoneBarOverride:n&&s.length>0?e=>(0,R.jsx)(D1,{count:s.length,onAnswer:()=>u(!0),onReply:e.editReply}):void 0,phoneChrome:n})}),n&&l&&(0,R.jsx)(o0,{questions:s,onClose:()=>u(!1)})]})})})})}var l8=700,u8=250,d8=900,f8=(()=>{try{return localStorage.getItem(`frizz.debugScroll`)===`1`}catch{return!1}})();function p8(e){return e?.pendingInteraction===!0}function m8(e){return p8(e)?void 0:e?.pendingAsk}function h8({thread:e,showWorking:t,registeredDone:n,restedCard:r,errorVisible:i}){return e?.providerError?.retrying?`provider-error`:e?.providerFault&&!e.foreign?`provider-fault`:e?.limitPause&&!e.foreign?`limit-pause`:m8(e)?`pending-ask`:e?.runtime===`perm-prompt`&&!p8(e)?`perm-prompt`:t?`working`:e?.providerError?i?null:`provider-error`:m6(e)?`snooze`:u6(e)?`resting`:n?`registered-done`:r?`rested`:null}function g8(e,t){return h8(e)===`working`?R8(t):14}function _8({state:e,slug:t,retryText:n,onTerminal:r,liveRuntimeStart:i,liveActivityLabel:a,liveToolRun:o}){let s=e.thread;switch(h8(e)){case`provider-fault`:return(0,R.jsx)(k5,{slug:t,sessionId:s.sessionId,fault:s.providerFault,retryText:n});case`provider-error`:return(0,R.jsx)(GQ,{error:s.providerError});case`limit-pause`:return(0,R.jsx)(A5,{slug:t,sessionId:s.sessionId,pause:s.limitPause});case`pending-ask`:return(0,R.jsx)(P5,{ask:m8(s),onTerminal:r});case`perm-prompt`:return(0,R.jsx)(j5,{onTerminal:r});case`working`:return(0,R.jsx)(V5,{since:s?.lastUserAt,startedAt:i,activityLabel:a,run:o});case`snooze`:return(0,R.jsx)(g6,{thread:s});case`resting`:return(0,R.jsx)(p6,{thread:s});case`registered-done`:return(0,R.jsx)(O5,{fenceKind:`done`,body:s.lastFence.body,hints:[]});case`rested`:return(0,R.jsx)(UQ,{thread:s});default:return null}}function v8({slug:e,transcriptRef:t,transcriptKey:n,messages:r,paired:i,inFlightAnswers:a,answeringForMessage:o,placement:s,settledPlacement:c,openQuestions:l,fencesLive:u,thread:d,running:f,copyTerminalCommand:p,transportFallback:m,isFetching:h,refresh:g,retryLiveUpdates:_,hasEarlier:v,beforeCursor:y,loadingEarlier:b,earlierError:x,loadEarlier:S,jumpOverlay:C,openAtLastMessage:w=!1}){let T=TE(),E=(0,L.useMemo)(()=>FG(r),[r]),D=f?RG(E):void 0,O=f?LG(E):void 0,k=O?JG(O,T):void 0,A=f?BG(E):void 0,j=(0,L.useMemo)(()=>P8(r),[r]),M=f?r.length:j,N=u6(d),P=(0,L.useMemo)(()=>{let e=f?UG(E):E;return M6(e,F8(e,M,N))},[E,f,M,N]),F=f,I=(0,L.useMemo)(()=>A6(P.map(e=>e.message),F8(P,M,N),M8).map(e=>{let t=P[e.messageIndex];return{...e,messageIndex:t.messageIndex,stampAt:VG(t)}}),[P,M,N]),ee=(0,L.useMemo)(()=>P0(r),[r]),te=CQ(d,j>=0?r[j]?.text:void 0),ne=(0,L.useMemo)(()=>E$(r,l),[r,l]),re=HQ(d,j>=0?r[j]?.text:void 0,ne),ie=WQ(r,d?.providerError),ae={thread:d,showWorking:F,registeredDone:te,restedCard:re,errorVisible:ie},oe=h8(ae)!==null,se=(0,L.useMemo)(()=>g8({thread:d,showWorking:F,registeredDone:te,restedCard:re,errorVisible:ie},P.map(e=>e.message)),[P,F,d,te,re,ie]),ce=(0,L.useMemo)(()=>{let e=[],t=new Map,n=r.length-1,i=e=>{let t=-1;for(let n=0;n<I.length&&!(I[n].messageIndex>e);n++)t=n;return t},a=l.filter(e=>!s.placedIds.has(e.id));for(let[o,s]of m$(r,a)){if(o>=n){e.push(...s);continue}let r=i(o),a=t.get(r);a?a.push(...s):t.set(r,[...s])}let o=!1,c=new Set;for(let e of O$(r,s)){if(e>=n){o=!0;continue}let r=i(e);c.add(r),t.has(r)||t.set(r,[])}return{byRow:t,tail:e,tailSend:o,sendRows:c}},[I,r,l,s]),le=(0,L.useMemo)(()=>{let e=new Map;for(let[t,n]of c.anchored){let r=-1;for(let e=0;e<I.length&&!(I[e].messageIndex>t);e++)r=e;if(r<0)continue;let i=e.get(r);i?i.push(...n):e.set(r,[...n])}return e},[I,c.anchored]),ue=(0,L.useMemo)(()=>_$(r,l),[r,l]),de=(0,L.useMemo)(()=>{let e=[{key:`head-anchor`,kind:`head-anchor`}];m&&e.push({key:`transport-fallback`,kind:`transport-fallback`}),(v||b||x)&&e.push({key:`earlier-history:${y??`complete`}`,kind:`earlier-history`});let t=ce.byRow.get(-1);t&&e.push({key:`questions:head`,kind:`questions`,questions:t,send:ce.sendRows.has(-1)}),I.forEach((t,n)=>{e.push({...t,kind:`message`});let r=le.get(n);r&&e.push({key:`settled-questions:${t.key}`,kind:`settled-questions`,questions:r});let i=ce.byRow.get(n);i&&e.push({key:`questions:${t.key}`,kind:`questions`,questions:i,send:ce.sendRows.has(n)})}),e.push({key:`interactions`,kind:`interactions`}),oe&&e.push({key:`runtime-status`,kind:`runtime-status`});let n=oe||I.length>0?14:0;return r.forEach((t,r)=>{if(!t.queued)return;let i=`queued:${t.deliveryId??t.sourceId??r}`;e.push({key:i,kind:`queued`,message:t,messageIndex:r,gap:n}),n=14}),e},[y,x,v,oe,b,I,r,ce,le,m]),fe=SD({count:de.length,getScrollElement:()=>t.current,getItemKey:e=>de[e]?.key??e,estimateSize:e=>{let t=de[e];return t?t.kind===`head-anchor`||t.kind===`interactions`?1:t.kind===`earlier-history`?42:t.kind===`transport-fallback`?76:t.kind===`runtime-status`?54:t.kind===`questions`?220:t.kind===`settled-questions`?140:t.kind===`message`?108+t.gap:82+t.gap:80},overscan:8,paddingStart:20,paddingEnd:20,anchorTo:`end`,followOnAppend:!0,scrollEndThreshold:4,scrollToFn:(e,{adjustments:t,behavior:n},r)=>{let i=r.scrollElement;i&&i.scrollTo({top:t===void 0?e:i.scrollTop+t,behavior:n})}}),[pe,me]=(0,L.useState)(!0),he=(0,L.useRef)(!0),ge=(0,L.useRef)(-1),_e=(0,L.useRef)(0),ve=(0,L.useRef)(null),ye=(0,L.useRef)(!1),be=(0,L.useRef)(!1),xe=(0,L.useRef)(!0),Se=(0,L.useRef)(null),Ce=(0,L.useRef)(void 0),we=(0,L.useRef)(null),Te=(0,L.useRef)(void 0),Ee=(0,L.useRef)(0),De=(0,L.useRef)(0),Oe=(0,L.useCallback)(()=>{let e=t.current;if(e){let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-transcript-source-id]`)).find(e=>e.getBoundingClientRect().bottom>t+1),r=n?.dataset.transcriptRowKey;n&&r&&(Se.current={rowKey:r,viewportTop:n.getBoundingClientRect().top-t})}S()},[S,t]),ke=(0,L.useCallback)((e,n)=>{let r=t.current;if(!r)return;let i=Array.from(r.querySelectorAll(`[data-transcript-source-id]`)).find(t=>t.dataset.transcriptSourceId===e);i&&(r.scrollTop+=i.getBoundingClientRect().top-n)},[t]);(0,L.useLayoutEffect)(()=>{if(!n||de.length===0||Ce.current===n)return;Ce.current=n,ye.current=!1,be.current=!1,xe.current=!0;let r=Pk(e)?.candidates.map(e=>({candidate:e,index:de.findIndex(t=>t.kind===`message`&&t.message.sourceId===e.sourceId)})).find(e=>e.index>=0),i=!r&&w&&j>=0?de.reduce((e,t,n)=>t.kind===`message`&&t.messageIndex<=j&&t.message.role===`assistant`&&t.message.kind!==`event`?n:e,-1):-1,a=requestAnimationFrame(()=>{if(!r&&i>=0){let e=de[i].key;fe.scrollToIndex(i,{align:`start`,behavior:`instant`}),he.current=!1,me(!1),ye.current=!0;let n=performance.now()+d8;Ee.current=n;let r=()=>{let i=t.current;if(!i||performance.now()>=n||performance.now()<_e.current){Ee.current=0,De.current=0,i&&i.scrollHeight-i.clientHeight-i.scrollTop<=4&&(he.current=!0,ge.current=i.scrollHeight,me(!0));return}let a=i.querySelector(`[data-transcript-row-key="${CSS.escape(e)}"]`);a&&(i.scrollTop+=a.getBoundingClientRect().top-i.getBoundingClientRect().top),De.current=requestAnimationFrame(r)};r();return}if(!r){fe.scrollToEnd({behavior:`instant`}),me(!0),ye.current=!0;return}fe.scrollToIndex(r.index,{align:`start`,behavior:`instant`}),he.current=!1,me(!1),ye.current=!0;let e=performance.now()+u8;Ee.current=e;let n=()=>{performance.now()>=e||performance.now()<_e.current||(ke(r.candidate.sourceId,r.candidate.screenTop),a=requestAnimationFrame(n))};n()});return()=>cancelAnimationFrame(a)},[ke,de.length,e,n,fe]),(0,L.useEffect)(()=>()=>cancelAnimationFrame(De.current),[]),(0,L.useLayoutEffect)(()=>{let e=Se.current,n=t.current;if(!e||!n||b)return;let r=()=>{let t=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey);if(!t)return;let r=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=r-e.viewportTop};r();let i=0,a=requestAnimationFrame(()=>{r(),i=requestAnimationFrame(()=>{r(),Se.current===e&&(Se.current=null)})});return()=>{cancelAnimationFrame(a),cancelAnimationFrame(i)}},[b,I.length,t]);let Ae=(0,L.useCallback)(()=>{let e=t.current;if(!e)return null;let n=e.getBoundingClientRect().top,r=Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.getBoundingClientRect().bottom>n+1),i=r?.dataset.transcriptRowKey;return!r||!i?null:{rowKey:i,viewportTop:r.getBoundingClientRect().top-n}},[t]),je=(0,L.useCallback)(e=>{let n=t.current;if(!n)return;let r=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey);if(!r)return;let i=r.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=i-e.viewportTop},[t]),Me=I[0]?.key;(0,L.useLayoutEffect)(()=>{let e=Te.current;if(Te.current=Me,e===void 0||e===Me||!ye.current||he.current||Se.current)return;let t=we.current;if(!t)return;je(t);let n=()=>{if(performance.now()<_e.current)return;let e=we.current;e&&je(e)},r=0,i=requestAnimationFrame(()=>{n(),r=requestAnimationFrame(n)});return()=>{cancelAnimationFrame(i),cancelAnimationFrame(r)}},[je,Me]);let Ne=(0,L.useCallback)(()=>{let e=t.current;if(!e||Se.current||performance.now()<Ee.current)return;let n=D6({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,previousScrollHeight:ge.current,following:he.current,readerMoved:performance.now()<_e.current});if(he.current=n.following,n.scrollTop!==null&&(e.scrollTop=n.scrollTop),ge.current=e.scrollHeight,me(e=>e===n.following?e:n.following),f8&&!n.following&&performance.now()>=_e.current){let t=we.current,n=t&&Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.dataset.transcriptRowKey===t.rowKey);if(t&&n){let r=Math.round(n.getBoundingClientRect().top-e.getBoundingClientRect().top-t.viewportTop);Math.abs(r)>2&&console.warn(`[frizz] transcript moved ${r}px under a still reader — row=${t.rowKey}`)}}we.current=Ae()??we.current},[Ae,t]);(0,L.useLayoutEffect)(Ne),(0,L.useEffect)(()=>{let e=ve.current;if(!e)return;let t=new ResizeObserver(Ne);return t.observe(e),()=>t.disconnect()},[Ne]),(0,L.useEffect)(()=>{let e=t.current;if(!e)return;let n=()=>{Ne();let t=O6({armed:xe.current,scrollTop:e.scrollTop,readerMoved:ye.current&&be.current,hasEarlier:v,loading:b});xe.current=t.armed,t.shouldLoad&&Oe()},r=()=>{be.current=!0,_e.current=performance.now()+l8,requestAnimationFrame(n)},i=t=>{[`ArrowUp`,`PageUp`,`Home`,` `].includes(t.key)&&(e.scrollTop<=480&&(xe.current=!0),r())},a=t=>{t.deltaY<0&&e.scrollTop<=480&&(xe.current=!0),r()},o=()=>{e.scrollTop<=480&&(xe.current=!0),r()};e.addEventListener(`scroll`,n,{passive:!0}),e.addEventListener(`wheel`,a,{passive:!0}),e.addEventListener(`touchstart`,o,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!0}),e.addEventListener(`pointerdown`,r,{passive:!0}),e.addEventListener(`keydown`,i);let s=requestAnimationFrame(n);return()=>{cancelAnimationFrame(s),e.removeEventListener(`scroll`,n),e.removeEventListener(`wheel`,a),e.removeEventListener(`touchstart`,o),e.removeEventListener(`touchmove`,o),e.removeEventListener(`pointerdown`,r),e.removeEventListener(`keydown`,i)}},[v,b,Oe,Ne,t]);let Pe=fe.getVirtualItems(),Fe=fe.getTotalSize();return(0,R.jsxs)(`div`,{ref:ve,"data-virtualized-transcript":!0,"data-virtual-row-count":Pe.length,className:`relative w-full`,style:{height:Fe},children:[Pe.map(t=>{let n=de[t.index];return n?(0,R.jsx)(`div`,{ref:fe.measureElement,"data-index":t.index,"data-transcript-row-key":n.key,"data-transcript-source-id":n.kind===`message`?n.message.sourceId:void 0,className:`absolute left-0 top-0 w-full hover:z-[1]`,style:{transform:`translateY(${t.start}px)`},children:n.kind===`head-anchor`?null:n.kind===`interactions`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(e3,{thread:d,className:`px-6 pt-5`,autoFocusFirst:!0}),(0,R.jsx)(i0,{thread:d,questions:ce.tail,inFlight:a,showSend:ce.tailSend,className:`px-6 pt-5`})]}):n.kind===`questions`?(0,R.jsx)(i0,{thread:d,questions:n.questions,showSend:n.send,className:`px-6 pt-5`}):n.kind===`settled-questions`?(0,R.jsx)(t0,{questions:n.questions,className:`px-6 pt-5`}):n.kind===`transport-fallback`?m?(0,R.jsx)(`div`,{className:`px-6 pt-3`,children:(0,R.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`flex flex-wrap items-center gap-2.5 ${TQ} border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:m.kind===`payload-too-large`?`Live payload ${m.actualBytes} bytes; socket limit ${m.maxBytes} bytes`:`Transcript read budget reached (${m.scope}); retry after about ${m.retryAfterMs}ms`,children:[(0,R.jsx)($_,{size:13,className:`shrink-0 text-muted`}),(0,R.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,m.kind===`payload-too-large`?`The transcript is too large for push; it refreshes over HTTP each time the thread moves.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,R.jsx)(`button`,{type:`button`,disabled:h,onClick:g,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-40`,children:h?`Refreshing…`:`Refresh once`}),(0,R.jsx)(`button`,{type:`button`,onClick:_,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`,children:`Retry live`})]})}):null:n.kind===`earlier-history`?(0,R.jsx)(`div`,{className:`flex min-h-10 items-center justify-center px-6 text-[11px] text-muted`,role:`status`,children:x?(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-2 text-center`,children:[(0,R.jsx)(`span`,{children:x}),(0,R.jsx)(`button`,{type:`button`,onClick:Oe,className:`rounded-md border border-border px-2 py-1 text-fg/90 hover:bg-panel-2`,children:`Retry`})]}):b?(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(E_,{size:12,className:`animate-spin`}),` Loading earlier messages…`]}):(0,R.jsx)(`button`,{type:`button`,onClick:Oe,className:`button-outline rounded-md px-2 py-1 outline-none hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:`Load earlier messages`})}):n.kind===`message`?(0,R.jsx)(d4,{at:n.stampAt,host:I0(n.message,i[n.messageIndex]),gap:n.gap,children:(0,R.jsx)(x5,{m:n.message,answering:u?o(n.message):void 0,showSendButton:!0,paired:i[n.messageIndex],staleAwaiting:M>=0&&n.messageIndex<M,restingCardShown:n.messageIndex===j&&N,shadowedBy:ue.get(n.messageIndex),placed:s.placed.get(n.messageIndex),settledPlaced:c.placed.get(n.messageIndex),thread:d})}):n.kind===`runtime-status`?(0,R.jsxs)(`div`,{className:`px-6`,style:{paddingTop:se},children:[(0,R.jsx)(_8,{state:ae,slug:e,retryText:ee>=0?r[ee]?.text:void 0,onTerminal:p,liveRuntimeStart:A,liveActivityLabel:k,liveToolRun:D}),d?.permPolicy?(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(M5,{policy:d.permPolicy,denies:d.permDenies})}):null]}):(0,R.jsx)(d4,{at:n.message.at,host:I0(n.message,i[n.messageIndex]),gap:n.gap,children:(0,R.jsx)(x5,{m:n.message,paired:i[n.messageIndex]})})},n.key):null}),(0,R.jsx)(y8,{overlay:C,hidden:pe,onJump:()=>fe.scrollToEnd({behavior:`smooth`})})]})}function y8({overlay:e,hidden:t,onJump:n}){return!e||t?null:(0,Tn.createPortal)((0,R.jsxs)(`button`,{type:`button`,"data-jump-to-latest":!0,onClick:n,className:`flex items-center gap-1.5 rounded-full border border-border-strong bg-elevated px-3 py-1.5 text-[11px] font-medium text-fg shadow-lg shadow-shadow-ink/30 hover:bg-panel-2`,children:[(0,R.jsx)(see,{size:12}),`Jump to latest`]}),e)}function b8({slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:r=!1}){let i=gg(wE(),e),a=pt({mutationFn:()=>Y.markComplete({slug:e})}),o=WY(ct({queryKey:[`threadBody`,e],queryFn:()=>Y.threadBody({slug:e})}).data?.markdown??``).trim().length>0;if(!i)return null;let s=i.kind===`session`&&i.foreign!==!0;return(0,R.jsxs)(`header`,{"data-thread-header":!0,className:a2,children:[(0,R.jsx)(`div`,{className:o2,children:(0,R.jsxs)(`div`,{className:`min-w-0 leading-tight`,children:[(0,R.jsx)(Y2,{thread:i}),(0,R.jsx)(q2,{thread:i})]})}),(0,R.jsxs)(`div`,{className:s2,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[s&&(0,R.jsx)(E6,{slug:e}),(0,R.jsx)(j2,{thread:i,collapse:r,onDoc:o?()=>Hh(`doc`,i.id):void 0,onDone:()=>a.mutate(void 0,{onSuccess:t}),doneBusy:a.isPending,onStatusApplied:t}),n&&(0,R.jsx)(HP,{slug:e}),(0,R.jsx)(aq,{thread:i,onArchived:t})]}),n&&(0,R.jsx)(`span`,{"aria-hidden":!0,"data-close-rule":!0,className:`ml-3 mr-2.5 h-4 w-px shrink-0 bg-border max-[640px]:hidden`}),n&&(0,R.jsx)(`button`,{type:`button`,"aria-label":`Close`,"data-dialog-initial-focus":!0,onClick:n,className:`icon-hover-outline shrink-0 rounded-md p-1.5 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,R.jsx)(tv,{size:15})})]})]})}function x8(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||e4(e))return null;if(e.parts&&e.parts.length>0){for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.kind===`tools`?n.tools.length>0:n.text.trim())return n.kind===`tools`?n.tools:null}return null}return(e.tools?.length??0)>0&&!e.text.trim()?e.tools:null}function S8(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||e4(e))return null;if(e.parts&&e.parts.length>0){for(let t of e.parts)if(t.kind===`tools`?t.tools.length>0:t.text.trim())return t.kind===`tools`?t.tools:null;return null}return(e.tools?.length??0)>0?e.tools:null}function C8(e){return x8(e)!==null}function w8(e){return S8(e)!==null}function T8(e){return e.kind===`event`&&!e.boundary||e.kind===`reasoning`}function E8(e){return T8(e)||C8(e)}function D8(e){return T8(e)||w8(e)}function O8(e){if(T8(e))return!0;let t=x8(e);return t!==null&&!SG(t[t.length-1])}function k8(e){if(T8(e))return!0;let t=S8(e);return t!==null&&!SG(t[0])}function A8(e){let t=x8(e);return t!==null&&TG(t[t.length-1])}function j8(e){let t=S8(e);return t!==null&&TG(t[0])}function M8(e,t){let n=A8(e)||j8(t),r=!n&&E8(e)&&D8(t)&&!(O8(e)&&k8(t));return(n?22:r?6:14)+(e.role===`user`&&t.role!==`user`?3:0)}function N8(e,t){return e.kind===`event`||e.kind===`reasoning`||e.role===`user`?!1:e.parts&&e.parts.length>0?e.parts.every(n=>n.kind===`tools`?n.tools.length===0:I8(e,n.text,t)):(e.tools?.length??0)===0&&I8(e,e.text,t)}function P8(e){for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`&&e[t].kind!==`event`)return t;return-1}function F8(e,t,n=!1){let r=new WeakSet;if(t>=0)for(let n of e)n.messageIndex<t&&r.add(n.message);if(t>=0&&n)for(let n of e)n.messageIndex===t&&r.add(n.message);return e=>N8(e,r.has(e))}function I8(e,t,n){return!e.fenceRefused&&!n?!t.trim():SQ(t).every(e=>e.kind===`fence`&&e.fenceKind===`awaiting`)}function L8(e,t){return e.kind===`event`||e.kind===`reasoning`||e.role===`user`?!1:e.parts&&e.parts.length>0?e.parts.some(n=>n.kind===`text`&&!I8(e,n.text,t)):typeof e.text==`string`&&!I8(e,e.text,t)}function R8(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.queued||N8(n)))return A8(n)?22:E8(n)&&!O8(n)?6:14+(n.role===`user`?3:0)}return 0}function z8(e,t,n){let r=[],i=null;return e.forEach((e,a)=>{n?.(e,a)||N8(e)||(i!==null&&r.push((0,R.jsx)(M$,{h:M8(i,e)},`s${a}`)),r.push(t(e,a)),i=e)}),r}function B8(e){let t=[];for(let n of e){if(n.kind===`text`){if(!n.text.trim())continue;t.push(n);continue}if(n.tools.length===0)continue;let e=t[t.length-1];e&&e.kind===`tools`?t[t.length-1]={kind:`tools`,tools:[...e.tools,...n.tools]}:t.push(n)}return t}function V8(e,t=14){let n=e.filter(e=>e!=null&&e!==!1),r=[];return n.forEach((e,n)=>{n>0&&r.push((0,R.jsx)(M$,{h:typeof t==`number`?t:t(n)},`vs${n}`)),r.push(e)}),r}var H8={head:!1,tail:!1};function U8(e,t){return n=>e[n-1]?.tail||e[n]?.head?22:t}function W8(e){return{head:TG(e[0]),tail:TG(e[e.length-1])}}function G8(e){let t=[];for(let n of e){let e=t[t.length-1];if(n.edit){let r=!!(n.input||n.output||n.status||n.exitCode!==void 0);e&&e.edits&&!r&&!e.input&&!e.output&&!e.status&&e.edits[0].file===n.edit.file?e.edits.push(n.edit):t.push({name:n.name,detail:n.detail,edits:[n.edit],input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}else n.command?t.push({name:n.name,detail:n.detail,command:n.command,desc:n.desc,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):n.outputImage?t.push({name:n.name,detail:n.detail,outputImage:n.outputImage,output:n.output??n.read,status:n.status,durationMs:n.durationMs,count:1}):n.read?t.push({name:n.name,detail:n.detail,read:n.read,status:n.status,durationMs:n.durationMs,count:1}):n.prompt||n.agentId?t.push({name:n.name,detail:n.detail,prompt:n.prompt,input:n.input,subagentType:n.subagentType,agentId:n.agentId,agentStatus:n.agentStatus,agentElapsedMs:n.agentElapsedMs,output:n.output,status:n.status,durationMs:n.durationMs,count:1}):n.sendTo!==void 0||n.sendBody!==void 0?t.push({name:n.name,detail:n.detail,sendTo:n.sendTo,sendSummary:n.sendSummary,sendBody:n.sendBody,sendType:n.sendType,sendDispatchId:n.sendDispatchId,sendTargetLabel:n.sendTargetLabel,status:n.status,durationMs:n.durationMs,count:1}):n.todos?t.push({name:n.name,detail:n.detail,todos:n.todos,input:n.input,status:n.status,durationMs:n.durationMs,count:1}):wG(n)?t.push({name:n.name,detail:n.detail,ask:n.ask,askAnswers:n.askAnswers,status:n.status,durationMs:n.durationMs,count:1}):n.sentImages||n.sentFiles?t.push({name:n.name,detail:n.detail,sentImages:n.sentImages,sentFiles:n.sentFiles,caption:n.caption,status:n.status,durationMs:n.durationMs,count:1}):n.input||n.output?t.push({name:n.name,detail:n.detail,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):e&&!e.edits&&!e.command&&!e.input&&!e.output&&!e.read&&!e.prompt&&!e.outputImage&&!e.sentImages&&!e.sentFiles&&e.sendTo===void 0&&e.sendBody===void 0&&e.name===n.name&&e.detail===n.detail&&e.status===n.status&&e.backgroundState===n.backgroundState&&e.exitCode===n.exitCode&&e.cwd===n.cwd&&e.sessionId===n.sessionId&&e.durationMs===n.durationMs?e.count++:t.push({name:n.name,detail:n.detail,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}return t}function K8(e){return e.split(`__`).pop()||e}function q8(e){let t=X.board?.projectDir;return t&&e.startsWith(t+`/`)?e.slice(t.length+1):e}function J8({tools:e,at:t}){let[n,r]=(0,L.useState)(!1),i=(0,L.useId)(),a=e.reduce((e,t)=>e+t.count,0),o=$G(a,ZG(e));return(0,R.jsxs)(`div`,{"data-tool-activity":!0,"data-tool-activity-state":`settled`,className:`flex min-w-0 flex-col`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":i,"aria-expanded":n,"aria-label":`${n?`Collapse`:`Expand`} ${a} tool ${a===1?`call`:`calls`}: ${o}`,className:`group flex w-full min-w-0 items-baseline gap-1.5 rounded py-0.5 text-left outline-none transition-colors hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60 ${f4}`,children:[(0,R.jsx)(`span`,{"data-tool-activity-label":!0,title:o,className:`min-w-0 truncate text-muted`,children:o}),(0,R.jsx)(Zg,{"data-tool-activity-chevron":!0,"aria-hidden":`true`,size:13,className:m4(n)})]}),n&&(0,R.jsx)(`div`,{id:i,className:`mt-1.5 flex flex-col`,children:V8(e.map((e,n)=>(0,R.jsx)(X8,{t:e,startedAt:t},n)),6)}),!n&&(0,R.jsx)(`div`,{id:i,hidden:!0})]})}function Y8({tools:e,at:t}){let n=[];for(let t of e){let e=SG(t),r=n[n.length-1];r?.exceptional===e?r.tools.push(t):n.push({exceptional:e,tools:[t]})}return(0,R.jsx)(`div`,{className:`flex flex-col`,children:V8(n.map((e,n)=>e.exceptional?(0,R.jsx)(`div`,{className:`flex flex-col`,children:V8(e.tools.map((e,n)=>(0,R.jsx)(X8,{t:e,startedAt:t},n)),U8(e.tools.map(e=>W8([e])),6))},`exceptions-${n}`):(0,R.jsx)(J8,{tools:e.tools,at:t},`activity-${n}`)),U8(n.map(e=>W8(e.tools)),6))})}function X8({t:e,startedAt:t}){let n=(0,L.useContext)(e8),r=wE(),i=YO(e,(n?gg(r,n):void 0)?.bgShells??[]);return e.edits&&e.status!==`failed`&&e.status!==`cancelled`?(0,R.jsx)(FX,{edits:e.edits,meta:(0,R.jsx)(t5,{status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,durationMs:e.durationMs})}):e.command?(0,R.jsx)(l5,{command:e.command,desc:e.desc??e.detail,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t}):e.outputImage?(0,R.jsx)(o5,{name:e.name,detail:e.detail,outputImage:e.outputImage,output:e.output,status:e.status,durationMs:e.durationMs}):e.read?(0,R.jsx)(d5,{detail:e.detail,read:e.read,status:e.status,durationMs:e.durationMs}):e.prompt||e.agentId?(0,R.jsx)(p5,{detail:e.detail,prompt:e.prompt,subagentType:e.subagentType,agentId:e.agentId,agentStatus:e.agentStatus,agentElapsedMs:e.agentElapsedMs,status:e.status,durationMs:e.durationMs}):e.sendTo!==void 0||e.sendBody!==void 0?(0,R.jsx)(h5,{to:e.sendTo,summary:e.sendSummary,body:e.sendBody??``,type:e.sendType,dispatchId:e.sendDispatchId,targetLabel:e.sendTargetLabel,status:e.status,durationMs:e.durationMs,at:t}):e.sentImages||e.sentFiles?(0,R.jsx)(s5,{images:e.sentImages??[],files:e.sentFiles??[],caption:e.caption,status:e.status,durationMs:e.durationMs}):e.todos?(0,R.jsx)(QZ,{todos:e.todos,note:e.input,meta:(0,R.jsx)(t5,{status:e.status,durationMs:e.durationMs})}):wG(e)?(0,R.jsx)(Z8,{ask:e.ask??[],askAnswers:e.askAnswers}):e.input||e.output?(0,R.jsx)(l5,{name:e.name,command:e.input??``,desc:e.detail,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,inputLabel:`input`,startedAt:t}):(0,R.jsx)(a5,{name:e.name,detail:e.detail,count:e.count,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,cwd:e.cwd,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t})}function Z8({ask:e,askAnswers:t}){return(0,R.jsx)(`div`,{"data-settled-ask":!0,className:`flex flex-col gap-1.5`,children:e.map((e,n)=>{let r=X4(e,t?.[n]);return(0,R.jsx)(g1,{question:r.question,settled:{chosenIdxs:r.chosenIdxs,text:r.text}},n)})})}function Q8({tone:e,indicator:t,label:n,duration:r,title:i}){return(0,R.jsxs)(`span`,{className:`petite-caps frizz-tool-header-caps flex shrink-0 items-center gap-1 whitespace-nowrap text-[11.5px] leading-none ${e}`,title:i,"aria-label":i,children:[t,(0,R.jsx)(`span`,{children:[n,r].filter(Boolean).join(` · `)})]})}function $8(e,t,n){let[r,i]=(0,L.useState)(()=>Date.now()),a=KO(e,t),o=qO(e,t,n,r);return(0,L.useEffect)(()=>{if(!a||o)return;let e=n?Date.parse(n):NaN;if(!Number.isFinite(e))return;let t=setTimeout(()=>i(Date.now()),Math.max(GO-(Date.now()-e),0));return()=>clearTimeout(t)},[a,o,n]),o}function e5({status:e,backgroundState:t,liveBackgroundState:n,startedAt:r}){let i=$8(e,t,r),a=n===`running`?(0,R.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):n===`stale`?(0,R.jsx)(`span`,{className:lk,title:pk}):WO(e,t)||i?(0,R.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):null;return a?(0,R.jsx)(`span`,{className:`frizz-tool-mark -mr-1 flex w-[9px] shrink-0 justify-center`,children:a}):null}function t5({status:e,backgroundState:t,liveBackgroundState:n,exitCode:r,durationMs:i}){if(!e&&i===void 0)return null;let[a,o]=n===`running`?[`running`,`background running`]:n===`stale`?[`stale`,`background stale`]:e===`pending`?t===`unknown`?[`unknown`,`background / unknown`]:[`running`,t===`background`?`background running`:`running`]:e===`failed`?r===void 0?[`failed`,`failed`]:[`exit ${r}`,`exit ${r}`]:e===`cancelled`?[`cancelled`,`cancelled`]:e===`completed`?[`done`,`done`]:[void 0,void 0],s=i===void 0?void 0:XO(i),c=[o,s].filter(Boolean).join(` · `);return(0,R.jsx)(Q8,{tone:e===`failed`?`frizz-tool-failed`:e===`cancelled`?`text-attention`:`text-muted-55`,title:c,label:a,duration:s})}function n5(e,t,n){let r=t?Date.parse(t):NaN,i=e===`pending`&&Number.isFinite(r),[a,o]=(0,L.useState)(()=>Date.now());return(0,L.useEffect)(()=>{if(!i)return;let e=()=>o(Date.now()),t,n=setTimeout(()=>{e(),t=setInterval(e,1e3)},1e3-Date.now()%1e3);return()=>{clearTimeout(n),t&&clearInterval(t)}},[i,t]),i?Math.max(a-r,0):n}function r5(e,t,n){let r=t&&t!==X.board?.projectDir?`in ${q8(t)}`:void 0;return[e,t?r:n!==void 0&&!e?.includes(String(n))?`session ${n}`:void 0].filter(Boolean).join(` · `)||void 0}function i5(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.includes(`…`)}function a5({name:e,detail:t,count:n,status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,cwd:s,sessionId:c,durationMs:l,startedAt:u}){let d=r5(t,s,c),f=d?q8(d):void 0,p=t&&i5(t)?t:void 0;return(0,R.jsx)(`div`,{className:`frizz-bash`,title:d,children:(0,R.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(e5,{status:r,backgroundState:i,liveBackgroundState:a,startedAt:u}),(0,R.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:K8(e)}),f&&(p?(0,R.jsx)(`span`,{className:`min-w-0 truncate`,onClick:e=>e.stopPropagation(),children:(0,R.jsx)(PX,{path:p,className:`text-[11.5px] text-muted`,children:f})}):(0,R.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:f}))]}),(0,R.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,R.jsx)(t5,{status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,durationMs:l}),n>1&&(0,R.jsxs)(`span`,{className:`tabular-nums text-[11px] text-muted-45`,children:[`×`,n]})]})]})})}function o5({name:e,detail:t,outputImage:n,output:r,status:i,durationMs:a}){let[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),u=(0,L.useId)(),d=K8(e),f=t?q8(t):void 0;return(0,R.jsxs)(`div`,{"data-tool-image":!0,className:`frizz-bash`,children:[(0,R.jsxs)(NX,{className:`frizz-bash-header`,controls:u,expanded:o,label:`${o?`Collapse`:`Expand`} ${d}${t?`: ${t}`:``}`,onToggle:()=>s(e=>!e),meta:(0,R.jsx)(t5,{status:i,durationMs:a}),children:[(0,R.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:d}),f&&(0,R.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,title:t,children:f})]}),(0,R.jsx)(`div`,{id:u,hidden:!o,children:o&&(0,R.jsxs)(R.Fragment,{children:[c?(0,R.jsx)(`div`,{className:`frizz-bash-body break-all text-muted-70`,children:n}):(0,R.jsx)(`div`,{className:`flex justify-center bg-panel-2 p-1.5`,children:(0,R.jsx)(`img`,{src:MT(n),alt:f?`${d}: ${f}`:d,"data-local-path":n,"data-local-image":`true`,onError:()=>l(!0),className:`cursor-zoom-in block max-h-[420px] max-w-full w-auto rounded-md object-contain`})}),r&&(0,R.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body`,children:r})]})})]})}function s5({images:e,files:t,caption:n,status:r,durationMs:i}){let[a,o]=(0,L.useState)(!0),s=(0,L.useId)(),c=(0,L.useMemo)(()=>e.map(e=>({target:e,title:n??`Delivered image`})),[e,n]),l=[e.length?`${e.length} image${e.length===1?``:`s`}`:``,t.length?`${t.length} file${t.length===1?``:`s`}`:``].filter(Boolean).join(` · `);return(0,R.jsxs)(`div`,{className:`frizz-bash`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":s,"aria-expanded":a,"aria-label":`${a?`Collapse`:`Expand`} files sent to you${l?`: ${l}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-60`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Sent to you`}),l&&(0,R.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:l})]}),(0,R.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,R.jsx)(t5,{status:r,durationMs:i}),(0,R.jsx)(Zg,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${a?`rotate-90`:``}`})]})]}),(0,R.jsx)(`div`,{id:s,hidden:!a,children:a&&(0,R.jsxs)(R.Fragment,{children:[e.length>0&&(0,R.jsx)(hZ,{entries:c,framed:!1}),(t.length>0||n)&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5 px-2.5 pb-2.5 pt-1.5`,children:[t.length>0&&(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map((e,t)=>(0,R.jsx)(w5,{path:e},`f${t}`))}),n&&(0,R.jsx)(`div`,{className:`max-w-[65%] text-[12px] leading-snug text-muted`,children:n})]})]})})]})}var c5=16;function l5({command:e,desc:t,output:n,name:r=`Bash`,status:i,backgroundState:a,liveBackgroundState:o,exitCode:s,sessionId:c,durationMs:l,inputLabel:u,startedAt:d}){let[f,p]=(0,L.useState)(!1),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(!1),v=(0,L.useId)(),y=n5(i,d,l),b=(0,L.useMemo)(()=>e.split(`
|
|
324
324
|
`).length,[e]),x=b>c5,S=(0,L.useMemo)(()=>n?n.split(`
|
|
325
325
|
`).length:0,[n]),C=S>c5,w=r5(t,void 0,c),T=!!(e||n);return(0,R.jsxs)(`div`,{className:`frizz-bash`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>T&&p(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":T?v:void 0,"aria-expanded":T?f:void 0,"aria-label":`${T?`${f?`Collapse`:`Expand`} `:``}${K8(r)}${w?`: ${w}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-60`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(e5,{status:i,backgroundState:a,liveBackgroundState:o,startedAt:d}),(0,R.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:K8(r)}),(0,R.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,title:w,children:w??``})]}),(0,R.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,R.jsx)(t5,{status:i,backgroundState:a,liveBackgroundState:o,exitCode:s,durationMs:y}),T&&(0,R.jsx)(Zg,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${f?`rotate-90`:``}`})]})]}),T&&(0,R.jsxs)(`div`,{id:v,hidden:!f,children:[f&&e&&(0,R.jsxs)(R.Fragment,{children:[u&&(0,R.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:u}),(0,R.jsx)(KZ,{text:e,language:u?`plaintext`:`bash`,className:`frizz-bash-body${u?` frizz-bash-output-body`:``}${x&&!m?` frizz-bash-clamp`:``}`}),x&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>h(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand petite-caps px-2.5 pb-1.5`,children:m?`Collapse`:`Show all ${b} lines`})]}),f&&n&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:`output`}),(0,R.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body${C&&!g?` frizz-bash-clamp`:``}`,children:n}),C&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>_(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand petite-caps px-2.5 pb-1.5`,children:g?`Collapse`:`Show all ${S} lines`})]})]})]})}var u5=16;function d5({detail:e,read:t,status:n,durationMs:r}){let[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(!1),c=(0,L.useId)(),l=(0,L.useMemo)(()=>t.split(`
|
|
326
326
|
`).length,[t]),u=l>u5,d=e?q8(e):void 0,f=e&&i5(e)?e:void 0;return(0,R.jsxs)(`div`,{className:`frizz-bash`,children:[(0,R.jsxs)(NX,{className:`frizz-bash-header`,controls:c,expanded:i,label:`${i?`Collapse`:`Expand`} Read${e?`: ${e}`:``}`,onToggle:()=>a(e=>!e),meta:(0,R.jsx)(t5,{status:n,durationMs:r}),children:[(0,R.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Read`}),d&&(f?(0,R.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,R.jsx)(PX,{path:f,className:`text-[11.5px] text-muted`,children:d})}):(0,R.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:d}))]}),(0,R.jsx)(`div`,{id:c,hidden:!i,children:i&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(KZ,{text:t,language:uT(e),className:`frizz-bash-body${u&&!o?` frizz-bash-clamp`:``}`}),u&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand petite-caps px-2.5 pb-1.5`,children:o?`Collapse`:`Show all ${l} lines`})]})})]})}var f5=16;function p5({detail:e,prompt:t,subagentType:n,agentId:r,agentStatus:i,agentElapsedMs:a,status:o,durationMs:s}){let[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(!1),f=(0,L.useId)(),p=t||`Initial prompt unavailable.`,m=(0,L.useMemo)(()=>p?p.split(`
|