frizz 0.7.7 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +11 -46
  2. package/dist/dev-child.js +201 -63
  3. package/dist/frizz.js +918 -398
  4. package/package.json +1 -1
  5. package/runtime/cc-worker/DECISIONS.md +2 -1
  6. package/runtime/cc-worker/bin/frizz-mcp.mjs +3 -2
  7. package/web-dist/assets/{TerminalPane-Cb8jOFP9.js → TerminalPane-ubcEP7X3.js} +1 -1
  8. package/web-dist/assets/{abnfDiagram-VRR7QNED-Dtbg2eZ0.js → abnfDiagram-VRR7QNED-0brfnieb.js} +1 -1
  9. package/web-dist/assets/architecture-TIHT7OUA-DksosNDW.js +1 -0
  10. package/web-dist/assets/{architectureDiagram-ZJ3FMSHR-DzQjWW7u.js → architectureDiagram-ZJ3FMSHR-Dji-XBdF.js} +1 -1
  11. package/web-dist/assets/{blockDiagram-677ZJIJ3-BJnpkLMt.js → blockDiagram-677ZJIJ3-BQMyz3Q9.js} +1 -1
  12. package/web-dist/assets/{c4Diagram-LMCZKHZV-COdatsYu.js → c4Diagram-LMCZKHZV-BMNws0Oi.js} +1 -1
  13. package/web-dist/assets/channel-DqoPvfQz.js +1 -0
  14. package/web-dist/assets/{chunk-32BRIVSS-CORMw4Vm.js → chunk-32BRIVSS-CVv1ae7n.js} +1 -1
  15. package/web-dist/assets/{chunk-52WLFC77-C7lEadTg.js → chunk-52WLFC77-BYhPlKCT.js} +1 -1
  16. package/web-dist/assets/{chunk-C7G6YPKG-DZy4F97l.js → chunk-C7G6YPKG-Cn4HhNwb.js} +1 -1
  17. package/web-dist/assets/{chunk-EX3LRPZG-HynlfV9p.js → chunk-EX3LRPZG-P3ZYFC1W.js} +1 -1
  18. package/web-dist/assets/{chunk-FWX5IMBZ-BbwKNhKm.js → chunk-FWX5IMBZ-Ba3NpEQa.js} +2 -2
  19. package/web-dist/assets/{chunk-HOUHSVGY-lIhOZSmL.js → chunk-HOUHSVGY-BCWyMhwJ.js} +1 -1
  20. package/web-dist/assets/{chunk-ICXQ74PX-WGxaMO8c.js → chunk-ICXQ74PX-DWAAqHL7.js} +1 -1
  21. package/web-dist/assets/{chunk-MOJQB5TN-B-cx0f3u.js → chunk-MOJQB5TN-pc5VJ4Nq.js} +1 -1
  22. package/web-dist/assets/{chunk-OGEWGWER-DJceVwZH.js → chunk-OGEWGWER-DUxmbiuX.js} +1 -1
  23. package/web-dist/assets/{chunk-PUDLZKDR-CGwHZns8.js → chunk-PUDLZKDR-DRdZWzxX.js} +1 -1
  24. package/web-dist/assets/{chunk-Q4XR5HBZ-PTSWtmk1.js → chunk-Q4XR5HBZ-Bafzu7s-.js} +1 -1
  25. package/web-dist/assets/{chunk-V7JOEXUC-VNxHZPcf.js → chunk-V7JOEXUC-Bj0A8ftW.js} +1 -1
  26. package/web-dist/assets/{chunk-VAUOI2AC-ZXYCz_Aw.js → chunk-VAUOI2AC-DBgVQKIO.js} +1 -1
  27. package/web-dist/assets/{chunk-VR4S4FIN-9WCtmFJp.js → chunk-VR4S4FIN-DU-1KtuM.js} +1 -1
  28. package/web-dist/assets/{chunk-WYO6CB5R-V4EBjpmt.js → chunk-WYO6CB5R-DzVb3-Rj.js} +1 -1
  29. package/web-dist/assets/{chunk-ZGVPDNZ5-CPW0Z0ae.js → chunk-ZGVPDNZ5-BPKQvduj.js} +1 -1
  30. package/web-dist/assets/classDiagram-OUVF2IWQ-DwUs74RB.js +1 -0
  31. package/web-dist/assets/classDiagram-v2-EOCWNBFH-DwUs74RB.js +1 -0
  32. package/web-dist/assets/{cynefin-VYW2F7L2-E7PklfJD.js → cynefin-VYW2F7L2-lo8PqVCk.js} +1 -1
  33. package/web-dist/assets/{cynefinDiagram-TSTJHNR4-JIXAPjDf.js → cynefinDiagram-TSTJHNR4-BtQLaDV0.js} +1 -1
  34. package/web-dist/assets/{dagre-VKFMJZFB-DjXrdcNx.js → dagre-VKFMJZFB-BJ2-f-A0.js} +1 -1
  35. package/web-dist/assets/{diagram-FQU43EPY--i9i0qhm.js → diagram-FQU43EPY-CLM-8r74.js} +1 -1
  36. package/web-dist/assets/{diagram-G47NLZAW-DxgcENZ_.js → diagram-G47NLZAW-CfuoJGpN.js} +1 -1
  37. package/web-dist/assets/{diagram-NH7WQ7WH-CUy9Nr90.js → diagram-NH7WQ7WH-DfxxRwH8.js} +1 -1
  38. package/web-dist/assets/{diagram-OA4YK3LP-DbTbUaCb.js → diagram-OA4YK3LP-D7knxZee.js} +1 -1
  39. package/web-dist/assets/{diagram-WEI45ONY-2gk6xhOq.js → diagram-WEI45ONY-C2WfMXWl.js} +1 -1
  40. package/web-dist/assets/{ebnfDiagram-CCIWWBDH-uE2iDETg.js → ebnfDiagram-CCIWWBDH-DRSZ24tF.js} +1 -1
  41. package/web-dist/assets/{erDiagram-Q63AITRT-dztd4MUw.js → erDiagram-Q63AITRT-DXe0OrbY.js} +1 -1
  42. package/web-dist/assets/eventmodeling-45OFAUF4-CUIjQ7kE.js +1 -0
  43. package/web-dist/assets/flowDiagram-23GEKE2U-Dka-3F3n.js +1 -0
  44. package/web-dist/assets/{ganttDiagram-NO4QXBWP-DAds6Aht.js → ganttDiagram-NO4QXBWP-wGqOgjvs.js} +1 -1
  45. package/web-dist/assets/{gitGraph-TEB2WS4Q-Ci0XVvIa.js → gitGraph-TEB2WS4Q-BygokG6y.js} +1 -1
  46. package/web-dist/assets/{gitGraphDiagram-IHSO6WYX-C6FULyt8.js → gitGraphDiagram-IHSO6WYX-CV1933_M.js} +1 -1
  47. package/web-dist/assets/index-CmrDpsD8.css +1 -0
  48. package/web-dist/assets/{index-CNy5uOpI.js → index-DB1d3eMJ.js} +75 -75
  49. package/web-dist/assets/{info-DKCQHKI2-9N77dOiw.js → info-DKCQHKI2-DLavbzui.js} +1 -1
  50. package/web-dist/assets/{infoDiagram-FWYZ7A6U-BymP3PgG.js → infoDiagram-FWYZ7A6U-Biouxd9G.js} +1 -1
  51. package/web-dist/assets/{ishikawaDiagram-FXEZZL3T-CU_kQBz1.js → ishikawaDiagram-FXEZZL3T-DJxwwS3R.js} +1 -1
  52. package/web-dist/assets/{journeyDiagram-5HDEW3XC-DZN15HSd.js → journeyDiagram-5HDEW3XC-Clx_WkdW.js} +1 -1
  53. package/web-dist/assets/{kanban-definition-HUTT4EX6-J4wR5g_3.js → kanban-definition-HUTT4EX6-Bf7bX_96.js} +1 -1
  54. package/web-dist/assets/{line-SRzGpiDr.js → line-CV2v49IN.js} +1 -1
  55. package/web-dist/assets/{mermaid-parser.core-CGBscNGo.js → mermaid-parser.core-BPsFhEi6.js} +3 -3
  56. package/web-dist/assets/{mermaid.core-xNdwXb1r.js → mermaid.core-0EWDNL_R.js} +3 -3
  57. package/web-dist/assets/{mindmap-definition-LN4V7U3C-gR2dbzrj.js → mindmap-definition-LN4V7U3C-C1y4yy3Z.js} +1 -1
  58. package/web-dist/assets/{packet-7NZHBO7P-DrR4W6I3.js → packet-7NZHBO7P-CpcpxruB.js} +1 -1
  59. package/web-dist/assets/{pegDiagram-2B236MQR-DN7R-_t4.js → pegDiagram-2B236MQR-CVlVP4cH.js} +1 -1
  60. package/web-dist/assets/{pie-RZYD4A2V-C8VjQAFZ.js → pie-RZYD4A2V-BcVPOhTZ.js} +1 -1
  61. package/web-dist/assets/{pieDiagram-ENE6RG2P-5w64zdD1.js → pieDiagram-ENE6RG2P-DZv4Tfae.js} +1 -1
  62. package/web-dist/assets/{quadrantDiagram-ABIIQ3AL-B4rbezq_.js → quadrantDiagram-ABIIQ3AL-DOzS_U_a.js} +1 -1
  63. package/web-dist/assets/{radar-I7S5WNFK-CTbbPB8m.js → radar-I7S5WNFK-8YADxkdT.js} +1 -1
  64. package/web-dist/assets/{railroad-3IZDKUUU-CY1er15b.js → railroad-3IZDKUUU-DzndPrRy.js} +1 -1
  65. package/web-dist/assets/railroad-abnf-AHOZXSZD-CCnWa6K9.js +1 -0
  66. package/web-dist/assets/railroad-ebnf-EBAXGLYW-jtVdzv7e.js +1 -0
  67. package/web-dist/assets/railroad-peg-LSFZ7HO6-B8D6TyEe.js +1 -0
  68. package/web-dist/assets/{railroadDiagram-RFXS5EU6-Bx2HJ3yT.js → railroadDiagram-RFXS5EU6-CPJAH-r7.js} +1 -1
  69. package/web-dist/assets/{requirementDiagram-TGXJPOKE-BLK-Y2rx.js → requirementDiagram-TGXJPOKE-BVFJZfwl.js} +1 -1
  70. package/web-dist/assets/{sankeyDiagram-HTMAVEWB-Dk-8Miv-.js → sankeyDiagram-HTMAVEWB-CUhvFPmE.js} +1 -1
  71. package/web-dist/assets/{sequenceDiagram-DBY2YBRQ-DL2alfR-.js → sequenceDiagram-DBY2YBRQ-Cy9CGhNq.js} +1 -1
  72. package/web-dist/assets/{stateDiagram-2N3HPSRC-Bka44wf1.js → stateDiagram-2N3HPSRC-CqOnmPLp.js} +1 -1
  73. package/web-dist/assets/stateDiagram-v2-6OUMAXLB-DWKW-4qu.js +1 -0
  74. package/web-dist/assets/{swimlanes-5IMT3BWC-e0GbMwIr.js → swimlanes-5IMT3BWC-c_zBqkb9.js} +1 -1
  75. package/web-dist/assets/swimlanesDiagram-G3AALYLV-DZKoB7ae.js +8 -0
  76. package/web-dist/assets/{timeline-definition-FHXFAJF6-CT3GFq89.js → timeline-definition-FHXFAJF6-y_QM62SK.js} +1 -1
  77. package/web-dist/assets/{treeView-QDETBFTQ-BJauJ0bm.js → treeView-QDETBFTQ-T3y_1KXV.js} +1 -1
  78. package/web-dist/assets/{treemap-6X3UGDF4-DCX7A-nx.js → treemap-6X3UGDF4-CzvqucqY.js} +1 -1
  79. package/web-dist/assets/{vennDiagram-L72KCM5P-D4dm2iTR.js → vennDiagram-L72KCM5P-6-HNOpN0.js} +1 -1
  80. package/web-dist/assets/{wardley-OPB4EBWU-DklTDSId.js → wardley-OPB4EBWU-BrsaqsLL.js} +1 -1
  81. package/web-dist/assets/{wardleyDiagram-EHGQE667-CikP5hBd.js → wardleyDiagram-EHGQE667-Cr_rCzwd.js} +1 -1
  82. package/web-dist/assets/{xychartDiagram-FW5EYKEG-FXuOAFpz.js → xychartDiagram-FW5EYKEG-BnX6ccx4.js} +1 -1
  83. package/web-dist/index.html +2 -2
  84. package/web-dist/assets/architecture-TIHT7OUA-CTxVpl9_.js +0 -1
  85. package/web-dist/assets/channel-COS0Ygbp.js +0 -1
  86. package/web-dist/assets/classDiagram-OUVF2IWQ-Df5TLnrN.js +0 -1
  87. package/web-dist/assets/classDiagram-v2-EOCWNBFH-Df5TLnrN.js +0 -1
  88. package/web-dist/assets/eventmodeling-45OFAUF4-DPVPOEaJ.js +0 -1
  89. package/web-dist/assets/flowDiagram-23GEKE2U-BMIMgVYd.js +0 -1
  90. package/web-dist/assets/index-D6LsViUY.css +0 -1
  91. package/web-dist/assets/railroad-abnf-AHOZXSZD-DfEpkrtJ.js +0 -1
  92. package/web-dist/assets/railroad-ebnf-EBAXGLYW-Csunejgu.js +0 -1
  93. package/web-dist/assets/railroad-peg-LSFZ7HO6-BgRslbM_.js +0 -1
  94. package/web-dist/assets/stateDiagram-v2-6OUMAXLB-6KcScVPX.js +0 -1
  95. package/web-dist/assets/swimlanesDiagram-G3AALYLV-jaJhlDbE.js +0 -8
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPane-Cb8jOFP9.js","assets/rolldown-runtime-Bh1tDfsg.js","assets/mermaid.core-xNdwXb1r.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-C4XfhTaE.js","assets/chunk-WYO6CB5R-V4EBjpmt.js","assets/chunk-ICXQ74PX-WGxaMO8c.js","assets/dist-DoH_9pyS.js","assets/chunk-VAUOI2AC-ZXYCz_Aw.js","assets/chunk-HOUHSVGY-lIhOZSmL.js","assets/chunk-Q4XR5HBZ-PTSWtmk1.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-OGEWGWER-DJceVwZH.js","assets/chunk-C7G6YPKG-DZy4F97l.js","assets/chunk-ZGVPDNZ5-CPW0Z0ae.js","assets/rough.esm-CSKSodPl.js","assets/chunk-52WLFC77-C7lEadTg.js","assets/line-SRzGpiDr.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-FWX5IMBZ-BbwKNhKm.js","assets/chunk-ZIRB5QZD-C6fEPe3t.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPane-ubcEP7X3.js","assets/rolldown-runtime-Bh1tDfsg.js","assets/mermaid.core-0EWDNL_R.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-C4XfhTaE.js","assets/chunk-WYO6CB5R-DzVb3-Rj.js","assets/chunk-ICXQ74PX-DWAAqHL7.js","assets/dist-DoH_9pyS.js","assets/chunk-VAUOI2AC-DBgVQKIO.js","assets/chunk-HOUHSVGY-BCWyMhwJ.js","assets/chunk-Q4XR5HBZ-Bafzu7s-.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-OGEWGWER-DUxmbiuX.js","assets/chunk-C7G6YPKG-Cn4HhNwb.js","assets/chunk-ZGVPDNZ5-BPKQvduj.js","assets/rough.esm-CSKSodPl.js","assets/chunk-52WLFC77-BYhPlKCT.js","assets/line-CV2v49IN.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-FWX5IMBZ-Ba3NpEQa.js","assets/chunk-ZIRB5QZD-C6fEPe3t.js"])))=>i.map(i=>d[i]);
2
2
  import{n as e,t}from"./rolldown-runtime-Bh1tDfsg.js";(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 n=`bippy-0.5.43`,r=Object.defineProperty,i=Object.prototype.hasOwnProperty,a=()=>{},o=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build`)})}catch{}},s=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e),c=!1,l,u=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>c?!0:(e&&typeof e.inject==`function`&&(l=e.inject.toString()),!!l?.includes(`(injected)`)),d=new Set,f=new Set,p=e=>{let t=new Map,i=0,s={_instrumentationIsActive:!1,_instrumentationSource:n,checkDCE:o,hasUnsupportedRendererAttached:!1,inject(e){let n=++i;return t.set(n,e),f.add(e),s._instrumentationIsActive||(s._instrumentationIsActive=!0,d.forEach(e=>e())),n},on:a,onCommitFiberRoot:a,onCommitFiberUnmount:a,onPostCommitFiberRoot:a,renderers:t,supportsFiber:!0,supportsFlight:!0};try{r(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get(){return s},set(t){if(t&&typeof t==`object`){let n=s.renderers;s=t,n.size>0&&(n.forEach((e,n)=>{f.add(e),t.renderers.set(n,e)}),m(e))}}});let t=window.hasOwnProperty,n=!1;r(window,`hasOwnProperty`,{configurable:!0,value:function(...e){try{if(!n&&e[0]===`__REACT_DEVTOOLS_GLOBAL_HOOK__`)return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,n=!0,-0}catch{}return t.apply(this,e)},writable:!0})}catch{m(e)}return s},m=e=>{e&&d.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=o,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=n,t._instrumentationIsActive=!1;let e=s(t);if(e||(t.on=a),t.renderers.size){t._instrumentationIsActive=!0,d.forEach(e=>e());return}let r=t.inject,i=u(t);i&&!e&&(c=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=e=>{let n=r(e);return f.add(e),i&&t.renderers.set(n,e),t._instrumentationIsActive=!0,d.forEach(e=>e()),n}}(t.renderers.size||t._instrumentationIsActive||u())&&e?.()}catch{}},h=()=>i.call(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),g=e=>h()?(m(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):p(e),_=()=>!!(typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`));(()=>{try{_()&&g()}catch{}})();var v=(e,t,n=!1)=>{if(!e)return null;if(t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=v(r,t,n);if(e)return e;r=n?null:r.sibling}return null},y=async(e,t,n=!1)=>{if(!e)return null;if(await t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=await y(r,t,n);if(e)return e;r=n?null:r.sibling}return null},b=e=>{let t=e;return typeof t==`function`?t:typeof t==`object`&&t?b(t.type||t.render):null},x=e=>{try{if(typeof e.version==`string`&&e.bundleType>0)return`development`}catch{}return`production`},S=e=>Object.prototype.toString.call(e)===`[object Object]`&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),C=(e,t=[])=>{if(!S(e))return[{path:t,value:e}];let n=[];for(let r in e){let i=e[r],a=t.concat(r);S(i)?n.push(...C(i,a)):n.push({path:a,value:i})}return n},w,T,E,D,O,k,A,j,M,N,P,ee,F,te,ne,re,ie={},ae=[],oe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,se=Array.isArray;function ce(e,t){for(var n in t)e[n]=t[n];return e}function le(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ue(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?w.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return de(e,o,r,i,null)}function de(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++E,__i:-1,__u:0};return i==null&&T.vnode!=null&&T.vnode(a),a}function fe(e){return e.children}function pe(e,t){this.props=e,this.context=t}function me(e,t){if(t==null)return e.__?me(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?me(e):null}function he(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=ce({},t);a.__v=t.__v+1,T.vnode&&T.vnode(a),De(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??me(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,ke(r,a,i),t.__e=t.__=null,a.__e!=n&&ge(a)}}function ge(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),ge(e)}function _e(e){(!e.__d&&(e.__d=!0)&&O.push(e)&&!ve.__r++||k!=T.debounceRendering)&&((k=T.debounceRendering)||A)(ve)}function ve(){try{for(var e,t=1;O.length;)O.length>t&&O.sort(j),e=O.shift(),t=O.length,he(e)}finally{O.length=ve.__r=0}}function ye(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v=r&&r.__k||ae,y=t.length;for(c=be(n,t,v,c,y),d=0;d<y;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&v[p.__i]||ie,p.__i=d,g=De(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&Me(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),(_=!!(4&p.__u))||f.__k===p.__k?(c=xe(p,c,e,_),_&&f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function be(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=de(null,o,null,null,null):se(o)?o=e.__k[a]=de(fe,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=de(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=Ce(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=me(s)),Ne(s,s));return r}function xe(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=xe(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=me(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Se(e,t){return t||=[],e==null||typeof e==`boolean`||(se(e)?e.some(function(e){Se(e,t)}):t.push(e)),t}function Ce(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function we(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||oe.test(t)?n:n+`px`}function Te(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||we(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||we(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(ee,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[P]=r[P]:(n[P]=F,e.addEventListener(t,a?ne:te,a)):e.removeEventListener(t,a?ne:te,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function Ee(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[N]==null)t[N]=F++;else if(t[N]<n[P])return;return n(T.event?T.event(t):t)}}}function De(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,E,D=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=T.__b)&&u(t);n:if(typeof D==`function`){d=o.length;try{if(v=t.props,y=D.prototype&&D.prototype.render,b=(u=D.contextType)&&r[u.__c],x=u?b?b.props.value:u.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new D(v,x):(t.__c=f=new pe(v,x),f.constructor=D,f.render=Pe),b&&b.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&D.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=ce({},f.__s)),ce(f.__s,D.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&D.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&D.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)){t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),ae.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__e=!1,S=T.__r,C=0,y)f.state=f.__s,f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),ae.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++C<25);f.state=f.__s,f.getChildContext!=null&&(r=ce(ce({},r),f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),w=u!=null&&u.type===fe&&u.key==null?Ae(u.props.children):u,s=ye(e,se(w)?w:[w],t,n,r,i,a,o,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__E=f.__=null)}catch(e){if(o.length=d,t.__v=null,c||a!=null){if(e.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a!=null&&(a[a.indexOf(s)]=null),t.__e=s}else if(a!=null)for(E=a.length;E--;)le(a[E])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||Oe(t),T.__e(e,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=je(n.__e,t,n,r,i,a,o,c,l);return(u=T.diffed)&&u(t),128&t.__u?void 0:s}function Oe(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Oe))}function ke(e,t,n){for(var r=0;r<n.length;r++)Me(n[r],n[++r],n[++r]);T.__c&&T.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){T.__e(e,t.__v)}})}function Ae(e){return typeof e!=`object`||!e||e.__b>0?e:se(e)?e.map(Ae):e.constructor===void 0?ce({},e):null}function je(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||ie,_=t.props,v=t.type;if(v==`svg`?i=`http://www.w3.org/2000/svg`:v==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(l=0;l<a.length;l++)if((p=a[l])&&`setAttribute`in p==!!v&&(v?p.localName==v:p.nodeType==3)){e=p,a[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(i,v,_.is&&_),s&&=(T.__m&&T.__m(t,a),!1),a=null}if(v==null)g===_||s&&e.data==_||(e.data=_);else{if(a=v==`textarea`&&_.defaultValue!=null?null:a&&w.call(e.childNodes),!s&&a!=null)for(g={},l=0;l<e.attributes.length;l++)g[(p=e.attributes[l]).name]=p.value;for(l in g)p=g[l],l==`dangerouslySetInnerHTML`?d=p:l==`children`||l in _||l==`value`&&`defaultValue`in _||l==`checked`&&`defaultChecked`in _||Te(e,l,null,p,i);for(l in _)p=_[l],l==`children`?f=p:l==`dangerouslySetInnerHTML`?u=p:l==`value`?m=p:l==`checked`?h=p:s&&typeof p!=`function`||g[l]===p||Te(e,l,p,g[l],i);if(u)s||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=``),ye(t.type==`template`?e.content:e,se(f)?f:[f],t,n,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&me(n,0),s,c),a!=null)for(l=a.length;l--;)le(a[l]);s&&v!=`textarea`||(l=`value`,v==`progress`&&m==null?e.removeAttribute(`value`):m!=null&&(m!==e[l]||v==`progress`&&!m||v==`option`&&m!=g[l])&&Te(e,l,m,g[l],i),l=`checked`,h!=null&&h!=e[l]&&Te(e,l,h,g[l],i))}return e}function Me(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){T.__e(e,n)}}function Ne(e,t,n){var r,i;if(T.unmount&&T.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Me(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){T.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Ne(r[i],t,n||typeof e.type!=`function`);n||le(e.__e),e.__c=e.__=e.__e=void 0}function Pe(e,t,n){return this.constructor(e,n)}function Fe(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),T.__&&T.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],De(t,e=(!r&&n||t).__k=ue(fe,null,[e]),i||ie,ie,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?w.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),ke(a,e,o),e.props.children=null}function Ie(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,_e(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c=`__cC`+re++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}w=ae.slice,T={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},E=0,D=function(e){return e!=null&&e.constructor===void 0},pe.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ce({},this.state);typeof e==`function`&&(e=e(ce({},n),this.props)),e&&ce(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),_e(this))},pe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),_e(this))},pe.prototype.render=fe,O=[],A=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,j=function(e,t){return e.__v.__b-t.__v.__b},ve.__r=0,M=Math.random().toString(8),N=`__d`+M,P=`__a`+M,ee=/(PointerCapture)$|Capture$/i,F=0,te=Ee(!1),ne=Ee(!0),re=0;var Le,Re,ze,Be,Ve=0,He=[],Ue=T,We=Ue.__b,Ge=Ue.__r,Ke=Ue.diffed,qe=Ue.__c,Je=Ue.unmount,Ye=Ue.__;function Xe(e,t){Ue.__h&&Ue.__h(Re,e,Ve||t),Ve=0;var n=Re.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Ze(e){return Ve=1,Qe(dt,e)}function Qe(e,t,n){var r=Xe(Le++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):dt(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Re,!Re.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};Re.__f=!0;var a=Re.shouldComponentUpdate,o=Re.componentWillUpdate;Re.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},Re.shouldComponentUpdate=i}return r.__N||r.__}function $e(e,t){var n=Xe(Le++,3);!Ue.__s&&ut(n.__H,t)&&(n.__=e,n.u=t,Re.__H.__h.push(n))}function et(e,t){var n=Xe(Le++,4);!Ue.__s&&ut(n.__H,t)&&(n.__=e,n.u=t,Re.__h.push(n))}function tt(e){return Ve=5,nt(function(){return{current:e}},[])}function nt(e,t){var n=Xe(Le++,7);return ut(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function rt(e,t){return Ve=8,nt(function(){return e},t)}function it(e){var t=Re.context[e.__c],n=Xe(Le++,9);return n.c=e,t?(n.__??(n.__=!0,t.sub(Re)),t.props.value):e.__}function at(){for(var e;e=He.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ct),t.__h.some(lt),t.__h=[]}catch(n){t.__h=[],Ue.__e(n,e.__v)}}}Ue.__b=function(e){Re=null,We&&We(e)},Ue.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ye&&Ye(e,t)},Ue.__r=function(e){Ge&&Ge(e),Le=0;var t=(Re=e.__c).__H;t&&(ze===Re?(t.__h=[],Re.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(ct),t.__h.some(lt),t.__h=[],Le=0)),ze=Re},Ue.diffed=function(e){Ke&&Ke(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(He.push(t)!==1&&Be===Ue.requestAnimationFrame||((Be=Ue.requestAnimationFrame)||st)(at)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),ze=Re=null},Ue.__c=function(e,t){t.some(function(e){try{e.__h.some(ct),e.__h=e.__h.filter(function(e){return!e.__||lt(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Ue.__e(n,e.__v)}}),qe&&qe(e,t)},Ue.unmount=function(e){Je&&Je(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{ct(e)}catch(e){t=e}}),n.__H=void 0,t&&Ue.__e(t,n.__v))};var ot=typeof requestAnimationFrame==`function`;function st(e){var t,n=function(){clearTimeout(r),ot&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ot&&(t=requestAnimationFrame(n))}function ct(e){var t=Re,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Re=t}function lt(e){var t=Re;e.__c=e.__(),Re=t}function ut(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function dt(e,t){return typeof t==`function`?t(e):t}var ft=Symbol.for(`preact-signals`);function pt(){if(yt>1)yt--;else{var e,t=!1;for((function(){var e=Ct;for(Ct=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();vt!==void 0;){var n=vt;for(vt=void 0,bt++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Ot(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(bt=0,yt--,t)throw e}}function mt(e){if(yt>0)return e();St=++xt,yt++;try{return e()}finally{pt()}}var ht,gt=void 0;function _t(e){var t=gt,n=ht;gt=void 0,ht=void 0;try{return e()}finally{gt=t,ht=n}}var vt=void 0,yt=0,bt=0,xt=0,St=0,Ct=void 0,wt=0;function Tt(e){if(gt!==void 0){var t=e.n;if(t===void 0||t.t!==gt)return t={i:0,S:e,p:gt.s,n:void 0,t:gt,e:void 0,x:void 0,r:t},gt.s!==void 0&&(gt.s.n=t),gt.s=t,e.n=t,32&gt.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=gt.s,t.n=void 0,gt.s.n=t,gt.s=t),t}}function Et(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Et.prototype.brand=ft,Et.prototype.h=function(){return!0},Et.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?_t(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},Et.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&_t(function(){var e;(e=t.Z)==null||e.call(t)}))}},Et.prototype.subscribe=function(e){var t=this;return Lt(function(){var n=t.value;_t(function(){return e(n)})},{name:`sub`})},Et.prototype.valueOf=function(){return this.value},Et.prototype.toString=function(){return this.value+``},Et.prototype.toJSON=function(){return this.value},Et.prototype.peek=function(){var e=this;return _t(function(){return e.value})},Object.defineProperty(Et.prototype,"value",{get:function(){var e=Tt(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(bt>100)throw Error(`Cycle detected`);(function(e){yt!==0&&bt===0&&e.l!==St&&(e.l=St,Ct={S:e,v:e.v,i:e.i,o:Ct})})(this),this.v=e,this.i++,wt++,yt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{pt()}}}});function Dt(e,t){return new Et(e,t)}function Ot(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function kt(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function At(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function jt(e,t){Et.call(this,void 0,t),this.x=e,this.s=void 0,this.g=wt-1,this.f=4}jt.prototype=new Et,jt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===wt))return!0;if(this.g=wt,this.f|=1,this.i>0&&!Ot(this))return this.f&=-2,!0;var e=gt;try{kt(this),gt=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return gt=e,At(this),this.f&=-2,!0},jt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Et.prototype.S.call(this,e)},jt.prototype.U=function(e){if(this.t!==void 0&&(Et.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},jt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(jt.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=Tt(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Mt(e,t){return new jt(e,t)}function Nt(e){var t=e.m;if(e.m=void 0,typeof t==`function`){yt++;var n=gt;gt=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Pt(e),t}finally{gt=n,pt()}}}function Pt(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Nt(e)}function Ft(e){if(gt!==this)throw Error(`Out-of-order effect`);At(this),gt=e,this.f&=-2,8&this.f&&Pt(this),pt()}function It(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,ht&&ht.push(this)}It.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.m=t)}finally{e()}},It.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,Nt(this),kt(this),yt++;var e=gt;return gt=this,Ft.bind(this,e)},It.prototype.N=function(){2&this.f||(this.f|=2,this.u=vt,vt=this)},It.prototype.d=function(){this.f|=8,1&this.f||Pt(this)},It.prototype.dispose=function(){this.d()};function Lt(e,t){var n=new It(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Rt,zt,Bt=typeof window<`u`&&!!window.__PREACT_SIGNALS_DEVTOOLS__,Vt=[],Ht=[];Lt(function(){Rt=this.N})();function Ut(e,t){T[e]=t.bind(null,T[e]||function(){})}function Wt(e){if(zt){var t=zt;zt=void 0,t()}zt=e&&e.S()}function Gt(e){var t=this,n=e.data,r=qt(n);r.name=`ReactiveDom`,r.value=n;var i=nt(function(){for(var e=t,n=t.__v;n=n.__;)if(n.__c){n.__c.__$f|=4;break}var i=Mt(function(){var e=r.value.value;return e===0?0:!0===e?``:e||``}),a=Mt(function(){return!Array.isArray(i.value)&&!D(i.value)}),o=Lt(function(){if(this.N=$t,a.value){var t=i.value;e.__v&&e.__v.__e&&e.__v.__e.nodeType===3&&(e.__v.__e.data=t)}}),s=t.__$u.d;return t.__$u.d=function(){o(),s.call(this)},[a,i]},[]),a=i[0],o=i[1];return a.value?o.peek():o.value}Gt.displayName=`ReactiveTextNode`,Object.defineProperties(Et.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Gt},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}}),Ut(`__b`,function(e,t){if(typeof t.type==`string`){var n,r=t.props;for(var i in r)if(i!==`children`){var a=r[i];a instanceof Et&&(n||(t.__np=n={}),n[i]=a,r[i]=a.peek())}}e(t)}),Ut(`__r`,function(e,t){if(e(t),t.type!==fe){Wt();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(e,t){var n;return Lt(function(){n=this},{name:t}),n.c=e,n}(function(){var e;Bt&&((e=n.y)==null||e.call(n)),r.__$f|=1,r.setState({})},typeof t.type==`function`?t.type.displayName||t.type.name:``))),Wt(n)}}),Ut(`__e`,function(e,t,n,r){Wt(),e(t,n,r)}),Ut(`diffed`,function(e,t){Wt();var n;if(typeof t.type==`string`&&(n=t.__e)){var r=t.__np,i=t.props,a=n.U;if(a)for(var o in a){var s=a[o];s===void 0||r&&o in r||(s.d(),a[o]=void 0)}if(r)for(var c in a||(a={},n.U=a),r){var l=a[c],u=r[c];l===void 0?(l=Kt(n,c,u,i),a[c]=l):l.o(u,i)}}e(t)});function Kt(e,t,n,r){var i=t in e&&e.ownerSVGElement===void 0,a=Dt(n);return{o:function(e,t){a.value=e,r=t},d:Lt(function(){this.N=$t;var n=a.value.value;r[t]!==n&&(r[t]=n,i?e[t]=n:n!=null&&(!1!==n||t[4]===`-`)?e.setAttribute(t,n):e.removeAttribute(t))})}}Ut(`unmount`,function(e,t){if(typeof t.type==`string`){var n=t.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var a=r[i];a&&a.d()}}var o=t.__np;if(o){var s=t.props;for(var c in o)s[c]=o[c]}t.__np=void 0}else{var l=t.__c;if(l){var u=l.__$u;u&&(l.__$u=void 0,u.d())}}e(t)}),Ut(`__h`,function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)}),pe.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u==`boolean`&&!0===this.u){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!==`__source`&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function qt(e,t){return nt(function(){return Dt(e,t)},[])}var Jt=typeof requestAnimationFrame>`u`?setTimeout:function(e){var t=function(){clearTimeout(n),cancelAnimationFrame(r),e()},n=setTimeout(t,35),r=requestAnimationFrame(t)},Yt=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Xt(){mt(function(){for(var e;e=Vt.shift();)Rt.call(e)})}function Zt(){Vt.push(this)===1&&(T.requestAnimationFrame||Jt)(Xt)}function Qt(){mt(function(){for(var e;e=Ht.shift();)Rt.call(e)})}function $t(){Ht.push(this)===1&&(T.requestAnimationFrame||Yt)(Qt)}function en(e,t){var n=tt(e);n.current=e,$e(function(){return Lt(function(){return this.N=Zt,n.current()},t)},[])}function tn(e,t){for(var n in t)e[n]=t[n];return e}function nn(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function rn(e,t){var n=t(),r=Ze({t:{__:n,u:t}}),i=r[0].t,a=r[1];return et(function(){i.__=n,i.u=t,an(i)&&a({t:i})},[e,n,t]),$e(function(){return an(i)&&a({t:i}),e(function(){an(i)&&a({t:i})})},[e]),n}function an(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function on(e,t){this.props=e,this.context=t}function sn(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&(typeof n==`function`?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:nn(this.props,e)}function r(t){return this.shouldComponentUpdate=n,ue(e,t)}return r.displayName=`Memo(`+(e.displayName||e.name)+`)`,r.__f=r.prototype.isReactComponent=!0,r.type=e,r}(on.prototype=new pe).isPureReactComponent=!0,on.prototype.shouldComponentUpdate=function(e,t){return nn(this.props,e)||nn(this.state,t)};var cn=T.__b;T.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),cn&&cn(e)};var ln=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.forward_ref`)||3911;function un(e){function t(t){var n=tn({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=ln,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}var dn=T.__e;T.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}dn(e,t,n,r)};var fn=T.unmount;function pn(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=tn({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return pn(e,t,n)})),e}function mn(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return mn(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function hn(){this.__u=0,this.o=null,this.__b=null}function gn(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function _n(){this.i=null,this.l=null}T.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),fn&&fn(e)},(hn.prototype=new pe).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=gn(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=mn(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},hn.prototype.componentWillUnmount=function(){this.o=[]},hn.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=pn(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&ue(fe,null,e.fallback);return i&&(i.__u&=-33),[ue(fe,null,t.__a?null:e.children),i]};var vn=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function yn(e){return this.getChildContext=function(){return e.context},e.children}function bn(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){Fe(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}Fe(ue(yn,{context:t.context},e.__v),t.v)}function xn(e,t){var n=ue(bn,{__v:e,h:t});return n.containerInfo=t,n}(_n.prototype=new pe).__a=function(e){var t=this,n=gn(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),vn(t,e,r)):i()};n?n(a):a()}},_n.prototype.render=function(e){this.i=null,this.l=new Map;var t=Se(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},_n.prototype.componentDidUpdate=_n.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){vn(e,n,t)})};var Sn=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Cn=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,wn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Tn=/[A-Z0-9]/g,En=typeof document<`u`,Dn=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};pe.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(pe.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var On=T.event;T.event=function(e){return On&&(e=On(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var kn={configurable:!0,get:function(){return this.class}},An=T.vnode;T.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||En&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||Dn(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:wn.test(a)&&(a=s):s=a=`oninput`:i&&Cn.test(a)?a=a.replace(Tn,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=Se(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=Se(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",kn)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=Sn,An&&An(e)};var jn=T.__r;T.__r=function(e){jn&&jn(e),e.__c};var Mn=T.diffed;T.diffed=function(e){Mn&&Mn(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};var Nn=0;Array.isArray;function I(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Nn,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(o=e.defaultProps))for(s in o)c[s]===void 0&&(c[s]=o[s]);return T.vnode&&T.vnode(l),l}var Pn=null,Fn=(()=>{if(Pn!==null)return Pn;try{Pn=window.matchMedia(`(color-gamut: p3)`).matches}catch{Pn=!1}return Pn})(),In=e=>Fn?`color(display-p3 0.84 0.19 0.78 / ${e})`:`rgba(210, 57, 192, ${e})`,Ln=1e4;In(.4),In(.05),In(.5),In(.08),In(.15);var Rn=new Set([`script`,`style`,`template`,`noscript`]),zn=`data-react-grab-frozen`,Bn=`data-react-grab-same-origin-frame`;new Set(`display.position.top.right.bottom.left.z-index.overflow.overflow-x.overflow-y.width.height.min-width.min-height.max-width.max-height.margin-top.margin-right.margin-bottom.margin-left.padding-top.padding-right.padding-bottom.padding-left.flex-direction.flex-wrap.justify-content.align-items.align-self.align-content.flex-grow.flex-shrink.flex-basis.order.gap.row-gap.column-gap.grid-template-columns.grid-template-rows.grid-template-areas.font-family.font-size.font-weight.font-style.line-height.letter-spacing.text-align.text-decoration-line.text-decoration-style.text-transform.text-overflow.text-shadow.white-space.word-break.overflow-wrap.vertical-align.color.background-color.background-image.background-position.background-size.background-repeat.border-top-width.border-right-width.border-bottom-width.border-left-width.border-top-style.border-right-style.border-bottom-style.border-left-style.border-top-color.border-right-color.border-bottom-color.border-left-color.border-top-left-radius.border-top-right-radius.border-bottom-left-radius.border-bottom-right-radius.box-shadow.opacity.transform.filter.backdrop-filter.object-fit.object-position`.split(`.`));var Vn=e=>typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE,Hn=e=>Vn(e)&&e.namespaceURI===`http://www.w3.org/1999/xhtml`,Un=e=>Hn(e)&&e.tagName===`IFRAME`,Wn=new WeakMap,Gn=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},Kn=e=>{let t=performance.now(),n=Wn.get(e);if(n&&t-n.timestamp<16)return n.metrics;let r=e.ownerDocument.defaultView?.getComputedStyle(e),i;if(!r)i={contentOffsetX:e.clientLeft,contentOffsetY:e.clientTop,height:e.offsetHeight,width:e.offsetWidth};else{let t=Gn(r.borderLeftWidth),n=Gn(r.borderRightWidth),a=Gn(r.borderTopWidth),o=Gn(r.borderBottomWidth),s=Gn(r.paddingLeft),c=Gn(r.paddingRight),l=Gn(r.paddingTop),u=Gn(r.paddingBottom),d=Gn(r.width),f=Gn(r.height),p=t+n+s+c,m=a+o+l+u,h=r.boxSizing===`border-box`?d:d+p,g=r.boxSizing===`border-box`?f:f+m;i={contentOffsetX:t+s,contentOffsetY:a+l,height:g>0?g:e.offsetHeight,width:h>0?h:e.offsetWidth}}return Wn.set(e,{metrics:i,timestamp:t}),i},qn=(e,t)=>t>0?e/t:1,Jn=e=>{if(!e)return null;try{return e.frameElement}catch{return null}},Yn=(e,t,n)=>{let r=t,i=n,a=1,o=1,s=e;for(;s&&s!==window;){let e=Jn(s);if(!e||!Un(e))break;let t=e.getBoundingClientRect(),n=Kn(e),c=qn(t.width,n.width),l=qn(t.height,n.height);r=t.left+(n.contentOffsetX+r)*c,i=t.top+(n.contentOffsetY+i)*l,a*=c,o*=l,s=e.ownerDocument.defaultView}return{x:r,y:i,scaleX:a,scaleY:o}},Xn=e=>{let t=e.ownerDocument.defaultView;return t?t.getComputedStyle(e):window.getComputedStyle(e)},Zn=e=>Object.assign(e,{[Symbol.dispose]:e}),Qn=`bippy-0.6.1`,$n=Object.defineProperty,er=Object.prototype.hasOwnProperty,tr=()=>{},nr=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build`)})}catch{}},rr=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e),ir=!1,ar,or=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>ir?!0:(e&&typeof e.inject==`function`&&(ar=e.inject.toString()),!!ar?.includes(`(injected)`)),sr=new Set,cr=new Set,lr=e=>{e&&sr.add(e);let t=new Map,n=0,r={_instrumentationIsActive:!1,_instrumentationSource:Qn,checkDCE:nr,hasUnsupportedRendererAttached:!1,inject(e){let i=++n;return t.set(i,e),cr.add(e),r._instrumentationIsActive||(r._instrumentationIsActive=!0,sr.forEach(e=>e())),i},on:tr,onCommitFiberRoot:tr,onCommitFiberUnmount:tr,onPostCommitFiberRoot:tr,renderers:t,supportsFiber:!0,supportsFlight:!0};try{$n(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get(){return r},set(t){if(t&&typeof t==`object`){let n=r.renderers;r=t,n.size>0&&(n.forEach((e,n)=>{cr.add(e),t.renderers.set(n,e)}),ur(e))}}});let t=window.hasOwnProperty,n=!1;$n(window,`hasOwnProperty`,{configurable:!0,value:function(...e){try{if(!n&&e[0]===`__REACT_DEVTOOLS_GLOBAL_HOOK__`)return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,n=!0,-0}catch{}return t.apply(this,e)},writable:!0})}catch{ur(e)}return r},ur=e=>{e&&sr.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=nr,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=Qn,t._instrumentationIsActive=!1;let e=rr(t);if(e||(t.on=tr),t.renderers.size){t._instrumentationIsActive=!0,sr.forEach(e=>e());return}let n=t.inject,r=or(t);r&&!e&&(ir=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=e=>{let i=n(e);return cr.add(e),r&&t.renderers.set(i,e),t._instrumentationIsActive=!0,sr.forEach(e=>e()),i}}(t.renderers.size||t._instrumentationIsActive||or())&&e?.()}catch{}},dr=()=>er.call(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),fr=e=>dr()?(ur(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):lr(e),pr=()=>!!(typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`));(()=>{try{pr()&&fr()}catch{}})();var mr=e=>{let t=e.memoizedProps,n=e.alternate?.memoizedProps||{},r=e.flags??e.effectTag??0;switch(e.tag){case 1:case 9:case 11:case 0:case 14:case 15:return(r&1)==1;default:return e.alternate?n!==t||e.alternate.memoizedState!==e.memoizedState||e.alternate.ref!==e.ref:!0}},hr=e=>{switch(e.tag){case 18:return!0;case 7:case 6:case 23:case 22:return!0;case 3:return!1;default:{let t=typeof e.type==`object`&&e.type!==null?e.type.$$typeof:e.type;if(typeof t==`symbol`)return t.description===`react.concurrent_mode`||t.description===`react.async_mode`;switch(t){case 60111:case`Symbol(react.concurrent_mode)`:case`Symbol(react.async_mode)`:return!0;default:return!1}}}},gr=(e,t,n=!1)=>{if(!e)return null;if(t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=gr(r,t,n);if(e)return e;r=n?null:r.sibling}return null},_r=async(e,t,n=!1)=>{if(!e)return null;if(await t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=await _r(r,t,n);if(e)return e;r=n?null:r.sibling}return null},vr=e=>{let t=e;return typeof t==`function`?t:typeof t==`object`&&t?vr(t.type||t.render):null},yr=new Set,br=0,xr=new WeakMap,Sr=(e,t=br++)=>{xr.set(e,t)},Cr=e=>{let t=xr.get(e);return t===void 0&&e.alternate&&(t=xr.get(e.alternate)),t===void 0&&(t=br++,Sr(e,t)),t},wr=(e,t,n)=>{let r=t;for(;r!=null;){if(xr.has(r)||Cr(r),!hr(r)&&mr(r)&&e(r,`mount`),r.tag===13)if(r.memoizedState!==null){let t=r.child,n=t?t.sibling:null;if(n){let t=n.child;t!==null&&wr(e,t,!1)}}else{let t=null;r.child!==null&&(t=r.child.child),t!==null&&wr(e,t,!1)}else r.child!=null&&wr(e,r.child,!0);r=n?r.sibling:null}},Tr=(e,t,n,r)=>{if(xr.has(t)||Cr(t),!n)return;xr.has(n)||Cr(n);let i=t.tag===13,a=!hr(t);a&&mr(t)&&e(t,`update`);let o=i&&n.memoizedState!==null,s=i&&t.memoizedState!==null;if(o&&s){let r=t.child?.sibling??null,i=n.child?.sibling??null;r!==null&&i!==null&&Tr(e,r,i,t)}else if(o&&!s){let n=t.child;n!==null&&wr(e,n,!0)}else if(!o&&s){Dr(e,n);let r=t.child?.sibling??null;r!==null&&wr(e,r,!0)}else if(t.child!==n.child){let n=t.child;for(;n;){if(n.alternate){let i=n.alternate;Tr(e,n,i,a?t:r)}else wr(e,n,!1);n=n.sibling}}},Er=(e,t)=>{(t.tag===3||!hr(t))&&e(t,`unmount`)},Dr=(e,t)=>{let n=t.tag===13&&t.memoizedState!==null,r=t.child;for(n&&(r=(t.child?.sibling??null)?.child??null);r!==null;)r.return!==null&&(Er(e,r),Dr(e,r)),r=r.sibling},Or=e=>Object.prototype.toString.call(e)===`[object Object]`&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),kr=(e,t=[])=>{if(!Or(e))return[{path:t,value:e}];let n=[];for(let r in e){let i=e[r],a=t.concat(r);Or(i)?n.push(...kr(i,a)):n.push({path:a,value:i})}return n},Ar=new Set,jr=new Set,Mr=new Set,Nr=new Set,Pr=new WeakMap,Fr=new WeakMap,Ir=e=>{let t=Pr.get(e)??{};if(Pr.set(e,t),!t.onCommitFiberRoot||e.onCommitFiberRoot!==t.onCommitFiberRoot){let n=e.onCommitFiberRoot,r=(t,i,a)=>{if(n?.(t,i,a),Pr.get(e)?.onCommitFiberRoot===r){yr.add(i),Fr.set(i,t);for(let e of Ar)e(t,i,a)}};t.onCommitFiberRoot=r,e.onCommitFiberRoot=r}if(!t.onCommitFiberUnmount||e.onCommitFiberUnmount!==t.onCommitFiberUnmount){let n=e.onCommitFiberUnmount,r=(t,i)=>{if(n?.(t,i),Pr.get(e)?.onCommitFiberUnmount===r)for(let e of jr)e(t,i)};t.onCommitFiberUnmount=r,e.onCommitFiberUnmount=r}if(!t.onPostCommitFiberRoot||e.onPostCommitFiberRoot!==t.onPostCommitFiberRoot){let n=e.onPostCommitFiberRoot,r=(t,i)=>{if(n?.(t,i),Pr.get(e)?.onPostCommitFiberRoot===r)for(let e of Mr)e(t,i)};t.onPostCommitFiberRoot=r,e.onPostCommitFiberRoot=r}if(!t.onScheduleFiberRoot||e.onScheduleFiberRoot!==t.onScheduleFiberRoot){let n=e.onScheduleFiberRoot,r=(t,i,a)=>{if(n?.(t,i,a),Pr.get(e)?.onScheduleFiberRoot===r)for(let e of Nr)e(t,i,a)};t.onScheduleFiberRoot=r,e.onScheduleFiberRoot=r}},Lr=e=>{let t=fr(e.onActive);t._instrumentationSource=e.name??Qn,Ir(t);let{onActive:n,onCommitFiberRoot:r,onCommitFiberUnmount:i,onPostCommitFiberRoot:a,onScheduleFiberRoot:o}=e;return r&&Ar.add(r),i&&jr.add(i),a&&Mr.add(a),o&&Nr.add(o),Zn(()=>{n&&sr.delete(n),r&&Ar.delete(r),i&&jr.delete(i),a&&Mr.delete(a),o&&Nr.delete(o)})},Rr=new WeakMap,zr=e=>Rr.get(e)??null,Br=e=>{let t=e.ownerDocument?.defaultView;return!!(t&&e instanceof t.ShadowRoot)},Vr=class extends Error{constructor(e,t){super(e,t),this.name=`ReactGrabError`}},Hr=class extends Vr{constructor(){super(`Can't generate CSS selector for non-element node type.`),this.name=`NonElementNodeError`}},Ur=class extends Vr{constructor(e){super(`Timeout: Can't find a unique selector after ${e}ms`),this.name=`SelectorTimeoutError`,this.timeoutMs=e}},Wr=class extends Vr{constructor(){super(`Selector was not found.`),this.name=`SelectorNotFoundError`}},Gr=e=>zr(e)?.getTagName()??(e.tagName||``).toLowerCase(),Kr=e=>typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===9,qr=e=>{if(e.assignedSlot)return e.assignedSlot;if(e.parentElement)return e.parentElement;let t=e.getRootNode();return Br(t)?t.host:Kr(t)?Jn(t.defaultView):null},Jr=e=>!0,Yr=typeof window<`u`,Xr=e=>0,Zr=e=>{},Qr=Yr?(Object.getOwnPropertyDescriptor(Window.prototype,`requestAnimationFrame`)?.value??window.requestAnimationFrame).bind(window):Xr,$r=Yr?(Object.getOwnPropertyDescriptor(Window.prototype,`cancelAnimationFrame`)?.value??window.cancelAnimationFrame).bind(window):Zr,ei=e=>{try{return e.contentDocument}catch{return null}},ti=(e,t,n)=>{let r=e.getBoundingClientRect(),i=Kn(e),a=qn(r.width,i.width),o=qn(r.height,i.height);return{x:(t-r.left)/a-i.contentOffsetX,y:(n-r.top)/o-i.contentOffsetY}},ni=(e,t,n)=>{let r=e.elementFromPoint(t,n);for(;r;){let e=r.shadowRoot?.elementFromPoint(t,n);if(e&&e!==r){r=e;continue}if(Un(r)){let e=ei(r);if(!e)return r;let i=ti(r,t,n);return ni(e,i.x,i.y)??r}return r}return null},ri=e=>{let t=e;for(;t;){if(t.hasAttribute(`data-react-grab-ignore`))return!0;t=qr(t)}return!1},ii=typeof Element<`u`&&typeof Element.prototype.checkVisibility==`function`,ai={checkOpacity:!0,checkVisibilityCSS:!0,opacityProperty:!0,visibilityProperty:!0},oi={checkVisibilityCSS:!0,visibilityProperty:!0},si=(e,t)=>{if(ii&&!t)return e.checkVisibility(ai)?!0:e.checkVisibility(oi)?Xn(e).opacity!==`0`:!1;let n=t??Xn(e);return n.display!==`none`&&n.visibility!==`hidden`&&n.opacity!==`0`},ci=e=>{let t=Gr(e);return t===`html`||t===`body`},li=[`data-react-grab`,`data-react-grab-demo`],ui=e=>li.some(t=>e.hasAttribute(t)),di=e=>{if(ui(e))return!0;let t=e.getRootNode();return Br(t)&&ui(t.host)},fi=e=>{let t=parseInt(e.zIndex,10);return e.pointerEvents===`none`&&e.position===`fixed`&&!isNaN(t)&&t>=2147483600},pi=e=>{let t=e.backgroundColor;return t===`transparent`||t===`rgba(0, 0, 0, 0)`},mi=e=>{let t=e.position;if(t!==`fixed`&&t!==`absolute`)return!1;if(pi(e)||parseFloat(e.opacity)<.1)return!0;let n=parseInt(e.zIndex,10);return!isNaN(n)&&n>1e3},hi=new WeakMap,gi=e=>{let t=zr(e);if(t)return t.isConnected();if(ci(e)||di(e)||ri(e))return!1;let n=performance.now(),r=hi.get(e);if(r&&n-r.timestamp<50)return r.isVisible;if(!si(e))return hi.set(e,{isVisible:!1,timestamp:n}),!1;if(e.clientWidth/(e.ownerDocument.defaultView?.innerWidth??window.innerWidth)>=.9&&e.clientHeight/(e.ownerDocument.defaultView?.innerHeight??window.innerHeight)>=.9){let t=Xn(e);if(fi(t)||mi(t))return!1}return hi.set(e,{isVisible:!0,timestamp:n}),!0},_i=e=>{if(e===`transparent`)return!0;let t=e.lastIndexOf(`/`);if(t>=0)return Number.parseFloat(e.slice(t+1))===0;if(!e.startsWith(`rgba(`))return!1;let n=e.lastIndexOf(`,`);return n>=0&&Number.parseFloat(e.slice(n+1))===0},vi=e=>{let t=e.ownerDocument.defaultView?.getComputedStyle?.(e);if(!t)return!1;let n=t.backgroundClip!==`text`&&(t.backgroundImage!==`none`||!_i(t.backgroundColor)),r=t.borderTopStyle!==`none`&&t.borderTopWidth!==`0px`||t.borderRightStyle!==`none`&&t.borderRightWidth!==`0px`||t.borderBottomStyle!==`none`&&t.borderBottomWidth!==`0px`||t.borderLeftStyle!==`none`&&t.borderLeftWidth!==`0px`;return n||r||t.boxShadow!==`none`||t.outlineStyle!==`none`},yi=new Set([`A`,`AUDIO`,`BUTTON`,`CANVAS`,`DETAILS`,`EMBED`,`IFRAME`,`IMG`,`INPUT`,`METER`,`OBJECT`,`OPTION`,`PROGRESS`,`SELECT`,`SUMMARY`,`SVG`,`TEXTAREA`,`VIDEO`]),bi=new Set([`button`,`checkbox`,`combobox`,`gridcell`,`link`,`listbox`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`scrollbar`,`searchbox`,`slider`,`spinbutton`,`switch`,`tab`,`textbox`,`treeitem`]),xi=new Set(`A.ABBR.B.BDI.BDO.BR.CITE.CODE.DATA.DEL.DFN.EM.I.INS.KBD.MARK.Q.S.SAMP.SMALL.SPAN.STRONG.SUB.SUP.TIME.U.VAR.WBR`.split(`.`)),Si=new WeakMap,Ci=new WeakMap,wi=(e,t,n)=>(Si.set(e,t),Ci.set(e,n),t),Ti=e=>yi.has(e.tagName)||bi.has(e.getAttribute(`role`)??``)||Hn(e)&&e.isContentEditable,Ei=e=>{let t=performance.now(),n=Ci.get(e);if(n!==void 0&&t-n<16)return Si.get(e)??null;if(Ti(e)||e.childNodes.length>64)return wi(e,null,t);let r=[],i=[],a=0;for(let t=e.childNodes.length-1;t>=0;--t)i.push(e.childNodes[t]);for(;i.length>0;){if(a+=1,a>64)return wi(e,null,t);let n=i.pop();if(n){if(n.nodeType===Node.TEXT_NODE){if(n.textContent?.trim()&&(r.push(n),r.length>32))return wi(e,null,t);continue}if(!Vn(n)||!xi.has(n.tagName)||a+i.length+n.childNodes.length>64)return wi(e,null,t);for(let e=n.childNodes.length-1;e>=0;--e)i.push(n.childNodes[e])}}if(r.length===0||vi(e))return wi(e,null,t);try{let n=e.ownerDocument.createRange(),i=Yn(e.ownerDocument.defaultView,0,0),a=[];for(let o of r){n.selectNodeContents(o);let r=n.getClientRects();if(a.length+r.length>64)return wi(e,null,t);for(let e=0;e<r.length;e+=1){let t=r[e],n=t.width*i.scaleX,o=t.height*i.scaleY;!Number.isFinite(t.left)||!Number.isFinite(t.top)||!Number.isFinite(n)||!Number.isFinite(o)||n<=0||o<=0||a.push({borderRadius:`0px`,height:o,width:n,x:i.x+t.left*i.scaleX,y:i.y+t.top*i.scaleY})}}return wi(e,a.length>0?a:null,t)}catch{return wi(e,null,t)}},Di=(e,t,n)=>{let r=Ei(e);if(!r)return!0;for(let e of r)if(t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height)return!0;return!1},Oi=(e,t,n,r,i)=>{let a=!0;for(let o of e.elementsFromPoint(t,n)){if(ri(o)&&(a=!1),!Jr(o))continue;let s=o.shadowRoot;if(a&&s&&s!==e){let e=Oi(s,t,n,r,i);if(e)return e}if(a&&Un(o)){let e=ei(o);if(e){let a=ti(o,t,n),s=Oi(e,a.x,a.y,r,i);if(s)return s}}if(gi(o)&&Di(o,r,i))return o}return null},ki=(e,t,n,r)=>{let i=e.elementsFromPoint(t,n),a=!0;for(let o of i){if(ri(o)&&(a=!1),a&&o.shadowRoot&&o.shadowRoot!==e&&ki(o.shadowRoot,t,n,r),a&&Un(o)){let e=ei(o);if(e){let i=ti(o,t,n);ki(e,i.x,i.y,r)}}r.add(o)}};`${Bn}`;var Ai=(e,t)=>{if(e.length!==0)throw e.length===1?e[0]:AggregateError(e,t)},ji=new Set,Mi=new Set,Ni=(e,t)=>{if(Mi.has(e))try{e.unfreeze()}catch(e){t.push(e)}finally{Mi.delete(e)}},Pi=e=>(ji.add(e),()=>{let t=[];Ni(e,t),ji.delete(e),Ai(t,`Unregistering renderer freeze failed`)}),Fi=new WeakMap,Ii=new WeakMap,Li=new WeakMap,Ri=e=>typeof e==`object`&&!!e,zi=e=>typeof e==`object`&&!!e||typeof e==`function`,Bi=(e,t)=>typeof e[t]==`function`,Vi=e=>Ri(e)&&Bi(e,`clone`)&&Bi(e,`premultiply`),Hi=e=>Ri(e)&&e.isObject3D===!0&&typeof e.uuid==`string`&&typeof e.name==`string`&&typeof e.type==`string`&&typeof e.visible==`boolean`&&Vi(e.matrixWorld)&&Bi(e,`updateWorldMatrix`),Ui=e=>Ri(e)&&e.isCamera===!0,Wi=e=>Hi(e)&&e.isScene===!0&&Array.isArray(e.children),Gi=e=>Ri(e)&&typeof e.tagName==`string`&&e.tagName.toLowerCase()===`canvas`&&Bi(e,`getContext`),Ki=e=>Ri(e)&&Gi(e.domElement),qi=e=>Ri(e)&&Bi(e,`set`),Ji=e=>Ri(e)&&Bi(e,`setFromCamera`)&&Bi(e,`intersectObjects`),Yi=e=>Ri(e)&&Ki(e.gl)&&Wi(e.scene)&&Ui(e.camera)&&Ji(e.raycaster)&&qi(e.pointer),Xi=e=>e===`always`||e===`demand`||e===`never`,Zi=e=>Ri(e)&&typeof e.elapsedTime==`number`,Qi=(e,t)=>{let n=e.getState();if(typeof n.setFrameloop!=`function`)return;let r=Zi(n.clock)?n.clock.elapsedTime:null;n.setFrameloop(t);let i=e.getState().clock;r!==null&&Zi(i)&&(i.elapsedTime=r)},$i=e=>{if(Ii.has(e))return;let t=null,n=Pi({freeze:()=>{let n=Fi.get(e);if(!n)return;let r=n.getState();if(Xi(r.frameloop)&&typeof r.setFrameloop==`function`){let e=r.frameloop;Qi(n,`never`),t=()=>Qi(n,e)}},isConnected:()=>e.isConnected,unfreeze:()=>{t?.(),t=null}});Ii.set(e,n)},ea=e=>{let t=Ii.get(e);t&&(Ii.delete(e),t())},ta=e=>{let t=e.current.stateNode;if(!Ri(t)||!zi(t.containerInfo))return null;let n=t.containerInfo,r=Reflect.get(n,`getState`);if(typeof r!=`function`)return null;let i=Reflect.apply(r,n,[]);return Yi(i)?()=>{let e=Reflect.apply(r,n,[]);return Yi(e)?e:i}:null},na=e=>{let t=Li.get(e);t&&(Li.delete(e),Fi.get(t.canvas)===t.root&&(Fi.delete(t.canvas),ea(t.canvas)))},ra=e=>{let t=ta(e);if(!t){na(e);return}let n=t().gl.domElement;if(!n.isConnected||!e.current.child){na(e);return}let r=Li.get(e);r&&r.canvas!==n&&(na(e),r=void 0),r?(r.root.getState=t,r.root.selectableObjects=null):(r={canvas:n,root:{getState:t,selectableObjects:null}},Li.set(e,r)),Fi.set(n,r.root),$i(n)};Lr({name:`react-grab-three-selection`,onCommitFiberRoot:(e,t)=>ra(t)});var ia=null,aa=!1,oa=new Map,sa=new WeakSet,ca=new WeakSet,la=new WeakMap,ua=new Map,da=new Map,fa=e=>{if(ia===e&&(aa=!0),sa.has(e))return!0;if(ia===e){let t=(la.get(e)??0)+1;return la.set(e,t),t<4?!1:(sa.add(e),!0)}return!1};typeof window<`u`&&(window.requestAnimationFrame=e=>(fa(e),Qr(t=>{let n=ia,r=aa;ia=e,aa=!1;try{e(t)}finally{let t=aa;ia=n,aa=r,!t&&!ca.has(e)&&(sa.delete(e),la.delete(e))}})),window.cancelAnimationFrame=e=>{if(oa.has(e)){oa.delete(e);return}let t=da.get(e);if(t!==void 0){$r(t.nativeId),da.delete(e);return}let n=ua.get(e);if(n!==void 0){oa.delete(n),ua.delete(e);return}$r(e)}),`${zn}${zn}`;var pa=new WeakMap;Lr({name:`react-grab-freeze-updates`,onCommitFiberRoot:(e,t)=>{let n=fr().renderers.get(e);n&&pa.set(t,n)}});var ma=44,ha=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,ga=new Uint8Array(64),_a=new Uint8Array(128);for(let e=0;e<ha.length;e++){let t=ha.charCodeAt(e);ga[e]=t,_a[t]=e}function va(e,t){let n=0,r=0,i=0;do i=_a[e.next()],n|=(i&31)<<r,r+=5;while(i&32);let a=n&1;return n>>>=1,a&&(n=-2147483648|-n),t+n}function ya(e,t){return e.pos>=t?!1:e.peek()!==ma}var ba=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}};function xa(e){e.sort(Sa)}function Sa(e,t){return e[0]-t[0]}var Ca=Symbol.for(`react.context`),wa=[],Ta=null,Ea=Error("Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render."),Da=()=>{let e=Ta;return e!==null&&(Ta=e.next),e},Oa=e=>e._currentValue,ka=(e,t,n,r=null)=>{wa.push({displayName:r,primitive:e,stackError:Error(),value:t,dispatcherHookName:n})},Aa=e=>{if(typeof e==`object`&&e){let t=e;if(typeof t.then==`function`){let e=t;switch(e.status){case`fulfilled`:return ka(`Promise`,e.value,`Use`),e.value;case`rejected`:throw e.reason}throw ka(`Unresolved`,e,`Use`),Ea}if(t.$$typeof===Ca&&`_currentValue`in t){let e=t,n=Oa(e);return ka(`Context (use)`,n,`Use`,e.displayName||`Context`),n}}throw Error(`An unsupported type was passed to use(): `+String(e))},ja=e=>{let t=Oa(e);return ka(`Context`,t,`Context`,e.displayName||null),t},Ma=e=>{let t=Da(),n=t===null?typeof e==`function`?e():e:t.memoizedState;return ka(`State`,n,`State`),[n,()=>{}]},Na=(e,t,n)=>{let r=Da(),i=r===null?n===void 0?t:n(t):r.memoizedState;return ka(`Reducer`,i,`Reducer`),[i,()=>{}]},Pa=e=>{let t=Da(),n=t===null?{current:e}:t.memoizedState;return ka(`Ref`,n.current,`Ref`),n},Fa=()=>{let e=Da();return ka(`CacheRefresh`,e===null?()=>{}:e.memoizedState,`CacheRefresh`),()=>{}},Ia=e=>{Da(),ka(`LayoutEffect`,e,`LayoutEffect`)},La=e=>{Da(),ka(`InsertionEffect`,e,`InsertionEffect`)},Ra=e=>{Da(),ka(`Effect`,e,`Effect`)},za=e=>{Da();let t;typeof e==`object`&&e&&`current`in e&&(t=e.current),ka(`ImperativeHandle`,t,`ImperativeHandle`)},Ba=(e,t)=>{ka(`DebugValue`,typeof t==`function`?t(e):e,`DebugValue`)},Va=e=>{let t=Da();return ka(`Callback`,t===null?e:t.memoizedState[0],`Callback`),e},Ha=e=>{let t=Da(),n=t===null?e():t.memoizedState[0];return ka(`Memo`,n,`Memo`),n},Ua=(e,t)=>{let n=Da();Da();let r=n===null?t():n.memoizedState;return ka(`SyncExternalStore`,r,`SyncExternalStore`),r},Wa=()=>{let e=Da();Da();let t=e===null?!1:e.memoizedState;return ka(`Transition`,t,`Transition`),[t,()=>{}]},Ga=e=>{let t=Da(),n=t===null?e:t.memoizedState;return ka(`DeferredValue`,n,`DeferredValue`),n},Ka=()=>{let e=Da(),t=e===null?``:e.memoizedState;return ka(`Id`,t,`Id`),t},qa=e=>[],Ja=e=>{let t=Da(),n=t===null?e:t.memoizedState;return ka(`Optimistic`,n,`Optimistic`),[n,()=>{}]},Ya=(e,t)=>{let n,r=null;if(e!==null){let t=e.memoizedState;if(typeof t==`object`&&t&&`then`in t&&typeof t.then==`function`){let e=t;switch(e.status){case`fulfilled`:n=e.value;break;case`rejected`:r=e.reason;break;default:r=Ea,n=e}}else n=t}else n=t;return{value:n,error:r}},Xa=e=>(t,n)=>{let r=Da();Da(),Da();let i=Error(),{value:a,error:o}=Ya(r,n);if(wa.push({displayName:null,primitive:e,stackError:i,value:a,dispatcherHookName:e}),o!==null)throw o;return[a,()=>{},!1]},Za=Xa(`ActionState`),Qa={readContext:Oa,use:Aa,useCallback:Va,useContext:ja,useEffect:Ra,useImperativeHandle:za,useLayoutEffect:Ia,useInsertionEffect:La,useMemo:Ha,useReducer:Na,useRef:Pa,useState:Ma,useDebugValue:Ba,useDeferredValue:Ga,useTransition:Wa,useSyncExternalStore:Ua,useId:Ka,useHostTransitionStatus:()=>{let e=Oa({_currentValue:null});return ka(`HostTransitionStatus`,e,`HostTransitionStatus`),e},useFormState:Xa(`FormState`),useActionState:Za,useOptimistic:Ja,useMemoCache:qa,useCacheRefresh:Fa,useEffectEvent:e=>(Da(),ka(`EffectEvent`,e,`EffectEvent`),e)};typeof Proxy>`u`||new Proxy(Qa,{get(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];let n=Error(`Missing method in Dispatcher: `+t);throw n.name=`ReactDebugToolsUnsupportedHookError`,n}});var $a=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),eo=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},to=(e,t)=>{let n=$a.has(e)||e.startsWith(`data-`)&&eo(e),r=eo(t)&&t.length<100||t.startsWith(`#`)&&eo(t.slice(1));return n&&r},no=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},ro=e=>{let t=0;for(let n of e)t+=n.penalty;return t},io=(e,t)=>ro(e)-ro(t),ao=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(Vn(r)&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},oo=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,so=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,co=(e,t)=>{let n=[],r=e.getAttribute(`id`),i=e.tagName.toLowerCase();r&&eo(r)&&n.push({name:`#${CSS.escape(r)}`,penalty:0});for(let t of e.classList)eo(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:i,penalty:5});let a=ao(e,i);a!==void 0&&n.push({name:so(i,a),penalty:10});let o=ao(e);return o!==void 0&&n.push({name:oo(i,o),penalty:50}),n},lo=(e,t=Ln,n=[])=>{if(t<=0)return[];if(e.length===0)return[n];let r=[];for(let i of e[0]){let a=t-r.length;if(a<=0)break;r.push(...lo(e.slice(1),a,[...n,i]))}return r},uo=(e,t)=>{let n=t.getRootNode();return Br(n)?n:Kr(e)?e:e.ownerDocument},fo=(e,t)=>t.querySelectorAll(no(e)).length===1,po=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=ao(n,e);if(t===void 0)return;r.push({name:so(e,t),penalty:10}),n=n.parentElement}return fo(r,t)?r:void 0},mo=(e,t,n,r)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new Hr;if(e.tagName.toLowerCase()===`html`)return`html`;let i=uo(t,e),a=Date.now(),o=[],s=e,c=0,l;for(;s&&s!==i&&!l;)if(o.push(co(s,r)),s=s.parentElement,c++,c>=3){let t=lo(o);t.sort(io);for(let r of t){if(Date.now()-a>n){let t=po(e,i);if(!t)throw new Ur(n);return no(t)}if(fo(r,i)){l=r;break}}}if(!l&&c<3){let e=lo(o);e.sort(io);for(let t of e){if(Date.now()-a>n)break;if(fo(t,i)){l=t;break}}}if(!l)throw new Wr;return no(l)},ho=/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i,go=/:r[a-z0-9]+:/i,_o=/_r_[a-z0-9]+_(?:$|-)/i,vo=/«r[a-z0-9]+»/i,yo=/^(?:downshift-\d+(?:-|$)|headlessui-[a-z-]+-\d+(?:-|$)|mui-\d+(?:-|$)|radix-\d+(?:-|$)|react-aria-\d+(?:-|$)|react-select-\d+(?:-|$))/i,bo=/^ember\d+$/i,xo=/^\d+$/,So=e=>e.length>0&&e.length<=120&&!go.test(e)&&!ho.test(e)&&!_o.test(e)&&!vo.test(e)&&!yo.test(e)&&!bo.test(e)&&!xo.test(e),Co=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`href`,`src`,`role`,`name`,`title`,`alt`]),wo=new Set([`button`,`link`,`checkbox`,`radio`,`switch`,`tab`,`menuitem`,`option`,`textbox`,`combobox`,`slider`,`spinbutton`]),To=e=>e.ownerDocument.body??e.ownerDocument.documentElement,Eo=e=>e.length>0&&e.length<=120,Do=(e,t)=>Co.has(e)&&Eo(t)&&(e!==`role`||t.split(/\s+/).some(e=>wo.has(e))),Oo=(e,t)=>{try{let n=e.getRootNode(),r=(Br(n)?n:e.ownerDocument).querySelectorAll(t);return r.length===1&&r[0]===e}catch{return!1}},ko=e=>{let t=e.getAttribute(`id`),n=null;if(t){let r=`#${CSS.escape(t)}`;if(Oo(e,r)){if(So(t))return{selector:r,isSemantic:!0};n=r}}for(let t of Co){let n=e.getAttribute(t);if(!n||!Do(t,n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(Oo(e,r))return{selector:r,isSemantic:!0};let i=`${e.tagName.toLowerCase()}${r}`;if(Oo(e,i))return{selector:i,isSemantic:!0}}return n?{selector:n,isSemantic:!1}:null},Ao=e=>{let t=[],n=e.getRootNode(),r=Br(n)?n:To(e),i=e;for(;i;){let e=i.getAttribute(`id`);if(e){t.unshift(`#${CSS.escape(e)}`);break}let n=i.parentNode;if(!n){t.unshift(i.tagName.toLowerCase());break}let a=Array.from(n.children).indexOf(i)+1;if(t.unshift(`${i.tagName.toLowerCase()}:nth-child(${a})`),n===r){Vn(r)&&t.unshift(r.tagName.toLowerCase());break}i=Vn(n)?n:null}return t.join(` > `)},jo=e=>{let t=ko(e);if(t)return t;try{let t=mo(e,To(e),200,(e,t)=>to(e,t)||Do(e,t));if(t)return{selector:t,isSemantic:!1}}catch{}return{selector:Ao(e),isSemantic:!1}},Mo=e=>{let t=zr(e);if(t)return{selector:t.getSelector(),isSemantic:!0};let n=ko(e);if(!n?.isSemantic)return null;let r=e.getRootNode();if(Br(r)){let e=Mo(r.host);return e?{selector:`${e.selector} >>> ${n.selector}`,isSemantic:!0}:null}let i=Jn(e.ownerDocument.defaultView);if(!i)return n;let a=Mo(i);return a?{selector:`${a.selector} >>iframe>> ${n.selector}`,isSemantic:!0}:null},No=e=>{let t=zr(e);if(t)return{selector:t.getSelector(),isSemantic:!0};let n=jo(e),r=e.getRootNode();if(Br(r)){let e=No(r.host);return{selector:`${e.selector} >>> ${n.selector}`,isSemantic:e.isSemantic&&n.isSemantic}}let i=Jn(e.ownerDocument.defaultView);if(!i)return n;let a=No(i);return{selector:`${a.selector} >>iframe>> ${n.selector}`,isSemantic:a.isSemantic&&n.isSemantic}};[...Array.from(Co).filter(e=>e!==`role`).map(e=>`[${e}]`),...Array.from(wo).map(e=>`[role~="${e}"]`)].join(`,`),[`button`,`input`,`select`,`textarea`].join(`,`);var Po=e=>e.replace(/\s+/g,` `).trim(),Fo=e=>e.getAttribute(`aria-hidden`)===`true`||e.hasAttribute(`hidden`)?!0:Rn.has(e.tagName.toLowerCase()),Io=(e,t,n)=>{if(e.nodeType===Node.TEXT_NODE){let r=Po(e.textContent??``);return r?(t.push(r),n-r.length):n}if(!Vn(e)||Fo(e))return n;for(let r of e.childNodes)if(n=Io(r,t,n),n<=0)break;return n};new Set(`AppRouter.AppRouterAnnouncer.AppDevOverlay.AppDevOverlayErrorBoundary.ClientPageRoot.ClientSegmentRoot.DevRootHTTPAccessFallbackBoundary.ErrorBoundary.ErrorBoundaryHandler.GracefulDegradeBoundary.HTTPAccessErrorFallback.HTTPAccessFallbackBoundary.HTTPAccessFallbackErrorBoundary.HandleRedirect.Head.HistoryUpdater.HotReload.InnerLayoutRouter.InnerScrollAndFocusHandler.InnerScrollAndFocusHandlerOld.InnerScrollAndMaybeFocusHandler.InnerScrollHandlerNew.LinkComponent.LoadableComponent.LoadingBoundary.LoadingBoundaryProvider.NotAllowedRootHTTPFallbackError.OfflineProvider.OuterLayoutRouter.RedirectBoundary.RedirectErrorBoundary.RenderFromTemplateContext.RenderValidationBoundaryAtThisLevel.ReplaySsrOnlyErrors.RootErrorBoundary.RootLevelDevOverlayElement.Router.ScrollAndFocusHandler.ScrollAndMaybeFocusHandler.SegmentBoundaryTrigger.SegmentBoundaryTriggerNode.SegmentStateProvider.SegmentTrieNode.SegmentViewNode.SegmentViewStateNode.ServerRoot.body.html`.split(`.`)),new Map([`top`,`right`,`bottom`,`left`].flatMap(e=>[[`border-${e}-style`,e],[`border-${e}-color`,e]]));var Lo=Object.defineProperty,Ro=(e,t,n)=>t in e?Lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zo=(e,t,n)=>Ro(e,typeof t==`symbol`?t:t+``,n);Array.prototype.toSorted||Object.defineProperty(Array.prototype,"toSorted",{value:function(e){return[...this].sort(e)},writable:!0,configurable:!0});var Bo=typeof window<`u`,Vo=()=>Bo?(window.reactScanIdCounter===void 0&&(window.reactScanIdCounter=0),`${++window.reactScanIdCounter}`):`0`,Ho=e=>{let t=e.createOscillator(),n=e.createGain();t.connect(n),n.connect(e.destination);let r={type:`sine`,freq:[392,600],duration:.3,gain:.12},i=r.freq,a=r.duration/i.length;i.forEach((n,r)=>{t.frequency.setValueAtTime(n,e.currentTime+r*a)}),t.type=r.type,n.gain.setValueAtTime(r.gain,e.currentTime),n.gain.setTargetAtTime(0,e.currentTime+r.duration*.7,.05),t.start(),t.stop(e.currentTime+r.duration)},Uo=un(({size:e=15,name:t,fill:n=`currentColor`,stroke:r=`currentColor`,className:i,externalURL:a=``,style:o},s)=>{let c=Array.isArray(e)?e[0]:e,l=Array.isArray(e)?e[1]||e[0]:e,u=`${a}#${t}`;return I(`svg`,{ref:s,width:`${c}px`,height:`${l}px`,fill:n,stroke:r,className:i,style:{...o,minWidth:`${c}px`,maxWidth:`${c}px`,minHeight:`${l}px`,maxHeight:`${l}px`},children:[I(`title`,{children:t}),I(`use`,{href:u})]})}),Wo=24,Go={width:550,height:350,initialHeight:400},Ko=240,qo=`react-scan-widget-settings-v2`,Jo=`react-scan-widget-collapsed-v1`;function Yo(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Yo(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Xo(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Yo(e))&&(r&&(r+=` `),r+=t);return r}var Zo=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Qo=(e,t)=>({classGroupId:e,validator:t}),$o=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),es=`-`,ts=[],ns=`arbitrary..`,rs=e=>{let t=os(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return as(e);let n=e.split(es);return is(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Zo(i,t):t:i||ts}return n[e]||ts}}},is=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=is(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(es):e.slice(t).join(es),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},as=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?ns+r:void 0})(),os=e=>{let{theme:t,classGroups:n}=e;return ss(n,t)},ss=(e,t)=>{let n=$o();for(let r in e){let i=e[r];cs(i,n,r,t)}return n},cs=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];ls(i,t,n,r)}},ls=(e,t,n,r)=>{if(typeof e==`string`){us(e,t,n);return}if(typeof e==`function`){ds(e,t,n,r);return}fs(e,t,n,r)},us=(e,t,n)=>{let r=e===``?t:ps(t,e);r.classGroupId=n},ds=(e,t,n,r)=>{if(ms(e)){cs(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Qo(n,e))},fs=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];cs(o,ps(t,a),n,r)}},ps=(e,t)=>{let n=e,r=t.split(es),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=$o(),n.nextPart.set(t,i)),n=i}return n},ms=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,hs=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},gs=`!`,_s=`:`,vs=[],ys=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),bs=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===_s){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(gs)?(c=s.slice(0,-1),l=!0):s.startsWith(gs)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return ys(t,l,c,u)};if(t){let e=t+_s,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):ys(vs,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},xs=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ss=e=>({cache:hs(e.cacheSize),parseClassName:bs(e),sortModifiers:xs(e),...rs(e)}),Cs=/\s+/,ws=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Cs),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+gs:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Ts=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Es(n))&&(i&&(i+=` `),i+=r);return i},Es=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Es(e[r]))&&(n&&(n+=` `),n+=t);return n},Ds=(e,...t)=>{let n,r,i,a,o=o=>(n=Ss(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=ws(e,n);return i(e,a),a};return a=o,(...e)=>a(Ts(...e))},Os=[],ks=e=>{let t=t=>t[e]||Os;return t.isThemeGetter=!0,t},As=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,js=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ms=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ns=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ps=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Fs=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Is=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ls=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rs=e=>Ms.test(e),zs=e=>!!e&&!Number.isNaN(Number(e)),Bs=e=>!!e&&Number.isInteger(Number(e)),Vs=e=>e.endsWith(`%`)&&zs(e.slice(0,-1)),Hs=e=>Ns.test(e),Us=()=>!0,Ws=e=>Ps.test(e)&&!Fs.test(e),Gs=()=>!1,Ks=e=>Is.test(e),qs=e=>Ls.test(e),Js=e=>!L(e)&&!R(e),Ys=e=>uc(e,mc,Gs),L=e=>As.test(e),Xs=e=>uc(e,hc,Ws),Zs=e=>uc(e,gc,zs),Qs=e=>uc(e,vc,Us),$s=e=>uc(e,_c,Gs),ec=e=>uc(e,fc,Gs),tc=e=>uc(e,pc,qs),nc=e=>uc(e,yc,Ks),R=e=>js.test(e),rc=e=>dc(e,hc),ic=e=>dc(e,_c),ac=e=>dc(e,fc),oc=e=>dc(e,mc),sc=e=>dc(e,pc),cc=e=>dc(e,yc,!0),lc=e=>dc(e,vc,!0),uc=(e,t,n)=>{let r=As.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},dc=(e,t,n=!1)=>{let r=js.exec(e);return r?r[1]?t(r[1]):n:!1},fc=e=>e===`position`||e===`percentage`,pc=e=>e===`image`||e===`url`,mc=e=>e===`length`||e===`size`||e===`bg-size`,hc=e=>e===`length`,gc=e=>e===`number`,_c=e=>e===`family-name`,vc=e=>e===`number`||e===`weight`,yc=e=>e===`shadow`,bc=Ds(()=>{let e=ks(`color`),t=ks(`font`),n=ks(`text`),r=ks(`font-weight`),i=ks(`tracking`),a=ks(`leading`),o=ks(`breakpoint`),s=ks(`container`),c=ks(`spacing`),l=ks(`radius`),u=ks(`shadow`),d=ks(`inset-shadow`),f=ks(`text-shadow`),p=ks(`drop-shadow`),m=ks(`blur`),h=ks(`perspective`),g=ks(`aspect`),_=ks(`ease`),v=ks(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),R,L],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[R,L,c],T=()=>[Rs,`full`,`auto`,...w()],E=()=>[Bs,`none`,`subgrid`,R,L],D=()=>[`auto`,{span:[`full`,Bs,R,L]},Bs,R,L],O=()=>[Bs,`auto`,R,L],k=()=>[`auto`,`min`,`max`,`fr`,R,L],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Rs,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Rs,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ee=()=>[Rs,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],F=()=>[e,R,L],te=()=>[...b(),ac,ec,{position:[R,L]}],ne=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],re=()=>[`auto`,`cover`,`contain`,oc,Ys,{size:[R,L]}],ie=()=>[Vs,rc,Xs],ae=()=>[``,`none`,`full`,l,R,L],oe=()=>[``,zs,rc,Xs],se=()=>[`solid`,`dashed`,`dotted`,`double`],ce=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],le=()=>[zs,Vs,ac,ec],ue=()=>[``,`none`,m,R,L],de=()=>[`none`,zs,R,L],fe=()=>[`none`,zs,R,L],pe=()=>[zs,R,L],me=()=>[Rs,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Hs],breakpoint:[Hs],color:[Us],container:[Hs],"drop-shadow":[Hs],ease:[`in`,`out`,`in-out`],font:[Js],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Hs],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Hs],shadow:[Hs],spacing:[`px`,zs],text:[Hs],"text-shadow":[Hs],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Rs,L,R,g]}],container:[`container`],columns:[{columns:[zs,L,R,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Bs,`auto`,R,L]}],basis:[{basis:[Rs,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[zs,Rs,`auto`,`initial`,`none`,L]}],grow:[{grow:[``,zs,R,L]}],shrink:[{shrink:[``,zs,R,L]}],order:[{order:[Bs,`first`,`last`,`none`,R,L]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...ee()]}],"min-block-size":[{"min-block":[`auto`,...ee()]}],"max-block-size":[{"max-block":[`none`,...ee()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,rc,Xs]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,lc,Qs]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Vs,L]}],"font-family":[{font:[ic,$s,t]}],"font-features":[{"font-features":[L]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,R,L]}],"line-clamp":[{"line-clamp":[zs,`none`,R,Zs]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,R,L]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,R,L]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...se(),`wavy`]}],"text-decoration-thickness":[{decoration:[zs,`from-font`,`auto`,R,Xs]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[zs,`auto`,R,L]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,R,L]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,R,L]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:te()}],"bg-repeat":[{bg:ne()}],"bg-size":[{bg:re()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Bs,R,L],radial:[``,R,L],conic:[Bs,R,L]},sc,tc]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...se(),`hidden`,`none`]}],"divide-style":[{divide:[...se(),`hidden`,`none`]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...se(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[zs,R,L]}],"outline-w":[{outline:[``,zs,rc,Xs]}],"outline-color":[{outline:F()}],shadow:[{shadow:[``,`none`,u,cc,nc]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":[`none`,d,cc,nc]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:oe()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[zs,Xs]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":[`none`,f,cc,nc]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[zs,R,L]}],"mix-blend":[{"mix-blend":[...ce(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[zs]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[R,L]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[zs]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:te()}],"mask-repeat":[{mask:ne()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,R,L]}],filter:[{filter:[``,`none`,R,L]}],blur:[{blur:ue()}],brightness:[{brightness:[zs,R,L]}],contrast:[{contrast:[zs,R,L]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,cc,nc]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:[``,zs,R,L]}],"hue-rotate":[{"hue-rotate":[zs,R,L]}],invert:[{invert:[``,zs,R,L]}],saturate:[{saturate:[zs,R,L]}],sepia:[{sepia:[``,zs,R,L]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,R,L]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[zs,R,L]}],"backdrop-contrast":[{"backdrop-contrast":[zs,R,L]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,zs,R,L]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[zs,R,L]}],"backdrop-invert":[{"backdrop-invert":[``,zs,R,L]}],"backdrop-opacity":[{"backdrop-opacity":[zs,R,L]}],"backdrop-saturate":[{"backdrop-saturate":[zs,R,L]}],"backdrop-sepia":[{"backdrop-sepia":[``,zs,R,L]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,R,L]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[zs,`initial`,R,L]}],ease:[{ease:[`linear`,`initial`,_,R,L]}],delay:[{delay:[zs,R,L]}],animate:[{animate:[`none`,v,R,L]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,R,L]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":[`scale-3d`],skew:[{skew:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[R,L,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":[`translate-none`],accent:[{accent:F()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,R,L]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,R,L]}],fill:[{fill:[`none`,...F()]}],"stroke-w":[{stroke:[zs,rc,Xs,Zs]}],stroke:[{stroke:[`none`,...F()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}}),z=(...e)=>bc(Xo(e));typeof navigator<`u`&&navigator.userAgent.includes(`Firefox`);var xc=(e,t)=>{let n=0;return r=>{let i=Date.now();if(i-n>=t)return n=i,e(r)}},Sc=e=>{if(!Bo)return null;try{let t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},Cc=(e,t)=>{if(Bo)try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},wc=Dt(!1),Tc=()=>({corner:`bottom-right`,dimensions:{isFullWidth:!1,isFullHeight:!1,width:Go.width,height:Go.height,position:{x:Wo,y:Wo}},lastDimensions:{isFullWidth:!1,isFullHeight:!1,width:Go.width,height:Go.height,position:{x:Wo,y:Wo}},componentsTree:{width:Ko}});Tc(),Dt((()=>{let e=Tc(),t=Sc(qo);return t?{corner:t.corner??e.corner,dimensions:t.dimensions??e.dimensions,lastDimensions:t.lastDimensions??t.dimensions??e.lastDimensions,componentsTree:t.componentsTree??e.componentsTree}:(Cc(qo,{corner:e.corner,dimensions:e.dimensions,lastDimensions:e.lastDimensions,componentsTree:e.componentsTree}),e)})());var Ec=Dt({view:`none`});Sc(Jo);function Dc(){return!1}function Oc(e){function t(t){return this.shouldComponentUpdate=Dc,ue(e,t)}return t.displayName=`Memo(${e.displayName||e.name})`,t.prototype.isReactComponent=!0,t._forwarded=!0,t}var kc=Dt({updates:[],currentFiber:null,totalUpdates:0,windowOffset:0,currentIndex:0,isViewingHistory:!1,latestFiber:null,isVisible:!1,playbackSpeed:1});Dt(0),Dt({query:``,matches:[],currentMatchIndex:-1}),Dt({fiber:null,fiberProps:{current:[],changes:new Set},fiberState:{current:[],changes:new Set},fiberContext:{current:[],changes:new Set}}),sn(()=>{let e=tt(null),t=tt(null),n=tt(null),r=tt({isPropsChanged:!1,isStateChanged:!1,isContextChanged:!1});return $e(()=>{let i=xc(()=>{let r=[];e.current?.dataset.flash===`true`&&r.push(e.current),t.current?.dataset.flash===`true`&&r.push(t.current),n.current?.dataset.flash===`true`&&r.push(n.current);for(let e of r)e.classList.remove(`count-flash-white`),e.offsetWidth,e.classList.add(`count-flash-white`)},400);return kc.subscribe(a=>{if(!e.current||!t.current||!n.current)return;let{currentIndex:o,updates:s}=a,c=s[o];!c||o===0||(i(),r.current={isPropsChanged:(c.props?.changes?.size??0)>0,isStateChanged:(c.state?.changes?.size??0)>0,isContextChanged:(c.context?.changes?.size??0)>0},e.current.dataset.flash!==`true`&&(e.current.dataset.flash=r.current.isPropsChanged.toString()),t.current.dataset.flash!==`true`&&(t.current.dataset.flash=r.current.isStateChanged.toString()),n.current.dataset.flash!==`true`&&(n.current.dataset.flash=r.current.isContextChanged.toString()))})},[]),I(`button`,{type:`button`,className:z(`react-section-header`,`overflow-hidden`,`max-h-0`,`transition-[max-height]`),children:I(`div`,{className:z(`flex-1 react-scan-expandable`),children:I(`div`,{className:`overflow-hidden`,children:I(`div`,{className:`flex items-center whitespace-nowrap`,children:[I(`div`,{className:`flex items-center gap-x-2`,children:`What changed?`}),I(`div`,{className:z(`ml-auto`,`change-scope`,`transition-opacity duration-300 delay-150`),children:[I(`div`,{ref:e,children:`props`}),I(`div`,{ref:t,children:`state`}),I(`div`,{ref:n,children:`context`})]})]})})})})}),Mt(()=>z(`react-scan-inspector`,`flex-1`,`opacity-0`,`overflow-y-auto overflow-x-hidden`,`transition-opacity delay-0`,`pointer-events-none`,!wc.value&&`opacity-100 delay-300 pointer-events-auto`));var Ac=0,jc=performance.now(),Mc=0,Nc=!1,Pc=()=>{Mc++;let e=performance.now();e-jc>=1e3&&(Ac=Mc,Mc=0,jc=e),requestAnimationFrame(Pc)},Fc=()=>(Nc||(Nc=!0,Pc(),Ac=60),Ac);function Ic(e,t){let n=[];for(let t of e){let e=t.target;this.seenElements.has(e)||(this.seenElements.add(e),n.push(t))}n.length>0&&this.resolveNext&&(this.resolveNext(n),this.resolveNext=null),this.seenElements.size===this.uniqueElements.size&&(t.disconnect(),this.done=!0,this.resolveNext&&this.resolveNext([]))}var Lc=async function*(e){let t={uniqueElements:new Set(e),seenElements:new Set,resolveNext:null,done:!1},n=new IntersectionObserver(Ic.bind(t));for(let e of t.uniqueElements)n.observe(e);for(;!t.done;){let e=await new Promise(e=>{t.resolveNext=e});e.length>0&&(yield e)}};Mt(()=>z(`absolute inset-0 flex items-center gap-x-2`,`translate-y-0`,`transition-transform duration-300`,wc.value&&`-translate-y-[200%]`));var Rc=({className:e,...t})=>I(`div`,{className:z(`react-scan-toggle`,e),children:[I(`input`,{type:`checkbox`,...t}),I(`div`,{})]}),zc=({fps:e})=>I(`div`,{className:z(`flex items-center gap-x-1 px-2 w-full`,`h-6`,`rounded-md`,`font-mono leading-none`,`bg-[#141414]`,`ring-1 ring-white/[0.08]`),children:[I(`div`,{style:{color:(e=>e<30?`#EF4444`:e<50?`#F59E0B`:`rgb(214,132,245)`)(e)},className:`text-sm font-semibold tracking-wide transition-colors ease-in-out w-full flex justify-center items-center`,children:e}),I(`span`,{className:`text-white/30 text-[11px] font-medium tracking-wide ml-auto min-w-fit`,children:`FPS`})]}),Bc=()=>{let[e,t]=Ze(null);return $e(()=>{let e=setInterval(()=>{t(Fc())},200);return()=>clearInterval(e)},[]),I(`div`,{className:z(`flex items-center justify-end gap-x-2 px-1 ml-1 w-[72px]`,`whitespace-nowrap text-sm text-white`),children:e===null?I(fe,{children:`️`}):I(zc,{fps:e})})},Vc=e=>e(),Hc=class e extends Array{constructor(e=25){super(),zo(this,`capacity`,e)}push(...e){let t=super.push(...e);for(;this.length>this.capacity;)this.shift();return t}static fromArray(t,n){let r=new e(n);return r.push(...t),r}};new class{constructor(e){zo(this,`subscribers`,new Set),zo(this,`currentValue`),this.currentValue=e}subscribe(e){return this.subscribers.add(e),e(this.currentValue),()=>{this.subscribers.delete(e)}}setState(e){this.currentValue=e,this.subscribers.forEach(t=>t(e))}getCurrentState(){return this.currentValue}}(new Hc(150));var Uc=50;new class{constructor(){zo(this,`channels`,{})}publish(e,t,n=!0){let r=this.channels[t];if(!r){if(!n)return;this.channels[t]={callbacks:new Hc(Uc),state:new Hc(Uc)},this.channels[t].state.push(e);return}r.state.push(e),r.callbacks.forEach(t=>t(e))}getAvailableChannels(){return Hc.fromArray(Object.keys(this.channels),Uc)}subscribe(e,t,n=!1){let r=()=>(n||this.channels[e].state.forEach(e=>{t(e)}),()=>{let n=this.channels[e].callbacks.filter(e=>e!==t);this.channels[e].callbacks=Hc.fromArray(n,Uc)}),i=this.channels[e];return i?(i.callbacks.push(t),r()):(this.channels[e]={callbacks:new Hc(Uc),state:new Hc(Uc)},this.channels[e].callbacks.push(t),r())}updateChannelState(e,t,n=!0){let r=this.channels[e];if(!r){if(!n)return;let r=new Hc(Uc),i={callbacks:new Hc(Uc),state:r};this.channels[e]=i,i.state=t(r);return}r.state=t(r.state)}getChannelState(e){return this.channels[e].state??new Hc(Uc)}},new Hc(25);var Wc=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:(e,r)=>{let i,a;r?(i=e,a=r):a=e;let o=i?i(t):void 0,s=(e,t)=>{if(i){let n=i(e),r=i(t);Object.is(o,n)||(o=n,a(n,r))}else a(e,t)};return n.add(s),()=>n.delete(s)}},o=t=e(r,i,a);return a},Gc=(e=>e?Wc(e):Wc);Gc()(e=>({state:{events:[]},actions:{addEvent:t=>{e(e=>({state:{events:[...e.state.events,t]}}))},clear:()=>{e({state:{events:[]}})}}}));var Kc=200,qc=Gc()((e,t)=>{let n=new Set;return{state:{events:new Hc(Kc)},actions:{addEvent:r=>{n.forEach(e=>e(r));let i=[...t().state.events,r],a=(e,t)=>{let n=i.find(t=>{if(t.kind!==`long-render`&&t.id!==e.id&&(e.data.startAt<=t.data.startAt&&e.data.endAt<=t.data.endAt&&e.data.endAt>=t.data.startAt||t.data.startAt<=e.data.startAt&&t.data.endAt>=e.data.startAt||e.data.startAt<=t.data.startAt&&e.data.endAt>=t.data.endAt))return!0});n&&t(n)},o=new Set;i.forEach(e=>{e.kind!==`interaction`&&a(e,()=>{o.add(e.id)})});let s=i.filter(e=>!o.has(e.id));e(()=>({state:{events:Hc.fromArray(s,Kc)}}))},addListener:e=>(n.add(e),()=>{n.delete(e)}),clear:()=>{e({state:{events:new Hc(Kc)}})}}}}),Jc=()=>rn(qc.subscribe,qc.getState),Yc=150,Xc=e=>{let t=e.filter(e=>e.length>2);return t.length===0?e.at(-1)??`Unknown`:t.at(-1)},Zc=e=>{switch(e.kind){case`interaction`:{let{renderTime:t,otherJSTime:n,framePreparation:r,frameConstruction:i,frameDraw:a}=e;return t+n+r+i+(a??0)}case`dropped-frames`:return e.otherTime+e.renderTime}},Qc=e=>e.wasFiberRenderMount||e.hasMemoCache?!1:e.changes.context.length===0&&e.changes.props.length===0&&e.changes.state.length===0,$c=e=>{let t=Zc(e.timing);switch(e.kind){case`interaction`:return t<200?`low`:t<500?`needs-improvement`:`high`;case`dropped-frames`:return t<50?`low`:t<Yc?`needs-improvement`:`high`}},el=()=>it(tl),tl=Ie(null),nl=({size:e=24,className:t})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:z([`lucide lucide-chevron-right`,t]),children:I(`path`,{d:`m9 18 6-6-6-6`})}),rl=({className:e=``,size:t=24,events:n=[]})=>{let r=n.includes(!0),i=n.filter(e=>e).length,a=i>99?`>99`:i,o=r?Math.max(t*.6,14):Math.max(t*.4,6);return I(`div`,{className:`relative`,children:[I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:`lucide lucide-bell ${e}`,children:[I(`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`}),I(`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`})]}),n.length>0&&i>0&&su.options.value.showNotificationCount&&I(`div`,{className:z([`absolute`,r?`-top-2.5 -right-2.5`:`-top-1 -right-1`,`rounded-full`,`flex items-center justify-center`,`text-[8px] font-medium text-white`,`aspect-square`,r?`bg-red-500/90`:`bg-purple-500/90`]),style:{width:`${o}px`,height:`${o}px`,padding:r?`0.5px`:`0`},children:r&&a})]})},il=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:e,children:[I(`path`,{d:`M18 6 6 18`}),I(`path`,{d:`m6 6 12 12`})]}),al=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:e,children:[I(`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`}),I(`path`,{d:`M16 9a5 5 0 0 1 0 6`}),I(`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`})]}),ol=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:e,children:[I(`path`,{d:`M16 9a5 5 0 0 1 .95 2.293`}),I(`path`,{d:`M19.364 5.636a9 9 0 0 1 1.889 9.96`}),I(`path`,{d:`m2 2 20 20`}),I(`path`,{d:`m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11`}),I(`path`,{d:`M9.828 4.172A.686.686 0 0 1 11 4.657v.686`})]}),sl=({size:e=24,className:t})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:z([`lucide lucide-arrow-left`,t]),children:[I(`path`,{d:`m12 19-7-7 7-7`}),I(`path`,{d:`M19 12H5`})]}),cl=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:e,children:[I(`path`,{d:`M14 4.1 12 6`}),I(`path`,{d:`m5.1 8-2.9-.8`}),I(`path`,{d:`m6 12-1.9 2`}),I(`path`,{d:`M7.2 2.2 8 5.1`}),I(`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`})]}),ll=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:e,children:[I(`path`,{d:`M10 8h.01`}),I(`path`,{d:`M12 12h.01`}),I(`path`,{d:`M14 8h.01`}),I(`path`,{d:`M16 12h.01`}),I(`path`,{d:`M18 8h.01`}),I(`path`,{d:`M6 8h.01`}),I(`path`,{d:`M7 16h10`}),I(`path`,{d:`M8 12h.01`}),I(`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`})]}),ul=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:e,style:{transform:`rotate(180deg)`},children:[I(`circle`,{cx:`12`,cy:`12`,r:`10`}),I(`path`,{d:`m4.9 4.9 14.2 14.2`})]}),dl=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,children:[I(`polyline`,{points:`22 17 13.5 8.5 8.5 13.5 2 7`}),I(`polyline`,{points:`16 17 22 17 22 11`})]}),fl=({children:e,triggerContent:t,wrapperProps:n})=>{let[r,i]=Ze(`closed`),[a,o]=Ze(null),[s,c]=Ze({width:window.innerWidth,height:window.innerHeight}),l=tt(null),u=tt(null),d=it(iu),f=tt(!1);$e(()=>{let e=()=>{c({width:window.innerWidth,height:window.innerHeight}),p()};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let p=()=>{if(l.current&&d){let e=l.current.getBoundingClientRect(),t=d.getBoundingClientRect(),n=e.left+e.width/2,r=e.top,i=new DOMRect(n-t.left,r-t.top,e.width,e.height);o(i)}};$e(()=>{p()},[l.current]),$e(()=>{if(r===`opening`){let e=setTimeout(()=>i(`open`),120);return()=>clearTimeout(e)}else if(r===`closing`){let e=setTimeout(()=>i(`closed`),120);return()=>clearTimeout(e)}},[r]),$e(()=>{let e=setInterval(()=>{!f.current&&r!==`closed`&&i(`closing`)},1e3);return()=>clearInterval(e)},[r]);let m=()=>{f.current=!0,p(),i(`opening`)},h=()=>{f.current=!1,p(),i(`closing`)},g=(()=>{if(!a||!d)return{top:0,left:0};let e=d.getBoundingClientRect(),t=u.current?.offsetHeight||40,n=a.x+e.left,r=a.y+e.top,i=n,o=r-4;return i-175/2<5?i=92.5:i+175/2>s.width-5&&(i=s.width-5-175/2),o-t<5&&(o=r+a.height+4),{top:o-e.top,left:i-e.left}})();return I(fe,{children:[d&&a&&r!==`closed`&&xn(I(`div`,{ref:u,className:z([`absolute z-100 bg-white text-black rounded-lg px-3 py-2 shadow-lg`,`transition-[opacity] duration-120 ease-out`,`after:content-[""] after:absolute after:top-[100%]`,`after:left-1/2 after:-translate-x-1/2`,`after:w-[10px] after:h-[6px]`,`after:border-l-[5px] after:border-l-transparent`,`after:border-r-[5px] after:border-r-transparent`,`after:border-t-[6px] after:border-t-white`,`pointer-events-none`,r===`opening`||r===`closing`?`opacity-0`:`opacity-100`]),style:{top:g.top+`px`,left:g.left+`px`,transform:`translate(-50%, calc(-100% - 4px)) scale(${r===`open`?1:.97})`,minWidth:`175px`,willChange:`opacity, transform`},children:e}),d),I(`div`,{ref:l,onMouseEnter:m,onMouseLeave:h,...n,children:t})]})},pl=({selectedEvent:e})=>{let{notificationState:t,setNotificationState:n,setRoute:r}=el();return I(`div`,{className:z([`flex w-full justify-between items-center px-3 py-2 text-xs`]),children:[I(`div`,{className:z([`bg-[#18181B] flex items-center gap-x-1 p-1 rounded-sm`]),children:[I(`button`,{onClick:()=>{r({route:`render-visualization`,routeMessage:null})},className:z([`w-1/2 flex items-center justify-center whitespace-nowrap py-[5px] px-1 gap-x-1`,t.route===`render-visualization`||t.route===`render-explanation`?`text-white bg-[#7521c8] rounded-sm`:`text-[#6E6E77] bg-[#18181B] rounded-sm`]),children:`Ranked`}),I(`button`,{onClick:()=>{r({route:`other-visualization`,routeMessage:null})},className:z([`w-1/2 flex items-center justify-center whitespace-nowrap py-[5px] px-1 gap-x-1`,t.route===`other-visualization`?`text-white bg-[#7521c8] rounded-sm`:`text-[#6E6E77] bg-[#18181B] rounded-sm`]),children:`Overview`}),I(`button`,{onClick:()=>{r({route:`optimize`,routeMessage:null})},className:z([`w-1/2 flex items-center justify-center whitespace-nowrap py-[5px] px-1 gap-x-1`,t.route===`optimize`?`text-white bg-[#7521c8] rounded-sm`:`text-[#6E6E77] bg-[#18181B] rounded-sm`]),children:I(`span`,{children:`Prompts`})})]}),I(fl,{triggerContent:I(`button`,{onClick:()=>{n(e=>{e.audioNotificationsOptions.enabled&&e.audioNotificationsOptions.audioContext.state!==`closed`&&e.audioNotificationsOptions.audioContext.close();let t=e.audioNotificationsOptions.enabled;localStorage.setItem(`react-scan-notifications-audio`,String(!t));let n=new AudioContext;return e.audioNotificationsOptions.enabled||Ho(n),t&&n.close(),{...e,audioNotificationsOptions:t?{audioContext:null,enabled:!1}:{audioContext:n,enabled:!0}}})},className:`ml-auto`,children:I(`div`,{className:z([`flex gap-x-2 justify-center items-center text-[#6E6E77]`]),children:[I(`span`,{children:`Alerts`}),t.audioNotificationsOptions.enabled?I(al,{size:16,className:`text-[#6E6E77]`}):I(ol,{size:16,className:`text-[#6E6E77]`})]})}),children:I(fe,{children:`Play a chime when a slowdown is recorded`})})]})},ml=e=>{let t=``;return e.toSorted((e,t)=>t.totalTime-e.totalTime).slice(0,30).filter(e=>e.totalTime>5).forEach(e=>{let n=``;n+=`Component Name:`,n+=e.name,n+=`
3
3
  `,n+=`Rendered: ${e.count} times
4
4
  `,n+=`Sum of self times for ${e.name} is ${e.totalTime.toFixed(0)}ms
@@ -232,18 +232,18 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
232
232
  `+Ip(l(e),c),s&&s()):d&&o&&o(),p}function _m({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(rp(i))i.spaceBefore&&d.push(``),vm(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if($f(i)){let e=rp(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),vm(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=rp(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=nm(i,c,()=>a=null);l||=d.length>u||o.includes(`
233
233
  `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=Lp(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
234
234
  `;return`${e}\n${i}${p}`}else return`${f}${o}${d.join(` `)}${o}${p}`}function vm({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=Ip(t(r),e);n.push(i.trimStart())}}function ym(e,t){let n=ep(t)?t.value:t;for(let r of e)if($f(r)&&(r.key===t||r.key===n||ep(r.key)&&r.key.value===n))return r}var bm=class extends Pp{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Gf,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(pm(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=$f(e)?e:!e||typeof e!=`object`||!(`key`in e)?new mm(e,e?.value):new mm(e.key,e.value);let r=ym(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);ep(r.value)&&Dp(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=ym(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=ym(this.items,e)?.value;return(!t&&ep(n)?n.value:n)??void 0}has(e){return!!ym(this.items,e)}set(e,t){this.add(new mm(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)dm(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!$f(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),hm(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},xm={collection:`map`,default:!0,nodeClass:bm,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Qf(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>bm.from(e,t,n)},Sm=class extends Pp{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Jf,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Cm(e);return typeof t==`number`?this.items.splice(t,1).length>0:!1}get(e,t){let n=Cm(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&ep(r)?r.value:r}has(e){let t=Cm(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Cm(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];ep(r)&&Dp(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(Cp(e,String(r++),t));return n}toString(e,t,n){return e?hm(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(jp(a,void 0,n))}}return i}};function Cm(e){let t=ep(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var wm={collection:`seq`,default:!0,nodeClass:Sm,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return tp(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Sm.from(e,t,n)},Tm={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),Qp(e,t,n,r)}},Em={identify:e=>e==null,createNode:()=>new Op(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Op(null),stringify:({source:e},t)=>typeof e==`string`&&Em.test.test(e)?e:t.options.nullStr},Dm={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Op(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&Dm.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function Om({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var km={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:Om},Am={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Om(e)}},jm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Op(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:Om},Mm=e=>typeof e==`bigint`||Number.isInteger(e),Nm=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function Pm(e,t,n){let{value:r}=e;return Mm(r)&&r>=0?n+r.toString(t):Om(e)}var Fm={identify:e=>Mm(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>Nm(e,2,8,n),stringify:e=>Pm(e,8,`0o`)},Im={identify:Mm,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Nm(e,0,10,n),stringify:Om},Lm={identify:e=>Mm(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Nm(e,2,16,n),stringify:e=>Pm(e,16,`0x`)},Rm=[xm,wm,Tm,Em,Dm,Fm,Im,Lm,km,Am,jm];function zm(e){return typeof e==`bigint`||Number.isInteger(e)}var Bm=({value:e})=>JSON.stringify(e),Vm=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Bm},{identify:e=>e==null,createNode:()=>new Op(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Bm},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Bm},{identify:zm,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>zm(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Bm}],Hm=[xm,wm].concat(Vm,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),Um={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}else return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=Op.BLOCK_LITERAL,t!==Op.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===Op.BLOCK_LITERAL?`
235
- `:` `)}return Qp({comment:e,type:t,value:s},r,i,a)}};function Wm(e,t){if(tp(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!$f(r)){if(Qf(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new mm(new Op(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=$f(r)?r:new mm(r)}}else t(`Expected a sequence for this tag`);return e}function Gm(e,t,n){let{replacer:r}=n,i=new Sm(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e))if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`);else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(pm(o,s,n))}return i}var Km={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Wm,createNode:Gm},qm=class e extends Sm{constructor(){super(),this.add=bm.prototype.add.bind(this),this.delete=bm.prototype.delete.bind(this),this.get=bm.prototype.get.bind(this),this.has=bm.prototype.has.bind(this),this.set=bm.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if($f(e)?(r=Cp(e.key,``,t),i=Cp(e.value,r,t)):r=Cp(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Gm(e,t,n),i=new this;return i.items=r.items,i}};qm.tag=`tag:yaml.org,2002:omap`;var Jm={collection:`seq`,identify:e=>e instanceof Map,nodeClass:qm,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Wm(e,t),r=[];for(let{key:e}of n.items)ep(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new qm,n)},createNode:(e,t,n)=>qm.from(e,t,n)};function Ym({value:e,source:t},n){return t&&(e?Xm:Zm).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Xm={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Op(!0),stringify:Ym},Zm={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Op(!1),stringify:Ym},Qm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:Om},$m={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Om(e)}},eh={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Op(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:Om},th=e=>typeof e==`bigint`||Number.isInteger(e);function nh(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function rh(e,t,n){let{value:r}=e;if(th(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return Om(e)}var ih={identify:th,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>nh(e,2,2,n),stringify:e=>rh(e,2,`0b`)},ah={identify:th,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>nh(e,1,8,n),stringify:e=>rh(e,8,`0`)},oh={identify:th,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>nh(e,0,10,n),stringify:Om},sh={identify:th,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>nh(e,2,16,n),stringify:e=>rh(e,16,`0x`)},ch=class e extends bm{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=$f(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new mm(e.key,null):new mm(e,null),ym(this.items,t.key)||this.items.push(t)}get(e,t){let n=ym(this.items,e);return!t&&$f(n)?ep(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=ym(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new mm(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(pm(e,null,n));return i}};ch.tag=`tag:yaml.org,2002:set`;var lh={collection:`map`,identify:e=>e instanceof Set,nodeClass:ch,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>ch.from(e,t,n),resolve(e,t){if(Qf(e)){if(e.hasAllNullValues(!0))return Object.assign(new ch,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function uh(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function dh(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return Om(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var fh={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>uh(e,n),stringify:dh},ph={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>uh(e,!1),stringify:dh},mh={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(mh.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=uh(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},hh=[xm,wm,Tm,Em,Xm,Zm,ih,ah,oh,sh,Qm,$m,eh,Um,om,Jm,Km,lh,fh,ph,mh],gh=new Map([[`core`,Rm],[`failsafe`,[xm,wm,Tm]],[`json`,Hm],[`yaml11`,hh],[`yaml-1.1`,hh]]),_h={binary:Um,bool:Dm,float:jm,floatExp:Am,floatNaN:km,floatTime:ph,int:Im,intHex:Lm,intOct:Fm,intTime:fh,map:xm,merge:om,null:Em,omap:Jm,pairs:Km,seq:wm,set:lh,timestamp:mh},vh={"tag:yaml.org,2002:binary":Um,"tag:yaml.org,2002:merge":om,"tag:yaml.org,2002:omap":Jm,"tag:yaml.org,2002:pairs":Km,"tag:yaml.org,2002:set":lh,"tag:yaml.org,2002:timestamp":mh};function yh(e,t,n){let r=gh.get(t);if(r&&!e)return n&&!r.includes(om)?r.concat(om):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{let e=Array.from(gh.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(om)),i.reduce((e,t)=>{let n=typeof t==`string`?_h[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(_h).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var bh=(e,t)=>e.key<t.key?-1:+(e.key>t.key),xh=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?yh(e,`compat`):e?yh(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?vh:{},this.tags=yh(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,Gf,{value:xm}),Object.defineProperty(this,qf,{value:Tm}),Object.defineProperty(this,Jf,{value:wm}),this.sortMapEntries=typeof a==`function`?a:a===!0?bh:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function Sh(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=$p(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(Ip(t,``))}let o=!1,s=null;if(e.contents){if(rp(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(Ip(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=nm(e.contents,i,()=>s=null,t);s&&(c+=Lp(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(nm(e.contents,i));if(e.directives?.docEnd)if(e.comment){let t=a(e.comment);t.includes(`
235
+ `:` `)}return Qp({comment:e,type:t,value:s},r,i,a)}};function Wm(e,t){if(tp(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!$f(r)){if(Qf(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new mm(new Op(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=$f(r)?r:new mm(r)}}else t(`Expected a sequence for this tag`);return e}function Gm(e,t,n){let{replacer:r}=n,i=new Sm(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e))if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`);else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(pm(o,s,n))}return i}var Km={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Wm,createNode:Gm},qm=class e extends Sm{constructor(){super(),this.add=bm.prototype.add.bind(this),this.delete=bm.prototype.delete.bind(this),this.get=bm.prototype.get.bind(this),this.has=bm.prototype.has.bind(this),this.set=bm.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if($f(e)?(r=Cp(e.key,``,t),i=Cp(e.value,r,t)):r=Cp(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Gm(e,t,n),i=new this;return i.items=r.items,i}};qm.tag=`tag:yaml.org,2002:omap`;var Jm={collection:`seq`,identify:e=>e instanceof Map,nodeClass:qm,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Wm(e,t),r=[];for(let{key:e}of n.items)ep(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new qm,n)},createNode:(e,t,n)=>qm.from(e,t,n)};function Ym({value:e,source:t},n){return t&&(e?Xm:Zm).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Xm={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Op(!0),stringify:Ym},Zm={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Op(!1),stringify:Ym},Qm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:Om},$m={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Om(e)}},eh={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Op(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:Om},th=e=>typeof e==`bigint`||Number.isInteger(e);function nh(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function rh(e,t,n){let{value:r}=e;if(th(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return Om(e)}var ih={identify:th,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>nh(e,2,2,n),stringify:e=>rh(e,2,`0b`)},ah={identify:th,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>nh(e,1,8,n),stringify:e=>rh(e,8,`0`)},eee={identify:th,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>nh(e,0,10,n),stringify:Om},oh={identify:th,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>nh(e,2,16,n),stringify:e=>rh(e,16,`0x`)},sh=class e extends bm{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=$f(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new mm(e.key,null):new mm(e,null),ym(this.items,t.key)||this.items.push(t)}get(e,t){let n=ym(this.items,e);return!t&&$f(n)?ep(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=ym(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new mm(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(pm(e,null,n));return i}};sh.tag=`tag:yaml.org,2002:set`;var ch={collection:`map`,identify:e=>e instanceof Set,nodeClass:sh,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>sh.from(e,t,n),resolve(e,t){if(Qf(e)){if(e.hasAllNullValues(!0))return Object.assign(new sh,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function lh(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function uh(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return Om(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var dh={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>lh(e,n),stringify:uh},fh={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>lh(e,!1),stringify:uh},ph={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(ph.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=lh(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},mh=[xm,wm,Tm,Em,Xm,Zm,ih,ah,eee,oh,Qm,$m,eh,Um,om,Jm,Km,ch,dh,fh,ph],hh=new Map([[`core`,Rm],[`failsafe`,[xm,wm,Tm]],[`json`,Hm],[`yaml11`,mh],[`yaml-1.1`,mh]]),gh={binary:Um,bool:Dm,float:jm,floatExp:Am,floatNaN:km,floatTime:fh,int:Im,intHex:Lm,intOct:Fm,intTime:dh,map:xm,merge:om,null:Em,omap:Jm,pairs:Km,seq:wm,set:ch,timestamp:ph},_h={"tag:yaml.org,2002:binary":Um,"tag:yaml.org,2002:merge":om,"tag:yaml.org,2002:omap":Jm,"tag:yaml.org,2002:pairs":Km,"tag:yaml.org,2002:set":ch,"tag:yaml.org,2002:timestamp":ph};function vh(e,t,n){let r=hh.get(t);if(r&&!e)return n&&!r.includes(om)?r.concat(om):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{let e=Array.from(hh.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(om)),i.reduce((e,t)=>{let n=typeof t==`string`?gh[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(gh).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var yh=(e,t)=>e.key<t.key?-1:+(e.key>t.key),bh=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?vh(e,`compat`):e?vh(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?_h:{},this.tags=vh(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,Gf,{value:xm}),Object.defineProperty(this,qf,{value:Tm}),Object.defineProperty(this,Jf,{value:wm}),this.sortMapEntries=typeof a==`function`?a:a===!0?yh:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function xh(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=$p(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(Ip(t,``))}let o=!1,s=null;if(e.contents){if(rp(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(Ip(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=nm(e.contents,i,()=>s=null,t);s&&(c+=Lp(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(nm(e.contents,i));if(e.directives?.docEnd)if(e.comment){let t=a(e.comment);t.includes(`
236
236
  `)?(n.push(`...`),n.push(Ip(t,``))):n.push(`... ${t}`)}else n.push(`...`);else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(Ip(a(t),``)))}return n.join(`
237
237
  `)+`
238
- `}var Ch=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Yf,{value:Wf});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new _p({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Yf]:{value:Wf}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=rp(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){wh(this.contents)&&this.contents.add(e)}addIn(e,t){wh(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=yp(this);e.anchor=!t||n.has(t)?bp(t||`a`,n):t}return new Tp(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=xp(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=jp(e,l,p);return o&&np(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new mm(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return wh(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Np(e)?this.contents==null?!1:(this.contents=null,!0):wh(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return np(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Np(e)?!t&&ep(this.contents)?this.contents.value:this.contents:np(this.contents)?this.contents.getIn(e,t):void 0}has(e){return np(this.contents)?this.contents.has(e):!1}hasIn(e){return Np(e)?this.contents!==void 0:np(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Mp(this.schema,[e],t):wh(this.contents)&&this.contents.set(e,t)}setIn(e,t){Np(e)?this.contents=t:this.contents==null?this.contents=Mp(this.schema,Array.from(e),t):wh(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new _p({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new _p({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new xh(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=Cp(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?Sp(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return Sh(this,e)}};function wh(e){if(np(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var Th=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},Eh=class extends Th{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},Dh=class extends Th{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},Oh=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
239
- `),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function kh(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}function Ah(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
240
- `))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(Ah(t.key)||Ah(t.value))return!0}return!1;default:return!0}}function jh(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&Ah(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function Mh(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||ep(e)&&ep(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var Nh=`All mapping items must start at the same column`;function Ph({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??bm)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=kh(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,Nh)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
241
- `+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||Ah(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,Nh);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&jh(r.indent,u,i),n.atKey=!1,Mh(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=kh(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&jh(r.indent,f,i),s=c.range[2];let l=new mm(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
242
- `+_.comment:g.comment=_.comment);let e=new mm(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function Fh({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??Sm)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=kh(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&jh(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function Ih(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var Lh=`Block collections are not allowed within flow collections`,Rh=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function zh({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?bm:Sm))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=kh(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
243
- `+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&Ah(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];$f(t)&&(t=t.value??t.key),t.comment?t.comment+=`
244
- `+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],Rh(m)&&i(r.range,`BLOCK_IN_FLOW`,Lh)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);Rh(f)&&i(g.range,`BLOCK_IN_FLOW`,Lh),n.atKey=!1;let _=kh(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?Rh(m)&&i(v.range,`BLOCK_IN_FLOW`,Lh):_.comment&&(g.comment?g.comment+=`
245
- `+_.comment:g.comment=_.comment);let y=new mm(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;Mh(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new bm(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=Ih(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
246
- `+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function Bh(e,t,n,r,i,a){let o=n.type===`block-map`?Ph(e,t,n,r,a):n.type===`block-seq`?Fh(e,t,n,r,a):zh(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function Vh(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===bm.tagName&&s===`map`||o===Sm.tagName&&s===`seq`)return Bh(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),Bh(e,t,n,i,o)}let l=Bh(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=rp(u)?u:new Op(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Hh(e,t,n){let r=t.offset,i=Uh(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?Op.BLOCK_FOLDED:Op.BLOCK_LITERAL,o=t.source?Wh(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
238
+ `}var Sh=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Yf,{value:Wf});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new _p({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Yf]:{value:Wf}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=rp(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){Ch(this.contents)&&this.contents.add(e)}addIn(e,t){Ch(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=yp(this);e.anchor=!t||n.has(t)?bp(t||`a`,n):t}return new Tp(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=xp(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=jp(e,l,p);return o&&np(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new mm(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return Ch(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Np(e)?this.contents==null?!1:(this.contents=null,!0):Ch(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return np(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Np(e)?!t&&ep(this.contents)?this.contents.value:this.contents:np(this.contents)?this.contents.getIn(e,t):void 0}has(e){return np(this.contents)?this.contents.has(e):!1}hasIn(e){return Np(e)?this.contents!==void 0:np(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Mp(this.schema,[e],t):Ch(this.contents)&&this.contents.set(e,t)}setIn(e,t){Np(e)?this.contents=t:this.contents==null?this.contents=Mp(this.schema,Array.from(e),t):Ch(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new _p({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new _p({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new bh(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=Cp(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?Sp(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return xh(this,e)}};function Ch(e){if(np(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var wh=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},Th=class extends wh{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},Eh=class extends wh{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},Dh=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
239
+ `),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function Oh(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}function kh(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
240
+ `))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(kh(t.key)||kh(t.value))return!0}return!1;default:return!0}}function Ah(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&kh(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function jh(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||ep(e)&&ep(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var Mh=`All mapping items must start at the same column`;function Nh({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??bm)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=Oh(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,Mh)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
241
+ `+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||kh(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,Mh);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&Ah(r.indent,u,i),n.atKey=!1,jh(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=Oh(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&Ah(r.indent,f,i),s=c.range[2];let l=new mm(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
242
+ `+_.comment:g.comment=_.comment);let e=new mm(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function Ph({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??Sm)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=Oh(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&Ah(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function Fh(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var Ih=`Block collections are not allowed within flow collections`,Lh=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function Rh({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?bm:Sm))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=Oh(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
243
+ `+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&kh(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];$f(t)&&(t=t.value??t.key),t.comment?t.comment+=`
244
+ `+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],Lh(m)&&i(r.range,`BLOCK_IN_FLOW`,Ih)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);Lh(f)&&i(g.range,`BLOCK_IN_FLOW`,Ih),n.atKey=!1;let _=Oh(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?Lh(m)&&i(v.range,`BLOCK_IN_FLOW`,Ih):_.comment&&(g.comment?g.comment+=`
245
+ `+_.comment:g.comment=_.comment);let y=new mm(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;jh(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new bm(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=Fh(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
246
+ `+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function zh(e,t,n,r,i,a){let o=n.type===`block-map`?Nh(e,t,n,r,a):n.type===`block-seq`?Ph(e,t,n,r,a):Rh(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function Bh(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===bm.tagName&&s===`map`||o===Sm.tagName&&s===`seq`)return zh(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),zh(e,t,n,i,o)}let l=zh(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=rp(u)?u:new Op(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Vh(e,t,n){let r=t.offset,i=Hh(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?Op.BLOCK_FOLDED:Op.BLOCK_LITERAL,o=t.source?Uh(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
247
247
  `.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
248
248
  `;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===Op.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
249
249
  `):t.length>c||r[0]===` `?(f===` `?f=`
@@ -258,66 +258,66 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
258
258
  `+o[e][0].slice(c);d[d.length-1]!==`
259
259
  `&&(d+=`
260
260
  `);break;default:d+=`
261
- `}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function Uh({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function Wh(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function Gh(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=Op.PLAIN,c=Kh(a,l);break;case`single-quoted-scalar`:s=Op.QUOTE_SINGLE,c=qh(a,l);break;case`double-quoted-scalar`:s=Op.QUOTE_DOUBLE,c=eee(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=Ih(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Kh(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`;break}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),Jh(e)}function qh(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Jh(e.slice(1,-1)).replace(/''/g,`'`)}function Jh(e){let t,n;try{t=RegExp(`(.*?)(?<![ ])[ ]*\r?
261
+ `}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function Hh({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function Uh(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function Wh(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=Op.PLAIN,c=Gh(a,l);break;case`single-quoted-scalar`:s=Op.QUOTE_SINGLE,c=Kh(a,l);break;case`double-quoted-scalar`:s=Op.QUOTE_DOUBLE,c=tee(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=Fh(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Gh(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`;break}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),qh(e)}function Kh(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),qh(e.slice(1,-1)).replace(/''/g,`'`)}function qh(e){let t,n;try{t=RegExp(`(.*?)(?<![ ])[ ]*\r?
262
262
  `,`sy`),n=RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
263
263
  `,`sy`)}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let i=r[1],a=` `,o=t.lastIndex;for(n.lastIndex=o;r=n.exec(e);)r[1]===``?a===`
264
264
  `?i+=a:a=`
265
- `:(i+=a+r[1],a=` `),o=n.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(e),i+a+(r?.[1]??``)}function eee(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(!(i===`\r`&&e[r+1]===`
265
+ `:(i+=a+r[1],a=` `),o=n.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(e),i+a+(r?.[1]??``)}function tee(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(!(i===`\r`&&e[r+1]===`
266
266
  `))if(i===`
267
- `){let{fold:t,offset:i}=tee(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=nee[i];if(a)n+=a;else if(i===`
267
+ `){let{fold:t,offset:i}=nee(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=ree[i];if(a)n+=a;else if(i===`
268
268
  `)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
269
- `)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=ree(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
269
+ `)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=iee(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
270
270
  `&&!(a===`\r`&&e[r+2]===`
271
- `)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function tee(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
271
+ `)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function nee(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
272
272
  `||r===`\r`)&&!(r===`\r`&&e[t+2]!==`
273
273
  `);)r===`
274
274
  `&&(n+=`
275
- `),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var nee={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
276
- `,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function ree(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function Yh(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Hh(e,t,r):Gh(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[qf]:c?iee(e.schema,i,c,n,r):t.type===`scalar`?aee(e,i,t,r):e.schema[qf];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=ep(a)?a:new Op(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new Op(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function iee(e,t,n,r,i){if(n===`!`)return e[qf];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n)if(t.default&&t.test)a.push(t);else return t;for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[qf])}function aee({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[qf];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[qf];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function oee(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var see={composeNode:Xh,composeEmptyNode:Zh};function Xh(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=Qh(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=Yh(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=Vh(see,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=Zh(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!ep(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Zh(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Yh(e,{type:`scalar`,offset:oee(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Qh({options:e},{offset:t,source:n,end:r},i){let a=new Tp(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=Ih(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function $h(e,t,{offset:n,start:r,value:i,end:a},o){let s=new Ch(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=kh(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?Xh(c,i,l,o):Zh(c,l.end,r,null,l,o);let u=s.contents.range[2],d=Ih(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function eg(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function tg(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
275
+ `),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var ree={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
276
+ `,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function iee(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function Jh(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Vh(e,t,r):Wh(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[qf]:c?aee(e.schema,i,c,n,r):t.type===`scalar`?oee(e,i,t,r):e.schema[qf];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=ep(a)?a:new Op(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new Op(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function aee(e,t,n,r,i){if(n===`!`)return e[qf];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n)if(t.default&&t.test)a.push(t);else return t;for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[qf])}function oee({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[qf];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[qf];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function see(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var cee={composeNode:Yh,composeEmptyNode:Xh};function Yh(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=Zh(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=Jh(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=Bh(cee,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=Xh(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!ep(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Xh(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Jh(e,{type:`scalar`,offset:see(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Zh({options:e},{offset:t,source:n,end:r},i){let a=new Tp(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=Fh(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Qh(e,t,{offset:n,start:r,value:i,end:a},o){let s=new Sh(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=Oh(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?Yh(c,i,l,o):Xh(c,l.end,r,null,l,o);let u=s.contents.range[2],d=Fh(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function $h(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function eg(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
277
277
 
278
278
  `:`
279
- `)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var ng=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=eg(e);r?this.warnings.push(new Dh(i,t,n)):this.errors.push(new Eh(i,t,n))},this.directives=new _p({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=tg(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(np(i)&&!i.flow&&i.items.length>0){let e=i.items[0];$f(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:tg(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=eg(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=$h(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Eh(eg(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new Eh(eg(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=Ih(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Eh(eg(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new Ch(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},rg=Symbol(`break visit`),ig=Symbol(`skip children`),ag=Symbol(`remove item`);function og(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),sg(Object.freeze([]),e,t)}og.BREAK=rg,og.SKIP=ig,og.REMOVE=ag,og.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},og.parentCollection=(e,t)=>{let n=og.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function sg(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=sg(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===rg)return rg;else r===ag&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function cg(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
279
+ `)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var tg=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=$h(e);r?this.warnings.push(new Eh(i,t,n)):this.errors.push(new Th(i,t,n))},this.directives=new _p({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=eg(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(np(i)&&!i.flow&&i.items.length>0){let e=i.items[0];$f(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:eg(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=$h(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Qh(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Th($h(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new Th($h(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=Fh(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Th($h(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new Sh(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},ng=Symbol(`break visit`),rg=Symbol(`skip children`),ig=Symbol(`remove item`);function ag(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),og(Object.freeze([]),e,t)}ag.BREAK=ng,ag.SKIP=rg,ag.REMOVE=ig,ag.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},ag.parentCollection=(e,t)=>{let n=ag.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function og(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=og(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===ng)return ng;else r===ig&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function sg(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
280
280
  `:case`\r
281
- `:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function lg(e){switch(e){case void 0:case` `:case`
282
- `:case`\r`:case` `:return!0;default:return!1}}var ug=new Set(`0123456789ABCDEFabcdef`),dg=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),fg=new Set(`,[]{}`),pg=new Set(` ,[]{}
283
- \r `),mg=e=>!e||pg.has(e),hg=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
281
+ `:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function cg(e){switch(e){case void 0:case` `:case`
282
+ `:case`\r`:case` `:return!0;default:return!1}}var lg=new Set(`0123456789ABCDEFabcdef`),ug=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),dg=new Set(`,[]{}`),fg=new Set(` ,[]{}
283
+ \r `),pg=e=>!e||fg.has(e),mg=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
284
284
  `?!0:t===`\r`?this.buffer[e+1]===`
285
285
  `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
286
286
  `||!t&&!this.atEnd)return e+n+1}return t===`
287
- `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&lg(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
288
- `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}else n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&lg(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!lg(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&lg(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(mg),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&lg(r[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]===`]`||r[0]===`}`)))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(mg),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||lg(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
287
+ `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&cg(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
288
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}else n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&cg(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!cg(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&cg(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(pg),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&cg(r[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]===`]`||r[0]===`}`)))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(pg),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||cg(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
289
289
  `,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
290
- `,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>lg(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
290
+ `,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>cg(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
291
291
  `:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
292
292
  `)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
293
293
  `,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
294
294
  `;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
295
- `&&n>=this.pos&&n+1+t>i)e=n;else break}while(!0);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(lg(r)||e&&fg.has(r))break;t=n}else if(lg(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
295
+ `&&n>=this.pos&&n+1+t>i)e=n;else break}while(!0);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(cg(r)||e&&dg.has(r))break;t=n}else if(cg(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
296
296
  `?(n+=1,r=`
297
- `,i=this.buffer[n+1]):t=n),i===`#`||e&&fg.has(i))break;if(r===`
298
- `){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&fg.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(mg),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(lg(n)||t&&fg.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!lg(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(dg.has(t))t=this.buffer[++e];else if(t===`%`&&ug.has(this.buffer[e+1])&&ug.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
297
+ `,i=this.buffer[n+1]):t=n),i===`#`||e&&dg.has(i))break;if(r===`
298
+ `){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&dg.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(pg),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(cg(n)||t&&dg.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!cg(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(ug.has(t))t=this.buffer[++e];else if(t===`%`&&lg.has(this.buffer[e+1])&&lg.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
299
299
  `?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
300
- `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},gg=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function _g(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function vg(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function yg(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function bg(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function xg(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function Sg(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function Cg(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!_g(t.start,`explicit-key-ind`)&&!_g(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,yg(t.value)?t.value.end?Sg(t.value.end,t.sep):t.value.end=t.sep:Sg(t.start,t.sep),delete t.sep)}var wg=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new hg,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=cg(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&Cg(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&vg(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.indent<t.indent))&&(e.type===`document`?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case`directive-line`:yield{type:`directive`,offset:this.offset,source:this.source};return;case`byte-order-mark`:case`space`:case`comment`:case`newline`:yield this.sourceToken;return;case`doc-mode`:case`doc-start`:{let e={type:`document`,offset:this.offset,start:[]};this.type===`doc-start`&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case`doc-start`:vg(e.start)===-1?e.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case`anchor`:case`tag`:case`space`:case`comment`:case`newline`:e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===`map-value-ind`){let t=xg(bg(this.peek(2))),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case`space`:case`comment`:case`newline`:e.props.push(this.sourceToken);return;case`scalar`:if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf(`
300
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},hg=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function gg(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function _g(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function vg(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function yg(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function bg(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function xg(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function Sg(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!gg(t.start,`explicit-key-ind`)&&!gg(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,vg(t.value)?t.value.end?xg(t.value.end,t.sep):t.value.end=t.sep:xg(t.start,t.sep),delete t.sep)}var Cg=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new mg,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=sg(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&Sg(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&_g(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.indent<t.indent))&&(e.type===`document`?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case`directive-line`:yield{type:`directive`,offset:this.offset,source:this.source};return;case`byte-order-mark`:case`space`:case`comment`:case`newline`:yield this.sourceToken;return;case`doc-mode`:case`doc-start`:{let e={type:`document`,offset:this.offset,start:[]};this.type===`doc-start`&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case`doc-start`:_g(e.start)===-1?e.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case`anchor`:case`tag`:case`space`:case`comment`:case`newline`:e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===`map-value-ind`){let t=bg(yg(this.peek(2))),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case`space`:case`comment`:case`newline`:e.props.push(this.sourceToken);return;case`scalar`:if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf(`
301
301
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
302
- `,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Sg(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey)if(!t.sep)if(_g(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=xg(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(_g(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(yg(t.key)&&!_g(t.sep,`newline`)){let e=xg(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):_g(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!_g(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Sg(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||_g(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=xg(bg(t));Cg(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
302
+ `,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){xg(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey)if(!t.sep)if(gg(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=bg(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(gg(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(vg(t.key)&&!gg(t.sep,`newline`)){let e=bg(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):gg(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!gg(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){xg(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||gg(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=bg(yg(t));Sg(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
303
303
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
304
- `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=xg(bg(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=xg(bg(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function Tg(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new gg||null,prettyErrors:t}}function Eg(e,t={}){let{lineCounter:n,prettyErrors:r}=Tg(t),i=new wg(n?.addNewLine),a=new ng(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new Eh(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(Oh(e,n)),o.warnings.forEach(Oh(e,n))),o}function Dg(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=Eg(e,n);if(!i)return null;if(i.warnings.forEach(e=>im(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}var Og;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(Og||={});var kg;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(kg||={});var H=Og.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),Ag=e=>{switch(typeof e){case`undefined`:return H.undefined;case`string`:return H.string;case`number`:return Number.isNaN(e)?H.nan:H.number;case`boolean`:return H.boolean;case`function`:return H.function;case`bigint`:return H.bigint;case`symbol`:return H.symbol;case`object`:return Array.isArray(e)?H.array:e===null?H.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?H.promise:typeof Map<`u`&&e instanceof Map?H.map:typeof Set<`u`&&e instanceof Set?H.set:typeof Date<`u`&&e instanceof Date?H.date:H.object;default:return H.unknown}},U=Og.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),jg=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Og.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};jg.create=e=>new jg(e);var Mg=(e,t)=>{let n;switch(e.code){case U.invalid_type:n=e.received===H.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case U.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Og.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:n=`Unrecognized key(s) in object: ${Og.joinValues(e.keys,`, `)}`;break;case U.invalid_union:n=`Invalid input`;break;case U.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Og.joinValues(e.options)}`;break;case U.invalid_enum_value:n=`Invalid enum value. Expected ${Og.joinValues(e.options)}, received '${e.received}'`;break;case U.invalid_arguments:n=`Invalid function arguments`;break;case U.invalid_return_type:n=`Invalid function return type`;break;case U.invalid_date:n=`Invalid date`;break;case U.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Og.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case U.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case U.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case U.custom:n=`Invalid input`;break;case U.invalid_intersection_types:n=`Intersection results could not be merged`;break;case U.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case U.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,Og.assertNever(e)}return{message:n}},Ng=Mg;function Pg(){return Ng}var Fg=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function W(e,t){let n=Pg(),r=Fg({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Mg?void 0:Mg].filter(e=>!!e)});e.common.issues.push(r)}var Ig=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return Lg;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return Lg;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},Lg=Object.freeze({status:`aborted`}),Rg=e=>({status:`dirty`,value:e}),zg=e=>({status:`valid`,value:e}),Bg=e=>e.status===`aborted`,Vg=e=>e.status===`dirty`,Hg=e=>e.status===`valid`,Ug=e=>typeof Promise<`u`&&e instanceof Promise,Wg;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(Wg||={});var Gg=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Kg=(e,t)=>{if(Hg(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new jg(e.common.issues);return this._error=t,this._error}}};function qg(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var Jg=class{get description(){return this._def.description}_getType(e){return Ag(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ag(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ig,ctx:{common:e.parent.common,data:e.data,parsedType:Ag(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ug(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ag(e)};return Kg(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ag(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Hg(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Hg(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ag(e)},r=this._parse({data:e,path:n.path,parent:n});return Kg(n,await(Ug(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:U.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new X_({schema:this,typeName:av.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return Z_.create(this,this._def)}nullable(){return Q_.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return M_.create(this)}promise(){return Y_.create(this,this._def)}or(e){return F_.create([this,e],this._def)}and(e){return R_.create(this,e,this._def)}transform(e){return new X_({...qg(this._def),schema:this,typeName:av.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new $_({...qg(this._def),innerType:this,defaultValue:t,typeName:av.ZodDefault})}brand(){return new nv({typeName:av.ZodBranded,type:this,...qg(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new ev({...qg(this._def),innerType:this,catchValue:t,typeName:av.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return rv.create(this,e)}readonly(){return iv.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Yg=/^c[^\s-]{8,}$/i,Xg=/^[0-9a-z]+$/,Zg=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Qg=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,$g=/^[a-z0-9_-]{21}$/i,e_=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,t_=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,n_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,r_=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,i_,a_=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,o_=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,s_=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,c_=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,l_=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,u_=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,d_=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,f_=RegExp(`^${d_}$`);function p_(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function m_(e){return RegExp(`^${p_(e)}$`)}function h_(e){let t=`${d_}T${p_(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function g_(e,t){return!!((t===`v4`||!t)&&a_.test(e)||(t===`v6`||!t)&&s_.test(e))}function __(e,t){if(!e_.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function v_(e,t){return!!((t===`v4`||!t)&&o_.test(e)||(t===`v6`||!t)&&c_.test(e))}var y_=class e extends Jg{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==H.string){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.string,received:t.parsedType}),Lg}let t=new Ig,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?W(n,{code:U.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&W(n,{code:U.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)n_.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`email`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)i_||=new RegExp(r_,`u`),i_.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`emoji`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)Qg.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`uuid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)$g.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`nanoid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)Yg.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`cuid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)Xg.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`cuid2`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)Zg.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`ulid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),W(n,{validation:`url`,code:U.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`regex`,code:U.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?h_(r).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?f_.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?m_(r).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?t_.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`duration`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?g_(e.data,r.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`ip`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?__(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`jwt`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?v_(e.data,r.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`cidr`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?l_.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`base64`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?u_.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`base64url`,code:U.invalid_string,message:r.message}),t.dirty()):Og.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:U.invalid_string,...Wg.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...Wg.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...Wg.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...Wg.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...Wg.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...Wg.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...Wg.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...Wg.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...Wg.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...Wg.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...Wg.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...Wg.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...Wg.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...Wg.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Wg.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...Wg.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...Wg.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...Wg.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...Wg.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...Wg.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...Wg.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...Wg.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...Wg.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...Wg.errToObj(t)})}nonempty(e){return this.min(1,Wg.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};y_.create=e=>new y_({checks:[],typeName:av.ZodString,coerce:e?.coerce??!1,...qg(e)});function b_(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var x_=class e extends Jg{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==H.number){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.number,received:t.parsedType}),Lg}let t,n=new Ig;for(let r of this._def.checks)r.kind===`int`?Og.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),W(t,{code:U.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?b_(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),W(t,{code:U.not_finite,message:r.message}),n.dirty()):Og.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,Wg.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Wg.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Wg.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Wg.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Wg.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:Wg.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:Wg.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:Wg.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:Wg.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:Wg.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Wg.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:Wg.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:Wg.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:Wg.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&Og.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};x_.create=e=>new x_({checks:[],typeName:av.ZodNumber,coerce:e?.coerce||!1,...qg(e)});var S_=class e extends Jg{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==H.bigint)return this._getInvalidInput(e);let t,n=new Ig;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Og.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.bigint,received:t.parsedType}),Lg}gte(e,t){return this.setLimit(`min`,e,!0,Wg.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Wg.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Wg.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Wg.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Wg.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:Wg.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:Wg.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:Wg.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:Wg.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Wg.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};S_.create=e=>new S_({checks:[],typeName:av.ZodBigInt,coerce:e?.coerce??!1,...qg(e)});var C_=class extends Jg{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==H.boolean){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.boolean,received:t.parsedType}),Lg}return zg(e.data)}};C_.create=e=>new C_({typeName:av.ZodBoolean,coerce:e?.coerce||!1,...qg(e)});var w_=class e extends Jg{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==H.date){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.date,received:t.parsedType}),Lg}if(Number.isNaN(e.data.getTime()))return W(this._getOrReturnCtx(e),{code:U.invalid_date}),Lg;let t=new Ig,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):Og.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:Wg.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:Wg.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};w_.create=e=>new w_({checks:[],coerce:e?.coerce||!1,typeName:av.ZodDate,...qg(e)});var T_=class extends Jg{_parse(e){if(this._getType(e)!==H.symbol){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.symbol,received:t.parsedType}),Lg}return zg(e.data)}};T_.create=e=>new T_({typeName:av.ZodSymbol,...qg(e)});var E_=class extends Jg{_parse(e){if(this._getType(e)!==H.undefined){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.undefined,received:t.parsedType}),Lg}return zg(e.data)}};E_.create=e=>new E_({typeName:av.ZodUndefined,...qg(e)});var D_=class extends Jg{_parse(e){if(this._getType(e)!==H.null){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.null,received:t.parsedType}),Lg}return zg(e.data)}};D_.create=e=>new D_({typeName:av.ZodNull,...qg(e)});var O_=class extends Jg{constructor(){super(...arguments),this._any=!0}_parse(e){return zg(e.data)}};O_.create=e=>new O_({typeName:av.ZodAny,...qg(e)});var k_=class extends Jg{constructor(){super(...arguments),this._unknown=!0}_parse(e){return zg(e.data)}};k_.create=e=>new k_({typeName:av.ZodUnknown,...qg(e)});var A_=class extends Jg{_parse(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.never,received:t.parsedType}),Lg}};A_.create=e=>new A_({typeName:av.ZodNever,...qg(e)});var j_=class extends Jg{_parse(e){if(this._getType(e)!==H.undefined){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.void,received:t.parsedType}),Lg}return zg(e.data)}};j_.create=e=>new j_({typeName:av.ZodVoid,...qg(e)});var M_=class e extends Jg{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==H.array)return W(t,{code:U.invalid_type,expected:H.array,received:t.parsedType}),Lg;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(W(t,{code:e?U.too_big:U.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(W(t,{code:U.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(W(t,{code:U.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new Gg(t,e,t.path,n)))).then(e=>Ig.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new Gg(t,e,t.path,n)));return Ig.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:Wg.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:Wg.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:Wg.toString(n)}})}nonempty(e){return this.min(1,e)}};M_.create=(e,t)=>new M_({type:e,minLength:null,maxLength:null,exactLength:null,typeName:av.ZodArray,...qg(t)});function N_(e){if(e instanceof P_){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Z_.create(N_(r))}return new P_({...e._def,shape:()=>t})}else if(e instanceof M_)return new M_({...e._def,type:N_(e.element)});else if(e instanceof Z_)return Z_.create(N_(e.unwrap()));else if(e instanceof Q_)return Q_.create(N_(e.unwrap()));else if(e instanceof z_)return z_.create(e.items.map(e=>N_(e)));else return e}var P_=class e extends Jg{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Og.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==H.object){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.object,received:t.parsedType}),Lg}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof A_&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new Gg(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof A_){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(W(n,{code:U.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new Gg(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Ig.mergeObjectSync(t,e)):Ig.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return Wg.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:Wg.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:av.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of Og.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of Og.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return N_(this)}partial(t){let n={};for(let e of Og.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of Og.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Z_;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return K_(Og.objectKeys(this.shape))}};P_.create=(e,t)=>new P_({shape:()=>e,unknownKeys:`strip`,catchall:A_.create(),typeName:av.ZodObject,...qg(t)}),P_.strictCreate=(e,t)=>new P_({shape:()=>e,unknownKeys:`strict`,catchall:A_.create(),typeName:av.ZodObject,...qg(t)}),P_.lazycreate=(e,t)=>new P_({shape:e,unknownKeys:`strip`,catchall:A_.create(),typeName:av.ZodObject,...qg(t)});var F_=class extends Jg{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new jg(e.ctx.common.issues));return W(t,{code:U.invalid_union,unionErrors:n}),Lg}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new jg(e));return W(t,{code:U.invalid_union,unionErrors:i}),Lg}}get options(){return this._def.options}};F_.create=(e,t)=>new F_({options:e,typeName:av.ZodUnion,...qg(t)});var I_=e=>e instanceof W_?I_(e.schema):e instanceof X_?I_(e.innerType()):e instanceof G_?[e.value]:e instanceof q_?e.options:e instanceof J_?Og.objectValues(e.enum):e instanceof $_?I_(e._def.innerType):e instanceof E_?[void 0]:e instanceof D_?[null]:e instanceof Z_?[void 0,...I_(e.unwrap())]:e instanceof Q_?[null,...I_(e.unwrap())]:e instanceof nv||e instanceof iv?I_(e.unwrap()):e instanceof ev?I_(e._def.innerType):[],cee=class e extends Jg{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==H.object)return W(t,{code:U.invalid_type,expected:H.object,received:t.parsedType}),Lg;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(W(t,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Lg)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=I_(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:av.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...qg(r)})}};function L_(e,t){let n=Ag(e),r=Ag(t);if(e===t)return{valid:!0,data:e};if(n===H.object&&r===H.object){let n=Og.objectKeys(t),r=Og.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=L_(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===H.array&&r===H.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=L_(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===H.date&&r===H.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var R_=class extends Jg{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Bg(e)||Bg(r))return Lg;let i=L_(e.value,r.value);return i.valid?((Vg(e)||Vg(r))&&t.dirty(),{status:t.value,value:i.data}):(W(n,{code:U.invalid_intersection_types}),Lg)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};R_.create=(e,t,n)=>new R_({left:e,right:t,typeName:av.ZodIntersection,...qg(n)});var z_=class e extends Jg{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.array)return W(n,{code:U.invalid_type,expected:H.array,received:n.parsedType}),Lg;if(n.data.length<this._def.items.length)return W(n,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),Lg;!this._def.rest&&n.data.length>this._def.items.length&&(W(n,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new Gg(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Ig.mergeArray(t,e)):Ig.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};z_.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new z_({items:e,typeName:av.ZodTuple,rest:null,...qg(t)})};var B_=class e extends Jg{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.object)return W(n,{code:U.invalid_type,expected:H.object,received:n.parsedType}),Lg;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new Gg(n,e,n.path,e)),value:a._parse(new Gg(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Ig.mergeObjectAsync(t,r):Ig.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Jg?new e({keyType:t,valueType:n,typeName:av.ZodRecord,...qg(r)}):new e({keyType:y_.create(),valueType:t,typeName:av.ZodRecord,...qg(n)})}},V_=class extends Jg{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.map)return W(n,{code:U.invalid_type,expected:H.map,received:n.parsedType}),Lg;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new Gg(n,e,n.path,[a,`key`])),value:i._parse(new Gg(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return Lg;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return Lg;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};V_.create=(e,t,n)=>new V_({valueType:t,keyType:e,typeName:av.ZodMap,...qg(n)});var H_=class e extends Jg{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.set)return W(n,{code:U.invalid_type,expected:H.set,received:n.parsedType}),Lg;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(W(n,{code:U.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(W(n,{code:U.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return Lg;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new Gg(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:Wg.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:Wg.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};H_.create=(e,t)=>new H_({valueType:e,minSize:null,maxSize:null,typeName:av.ZodSet,...qg(t)});var U_=class e extends Jg{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==H.function)return W(t,{code:U.invalid_type,expected:H.function,received:t.parsedType}),Lg;function n(e,n){return Fg({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Pg(),Mg].filter(e=>!!e),issueData:{code:U.invalid_arguments,argumentsError:n}})}function r(e,n){return Fg({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Pg(),Mg].filter(e=>!!e),issueData:{code:U.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Y_){let e=this;return zg(async function(...t){let o=new jg([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return zg(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new jg([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new jg([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:z_.create(t).rest(k_.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||z_.create([]).rest(k_.create()),returns:n||k_.create(),typeName:av.ZodFunction,...qg(r)})}},W_=class extends Jg{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};W_.create=(e,t)=>new W_({getter:e,typeName:av.ZodLazy,...qg(t)});var G_=class extends Jg{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return W(t,{received:t.data,code:U.invalid_literal,expected:this._def.value}),Lg}return{status:`valid`,value:e.data}}get value(){return this._def.value}};G_.create=(e,t)=>new G_({value:e,typeName:av.ZodLiteral,...qg(t)});function K_(e,t){return new q_({values:e,typeName:av.ZodEnum,...qg(t)})}var q_=class e extends Jg{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return W(t,{expected:Og.joinValues(n),received:t.parsedType,code:U.invalid_type}),Lg}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return W(t,{received:t.data,code:U.invalid_enum_value,options:n}),Lg}return zg(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};q_.create=K_;var J_=class extends Jg{_parse(e){let t=Og.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==H.string&&n.parsedType!==H.number){let e=Og.objectValues(t);return W(n,{expected:Og.joinValues(e),received:n.parsedType,code:U.invalid_type}),Lg}if(this._cache||=new Set(Og.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=Og.objectValues(t);return W(n,{received:n.data,code:U.invalid_enum_value,options:e}),Lg}return zg(e.data)}get enum(){return this._def.values}};J_.create=(e,t)=>new J_({values:e,typeName:av.ZodNativeEnum,...qg(t)});var Y_=class extends Jg{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==H.promise&&t.common.async===!1?(W(t,{code:U.invalid_type,expected:H.promise,received:t.parsedType}),Lg):zg((t.parsedType===H.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Y_.create=(e,t)=>new Y_({type:e,typeName:av.ZodPromise,...qg(t)});var X_=class extends Jg{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===av.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{W(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return Lg;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?Lg:r.status===`dirty`||t.value===`dirty`?Rg(r.value):r});{if(t.value===`aborted`)return Lg;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?Lg:r.status===`dirty`||t.value===`dirty`?Rg(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?Lg:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?Lg:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Hg(e))return Lg;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Hg(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):Lg);Og.assertNever(r)}};X_.create=(e,t,n)=>new X_({schema:e,typeName:av.ZodEffects,effect:t,...qg(n)}),X_.createWithPreprocess=(e,t,n)=>new X_({schema:t,effect:{type:`preprocess`,transform:e},typeName:av.ZodEffects,...qg(n)});var Z_=class extends Jg{_parse(e){return this._getType(e)===H.undefined?zg(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Z_.create=(e,t)=>new Z_({innerType:e,typeName:av.ZodOptional,...qg(t)});var Q_=class extends Jg{_parse(e){return this._getType(e)===H.null?zg(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Q_.create=(e,t)=>new Q_({innerType:e,typeName:av.ZodNullable,...qg(t)});var $_=class extends Jg{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===H.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};$_.create=(e,t)=>new $_({innerType:e,typeName:av.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...qg(t)});var ev=class extends Jg{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ug(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new jg(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new jg(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ev.create=(e,t)=>new ev({innerType:e,typeName:av.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...qg(t)});var tv=class extends Jg{_parse(e){if(this._getType(e)!==H.nan){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.nan,received:t.parsedType}),Lg}return{status:`valid`,value:e.data}}};tv.create=e=>new tv({typeName:av.ZodNaN,...qg(e)});var nv=class extends Jg{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},rv=class e extends Jg{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Lg:e.status===`dirty`?(t.dirty(),Rg(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Lg:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:av.ZodPipeline})}},iv=class extends Jg{_parse(e){let t=this._def.innerType._parse(e),n=e=>(Hg(e)&&(e.value=Object.freeze(e.value)),e);return Ug(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};iv.create=(e,t)=>new iv({innerType:e,typeName:av.ZodReadonly,...qg(t)}),P_.lazycreate;var av;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(av||={});var G=y_.create,ov=x_.create;tv.create,S_.create;var K=C_.create;w_.create,T_.create,E_.create,D_.create,O_.create,k_.create,A_.create,j_.create;var q=M_.create,J=P_.create;P_.strictCreate;var sv=F_.create,cv=cee.create;R_.create,z_.create;var lv=B_.create;V_.create,H_.create,U_.create,W_.create;var uv=G_.create,Y=q_.create;J_.create,Y_.create,X_.create,Z_.create,Q_.create,X_.createWithPreprocess,rv.create;var dv=G().min(1).max(200).regex(/^[a-z0-9][a-z0-9-]*$/),fv=64*1024,pv=24*1024,mv=new TextEncoder,hv=0x38d7ea4c68000,gv=/[\p{Cf}\p{Cs}\p{Zl}\p{Zp}\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]/u;function _v(e){return mv.encode(typeof e==`string`?e:JSON.stringify(e)).byteLength}function vv(e,t,n=!1){return G().min(1).max(e).refine(e=>!gv.test(e),`contains unsafe control or bidirectional text`).refine(e=>n||!e.includes(`
305
- `)&&!e.includes(`\r`),`must be a single line`).refine(e=>_v(e)<=t,`must be at most ${t} UTF-8 bytes`)}function yv(e,t,n=!1){return G().max(e).refine(e=>!gv.test(e),`contains unsafe control or bidirectional text`).refine(e=>n||!e.includes(`
306
- `)&&!e.includes(`\r`),`must be a single line`).refine(e=>_v(e)<=t,`must be at most ${t} UTF-8 bytes`)}var bv=vv(256,512),xv=dv,Sv=ov().int().nonnegative().max(2**53-1),Cv=G().datetime({offset:!0}).transform(e=>new Date(e).toISOString()),wv=vv(160,512),Tv=vv(4e3,8e3,!0),Ev=vv(16e3,24e3,!0).refine(e=>e.split(/\r?\n/u).length<=256,`must be at most 256 lines`),Dv=G().min(1).max(128).regex(/^[A-Za-z_][A-Za-z0-9_.:-]*$/).refine(e=>![`__proto__`,`constructor`,`prototype`].includes(e),`reserved field id`),Ov=G().min(1).max(80).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/),kv=J({kind:Y([`claude`,`codex`,`frizz`]),name:wv.optional(),version:bv.optional()}).strict(),Av=J({kind:Y([`runtime`,`agent`,`tool`,`mcp-server`,`frizz`]),id:bv,label:wv.optional()}).strict(),jv=J({projectId:bv,threadSlug:xv,sessionId:bv,turnId:bv,itemId:bv,sessionEpoch:Sv,capabilityRevision:Sv}).strict(),Mv=J({id:Ov,semantic:Y([`approve`,`deny`,`cancel`,`accept`,`decline`,`answer`]),label:wv,description:Tv.optional()}).strict(),Nv=ov().finite().min(-0x38d7ea4c68000).max(hv),Pv=sv([yv(4e3,8e3,!0),Nv,K()]),Fv=sv([Pv,q(yv(1e3,2e3,!0)).max(32)]),Iv={id:Dv,label:wv,description:Tv.optional(),required:K(),secret:K().default(!1)},Lv=J({value:Pv,label:wv}).strict(),Rv=J({value:yv(1e3,2e3,!0),label:wv}).strict(),zv=cv(`input`,[J({...Iv,input:Y([`text`,`multiline`]),minLength:ov().int().nonnegative().max(4e3).optional(),maxLength:ov().int().nonnegative().max(4e3).optional(),format:Y([`email`,`uri`,`date`,`date-time`]).optional(),default:yv(4e3,8e3,!0).optional()}).strict(),J({...Iv,input:Y([`number`,`integer`]),minimum:Nv.optional(),maximum:Nv.optional(),default:Nv.optional()}).strict(),J({...Iv,input:uv(`boolean`),default:K().optional()}).strict(),J({...Iv,input:uv(`select`),options:q(Lv).min(1).max(64),default:Pv.optional()}).strict(),J({...Iv,input:uv(`multi-select`),options:q(Rv).min(1).max(64),minItems:ov().int().nonnegative().max(32).optional(),maxItems:ov().int().nonnegative().max(32).optional(),default:q(yv(1e3,2e3,!0)).max(32).optional()}).strict()]);function Bv(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T00:00:00Z`);return Number.isFinite(t.getTime())&&t.toISOString().slice(0,10)===e}function Vv(e,t){if(e.input===`text`||e.input===`multiline`){if(typeof t!=`string`)return`must be text`;if(e.input===`text`&&(t.includes(`
307
- `)||t.includes(`\r`)))return`must be a single line`;if(e.minLength!==void 0&&t.length<e.minLength)return`is shorter than minLength`;if(e.maxLength!==void 0&&t.length>e.maxLength)return`is longer than maxLength`;if(e.format===`email`&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return`must be an email address`;if(e.format===`uri`)try{new URL(t)}catch{return`must be a URL`}return e.format===`date`&&!Bv(t)?`must be a date`:e.format===`date-time`&&!Cv.safeParse(t).success?`must be a date-time`:void 0}return e.input===`number`||e.input===`integer`?typeof t!=`number`||!Number.isFinite(t)?`must be a number`:e.input===`integer`&&!Number.isInteger(t)?`must be an integer`:e.minimum!==void 0&&t<e.minimum?`is below minimum`:e.maximum!==void 0&&t>e.maximum?`is above maximum`:void 0:e.input===`boolean`?typeof t==`boolean`?void 0:`must be a boolean`:e.input===`select`?Array.isArray(t)?`must be one option`:e.options.some(e=>JSON.stringify(e.value)===JSON.stringify(t))?void 0:`is not an advertised option`:e.input===`multi-select`?Array.isArray(t)?new Set(t).size===t.length?e.minItems!==void 0&&t.length<e.minItems?`contains fewer than minItems`:e.maxItems!==void 0&&t.length>e.maxItems?`contains more than maxItems`:t.every(t=>e.options.some(e=>e.value===t))?void 0:`contains an unadvertised option`:`contains duplicate options`:`must be a list of options`:`has an unsupported input type`}var Hv=zv.superRefine((e,t)=>{if(e.secret&&e.default!==void 0&&t.addIssue({code:U.custom,message:`secret fields cannot advertise defaults`,path:[`default`]}),(e.input===`text`||e.input===`multiline`)&&e.minLength!==void 0&&e.maxLength!==void 0&&e.minLength>e.maxLength&&t.addIssue({code:U.custom,message:`minLength exceeds maxLength`}),(e.input===`number`||e.input===`integer`)&&e.minimum!==void 0&&e.maximum!==void 0&&e.minimum>e.maximum&&t.addIssue({code:U.custom,message:`minimum exceeds maximum`}),e.input===`select`||e.input===`multi-select`){let n=new Set;for(let[r,i]of e.options.entries()){let e=JSON.stringify(i.value);n.has(e)&&t.addIssue({code:U.custom,message:`duplicate option value`,path:[`options`,r,`value`]}),n.add(e)}e.input===`multi-select`&&e.minItems!==void 0&&e.maxItems!==void 0&&e.minItems>e.maxItems&&t.addIssue({code:U.custom,message:`minItems exceeds maxItems`})}if(e.default!==void 0){let n=Vv(e,e.default);n&&t.addIssue({code:U.custom,message:`invalid default: ${n}`,path:[`default`]})}}),Uv={title:wv,message:Tv.optional()},Wv=J({kind:Y([`read`,`list-files`,`search`,`unknown`]),commandPreview:Ev,resourceLabel:vv(2048,4096).optional(),queryLabel:vv(1024,2048).optional()}).strict(),Gv=vv(2048,4096),Kv=cv(`kind`,[J({kind:uv(`network`),enabled:K().nullable(),hosts:q(Gv).max(24)}).strict(),J({kind:uv(`filesystem`),access:Y([`read`,`write`,`deny`]),resources:q(Gv).min(1).max(32)}).strict(),J({kind:uv(`glob-scan`),depth:ov().int().nonnegative().max(256)}).strict(),J({kind:uv(`exec-policy`),prefixes:q(Gv).min(1).max(32)}).strict(),J({kind:uv(`network-policy`),access:Y([`allow`,`deny`]),hosts:q(Gv).min(1).max(24)}).strict()]),qv=J({operation:Y([`create`,`write`,`move`,`delete`]),pathLabel:vv(2048,4096),destinationLabel:vv(2048,4096).optional(),diffPreview:Ev.optional()}).strict(),Jv=cv(`kind`,[J({...Uv,kind:uv(`command-approval`),command:J({summary:wv,preview:Ev,redacted:uv(!0),workingDirectoryLabel:vv(1024,2048).optional(),actions:q(Wv).max(16).optional()}).strict(),capabilities:q(Kv).max(32).optional()}).strict(),J({...Uv,kind:uv(`file-approval`),operation:Y([`read`,`create`,`write`,`move`,`delete`,`execute`,`other`]),pathLabel:vv(1024,2048),destinationLabel:vv(1024,2048).optional(),grantRootLabel:vv(2048,4096).optional(),scopeLabel:Tv.optional(),diffPreview:Ev.optional(),changes:q(qv).min(1).max(16).optional()}).strict(),J({...Uv,kind:uv(`permission-approval`),permission:bv,preview:Ev.optional(),promptLabel:vv(256,512).optional(),resourceLabel:vv(1024,2048).optional(),workingDirectoryLabel:vv(1024,2048).optional(),scopeLabel:Tv.optional(),capabilities:q(Kv).min(1).max(32).optional()}).strict(),J({kind:uv(`mcp-elicitation-form`),title:wv,message:Tv,protocolVersion:bv,fields:q(Hv).max(32)}).strict(),J({kind:uv(`mcp-elicitation-url`),title:wv,message:Tv,protocolVersion:bv,elicitationId:bv,url:G().min(1).max(2048).url().superRefine((e,t)=>{let n;try{n=new URL(e)}catch{return}let r=n.protocol===`http:`&&[`localhost`,`127.0.0.1`,`::1`,`[::1]`].includes(n.hostname);n.protocol!==`https:`&&!r&&t.addIssue({code:U.custom,message:`URL elicitation requires HTTPS (except localhost development)`}),(n.username||n.password)&&t.addIssue({code:U.custom,message:`URL elicitation must not contain userinfo credentials`})})}).strict(),J({kind:uv(`agent-question`),title:wv,message:Tv.optional(),fields:q(Hv).min(1).max(32)}).strict()]),Yv=J({protocolVersion:uv(1),contentFormat:uv(`plain-text`),provider:kv,source:Av,owner:jv,providerRequestId:bv,allowedDecisions:q(Mv).min(1).max(8),payload:Jv,expiresAt:Cv.nullable()}).strict(),Xv={"command-approval":new Set([`approve`,`deny`,`cancel`]),"file-approval":new Set([`approve`,`deny`,`cancel`]),"permission-approval":new Set([`approve`,`deny`,`cancel`]),"mcp-elicitation-form":new Set([`accept`,`decline`,`cancel`]),"mcp-elicitation-url":new Set([`accept`,`decline`,`cancel`]),"agent-question":new Set([`answer`,`decline`,`cancel`])};function Zv(e,t){let n=Xv[e.payload.kind],r=new Set;for(let[i,a]of e.allowedDecisions.entries())r.has(a.id)&&t.addIssue({code:U.custom,message:`duplicate decision id`,path:[`allowedDecisions`,i,`id`]}),r.add(a.id),n.has(a.semantic)||t.addIssue({code:U.custom,message:`decision is invalid for ${e.payload.kind}`,path:[`allowedDecisions`,i,`semantic`]});let i=e.payload.kind===`mcp-elicitation-form`||e.payload.kind===`agent-question`?e.payload.fields:[],a=new Set;for(let[n,r]of i.entries())a.has(r.id)&&t.addIssue({code:U.custom,message:`duplicate field id`,path:[`payload`,`fields`,n,`id`]}),a.add(r.id),e.payload.kind===`mcp-elicitation-form`&&r.secret&&t.addIssue({code:U.custom,message:`MCP form elicitation cannot request secret fields; use URL mode`,path:[`payload`,`fields`,n,`secret`]});_v({protocolVersion:e.protocolVersion,contentFormat:e.contentFormat,provider:e.provider,source:e.source,owner:e.owner,providerRequestId:e.providerRequestId,allowedDecisions:e.allowedDecisions,payload:e.payload,expiresAt:e.expiresAt})>65536&&t.addIssue({code:U.custom,message:`interaction request exceeds ${fv} bytes`})}Yv.superRefine(Zv);var Qv=Y([`pending`,`resolved`,`cancelled`,`expired`]),lee=J({effect:Y([`awaiting-user`,`sending`,`reconnect-required`])}).strict(),uee=Y([`user-cancelled`,`provider-cancelled`,`turn-ended`,`session-replaced`,`session-deleted`,`capabilities-changed`,`expired`]),$v=lv(Dv,Fv).superRefine((e,t)=>{Object.keys(e).length>32&&t.addIssue({code:U.custom,message:`too many response fields`}),_v(e)>24576&&t.addIssue({code:U.custom,message:`interaction response exceeds ${pv} bytes`})}),dee=J({responseId:bv,decisionId:Ov,values:$v.optional(),redactedFieldIds:q(Dv).max(32),resolvedAt:Cv}).strict(),ey=Yv.extend({id:bv,lifecycle:Qv,delivery:lee.optional(),recordRevision:Sv,createdAt:Cv,updatedAt:Cv,completedAt:Cv.nullable(),resolution:dee.nullable(),cancellationReason:uee.nullable()}).strict().superRefine((e,t)=>{if(Zv(e,t),e.delivery&&e.lifecycle!==`pending`&&t.addIssue({code:U.custom,message:`terminal interaction cannot advertise a delivery effect`}),e.lifecycle===`pending`?((e.completedAt||e.resolution||e.cancellationReason)&&t.addIssue({code:U.custom,message:`pending interaction has terminal data`}),(e.recordRevision!==0||e.updatedAt!==e.createdAt)&&t.addIssue({code:U.custom,message:`pending interaction has invalid revision or timestamps`})):e.completedAt?(e.recordRevision<1||e.updatedAt!==e.completedAt||e.updatedAt<e.createdAt)&&t.addIssue({code:U.custom,message:`terminal interaction has invalid revision or timestamps`}):t.addIssue({code:U.custom,message:`terminal interaction is missing completedAt`}),e.lifecycle===`resolved`?(!e.resolution||e.cancellationReason)&&t.addIssue({code:U.custom,message:`resolved interaction has invalid terminal data`}):e.resolution&&t.addIssue({code:U.custom,message:`non-resolved interaction contains a resolution`}),e.lifecycle===`cancelled`&&(!e.cancellationReason||e.cancellationReason===`expired`)&&t.addIssue({code:U.custom,message:`cancelled interaction has invalid reason`}),e.lifecycle===`expired`&&e.cancellationReason!==`expired`&&t.addIssue({code:U.custom,message:`expired interaction has invalid reason`}),e.resolution){e.resolution.resolvedAt!==e.completedAt&&t.addIssue({code:U.custom,message:`resolution timestamp does not match its terminal record`});let n=e.allowedDecisions.find(t=>t.id===e.resolution.decisionId);n||t.addIssue({code:U.custom,message:`resolution names an unadvertised decision`,path:[`resolution`,`decisionId`]});let r=e.payload.kind===`mcp-elicitation-form`||e.payload.kind===`agent-question`?e.payload.fields:[],i=new Map(r.map(e=>[e.id,e])),a=new Set(e.resolution.redactedFieldIds);a.size!==e.resolution.redactedFieldIds.length&&t.addIssue({code:U.custom,message:`resolution contains duplicate redaction markers`,path:[`resolution`,`redactedFieldIds`]});for(let n of e.resolution.redactedFieldIds)i.get(n)?.secret||t.addIssue({code:U.custom,message:`redaction marker does not name a secret field`,path:[`resolution`,`redactedFieldIds`]});for(let[n,r]of Object.entries(e.resolution.values??{})){let e=i.get(n);e?e.secret?t.addIssue({code:U.custom,message:`secret value persisted in resolution`,path:[`resolution`,`values`,n]}):Vv(e,r)&&t.addIssue({code:U.custom,message:`persisted response failed advertised validation`,path:[`resolution`,`values`,n]}):t.addIssue({code:U.custom,message:`resolution contains an unadvertised field`,path:[`resolution`,`values`,n]})}if(n)if(!(e.payload.kind===`mcp-elicitation-form`&&n.semantic===`accept`||e.payload.kind===`agent-question`&&n.semantic===`answer`))(e.resolution.values!==void 0||e.resolution.redactedFieldIds.length>0)&&t.addIssue({code:U.custom,message:`resolution decision cannot contain response fields`,path:[`resolution`]});else for(let n of r){let r=n.secret?a.has(n.id):Object.prototype.hasOwnProperty.call(e.resolution.values??{},n.id);n.required&&!r&&t.addIssue({code:U.custom,message:`resolution is missing a required field`,path:[`resolution`,`values`,n.id]})}}}),fee=J({slug:xv,sessionId:bv}).strict();J({interactions:q(ey).max(128)}).strict();var ty=fee.extend({interactionId:bv}).strict();J({interaction:ey}).strict(),ty.extend({sessionEpoch:Sv,capabilityRevision:Sv,expectedRecordRevision:Sv,responseId:bv,decisionId:Ov,values:$v.optional()}).strict(),J({effect:Y([`resolved`,`already-resolved`,`queued`,`already-queued`]),interaction:ey}).strict(),ty.extend({sessionEpoch:Sv,capabilityRevision:Sv,expectedRecordRevision:Sv}).strict(),J({effect:Y([`cancelled`,`already-cancelled`]),interaction:ey}).strict();var ny=/^ {0,3}(`{3,}|~{3,})(.*)$/;function ry(e){let t=[],n=0,r=null;for(let i of e.split(`
308
- `)){let a=n+i.length+1,o=i.replace(/\r$/,``).match(ny);r?o&&o[1][0]===r.char&&o[1].length>=r.len&&o[2].trim()===``&&(t.push([r.from,n]),r=null):o&&!(o[1][0]==="`"&&o[2].includes("`"))&&(r={char:o[1][0],len:o[1].length,from:Math.min(a,e.length)}),n=a}return r&&t.push([r.from,e.length]),t}function iy(e){let t=ry(e);return t.length===0?()=>!1:e=>t.some(([t,n])=>e>=t&&e<n)}function ay(e,t){if(t.upserts.length){let n=new Map;e.threads.forEach((e,t)=>n.set(e.id,t));for(let r of t.upserts){let t=n.get(r.id);t===void 0?e.threads.push(r):e.threads[t]=r}}if(t.removed.length){let n=new Set(t.removed);for(let t=e.threads.length-1;t>=0;t--)n.has(e.threads[t].id)&&e.threads.splice(t,1)}t.meta&&(e.projectDir=t.meta.projectDir,e.projectName=t.meta.projectName,e.projectLabel=t.meta.projectLabel,e.errors=t.meta.errors,e.warnings=t.meta.warnings,e.errorItems=t.meta.errorItems)}function oy(e,t){return e<0?`resync`:t<=e?`ignore`:t===e+1?`apply`:`resync`}function sy(e,t){return t?e===null?`record`:e===t?`noop`:`adopt`:`noop`}var cy=[`png`,`jpg`,`jpeg`,`gif`,`webp`],ly=`pdf.svg.txt.text.log.md.markdown.csv.tsv.json.jsonl.yaml.yml.toml.ini.xml.html.htm.css.scss.sql.sh.bash.zsh.js.mjs.cjs.jsx.ts.tsx.py.rb.go.rs.java.kt.c.h.cpp.cc.hpp.cs.php.swift.lua.r`.split(`.`),uy=[...cy,...ly],dy=625e4*3,fy=new Set(uy);function py(e){let t=/\.([a-zA-Z0-9]+)$/.exec(e.trim());return t?t[1].toLowerCase():``}function my(e){return fy.has(py(e))}var hy=uy.map(e=>`.${e}`).join(`,`),gy=Y([`planning`,`planned`,`active`,`needs-human`,`blocked`,`done`,`dismissed`]),_y=Y([`human`,`threads`,`timer`]),vy=Y([`none`,`spawning`,`running`,`perm-prompt`,`turn-idle`,`exited`]),yy=Y([`claude`,`codex`]);J({slug:G(),displayName:G(),defaultEffort:G(),efforts:q(G())});var by=J({model:G().min(1),label:G().min(1),defaultEffort:G().min(1),efforts:q(G().min(1)).min(1)}),xy=J({id:G(),label:G().optional(),state:G().optional()}),Sy=J({label:G(),startedAt:G(),state:Y([`running`,`stale`,`rested`]),subagentType:G().optional(),id:G().optional(),stoppable:K().optional(),lastActivityAt:G().optional(),activity:G().optional(),activityDetail:G().optional(),summary:G().optional(),toolUses:ov().optional(),tokens:ov().optional(),durationMs:ov().optional(),depth:ov().optional(),parentId:G().optional()});function Cy(e){return(e.depth??1)===1}var wy=J({label:G(),startedAt:G(),state:Y([`running`,`stale`]),id:G().optional(),stoppable:K().optional(),outputUnavailable:K().optional(),command:G().optional(),lastActivityAt:G().optional(),taskId:G().optional()}),Ty=J({label:G(),state:Y([`running`,`stale`])});J({turnInFlight:K().default(!1),unobservable:K().default(!1),subAgents:q(Ty).default([]),subAgentCount:ov().default(0),bgShells:q(Ty).default([]),bgShellCount:ov().default(0)});var Ey=J({label:G(),description:G().optional()}),Dy=J({questions:q(J({question:G(),header:G().optional(),multiSelect:K().optional(),options:q(Ey)}))}),Oy=J({kind:Y([`shell`,`agent`,`timer`,`pr`,`for`]),value:G()}),ky=[`watch`,`pr-watch`,`human`,`ci`,`session`,`shell`,`agent`,`timer`,`pr`,`reason`];RegExp(`^\\s*(${ky.join(`|`)}):\\s*\\S`,`im`);var Ay=/^([a-z][a-z-]*):\s*(\S.*)?$/i,jy=new Set([`shells`,`agents`,`timers`,`prs`,`for`]),My={shells:`shell`,agents:`agent`,timers:`timer`,prs:`pr`};function Ny(e){let t=e.split(`
309
- `).map(e=>e.replace(/\r$/,``)),n=t.findIndex(e=>/^\s*---+\s*$/.test(e)),r=n===-1?t:t.slice(0,n),i=n===-1?[]:t.slice(n+1),a=[],o=[],s=!0;for(let e of r){let t=e.match(Ay),n=t?.[1].toLowerCase();t&&n?s=jy.has(n):e.trim()!==``&&!/^\s/.test(e)&&!/^\s*-\s/.test(e)&&(s=!1),(s?o:a).push(e)}let c=Py(o.join(`
304
+ `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=bg(yg(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=bg(yg(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function wg(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new hg||null,prettyErrors:t}}function Tg(e,t={}){let{lineCounter:n,prettyErrors:r}=wg(t),i=new Cg(n?.addNewLine),a=new tg(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new Th(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(Dh(e,n)),o.warnings.forEach(Dh(e,n))),o}function Eg(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=Tg(e,n);if(!i)return null;if(i.warnings.forEach(e=>im(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}var Dg;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(Dg||={});var Og;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Og||={});var H=Dg.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),kg=e=>{switch(typeof e){case`undefined`:return H.undefined;case`string`:return H.string;case`number`:return Number.isNaN(e)?H.nan:H.number;case`boolean`:return H.boolean;case`function`:return H.function;case`bigint`:return H.bigint;case`symbol`:return H.symbol;case`object`:return Array.isArray(e)?H.array:e===null?H.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?H.promise:typeof Map<`u`&&e instanceof Map?H.map:typeof Set<`u`&&e instanceof Set?H.set:typeof Date<`u`&&e instanceof Date?H.date:H.object;default:return H.unknown}},U=Dg.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),Ag=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Dg.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Ag.create=e=>new Ag(e);var jg=(e,t)=>{let n;switch(e.code){case U.invalid_type:n=e.received===H.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case U.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Dg.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:n=`Unrecognized key(s) in object: ${Dg.joinValues(e.keys,`, `)}`;break;case U.invalid_union:n=`Invalid input`;break;case U.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Dg.joinValues(e.options)}`;break;case U.invalid_enum_value:n=`Invalid enum value. Expected ${Dg.joinValues(e.options)}, received '${e.received}'`;break;case U.invalid_arguments:n=`Invalid function arguments`;break;case U.invalid_return_type:n=`Invalid function return type`;break;case U.invalid_date:n=`Invalid date`;break;case U.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Dg.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case U.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case U.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case U.custom:n=`Invalid input`;break;case U.invalid_intersection_types:n=`Intersection results could not be merged`;break;case U.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case U.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,Dg.assertNever(e)}return{message:n}},Mg=jg;function Ng(){return Mg}var Pg=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function W(e,t){let n=Ng(),r=Pg({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===jg?void 0:jg].filter(e=>!!e)});e.common.issues.push(r)}var Fg=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return Ig;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return Ig;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},Ig=Object.freeze({status:`aborted`}),Lg=e=>({status:`dirty`,value:e}),Rg=e=>({status:`valid`,value:e}),zg=e=>e.status===`aborted`,Bg=e=>e.status===`dirty`,Vg=e=>e.status===`valid`,Hg=e=>typeof Promise<`u`&&e instanceof Promise,Ug;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(Ug||={});var Wg=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Gg=(e,t)=>{if(Vg(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Ag(e.common.issues);return this._error=t,this._error}}};function Kg(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var qg=class{get description(){return this._def.description}_getType(e){return kg(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:kg(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Fg,ctx:{common:e.parent.common,data:e.data,parsedType:kg(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Hg(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kg(e)};return Gg(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kg(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Vg(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Vg(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kg(e)},r=this._parse({data:e,path:n.path,parent:n});return Gg(n,await(Hg(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:U.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new Y_({schema:this,typeName:iv.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return X_.create(this,this._def)}nullable(){return Z_.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return j_.create(this)}promise(){return J_.create(this,this._def)}or(e){return P_.create([this,e],this._def)}and(e){return L_.create(this,e,this._def)}transform(e){return new Y_({...Kg(this._def),schema:this,typeName:iv.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new Q_({...Kg(this._def),innerType:this,defaultValue:t,typeName:iv.ZodDefault})}brand(){return new tv({typeName:iv.ZodBranded,type:this,...Kg(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new $_({...Kg(this._def),innerType:this,catchValue:t,typeName:iv.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return nv.create(this,e)}readonly(){return rv.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Jg=/^c[^\s-]{8,}$/i,Yg=/^[0-9a-z]+$/,Xg=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Zg=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Qg=/^[a-z0-9_-]{21}$/i,$g=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,e_=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,t_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,n_=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,r_,i_=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,a_=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,o_=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,s_=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,c_=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,l_=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,u_=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,d_=RegExp(`^${u_}$`);function f_(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function p_(e){return RegExp(`^${f_(e)}$`)}function m_(e){let t=`${u_}T${f_(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function h_(e,t){return!!((t===`v4`||!t)&&i_.test(e)||(t===`v6`||!t)&&o_.test(e))}function g_(e,t){if(!$g.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function __(e,t){return!!((t===`v4`||!t)&&a_.test(e)||(t===`v6`||!t)&&s_.test(e))}var v_=class e extends qg{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==H.string){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.string,received:t.parsedType}),Ig}let t=new Fg,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?W(n,{code:U.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&W(n,{code:U.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)t_.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`email`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)r_||=new RegExp(n_,`u`),r_.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`emoji`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)Zg.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`uuid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)Qg.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`nanoid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)Jg.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`cuid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)Yg.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`cuid2`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)Xg.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`ulid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),W(n,{validation:`url`,code:U.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`regex`,code:U.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?m_(r).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?d_.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?p_(r).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?e_.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`duration`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?h_(e.data,r.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`ip`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?g_(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`jwt`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?__(e.data,r.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`cidr`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?c_.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`base64`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?l_.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`base64url`,code:U.invalid_string,message:r.message}),t.dirty()):Dg.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:U.invalid_string,...Ug.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...Ug.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...Ug.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...Ug.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...Ug.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...Ug.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...Ug.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...Ug.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...Ug.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...Ug.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...Ug.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...Ug.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...Ug.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...Ug.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Ug.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...Ug.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...Ug.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...Ug.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...Ug.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...Ug.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...Ug.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...Ug.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...Ug.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...Ug.errToObj(t)})}nonempty(e){return this.min(1,Ug.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};v_.create=e=>new v_({checks:[],typeName:iv.ZodString,coerce:e?.coerce??!1,...Kg(e)});function y_(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var b_=class e extends qg{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==H.number){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.number,received:t.parsedType}),Ig}let t,n=new Fg;for(let r of this._def.checks)r.kind===`int`?Dg.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),W(t,{code:U.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?y_(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),W(t,{code:U.not_finite,message:r.message}),n.dirty()):Dg.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,Ug.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Ug.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Ug.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Ug.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ug.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:Ug.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:Ug.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:Ug.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:Ug.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:Ug.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Ug.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:Ug.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:Ug.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:Ug.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&Dg.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};b_.create=e=>new b_({checks:[],typeName:iv.ZodNumber,coerce:e?.coerce||!1,...Kg(e)});var x_=class e extends qg{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==H.bigint)return this._getInvalidInput(e);let t,n=new Fg;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Dg.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.bigint,received:t.parsedType}),Ig}gte(e,t){return this.setLimit(`min`,e,!0,Ug.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Ug.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Ug.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Ug.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ug.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:Ug.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:Ug.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:Ug.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:Ug.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Ug.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};x_.create=e=>new x_({checks:[],typeName:iv.ZodBigInt,coerce:e?.coerce??!1,...Kg(e)});var S_=class extends qg{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==H.boolean){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.boolean,received:t.parsedType}),Ig}return Rg(e.data)}};S_.create=e=>new S_({typeName:iv.ZodBoolean,coerce:e?.coerce||!1,...Kg(e)});var C_=class e extends qg{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==H.date){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.date,received:t.parsedType}),Ig}if(Number.isNaN(e.data.getTime()))return W(this._getOrReturnCtx(e),{code:U.invalid_date}),Ig;let t=new Fg,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):Dg.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:Ug.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:Ug.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};C_.create=e=>new C_({checks:[],coerce:e?.coerce||!1,typeName:iv.ZodDate,...Kg(e)});var w_=class extends qg{_parse(e){if(this._getType(e)!==H.symbol){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.symbol,received:t.parsedType}),Ig}return Rg(e.data)}};w_.create=e=>new w_({typeName:iv.ZodSymbol,...Kg(e)});var T_=class extends qg{_parse(e){if(this._getType(e)!==H.undefined){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.undefined,received:t.parsedType}),Ig}return Rg(e.data)}};T_.create=e=>new T_({typeName:iv.ZodUndefined,...Kg(e)});var E_=class extends qg{_parse(e){if(this._getType(e)!==H.null){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.null,received:t.parsedType}),Ig}return Rg(e.data)}};E_.create=e=>new E_({typeName:iv.ZodNull,...Kg(e)});var D_=class extends qg{constructor(){super(...arguments),this._any=!0}_parse(e){return Rg(e.data)}};D_.create=e=>new D_({typeName:iv.ZodAny,...Kg(e)});var O_=class extends qg{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Rg(e.data)}};O_.create=e=>new O_({typeName:iv.ZodUnknown,...Kg(e)});var k_=class extends qg{_parse(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.never,received:t.parsedType}),Ig}};k_.create=e=>new k_({typeName:iv.ZodNever,...Kg(e)});var A_=class extends qg{_parse(e){if(this._getType(e)!==H.undefined){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.void,received:t.parsedType}),Ig}return Rg(e.data)}};A_.create=e=>new A_({typeName:iv.ZodVoid,...Kg(e)});var j_=class e extends qg{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==H.array)return W(t,{code:U.invalid_type,expected:H.array,received:t.parsedType}),Ig;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(W(t,{code:e?U.too_big:U.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(W(t,{code:U.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(W(t,{code:U.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new Wg(t,e,t.path,n)))).then(e=>Fg.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new Wg(t,e,t.path,n)));return Fg.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:Ug.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:Ug.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:Ug.toString(n)}})}nonempty(e){return this.min(1,e)}};j_.create=(e,t)=>new j_({type:e,minLength:null,maxLength:null,exactLength:null,typeName:iv.ZodArray,...Kg(t)});function M_(e){if(e instanceof N_){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=X_.create(M_(r))}return new N_({...e._def,shape:()=>t})}else if(e instanceof j_)return new j_({...e._def,type:M_(e.element)});else if(e instanceof X_)return X_.create(M_(e.unwrap()));else if(e instanceof Z_)return Z_.create(M_(e.unwrap()));else if(e instanceof R_)return R_.create(e.items.map(e=>M_(e)));else return e}var N_=class e extends qg{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Dg.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==H.object){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.object,received:t.parsedType}),Ig}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof k_&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new Wg(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof k_){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(W(n,{code:U.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new Wg(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Fg.mergeObjectSync(t,e)):Fg.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return Ug.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:Ug.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:iv.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of Dg.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of Dg.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return M_(this)}partial(t){let n={};for(let e of Dg.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of Dg.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof X_;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return G_(Dg.objectKeys(this.shape))}};N_.create=(e,t)=>new N_({shape:()=>e,unknownKeys:`strip`,catchall:k_.create(),typeName:iv.ZodObject,...Kg(t)}),N_.strictCreate=(e,t)=>new N_({shape:()=>e,unknownKeys:`strict`,catchall:k_.create(),typeName:iv.ZodObject,...Kg(t)}),N_.lazycreate=(e,t)=>new N_({shape:e,unknownKeys:`strip`,catchall:k_.create(),typeName:iv.ZodObject,...Kg(t)});var P_=class extends qg{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Ag(e.ctx.common.issues));return W(t,{code:U.invalid_union,unionErrors:n}),Ig}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Ag(e));return W(t,{code:U.invalid_union,unionErrors:i}),Ig}}get options(){return this._def.options}};P_.create=(e,t)=>new P_({options:e,typeName:iv.ZodUnion,...Kg(t)});var F_=e=>e instanceof U_?F_(e.schema):e instanceof Y_?F_(e.innerType()):e instanceof W_?[e.value]:e instanceof K_?e.options:e instanceof q_?Dg.objectValues(e.enum):e instanceof Q_?F_(e._def.innerType):e instanceof T_?[void 0]:e instanceof E_?[null]:e instanceof X_?[void 0,...F_(e.unwrap())]:e instanceof Z_?[null,...F_(e.unwrap())]:e instanceof tv||e instanceof rv?F_(e.unwrap()):e instanceof $_?F_(e._def.innerType):[],lee=class e extends qg{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==H.object)return W(t,{code:U.invalid_type,expected:H.object,received:t.parsedType}),Ig;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(W(t,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ig)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=F_(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:iv.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Kg(r)})}};function I_(e,t){let n=kg(e),r=kg(t);if(e===t)return{valid:!0,data:e};if(n===H.object&&r===H.object){let n=Dg.objectKeys(t),r=Dg.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=I_(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===H.array&&r===H.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=I_(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===H.date&&r===H.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var L_=class extends qg{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(zg(e)||zg(r))return Ig;let i=I_(e.value,r.value);return i.valid?((Bg(e)||Bg(r))&&t.dirty(),{status:t.value,value:i.data}):(W(n,{code:U.invalid_intersection_types}),Ig)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};L_.create=(e,t,n)=>new L_({left:e,right:t,typeName:iv.ZodIntersection,...Kg(n)});var R_=class e extends qg{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.array)return W(n,{code:U.invalid_type,expected:H.array,received:n.parsedType}),Ig;if(n.data.length<this._def.items.length)return W(n,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),Ig;!this._def.rest&&n.data.length>this._def.items.length&&(W(n,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new Wg(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Fg.mergeArray(t,e)):Fg.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};R_.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new R_({items:e,typeName:iv.ZodTuple,rest:null,...Kg(t)})};var z_=class e extends qg{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.object)return W(n,{code:U.invalid_type,expected:H.object,received:n.parsedType}),Ig;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new Wg(n,e,n.path,e)),value:a._parse(new Wg(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Fg.mergeObjectAsync(t,r):Fg.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof qg?new e({keyType:t,valueType:n,typeName:iv.ZodRecord,...Kg(r)}):new e({keyType:v_.create(),valueType:t,typeName:iv.ZodRecord,...Kg(n)})}},B_=class extends qg{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.map)return W(n,{code:U.invalid_type,expected:H.map,received:n.parsedType}),Ig;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new Wg(n,e,n.path,[a,`key`])),value:i._parse(new Wg(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return Ig;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return Ig;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};B_.create=(e,t,n)=>new B_({valueType:t,keyType:e,typeName:iv.ZodMap,...Kg(n)});var V_=class e extends qg{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.set)return W(n,{code:U.invalid_type,expected:H.set,received:n.parsedType}),Ig;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(W(n,{code:U.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(W(n,{code:U.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return Ig;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new Wg(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:Ug.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:Ug.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};V_.create=(e,t)=>new V_({valueType:e,minSize:null,maxSize:null,typeName:iv.ZodSet,...Kg(t)});var H_=class e extends qg{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==H.function)return W(t,{code:U.invalid_type,expected:H.function,received:t.parsedType}),Ig;function n(e,n){return Pg({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ng(),jg].filter(e=>!!e),issueData:{code:U.invalid_arguments,argumentsError:n}})}function r(e,n){return Pg({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ng(),jg].filter(e=>!!e),issueData:{code:U.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof J_){let e=this;return Rg(async function(...t){let o=new Ag([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return Rg(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Ag([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Ag([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:R_.create(t).rest(O_.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||R_.create([]).rest(O_.create()),returns:n||O_.create(),typeName:iv.ZodFunction,...Kg(r)})}},U_=class extends qg{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};U_.create=(e,t)=>new U_({getter:e,typeName:iv.ZodLazy,...Kg(t)});var W_=class extends qg{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return W(t,{received:t.data,code:U.invalid_literal,expected:this._def.value}),Ig}return{status:`valid`,value:e.data}}get value(){return this._def.value}};W_.create=(e,t)=>new W_({value:e,typeName:iv.ZodLiteral,...Kg(t)});function G_(e,t){return new K_({values:e,typeName:iv.ZodEnum,...Kg(t)})}var K_=class e extends qg{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return W(t,{expected:Dg.joinValues(n),received:t.parsedType,code:U.invalid_type}),Ig}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return W(t,{received:t.data,code:U.invalid_enum_value,options:n}),Ig}return Rg(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};K_.create=G_;var q_=class extends qg{_parse(e){let t=Dg.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==H.string&&n.parsedType!==H.number){let e=Dg.objectValues(t);return W(n,{expected:Dg.joinValues(e),received:n.parsedType,code:U.invalid_type}),Ig}if(this._cache||=new Set(Dg.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=Dg.objectValues(t);return W(n,{received:n.data,code:U.invalid_enum_value,options:e}),Ig}return Rg(e.data)}get enum(){return this._def.values}};q_.create=(e,t)=>new q_({values:e,typeName:iv.ZodNativeEnum,...Kg(t)});var J_=class extends qg{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==H.promise&&t.common.async===!1?(W(t,{code:U.invalid_type,expected:H.promise,received:t.parsedType}),Ig):Rg((t.parsedType===H.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};J_.create=(e,t)=>new J_({type:e,typeName:iv.ZodPromise,...Kg(t)});var Y_=class extends qg{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===iv.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{W(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return Ig;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?Ig:r.status===`dirty`||t.value===`dirty`?Lg(r.value):r});{if(t.value===`aborted`)return Ig;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?Ig:r.status===`dirty`||t.value===`dirty`?Lg(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?Ig:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?Ig:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Vg(e))return Ig;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Vg(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):Ig);Dg.assertNever(r)}};Y_.create=(e,t,n)=>new Y_({schema:e,typeName:iv.ZodEffects,effect:t,...Kg(n)}),Y_.createWithPreprocess=(e,t,n)=>new Y_({schema:t,effect:{type:`preprocess`,transform:e},typeName:iv.ZodEffects,...Kg(n)});var X_=class extends qg{_parse(e){return this._getType(e)===H.undefined?Rg(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};X_.create=(e,t)=>new X_({innerType:e,typeName:iv.ZodOptional,...Kg(t)});var Z_=class extends qg{_parse(e){return this._getType(e)===H.null?Rg(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Z_.create=(e,t)=>new Z_({innerType:e,typeName:iv.ZodNullable,...Kg(t)});var Q_=class extends qg{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===H.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Q_.create=(e,t)=>new Q_({innerType:e,typeName:iv.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...Kg(t)});var $_=class extends qg{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Hg(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Ag(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Ag(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};$_.create=(e,t)=>new $_({innerType:e,typeName:iv.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...Kg(t)});var ev=class extends qg{_parse(e){if(this._getType(e)!==H.nan){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.nan,received:t.parsedType}),Ig}return{status:`valid`,value:e.data}}};ev.create=e=>new ev({typeName:iv.ZodNaN,...Kg(e)});var tv=class extends qg{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},nv=class e extends qg{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Ig:e.status===`dirty`?(t.dirty(),Lg(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Ig:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:iv.ZodPipeline})}},rv=class extends qg{_parse(e){let t=this._def.innerType._parse(e),n=e=>(Vg(e)&&(e.value=Object.freeze(e.value)),e);return Hg(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};rv.create=(e,t)=>new rv({innerType:e,typeName:iv.ZodReadonly,...Kg(t)}),N_.lazycreate;var iv;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(iv||={});var G=v_.create,av=b_.create;ev.create,x_.create;var K=S_.create;C_.create,w_.create,T_.create,E_.create,D_.create,O_.create,k_.create,A_.create;var q=j_.create,J=N_.create;N_.strictCreate;var ov=P_.create,sv=lee.create;L_.create,R_.create;var cv=z_.create;B_.create,V_.create,H_.create,U_.create;var lv=W_.create,Y=K_.create;q_.create,J_.create,Y_.create,X_.create,Z_.create,Y_.createWithPreprocess,nv.create;var uv=G().min(1).max(200).regex(/^[a-z0-9][a-z0-9-]*$/),dv=64*1024,fv=24*1024,pv=new TextEncoder,mv=0x38d7ea4c68000,hv=/[\p{Cf}\p{Cs}\p{Zl}\p{Zp}\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]/u;function gv(e){return pv.encode(typeof e==`string`?e:JSON.stringify(e)).byteLength}function _v(e,t,n=!1){return G().min(1).max(e).refine(e=>!hv.test(e),`contains unsafe control or bidirectional text`).refine(e=>n||!e.includes(`
305
+ `)&&!e.includes(`\r`),`must be a single line`).refine(e=>gv(e)<=t,`must be at most ${t} UTF-8 bytes`)}function vv(e,t,n=!1){return G().max(e).refine(e=>!hv.test(e),`contains unsafe control or bidirectional text`).refine(e=>n||!e.includes(`
306
+ `)&&!e.includes(`\r`),`must be a single line`).refine(e=>gv(e)<=t,`must be at most ${t} UTF-8 bytes`)}var yv=_v(256,512),bv=uv,xv=av().int().nonnegative().max(2**53-1),Sv=G().datetime({offset:!0}).transform(e=>new Date(e).toISOString()),Cv=_v(160,512),wv=_v(4e3,8e3,!0),Tv=_v(16e3,24e3,!0).refine(e=>e.split(/\r?\n/u).length<=256,`must be at most 256 lines`),Ev=G().min(1).max(128).regex(/^[A-Za-z_][A-Za-z0-9_.:-]*$/).refine(e=>![`__proto__`,`constructor`,`prototype`].includes(e),`reserved field id`),Dv=G().min(1).max(80).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/),Ov=J({kind:Y([`claude`,`codex`,`frizz`]),name:Cv.optional(),version:yv.optional()}).strict(),kv=J({kind:Y([`runtime`,`agent`,`tool`,`mcp-server`,`frizz`]),id:yv,label:Cv.optional()}).strict(),Av=J({projectId:yv,threadSlug:bv,sessionId:yv,turnId:yv,itemId:yv,sessionEpoch:xv,capabilityRevision:xv}).strict(),jv=J({id:Dv,semantic:Y([`approve`,`deny`,`cancel`,`accept`,`decline`,`answer`]),label:Cv,description:wv.optional()}).strict(),Mv=av().finite().min(-0x38d7ea4c68000).max(mv),Nv=ov([vv(4e3,8e3,!0),Mv,K()]),Pv=ov([Nv,q(vv(1e3,2e3,!0)).max(32)]),Fv={id:Ev,label:Cv,description:wv.optional(),required:K(),secret:K().default(!1)},Iv=J({value:Nv,label:Cv}).strict(),Lv=J({value:vv(1e3,2e3,!0),label:Cv}).strict(),Rv=sv(`input`,[J({...Fv,input:Y([`text`,`multiline`]),minLength:av().int().nonnegative().max(4e3).optional(),maxLength:av().int().nonnegative().max(4e3).optional(),format:Y([`email`,`uri`,`date`,`date-time`]).optional(),default:vv(4e3,8e3,!0).optional()}).strict(),J({...Fv,input:Y([`number`,`integer`]),minimum:Mv.optional(),maximum:Mv.optional(),default:Mv.optional()}).strict(),J({...Fv,input:lv(`boolean`),default:K().optional()}).strict(),J({...Fv,input:lv(`select`),options:q(Iv).min(1).max(64),default:Nv.optional()}).strict(),J({...Fv,input:lv(`multi-select`),options:q(Lv).min(1).max(64),minItems:av().int().nonnegative().max(32).optional(),maxItems:av().int().nonnegative().max(32).optional(),default:q(vv(1e3,2e3,!0)).max(32).optional()}).strict()]);function zv(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T00:00:00Z`);return Number.isFinite(t.getTime())&&t.toISOString().slice(0,10)===e}function Bv(e,t){if(e.input===`text`||e.input===`multiline`){if(typeof t!=`string`)return`must be text`;if(e.input===`text`&&(t.includes(`
307
+ `)||t.includes(`\r`)))return`must be a single line`;if(e.minLength!==void 0&&t.length<e.minLength)return`is shorter than minLength`;if(e.maxLength!==void 0&&t.length>e.maxLength)return`is longer than maxLength`;if(e.format===`email`&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return`must be an email address`;if(e.format===`uri`)try{new URL(t)}catch{return`must be a URL`}return e.format===`date`&&!zv(t)?`must be a date`:e.format===`date-time`&&!Sv.safeParse(t).success?`must be a date-time`:void 0}return e.input===`number`||e.input===`integer`?typeof t!=`number`||!Number.isFinite(t)?`must be a number`:e.input===`integer`&&!Number.isInteger(t)?`must be an integer`:e.minimum!==void 0&&t<e.minimum?`is below minimum`:e.maximum!==void 0&&t>e.maximum?`is above maximum`:void 0:e.input===`boolean`?typeof t==`boolean`?void 0:`must be a boolean`:e.input===`select`?Array.isArray(t)?`must be one option`:e.options.some(e=>JSON.stringify(e.value)===JSON.stringify(t))?void 0:`is not an advertised option`:e.input===`multi-select`?Array.isArray(t)?new Set(t).size===t.length?e.minItems!==void 0&&t.length<e.minItems?`contains fewer than minItems`:e.maxItems!==void 0&&t.length>e.maxItems?`contains more than maxItems`:t.every(t=>e.options.some(e=>e.value===t))?void 0:`contains an unadvertised option`:`contains duplicate options`:`must be a list of options`:`has an unsupported input type`}var Vv=Rv.superRefine((e,t)=>{if(e.secret&&e.default!==void 0&&t.addIssue({code:U.custom,message:`secret fields cannot advertise defaults`,path:[`default`]}),(e.input===`text`||e.input===`multiline`)&&e.minLength!==void 0&&e.maxLength!==void 0&&e.minLength>e.maxLength&&t.addIssue({code:U.custom,message:`minLength exceeds maxLength`}),(e.input===`number`||e.input===`integer`)&&e.minimum!==void 0&&e.maximum!==void 0&&e.minimum>e.maximum&&t.addIssue({code:U.custom,message:`minimum exceeds maximum`}),e.input===`select`||e.input===`multi-select`){let n=new Set;for(let[r,i]of e.options.entries()){let e=JSON.stringify(i.value);n.has(e)&&t.addIssue({code:U.custom,message:`duplicate option value`,path:[`options`,r,`value`]}),n.add(e)}e.input===`multi-select`&&e.minItems!==void 0&&e.maxItems!==void 0&&e.minItems>e.maxItems&&t.addIssue({code:U.custom,message:`minItems exceeds maxItems`})}if(e.default!==void 0){let n=Bv(e,e.default);n&&t.addIssue({code:U.custom,message:`invalid default: ${n}`,path:[`default`]})}}),Hv={title:Cv,message:wv.optional()},Uv=J({kind:Y([`read`,`list-files`,`search`,`unknown`]),commandPreview:Tv,resourceLabel:_v(2048,4096).optional(),queryLabel:_v(1024,2048).optional()}).strict(),Wv=_v(2048,4096),Gv=sv(`kind`,[J({kind:lv(`network`),enabled:K().nullable(),hosts:q(Wv).max(24)}).strict(),J({kind:lv(`filesystem`),access:Y([`read`,`write`,`deny`]),resources:q(Wv).min(1).max(32)}).strict(),J({kind:lv(`glob-scan`),depth:av().int().nonnegative().max(256)}).strict(),J({kind:lv(`exec-policy`),prefixes:q(Wv).min(1).max(32)}).strict(),J({kind:lv(`network-policy`),access:Y([`allow`,`deny`]),hosts:q(Wv).min(1).max(24)}).strict()]),Kv=J({operation:Y([`create`,`write`,`move`,`delete`]),pathLabel:_v(2048,4096),destinationLabel:_v(2048,4096).optional(),diffPreview:Tv.optional()}).strict(),qv=sv(`kind`,[J({...Hv,kind:lv(`command-approval`),command:J({summary:Cv,preview:Tv,redacted:lv(!0),workingDirectoryLabel:_v(1024,2048).optional(),actions:q(Uv).max(16).optional()}).strict(),capabilities:q(Gv).max(32).optional()}).strict(),J({...Hv,kind:lv(`file-approval`),operation:Y([`read`,`create`,`write`,`move`,`delete`,`execute`,`other`]),pathLabel:_v(1024,2048),destinationLabel:_v(1024,2048).optional(),grantRootLabel:_v(2048,4096).optional(),scopeLabel:wv.optional(),diffPreview:Tv.optional(),changes:q(Kv).min(1).max(16).optional()}).strict(),J({...Hv,kind:lv(`permission-approval`),permission:yv,preview:Tv.optional(),promptLabel:_v(256,512).optional(),resourceLabel:_v(1024,2048).optional(),workingDirectoryLabel:_v(1024,2048).optional(),scopeLabel:wv.optional(),capabilities:q(Gv).min(1).max(32).optional()}).strict(),J({kind:lv(`mcp-elicitation-form`),title:Cv,message:wv,protocolVersion:yv,fields:q(Vv).max(32)}).strict(),J({kind:lv(`mcp-elicitation-url`),title:Cv,message:wv,protocolVersion:yv,elicitationId:yv,url:G().min(1).max(2048).url().superRefine((e,t)=>{let n;try{n=new URL(e)}catch{return}let r=n.protocol===`http:`&&[`localhost`,`127.0.0.1`,`::1`,`[::1]`].includes(n.hostname);n.protocol!==`https:`&&!r&&t.addIssue({code:U.custom,message:`URL elicitation requires HTTPS (except localhost development)`}),(n.username||n.password)&&t.addIssue({code:U.custom,message:`URL elicitation must not contain userinfo credentials`})})}).strict(),J({kind:lv(`agent-question`),title:Cv,message:wv.optional(),fields:q(Vv).min(1).max(32)}).strict()]),Jv=J({protocolVersion:lv(1),contentFormat:lv(`plain-text`),provider:Ov,source:kv,owner:Av,providerRequestId:yv,allowedDecisions:q(jv).min(1).max(8),payload:qv,expiresAt:Sv.nullable()}).strict(),Yv={"command-approval":new Set([`approve`,`deny`,`cancel`]),"file-approval":new Set([`approve`,`deny`,`cancel`]),"permission-approval":new Set([`approve`,`deny`,`cancel`]),"mcp-elicitation-form":new Set([`accept`,`decline`,`cancel`]),"mcp-elicitation-url":new Set([`accept`,`decline`,`cancel`]),"agent-question":new Set([`answer`,`decline`,`cancel`])};function Xv(e,t){let n=Yv[e.payload.kind],r=new Set;for(let[i,a]of e.allowedDecisions.entries())r.has(a.id)&&t.addIssue({code:U.custom,message:`duplicate decision id`,path:[`allowedDecisions`,i,`id`]}),r.add(a.id),n.has(a.semantic)||t.addIssue({code:U.custom,message:`decision is invalid for ${e.payload.kind}`,path:[`allowedDecisions`,i,`semantic`]});let i=e.payload.kind===`mcp-elicitation-form`||e.payload.kind===`agent-question`?e.payload.fields:[],a=new Set;for(let[n,r]of i.entries())a.has(r.id)&&t.addIssue({code:U.custom,message:`duplicate field id`,path:[`payload`,`fields`,n,`id`]}),a.add(r.id),e.payload.kind===`mcp-elicitation-form`&&r.secret&&t.addIssue({code:U.custom,message:`MCP form elicitation cannot request secret fields; use URL mode`,path:[`payload`,`fields`,n,`secret`]});gv({protocolVersion:e.protocolVersion,contentFormat:e.contentFormat,provider:e.provider,source:e.source,owner:e.owner,providerRequestId:e.providerRequestId,allowedDecisions:e.allowedDecisions,payload:e.payload,expiresAt:e.expiresAt})>65536&&t.addIssue({code:U.custom,message:`interaction request exceeds ${dv} bytes`})}Jv.superRefine(Xv);var Zv=Y([`pending`,`resolved`,`cancelled`,`expired`]),uee=J({effect:Y([`awaiting-user`,`sending`,`reconnect-required`])}).strict(),dee=Y([`user-cancelled`,`provider-cancelled`,`turn-ended`,`session-replaced`,`session-deleted`,`capabilities-changed`,`expired`]),Qv=cv(Ev,Pv).superRefine((e,t)=>{Object.keys(e).length>32&&t.addIssue({code:U.custom,message:`too many response fields`}),gv(e)>24576&&t.addIssue({code:U.custom,message:`interaction response exceeds ${fv} bytes`})}),fee=J({responseId:yv,decisionId:Dv,values:Qv.optional(),redactedFieldIds:q(Ev).max(32),resolvedAt:Sv}).strict(),$v=Jv.extend({id:yv,lifecycle:Zv,delivery:uee.optional(),recordRevision:xv,createdAt:Sv,updatedAt:Sv,completedAt:Sv.nullable(),resolution:fee.nullable(),cancellationReason:dee.nullable()}).strict().superRefine((e,t)=>{if(Xv(e,t),e.delivery&&e.lifecycle!==`pending`&&t.addIssue({code:U.custom,message:`terminal interaction cannot advertise a delivery effect`}),e.lifecycle===`pending`?((e.completedAt||e.resolution||e.cancellationReason)&&t.addIssue({code:U.custom,message:`pending interaction has terminal data`}),(e.recordRevision!==0||e.updatedAt!==e.createdAt)&&t.addIssue({code:U.custom,message:`pending interaction has invalid revision or timestamps`})):e.completedAt?(e.recordRevision<1||e.updatedAt!==e.completedAt||e.updatedAt<e.createdAt)&&t.addIssue({code:U.custom,message:`terminal interaction has invalid revision or timestamps`}):t.addIssue({code:U.custom,message:`terminal interaction is missing completedAt`}),e.lifecycle===`resolved`?(!e.resolution||e.cancellationReason)&&t.addIssue({code:U.custom,message:`resolved interaction has invalid terminal data`}):e.resolution&&t.addIssue({code:U.custom,message:`non-resolved interaction contains a resolution`}),e.lifecycle===`cancelled`&&(!e.cancellationReason||e.cancellationReason===`expired`)&&t.addIssue({code:U.custom,message:`cancelled interaction has invalid reason`}),e.lifecycle===`expired`&&e.cancellationReason!==`expired`&&t.addIssue({code:U.custom,message:`expired interaction has invalid reason`}),e.resolution){e.resolution.resolvedAt!==e.completedAt&&t.addIssue({code:U.custom,message:`resolution timestamp does not match its terminal record`});let n=e.allowedDecisions.find(t=>t.id===e.resolution.decisionId);n||t.addIssue({code:U.custom,message:`resolution names an unadvertised decision`,path:[`resolution`,`decisionId`]});let r=e.payload.kind===`mcp-elicitation-form`||e.payload.kind===`agent-question`?e.payload.fields:[],i=new Map(r.map(e=>[e.id,e])),a=new Set(e.resolution.redactedFieldIds);a.size!==e.resolution.redactedFieldIds.length&&t.addIssue({code:U.custom,message:`resolution contains duplicate redaction markers`,path:[`resolution`,`redactedFieldIds`]});for(let n of e.resolution.redactedFieldIds)i.get(n)?.secret||t.addIssue({code:U.custom,message:`redaction marker does not name a secret field`,path:[`resolution`,`redactedFieldIds`]});for(let[n,r]of Object.entries(e.resolution.values??{})){let e=i.get(n);e?e.secret?t.addIssue({code:U.custom,message:`secret value persisted in resolution`,path:[`resolution`,`values`,n]}):Bv(e,r)&&t.addIssue({code:U.custom,message:`persisted response failed advertised validation`,path:[`resolution`,`values`,n]}):t.addIssue({code:U.custom,message:`resolution contains an unadvertised field`,path:[`resolution`,`values`,n]})}if(n)if(!(e.payload.kind===`mcp-elicitation-form`&&n.semantic===`accept`||e.payload.kind===`agent-question`&&n.semantic===`answer`))(e.resolution.values!==void 0||e.resolution.redactedFieldIds.length>0)&&t.addIssue({code:U.custom,message:`resolution decision cannot contain response fields`,path:[`resolution`]});else for(let n of r){let r=n.secret?a.has(n.id):Object.prototype.hasOwnProperty.call(e.resolution.values??{},n.id);n.required&&!r&&t.addIssue({code:U.custom,message:`resolution is missing a required field`,path:[`resolution`,`values`,n.id]})}}}),pee=J({slug:bv,sessionId:yv}).strict();J({interactions:q($v).max(128)}).strict();var ey=pee.extend({interactionId:yv}).strict();J({interaction:$v}).strict(),ey.extend({sessionEpoch:xv,capabilityRevision:xv,expectedRecordRevision:xv,responseId:yv,decisionId:Dv,values:Qv.optional()}).strict(),J({effect:Y([`resolved`,`already-resolved`,`queued`,`already-queued`]),interaction:$v}).strict(),ey.extend({sessionEpoch:xv,capabilityRevision:xv,expectedRecordRevision:xv}).strict(),J({effect:Y([`cancelled`,`already-cancelled`]),interaction:$v}).strict();var ty=/^ {0,3}(`{3,}|~{3,})(.*)$/;function ny(e){let t=[],n=0,r=null;for(let i of e.split(`
308
+ `)){let a=n+i.length+1,o=i.replace(/\r$/,``).match(ty);r?o&&o[1][0]===r.char&&o[1].length>=r.len&&o[2].trim()===``&&(t.push([r.from,n]),r=null):o&&!(o[1][0]==="`"&&o[2].includes("`"))&&(r={char:o[1][0],len:o[1].length,from:Math.min(a,e.length)}),n=a}return r&&t.push([r.from,e.length]),t}function ry(e){let t=ny(e);return t.length===0?()=>!1:e=>t.some(([t,n])=>e>=t&&e<n)}function iy(e,t){if(t.upserts.length){let n=new Map;e.threads.forEach((e,t)=>n.set(e.id,t));for(let r of t.upserts){let t=n.get(r.id);t===void 0?e.threads.push(r):e.threads[t]=r}}if(t.removed.length){let n=new Set(t.removed);for(let t=e.threads.length-1;t>=0;t--)n.has(e.threads[t].id)&&e.threads.splice(t,1)}t.meta&&(e.projectDir=t.meta.projectDir,e.projectName=t.meta.projectName,e.projectLabel=t.meta.projectLabel,e.errors=t.meta.errors,e.warnings=t.meta.warnings,e.errorItems=t.meta.errorItems)}function ay(e,t){return e<0?`resync`:t<=e?`ignore`:t===e+1?`apply`:`resync`}function oy(e,t){return t?e===null?`record`:e===t?`noop`:`adopt`:`noop`}var sy=[`png`,`jpg`,`jpeg`,`gif`,`webp`],cy=`pdf.svg.txt.text.log.md.markdown.csv.tsv.json.jsonl.yaml.yml.toml.ini.xml.html.htm.css.scss.sql.sh.bash.zsh.js.mjs.cjs.jsx.ts.tsx.py.rb.go.rs.java.kt.c.h.cpp.cc.hpp.cs.php.swift.lua.r`.split(`.`),ly=[...sy,...cy],uy=625e4*3,dy=new Set(ly);function fy(e){let t=/\.([a-zA-Z0-9]+)$/.exec(e.trim());return t?t[1].toLowerCase():``}function py(e){return dy.has(fy(e))}var my=ly.map(e=>`.${e}`).join(`,`),hy=Y([`planning`,`planned`,`active`,`needs-human`,`blocked`,`done`,`dismissed`]),gy=Y([`human`,`threads`,`timer`]),_y=Y([`none`,`spawning`,`running`,`perm-prompt`,`turn-idle`,`exited`]),vy=Y([`claude`,`codex`]);J({slug:G(),displayName:G(),defaultEffort:G(),efforts:q(G())});var yy=J({model:G().min(1),label:G().min(1),defaultEffort:G().min(1),efforts:q(G().min(1)).min(1)}),by=J({id:G(),label:G().optional(),state:G().optional()}),xy=J({label:G(),startedAt:G(),state:Y([`running`,`stale`,`rested`]),subagentType:G().optional(),id:G().optional(),stoppable:K().optional(),lastActivityAt:G().optional(),activity:G().optional(),activityDetail:G().optional(),summary:G().optional(),toolUses:av().optional(),tokens:av().optional(),durationMs:av().optional(),depth:av().optional(),parentId:G().optional()});function Sy(e){return(e.depth??1)===1}var Cy=J({label:G(),startedAt:G(),state:Y([`running`,`stale`]),id:G().optional(),stoppable:K().optional(),outputUnavailable:K().optional(),command:G().optional(),lastActivityAt:G().optional(),taskId:G().optional()}),wy=J({label:G(),state:Y([`running`,`stale`])});J({turnInFlight:K().default(!1),unobservable:K().default(!1),subAgents:q(wy).default([]),subAgentCount:av().default(0),bgShells:q(wy).default([]),bgShellCount:av().default(0)});var Ty=J({label:G(),description:G().optional()}),Ey=J({questions:q(J({question:G(),header:G().optional(),multiSelect:K().optional(),options:q(Ty)}))}),Dy=J({kind:Y([`shell`,`agent`,`timer`,`pr`,`for`]),value:G()}),Oy=[`watch`,`pr-watch`,`human`,`ci`,`session`,`shell`,`agent`,`timer`,`pr`,`reason`];RegExp(`^\\s*(${Oy.join(`|`)}):\\s*\\S`,`im`);var ky=/^([a-z][a-z-]*):\s*(\S.*)?$/i,Ay=new Set([`shells`,`agents`,`timers`,`prs`,`for`]),jy={shells:`shell`,agents:`agent`,timers:`timer`,prs:`pr`};function My(e){let t=e.split(`
309
+ `).map(e=>e.replace(/\r$/,``)),n=t.findIndex(e=>/^\s*---+\s*$/.test(e)),r=n===-1?t:t.slice(0,n),i=n===-1?[]:t.slice(n+1),a=[],o=[],s=!0;for(let e of r){let t=e.match(ky),n=t?.[1].toLowerCase();t&&n?s=Ay.has(n):e.trim()!==``&&!/^\s/.test(e)&&!/^\s*-\s/.test(e)&&(s=!1),(s?o:a).push(e)}let c=Ny(o.join(`
310
310
  `));return c.ok||a.push(...o),a.push(...i),{body:a.join(`
311
- `).trim(),hints:c.hints.slice(0,8)}}function Py(e){if(!e.trim())return{ok:!0,hints:[]};let t;try{t=Dg(e)}catch{return{ok:!1,hints:[]}}if(!t||typeof t!=`object`||Array.isArray(t))return{ok:!1,hints:[]};let n=[],r=(e,t)=>{if(t==null||typeof t==`object`)return;let r=String(t).trim();r&&n.push({kind:e,value:r.slice(0,200)})};for(let[e,n]of Object.entries(t)){let t=e.toLowerCase(),i=My[t];if(i)for(let e of Array.isArray(n)?n:[n])r(i,e);else t===`for`&&r(`for`,n)}return{ok:!0,hints:n}}var Fy=G().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/,`Snooze time must be an ISO-8601 UTC instant`).refine(e=>{let t=Date.parse(e);return Number.isFinite(t)&&new Date(t).toISOString()===e},`Snooze time must be valid`),Iy=4e3,Ly=G().trim().min(1).max(Iy),Ry=Iy,zy=1440*60,By=G().trim().min(1).max(Ry),Vy=`If additional work remains on the original task, keep going. Make decisions autonomously.`,Hy=ov().int().min(60).max(zy),Uy=J({prompt:G(),stopHook:K(),heartbeat:K(),postCompaction:K(),intervalSeconds:ov().int().positive().optional(),armedAt:G(),lastRestFiredAt:G().optional(),lastScheduleFiredAt:G().optional(),lastCompactFiredAt:G().optional()}).strict(),Wy=/\n\n\((?:Goal|Recurring prompt|Stop hook|Heartbeat) — (?:sent (?:(each time you come to rest)|every ([^.)]+))|(your context was just compacted))\. [^)]*\)$/;function Gy(e){if(typeof e!=`string`)return;if(e.trimStart().startsWith(`**This message is from frizz, not from the human.**`))return{kind:`signoff`,prompt:``};let t=Wy.exec(e.trimEnd());if(!t)return;let n=e.trimEnd().slice(0,t.index).trim();if(n)return t[3]?{kind:`compaction`,prompt:n}:t[2]?{kind:`schedule`,every:t[2].trim(),prompt:n}:{kind:`rest`,prompt:n}}var Ky=Iy,qy=G().trim().min(1).max(Ky),Jy=/^⏰ Your background shell (finished|FAILED|was STOPPED): (?:`([^`]+)` — )?(.+)\.$/;function Yy(e){let t=Jy.exec(e.trim().split(`
311
+ `).trim(),hints:c.hints.slice(0,8)}}function Ny(e){if(!e.trim())return{ok:!0,hints:[]};let t;try{t=Eg(e)}catch{return{ok:!1,hints:[]}}if(!t||typeof t!=`object`||Array.isArray(t))return{ok:!1,hints:[]};let n=[],r=(e,t)=>{if(t==null||typeof t==`object`)return;let r=String(t).trim();r&&n.push({kind:e,value:r.slice(0,200)})};for(let[e,n]of Object.entries(t)){let t=e.toLowerCase(),i=jy[t];if(i)for(let e of Array.isArray(n)?n:[n])r(i,e);else t===`for`&&r(`for`,n)}return{ok:!0,hints:n}}var Py=G().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/,`Snooze time must be an ISO-8601 UTC instant`).refine(e=>{let t=Date.parse(e);return Number.isFinite(t)&&new Date(t).toISOString()===e},`Snooze time must be valid`),Fy=4e3,Iy=G().trim().min(1).max(Fy),Ly=Fy,Ry=1440*60,zy=G().trim().min(1).max(Ly),By=`If additional work remains on the original task, keep going. Make decisions autonomously.`,Vy=av().int().min(60).max(Ry),Hy=J({prompt:G(),stopHook:K(),heartbeat:K(),postCompaction:K(),intervalSeconds:av().int().positive().optional(),armedAt:G(),lastRestFiredAt:G().optional(),lastScheduleFiredAt:G().optional(),lastCompactFiredAt:G().optional()}).strict(),Uy=/\n\n\((?:Goal|Recurring prompt|Stop hook|Heartbeat) — (?:sent (?:(each time you come to rest)|every ([^.)]+))|(your context was just compacted))\. [^)]*\)$/;function Wy(e){if(typeof e!=`string`)return;if(e.trimStart().startsWith(`**This message is from frizz, not from the human.**`))return{kind:`signoff`,prompt:``};let t=Uy.exec(e.trimEnd());if(!t)return;let n=e.trimEnd().slice(0,t.index).trim();if(n)return t[3]?{kind:`compaction`,prompt:n}:t[2]?{kind:`schedule`,every:t[2].trim(),prompt:n}:{kind:`rest`,prompt:n}}var Gy=Fy,Ky=G().trim().min(1).max(Gy),qy=/^⏰ Your background shell (finished|FAILED|was STOPPED): (?:`([^`]+)` — )?(.+)\.$/;function Jy(e){let t=qy.exec(e.trim().split(`
312
312
  `)[0]?.trim()??``);if(!t)return null;let n=t[1]===`FAILED`?`failed`:t[1]===`was STOPPED`?`stopped`:`finished`;return{...t[2]?{taskId:t[2]}:{},label:t[3],outcome:n}}"**This message is from frizz, not from the human.** Nothing about your task has changed, and no new work is being asked of you.((You rested without a fence, so this thread cannot be triaged.((**IF THE TASK STILL HAS PARTS LEFT, THE FENCE IS NOT WHAT YOU OWE — THE WORK IS.** If ANY part of the(original task is unfinished, unverified, or deferred, resume it NOW, in THIS turn, and sign off once it(is genuinely finished. A milestone, a green test run and a long turn are none of them endings, and(neither is naming the next step or writing it into a scratch file.((**AND THAT TASK IS ALSO THE CEILING — finish it, and nothing else.** Work you notice on the way is a(FINDING TO REPORT in your sign-off, never work to take on: the bug beside the one you were sent for,(the refactor the code obviously wants, the second issue the first one touches. Widening the job is not(thoroughness — it is a different job nobody asked for, and it buries the answer they did ask for under(changes they now have to review. If it should be done, name it in one line and let the human dispatch(it.((**IF WHAT YOU WERE ASKED FOR IS A DOCUMENT, THE DOCUMENT IS THE ENDING.** A triage, a review, an(investigation, a recommendation, a plan — when that is the deliverable, the finished write-up IS the(work. Implementing what it proposes is the NEXT job, and not yours unless you were asked. Sign off with(the write-up.((**DECIDE RATHER THAN ASK.** Stop only for a decision that is genuinely the human's AND that blocks you(right now: ask that one in a question fence. Every other open choice INSIDE the task — a name, a(default, a reversible design call — is yours to make: decide it, say in one line which way you went and(what would reverse it, and carry on. A choice that would ENLARGE the task is not one of those: an(unanswered question is not permission to go build the answer.((Otherwise, add a fence at the END of your next message:((- `` ```question `` — you need the human. One question per fence, lettered options, one recommended.(- `` ```done `` — genuinely FINISHED. A DISMISSAL: the card is filed away and nobody looks again, so( if anything is still owed, it is not done. Body: 1-3 sentences, then bullets, each opening with a( **bolded verb phrase**.(- `` ```awaiting `` — you are WAITING on work that is actually running. FRONTMATTER, THEN MARKDOWN:( one structural line per thing you are waiting on, a REQUIRED `for:` duration, then a `---` line and( as much prose as you want. The prose is OPTIONAL; the lines above it are not.(( ```awaiting( shell: <the id your runtime gave you>( pr: owner/repo#123( for: 2h( ---( What you are waiting for, in your own words — this is what the human reads on your card.( ```(( Frizz CHECKS every line: name something that is not running and you are bumped rather than parked.( A fence that names NOTHING is not a park at all — if you are not waiting on anything, you are not( awaiting, you are done. Register a PR with `mcp__frizz__watch_pr` and a timer with( `mcp__frizz__timer`; `mcp__frizz__activity` reads back everything you have running, with its id.((**STILL OWED counts things you are not going to do yourself.** A decision you are RECOMMENDING, a(draft you wrote but did not send, follow-up work you discovered — all of it dies with the card, even(the part that is someone else's to do. Each ends on a question with your recommendation as option A,(or you DO it first — a sub-agent's result comes BACK to you, so it lands on your card; a new card via(`mcp__frizz__spawn_thread` is the LAST resort, since nothing it learns returns to you or its siblings.(None of them is a `done`. And what is not(worth a card is not worth a SENTENCE: delete the dangling \"one thing to carry forward\", never park it(in the handoff.((**DO NOT REPEAT YOURSELF.** If the message you just wrote already stands on its own, reply with the(fence ALONE — the human reads both together, so restating it costs them the second read for nothing.(The same holds inside one message: the card is the ledger of what shipped, the prose is only what a(ledger cannot hold, and a sentence that reads the same in either belongs in exactly one of them.((Only if it does NOT stand alone, fix that first, briefly. It has to be readable cold: the human has(seen nothing since their own last message — the Goal, this reminder, a watcher wake all came from(frizz — so anything you assumed they had followed, they have not.".split(`(`).join(`
313
- `);var Xy=/\n\n\(One-off timer, set for (\S+?)\. It has fired and will not repeat\.\)$/;function Zy(e){let t=e.trimEnd(),n=Xy.exec(t);if(!n)return null;let r=t.slice(0,n.index).trim();return r?{prompt:r,at:n[1]}:null}var Qy=/^⏳ The (weekly usage limit|session usage limit|usage limit) that interrupted you has reset\. Continue exactly where you left off\.$/;function $y(e){let t=Qy.exec(e.trim());return t?{window:t[1]===`weekly usage limit`?`weekly`:t[1]===`session usage limit`?`session`:`unknown`}:null}var eb=/^⏰ Your wait expired, nothing resolved\./,tb=/^✅ (?:The work you parked on has|Everything you parked on has) FINISHED, so the park is over/;function nb(e){return e.split(`
314
- `).filter(e=>e.trimStart().startsWith(`- `))}function rb(e){let t=e.trim();return eb.test(t)?{kind:`expired`,items:nb(t)}:tb.test(t)?{kind:`finished`,items:nb(t)}:null}var ib=/^⏰ Your watcher on (\S+) has expired and is no longer armed\b/;function ab(e){let t=ib.exec(e.trim());return t?{ref:t[1]}:null}var ob=Y([`shell`,`github`,`timer`]),sb=Y([`none`,`running`,`passing`,`failing`]),cb=Y([`mergeable`,`blocked`,`conflicting`,`unknown`]),lb=J({checks:sb,running:ov().int().nonnegative(),passed:ov().int().nonnegative(),failed:ov().int().nonnegative(),failing:q(G()).max(8).default([]),merge:cb,state:Y([`open`,`closed`,`merged`]),polledAt:G(),head:G().optional(),failureSig:G().optional()}).strict(),ub=J({id:G(),kind:ob,target:G(),state:Y([`armed`,`fired`,`dropped`]),createdAt:G(),github:lb.optional(),timer:J({fireAt:G(),prompt:G()}).strict().optional()}).strict(),db=J({id:G(),target:G(),state:Y([`armed`,`dropped`,`settled`]),createdAt:G(),github:lb.optional()}).strict();J({slug:dv,target:G().trim().min(1).max(200),for:G().trim().min(1).max(16).optional()}).strict(),J({id:G(),target:G(),alreadyArmed:K(),watches:q(db)}).strict(),J({slug:dv,id:G().min(1).max(64)}).strict(),J({dropped:K(),watches:q(db)}).strict(),J({slug:dv}).strict(),J({watches:q(db)}).strict();var fb=J({id:G(),prompt:G(),fireAt:G(),state:Y([`armed`,`fired`,`cancelled`]),createdAt:G()}).strict(),pb=J({kind:Y([`done`,`awaiting`]),body:G(),hints:q(Oy).default([])}),mb=J({backend:yy,window:Y([`session`,`weekly`,`unknown`]),at:G(),resumesAt:ov().optional(),autoResume:K()}),hb=J({id:dv,title:G(),status:gy,statusText:G().optional(),activity:G().optional(),next:G().optional(),hasPlan:K().default(!1),mechanism:_y.nullable(),humanBlocked:K(),ready:K(),dependsOn:q(dv),externalDeps:q(G()),owner:G().optional(),revalidate:G().optional(),agents:q(xy),errors:q(G()),warnings:q(G()),runtime:vy,sessionId:G().optional(),threadName:G().optional(),unread:K(),archived:K(),lastAssistant:G().optional(),spawnedAt:G().optional(),lastActivityAt:G().optional(),lastAssistantAt:G().optional(),aiTitle:G().optional(),titleAuto:K().optional(),titleLocked:K().optional(),subAgents:q(Sy).default([]),bgShells:q(wy).default([]),watches:q(ub).default([]),pendingAsk:Dy.optional(),pendingQuestion:K().default(!1),lastUserAt:G().optional(),providerFault:J({backend:Y([`claude`,`codex`]),category:Y([`authentication_required`,`authentication_rejected`])}).optional(),limitPause:mb.optional(),kind:Y([`session`,`legacy`]).optional(),foreign:K().optional(),state:Y([`open`,`archived`]).optional(),snoozedUntil:Fy.optional(),snoozePrompt:G().optional(),bgSnoozed:K().optional(),claudeRuntime:uv(`broker`).optional(),recurringPrompt:Uy.optional(),lastFence:pb.optional(),needsYou:K().optional(),crashed:K().optional(),awaitingBackground:K().optional(),pendingInteraction:K().optional(),actionableInteraction:K().optional(),seenAt:G().optional(),backend:yy.optional(),permissionMode:Y([`auto`,`default`,`acceptEdits`,`plan`,`bypassPermissions`]).optional(),permissionPending:Y([`auto`,`default`,`acceptEdits`,`plan`,`bypassPermissions`]).optional(),permissionChangePending:K().optional(),permPolicy:J({decision:uv(`deny`),rule:G(),reason:G(),tool:G().nullable(),at:G(),command:G().optional()}).optional(),permDenies:ov().optional(),profilePendingModel:G().optional(),profilePendingEffort:G().optional(),profileChangePending:K().optional(),runtimeControlPending:K().optional(),controlError:G().optional(),model:G().optional(),effort:G().optional(),context:J({tokens:ov(),window:ov()}).optional()});function gb(e){return e.kind===`session`&&e.foreign!==!0&&e.needsYou===!0&&e.state!==`archived`}var _b=J({file:G(),kind:Y([`no-frontmatter`,`other`]),message:G()}),vb=J({projectDir:G(),projectName:G(),projectLabel:G(),githubRepo:G().optional(),projectSlug:G().optional(),homeDir:G().optional(),threads:q(hb),errors:q(G()),warnings:q(G()),errorItems:q(_b).optional()}),yb=J({key:G(),label:G(),usedPercent:ov(),resetsAt:ov().optional()}),bb=J({status:Y([`ok`,`unavailable`]),planType:G().optional(),windows:q(yb),detail:G().optional()});J({claude:bb,codex:bb});var xb=Y([`authed`,`signed-out`,`unknown`]);J({claude:xb,codex:xb,emails:J({claude:G().max(320).optional(),codex:G().max(320).optional()})}),J({backend:Y([`claude`,`codex`])}).strict(),J({status:Y([`done`,`blocked`,`failed`]),auth:xb,activeThreads:ov().int().positive().optional(),detail:G().max(200).optional()}),J({backend:Y([`claude`,`codex`])}).strict(),J({attemptId:dv}),J({attemptId:dv}).strict(),J({state:Y([`running`,`exited`,`unknown`]),auth:xb});var Sb=Y([`auto`,`default`,`acceptEdits`,`plan`,`bypassPermissions`]),Cb=Y([`system`,`cursor`,`vscode`,`finder`,`copy`]),wb=J({permissionMode:Sb,model:G().optional(),backend:yy.optional(),effort:Y([`low`,`medium`,`high`,`xhigh`,`max`,`ultra`,`ultracode`]).optional(),notifications:K(),projectRail:K(),font:Y([`mono`,`sans`]).optional(),localFileOpener:Cb.optional(),githubPrompt:G().optional()}),Tb=J({model:G().trim().min(1).max(200).optional(),effort:wb.shape.effort,permissionMode:Sb.optional()});J({backend:yy,claude:Tb,codex:Tb});var Eb=J({backend:yy,model:G().trim().min(1).max(200),effort:wb.shape.effort.unwrap(),permissionMode:Sb.optional()}).strict();cv(`field`,[J({field:uv(`backend`),value:yy}),J({field:uv(`profile`),backend:yy,model:G().trim().min(1).max(200),effort:wb.shape.effort.unwrap()}),J({field:uv(`model`),backend:yy,value:G().trim().min(1).max(200)}),J({field:uv(`effort`),backend:yy,value:wb.shape.effort.unwrap()})]),J({title:G().min(1).optional(),prompt:G().min(1),slug:dv.optional(),permissionMode:Sb.optional(),model:G().optional(),backend:yy.optional(),effort:wb.shape.effort}),J({slug:dv,message:G().max(64*1024).optional()}).strict(),J({slug:dv,sessionId:G().min(1)}).strict(),J({sessionId:dv,backend:Y([`claude`,`codex`]),title:G().max(200).optional()}).strict(),J({slug:dv,sessionId:G().min(1),message:G().min(1),deliveryId:G().min(1).max(200).optional(),freshProcess:K().optional(),interrupt:K().optional()}),J({slug:dv,sessionId:G().min(1),deliveryId:G().min(1).max(200)}).strict(),J({unqueued:K(),reason:G().optional()}).strict(),J({slug:dv,sessionId:G().min(1)}).strict(),J({interrupted:K(),reason:G().optional()}).strict(),J({slug:dv,sessionId:G().min(1),until:Fy.nullable(),prompt:Ly.nullable().optional()}).strict(),J({slug:dv,sessionId:G().min(1),prompt:By.nullable(),stopHook:K(),heartbeat:K(),postCompaction:K().default(!1),intervalSeconds:Hy.optional()}).strict(),J({slug:dv,prompt:By.nullable(),stopHook:K(),heartbeat:K(),postCompaction:K().default(!1),pauseOnQuestions:K().optional(),intervalSeconds:Hy.optional()}).strict(),J({replaced:Uy.nullable()}).strict(),J({slug:dv}).strict(),J({recurringPrompt:Uy.nullable()}).strict(),J({slug:dv,prompt:qy,fireAt:Fy}).strict(),J({slug:dv,id:G().min(1).max(64)}).strict(),J({slug:dv}).strict(),J({timers:q(fb)}).strict();var Db=J({kind:Y([`shell`,`agent`,`timer`,`pr`]),id:G(),label:G(),since:G().optional(),until:G().optional()}).strict();J({slug:dv}).strict(),J({activity:q(Db)}).strict(),J({id:G(),fireAt:G(),timers:q(fb)}).strict(),J({cancelled:K(),timers:q(fb)}).strict(),J({slug:dv,prompt:By.nullable(),enabled:K()}).strict(),J({slug:dv,prompt:By.nullable(),intervalSeconds:Hy.optional(),enabled:K().optional()}).strict(),J({plugins:ov().int().min(0),commands:ov().int().min(0),agents:ov().int().min(0),mcpServers:q(G()),errorCount:ov().int().min(0)}).strict(),J({slug:dv,title:G().trim().min(1).max(200)}),J({slug:dv}),J({title:G().min(1).max(200)}),J({slug:dv,permissionMode:Sb}),J({effect:Y([`applied`,`next-turn`,`next-resume`])}),J({slug:dv}).strict(),J({backend:yy,options:q(by)});var Ob=J({name:G().min(1).max(512),description:G().max(1024)}).strict();J({slug:dv}).strict(),J({skills:q(Ob).max(1024)}).strict(),J({slug:dv,model:G().trim().min(1).max(200),effort:G().trim().min(1).max(100)}).strict(),J({effect:Y([`applied`,`next-resume`])}),`${[`===============================================================`,`====================== YOUR TASK ========================`,`===============================================================`].join(`
315
- `)}`;var kb=J({label:G(),actor:G(),bot:K(),at:G().optional(),url:G().optional()}),Ab=J({ref:G(),items:q(kb),omitted:ov()}),jb=`ignore older activity you have already handled`,Mb=`These were already on the PR when you parked, so you may have handled some. Check what is still unaddressed, deal with it, and re-park — this is the only time frizz replays a PR's existing activity to you.`;function Nb(e){return typeof e==`string`&&e.includes(Mb)}var Pb=String.raw`[A-Za-z0-9][\w.-]*\/[A-Za-z0-9][\w.-]*#\d+`,Fb=new RegExp(String.raw`^(👤|🤖) New GitHub (.+?) on (${Pb}) from @(\S+?)(?: at (\S+?))?\. Read that exact .+? — `+jb+String.raw` — and continue(?::\s*(\S+)|\.)$`),Ib=new RegExp(String.raw`^(👤|🤖) (\d+) new GitHub items on (${Pb})\. Read exactly these — `+jb+String.raw` — and continue:$`),Lb=/^- (👤|🤖) (.+?) from @(\S+?)(?: at (\S+?))?(?:: (\S+))?$/,Rb=/^- …and (\d+) more not listed — check .+ for the rest$/;function zb(e){let t=(e,t,n,r,i)=>({label:e,actor:t,bot:n,...r?{at:r}:{},...i?{url:i}:{}}),n=e.trim().split(`
316
- `).map(e=>e.trim()).filter(Boolean),r=Fb.exec(n[0]??``);if(r)return{ref:r[3],omitted:0,items:[t(r[2],r[4],r[1]===`🤖`,r[5],r[6])]};let i=Ib.exec(n[0]??``);if(!i)return null;let a=[],o=0;for(let e of n.slice(1)){let n=Rb.exec(e);if(n){o=Number(n[1]);continue}let r=Lb.exec(e);r&&a.push(t(r[2],r[3],r[1]===`🤖`,r[4],r[5]))}return!a.length||a.length+o!==Number(i[2])?null:{ref:i[3],omitted:o,items:a}}var Bb=new RegExp(String.raw`^⏰ (${Pb}) was (MERGED|CLOSED)\.$`),Vb=new RegExp(String.raw`^✅ CI PASSED on (${Pb}) — (\d+) checks? green\.$`),Hb=new RegExp(String.raw`^❌ CI FAILED on (${Pb})(?:: (.+?))?\.$`);function Ub(e){for(let t of e.split(`
317
- `)){let e=t.trim();if(!e)continue;let n=Bb.exec(e);if(n)return{ref:n[1],kind:n[2]===`MERGED`?`merged`:`closed`};let r=Vb.exec(e);if(r)return{ref:r[1],kind:`ci`,verdict:`passing`,passed:Number(r[2]),failing:[]};let i=Hb.exec(e);if(i)return{ref:i[1],kind:`ci`,verdict:`failing`,failing:i[2]?i[2].split(`, `):[]}}return null}J({installed:K(),inRepo:K(),nameWithOwner:G().nullable(),authed:K()});var Wb=J({ref:G(),kind:Y([`issue`,`pr`,`commit`]),repo:G(),url:G(),title:G(),body:G(),state:G(),stateReason:G().optional(),at:G().optional(),authorLogin:G().optional(),authorName:G().optional(),authorAvatar:G().optional(),labels:q(J({name:G(),color:G()})).default([]),additions:ov().int().nonnegative().optional(),deletions:ov().int().nonnegative().optional(),changedFiles:ov().int().nonnegative().optional(),comments:ov().int().nonnegative().optional(),fetchedAt:ov().int().nonnegative()});J({refs:q(G().min(3).max(120)).min(1).max(100),refresh:K().default(!1)}),J({cards:q(Wb),missing:q(G()),error:G().optional()});var Gb=J({kind:Y([`issue`,`pr`]),number:ov().int().positive(),title:G(),url:G(),reactions:ov().int().nonnegative(),updatedAt:G(),comments:ov().int().nonnegative().optional(),createdAt:G().optional(),author:G().optional(),labels:q(J({name:G(),color:G()})).default([]),state:G().optional(),isDraft:K().optional(),linkedPrs:J({count:ov().int().positive(),number:ov().int().positive(),url:G(),state:G(),isDraft:K().optional()}).optional()});J({kind:Y([`issues`,`prs`]),sort:Y([`recent`,`reactions`]),page:ov().int().min(1).default(1),perPage:ov().int().min(1).max(100).default(30)}),J({items:q(Gb),total:ov().int().nonnegative(),page:ov().int().positive(),pageCount:ov().int().positive()}),Eb.extend({items:q(J({kind:Y([`issue`,`pr`]),number:ov().int().positive()})).min(1)}).strict(),J({dispatched:q(J({number:ov(),kind:G(),slug:dv})),failed:q(J({number:ov(),kind:G(),error:G()}))});var Kb=J({projectDir:G(),projectName:G(),projectLabel:G(),errors:q(G()),warnings:q(G()),errorItems:q(_b).optional()});cv(`type`,[J({type:uv(`board`),board:vb,seq:ov().optional(),bootId:G().optional()}),J({type:uv(`board-delta`),seq:ov(),bootId:G(),upserts:q(hb),removed:q(dv),meta:Kb.optional()}),J({type:uv(`notify`),slug:dv,kind:Y([`needs-decision`,`turn-done`,`exited`]),title:G(),body:G().optional()}),J({type:uv(`interactions-invalidated`),slug:xv,sessionId:bv,interactionId:bv,lifecycle:Qv,recordRevision:Sv}).strict()]);var qb=J({file:G(),old:G(),new:G()}),Jb=J({text:G(),status:Y([`pending`,`in_progress`,`completed`])}),Yb=J({name:G(),detail:G().optional(),edit:qb.optional(),desc:G().optional(),command:G().optional(),input:G().optional(),read:G().optional(),output:G().optional(),outputImage:G().optional(),status:Y([`pending`,`completed`,`failed`,`cancelled`]).optional(),backgroundState:Y([`background`,`unknown`]).optional(),shellId:G().optional(),exitCode:ov().int().optional(),cwd:G().optional(),sessionId:sv([G(),ov()]).optional(),durationMs:ov().nonnegative().optional(),prompt:G().optional(),subagentType:G().optional(),agentId:G().optional(),agentStatus:Y([`completed`,`failed`,`killed`]).optional(),agentElapsedMs:ov().optional(),agentCompletion:K().optional(),sendTo:G().optional(),sendSummary:G().optional(),sendBody:G().optional(),sendType:G().optional(),sendDispatchId:G().optional(),sendTargetLabel:G().optional(),sentImages:q(G()).optional(),sentFiles:q(G()).optional(),caption:G().optional(),todos:q(Jb).optional()}),Xb=cv(`kind`,[J({kind:uv(`text`),text:G()}),J({kind:uv(`tools`),tools:q(Yb)})]),Zb=J({sourceId:G().min(1).max(768).optional(),pinnedFromSourceId:G().min(1).max(768).optional(),role:Y([`user`,`assistant`]),text:G(),displayText:G().optional(),tools:q(Yb),at:G().optional(),kind:Y([`event`,`reasoning`]).optional(),durationMs:ov().nonnegative().optional(),boundary:Y([`wake`,`compaction`,`rest`]).optional(),parts:q(Xb).default([]),queued:K().optional(),deliveryId:G().optional(),deliveryState:Y([`pending`,`enqueued`,`delivered`,`unconfirmed`]).optional(),wake:K().optional(),wakeSteer:Ab.optional(),peerFrom:G().optional(),peerDispatchId:G().optional(),peerUnnamed:uv(!0).optional(),peerSenderTaskId:G().optional(),fenceRefused:uv(!0).optional()}),Qb=G().min(1).max(2048).regex(/^[A-Za-z0-9_-]+$/);J({messages:q(Zb),beforeCursor:Qb.nullable(),hasEarlier:K(),reachedTurnBoundary:K(),transcriptKey:G().min(1).max(256)}).strict(),J({slug:dv,cursor:Qb}).strict();var $b=dv;cv(`t`,[J({t:uv(`sub`),topic:uv(`transcript`),slug:$b}).strict(),J({t:uv(`unsub`),topic:uv(`transcript`),slug:$b}).strict()]);var ex=J({id:G(),slug:G(),name:G(),path:G(),lastOpenedAt:G(),stale:K(),iconVersion:G().optional(),iconStatus:Y([`icon`,`none`,`unknown`]),iconIsCustom:K().optional()}),tx=[`png`,`svg`,`ico`,`webp`,`jpg`,`jpeg`,`gif`];cv(`kind`,[J({kind:uv(`picked`),project:ex}),J({kind:uv(`cancelled`)}),J({kind:uv(`unavailable`),reason:G()})]),J({projectSlug:G(),projectName:G()});var nx=`/_frizz`,rx=null;function ix(e){rx=e}function ax(){return rx?(rx(),!0):!1}var ox=new Map,sx=new Map;function cx(e,t){t?ox.set(e,t):ox.delete(e)}function lx(e){let t=ox.get(e);return t?(t(),!0):!1}function ux(e,t){t?sx.set(e,t):sx.delete(e)}function dx(e){sx.get(e)?.()}function fx(){if(typeof document>`u`||!document.body)return typeof window>`u`?0:window.scrollY;let e=px()?Number.parseFloat(document.body.style.top):NaN;return Number.isNaN(e)?window.scrollY:-e}function px(){return typeof document<`u`&&document.body?.style.position===`fixed`}var mx=null;function pee(e){mx=e}function hx(){let e=mx;return mx=null,e}function gx(e,t){if(!e)return{kind:`loading`};let n=e.threads.find(e=>e.id===t);return n?{kind:`found`,ownership:n.kind===`session`?n.foreign===!0?`foreign`:`owned`:`legacy`,thread:n}:{kind:`missing`}}var _x=new Set([`thread`,`status`]);function vx(e){if(typeof e==`string`)return e;let t=typeof location>`u`?void 0:location.pathname;return typeof t==`string`?t:`/`}var yx=`project`,mee=`/${yx}`;function bx(e){let[,t,n]=vx(e).split(`/`);return t===yx&&n?n:void 0}function xx(e){return`${mee}/${e}`}function Sx(e){let t=bx(e);return t?xx(t):``}function Cx(e){let t=vx(e),n=Sx(t);return n?t.slice(n.length)||`/`:t||`/`}function wx(e,t){let n=Sx(vx(t));return n?`${n}${e===`/`?``:e}`||`/`:e}function hee(e,t){if(!e||!e.startsWith(`/`)||e.startsWith(`//`))return null;let n=e.replace(/[?#].*$/u,``);if(bx(n))return null;let r=n.split(`/`)[1]??``;if(!_x.has(r))return null;let i=wx(e,t);return i===e?null:i}function Tx(e){let t=bx(e);return t?`${nx}/${t}`:nx}function Ex(e,t){return wx(`/thread/${encodeURIComponent(e)}/full`,t)}function gee(e){let t=e.match(/^\/thread\/([^/]+)\/full$/);if(!t)return null;try{return decodeURIComponent(t[1])}catch{return null}}function Dx(e,t){let n=bx(t);return n===void 0||e==null?!0:e===n}var Ox=`https://github.com`,kx=null,Ax=new Set;function jx(e){let t=e??null;if(t!==kx){kx=t;for(let e of Ax)e()}}function Mx(){return kx}function Nx(e){return Ax.add(e),()=>Ax.delete(e)}var Px=`[A-Za-z0-9][A-Za-z0-9._-]*`,Fx=RegExp(`^https://github\\.com/(${Px})/(${Px})/(?:(issues|pull)/([1-9]\\d{0,9})|commit/([0-9a-f]{7,40}))(?:[/?#].*)?$`,`i`);function Ix(e){if(!e)return null;let t=Fx.exec(e.trim());if(!t)return null;let[,n,r,,i,a]=t;return i?`${n}/${r}#${i}`:`${n}/${r}@${a.toLowerCase()}`}var Lx=RegExp(`(^|[^\\w#/&@-])(?:(${Px}/${Px})@([0-9a-f]{7,40})|(${Px}/${Px})?#([1-9]\\d{0,9})|([0-9a-f]{7,40}))(?![\\w-])`,`g`);function Rx(e){return/\d/.test(e)&&/[a-f]/.test(e)}function zx(e){return{type:`text`,raw:e,text:e}}function Bx(e,t,n){return{type:`link`,raw:e,href:t,title:n,text:e,tokens:[zx(e)]}}function Vx(e){if(!kx)return[];let t=[];Lx.lastIndex=0;for(let n=Lx.exec(e);n;n=Lx.exec(e)){let[e,r,i,a,o,s,c]=n,l=a??c;if(l&&!Rx(l))continue;let u=s?`${Ox}/${o??kx}/issues/${s}`:`${Ox}/${i??kx}/commit/${l}`,d=s?`${o??kx}#${s}`:`${i??kx}@${l}`;t.push({start:n.index+r.length,text:e.slice(r.length),href:u,title:d})}return t}function Hx(e){let t=Vx(e);if(t.length===0)return null;let n=[],r=0;for(let{start:i,text:a,href:o,title:s}of t)i>r&&n.push(zx(e.slice(r,i))),n.push(Bx(a,o,s)),r=i+a.length;return r<e.length&&n.push(zx(e.slice(r))),n}var Ux=new Set([`code`,`codespan`,`html`,`link`,`image`]);function Wx(e){let t=[],n=e;Array.isArray(n.tokens)&&t.push(n.tokens),Array.isArray(n.items)&&t.push(n.items);for(let e of n.header??[])Array.isArray(e.tokens)&&t.push(e.tokens);for(let e of n.rows??[])for(let n of e)Array.isArray(n.tokens)&&t.push(n.tokens);return t}function Gx(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(Ux.has(n.type))continue;let r=Wx(n);for(let e of r)Gx(e);if(n.type!==`text`||r.length>0)continue;let i=Hx(n.text);i&&e.splice(t,1,...i)}}var Kx=`frizz-boot-id`;function qx(e){try{return sessionStorage.getItem(e)}catch{return null}}function Jx(e,t){try{sessionStorage.setItem(e,t)}catch{}}function Yx(e){switch(sy(qx(Kx),e)){case`noop`:return;case`record`:Jx(Kx,e);return;case`adopt`:Jx(Kx,e);return}}var Xx={board:`query`,threadBody:`query`,threadTranscript:`query`,threadTranscriptEarlier:`query`,subAgentTranscript:`query`,subAgentSteer:`mutation`,subAgentStop:`mutation`,backgroundShellOutput:`query`,backgroundShellActivity:`query`,stopBackgroundOp:`mutation`,pendingInteractions:`query`,interactionGet:`query`,interactionResolve:`mutation`,interactionCancel:`mutation`,dispatch:`mutation`,adoptThread:`mutation`,followUp:`mutation`,unqueueFollowUp:`mutation`,deliverQueuedNow:`mutation`,setThreadPermission:`mutation`,threadProfileOptions:`query`,threadSkills:`query`,setThreadProfile:`mutation`,markRead:`mutation`,threadSeen:`mutation`,setThreadState:`mutation`,completeThread:`mutation`,setThreadSnooze:`mutation`,setThreadRecurringPrompt:`mutation`,setOwnThreadRecurringPrompt:`mutation`,addOwnPrWatch:`mutation`,dropOwnPrWatch:`mutation`,listOwnPrWatches:`mutation`,getOwnThreadRecurringPrompt:`mutation`,setOwnThreadStopHook:`mutation`,setOwnThreadHeartbeat:`mutation`,setThreadHeartbeat:`mutation`,setOwnThreadTimer:`mutation`,cancelOwnThreadTimer:`mutation`,listOwnThreadTimers:`mutation`,listOwnThreadActivity:`mutation`,reloadThreadPlugins:`mutation`,snoozeAwaitingBackground:`mutation`,forgetThread:`mutation`,threadTerminalCommand:`query`,openExternal:`mutation`,openLocalFile:`mutation`,localMarkdown:`query`,resolveLocalPaths:`query`,markComplete:`mutation`,setThreadStatus:`mutation`,dismissThread:`mutation`,repairThread:`mutation`,archiveThread:`mutation`,killAgent:`mutation`,renameThread:`mutation`,aiRenameThread:`mutation`,codexModels:`query`,quota:`query`,authStatus:`query`,accountLogout:`mutation`,accountLoginStart:`mutation`,accountLoginStatus:`query`,accountLoginCancel:`mutation`,threadLocate:`query`,projectsList:`query`,projectPick:`mutation`,projectAdd:`mutation`,projectsReorder:`mutation`,projectsQueueCounts:`query`,projectIconPick:`mutation`,projectIconSet:`mutation`,projectIconClear:`mutation`,settingsGet:`query`,settingsSet:`mutation`,settingsReset:`mutation`,dispatchPreferencesGet:`query`,dispatchPreferenceSet:`mutation`,githubPromptDefaults:`query`,githubStatus:`query`,githubList:`query`,githubDispatchBatch:`mutation`,githubRefPreview:`query`},Zx=`Frizz is updating and restarting. Your draft is preserved; wait until it is ready before sending or changing settings.`;function Qx(e){return e?.retryableRpc===!0}function $x(e){return Object.defineProperty(e,"retryableRpc",{value:!0,enumerable:!1}),e}function eS(e){if(e===`mutation`&&Z.controlPlaneState===`restarting`)throw $x(Error(Zx))}async function tS(e,t){let n=await e.text(),r;try{r=JSON.parse(n)}catch{throw e.status===404||e.status===405?Error(`Frizz server restart required — this control is newer than the running server`):e.status===403?Error(`RPC ${t} was refused (403) — the page's origin does not match the server it is talking to. Reload from the URL frizz is actually serving.`):Error(`RPC ${t} returned a non-JSON response (HTTP ${e.status})`)}if(!e.ok){let e=Error(typeof r.error==`string`?r.error:`RPC ${t} failed`);throw r.retryable===!0?$x(e):e}return r.result}async function nS(e,t,n,r){if(eS(t),t===`query`){let t=new URL(`${Tx()}/rpc/${e}`,location.origin);n!==void 0&&t.searchParams.set(`input`,JSON.stringify(n));let i=await fetch(t.toString(),{signal:r?.signal});return Yx(i.headers.get(`x-frizz-boot`)),tS(i,e)}let i=await fetch(`${Tx()}/rpc/${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n??{}),signal:r?.signal});return Yx(i.headers.get(`x-frizz-boot`)),tS(i,e)}var X=new Proxy({},{get(e,t){let n=Xx[t];if(n)return(e,r)=>nS(t,n,e,r)}}),rS=6e4,iS=80,aS=100,oS={loading:!0},sS=new Map,cS=new Set,lS=new Set,uS;function dS(){for(let e of cS)e()}function fS(e){return cS.add(e),()=>cS.delete(e)}function pS(e){return sS.get(e)}function mS(e,t=Date.now()){return!e?.card||e.card.kind===`commit`?!1:t-e.card.fetchedAt>rS}var hS=/data-gh-ref="([^"]+)"/g;function gS(e){if(!e.includes(`data-gh-ref`))return[];let t=new Set;for(let n of e.matchAll(hS))t.add(n[1]);return[...t]}function _S(e){let t=!1;for(let n of e)sS.has(n)||lS.has(n)||(lS.add(n),t=!0);!t||uS!==void 0||(uS=setTimeout(()=>{uS=void 0,yS()},iS))}function vS(e,t){for(let e of t.cards)sS.set(e.ref,{card:e});for(let e of t.missing)sS.set(e,{missing:!0});for(let t of e)sS.get(t)===oS&&sS.delete(t);dS()}async function yS(){let e=[...lS].slice(0,aS);if(e.length!==0){for(let t of e)lS.delete(t),sS.set(t,oS);dS();try{vS(e,await X.githubRefPreview({refs:e}))}catch{vS(e,{cards:[],missing:[]})}lS.size>0&&uS===void 0&&(uS=setTimeout(()=>{uS=void 0,yS()},0))}}var bS=new Set;function xS(e){bS.has(e)||(bS.add(e),X.githubRefPreview({refs:[e],refresh:!0}).then(e=>{for(let t of e.cards)sS.set(t.ref,{card:t});dS()}).catch(()=>{}).finally(()=>bS.delete(e)))}function SS(){sS.clear(),lS.clear(),bS.clear(),uS!==void 0&&(clearTimeout(uS),uS=void 0),dS()}var CS={dir:``,home:``},wS=CS,TS=new Set;function ES(e,t){let n={dir:e??``,home:t??``};if(!(n.dir===wS.dir&&n.home===wS.home)){wS=n.dir||n.home?n:CS;for(let e of TS)e()}}function DS(){return wS}function OS(e){return TS.add(e),()=>TS.delete(e)}function kS(e){if(typeof document>`u`)return null;let t=document.querySelector(`[data-queue-card="${CSS.escape(e)}"]`);return t?t.querySelector(`[data-queue-card-root="${CSS.escape(e)}"]`)??t:null}function AS(e){let t=kS(e);if(!t)return null;let n=typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 800px)`).matches?40:0;return Math.max(0,fx()+t.getBoundingClientRect().top-40-n)}var Z=Rf({board:null,view:`todos`,connection:`connecting`,controlPlaneState:`ready`,controlPlaneMessage:null,controlPlaneRestartPending:!1,showSettings:!1,showPalette:!1,showNewThread:!1,showGithubPicker:!1,sidebarCollapsed:{active:!1,held:!0,inactive:!0,external:!0},drawers:[],notificationsEnabled:!1,socketTranscripts:!1,socketBoardFallback:null,socketTranscriptFallbacks:{},routeThreadSlug:null,toast:null});function jS(){Z.showNewThread=!0}function MS(){Z.showGithubPicker=!0}function NS(){Z.showGithubPicker=!1}var PS=0;function Q(e,t){Z.toast={id:++PS,text:e,...t}}var FS=0,IS=0;function LS(e,t){return e.kind===t.kind?e.kind===`markdown`?e.path===t.path:e.kind===`subagent`||e.kind===`shell`?e.subId===t.subId:e.slug===t.slug:!1}function RS(e,t){return t.kind===`markdown`?!0:t.kind===`subagent`||t.kind===`shell`?(e.kind===`thread`||e.kind===`doc`)&&e.slug===t.slug:t.kind===`doc`?e.kind===`thread`&&e.slug===t.slug:t.kind===`thread`?e.kind===`doc`&&e.slug===t.slug:!1}function zS(e){let t=Z.drawers.filter(t=>!t.closing&&!LS(t,e)&&!RS(t,e)).map(e=>e.id);t.length&&QS(t);let n=Z.drawers.filter(t=>LS(t,e));if(!n.length){Z.drawers.push({...e,id:++FS,openedAt:++IS});return}let r=[...n].reverse().find(e=>!e.closing)??n[n.length-1],{closing:i,...a}=r,o={...a,...e,openedAt:++IS};Z.drawers=[...Z.drawers.filter(t=>!LS(t,e)),o],queueMicrotask(()=>dx(r.id))}function BS(e,t,n){zS({kind:e,slug:t,routed:n?.routed})}function VS(e,t,n){zS({kind:`subagent`,slug:e,subId:t,label:n.label,subagentType:n.subagentType,startedAt:n.startedAt})}function HS(e,t,n){zS({kind:`shell`,slug:e,subId:t,label:n.label,startedAt:n.startedAt})}function US(e){let t=Z.board?.threads.find(t=>t.id===e);t?.needsYou&&GS(e)||BS(t&&t.runtime===`none`?`doc`:`thread`,e)}function WS(){let e=Z.routeThreadSlug;if(!e||!Z.board)return;Z.routeThreadSlug=null;let t=gx(Z.board,e);if(t.kind===`missing`){typeof location<`u`&&location.replace(Ex(e));return}t.kind===`found`&&t.thread.needsYou&&GS(e)||BS(`thread`,e,{routed:!0})}function GS(e){let t=kS(e);if(!t)return!1;let n=AS(e),r=Z.drawers.filter(e=>!e.closing).map(e=>e.id);return r.length&&QS(r),n!==null&&(px()?pee(n):Math.abs(window.scrollY-n)>.5&&window.scrollTo({top:n,left:0,behavior:`auto`})),qS(e,t),!0}var KS=new Map;function qS(e,t){let n=KS.get(e);n!==void 0&&window.clearTimeout(n),t.removeAttribute(`data-queue-flash`),t.offsetWidth,t.setAttribute(`data-queue-flash`,``),KS.set(e,window.setTimeout(()=>{KS.delete(e),t.removeAttribute(`data-queue-flash`)},1100))}function JS(e){zS({kind:`markdown`,slug:e,path:e,label:e.split(`/`).filter(Boolean).pop()||e})}function YS(){return Z.drawers[Z.drawers.length-1]}function XS(e){let t=Z.drawers.find(t=>t.id===e);t&&(t.closing=!0)}function ZS(e){Z.drawers.find(t=>t.id===e)?.closing&&(Z.drawers=Z.drawers.filter(t=>t.id!==e))}function QS(e){let t=[];for(let n of e)lx(n)||t.push(n);if(t.length){let e=new Set(t);Z.drawers=Z.drawers.filter(t=>!e.has(t.id))}}function $S(){for(let e=Z.drawers.length-1;e>=0;e--){let t=Z.drawers[e];if(t.kind===`thread`&&!t.closing)return t.slug}return null}function eC(e){Dx(e.projectSlug)&&(jx(e.githubRepo),ES(e.projectDir,e.homeDir),Z.board=e)}function tC(){jx(null),ES(null),SS(),Z.board=null,Z.view=`todos`,Z.connection=`connecting`,Z.drawers=[],Z.routeThreadSlug=null,Z.socketBoardFallback=null,Z.socketTranscriptFallbacks={},Z.showSettings=!1,Z.showNewThread=!1,Z.showGithubPicker=!1}function nC(e){Dx(e.projectSlug)&&Z.board===null&&(jx(e.githubRepo),ES(e.projectDir,e.homeDir),Z.board=e)}function rC(e){return Z.board===null?!1:(ay(Z.board,e),!0)}function iC(e,t){if(!(!e||!t))return e.threads.find(e=>e.id===t)}var aC=`fixed inset-0 bg-black/40 backdrop-blur-[1px] transition-opacity duration-200 ease-out motion-reduce:transition-none`,oC=`frizz-sheet-panel flex h-full flex-col border-l border-border bg-panel shadow-2xl shadow-black/50 transition-transform duration-200 ease-out motion-reduce:transition-none`;function sC(e,t=0){let n=Math.max(0,e-t);return`min(${720-n*28}px, ${80-n*4}vw)`}function cC(){return typeof window<`u`&&!!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches}function lC(e,t=!1){let[n,r]=(0,B.useState)(t),i=(0,B.useRef)(!1),a=Hf(Z);(0,B.useEffect)(()=>{if(t)return;let e=!1,n=()=>{e||i.current||(e=!0,r(!0))},a=requestAnimationFrame(n),o=window.setTimeout(n,120);return()=>{cancelAnimationFrame(a),window.clearTimeout(o)}},[t]);let o=(0,B.useCallback)(()=>{i.current||(i.current=!0,XS(e),r(!1),window.setTimeout(()=>ZS(e),cC()?0:210))},[e]);return(0,B.useEffect)(()=>(cx(e,o),()=>cx(e,null)),[e,o]),(0,B.useEffect)(()=>{a.drawers.find(t=>t.id===e)?.closing||!i.current||(i.current=!1,r(!0))},[a.drawers,e]),{shown:n,close:o,closingRef:i}}var uC=`[data-radix-popper-content-wrapper],[role='menu'],[role='listbox'],[role='dialog']`;function dC(e){return document.body.style.pointerEvents===`none`||e.closest(uC)!==null}function fC(e,t,n,r){(0,B.useEffect)(()=>{function i(i){let a=i.target;if(!(a instanceof Element)||t.current?.contains(a)||dC(a))return;let o=Z.drawers.findIndex(t=>t.id===e);o===-1||o<Z.drawers.length-1||r&&a.closest(`[data-subagent-parent]`)?.getAttribute(`data-subagent-parent`)===r||n()}return window.addEventListener(`pointerdown`,i,!0),()=>window.removeEventListener(`pointerdown`,i,!0)},[e,t,n,r])}function pC({id:e,depth:t,widthDepth:n,widthOffset:r=0,subagentParent:i,children:a}){let{shown:o,close:s}=lC(e),c=(0,B.useRef)(null);return fC(e,c,s,i),(0,V.jsx)(`div`,{className:`${aC} pointer-events-none flex justify-end ${o?`opacity-100`:`opacity-0`}`,style:{zIndex:50+t*2},children:(0,V.jsx)(`div`,{ref:c,className:`${oC} pointer-events-auto ${o?`translate-x-0`:`translate-x-full`}`,style:{width:sC(n,r)},children:a(s)})})}var mC=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),hC=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),gC=e=>{let t=hC(e);return t.charAt(0).toUpperCase()+t.slice(1)},_C=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),vC=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},yC={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},bC=(0,B.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,B.createElement)(`svg`,{ref:c,...yC,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:_C(`lucide`,i),...!a&&!vC(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,B.createElement)(e,t)),...Array.isArray(a)?a:[a]])),xC=(e,t)=>{let n=(0,B.forwardRef)(({className:n,...r},i)=>(0,B.createElement)(bC,{ref:i,iconNode:t,className:_C(`lucide-${mC(gC(e))}`,`lucide-${e}`,n),...r}));return n.displayName=gC(e),n},SC=xC(`alarm-clock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),CC=xC(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),wC=xC(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),TC=xC(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),EC=xC(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),DC=xC(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),OC=xC(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),kC=xC(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),AC=xC(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),jC=xC(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),MC=xC(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),NC=xC(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),PC=xC(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),FC=xC(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),IC=xC(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),LC=xC(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),RC=xC(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),zC=xC(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),BC=xC(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),VC=xC(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),HC=xC(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),UC=xC(`clock`,[[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),WC=xC(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),GC=xC(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),KC=xC(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),qC=xC(`file-text`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),JC=xC(`git-branch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),YC=xC(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),XC=xC(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),ZC=xC(`git-pull-request-closed`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`m21 3-6 6`,key:`16nqsk`}],[`path`,{d:`m21 9-6-6`,key:`9j17rh`}],[`path`,{d:`M18 11.5V15`,key:`65xf6f`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),QC=xC(`git-pull-request-draft`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M18 6V5`,key:`1oao2s`}],[`path`,{d:`M18 11v-1`,key:`11c8tz`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),$C=xC(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),ew=xC(`github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),tw=xC(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),nw=xC(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),rw=xC(`image-plus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),iw=xC(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),aw=xC(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),ow=xC(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),sw=xC(`list-checks`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),cw=xC(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),lw=xC(`message-square-code`,[[`path`,{d:`M10 7.5 8 10l2 2.5`,key:`xb17xw`}],[`path`,{d:`m14 7.5 2 2.5-2 2.5`,key:`5rap1v`}],[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),uw=xC(`message-square`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),dw=xC(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),fw=xC(`package-check`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),pw=xC(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),mw=xC(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),hw=xC(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),gw=xC(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),_w=xC(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),vw=xC(`repeat`,[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]),yw=xC(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),bw=xC(`settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),xw=xC(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Sw=xC(`signpost`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M12 3v3`,key:`1n5kay`}],[`path`,{d:`M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z`,key:`gqqp9m`}]]),Cw=xC(`sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),ww=xC(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Tw=xC(`square-dot`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Ew=xC(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Dw=xC(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Ow=xC(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),kw=xC(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Aw=xC(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),jw=xC(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Mw({title:e,subtitle:t,icon:n,meta:r,actions:i,onClose:a,initialFocus:o}){return(0,V.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-2.5 border-b border-border bg-panel px-4`,children:[n,(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,title:e,children:e}),r]}),t&&(0,V.jsx)(`span`,{className:`truncate text-[10px] text-muted/60`,children:t})]}),i,(0,V.jsx)(`button`,{type:`button`,"aria-label":`Close`,onClick:a,...o?{"data-dialog-initial-focus":``}:{},className:`rounded-md p-1.5 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,V.jsx)(jw,{size:15})})]})}function Nw(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((e,n)=>Object.is(e,t[n]))}var Pw=class extends B.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[frizz] render error in ${this.props.label}:`,e,t.componentStack)}componentDidUpdate(e){!this.state.error||Nw(e.resetKeys,this.props.resetKeys)||this.setState({error:null})}retry=()=>this.setState({error:null});render(){let{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.retry):(0,V.jsx)(Iw,{label:this.props.label,error:e,onRetry:this.retry}):this.props.children}};function _ee(e){let t=e instanceof Error?`${e.name}: ${e.message}`:String(e);return t.length>300?`${t.slice(0,300)}…`:t}var Fw=`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`;function Iw({label:e,error:t,onRetry:n,onClose:r}){return(0,V.jsxs)(`div`,{"data-error-panel":!0,className:`m-4 rounded-md border border-border-strong bg-panel-2 px-3.5 py-3 text-[12.5px]`,children:[(0,V.jsxs)(`p`,{className:`text-fg/90`,children:[`Something went wrong rendering `,e,`.`]}),(0,V.jsx)(`p`,{className:`font-mono-keep mt-1.5 break-words text-[11.5px] text-muted`,children:_ee(t)}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,className:Fw,onClick:n,children:`Try again`}),r&&(0,V.jsx)(`button`,{type:`button`,className:Fw,onClick:r,children:`Close`}),(0,V.jsx)(`button`,{type:`button`,className:Fw,onClick:()=>window.location.reload(),children:`Reload frizz`})]})]})}function Lw({children:e}){return(0,V.jsx)(Pw,{label:`frizz`,fallback:(e,t)=>(0,V.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-bg p-6 text-fg`,children:(0,V.jsx)(`div`,{className:`w-full max-w-lg`,children:(0,V.jsx)(Iw,{label:`frizz`,error:e,onRetry:t})})}),children:e})}function Rw({id:e,depth:t,widthDepth:n,error:r,onRetry:i}){let a=()=>{Z.drawers=Z.drawers.filter(t=>t.id!==e)};return(0,V.jsx)(pC,{id:e,depth:t,widthDepth:n,children:e=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Mw,{title:`This drawer could not be rendered`,onClose:()=>{e(),a()}}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:(0,V.jsx)(Iw,{label:`this drawer`,error:r,onRetry:i,onClose:a})})]})})}var zw=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Bw=/^[\\/]{2}/;function Vw(e,t){return t+e.replace(/\\/g,`/`)}var Hw=`popstate`;function Uw(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Ww(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Yw(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:Xw(t)}return Qw(t,n,null,e)}function Gw(e,t){if(e===!1||e==null)throw Error(t)}function Kw(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function qw(){return Math.random().toString(36).substring(2,10)}function Jw(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Yw(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Zw(t):t,state:n,key:t&&t.key||r||qw(),mask:i}}function Xw({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function Zw(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Qw(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=Uw(e)?e:Yw(h.location,e,t);n&&n(r,e),l=u()+1;let d=Jw(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=Uw(e)?e:Yw(h.location,e,t);n&&n(r,e),l=u();let i=Jw(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return $w(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Hw,d),c=e,()=>{i.removeEventListener(Hw,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function $w(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),Gw(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:Xw(t);return i=i.replace(/ $/,`%20`),!n&&Bw.test(i)&&(i=r+i),new URL(i,r)}var eT=class{#e=new Map;constructor(e){if(e)for(let[t,n]of e)this.set(t,n)}get(e){if(this.#e.has(e))return this.#e.get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){this.#e.set(e,t)}},tT=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function nT(e){return tT.has(e)}var rT=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function iT(e){return rT.has(e)}function aT(e){return e.index===!0}function oT(e){let t={};return e.Component&&Object.assign(t,{element:B.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:B.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:B.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function sT(e,t=oT,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(Gw(e.index!==!0||!e.children,`Cannot specify children on an index route`),Gw(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),aT(e)){let n={...e,id:s};return r[s]=cT(n,t(n)),n}else{let n={...e,id:s,children:void 0};return r[s]=cT(n,t(n)),e.children&&(n.children=sT(e.children,t,o,r,i)),n}})}function cT(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function lT(e,t,n=`/`){return uT(e,t,n,!1)}function uT(e,t,n,r,i){let a=MT((typeof t==`string`?Zw(t):t).pathname||`/`,n);if(a==null)return null;let o=i??fT(e),s=null,c=jT(a);for(let e=0;s==null&&e<o.length;++e)s=DT(o[e],c,r);return s}function dT(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,loaderData:t[n.id],handle:n.handle}}function fT(e){let t=pT(e);return hT(t),t}function pT(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;Gw(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=HT([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(Gw(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),pT(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:TT(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=AT(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of mT(e.path))a(e,t,!0,n)}),t}function mT(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=mT(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function hT(e){e.sort((e,t)=>e.score===t.score?ET(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var gT=/^:[\w-]+$/,_T=/^:[\w-]+/,vT=3.5,yT=3,bT=2,xT=1,ST=10,CT=-2,wT=e=>e===`*`;function TT(e,t){let n=e.split(`/`),r=n.length;return n.some(wT)&&(r+=CT),t&&(r+=bT),n.filter(e=>!wT(e)).reduce((e,t)=>e+(gT.test(t)?yT:_T.test(t)?vT:t===``?xT:ST),r)}function ET(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function DT(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?kT(u,l,s.matcher,s.compiledParams):OT(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=OT({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:HT([a,d.pathname]),pathnameBase:WT(HT([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=HT([a,d.pathnameBase]))}return o}function OT(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=AT(e.path,e.caseSensitive,e.end);return kT(e,t,n,r)}function kT(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function AT(e,t=!1,n=!0){Kw(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function jT(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return Kw(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function MT(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function NT({basename:e,pathname:t}){return t===`/`?e:HT([e,t])}var PT=e=>zw.test(e);function FT(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Zw(e):e,a;return n?(n=VT(n),a=n.startsWith(`/`)?IT(n.substring(1),`/`):IT(n,t)):a=t,{pathname:a,search:GT(r),hash:KT(i)}}function IT(e,t){let n=UT(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function LT(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function RT(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function zT(e){let t=RT(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function BT(e,t,n,r=!1){let i;typeof e==`string`?i=Zw(e):(i={...e},Gw(!i.pathname||!i.pathname.includes(`?`),LT(`?`,`pathname`,`search`,i)),Gw(!i.pathname||!i.pathname.includes(`#`),LT(`#`,`pathname`,`hash`,i)),Gw(!i.search||!i.search.includes(`#`),LT(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=FT(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var VT=e=>e.replace(/[\\/]{2,}/g,`/`),HT=e=>VT(e.join(`/`)),UT=e=>e.replace(/\/+$/,``),WT=e=>UT(e).replace(/^\/*/,`/`),GT=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,KT=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,qT=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],JT=class{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function YT(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function XT(e){return HT(e.map(e=>e.route.path).filter(Boolean))||`/`}function ZT(e,t){let n=new URL(typeof e==`string`||e instanceof URL?e:e.url),r=typeof t==`string`?Zw(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);let i=e.toString();n.search=i?`?${i}`:``}else n.search=``;return n.hash=r.hash||``,n}var QT=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function $T(e,t){let n=e;if(typeof n!=`string`||!zw.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(QT)try{let e=new URL(window.location.href),r=Bw.test(n)?new URL(Vw(n,e.protocol)):new URL(n),a=MT(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{Kw(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var eE=Symbol(`Uninstrumented`),tE=new WeakMap;function nE(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){e.lazy!=null&&n.lazy.push(e.lazy),e[`lazy.loader`]!=null&&n[`lazy.loader`].push(e[`lazy.loader`]),e[`lazy.action`]!=null&&n[`lazy.action`].push(e[`lazy.action`]),e[`lazy.middleware`]!=null&&n[`lazy.middleware`].push(e[`lazy.middleware`]),e.middleware!=null&&n.middleware.push(e.middleware),e.loader!=null&&n.loader.push(e.loader),e.action!=null&&n.action.push(e.action)}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=t.lazy;r.lazy=async(...t)=>cE(await lE(n.lazy,void 0,()=>e(...t),uE))}if(typeof t.lazy==`object`){let e=t.lazy;if(typeof e.middleware==`function`&&n[`lazy.middleware`].length>0){let t=e.middleware;r.lazy=Object.assign(r.lazy||{},{middleware:async(...e)=>cE(await lE(n[`lazy.middleware`],void 0,()=>t(...e),uE))})}if(typeof e.loader==`function`&&n[`lazy.loader`].length>0){let t=e.loader;r.lazy=Object.assign(r.lazy||{},{loader:async(...e)=>cE(await lE(n[`lazy.loader`],void 0,()=>t(...e),uE))})}if(typeof e.action==`function`&&n[`lazy.action`].length>0){let t=e.action;r.lazy=Object.assign(r.lazy||{},{action:async(...e)=>cE(await lE(n[`lazy.action`],void 0,()=>t(...e),uE))})}}if(typeof t.loader==`function`&&n.loader.length>0){let e=iE(t.loader),i=async(...t)=>cE(await lE(n.loader,dE(t[0]),()=>e(...t),uE));e.hydrate===!0&&(i.hydrate=!0),aE(i,e),r.loader=i}if(typeof t.action==`function`&&n.action.length>0){let e=iE(t.action),i=async(...t)=>cE(await lE(n.action,dE(t[0]),()=>e(...t),uE));aE(i,e),r.action=i}return t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=iE(e),r=async(...e)=>cE(await lE(n.middleware,dE(e[0]),()=>t(...e),uE));return aE(r,t),r})),r}function rE(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){e.navigate!=null&&n.navigate.push(e.navigate),e.fetch!=null&&n.fetch.push(e.fetch)}})),n.navigate.length>0){let t=iE(e.navigate),r=async(...r)=>{let[i,a]=r,o,s={to:typeof i==`number`||typeof i==`string`?i:i?Xw(i):`.`,...fE(e,a??{})};return cE(await lE(n.navigate,s,async()=>{if(typeof i==`number`)return await t(...r);let n=oE(e,e=>{o=e});try{return await t(...r)}finally{n()}},e=>({...uE(e),meta:o})))};aE(r,t),e.navigate=r}if(n.fetch.length>0){let t=iE(e.fetch),r=async(...r)=>{let[i,a,o,s]=r,c;return cE(await lE(n.fetch,{href:o??`.`,fetcherKey:i,...fE(e,s??{})},async()=>{let n=oE(e,e=>{c=e});try{return await t(...r)}finally{n()}},e=>({...uE(e),meta:c})))};aE(r,t),e.fetch=r}return e}function iE(e){return e[eE]??e}function aE(e,t){e[eE]=t}function oE(e,t){return tE.set(e,t),()=>{tE.get(e)===t&&tE.delete(e)}}function sE(e){let t=tE.get(e);return tE.delete(e),t}function cE(e){if(e.type===`error`)throw e.value;return e.value}async function lE(e,t,n,r,i={result:null,innerResult:null},a=e.length-1){let o=e[a];if(o){let s,c=async()=>(s?console.error(`You cannot call instrumented handlers more than once`):s=lE(e,t,n,r,i,a-1),await s,Gw(i.innerResult,`Expected an inner result`),i.innerResult);try{await o(c,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}s||await c(),await s}else{try{i.result={type:`success`,value:await n()}}catch(e){i.result={type:`error`,value:e}}i.innerResult=r(i.result,t)}return i.result?i.result:(i.result={type:`error`,value:Error(`No result assigned in instrumentation chain.`)},i.innerResult=r(i.result,t),i.result)}function uE(e){return e.type===`error`&&e.value instanceof Error?{status:`error`,error:e.value}:{status:`success`,error:void 0}}function dE(e){let{request:t,context:n,params:r}=e;return{...e,request:pE(t),params:{...r},context:mE(n)}}function fE(e,t){return{currentUrl:Xw(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function pE(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function mE(e){return{get:t=>e.get(t)}}var hE=[`POST`,`PUT`,`PATCH`,`DELETE`],gE=new Set(hE),_E=[`GET`,...hE],vE=new Set(_E),yE=new Set([301,302,303,307,308]),bE=new Set([307,308]),xE={state:`idle`,location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},vee={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},SE={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},CE=`remix-router-transitions`,wE=Symbol(`ResetLoaderData`),yee=class{#e;#t;#n;#r;constructor(e){this.#e=e,this.#t=fT(e)}get stableRoutes(){return this.#e}get activeRoutes(){return this.#n??this.#e}get branches(){return this.#r??this.#t}get hasHMRRoutes(){return this.#n!=null}setRoutes(e){this.#e=e,this.#t=fT(e)}setHmrRoutes(e){this.#n=e,this.#r=fT(e)}commitHmrRoutes(){this.#n&&(this.#e=this.#n,this.#t=this.#r,this.#n=void 0,this.#r=void 0)}};function bee(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;Gw(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties,a=i||(()=>({}));if(e.instrumentations){let t=e.instrumentations;a=e=>({...i?.(e),...nE(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=new yee(sT(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||Tee,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,g=null,_=e.hydrationData!=null,v=uT(s.activeRoutes,e.history.location,c,!1,s.branches),y=!1,b=null,x,S;if(v==null&&!e.patchRoutesOnNavigation){let t=iD(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=rD(s.activeRoutes);x=!0,S=!x,v=n,b={[r.id]:t}}else if(v&&!e.hydrationData&&Je(v,s.activeRoutes,e.history.location.pathname).active&&(v=null),!v){x=!1,S=!x,v=[];let t=Je(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}else if(v.some(e=>e.route.lazy))x=!1,S=!x;else if(!v.some(e=>OE(e.route)))x=!0,S=!x;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=v;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}S=!1,x=!0,r.forEach(e=>{let r=kE(e.route,t,n);S||=r.renderFallback,x&&=!r.shouldLoad})}let C,w={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,renderFallback:S,navigation:xE,restoreScrollPosition:e.hydrationData==null?null:!1,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},T=`POP`,E=null,D=!1,O,k=!1,A=new Map,j=null,M=!1,N=!1,P=new Set,ee=new Map,F=0,te=-1,ne=new Map,re=new Set,ie=new Map,ae=new Map,oe=new Set,se=new Map,ce,le=null;function ue(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(ce){ce(),ce=void 0;return}Kw(se.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=He({currentLocation:w.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{ce=e});e.history.go(r*-1),Ve(i,{state:`blocked`,location:n,proceed(){Ve(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(w.blockers);e.set(i,SE),pe({blockers:e})}}),E?.resolve(),E=null;return}return _e(t,n)}),n){Aee(t,A);let e=()=>DD(t,A);t.addEventListener(`pagehide`,e),j=()=>t.removeEventListener(`pagehide`,e)}return w.initialized||_e(`POP`,w.location,{initialHydration:!0}),C}function de(){d&&d(),j&&j(),f.clear(),O&&O.abort(),w.fetchers.forEach((e,t)=>Ne(w.fetchers,t)),w.blockers.forEach((e,t)=>Be(t))}function fe(e){if(f.add(e),p){let{newErrors:t}=p;p=null,e(w,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(e)}function pe(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),w={...w,...e};let n=[],r=[];w.fetchers.forEach((e,t)=>{e.state===`idle`&&(oe.has(t)?n.push(t):r.push(t))}),oe.forEach(e=>{!w.fetchers.has(e)&&!ee.has(e)&&n.push(e)}),f.size===0&&(p={newErrors:e.errors??null}),[...f].forEach(r=>r(w,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>Ne(w.fetchers,e)),r.forEach(e=>w.fetchers.delete(e))}function me(t,n,{flushSync:r}={}){let i=w.actionData!=null&&w.navigation.formMethod!=null&&vD(w.navigation.formMethod)&&w.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?w.actionData:null;let o=n.loaderData?eD(w.loaderData,n.loaderData,n.matches||[],n.errors):w.loaderData,c=w.blockers;c.size>0&&!M&&(c=new Map(c),c.forEach((e,t)=>c.set(t,SE)));let l=M?!1:qe(t,n.matches||w.matches),u=D===!0||w.navigation.formMethod!=null&&vD(w.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),M||T===`POP`||(T===`PUSH`?e.history.push(t,t.state):T===`REPLACE`&&e.history.replace(t,t.state));let d;if(T===`POP`){let e=A.get(w.location.pathname);e&&e.has(t.pathname)?d={currentLocation:w.location,nextLocation:t}:A.has(t.pathname)&&(d={currentLocation:t,nextLocation:w.location})}else if(k){let e=A.get(w.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),A.set(w.location.pathname,e)),d={currentLocation:w.location,nextLocation:t}}pe({...n,actionData:a,loaderData:o,historyAction:T,location:t,initialized:!0,renderFallback:!1,navigation:xE,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),T=`POP`,D=!1,k=!1,M=!1,N=!1,E?.resolve(),E=null,le?.resolve(),le=null}async function he(t,n){if(E?.resolve(),E=null,typeof t==`number`){E||=OD();let n=E.promise;return e.history.go(t),n}let r=sE(C),{path:i,submission:a,error:o}=EE(!1,TE(w.location,w.matches,c,t,n?.fromRouteId,n?.relative),n),s;n?.mask&&(s={pathname:``,search:``,hash:``,...typeof n.mask==`string`?Zw(n.mask):{...w.location.mask,...n.mask}});let l=w.location,u=Yw(l,i,n&&n.state,void 0,s);u={...u,...e.history.encodeLocation(u)};let d=n&&n.replace!=null?n.replace:void 0,f=`PUSH`;d===!0?f=`REPLACE`:d===!1||a!=null&&vD(a.formMethod)&&a.formAction===w.location.pathname+w.location.search&&(f=`REPLACE`);let p=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,m=(n&&n.flushSync)===!0,h=He({currentLocation:l,nextLocation:u,historyAction:f});if(h){Ve(h,{state:`blocked`,location:u,proceed(){Ve(h,{state:`proceeding`,proceed:void 0,reset:void 0,location:u}),he(t,n)},reset(){let e=new Map(w.blockers);e.set(h,SE),pe({blockers:e})}});return}await _e(f,u,{submission:a,pendingError:o,preventScrollReset:p,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:m,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate,instrumentationNavigateMetaReceiver:r})}function ge(){le||=OD(),Oe(),pe({revalidation:`loading`});let e=le.promise;return w.navigation.state===`submitting`?e:w.navigation.state===`idle`?(_e(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),e):(_e(T||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:k===!0}),e)}async function _e(t,n,r){O&&O.abort(),O=null,T=t,M=(r&&r.startUninterruptedRevalidation)===!0,Ke(w.location,w.matches),D=(r&&r.preventScrollReset)===!0,k=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&w.matches&&w.matches.length>0&&!y?w.matches:uT(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&w.initialized&&!N&&Oee(w.location,n)&&!(r&&r.submission&&vD(r.submission.formMethod))){me(n,{matches:a},{flushSync:o});return}let l=Je(a,i,n.pathname);if(l.active&&l.matches&&(a=l.matches),r?.instrumentationNavigateMetaReceiver){let t=xD(e.history,n,a);r.instrumentationNavigateMetaReceiver(t)}if(!a){let{error:e,notFoundMatches:t,route:r}=Ue(n.pathname);me(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;O=new AbortController;let d=YE(e.history,n,O.signal,r&&r.submission),f=e.getContext?await e.getContext():new eT,p;if(r&&r.pendingError)p=[nD(a).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&vD(r.submission.formMethod)){let i=await ve(d,n,r.submission,a,t,f,l.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:o});if(i.shortCircuited)return;if(i.pendingActionResult){let[e,t]=i.pendingActionResult;if(dD(t)&&YT(t.error)&&t.error.status===404){O=null,me(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=CD(n,a,t,r.submission),o=!1,l.active=!1,d=YE(e.history,d.url,d.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_,workingFetchers:v}=await ye(d,n,a,t,f,l.active,u,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,o,p,r&&r.callSiteDefaultShouldRevalidate);m||(O=null,me(n,{matches:h||a,...tD(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function ve(t,n,i,l,u,d,f,p,m={}){if(Oe(),pe({navigation:wD(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await Ye(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=rD(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=nD(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}else if(e.matches)l=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Ue(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=bD(l,n);if(!g.route.action&&!g.route.lazy)h={type:`error`,error:iD(405,{method:t.method,pathname:n.pathname,routeId:g.route.id})};else{let e=await Ee(t,n,VE(a,o,t,n,l,g,p?[]:r,d),d,null);if(h=e[g.route.id],!h){for(let t of l)if(e[t.route.id]){h=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(fD(h)){let n;return n=m&&m.replace!=null?m.replace:JE(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===w.location.pathname+w.location.search,await Te(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(dD(h)){let e=nD(l,g.route.id);return(m&&m.replace)!==!0&&(T=`PUSH`),{matches:l,pendingActionResult:[e.route.id,h,g.route.id]}}return{matches:l,pendingActionResult:[g.route.id,h]}}async function ye(t,n,i,l,u,d,f,p,m,h,g,_,v,y){let b=f||CD(n,i,l,p),x=p||m||SD(b),S=!M&&!g;if(d){if(S){let e=be(v);pe({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await Ye(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=rD(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=nD(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}else if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Ue(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:T,revalidatingFetchers:E}=DE(t,u,a,o,e.history,w,i,x,n,g?[]:r,g===!0,N,P,oe,ie,re,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(te=++F,!e.dataStrategy&&!T.some(e=>e.shouldLoad)&&!T.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=new Map(w.fetchers),t=Le(e);return me(n,{matches:i,loaderData:{},errors:v&&dD(v[1])?{[v[0]]:v[1].error}:null,...tD(v),...t?{fetchers:e}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=be(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=xe(E)),pe(e,{flushSync:_})}E.forEach(e=>{Fe(e.key),e.controller&&ee.set(e.key,e.controller)});let D=()=>E.forEach(e=>Fe(e.key));O&&O.signal.addEventListener(`abort`,D);let{loaderResults:k,fetcherResults:A}=await De(T,E,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener(`abort`,D),E.forEach(e=>ee.delete(e.key));let j=aD(k);if(j)return await Te(t,j.result,!0,{replace:h}),{shortCircuited:!0};if(j=aD(A),j)return re.add(j.key),await Te(t,j.result,!0,{replace:h}),{shortCircuited:!0};let ne=new Map(w.fetchers),{loaderData:ae,errors:se}=$E(w,i,k,v,E,A,ne);g&&w.errors&&(se={...w.errors,...se});let ce=Le(ne),le=Re(te,ne),ue=ce||le||E.length>0;return{matches:i,loaderData:ae,errors:se,...ue?{workingFetchers:ne}:{}}}function be(e){if(e&&!dD(e[1]))return{[e[0]]:e[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function xe(e){let t=new Map(w.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=TD(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function Se(t,n,r,i){Fe(t);let a=(i&&i.flushSync)===!0,o=sE(C),l=s.activeRoutes,u=TE(w.location,w.matches,c,r,n,i?.relative),d=uT(l,u,c,!1,s.branches),f=Je(d,l,u);if(f.active&&f.matches&&(d=f.matches),o&&o(xD(e.history,u,d)),!d){Ae(t,n,iD(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=EE(!0,u,i);if(h){Ae(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new eT,_=(i&&i.preventScrollReset)===!0;if(m&&vD(m.formMethod)){await Ce(t,n,p,d,g,f.active,a,_,m,i&&i.defaultShouldRevalidate);return}ie.set(t,{routeId:n,path:p}),await we(t,n,p,d,g,f.active,a,_,m)}async function Ce(t,n,i,l,u,d,f,p,m,h){Oe(),ie.delete(t),ke(t,kee(m,w.fetchers.get(t)),{flushSync:f});let g=new AbortController,_=YE(e.history,i,g.signal,m);if(d){let e=await Ye(l,new URL(_.url).pathname,_.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ae(t,n,e.error,{flushSync:f});return}else if(e.matches)l=e.matches;else{Ae(t,n,iD(404,{pathname:i}),{flushSync:f});return}}let v=bD(l,i);if(!v.route.action&&!v.route.lazy){Ae(t,n,iD(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}ee.set(t,g);let y=F,b=VE(a,o,_,i,l,v,r,u),x=await Ee(_,i,b,u,t),S=x[v.route.id];if(!S){for(let e of b)if(x[e.route.id]){S=x[e.route.id];break}}if(_.signal.aborted){ee.get(t)===g&&ee.delete(t);return}if(oe.has(t)){if(fD(S)||dD(S)){ke(t,ED(void 0));return}}else{if(fD(S))if(ee.delete(t),te>y){ke(t,ED(void 0));return}else return re.add(t),ke(t,TD(m)),Te(_,S,!1,{fetcherSubmission:m,preventScrollReset:p});if(dD(S)){Ae(t,n,S.error);return}}let C=w.navigation.location||w.location,E=YE(e.history,C,g.signal),D=s.activeRoutes,k=w.navigation.state===`idle`?w.matches:uT(D,w.navigation.location,c,!1,s.branches);Gw(k,`Didn't find any matches after fetcher action`);let A=++F;ne.set(t,A);let{dsMatches:j,revalidatingFetchers:M}=DE(E,u,a,o,e.history,w,k,m,C,r,!1,N,P,oe,ie,re,D,c,e.patchRoutesOnNavigation!=null,s.branches,[v.route.id,S],h),ae=TD(m,S.data),se=new Map(w.fetchers);se.set(t,ae),M.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=se.get(t),r=TD(void 0,n?n.data:void 0);se.set(t,r),Fe(t),e.controller&&ee.set(t,e.controller)}),pe({fetchers:se});let ce=()=>M.forEach(e=>Fe(e.key));g.signal.addEventListener(`abort`,ce);let{loaderResults:le,fetcherResults:ue}=await De(j,M,E,C,u);if(g.signal.aborted)return;g.signal.removeEventListener(`abort`,ce),ne.delete(t),ee.delete(t),M.forEach(e=>ee.delete(e.key));let de=w.fetchers.has(t),fe=e=>{if(!de)return e;let n=new Map(e.fetchers);return n.set(t,ED(S.data)),{...e,fetchers:n}},he=aD(le);if(he)return w=fe(w),Te(E,he.result,!1,{preventScrollReset:p});if(he=aD(ue),he)return re.add(he.key),w=fe(w),Te(E,he.result,!1,{preventScrollReset:p});let ge=new Map(w.fetchers);de&&ge.set(t,ED(S.data));let{loaderData:_e,errors:ve}=$E(w,k,le,void 0,M,ue,ge);Re(A,ge),w.navigation.state===`loading`&&A>te?(Gw(T,`Expected pending action`),O&&O.abort(),me(w.navigation.location,{matches:k,loaderData:_e,errors:ve,fetchers:ge})):(pe({errors:ve,loaderData:eD(w.loaderData,_e,k,ve),fetchers:ge}),N=!1)}async function we(t,n,i,s,c,l,u,d,f){let p=w.fetchers.get(t);ke(t,TD(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=YE(e.history,i,m.signal);if(l){let e=await Ye(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ae(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{Ae(t,n,iD(404,{pathname:i}),{flushSync:u});return}}let g=bD(s,i);ee.set(t,m);let _=F,v=await Ee(h,i,VE(a,o,h,i,s,g,r,c),c,t),y=v[g.route.id];if(!y){for(let e of s)if(v[e.route.id]){y=v[e.route.id];break}}if(ee.get(t)===m&&ee.delete(t),!h.signal.aborted){if(oe.has(t)){ke(t,ED(void 0));return}if(fD(y))if(te>_){ke(t,ED(void 0));return}else{re.add(t),await Te(h,y,!1,{preventScrollReset:d});return}if(dD(y)){Ae(t,n,y.error);return}ke(t,ED(y.data))}}async function Te(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(E?.resolve(),E=null),i.response.headers.has(`X-Remix-Revalidate`)&&(N=!0);let d=i.response.headers.get(`Location`);Gw(d,`Expected a Location header on the redirect Response`),d=JE(d,new URL(r.url),c,e.history);let f=Yw(w.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(PT(d)){let n=$w(t,d,!0);e=n.origin!==t.location.origin||MT(n.pathname,c)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}O=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:h,formEncType:g}=w.navigation;!o&&!s&&m&&h&&g&&(o=SD(w.navigation));let _=o||s;bE.has(i.response.status)&&_&&vD(_.formMethod)?await _e(p,f,{submission:{..._,formAction:d},preventScrollReset:l||D,enableViewTransition:a?k:void 0}):await _e(p,f,{overrideNavigation:CD(f,[],p,o),fetcherSubmission:s,preventScrollReset:l||D,enableViewTransition:a?k:void 0})}async function Ee(e,t,n,r,i){let a,o={};try{a=await HE(l,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!vD(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!w.loaderData.hasOwnProperty(e.route.id)&&(!w.errors||!w.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(uD(r)){let i=r.result;o[t]={type:`redirect`,response:GE(i,e,t,n,c)}}else o[t]=await WE(r);return o}async function De(e,t,n,r,i){let a=Ee(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await Ee(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}else return Promise.resolve({[e.key]:{type:`error`,error:iD(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function Oe(){N=!0,ie.forEach((e,t)=>{ee.has(t)&&P.add(t),Fe(t)})}function ke(e,t,n={}){let r=new Map(w.fetchers);r.set(e,t),pe({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function Ae(e,t,n,r={}){let i=nD(w.matches,t),a=new Map(w.fetchers);Ne(a,e),pe({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function je(e){return ae.set(e,(ae.get(e)||0)+1),oe.has(e)&&oe.delete(e),w.fetchers.get(e)||vee}function Me(e,t){Fe(e,t?.reason),ke(e,ED(null))}function Ne(e,t){let n=w.fetchers.get(t);ee.has(t)&&!(n&&n.state===`loading`&&ne.has(t))&&Fe(t),ie.delete(t),ne.delete(t),re.delete(t),oe.delete(t),P.delete(t),e.delete(t)}function Pe(e){let t=(ae.get(e)||0)-1;t<=0?(ae.delete(e),oe.add(e)):ae.set(e,t),pe({fetchers:new Map(w.fetchers)})}function Fe(e,t){let n=ee.get(e);n&&(n.abort(t),ee.delete(e))}function Ie(e,t){for(let n of e){let e=t.get(n);Gw(e,`Expected fetcher: ${n}`);let r=ED(e.data);t.set(n,r)}}function Le(e){let t=[],n=!1;for(let r of re){let i=e.get(r);Gw(i,`Expected fetcher: ${r}`),i.state===`loading`&&(re.delete(r),t.push(r),n=!0)}return Ie(t,e),n}function Re(e,t){let n=[];for(let[r,i]of ne)if(i<e){let e=t.get(r);Gw(e,`Expected fetcher: ${r}`),e.state===`loading`&&(Fe(r),ne.delete(r),n.push(r))}return Ie(n,t),n.length>0}function ze(e,t){let n=w.blockers.get(e)||SE;return se.get(e)!==t&&se.set(e,t),n}function Be(e){w.blockers.delete(e),se.delete(e)}function Ve(e,t){let n=w.blockers.get(e)||SE;Gw(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(w.blockers);r.set(e,t),pe({blockers:r})}function He({currentLocation:e,nextLocation:t,historyAction:n}){if(se.size===0)return;se.size>1&&Kw(!1,`A router only supports one blocker at a time`);let r=Array.from(se.entries()),[i,a]=r[r.length-1],o=w.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Ue(e){let t=iD(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=rD(n);return{notFoundMatches:r,route:i,error:t}}function We(e,t,n){if(m=e,g=t,h=n||null,!_&&w.navigation===xE){_=!0;let e=qe(w.location,w.matches);e!=null&&pe({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Ge(e,t){return h&&h(e,t.map(e=>dT(e,w.loaderData)))||e.key}function Ke(e,t){if(m&&g){let n=Ge(e,t);m[n]=g()}}function qe(e,t){if(m){let n=Ge(e,t),r=m[n];if(typeof r==`number`)return r}return null}function Je(t,n,r){if(e.patchRoutesOnNavigation){let e=s.branches;if(!t)return{active:!0,matches:uT(n,r,c,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:uT(n,r,c,!0,e)}}return{active:!1,matches:null}}async function Ye(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let l=t;for(;;){let t=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:l,fetcherKey:i,patch:(e,n)=>{r.aborted||jE(e,n,s,t,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}if(r.aborted)return{type:`aborted`};let u=s.branches,d=uT(s.activeRoutes,n,c,!1,u),f=null;if(d&&(Object.keys(d[0].params).length===0||(f=uT(s.activeRoutes,n,c,!0,u),!(f&&l.length<f.length&&Xe(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||=uT(s.activeRoutes,n,c,!0,u),!f||Xe(l,f))return{type:`success`,matches:null};l=f}}function Xe(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function Ze(e){o={},s.setHmrRoutes(sT(e,a,void 0,o))}function Qe(e,t,n=!1){jE(e,t,s,o,a,n),s.hasHMRRoutes||pe({})}return C={get basename(){return c},get future(){return u},get state(){return w},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:ue,subscribe:fe,enableScrollRestoration:We,navigate:he,fetch:Se,revalidate:ge,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:je,resetFetcher:Me,deleteFetcher:Pe,dispose:de,getBlocker:ze,deleteBlocker:Be,patchRoutes:Qe,_internalFetchControllers:ee,_internalSetRoutes:Ze,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){pe(e)}},e.instrumentations&&(C=rE(C,e.instrumentations.map(e=>e.router).filter(Boolean))),C}function xee(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function TE(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=BT(r||`.`,zT(o),MT(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=yD(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=NT({basename:n,pathname:c.pathname})),Xw(c)}function EE(e,t,n){if(!n||!xee(n))return{path:t};if(n.formMethod&&!_D(n.formMethod))return{path:t,error:iD(405,{method:n.formMethod})};let r=()=>({path:t,error:iD(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=oD(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!vD(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}\n`,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}else if(n.formEncType===`application/json`){if(!vD(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}Gw(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=XE(n.formData),s=n.formData;else if(n.body instanceof FormData)o=XE(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=ZE(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=ZE(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(vD(c.formMethod))return{path:t,submission:c};let l=Zw(t);return e&&l.search&&yD(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:Xw(l),submission:c}}function DE(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let S=b?dD(b[1])?b[1].error:b[1].data:void 0,C=i.createURL(a.location),w=i.createURL(c),T;if(u&&a.errors){let e=Object.keys(a.errors)[0];T=o.findIndex(t=>t.route.id===e)}else if(b&&dD(b[1])){let e=b[0];T=o.findIndex(t=>t.route.id===e)-1}let E=b?b[1].statusCode:void 0,D=E&&E>=400,O={currentUrl:C,currentParams:a.matches[0]?.params||{},nextUrl:w,nextParams:o[0].params,...s,actionResult:S,actionStatus:E},k=XT(o),A=o.map((i,o)=>{let{route:s}=i,f=null;if(T!=null&&o>T)f=!1;else if(s.lazy)f=!0;else if(!OE(s))f=!1;else if(u){let{shouldLoad:e}=kE(s,a.loaderData,a.errors);f=e}else See(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return BE(n,r,e,c,k,i,l,t,f);let p=!1;typeof x==`boolean`?p=x:D?p=!1:d||C.pathname+C.search===w.pathname+w.search?p=!0:C.search===w.search?Cee(a.matches[o],i)&&(p=!0):p=!0;let m={...O,defaultShouldRevalidate:p};return BE(n,r,e,c,k,i,l,t,AE(i,m),m,x)}),j=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,b=uT(g,e.path,_??`/`,!1,y);if(!b){if(v&&m)return;j.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let S=bD(b,e.path),C=new AbortController,w=YE(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=VE(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=VE(n,r,w,e.path,b,S,l,t));else{let i;i=typeof x==`boolean`?x:D?!1:d;let a={...O,defaultShouldRevalidate:i};AE(S,a)&&(T=VE(n,r,w,e.path,b,S,l,t,a))}T&&j.push({key:s,routeId:e.routeId,path:e.path,matches:T,match:S,request:w,controller:C})}),{dsMatches:A,revalidatingFetchers:j}}function OE(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function kE(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!OE(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function See(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function Cee(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function AE(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function jE(e,t,n,r,i,a){let o;if(e){let t=r[e];Gw(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>ME(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=sT(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=sT([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function ME(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>ME(e,t)))??!1:!1}var NE=new WeakMap,PE=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(Gw(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=NE.get(i);o||(o={},NE.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=nT(e),n=i[e]!==void 0;if(t)Kw(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)Kw(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},FE=new WeakMap;function wee(e,t,n,r,i){let a=n[e.id];if(Gw(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=FE.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{Gw(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=iT(e),o=a[e]!==void 0;i?Kw(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?Kw(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return FE.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=PE({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function IE(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function Tee(e){return e.matches.some(e=>e.route.middleware)?LE(e,()=>IE(e)):IE(e)}function LE(e,t){return Eee(e,t,e=>{if(gD(e))throw e;return e},cD,n);async function n(t,n,r){if(r)return Object.assign(r.value,{[n]:{type:`error`,result:t}});{let{matches:r}=e,i=Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0)),a=r[i].route.id;for(let e of r.slice(0,i+1))try{await e._lazyPromises?.route}catch{a=e.route.id;break}return{[nD(r,a).route.id]:{type:`error`,result:t}}}}}async function Eee(e,t,n,r,i){let{matches:a,...o}=e;return await RE(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function RE(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await RE(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function zE(e,t,n,r,i){let a=PE({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=wee(r.route,vD(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function BE(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=zE(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?AE(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?AE(a,{...l,defaultShouldRevalidate:e}):AE(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!vD(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(vD(n.method)||!p)?UE({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function VE(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?BE(e,t,n,r,XT(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:zE(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function HE(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,url:ZT(t,n),pattern:XT(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return LE(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function UE({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=vD(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,url:ZT(e,t),pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a)if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw iD(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}else if(t)c=await f(t);else{let t=new URL(e.url);throw iD(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function Dee(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function WE(e){let{result:t,type:n}=e;if(mD(t)){let e;try{e=await Dee(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new JT(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?pD(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:sD(t),statusCode:YT(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:YT(t)?t.status:void 0}:pD(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function GE(e,t,n,r,i){let a=e.headers.get(`Location`);if(Gw(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!PT(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=TE(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var KE=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function qE(e){try{return KE.includes(new URL(e).protocol)}catch{return!1}}function JE(e,t,n,r){if(PT(e)){let r=e,i=Bw.test(r)?new URL(Vw(r,t.protocol)):new URL(r);if(qE(i.toString()))throw Error(`Invalid redirect location`);let a=MT(i.pathname,n)!=null;if(i.origin===t.origin&&a)return VT(i.pathname)+i.search+i.hash}try{if(qE(r.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function YE(e,t,n,r){let i=e.createURL(oD(t)).toString(),a={signal:n};if(r&&vD(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):t===`text/plain`?a.body=r.text:t===`application/x-www-form-urlencoded`&&r.formData?a.body=XE(r.formData):a.body=r.formData}return new Request(i,a)}function XE(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function ZE(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function QE(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&dD(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(Gw(!fD(f),`Cannot handle redirect results in processLoaderData`),dD(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=nD(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=wE),c||(c=!0,s=YT(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function $E(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=QE(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(Gw(s,`Did not find corresponding fetcher result`),dD(s)){let t=nD(e.matches,r?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if(fD(s))Gw(!1,`Unhandled fetcher revalidation redirect`);else{let e=ED(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function eD(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==wE).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function tD(e){return e?dD(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function nD(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.ErrorBoundary!=null||e.route.errorElement!=null)||e[0]}function rD(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function iD(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new JT(e||500,o,Error(s),!0)}function aD(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(fD(r))return{key:n,result:r}}}function oD(e){return Xw({...typeof e==`string`?Zw(e):e,hash:``})}function Oee(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash?!0:t.hash!==``}function sD(e){return new JT(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function cD(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&lD(t))}function lD(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function uD(e){return mD(e.result)&&yE.has(e.result.status)}function dD(e){return e.type===`error`}function fD(e){return(e&&e.type)===`redirect`}function pD(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function mD(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function hD(e){return yE.has(e)}function gD(e){return mD(e)&&hD(e.status)&&e.headers.has(`Location`)}function _D(e){return vE.has(e.toUpperCase())}function vD(e){return gE.has(e.toUpperCase())}function yD(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function bD(e,t){let n=typeof t==`string`?Zw(t).search:t.search;if(e[e.length-1].route.index&&yD(n||``))return e[e.length-1];let r=RT(e);return r[r.length-1]}function xD(e,t,n){return{url:ZT(e.createURL(t),t),pattern:n?XT(n):``,params:n?.[0]?.params?{...n[0].params}:{}}}function SD(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function CD(e,t,n,r){return r?{state:`loading`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:`loading`,location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function wD(e,t,n,r){return{state:`submitting`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function TD(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function kee(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function ED(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Aee(e,t){try{let n=e.sessionStorage.getItem(CE);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function DD(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(CE,JSON.stringify(n))}catch(e){Kw(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function OD(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var kD=B.createContext(null);kD.displayName=`DataRouter`;var AD=B.createContext(null);AD.displayName=`DataRouterState`;var jD=B.createContext(!1);function MD(){return B.useContext(jD)}var ND=B.createContext({isTransitioning:!1});ND.displayName=`ViewTransition`;var PD=B.createContext(new Map);PD.displayName=`Fetchers`;var FD=B.createContext(null);FD.displayName=`Await`;var ID=B.createContext(null);ID.displayName=`Navigation`;var LD=B.createContext(null);LD.displayName=`Location`;var RD=B.createContext({outlet:null,matches:[],isDataRoute:!1});RD.displayName=`Route`;var zD=B.createContext(null);zD.displayName=`RouteError`;var BD=`REACT_ROUTER_ERROR`,VD=`REDIRECT`,HD=`ROUTE_ERROR_RESPONSE`;function UD(e){if(e.startsWith(`${BD}:${VD}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function WD(e){if(e.startsWith(`${BD}:${HD}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new JT(t.status,t.statusText,t.data)}catch{}}function GD(e,{relative:t}={}){Gw(KD(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=B.useContext(ID),{hash:i,pathname:a,search:o}=eO(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:HT([n,a])),r.createHref({pathname:s,search:o,hash:i})}function KD(){return B.useContext(LD)!=null}function qD(){return Gw(KD(),`useLocation() may be used only in the context of a <Router> component.`),B.useContext(LD).location}var JD=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function YD(){let{isDataRoute:e}=B.useContext(RD);return e?vO():XD()}function XD(){Gw(KD(),`useNavigate() may be used only in the context of a <Router> component.`);let e=B.useContext(kD),{basename:t,navigator:n}=B.useContext(ID),{matches:r}=B.useContext(RD),{pathname:i}=qD(),a=JSON.stringify(zT(r)),o=B.useRef(!1);return B.useLayoutEffect(()=>{o.current=!0}),B.useCallback((r,s={})=>{if(Kw(o.current,JD),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=BT(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:HT([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var ZD=B.createContext(null);function QD(e){let t=B.useContext(RD).outlet;return B.useMemo(()=>t&&B.createElement(ZD.Provider,{value:e},t),[t,e])}function $D(){let{matches:e}=B.useContext(RD);return e[e.length-1]?.params??{}}function eO(e,{relative:t}={}){let{matches:n}=B.useContext(RD),{pathname:r}=qD(),i=JSON.stringify(zT(n));return B.useMemo(()=>BT(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function tO(e,t,n){Gw(KD(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=B.useContext(ID),{matches:i}=B.useContext(RD),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=qD(),l;if(t){let e=typeof t==`string`?Zw(t):t;Gw(s===`/`||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),l=e}else l=c;let u=l.pathname||`/`,d=u;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);d=`/`+u.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let f=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):lT(e,{pathname:d}),p=cO(f&&f.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:HT([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:HT([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&p?B.createElement(LD.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},p):p}function nO(){let e=_O(),t=YT(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return B.createElement(B.Fragment,null,B.createElement(`h2`,null,`Unexpected Application Error!`),B.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?B.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var rO=B.createElement(nO,null),iO=class extends B.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=jD;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=WD(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:B.createElement(RD.Provider,{value:this.props.routeContext},B.createElement(zD.Provider,{value:e,children:this.props.component}));return this.context?B.createElement(oO,{error:e},t):t}},aO=new WeakMap;function oO({children:e,error:t}){let{basename:n}=B.useContext(ID);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=UD(t.digest);if(e){let r=aO.get(t);if(r)throw r;let i=$T(e.location,n),a=i.absoluteURL||i.to;if(qE(a))throw Error(`Invalid redirect location`);if(QT&&!aO.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw aO.set(t,n),n}return B.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function sO({routeContext:e,match:t,children:n}){let r=B.useContext(kD);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),B.createElement(RD.Provider,{value:e},n)}function cO(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);Gw(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:XT(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||rO,o&&(s<0&&c===0?(bO(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?B.createElement(n.route.Component,null):n.route.element?n.route.element:e,B.createElement(sO,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?B.createElement(iO,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function lO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function uO(e){let t=B.useContext(kD);return Gw(t,lO(e)),t}function dO(e){let t=B.useContext(AD);return Gw(t,lO(e)),t}function fO(e){let t=B.useContext(RD);return Gw(t,lO(e)),t}function pO(e){let t=fO(e),n=t.matches[t.matches.length-1];return Gw(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function mO(){return pO(`useRouteId`)}function hO(){let e=dO(`useNavigation`);return B.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function gO(){let{matches:e,loaderData:t}=dO(`useMatches`);return B.useMemo(()=>e.map(e=>dT(e,t)),[e,t])}function _O(){let e=B.useContext(zD),t=dO(`useRouteError`),n=pO(`useRouteError`);return e===void 0?t.errors?.[n]:e}function vO(){let{router:e}=uO(`useNavigate`),t=pO(`useNavigate`),n=B.useRef(!1);return B.useLayoutEffect(()=>{n.current=!0}),B.useCallback(async(r,i={})=>{Kw(n.current,JD),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var yO={};function bO(e,t,n){!t&&!yO[e]&&(yO[e]=!0,Kw(!1,n))}var xO={};function SO(e,t){!e&&!xO[t]&&(xO[t]=!0,console.warn(t))}var CO=[`HydrateFallback`,`hydrateFallbackElement`],jee=class{status=`pending`;promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function Mee({router:e,flushSync:t,onError:n,useTransitions:r}){r=MD()||r;let[i,a]=B.useState(e.state),[o,s]=(0,B.useOptimistic)(i),[c,l]=B.useState(),[u,d]=B.useState({isTransitioning:!1}),[f,p]=B.useState(),[m,h]=B.useState(),[g,_]=B.useState(),v=B.useRef(new Map),y=B.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:g})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},pattern:XT(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&v.current.set(t,e.data)}),o.forEach(e=>v.current.delete(e)),SO(u===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let y=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(SO(g==null||y,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!g||!y){t&&u?t(()=>a(i)):r===!1?a(i):B.startTransition(()=>{r===!0&&s(e=>wO(e,i)),a(i)});return}if(t&&u){t(()=>{m&&(f?.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})})}),t(()=>h(n));return}m?(f?.resolve(),m.skipTransition(),_({state:i,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(l(i),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[e.window,t,m,f,r,s,n]);B.useLayoutEffect(()=>e.subscribe(y),[e,y]),B.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new jee)},[u]),B.useEffect(()=>{if(f&&c&&e.window){let t=c,n=f.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):B.startTransition(()=>{r===!0&&s(e=>wO(e,t)),a(t)}),await n});i.finished.finally(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})}),h(i)}},[c,f,e.window,r,s]),B.useEffect(()=>{f&&c&&o.location.key===c.location.key&&f.resolve()},[f,m,o.location,c]),B.useEffect(()=>{!u.isTransitioning&&g&&(l(g.state),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),_(void 0))},[u.isTransitioning,g]);let b=B.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),x=e.basename||`/`,S=B.useMemo(()=>({router:e,navigator:b,static:!1,basename:x,onError:n}),[e,b,x,n]);return B.createElement(B.Fragment,null,B.createElement(kD.Provider,{value:S},B.createElement(AD.Provider,{value:o},B.createElement(PD.Provider,{value:v.current},B.createElement(ND.Provider,{value:u},B.createElement(TO,{basename:x,location:o.location,navigationType:o.historyAction,navigator:b,useTransitions:r},B.createElement(Nee,{routes:e.routes,manifest:e.manifest,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function wO(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var Nee=B.memo(Pee);function Pee({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return tO(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Fee(e){return QD(e.context)}function TO({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){Gw(!KD(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=B.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Zw(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=B.useMemo(()=>{let e=MT(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return Kw(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:B.createElement(ID.Provider,{value:c},B.createElement(LD.Provider,{children:t,value:h}))}B.Component;var EO=`application/x-www-form-urlencoded`;function DO(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Iee(e){return DO(e)&&e.tagName.toLowerCase()===`button`}function Lee(e){return DO(e)&&e.tagName.toLowerCase()===`form`}function Ree(e){return DO(e)&&e.tagName.toLowerCase()===`input`}function zee(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function OO(e,t){return e.button===0&&(!t||t===`_self`)&&!zee(e)}var kO=null;function AO(){if(kO===null)try{new FormData(document.createElement(`form`),0),kO=!1}catch{kO=!0}return kO}var jO=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function MO(e){return e!=null&&!jO.has(e)?(Kw(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${EO}"`),null):e}function NO(e,t){let n,r,i,a,o;if(Lee(e)){let o=e.getAttribute(`action`);r=o?MT(o,t):null,n=e.getAttribute(`method`)||`get`,i=MO(e.getAttribute(`enctype`))||EO,a=new FormData(e)}else if(Iee(e)||Ree(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?MT(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=MO(e.getAttribute(`formenctype`))||MO(o.getAttribute(`enctype`))||EO,a=new FormData(o,e),!AO()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(DO(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=EO,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}function PO(e,t){if(e===!1||e==null)throw Error(t)}var FO={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},IO=/[&><\u2028\u2029]/g;function LO(e){return e.replace(IO,e=>FO[e])}function RO(e,t){let n=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n.pathname.endsWith(`/`)?n.pathname=`${n.pathname}_.${t}`:n.pathname=`${n.pathname}.${t}`,n}var zO=`modulepreload`,BO=function(e){return`/`+e},VO={},HO=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=BO(t,n),t=s(t),t in VO)return;VO[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:zO,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};async function UO(e,t){if(e.id in t)return t[e.id];try{let n=await HO(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function WO(e){return e!=null&&typeof e.page==`string`}function GO(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function KO(e,t,n){return ZO((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await UO(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(GO).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function qO(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function JO(e,t,{includeHydrateFallback:n}={}){return YO(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function YO(e){return[...new Set(e)]}function XO(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ZO(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!WO(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(XO(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function QO(){let e=B.useContext(kD);return PO(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function $O(){let e=B.useContext(AD);return PO(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var ek=B.createContext(void 0);ek.displayName=`FrameworkContext`;function tk(){let e=B.useContext(ek);return PO(e,`You must render this element inside a <HydratedRouter> element`),e}function nk(e,t){let n=B.useContext(ek),[r,i]=B.useState(!1),[a,o]=B.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=B.useRef(null);B.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),B.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:rk(s,p),onBlur:rk(c,m),onMouseEnter:rk(l,p),onMouseLeave:rk(u,m),onTouchStart:rk(d,p)}]:[a,f,{}]:[!1,f,{}]}function rk(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function ik({page:e,...t}){let n=MD(),{nonce:r}=tk(),{router:i}=QO(),a=B.useMemo(()=>lT(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?B.createElement(ok,{page:e,matches:a,...t}):B.createElement(sk,{page:e,matches:a,...t})):null}function ak(e){let{manifest:t,routeModules:n}=tk(),[r,i]=B.useState([]);return B.useEffect(()=>{let r=!1;return KO(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function ok({page:e,matches:t,...n}){let r=qD(),i=B.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=RO(e,`rsc`),i=!1,a=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?i=!0:a.push(e.route.id);return i&&a.length>0&&n.searchParams.set(`_routes`,a.join(`,`)),[n.pathname+n.search]},[e,r,t]);return B.createElement(B.Fragment,null,i.map(e=>B.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function sk({page:e,matches:t,...n}){let r=qD(),{manifest:i,routeModules:a}=tk(),{loaderData:o,matches:s}=$O(),c=B.useMemo(()=>qO(e,t,s,i,r,`data`),[e,t,s,i,r]),l=B.useMemo(()=>qO(e,t,s,i,r,`assets`),[e,t,s,i,r]),u=B.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];!t||!t.hasLoader||(!c.some(t=>t.route.id===e.route.id)&&e.route.id in o&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let l=RO(e,`data`);return s&&n.size>0&&l.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[l.pathname+l.search]},[o,r,i,c,t,e,a]),d=B.useMemo(()=>JO(l,i),[l,i]),f=ak(l);return B.createElement(B.Fragment,null,u.map(e=>B.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),d.map(e=>B.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),f.map(({key:e,link:t})=>B.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function ck(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var lk=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{lk&&(window.__reactRouterVersion=`8.3.0`)}catch{}function uk(e,t){return bee({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:Ww({window:t?.window}),hydrationData:t?.hydrationData||dk(),routes:e,mapRouteProperties:oT,hydrationRouteProperties:CO,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function dk(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:fk(e.errors)}),e}function fk(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new JT(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&qT.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}function pk({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=B.useState({action:n.action,location:n.location}),o=B.useCallback(e=>{r===!1?a(e):B.startTransition(()=>a(e))},[r]);return B.useLayoutEffect(()=>n.listen(o),[n,o]),B.createElement(TO,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}pk.displayName=`unstable_HistoryRouter`;var mk=B.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=B.useContext(ID),v=typeof l==`string`&&zw.test(l),y=$T(l,h);l=y.to;let b=GD(l,{relative:r}),x=qD(),S=null;if(o){let e=BT(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:HT([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=nk(n,p),E=xk(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=B.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:ck(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?B.createElement(B.Fragment,null,k,B.createElement(ik,{page:b})):k});mk.displayName=`Link`;var hk=B.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=eO(a,{relative:c.relative}),d=qD(),f=B.useContext(AD),{navigator:p,basename:m}=B.useContext(ID),h=f!=null&&jk(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=MT(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(y)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return B.createElement(mk,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});hk.displayName=`NavLink`;var gk=B.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=B.useContext(ID),g=wk(),_=Tk(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&zw.test(s);return B.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?B.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});gk.displayName=`Form`;function _k({getKey:e,storageKey:t,...n}){let r=B.useContext(ek),{basename:i}=B.useContext(ID),a=qD(),o=gO();kk({getKey:e,storageKey:t});let s=B.useMemo(()=>{if(!r||!e)return null;let t=Ok(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),B.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${LO(JSON.stringify(t||Ek))}, ${LO(JSON.stringify(s))})`}})}_k.displayName=`ScrollRestoration`;function vk(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yk(e){let t=B.useContext(kD);return Gw(t,vk(e)),t}function bk(e){let t=B.useContext(AD);return Gw(t,vk(e)),t}function xk(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=YD(),d=qD(),f=eO(e,{relative:o});return B.useCallback(p=>{if(OO(p,t)){p.preventDefault();let t=n===void 0?Xw(d)===Xw(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?B.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var Sk=0,Ck=()=>`__${String(++Sk)}__`;function wk(){let{router:e}=yk(`useSubmit`),{basename:t}=B.useContext(ID),n=mO(),r=e.fetch,i=e.navigate;return B.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=NO(e,t);a.navigate===!1?await r(a.fetcherKey||Ck(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Tk(e,{relative:t}={}){let{basename:n}=B.useContext(ID),r=B.useContext(RD);Gw(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...eO(e||`.`,{relative:t})},o=qD();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:HT([n,a.pathname])),Xw(a)}var Ek=`react-router-scroll-positions`,Dk={};function Ok(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:MT(e.pathname,n)||e.pathname},t)),i??=e.key,i}function kk({getKey:e,storageKey:t}={}){let{router:n}=yk(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=bk(`useScrollRestoration`),{basename:a}=B.useContext(ID),o=qD(),s=gO(),c=hO();B.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Ak(B.useCallback(()=>{if(c.state===`idle`){let t=Ok(o,s,a,e);Dk[t]=window.scrollY}try{sessionStorage.setItem(t||Ek,JSON.stringify(Dk))}catch(e){Kw(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(B.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Ek);e&&(Dk=JSON.parse(e))}catch{}},[t]),B.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Dk,()=>window.scrollY,e?(t,n)=>Ok(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),B.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{Kw(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Ak(e,t){let{capture:n}=t||{};B.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function jk(e,{relative:t}={}){let n=B.useContext(ND);Gw(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=yk(`useViewTransitionState`),i=eO(e,{relative:t});if(!n.isTransitioning)return!1;let a=MT(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=MT(n.nextLocation.pathname,r)||n.nextLocation.pathname;return OT(i.pathname,o)!=null||OT(i.pathname,a)!=null}var Mk=class{currentSeq=-1;resync;interactionsInvalidated;constructor(e,t=()=>{}){this.resync=e,this.interactionsInvalidated=t}reset(){this.currentSeq=-1}handle(e){switch(e.type){case`board`:Yx(e.bootId),eC(e.board),this.currentSeq=typeof e.seq==`number`?e.seq:-1;break;case`board-delta`:switch(Yx(e.bootId),oy(this.currentSeq,e.seq)){case`apply`:rC(e)?this.currentSeq=e.seq:this.resync();break;case`ignore`:break;case`resync`:this.resync();break}break;case`notify`:Nk(e);break;case`interactions-invalidated`:this.interactionsInvalidated(e);break}}};function Nk(e){if(!Z.notificationsEnabled||!document.hidden||typeof Notification>`u`||Notification.permission!==`granted`)return;let t=new Notification(e.title,{body:e.body,tag:`${Sx()}/${e.slug}`}),n=bx()??Z.board?.projectSlug;t.onclick=()=>{window.focus(),n===void 0||bx()===n?US(e.slug):location.assign(`${xx(n)}/thread/${encodeURIComponent(e.slug)}`),t.close()}}var Pk=(e,t)=>[`interactions`,`pending`,e,t],Fk=(e,t,n)=>[`interactions`,`record`,e,t,n];function Ik(e,t){let n=Pk(t.owner.threadSlug,t.owner.sessionId);e.setQueryData(n,e=>e&&(t.lifecycle===`pending`?{interactions:e.interactions.map(e=>e.id===t.id?t:e)}:{interactions:e.interactions.filter(e=>e.id!==t.id)}))}function Lk(e,t){Ik(e,{...t,delivery:{effect:`reconnect-required`}})}async function Rk(e,t){await Promise.all([e.invalidateQueries({queryKey:Pk(t.slug,t.sessionId),exact:!0}),e.invalidateQueries({queryKey:Fk(t.slug,t.sessionId,t.interactionId),exact:!0})])}var zk=null,Bk=null,Vk=0,Hk=null,Uk=0,Wk=null,Gk=new Mk(()=>Yk(),e=>{Wk&&Rk(Wk,e)}),Kk=35e3;function qk(){if(zk)return;Z.connection!==`open`&&(Z.connection=`connecting`),zk=new EventSource(`${Tx()}/events`);let e=bx();if(Vk=Date.now(),zk.onopen=()=>{Bk&&=(clearTimeout(Bk),null),Uk=0,Vk=Date.now(),Z.connection=`open`},zk.addEventListener(`heartbeat`,()=>{Vk=Date.now()}),zk.onmessage=t=>{if(e===bx()){Vk=Date.now();try{Gk.handle(JSON.parse(t.data))}catch(e){console.error(`bad SSE event`,e)}}},zk.onerror=()=>Jk(),!Hk){Hk=setInterval(()=>{zk&&Date.now()-Vk>Kk&&Jk()},1e4);let e=()=>{(!zk||Date.now()-Vk>Kk)&&Jk(!0)};window.addEventListener(`focus`,e),window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,()=>{document.hidden||e()})}}function Jk(e=!1){if(zk?.close(),zk=null,Gk.reset(),Uk++,Z.connection=Uk>3?`closed`:`connecting`,Bk){if(!e)return;clearTimeout(Bk),Bk=null}let t=e?0:Math.min(1e3*2**Math.min(Uk-1,4),15e3);Bk=setTimeout(()=>{Bk=null,qk()},t)}function Yk(){Gk.reset(),zk?.close(),zk=null,qk()}function Xk(){Gk.reset(),zk?.close(),zk=null,Z.connection=`connecting`,qk()}function Zk(e){e&&(Wk=e),document.readyState===`complete`?qk():window.addEventListener(`load`,qk,{once:!0})}function Qk(e,t){let n=new Set(e.filter(e=>e.role===`user`&&e.sourceId).map(e=>e.sourceId));return t.filter(e=>e.role===`user`&&e.sourceId&&!n.has(e.sourceId)).map(e=>e.text.trim())}function $k(e,t){let n=new Set;for(let r of t)for(let t=0;t<e.length;t++){if(n.has(t))continue;let i=e[t].text.trim();if(r===i){n.add(t);break}if(!r.startsWith(i))continue;let a=i.length;for(let i=t+1;i<e.length&&!n.has(i);i++){let o=e[i].text.trim();if(!r.startsWith(`
318
-
319
- `,a)||!r.startsWith(o,a+2))break;if(a+=2+o.length,a===r.length){for(let e=t;e<=i;e++)n.add(e);break}}if(n.has(t))break}return n}function eA(e,t){if(!e?.length)return t;let n=e.filter(e=>e.queued&&!e.sourceId&&e.role===`user`&&e.text.trim());if(!n.length)return t;let r=new Set(t.map(e=>e.deliveryId).filter(e=>!!e)),i=$k(n,Qk(e,t)),a=n.filter((e,t)=>!i.has(t)&&!(e.deliveryId&&r.has(e.deliveryId)));if(!a.length)return t;let o=a.filter(n=>iA(n,rA(t),rA(e)));return o.length?[...t,...o]:t}var tA=6e4,nA=new WeakMap;function rA(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.queued&&!n.sourceId)continue;let r=n.at?Date.parse(n.at):NaN;if(Number.isFinite(r))return r}return NaN}function iA(e,t,n){if(!Number.isFinite(t))return!0;let r=nA.get(e);return r===void 0?(nA.set(e,Number.isFinite(n)?n:t),iA(e,t,n)):t-r<=tA?!0:(console.warn(`[frizz] retiring a stranded optimistic send: the transcript advanced past it without ever recording it`,{text:e.text.slice(0,120),advancedMs:t-r}),!1)}var aA=new WeakMap;function oA(e){let t=aA.get(e);return t===void 0&&(t=JSON.stringify(e),aA.set(e,t)),t}function sA(e,t){if(!e?.length||!t.length)return t;let n=new Map;for(let t of e)t.sourceId&&n.set(t.sourceId,t);if(!n.size)return t;let r=!1,i=t.map(e=>{if(e===n.get(e.sourceId??``))return e;let t=e.sourceId?n.get(e.sourceId):void 0;return t&&oA(t)===oA(e)?(r=!0,t):e});return r?i:t}function cA(e,t,n){if(!e)return!1;let r=Date.parse(e);if(!Number.isFinite(r))return!1;let i=t?Date.parse(t):0;return t&&!Number.isFinite(i)?!1:r-i>n}function lA(e){if(e)for(let t=e.length-1;t>=0;t--){let n=e[t].at;if(n)return n}}function uA(e,t){let n=Math.max(0,Math.min(e.length,t));for(let t=n-1;t>=0;t--)if(e[t].role===`user`)return t;return n>0?0:null}function dA(e,t,n){if(!t)return n;let r=e.findIndex(e=>e.sourceId===t);return r>=0?r:0}function fA(e,t){let n=new Map;e.forEach((e,t)=>{e.sourceId&&n.set(e.sourceId,t)});for(let e=0;e<t.length;e++){let r=t[e].sourceId,i=r?n.get(r):void 0;if(i!==void 0)return{previousIndex:i,incomingIndex:e}}}function pA(e,t){if(!e?.historyLoaded||e.transcriptKey!==t.transcriptKey)return t;let n=fA(e.messages,t.messages);return n?{...t,messages:[...e.messages.slice(0,n.previousIndex).filter(e=>!e.pinnedFromSourceId),...t.messages.slice(n.incomingIndex)],beforeCursor:e.beforeCursor,hasEarlier:e.hasEarlier,reachedTurnBoundary:e.reachedTurnBoundary,historyLoaded:!0}:t}function mA(e,t){if(!e)return{messages:[...t]};let n=fA(e.messages,t);return n?e.historyLoaded?{...e,messages:[...e.messages.slice(0,n.previousIndex).filter(e=>!e.pinnedFromSourceId),...t.slice(n.incomingIndex)]}:{...e,messages:[...t]}:{messages:[...t]}}function hA(e,t){if(e.transcriptKey!==t.transcriptKey)return e;let n=new Set(t.messages.map(e=>e.sourceId).filter(Boolean)),r=e.messages.filter(e=>!e.pinnedFromSourceId||!n.has(e.pinnedFromSourceId)),i=new Set(r.map(e=>e.sourceId).filter(Boolean)),a=t.messages.filter(e=>!e.sourceId||!i.has(e.sourceId));return{...e,messages:[...a,...r],beforeCursor:t.beforeCursor,hasEarlier:t.hasEarlier,reachedTurnBoundary:t.reachedTurnBoundary,historyLoaded:!0}}function gA(e,t=0){if(!e)return null;let n=[...e.querySelectorAll(`[data-transcript-source-id]`)].filter(e=>e.dataset.transcriptSticky!==`true`),r=n.find(e=>e.getBoundingClientRect().bottom>t)??n[0],i=r?.dataset.transcriptSourceId;return r&&i?{sourceId:i,top:r.getBoundingClientRect().top}:null}function _A(e,t){return t-e}function vA(e,t,n){if(!e||!t)return!1;let r=[...e.querySelectorAll(`[data-transcript-source-id]`)].find(e=>e.dataset.transcriptSourceId===t.sourceId);return r?(n(_A(t.top,r.getBoundingClientRect().top)),!0):!1}function yA(e){let{remaining:t,scrollY:n,maxScrollY:r,alreadyReserved:i}=e;return!(t>.5)||r<=0||i?`settle`:n>=r-1?`reserve`:`settle`}var bA=null,xA=null,SA=null,CA=null,wA=0,TA=0,EA=!1,DA=!1,OA=!1,kA=new Map,AA=new Mk(()=>VA(),e=>{xA&&Rk(xA,e)}),jA=35e3;function MA(){return`${location.origin.replace(/^http/,`ws`)}${Tx()}/ws`}var NA,PA=!1;function FA(){NA=bx(),PA=!0}function IA(e){return PA&&NA===e}function LA(){if(bA||OA)return;Z.connection!==`open`&&(Z.connection=`connecting`),FA();let e=new WebSocket(MA()),t=bx();bA=e,EA=!1,TA=Date.now(),e.onopen=()=>{DA=!0,TA=Date.now(),Z.connection=`open`,Z.socketTranscripts=!0,SA&&=(clearTimeout(SA),null)},e.onmessage=n=>{if(!(bA!==e||t!==bx())){TA=Date.now();try{let e=JSON.parse(n.data),t=GA(e);t&&(wA=0),t&&e.t===`event`&&e.event.type===`board`&&(EA=!0,qA())}catch(e){console.error(`bad /ws message`,e)}}},e.onerror=()=>{},e.onclose=()=>{bA===e&&(bA=null,zA())},HA()}function RA(){let e=bA;if(bA=null,EA=!1,e){e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}}function zA(){if(AA.reset(),!DA){WA();return}wA++,Z.connection=wA>3?`closed`:`connecting`,BA()}function BA(e=!1){if(SA){if(!e)return;clearTimeout(SA),SA=null}let t=e?0:Math.min(1e3*2**Math.min(wA-1,4),15e3);SA=setTimeout(()=>{SA=null,LA()},t)}function VA(){AA.reset(),RA(),LA()}function HA(){if(CA)return;CA=setInterval(()=>{bA&&Date.now()-TA>jA&&UA()},1e4);let e=()=>{OA||(!bA||Date.now()-TA>jA)&&UA(!0)};window.addEventListener(`focus`,e),window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,()=>{document.hidden||e()})}function UA(e=!1){if(!OA){if(RA(),AA.reset(),!DA){WA();return}wA++,Z.connection=wA>3?`closed`:`connecting`,BA(e)}}function WA(e){OA||(OA=!0,e&&(Z.socketBoardFallback=e,Z.socketTranscriptFallbacks={}),RA(),Z.socketTranscripts=!1,Zk(xA??void 0))}function GA(e){switch(e.t){case`event`:return AA.handle(e.event),e.event.type===`board`&&(Z.socketBoardFallback=null),!0;case`transcript`:return xA?.setQueryData([`transcript`,e.slug],t=>{let n=mA(t,e.messages);return{...n,messages:sA(t?.messages,eA(t?.messages,n.messages))}}),delete Z.socketTranscriptFallbacks[e.slug],!0;case`payload-too-large`:return e.channel===`board`?(Z.socketBoardFallback||console.warn(`[frizz] live board payload exceeded the socket limit; using SSE`,{actualBytes:e.actualBytes,maxBytes:e.maxBytes}),WA({actualBytes:e.actualBytes,maxBytes:e.maxBytes})):(Z.socketTranscriptFallbacks[e.slug]||console.warn(`[frizz] live transcript payload exceeded the socket limit; updates paused`,{slug:e.slug,actualBytes:e.actualBytes,maxBytes:e.maxBytes}),Z.socketTranscriptFallbacks[e.slug]={kind:`payload-too-large`,actualBytes:e.actualBytes,maxBytes:e.maxBytes}),!1;case`resource-limited`:return Z.socketTranscriptFallbacks[e.slug]||console.warn(`[frizz] live transcript read budget reached; updates paused`,{slug:e.slug,scope:e.scope,retryAfterMs:e.retryAfterMs}),Z.socketTranscriptFallbacks[e.slug]={kind:`read-budget`,scope:e.scope,retryAfterMs:e.retryAfterMs},!1;case`hb`:return!0}}function KA(e){EA&&bA&&bA.readyState===WebSocket.OPEN&&bA.send(JSON.stringify(e))}function qA(){for(let e of kA.keys())Z.socketTranscriptFallbacks[e]||KA({t:`sub`,topic:`transcript`,slug:e})}function JA(e){let t=(kA.get(e)??0)+1;kA.set(e,t),t===1&&!Z.socketTranscriptFallbacks[e]&&KA({t:`sub`,topic:`transcript`,slug:e})}function YA(e){let t=(kA.get(e)??0)-1;t<=0?(kA.delete(e),KA({t:`unsub`,topic:`transcript`,slug:e})):kA.set(e,t)}function XA(e){Z.socketTranscriptFallbacks[e]&&(delete Z.socketTranscriptFallbacks[e],kA.has(e)&&KA({t:`sub`,topic:`transcript`,slug:e}))}function ZA(){kA.clear(),AA.reset(),RA(),Z.connection=`connecting`,FA(),OA?Xk():LA()}function QA(e){xA=e,FA();let t=()=>LA();document.readyState===`complete`?t():window.addEventListener(`load`,t,{once:!0})}function $A(){return Hf(Z).board}function ej(){return Hf(Z).board?.projectDir}function tj(e){return e}function nj(e){if(!(!e||e.kind!==`session`||e.foreign||!e.sessionId))return{slug:e.id,sessionId:e.sessionId}}function rj(e){let t=nj(e);if(!(!t||e?.pendingInteraction===!1))return t}function ij(e,t=Date.now()){let n=1/0;for(let t of e){if(!t.expiresAt)continue;let e=Date.parse(t.expiresAt);Number.isFinite(e)&&(n=Math.min(n,e))}return Number.isFinite(n)?Math.max(250,n-t+50):!1}function aj(e){let t=rj(e);return qd({queryKey:t?Pk(t.slug,t.sessionId):[`interactions`,`pending`,`unowned`],queryFn:()=>X.pendingInteractions(t),enabled:t!==void 0,refetchInterval:e=>ij(e.state.data?.interactions??[]),refetchOnReconnect:!0,refetchOnWindowFocus:!0})}var oj=7e3,sj=5e3,cj=3;function lj(e,t){let n=Md(),r=Hf(Z),i=r.socketTranscripts,a=r.socketTranscriptFallbacks[e],o=qd({queryKey:[`transcript`,e],queryFn:async()=>{let t=await X.threadTranscript({slug:e}),r=n.getQueryData([`transcript`,e]),i=pA(r,t);return{...i,messages:sA(r?.messages,eA(r?.messages,i.messages))}},refetchInterval:t.poll&&!i&&!a?1500:!1,refetchOnWindowFocus:!a});return(0,B.useEffect)(()=>{if(!t.poll&&!i||a)return;let r=!1,s=0,c,l=setInterval(()=>{if(r)return;let t=iC(Z.board,e)?.lastActivityAt,a=lA(n.getQueryData([`transcript`,e])?.messages);if(!cA(t,a,sj)){s=0;return}if(a!==c&&(s=0),s>=cj)return;s++,c=a;let l=t?Date.parse(t)-(a?Date.parse(a):0):0;console.warn(`[frizz] transcript watchdog: stale view — self-healing`,{slug:e,lagMs:l,transport:i?`socket`:`poll`,attempt:s}),i&&(YA(e),JA(e)),r=!0,o.refetch().finally(()=>{r=!1})},oj);return()=>clearInterval(l)},[e,t.poll,i,a]),{...o,transportFallback:a?a.kind===`payload-too-large`?{kind:`payload-too-large`,actualBytes:a.actualBytes,maxBytes:a.maxBytes}:{kind:`read-budget`,scope:a.scope,retryAfterMs:a.retryAfterMs}:null,retryLiveUpdates:()=>XA(e)}}function uj(e,t){return qd({queryKey:[`subAgentTranscript`,e,t],queryFn:()=>X.subAgentTranscript({slug:e,id:t}),refetchInterval:e=>e.state.data?.state===`running`?2500:!1})}function dj(e,t){return qd({queryKey:[`backgroundShellOutput`,e,t],queryFn:()=>X.backgroundShellOutput({slug:e,id:t}),refetchInterval:e=>e.state.data?.state===`running`?1500:!1})}function fj(e,t){let n=[...t].sort(),r=qd({queryKey:[`backgroundShellActivity`,e,n],queryFn:()=>X.backgroundShellActivity({slug:e,ids:n}),enabled:n.length>0,refetchInterval:e=>e.state.data&&!e.state.data.shells.some(e=>e.running)?!1:1500});return(0,B.useMemo)(()=>new Map((r.data?.shells??[]).flatMap(e=>e.lines===null?[]:[[e.id,e.lines]])),[r.data])}function pj(e,t,n,r={}){e.setQueryData([`transcript`,t],e=>{let t=e?.messages??[];return{...e,messages:[...t,{role:`user`,text:n,tools:[],parts:[],queued:!0,deliveryId:r.deliveryId}]}}),r.scrollToBottom!==!1&&typeof window<`u`&&requestAnimationFrame(()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:`smooth`}))}function mj(e,t,n,r){e.setQueryData([`transcript`,t],e=>{if(!e?.messages?.length)return e;let t=e.messages.findLastIndex(e=>e.queued&&e.role===`user`&&e.text===n&&(r===void 0||e.deliveryId===r));return t===-1?e:{...e,messages:e.messages.filter((e,n)=>n!==t)}})}function hj(){let e=$S();return e?`/thread/${encodeURIComponent(e)}`:Z.routeThreadSlug?`/thread/${encodeURIComponent(Z.routeThreadSlug)}`:Z.view.startsWith(`status:`)?`/status/${encodeURIComponent(Z.view.slice(7))}`:`/`}function gj(e){try{return decodeURIComponent(e)}catch{return null}}function _j(e,t=Z.board?.projectSlug){let n=wx(e);return n===`/`&&t?xx(t):n}function vj(e){let t=e.match(/^\/thread\/([^/]+)$/);if(t){let e=gj(t[1]);if(e===null){Z.routeThreadSlug=null,QS(Z.drawers.map(e=>e.id)),Z.view=`todos`;return}Z.view=`todos`;let n=Z.drawers.findIndex(t=>t.kind===`thread`&&t.slug===e&&!t.closing);if(n!==-1){Z.routeThreadSlug=null,QS(Z.drawers.slice(n+1).map(e=>e.id));return}Z.routeThreadSlug=e;return}let n=e.match(/^\/status\/([^/]+)$/);if(n){Z.routeThreadSlug=null,QS(Z.drawers.map(e=>e.id));let e=gj(n[1]);Z.view=e===null?`todos`:`status:${e}`;return}Z.routeThreadSlug=null,QS(Z.drawers.map(e=>e.id)),Z.view=`todos`}function yj(e=location.pathname){vj(Cx(e))}function Bee(e){return yj(),zf(Z,()=>{let t=_j(hj());t!==location.pathname&&e(t,{replace:!hj().startsWith(`/thread/`)})})}function Vee(e,t){if(!t)return e;let n=e.projectDir!==t.projectDir,r=t.threads.length>0;return{projectDir:t.projectDir,hasBeenVisible:n?r:e.hasBeenVisible||r}}var bj=`frizz-sidebar-seen:`;function Hee(e){try{return localStorage.getItem(bj+(e??``))===`1`}catch{return!1}}function Uee(e,t){try{localStorage.setItem(bj+(e??``),t?`1`:`0`)}catch{}}var xj=3600*1e3,Sj=24*xj,Cj=[{value:`1h`,label:`1 hour`,detail:`60 minutes`,kind:`duration`},{value:`tomorrow`,label:`tomorrow`,detail:`9am`,kind:`calendar`},{value:`1d`,label:`1 day`,detail:`24 hours`,kind:`duration`},{value:`3d`,label:`3 days`,detail:`72 hours`,kind:`duration`},{value:`1w`,label:`1 week`,detail:`7 days`,kind:`duration`}],Wee=new Set(Cj.map(e=>e.value));function Gee(e){return typeof e==`string`&&Wee.has(e)}function wj(e){return Tj(e).label}function Tj(e){return Cj.find(t=>t.value===e)??Cj[2]}function Kee(e){let t=Tj(e);return t.kind===`calendar`?`Snooze until ${t.label}`:`Snooze ${t.label}`}function Ej(e,t=Date.now()){if(e===`tomorrow`){let e=new Date(t);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+1,9,0,0,0).toISOString()}return new Date(t+(e===`1h`?xj:e===`1d`?Sj:e===`3d`?3*Sj:7*Sj)).toISOString()}function Dj(e){return String(e).padStart(2,`0`)}function Oj(e){return`${e.getFullYear()}-${Dj(e.getMonth()+1)}-${Dj(e.getDate())}T${Dj(e.getHours())}:${Dj(e.getMinutes())}`}function qee(e,t=Date.now()){let n=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(!n)return{ok:!1,message:`Choose a local date and time`};let[,r,i,a,o,s]=n,c=[r,i,a,o,s].map(Number),l=new Date(c[0],c[1]-1,c[2],c[3],c[4],0,0);return!Number.isFinite(l.getTime())||l.getFullYear()!==c[0]||l.getMonth()!==c[1]-1||l.getDate()!==c[2]||l.getHours()!==c[3]||l.getMinutes()!==c[4]?{ok:!1,message:`That local time does not exist`}:l.getTime()<=t?{ok:!1,message:`Choose a time in the future`}:{ok:!0,until:l.toISOString()}}function kj(e,t=Date.now()){let n=new Date(e);if(!Number.isFinite(n.getTime()))return``;let r=new Date(t),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),a=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),o=Math.round((a-i)/Sj),s=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);if(o===0)return`Today at ${s}`;if(o===1)return`Tomorrow at ${s}`;if(o>1&&o<7)return`${new Intl.DateTimeFormat(void 0,{weekday:`long`}).format(n)} at ${s}`;let c={month:`short`,day:`numeric`};return n.getFullYear()!==r.getFullYear()&&(c.year=`numeric`),`${new Intl.DateTimeFormat(void 0,c).format(n)} at ${s}`}function Aj(e,t){if(!Number.isFinite(Date.parse(e)))return null;let n=kj(e,t);return n?n.replace(/^(Today|Tomorrow)/,e=>e.toLowerCase()):null}function Jee(e,t=Date.now()){let n=Aj(e,t);return n?`Snoozed until ${n}`:null}var Yee=120;function jj(e,t=Yee){let n=e.trim().replace(/\s+/g,` `);return n.length>t?`${n.slice(0,t-1)}…`:n}function Mj(e,t,n=Date.now()){let r=t?.trim();if(!r)return Jee(e,n);let i=Nj(e,n);return i?`${i} — then: ${jj(r)}`:null}function Nj(e,t=Date.now()){let n=Aj(e,t);return n?`Auto-snoozed until ${n}`:null}var Pj=`frizz.prefs.v1`;function Fj(e,t){return typeof e==`boolean`?e:e===`off`?!1:e===`compact`||e===`full`?!0:t}function Ij(e,t){return e===`fifo`||e===`lifo`?e:t}function Lj(e){let t={compactDiffs:!0,snoozePreset:`1d`,stickyUserMessage:!1,queueOrder:`fifo`,diffsRedefaulted:!0,stickyRedefaulted:!0};try{if(!e)return t;let n=JSON.parse(e);return n.diffsRedefaulted||=(n.compactDiffs=!0,!0),n.stickyRedefaulted||=(n.stickyUserMessage=!1,!0),{...t,...n,snoozePreset:Gee(n.snoozePreset)?n.snoozePreset:t.snoozePreset,stickyUserMessage:Fj(n.stickyUserMessage,t.stickyUserMessage),queueOrder:Ij(n.queueOrder,t.queueOrder)}}catch{return t}}function Rj(){try{return Lj(typeof localStorage>`u`?null:localStorage.getItem(Pj))}catch{return Lj(null)}}var zj=Rf(Rj());zf(zj,()=>{try{typeof localStorage<`u`&&localStorage.setItem(Pj,JSON.stringify(zj))}catch{}});function Bj(e){return e.kind===`session`&&e.foreign!==!0&&e.runtime===`exited`}var Vj=gy.options,Hj={planning:`text-sky-400 border-sky-400/40`,planned:`text-violet-400 border-violet-400/40`,active:`text-emerald-400 border-emerald-400/40`,"needs-human":`text-yellow-400 border-yellow-400/40`,blocked:`text-orange-400 border-orange-400/40`,done:`text-zinc-400 border-zinc-400/40`,dismissed:`text-rose-400 border-rose-400/40`,archived:`text-slate-500 border-slate-500/40`};function Uj(e){return e.foreign===!0&&e.title.trim()?e.title.trim():Xj(e)?Kj:e.aiTitle?.trim()&&!Wj(e)?Gj(e.aiTitle):e.backend===`codex`&&e.titleAuto===!0&&!e.aiTitle?.trim()?qj:e.titleAuto===!1&&e.title.trim()?e.title:e.title.trim()&&!(e.titleAuto===!0&&e.title.trim()===e.id)?e.titleAuto===!0?Gj(e.title):e.title.trim():e.titleAuto===!0?qj:e.id}function Wj(e){return e.titleLocked??e.titleAuto===!1}function Gj(e){let t=e.trim();if(!/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/i.test(t))return t;let n=t.split(/[-_]+/).filter(Boolean);if(n.length===0)return t;let r=n.join(` `).toLowerCase();return r.charAt(0).toUpperCase()+r.slice(1)}var Kj=`Spinning up a thread…`,qj=`Untitled thread`,Jj=6e4,Yj=15e3;function Xj(e){if(!e.titleAuto||e.aiTitle)return!1;if(e.backend===`codex`){if(e.runtime===`spawning`)return!0;let t=Date.parse(e.spawnedAt??``);return Number.isFinite(t)&&Date.now()-t<Yj}let t=Date.parse(e.spawnedAt??``);return Number.isFinite(t)&&Date.now()-t<Jj}function Zj(e){return e.status===`done`||e.status===`dismissed`?!1:!!(e.runtime===`perm-prompt`||e.pendingAsk||e.humanBlocked&&e.runtime!==`none`&&e.runtime!==`running`&&e.runtime!==`spawning`||e.pendingQuestion&&e.runtime!==`running`&&e.runtime!==`spawning`||(e.status===`active`||e.status===`planning`)&&(e.runtime===`exited`||e.runtime===`none`)&&e.spawnedAt&&!e.archived)}function Qj(e){let t=Date.parse(e.lastUserAt??``),n=Date.parse(e.spawnedAt??``),r=Math.max(Number.isFinite(t)?t:-1/0,Number.isFinite(n)?n:-1/0);return Number.isFinite(r)?r:0}function $j(e){if(dM(e))return Qj(e);let t=Date.parse(e.lastAssistantAt??``);return Number.isFinite(t)?t:Qj(e)}function eM(e){return dM(e)?e.lastActivityAt??e.spawnedAt:e.lastAssistantAt??e.lastActivityAt??e.spawnedAt}function tM(e){return[...e].sort((e,t)=>{let n=Zj(e);if(n!==Zj(t))return n?-1:1;let r=$j(t)-$j(e);return r===0?e.id.localeCompare(t.id):r})}function nM(e){return[...e].sort((e,t)=>{let n=$j(t)-$j(e);return n===0?e.id.localeCompare(t.id):n})}function rM(e,t=`fifo`){let n=t===`lifo`?-1:1;return[...e].sort((e,t)=>{let r=($j(e)-$j(t))*n;return r===0?e.id.localeCompare(t.id):r})}function iM(e){return gb(e)}function aM(e){return e.filter(e=>e.kind===`session`&&e.foreign===!0)}function oM(e){return e.runtime===`turn-idle`||e.runtime===`exited`}function sM(e){return(e.subAgents??[]).some(e=>Cy(e)&&e.state===`running`)}function cM(e){return sM(e)||e.awaitingBackground===!0}function lM(e,t=Date.now()){let n=Date.parse(e.snoozedUntil??``);return Number.isFinite(n)&&n>t?e.snoozedUntil:void 0}function uM(e,t=Date.now()){let n=lM(e,t)!==void 0;if(e.state===`archived`||cM(e))return!1;if(n)return e.runtime!==`running`&&e.runtime!==`spawning`;if(e.needsYou||e.pendingAsk||e.runtime===`perm-prompt`||!oM(e))return!1;if(e.limitPause?.autoResume)return!0;let r=e.lastFence?.kind===`awaiting`;return n||r}function dM(e){return e.runtime===`running`||e.runtime===`spawning`?!0:e.runtime===`turn-idle`&&cM(e)}function fM(e){return e.needsYou===!0&&oM(e)}function pM(e){return e.runtime===`turn-idle`&&e.awaitingBackground===!0&&!sM(e)}function mM(e){return pM(e)?(e.bgShells??[]).some(e=>e.state===`running`)?!0:(e.watches??[]).some(e=>e.kind===`github`&&e.state===`armed`&&e.github?.checks===`running`&&e.github.state===`open`):!1}function hM(e){let t=dM(e);return e.state===`archived`&&!t?`archived`:e.actionableInteraction||e.pendingAsk||e.pendingQuestion||e.runtime===`perm-prompt`||e.humanBlocked||e.status===`needs-human`?`needs-input`:t&&!fM(e)&&!pM(e)?`working`:uM(e)?`held`:e.lastFence?.kind===`done`&&oM(e)?`done`:mM(e)?`background`:Bj(e)?`stalled`:`rest`}function gM(e){let t=hM(e);return t===`stalled`?!0:t===`held`&&e.foreign!==!0&&!!e.limitPause?.autoResume}function _M(e){return e.kind===`session`?e.state===`archived`&&!dM(e)?`inactive`:uM(e)?`held`:`active`:null}function vM(e,t=`fifo`){let n=e.filter(yM);return[...rM(e.filter(e=>!yM(e)),t),...nM(n)]}function yM(e){return e.needsYou!==!0}function bM(e){return{running:e.filter(yM),rested:e.filter(e=>!yM(e))}}function xM(e,t=`fifo`){let n={active:[],held:[],inactive:[]};for(let t of e){if(t.kind===`session`&&t.foreign===!0)continue;let e=_M(t);e&&n[e].push(t)}return n.active=vM(n.active,t),n.held=nM(n.held),n.inactive=nM(n.inactive),n}function SM(e,t){for(let n of[e,t])if(n&&Number.isFinite(Date.parse(n)))return n}function CM(e,t=Date.now()){let n=wM(e,t);return n&&`Last active ${n}`}function wM(e,t=Date.now()){let n=EM(e,t);return n===null||n===TM?n:`${n} ago`}var TM=`just now`;function EM(e,t=Date.now()){let n=e?Date.parse(e):NaN;if(!Number.isFinite(n)||!Number.isFinite(t))return null;let r=Math.max(0,Math.floor((t-n)/1e3));if(r===0)return TM;if(r<60)return`${r} ${r===1?`second`:`seconds`}`;let i=Math.floor(r/60);if(i<60)return`${i} ${i===1?`minute`:`minutes`}`;let a=Math.floor(i/60);if(a<24)return`${a} ${a===1?`hour`:`hours`}`;let o=Math.floor(a/24);if(o<7)return`${o} ${o===1?`day`:`days`}`;let s=Math.floor(o/7);if(s<5)return`${s} ${s===1?`week`:`weeks`}`;let c=Math.floor(o/30);if(c<12)return`${c} ${c===1?`month`:`months`}`;let l=Math.floor(o/365);return`${l} ${l===1?`year`:`years`}`}var DM=3e4,OM=new Set,kM=Date.now(),AM;function jM(){kM=Date.now();for(let e of OM)e();MM()}function MM(){if(OM.size===0)return;let e=DM-kM%DM;AM=setTimeout(jM,e||DM)}function NM(e){return OM.add(e),OM.size===1&&(kM=Date.now(),MM()),()=>{OM.delete(e),OM.size===0&&AM&&(clearTimeout(AM),AM=void 0)}}function PM(){return kM}function FM(){return(0,B.useSyncExternalStore)(NM,PM,PM)}function IM({size:e=15}){return(0,V.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 15 15`,"aria-hidden":!0,className:`text-muted/85`,children:[(0,V.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`14`,height:`14`,rx:`3.5`,fill:`none`,stroke:`currentColor`,strokeOpacity:`0.5`,strokeWidth:`1`}),(0,V.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`14`,height:`14`,rx:`3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`,strokeLinecap:`round`,strokeDasharray:`11 39`,children:(0,V.jsx)(`animate`,{attributeName:`stroke-dashoffset`,from:`50`,to:`0`,dur:`1.1s`,repeatCount:`indefinite`})})]})}function LM(e){return e===`running`}function RM(e,t){return e===`pending`&&t===`background`}var zM=2e3;function BM(e,t){return e===`pending`&&t===void 0}function VM(e,t,n,r){if(!BM(e,t))return!1;let i=n?Date.parse(n):NaN;return Number.isFinite(i)?r-i>=zM:!0}function HM(e){return e?.split(`
320
- `).find(e=>e.trim())?.trim().replace(/\s+/g,` `)||void 0}function UM(e,t){if(e.name===`Interrupt process`||e.status===`cancelled`||e.backgroundState!==`background`)return;let n=new Set([HM(e.desc),HM(e.detail),HM(e.command)].filter(e=>!!e));if(n.size===0)return;let r=t.filter(e=>n.has(HM(e.label)??``));return r.some(e=>e.state===`running`)?`running`:r.some(e=>e.state===`stale`)?`stale`:void 0}function WM(e){if(e<1)return`<1 ms`;if(e<1e3)return`${Math.round(e)} ms`;if(e<6e4)return`${e<1e4?(e/1e3).toFixed(1):Math.round(e/1e3)} sec`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n?`${t} min ${n} sec`:`${t} min`}function GM(e){return e<1?`just now`:e<60?`${e} min`:`${Math.floor(e/60)} hr ${e%60} min`}function KM(e){if(!Number.isFinite(e)||e<0)return``;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60),i=n%60;return i?`${r}hr ${i}m`:`${r}hr`}function qM(e){if(!Number.isFinite(e)||e<0)return``;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r<24)return n%60?`${r}h ${n%60}m`:`${r}h`;let i=Math.floor(r/24);if(i<7)return r%24?`${i}d ${r%24}h`:`${i}d`;let a=Math.floor(i/7);return i%7?`${a}w ${i%7}d`:`${a}w`}function JM(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);return Number.isFinite(n)?KM(t-n):``}function YM(e){if(!Number.isFinite(e)||e<0)return``;let t=Math.floor(e/6e4);return t<1?`<1 min`:GM(t)}function XM(e){if(!Number.isFinite(e)||e<=0)return`0s`;let t=e=>String(e).padStart(2,`0`),n=Math.ceil(e/1e3);if(n<60)return`${n}s`;let r=Math.floor(n/60);if(r<60)return`${r}m ${t(n%60)}s`;let i=Math.floor(r/60);if(i<24)return`${i}h ${t(r%60)}m`;let a=Math.floor(i/24);if(a<7)return i%24?`${a}d ${i%24}h`:`${a}d`;let o=Math.floor(a/7);return a%7?`${o}w ${a%7}d`:`${o}w`}function ZM(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);return Number.isFinite(n)?GM(Math.floor((t-n)/6e4)):``}function QM(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.floor((t-n)/6e4);return r<1?`just now`:`${GM(r)} ago`}var $M=`shrink-0 text-[11px] leading-none text-muted/45`,eN=`block h-1.5 w-1.5 rounded-full bg-muted/30`,tN=`stale — no recent output`,nN=`block h-1.5 w-1.5 rounded-full border border-muted/45`,rN=`rested — it stopped, but the work it launched is still running`,iN=`running — no recent output`,aN={AGENT:`Open sub-agent transcript`,SHELL:`Open background shell output`,GITHUB:`Open this pull request on GitHub`};function oN(e){if(!(typeof e!=`number`||!Number.isFinite(e)||e<0))return e===1?`1 line`:`${sN(e)??`0`} lines`}function sN(e){if(typeof e!=`number`||!Number.isFinite(e)||e<=0)return;let t=(e,t)=>`${e<100?e.toFixed(1).replace(/\.0$/,``):Math.round(e)}${t}`;return e<1e3?String(Math.round(e)):e<1e6?t(e/1e3,`k`):t(e/1e6,`M`)}var cN={running:`Stop — end this operation and everything it spawned, then clear the row`,settled:`Clear — stop tracking this finished operation`},lN={running:`Stop`,settled:`Clear`},uN={AGENT:`sub-agent`,SHELL:`background shell`,GITHUB:`PR watcher`};function dN(e,t){let n=new Map;for(let t of e){if(!t.parentId)continue;let e=n.get(t.parentId);e?e.push(t):n.set(t.parentId,[t])}let r=[],i=new Set([t]),a=(e,t)=>{for(let o of n.get(e)??[])o.id&&i.has(o.id)||(o.id&&i.add(o.id),r.push({...o,displayDepth:t}),o.id&&a(o.id,t+1))};return a(t,1),r}var fN=e=>e.state===`running`||e.state===`stale`||e.state===`rested`;function pN(e,t){return t===`card`?e.filter(fN):t===`rail`?e.filter(e=>!!e.id&&fN(e)):e}var mN=e=>{let t=e.launchId??e.id;return[...t?[`id:${t}`]:[],...e.command?[`cmd:${e.command}`]:[],`launch:${e.label}\u0000${e.startedAt??``}`]};function hN(e,t){let n=[...e],r=new Set(n.flatMap(mN));for(let e of t)mN(e).some(e=>r.has(e))||n.push(e);return n}function gN({kind:e,label:t,state:n,density:r,depth:i,startedAt:a,counter:o,counterTitle:s,parentSlug:c,onOpen:l,onDismiss:u,title:d}){let f=LM(n),p={AGENT:`frizz-live-dot--agent`,SHELL:`frizz-live-dot--shell`,GITHUB:`frizz-live-dot--github`},m={AGENT:`AGENT`,SHELL:`SHELL`,GITHUB:`WATCH`},h=!!l,g=r===`rail`,_=r===`sheet`,v=JM(a,FM()),y=Math.min(Math.max((i??1)-1,0),4)*13,b=f?`running`:`settled`,x=aN[e],S=d??(h?x:void 0),C=n===`rested`?(0,V.jsx)(`span`,{className:nN,title:rN}):(0,V.jsx)(`span`,{className:eN,title:tN}),w=g?(0,V.jsx)(`span`,{className:`flex w-3.5 shrink-0 items-center justify-center`,children:f?(0,V.jsx)(IM,{size:12}):C}):(0,V.jsx)(`span`,{className:`frizz-op-dot-slot flex w-[9px] shrink-0 justify-center`,children:f?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot ${p[e]}`,"data-running-indicator":r===`card`?`queue-subagent`:`operation`}):e===`SHELL`?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot-quiet frizz-live-dot-quiet--shell`,"data-running-indicator":`operation-quiet`,title:iN}):C}),T=o||v?(0,V.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 pl-1.5 text-muted/40`,children:[o&&(0,V.jsx)(`span`,{"data-child-op-counter":!0,title:s,children:o}),o&&v&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`text-muted/25`,children:`·`}),v&&(0,V.jsx)(`span`,{title:`Working for ${v}`,children:v})]}):null,E=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":!0,className:$M,children:`⤷`}),w,_&&(0,V.jsx)(`span`,{className:`petite-caps shrink-0 text-[9.5px] text-muted/45`,children:m[e]}),(0,V.jsx)(`span`,{className:`min-w-0 truncate text-muted/70 ${g?`leading-[16px]`:h?`group-hover:text-fg/80 group-hover:underline`:``}`,children:t})]}),D=g?`group flex min-w-0 items-center gap-2 pl-[26px] text-left outline-none`:`group flex min-w-0 max-w-[60%] items-center gap-1.5 overflow-hidden text-left text-[11.5px] ${h?`cursor-pointer rounded-sm outline-none transition-colors focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`:``}`,O=g&&y>0?{paddingLeft:26+y}:void 0,k=h?(0,V.jsx)(`button`,{type:`button`,style:O,onClick:l,onMouseDown:_?e=>e.stopPropagation():void 0,title:S,"aria-label":`${x}: ${t}`,className:D,children:E}):(0,V.jsx)(`div`,{style:O,title:S,className:D,children:E});return(0,V.jsxs)(`div`,{className:g?`flex w-full min-w-0 items-center gap-1.5 rounded-md py-0.5 pr-1.5 text-[11.5px] transition-colors hover:bg-white/[0.04]`:`flex min-w-0 items-center gap-1.5 text-[11.5px]`,style:!g&&y>0?{marginLeft:y}:void 0,"data-op-row":u?``:void 0,"data-subagent-depth":i&&i>1?i:void 0,"data-subagent-parent":c,children:[k,u&&(0,V.jsx)(`button`,{type:`button`,onClick:u,onMouseDown:e=>e.stopPropagation(),title:cN[b],"aria-label":`${lN[b]} ${uN[e]}: ${t}`,className:`shrink-0 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-fg/60`,children:(0,V.jsx)(jw,{size:11})}),T]})}function _N(e,t,n=`AGENT`){let r=n===`SHELL`?`Background shell`:`Sub-agent`;X.stopBackgroundOp({slug:e,id:t}).then(({stopped:e,note:t,descendantsStopped:i})=>{if(e){if(t)return Q(`${r} stopped. ${t}`,{duration:7e3});if(n===`SHELL`)return Q(`Background shell stopped — the worker was told`);Q(i>0?`Sub-agent and ${i} descendant${i===1?``:`s`} stopped`:`Sub-agent stopped`)}}).catch(e=>{Q(`Couldn’t stop: ${(e instanceof Error?e.message:String(e)).slice(0,100)}`,{duration:7e3})})}function vN(e,t,n=`AGENT`){if(!t.id||!Cy(t)||t.state===`running`&&!t.stoppable)return;let r=t.id;return()=>_N(e,r,n)}typeof window<`u`&&window.document&&window.document.createElement;function yN(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function bN(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function xN(...e){return t=>{let n=!1,r=e.map(e=>{let r=bN(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():bN(e[t],null)}}}}function SN(...e){return B.useCallback(xN(...e),e)}function CN(e,t=[]){let n=[];function r(t,r){let i=B.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=B.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=B.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>B.createContext(e));return function(n){let r=n?.[e]||t;return B.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,wN(i,...t)]}function wN(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var TN=globalThis?.document?B.useLayoutEffect:()=>{},EN=B.useEffectEvent,DN=B.useInsertionEffect;function ON(e){if(typeof EN==`function`)return EN(e);let t=B.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof DN==`function`?DN(()=>{t.current=e}):TN(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}var kN=B.useInsertionEffect||TN;function AN({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=jN({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=B.useRef(e!==void 0);B.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,B.useCallback(t=>{if(s){let n=MN(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function jN({defaultProp:e,onChange:t}){let[n,r]=B.useState(e),i=B.useRef(n),a=B.useRef(t);return kN(()=>{a.current=t},[t]),B.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function MN(e){return typeof e==`function`}function NN(e){let t=B.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];VN(r)&&typeof GN==`function`&&(r=GN(r._payload)),B.Children.forEach(r,e=>{if(zN(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;VN(n)&&typeof GN==`function`&&(n=GN(n._payload)),a=IN(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=B.cloneElement(a,void 0,s):!o&&B.Children.count(r)===1&&B.isValidElement(r)&&(a=r);let c=a?RN(a):void 0,l=SN(n,c);if(!a){if(r||r===0)throw Error(o?WN(e):UN(e));return r}let u=LN(i,a.props??{});return a.type!==B.Fragment&&(u.ref=n?l:c),B.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var PN=Symbol.for(`radix.slottable`);function FN(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=PN,t}var IN=(e,t)=>{if(`child`in e.props){let t=e.props.child;return B.isValidElement(t)?B.cloneElement(t,void 0,e.props.children(t.props.children)):null}return B.isValidElement(t)?t:null};function LN(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function RN(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function zN(e){return B.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===PN}var BN=Symbol.for(`react.lazy`);function VN(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===BN&&`_payload`in e&&HN(e._payload)}function HN(e){return typeof e==`object`&&!!e&&`then`in e}var UN=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,WN=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,GN=B.use,KN=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=NN(`Primitive.${t}`),r=B.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function qN(e,t){e&&Xd.flushSync(()=>e.dispatchEvent(t))}function JN(e){let t=e+`CollectionProvider`,[n,r]=CN(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=B.useRef(null),a=B.useRef(new Map).current;return(0,V.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=NN(s),l=B.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=SN(t,a(s,n).collectionRef);return(0,V.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=NN(u),p=B.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=B.useRef(null),s=SN(t,o),c=a(u,n);return B.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,V.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return B.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var YN=B.createContext(void 0);function XN(e){let t=B.useContext(YN);return e||t||`ltr`}function ZN(e){let t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}var QN=`DismissableLayer`,$N=`dismissableLayer.update`,eP=`dismissableLayer.pointerDownOutside`,tP=`dismissableLayer.focusOutside`,nP,rP=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),iP=B.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=B.useContext(rP),[d,f]=B.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=B.useState({}),h=SN(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(_),y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=B.useRef(!1),C=cP(e=>{let t=e.target;if(!(t instanceof Node))return;let n=[...u.branches].some(e=>e.contains(t));!x||n||(a?.(e),s?.(e),e.defaultPrevented||c?.())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces}),w=lP(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=ON(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return B.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T]),B.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(nP=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),uP(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=nP))}},[d,p,n,u]),B.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),uP())},[d,u]),B.useEffect(()=>{let e=()=>m({});return document.addEventListener($N,e),()=>document.removeEventListener($N,e)},[]),(0,V.jsx)(KN.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:yN(e.onFocusCapture,w.onFocusCapture),onBlurCapture:yN(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:yN(e.onPointerDownCapture,C.onPointerDownCapture)})});iP.displayName=QN;var aP=`DismissableLayerBranch`,oP=B.forwardRef((e,t)=>{let n=B.useContext(rP),r=B.useRef(null),i=SN(t,r);return B.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(KN.div,{...e,ref:i})});oP.displayName=aP;function sP(){let e=B.useContext(rP),[t,n]=B.useState(null);return B.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function cP(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a}=t,o=ZN(e),s=B.useRef(!1),c=B.useRef(!1),l=B.useRef(new Map),u=B.useRef(()=>{});return B.useEffect(()=>{function e(){c.current=!1,i.current=!1,l.current.clear()}function t(){return Array.from(l.current.values()).some(Boolean)}function d(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||l.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{c.current&&u.current()},0)}function f(e){c.current&&l.current.set(e.type,!1)}let p=a=>{if(a.target&&!s.current){let s=function(){n.removeEventListener(`click`,u.current);let r=t();e(),r||dP(eP,o,d,{discrete:!0})},d={originalEvent:a};c.current=!0,i.current=r&&a.button===0,l.current.clear(),!r||a.button!==0?s():(n.removeEventListener(`click`,u.current),u.current=s,n.addEventListener(`click`,u.current,{once:!0}))}else n.removeEventListener(`click`,u.current),e();s.current=!1},m=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of m)n.addEventListener(e,d,!0),n.addEventListener(e,f);let h=window.setTimeout(()=>{n.addEventListener(`pointerdown`,p)},0);return()=>{window.clearTimeout(h),n.removeEventListener(`pointerdown`,p),n.removeEventListener(`click`,u.current);for(let e of m)n.removeEventListener(e,d,!0),n.removeEventListener(e,f)}},[n,o,r,i,a]),{onPointerDownCapture:()=>s.current=!0}}function lP(e,t=globalThis?.document){let n=ZN(e),r=B.useRef(!1);return B.useEffect(()=>{let e=e=>{e.target&&!r.current&&dP(tP,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function uP(){let e=new CustomEvent($N);document.dispatchEvent(e)}function dP(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?qN(i,a):i.dispatchEvent(a)}var fP=0,pP=null;function mP(){B.useEffect(()=>{pP||={start:hP(),end:hP()};let{start:e,end:t}=pP;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),fP++,()=>{fP===1&&(pP?.start.remove(),pP?.end.remove(),pP=null),fP=Math.max(0,fP-1)}},[])}function hP(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var gP=`focusScope.autoFocusOnMount`,_P=`focusScope.autoFocusOnUnmount`,vP={bubbles:!1,cancelable:!0},yP=`FocusScope`,bP=B.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=ZN(i),u=ZN(a),d=B.useRef(null),f=SN(t,c),p=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:DP(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||DP(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&DP(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),B.useEffect(()=>{if(s){OP.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(gP,vP);s.addEventListener(gP,l),s.dispatchEvent(t),t.defaultPrevented||(xP(jP(CP(s)),{select:!0}),document.activeElement===e&&DP(s))}return()=>{s.removeEventListener(gP,l),setTimeout(()=>{let t=new CustomEvent(_P,vP);s.addEventListener(_P,u),s.dispatchEvent(t),t.defaultPrevented||DP(e??document.body,{select:!0}),s.removeEventListener(_P,u),OP.remove(p)},0)}}},[s,l,u,p]);let m=B.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=SP(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&DP(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&DP(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(KN.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});bP.displayName=yP;function xP(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(DP(r,{select:t}),document.activeElement!==n)return}function SP(e){let t=CP(e);return[wP(t,e),wP(t.reverse(),e)]}function CP(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function wP(e,t){for(let n of e)if(!TP(n,{upTo:t}))return n}function TP(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function EP(e){return e instanceof HTMLInputElement&&`select`in e}function DP(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&EP(e)&&t&&e.select()}}var OP=kP();function kP(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=AP(e,t),e.unshift(t)},remove(t){e=AP(e,t),e[0]?.resume()}}}function AP(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function jP(e){return e.filter(e=>e.tagName!==`A`)}var MP=B.useId||(()=>void 0),NP=0;function PP(e){let[t,n]=B.useState(MP());return TN(()=>{e||n(e=>e??String(NP++))},[e]),e||(t?`radix-${t}`:``)}var FP=[`top`,`right`,`bottom`,`left`],IP=Math.min,LP=Math.max,RP=Math.round,zP=Math.floor,BP=e=>({x:e,y:e}),VP={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function HP(e,t,n){return LP(e,IP(t,n))}function UP(e,t){return typeof e==`function`?e(t):e}function WP(e){return e.split(`-`)[0]}function GP(e){return e.split(`-`)[1]}function KP(e){return e===`x`?`y`:`x`}function qP(e){return e===`y`?`height`:`width`}function JP(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function YP(e){return KP(JP(e))}function XP(e,t,n){n===void 0&&(n=!1);let r=GP(e),i=YP(e),a=qP(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=aF(o)),[o,aF(o)]}function ZP(e){let t=aF(e);return[QP(e),t,QP(t)]}function QP(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var $P=[`left`,`right`],eF=[`right`,`left`],tF=[`top`,`bottom`],nF=[`bottom`,`top`];function rF(e,t,n){switch(e){case`top`:case`bottom`:return n?t?eF:$P:t?$P:eF;case`left`:case`right`:return t?tF:nF;default:return[]}}function iF(e,t,n,r){let i=GP(e),a=rF(WP(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(QP)))),a}function aF(e){let t=WP(e);return VP[t]+e.slice(t.length)}function oF(e){return{top:0,right:0,bottom:0,left:0,...e}}function sF(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:oF(e)}function cF(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function lF(e,t,n){let{reference:r,floating:i}=e,a=JP(t),o=YP(t),s=qP(o),c=WP(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(GP(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function uF(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=UP(t,e),p=sF(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=cF(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=cF(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var dF=50,fF=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:uF},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=lF(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<dF&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=lF(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},pF=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=UP(e,t)||{};if(l==null)return{};let d=sF(u),f={x:n,y:r},p=YP(i),m=qP(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=IP(d[_],T),D=IP(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=HP(O,A,k),M=!c.arrow&&GP(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),mF=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=UP(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=WP(r),_=JP(o),v=WP(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[aF(o)]:ZP(o)),x=p!==`none`;!d&&x&&b.push(...iF(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=XP(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==JP(t))||T.every(e=>JP(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=JP(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function hF(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gF(e){return FP.some(t=>e[t]>=0)}var _F=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=UP(e,t);switch(i){case`referenceHidden`:{let e=hF(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:gF(e)}}}case`escaped`:{let e=hF(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:gF(e)}}}default:return{}}}}},vF=new Set([`left`,`top`]);async function yF(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=WP(n),s=GP(n),c=JP(n)===`y`,l=vF.has(o)?-1:1,u=a&&c?-1:1,d=UP(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var bF=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await yF(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},xF=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=UP(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=JP(WP(i)),p=KP(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=HP(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=HP(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},SF=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=UP(e,t),u={x:n,y:r},d=JP(i),f=KP(d),p=u[f],m=u[d],h=UP(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=vF.has(WP(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},CF=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=UP(e,t),u=await o.detectOverflow(t,l),d=WP(i),f=GP(i),p=JP(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=IP(h-u[g],v),x=IP(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=LP(u.left,0),t=LP(u.right,0),n=LP(u.top,0),r=LP(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:LP(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:LP(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function wF(){return typeof window<`u`}function TF(e){return OF(e)?(e.nodeName||``).toLowerCase():`#document`}function EF(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function DF(e){return((OF(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function OF(e){return wF()?e instanceof Node||e instanceof EF(e).Node:!1}function kF(e){return wF()?e instanceof Element||e instanceof EF(e).Element:!1}function AF(e){return wF()?e instanceof HTMLElement||e instanceof EF(e).HTMLElement:!1}function jF(e){return!wF()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof EF(e).ShadowRoot}function MF(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=UF(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function NF(e){return/^(table|td|th)$/.test(TF(e))}function PF(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var FF=/transform|translate|scale|rotate|perspective|filter/,IF=/paint|layout|strict|content/,LF=e=>!!e&&e!==`none`,RF;function zF(e){let t=kF(e)?UF(e):e;return LF(t.transform)||LF(t.translate)||LF(t.scale)||LF(t.rotate)||LF(t.perspective)||!VF()&&(LF(t.backdropFilter)||LF(t.filter))||FF.test(t.willChange||``)||IF.test(t.contain||``)}function BF(e){let t=GF(e);for(;AF(t)&&!HF(t);){if(zF(t))return t;if(PF(t))return null;t=GF(t)}return null}function VF(){return RF??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),RF}function HF(e){return/^(html|body|#document)$/.test(TF(e))}function UF(e){return EF(e).getComputedStyle(e)}function WF(e){return kF(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function GF(e){if(TF(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||jF(e)&&e.host||DF(e);return jF(t)?t.host:t}function KF(e){let t=GF(e);return HF(t)?e.ownerDocument?e.ownerDocument.body:e.body:AF(t)&&MF(t)?t:KF(t)}function qF(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=KF(e),i=r===e.ownerDocument?.body,a=EF(r);if(i){let e=JF(a);return t.concat(a,a.visualViewport||[],MF(r)?r:[],e&&n?qF(e):[])}else return t.concat(r,qF(r,[],n))}function JF(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function YF(e){let t=UF(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=AF(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=RP(n)!==a||RP(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function XF(e){return kF(e)?e:e.contextElement}function ZF(e){let t=XF(e);if(!AF(t))return BP(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=YF(t),o=(a?RP(n.width):n.width)/r,s=(a?RP(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var QF=BP(0);function $F(e){let t=EF(e);return!VF()||!t.visualViewport?QF:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function eI(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==EF(e)?!1:t}function tI(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=XF(e),o=BP(1);t&&(r?kF(r)&&(o=ZF(r)):o=ZF(e));let s=eI(a,n,r)?$F(a):BP(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=EF(a),t=r&&kF(r)?EF(r):r,n=e,i=JF(n);for(;i&&r&&t!==n;){let e=ZF(i),t=i.getBoundingClientRect(),r=UF(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=EF(i),i=JF(n)}}return cF({width:u,height:d,x:c,y:l})}function nI(e,t){let n=WF(e).scrollLeft;return t?t.left+n:tI(DF(e)).left+n}function rI(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-nI(e,n),y:n.top+t.scrollTop}}function iI(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=DF(r),s=t?PF(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=BP(1),u=BP(0),d=AF(r);if((d||!d&&!a)&&((TF(r)!==`body`||MF(o))&&(c=WF(r)),d)){let e=tI(r);l=ZF(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?rI(o,c):BP(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function aI(e){return Array.from(e.getClientRects())}function oI(e){let t=DF(e),n=WF(e),r=e.ownerDocument.body,i=LP(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=LP(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+nI(e),s=-n.scrollTop;return UF(r).direction===`rtl`&&(o+=LP(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var sI=25;function cI(e,t){let n=EF(e),r=DF(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=VF();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=nI(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=sI&&(a-=o)}else l<=sI&&(a+=l);return{width:a,height:o,x:s,y:c}}function lI(e,t){let n=tI(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=AF(e)?ZF(e):BP(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function uI(e,t,n){let r;if(t===`viewport`)r=cI(e,n);else if(t===`document`)r=oI(DF(e));else if(kF(t))r=lI(t,n);else{let n=$F(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return cF(r)}function dI(e,t){let n=GF(e);return n===t||!kF(n)||HF(n)?!1:UF(n).position===`fixed`||dI(n,t)}function fI(e,t){let n=t.get(e);if(n)return n;let r=qF(e,[],!1).filter(e=>kF(e)&&TF(e)!==`body`),i=null,a=UF(e).position===`fixed`,o=a?GF(e):e;for(;kF(o)&&!HF(o);){let t=UF(o),n=zF(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||MF(o)&&!n&&dI(e,o))?r=r.filter(e=>e!==o):i=t,o=GF(o)}return t.set(e,r),r}function pI(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?PF(t)?[]:fI(t,this._c):[].concat(n),r],o=uI(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=uI(t,a[e],i);s=LP(n.top,s),c=IP(n.right,c),l=IP(n.bottom,l),u=LP(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function mI(e){let{width:t,height:n}=YF(e);return{width:t,height:n}}function hI(e,t,n){let r=AF(t),i=DF(t),a=n===`fixed`,o=tI(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=BP(0);function l(){c.x=nI(i)}if(r||!r&&!a)if((TF(t)!==`body`||MF(i))&&(s=WF(t)),r){let e=tI(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?rI(i,s):BP(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function gI(e){return UF(e).position===`static`}function _I(e,t){if(!AF(e)||UF(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return DF(e)===n&&(n=n.ownerDocument.body),n}function vI(e,t){let n=EF(e);if(PF(e))return n;if(!AF(e)){let t=GF(e);for(;t&&!HF(t);){if(kF(t)&&!gI(t))return t;t=GF(t)}return n}let r=_I(e,t);for(;r&&NF(r)&&gI(r);)r=_I(r,t);return r&&HF(r)&&gI(r)&&!zF(r)?n:r||BF(e)||n}var yI=async function(e){let t=this.getOffsetParent||vI,n=this.getDimensions,r=await n(e.floating);return{reference:hI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function bI(e){return UF(e).direction===`rtl`}var xI={convertOffsetParentRelativeRectToViewportRelativeRect:iI,getDocumentElement:DF,getClippingRect:pI,getOffsetParent:vI,getElementRects:yI,getClientRects:aI,getDimensions:mI,getScale:ZF,isElement:kF,isRTL:bI};function SI(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function CI(e,t){let n=null,r,i=DF(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=zP(d),h=zP(i.clientWidth-(u+f)),g=zP(i.clientHeight-(d+p)),_=zP(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:LP(0,IP(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!SI(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function wI(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=XF(e),u=i||a?[...l?qF(l):[],...t?qF(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?CI(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?tI(e):null;c&&g();function g(){let t=tI(e);h&&!SI(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var TI=bF,EI=xF,DI=mF,OI=CF,kI=_F,AI=pF,jI=SF,MI=(e,t,n)=>{let r=new Map,i={platform:xI,...n},a={...i.platform,_c:r};return fF(e,t,{...i,platform:a})},NI=typeof document<`u`?B.useLayoutEffect:function(){};function PI(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!PI(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!PI(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function FI(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function II(e,t){let n=FI(e);return Math.round(t*n)/n}function LI(e){let t=B.useRef(e);return NI(()=>{t.current=e}),t}function RI(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=B.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=B.useState(r);PI(f,r)||p(r);let[m,h]=B.useState(null),[g,_]=B.useState(null),v=B.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=B.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=B.useRef(null),C=B.useRef(null),w=B.useRef(u),T=c!=null,E=LI(c),D=LI(i),O=LI(l),k=B.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),MI(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!PI(w.current,t)&&(w.current=t,Xd.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);NI(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=B.useRef(!1);NI(()=>(A.current=!0,()=>{A.current=!1}),[]),NI(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=B.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=B.useMemo(()=>({reference:b,floating:x}),[b,x]),N=B.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=II(M.floating,u.x),r=II(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...FI(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return B.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var zI=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:AI({element:r.current,padding:i}).fn(n):r?AI({element:r,padding:i}).fn(n):{}}}},BI=(e,t)=>{let n=TI(e);return{name:n.name,fn:n.fn,options:[e,t]}},VI=(e,t)=>{let n=EI(e);return{name:n.name,fn:n.fn,options:[e,t]}},HI=(e,t)=>({fn:jI(e).fn,options:[e,t]}),UI=(e,t)=>{let n=DI(e);return{name:n.name,fn:n.fn,options:[e,t]}},WI=(e,t)=>{let n=OI(e);return{name:n.name,fn:n.fn,options:[e,t]}},GI=(e,t)=>{let n=kI(e);return{name:n.name,fn:n.fn,options:[e,t]}},KI=(e,t)=>{let n=zI(e);return{name:n.name,fn:n.fn,options:[e,t]}},qI=`Arrow`,JI=B.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,V.jsx)(KN.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,V.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});JI.displayName=qI;var YI=JI;function XI(e){let[t,n]=B.useState(void 0);return TN(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var ZI=`Popper`,[QI,$I]=CN(ZI),[eL,tL]=QI(ZI),nL=e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,V.jsx)(eL,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};nL.displayName=ZI;var rL=`PopperAnchor`,iL=B.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=tL(rL,n),o=B.useRef(null),s=a.onAnchorChange,c=SN(t,B.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=B.useRef(null);B.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&mL(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,V.jsx)(KN.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});iL.displayName=rL;var aL=`PopperContent`,[oL,sL]=QI(aL),cL=B.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=tL(aL,n),[_,v]=B.useState(null),y=SN(t,v),[b,x]=B.useState(null),S=XI(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(fL),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=RI({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>wI(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[BI({mainAxis:i+w,alignmentAxis:o}),c&&VI({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?HI():void 0,...k}),c&&UI({...k}),WI({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&KI({element:b,padding:s}),pL({arrowWidth:C,arrowHeight:w}),f&&GI({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),ee=g.setPlacementState;TN(()=>(ee(M),()=>{ee(void 0)}),[M,ee]);let[F,te]=mL(M),ne=ZN(m);TN(()=>{N&&ne?.()},[N,ne]);let re=P.arrow?.x,ie=P.arrow?.y,ae=P.arrow?.centerOffset!==0,[oe,se]=B.useState();return TN(()=>{_&&se(window.getComputedStyle(_).zIndex)},[_]),(0,V.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(oL,{scope:n,placedSide:F,placedAlign:te,onArrowChange:x,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,V.jsx)(KN.div,{"data-side":F,"data-align":te,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});cL.displayName=aL;var lL=`PopperArrow`,uL={top:`bottom`,right:`left`,bottom:`top`,left:`right`},dL=B.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=sL(lL,n),a=uL[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(YI,{...r,ref:t,style:{...r.style,display:`block`}})})});dL.displayName=lL;function fL(e){return e!==null}var pL=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=mL(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function mL(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var hL=nL,gL=iL,_L=cL,vL=dL,yL=`Portal`,bL=B.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=B.useState(!1);TN(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Xd.createPortal((0,V.jsx)(KN.div,{...r,ref:t}),o):null});bL.displayName=yL;function xL(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}var SL=e=>{let{present:t,children:n}=e,r=CL(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=TL(r.ref,DL(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null};SL.displayName=`Presence`;function CL(e){let[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),a=B.useRef(`none`),[o,s]=xL(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return B.useEffect(()=>{let e=EL(r.current);a.current=o===`mounted`?e:`none`},[o]),TN(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=EL(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),TN(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=EL(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=EL(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:B.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function wL(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function TL(...e){let t=B.useRef(e);return t.current=e,B.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=wL(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():wL(n[e],null)}}},[])}function EL(e){return e?.animationName||`none`}function DL(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var OL=`rovingFocusGroup.onEntryFocus`,kL={bubbles:!1,cancelable:!0},AL=`RovingFocusGroup`,[jL,ML,NL]=JN(AL),[PL,FL]=CN(AL,[NL]),[IL,LL]=PL(AL),RL=B.forwardRef((e,t)=>(0,V.jsx)(jL.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(jL.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(zL,{...e,ref:t})})}));RL.displayName=AL;var zL=B.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=B.useRef(null),p=SN(t,f),m=XN(a),[h,g]=AN({prop:o,defaultProp:s??null,onChange:c,caller:AL}),[_,v]=B.useState(!1),y=ZN(l),b=ML(n),x=B.useRef(!1),[S,C]=B.useState(0);return B.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(OL,y),()=>e.removeEventListener(OL,y)},[y]),(0,V.jsx)(IL,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:B.useCallback(e=>g(e),[g]),onItemShiftTab:B.useCallback(()=>v(!0),[]),onFocusableItemAdd:B.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:B.useCallback(()=>C(e=>e-1),[]),children:(0,V.jsx)(KN.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:yN(e.onMouseDown,()=>{x.current=!0}),onFocus:yN(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(OL,kL);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);GL([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:yN(e.onBlur,()=>v(!1))})})}),BL=`RovingFocusGroupItem`,VL=B.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=PP(),l=a||c,u=LL(BL,n),d=u.currentTabStopId===l,f=ML(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return B.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,V.jsx)(jL.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,V.jsx)(KN.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:yN(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:yN(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:yN(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=WL(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?KL(n,r+1):n.slice(r+1)}setTimeout(()=>GL(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});VL.displayName=BL;var HL={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function UL(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function WL(e,t,n){let r=UL(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return HL[r]}function GL(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function KL(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var qL=RL,JL=VL,YL=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},XL=new WeakMap,ZL=new WeakMap,QL={},$L=0,eR=function(e){return e&&(e.host||eR(e.parentNode))},tR=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=eR(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},nR=function(e,t,n,r){var i=tR(t,Array.isArray(e)?e:[e]);QL[n]||(QL[n]=new WeakMap);var a=QL[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(XL.get(e)||0)+1,l=(a.get(e)||0)+1;XL.set(e,c),a.set(e,l),o.push(e),c===1&&i&&ZL.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),$L++,function(){o.forEach(function(e){var t=XL.get(e)-1,i=a.get(e)-1;XL.set(e,t),a.set(e,i),t||(ZL.has(e)||e.removeAttribute(r),ZL.delete(e)),i||e.removeAttribute(n)}),$L--,$L||(XL=new WeakMap,XL=new WeakMap,ZL=new WeakMap,QL={})}},rR=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||YL(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),nR(r,i,n,`aria-hidden`)):function(){return null}},iR=function(){return iR=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},iR.apply(this,arguments)};function aR(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function oR(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var sR=`right-scroll-bar-position`,cR=`width-before-scroll-bar`,lR=`with-scroll-bars-hidden`,uR=`--removed-body-scroll-bar-size`;function dR(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function fR(e,t){var n=(0,B.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var pR=typeof window<`u`?B.useLayoutEffect:B.useEffect,mR=new WeakMap;function hR(e,t){var n=fR(t||null,function(t){return e.forEach(function(e){return dR(e,t)})});return pR(function(){var t=mR.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||dR(e,null)}),i.forEach(function(e){r.has(e)||dR(e,a)})}mR.set(n,e)},[e]),n}function gR(e){return e}function _R(e,t){t===void 0&&(t=gR);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function vR(e){e===void 0&&(e={});var t=_R(null);return t.options=iR({async:!0,ssr:!1},e),t}var yR=function(e){var t=e.sideCar,n=aR(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return B.createElement(r,iR({},n))};yR.isSideCarExport=!0;function bR(e,t){return e.useMedium(t),yR}var xR=vR(),SR=function(){},CR=B.forwardRef(function(e,t){var n=B.useRef(null),r=B.useState({onScrollCapture:SR,onWheelCapture:SR,onTouchMoveCapture:SR}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=aR(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=hR([n,t]),C=iR(iR({},b),i);return B.createElement(B.Fragment,null,u&&B.createElement(x,{sideCar:xR,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?B.cloneElement(B.Children.only(s),iR(iR({},C),{ref:S})):B.createElement(v,iR({},C,{className:c,ref:S}),s))});CR.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},CR.classNames={fullWidth:cR,zeroRight:sR};var wR,TR=function(){if(wR)return wR;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function ER(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=TR();return t&&e.setAttribute(`nonce`,t),e}function DR(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function OR(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var kR=function(){var e=0,t=null;return{add:function(n){e==0&&(t=ER())&&(DR(t,n),OR(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},AR=function(){var e=kR();return function(t,n){B.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},jR=function(){var e=AR();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},MR={left:0,top:0,right:0,gap:0},NR=function(e){return parseInt(e||``,10)||0},PR=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[NR(n),NR(r),NR(i)]},FR=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return MR;var t=PR(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},IR=jR(),LR=`data-scroll-locked`,RR=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
313
+ `);var Yy=/\n\n\(One-off timer, set for (\S+?)\. It has fired and will not repeat\.\)$/;function Xy(e){let t=e.trimEnd(),n=Yy.exec(t);if(!n)return null;let r=t.slice(0,n.index).trim();return r?{prompt:r,at:n[1]}:null}var Zy=/^⏳ The (weekly usage limit|session usage limit|usage limit) that interrupted you has reset\. Continue exactly where you left off\.$/;function Qy(e){let t=Zy.exec(e.trim());return t?{window:t[1]===`weekly usage limit`?`weekly`:t[1]===`session usage limit`?`session`:`unknown`}:null}var $y=/^⏰ Your wait expired, nothing resolved\./,eb=/^✅ (?:The work you parked on has|Everything you parked on has) FINISHED, so the park is over/;function tb(e){return e.split(`
314
+ `).filter(e=>e.trimStart().startsWith(`- `))}function nb(e){let t=e.trim();return $y.test(t)?{kind:`expired`,items:tb(t)}:eb.test(t)?{kind:`finished`,items:tb(t)}:null}var rb=/^⏰ Your watcher on (\S+) has expired and is no longer armed\b/;function ib(e){let t=rb.exec(e.trim());return t?{ref:t[1]}:null}var ab=Y([`shell`,`github`,`timer`]),ob=Y([`none`,`running`,`passing`,`failing`]),sb=Y([`mergeable`,`blocked`,`conflicting`,`unknown`]),cb=J({checks:ob,running:av().int().nonnegative(),passed:av().int().nonnegative(),failed:av().int().nonnegative(),failing:q(G()).max(8).default([]),merge:sb,state:Y([`open`,`closed`,`merged`]),polledAt:G(),head:G().optional(),failureSig:G().optional()}).strict(),lb=J({id:G(),kind:ab,target:G(),state:Y([`armed`,`fired`,`dropped`]),createdAt:G(),github:cb.optional(),timer:J({fireAt:G(),prompt:G()}).strict().optional()}).strict(),ub=J({id:G(),target:G(),state:Y([`armed`,`dropped`,`settled`]),createdAt:G(),github:cb.optional()}).strict();J({slug:uv,target:G().trim().min(1).max(200),for:G().trim().min(1).max(16).optional()}).strict(),J({id:G(),target:G(),alreadyArmed:K(),watches:q(ub)}).strict(),J({slug:uv,id:G().min(1).max(64)}).strict(),J({dropped:K(),watches:q(ub)}).strict(),J({slug:uv}).strict(),J({watches:q(ub)}).strict();var db=J({id:G(),prompt:G(),fireAt:G(),state:Y([`armed`,`fired`,`cancelled`]),createdAt:G()}).strict(),fb=J({kind:Y([`done`,`awaiting`]),body:G(),hints:q(Dy).default([])}),pb=J({backend:vy,window:Y([`session`,`weekly`,`unknown`]),at:G(),resumesAt:av().optional(),autoResume:K()}),mb=J({id:uv,title:G(),status:hy,statusText:G().optional(),activity:G().optional(),next:G().optional(),hasPlan:K().default(!1),mechanism:gy.nullable(),humanBlocked:K(),ready:K(),dependsOn:q(uv),externalDeps:q(G()),owner:G().optional(),revalidate:G().optional(),agents:q(by),errors:q(G()),warnings:q(G()),runtime:_y,sessionId:G().optional(),threadName:G().optional(),unread:K(),archived:K(),lastAssistant:G().optional(),spawnedAt:G().optional(),lastActivityAt:G().optional(),lastAssistantAt:G().optional(),aiTitle:G().optional(),titleAuto:K().optional(),titleLocked:K().optional(),subAgents:q(xy).default([]),bgShells:q(Cy).default([]),watches:q(lb).default([]),pendingAsk:Ey.optional(),pendingQuestion:K().default(!1),lastUserAt:G().optional(),providerFault:J({backend:Y([`claude`,`codex`]),category:Y([`authentication_required`,`authentication_rejected`])}).optional(),limitPause:pb.optional(),kind:Y([`session`,`legacy`]).optional(),foreign:K().optional(),state:Y([`open`,`archived`]).optional(),snoozedUntil:Py.optional(),snoozePrompt:G().optional(),bgSnoozed:K().optional(),claudeRuntime:lv(`broker`).optional(),recurringPrompt:Hy.optional(),lastFence:fb.optional(),needsYou:K().optional(),crashed:K().optional(),awaitingBackground:K().optional(),pendingInteraction:K().optional(),actionableInteraction:K().optional(),seenAt:G().optional(),backend:vy.optional(),permissionMode:Y([`auto`,`default`,`acceptEdits`,`plan`,`bypassPermissions`]).optional(),permissionPending:Y([`auto`,`default`,`acceptEdits`,`plan`,`bypassPermissions`]).optional(),permissionChangePending:K().optional(),permPolicy:J({decision:lv(`deny`),rule:G(),reason:G(),tool:G().nullable(),at:G(),command:G().optional()}).optional(),permDenies:av().optional(),profilePendingModel:G().optional(),profilePendingEffort:G().optional(),profileChangePending:K().optional(),runtimeControlPending:K().optional(),controlError:G().optional(),model:G().optional(),effort:G().optional(),context:J({tokens:av(),window:av()}).optional()});function hb(e){return e.kind===`session`&&e.foreign!==!0&&e.needsYou===!0&&e.state!==`archived`}var gb=J({file:G(),kind:Y([`no-frontmatter`,`other`]),message:G()}),_b=J({projectDir:G(),projectName:G(),projectLabel:G(),githubRepo:G().optional(),projectSlug:G().optional(),homeDir:G().optional(),threads:q(mb),errors:q(G()),warnings:q(G()),errorItems:q(gb).optional()}),vb=J({key:G(),label:G(),usedPercent:av(),resetsAt:av().optional()}),yb=J({status:Y([`ok`,`unavailable`]),planType:G().optional(),windows:q(vb),detail:G().optional()});J({claude:yb,codex:yb});var bb=Y([`authed`,`signed-out`,`unknown`]);J({claude:bb,codex:bb,emails:J({claude:G().max(320).optional(),codex:G().max(320).optional()})}),J({backend:Y([`claude`,`codex`])}).strict(),J({status:Y([`done`,`blocked`,`failed`]),auth:bb,activeThreads:av().int().positive().optional(),detail:G().max(200).optional()}),J({backend:Y([`claude`,`codex`])}).strict(),J({attemptId:uv}),J({attemptId:uv}).strict(),J({state:Y([`running`,`exited`,`unknown`]),auth:bb});var xb=Y([`auto`,`default`,`acceptEdits`,`plan`,`bypassPermissions`]),Sb=Y([`system`,`cursor`,`vscode`,`finder`,`copy`]),Cb=J({permissionMode:xb,model:G().optional(),backend:vy.optional(),effort:Y([`low`,`medium`,`high`,`xhigh`,`max`,`ultra`,`ultracode`]).optional(),notifications:K(),projectRail:K(),font:Y([`mono`,`sans`]).optional(),localFileOpener:Sb.optional(),githubPrompt:G().optional()}),wb=J({model:G().trim().min(1).max(200).optional(),effort:Cb.shape.effort,permissionMode:xb.optional()});J({backend:vy,claude:wb,codex:wb});var Tb=J({backend:vy,model:G().trim().min(1).max(200),effort:Cb.shape.effort.unwrap(),permissionMode:xb.optional()}).strict();sv(`field`,[J({field:lv(`backend`),value:vy}),J({field:lv(`profile`),backend:vy,model:G().trim().min(1).max(200),effort:Cb.shape.effort.unwrap()}),J({field:lv(`model`),backend:vy,value:G().trim().min(1).max(200)}),J({field:lv(`effort`),backend:vy,value:Cb.shape.effort.unwrap()})]),J({title:G().min(1).optional(),prompt:G().min(1),slug:uv.optional(),permissionMode:xb.optional(),model:G().optional(),backend:vy.optional(),effort:Cb.shape.effort}),J({slug:uv,message:G().max(64*1024).optional()}).strict(),J({slug:uv,sessionId:G().min(1)}).strict(),J({sessionId:uv,backend:Y([`claude`,`codex`]),title:G().max(200).optional()}).strict(),J({slug:uv,sessionId:G().min(1),message:G().min(1),deliveryId:G().min(1).max(200).optional(),freshProcess:K().optional(),interrupt:K().optional()}),J({slug:uv,sessionId:G().min(1),deliveryId:G().min(1).max(200)}).strict(),J({unqueued:K(),reason:G().optional()}).strict(),J({slug:uv,sessionId:G().min(1)}).strict(),J({interrupted:K(),reason:G().optional()}).strict(),J({slug:uv,sessionId:G().min(1),until:Py.nullable(),prompt:Iy.nullable().optional()}).strict(),J({slug:uv,sessionId:G().min(1),prompt:zy.nullable(),stopHook:K(),heartbeat:K(),postCompaction:K().default(!1),intervalSeconds:Vy.optional()}).strict(),J({slug:uv,prompt:zy.nullable(),stopHook:K(),heartbeat:K(),postCompaction:K().default(!1),pauseOnQuestions:K().optional(),intervalSeconds:Vy.optional()}).strict(),J({replaced:Hy.nullable()}).strict(),J({slug:uv}).strict(),J({recurringPrompt:Hy.nullable()}).strict(),J({slug:uv,prompt:Ky,fireAt:Py}).strict(),J({slug:uv,id:G().min(1).max(64)}).strict(),J({slug:uv}).strict(),J({timers:q(db)}).strict();var Eb=J({kind:Y([`shell`,`agent`,`timer`,`pr`]),id:G(),label:G(),since:G().optional(),until:G().optional()}).strict();J({slug:uv}).strict(),J({activity:q(Eb)}).strict(),J({id:G(),fireAt:G(),timers:q(db)}).strict(),J({cancelled:K(),timers:q(db)}).strict(),J({slug:uv,prompt:zy.nullable(),enabled:K()}).strict(),J({slug:uv,prompt:zy.nullable(),intervalSeconds:Vy.optional(),enabled:K().optional()}).strict(),J({plugins:av().int().min(0),commands:av().int().min(0),agents:av().int().min(0),mcpServers:q(G()),errorCount:av().int().min(0)}).strict(),J({slug:uv,title:G().trim().min(1).max(200)}),J({slug:uv}),J({title:G().min(1).max(200)}),J({slug:uv,permissionMode:xb}),J({effect:Y([`applied`,`next-turn`,`next-resume`])}),J({slug:uv}).strict(),J({backend:vy,options:q(yy)});var Db=J({name:G().min(1).max(512),description:G().max(1024)}).strict();J({slug:uv}).strict(),J({skills:q(Db).max(1024)}).strict(),J({slug:uv,model:G().trim().min(1).max(200),effort:G().trim().min(1).max(100)}).strict(),J({effect:Y([`applied`,`next-resume`])}),`${[`===============================================================`,`====================== YOUR TASK ========================`,`===============================================================`].join(`
315
+ `)}`;var Ob=J({label:G(),actor:G(),bot:K(),at:G().optional(),url:G().optional()}),kb=J({ref:G(),items:q(Ob),omitted:av()}),Ab=`ignore older activity you have already handled`,jb=`These were already on the PR when you parked, so you may have handled some. Check what is still unaddressed, deal with it, and re-park — this is the only time frizz replays a PR's existing activity to you.`;function Mb(e){return typeof e==`string`&&e.includes(jb)}var Nb=String.raw`[A-Za-z0-9][\w.-]*\/[A-Za-z0-9][\w.-]*#\d+`,Pb=new RegExp(String.raw`^(👤|🤖) New GitHub (.+?) on (${Nb}) from @(\S+?)(?: at (\S+?))?\. Read that exact .+? — `+Ab+String.raw` — and continue(?::\s*(\S+)|\.)$`),Fb=new RegExp(String.raw`^(👤|🤖) (\d+) new GitHub items on (${Nb})\. Read exactly these — `+Ab+String.raw` — and continue:$`),Ib=/^- (👤|🤖) (.+?) from @(\S+?)(?: at (\S+?))?(?:: (\S+))?$/,Lb=/^- …and (\d+) more not listed — check .+ for the rest$/;function Rb(e){let t=(e,t,n,r,i)=>({label:e,actor:t,bot:n,...r?{at:r}:{},...i?{url:i}:{}}),n=e.trim().split(`
316
+ `).map(e=>e.trim()).filter(Boolean),r=Pb.exec(n[0]??``);if(r)return{ref:r[3],omitted:0,items:[t(r[2],r[4],r[1]===`🤖`,r[5],r[6])]};let i=Fb.exec(n[0]??``);if(!i)return null;let a=[],o=0;for(let e of n.slice(1)){let n=Lb.exec(e);if(n){o=Number(n[1]);continue}let r=Ib.exec(e);r&&a.push(t(r[2],r[3],r[1]===`🤖`,r[4],r[5]))}return!a.length||a.length+o!==Number(i[2])?null:{ref:i[3],omitted:o,items:a}}var zb=new RegExp(String.raw`^⏰ (${Nb}) was (MERGED|CLOSED)\.$`),Bb=new RegExp(String.raw`^✅ CI PASSED on (${Nb}) — (\d+) checks? green\.$`),Vb=new RegExp(String.raw`^❌ CI FAILED on (${Nb})(?:: (.+?))?\.$`);function Hb(e){for(let t of e.split(`
317
+ `)){let e=t.trim();if(!e)continue;let n=zb.exec(e);if(n)return{ref:n[1],kind:n[2]===`MERGED`?`merged`:`closed`};let r=Bb.exec(e);if(r)return{ref:r[1],kind:`ci`,verdict:`passing`,passed:Number(r[2]),failing:[]};let i=Vb.exec(e);if(i)return{ref:i[1],kind:`ci`,verdict:`failing`,failing:i[2]?i[2].split(`, `):[]}}return null}J({installed:K(),inRepo:K(),nameWithOwner:G().nullable(),authed:K()});var Ub=J({ref:G(),kind:Y([`issue`,`pr`,`commit`]),repo:G(),url:G(),title:G(),body:G(),state:G(),stateReason:G().optional(),at:G().optional(),authorLogin:G().optional(),authorName:G().optional(),authorAvatar:G().optional(),labels:q(J({name:G(),color:G()})).default([]),additions:av().int().nonnegative().optional(),deletions:av().int().nonnegative().optional(),changedFiles:av().int().nonnegative().optional(),comments:av().int().nonnegative().optional(),fetchedAt:av().int().nonnegative()});J({refs:q(G().min(3).max(120)).min(1).max(100),refresh:K().default(!1)}),J({cards:q(Ub),missing:q(G()),error:G().optional()});var Wb=J({kind:Y([`issue`,`pr`]),number:av().int().positive(),title:G(),url:G(),reactions:av().int().nonnegative(),updatedAt:G(),comments:av().int().nonnegative().optional(),createdAt:G().optional(),author:G().optional(),labels:q(J({name:G(),color:G()})).default([]),state:G().optional(),isDraft:K().optional(),linkedPrs:J({count:av().int().positive(),number:av().int().positive(),url:G(),state:G(),isDraft:K().optional()}).optional()});J({kind:Y([`issues`,`prs`]),sort:Y([`recent`,`reactions`]),page:av().int().min(1).default(1),perPage:av().int().min(1).max(100).default(30)}),J({items:q(Wb),total:av().int().nonnegative(),page:av().int().positive(),pageCount:av().int().positive()}),Tb.extend({items:q(J({kind:Y([`issue`,`pr`]),number:av().int().positive()})).min(1)}).strict(),J({dispatched:q(J({number:av(),kind:G(),slug:uv})),failed:q(J({number:av(),kind:G(),error:G()}))});var Gb=J({projectDir:G(),projectName:G(),projectLabel:G(),errors:q(G()),warnings:q(G()),errorItems:q(gb).optional()});sv(`type`,[J({type:lv(`board`),board:_b,seq:av().optional(),bootId:G().optional()}),J({type:lv(`board-delta`),seq:av(),bootId:G(),upserts:q(mb),removed:q(uv),meta:Gb.optional()}),J({type:lv(`notify`),slug:uv,kind:Y([`needs-decision`,`turn-done`,`exited`]),title:G(),body:G().optional()}),J({type:lv(`interactions-invalidated`),slug:bv,sessionId:yv,interactionId:yv,lifecycle:Zv,recordRevision:xv}).strict()]);var Kb=J({file:G(),old:G(),new:G()}),qb=J({text:G(),status:Y([`pending`,`in_progress`,`completed`])}),Jb=J({name:G(),detail:G().optional(),edit:Kb.optional(),desc:G().optional(),command:G().optional(),input:G().optional(),read:G().optional(),output:G().optional(),outputImage:G().optional(),status:Y([`pending`,`completed`,`failed`,`cancelled`]).optional(),backgroundState:Y([`background`,`unknown`]).optional(),shellId:G().optional(),exitCode:av().int().optional(),cwd:G().optional(),sessionId:ov([G(),av()]).optional(),durationMs:av().nonnegative().optional(),prompt:G().optional(),subagentType:G().optional(),agentId:G().optional(),agentStatus:Y([`completed`,`failed`,`killed`]).optional(),agentElapsedMs:av().optional(),agentCompletion:K().optional(),sendTo:G().optional(),sendSummary:G().optional(),sendBody:G().optional(),sendType:G().optional(),sendDispatchId:G().optional(),sendTargetLabel:G().optional(),sentImages:q(G()).optional(),sentFiles:q(G()).optional(),caption:G().optional(),todos:q(qb).optional()}),Yb=sv(`kind`,[J({kind:lv(`text`),text:G()}),J({kind:lv(`tools`),tools:q(Jb)})]),Xb=J({sourceId:G().min(1).max(768).optional(),pinnedFromSourceId:G().min(1).max(768).optional(),role:Y([`user`,`assistant`]),text:G(),displayText:G().optional(),tools:q(Jb),at:G().optional(),kind:Y([`event`,`reasoning`]).optional(),durationMs:av().nonnegative().optional(),boundary:Y([`wake`,`compaction`,`rest`]).optional(),parts:q(Yb).default([]),queued:K().optional(),deliveryId:G().optional(),deliveryState:Y([`pending`,`enqueued`,`delivered`,`unconfirmed`]).optional(),wake:K().optional(),wakeSteer:kb.optional(),peerFrom:G().optional(),peerDispatchId:G().optional(),peerUnnamed:lv(!0).optional(),peerSenderTaskId:G().optional(),fenceRefused:lv(!0).optional()}),Zb=G().min(1).max(2048).regex(/^[A-Za-z0-9_-]+$/);J({messages:q(Xb),beforeCursor:Zb.nullable(),hasEarlier:K(),reachedTurnBoundary:K(),transcriptKey:G().min(1).max(256)}).strict(),J({slug:uv,cursor:Zb}).strict();var Qb=uv;sv(`t`,[J({t:lv(`sub`),topic:lv(`transcript`),slug:Qb}).strict(),J({t:lv(`unsub`),topic:lv(`transcript`),slug:Qb}).strict()]);var $b=J({id:G(),slug:G(),name:G(),path:G(),lastOpenedAt:G(),stale:K(),iconVersion:G().optional(),iconStatus:Y([`icon`,`none`,`unknown`]),iconIsCustom:K().optional()}),ex=[`png`,`svg`,`ico`,`webp`,`jpg`,`jpeg`,`gif`];sv(`kind`,[J({kind:lv(`picked`),project:$b}),J({kind:lv(`cancelled`)}),J({kind:lv(`unavailable`),reason:G()})]),J({projectSlug:G(),projectName:G()});var tx=`/_frizz`,nx=null;function rx(e){nx=e}function ix(){return nx?(nx(),!0):!1}var ax=new Map,ox=new Map;function sx(e,t){t?ax.set(e,t):ax.delete(e)}function cx(e){let t=ax.get(e);return t?(t(),!0):!1}function lx(e,t){t?ox.set(e,t):ox.delete(e)}function ux(e){ox.get(e)?.()}function dx(){if(typeof document>`u`||!document.body)return typeof window>`u`?0:window.scrollY;let e=fx()?Number.parseFloat(document.body.style.top):NaN;return Number.isNaN(e)?window.scrollY:-e}function fx(){return typeof document<`u`&&document.body?.style.position===`fixed`}var px=null;function mx(e){px=e}function hx(){let e=px;return px=null,e}function gx(e,t){if(!e)return{kind:`loading`};let n=e.threads.find(e=>e.id===t);return n?{kind:`found`,ownership:n.kind===`session`?n.foreign===!0?`foreign`:`owned`:`legacy`,thread:n}:{kind:`missing`}}var _x=new Set([`thread`,`status`]);function vx(e){if(typeof e==`string`)return e;let t=typeof location>`u`?void 0:location.pathname;return typeof t==`string`?t:`/`}var yx=`project`,mee=`/${yx}`;function bx(e){let[,t,n]=vx(e).split(`/`);return t===yx&&n?n:void 0}function xx(e){return`${mee}/${e}`}function Sx(e){let t=bx(e);return t?xx(t):``}function Cx(e){let t=vx(e),n=Sx(t);return n?t.slice(n.length)||`/`:t||`/`}function wx(e,t){let n=Sx(vx(t));return n?`${n}${e===`/`?``:e}`||`/`:e}function hee(e,t){if(!e||!e.startsWith(`/`)||e.startsWith(`//`))return null;let n=e.replace(/[?#].*$/u,``);if(bx(n))return null;let r=n.split(`/`)[1]??``;if(!_x.has(r))return null;let i=wx(e,t);return i===e?null:i}function Tx(e){let t=bx(e);return t?`${tx}/${t}`:tx}function Ex(e,t){return wx(`/thread/${encodeURIComponent(e)}/full`,t)}function gee(e){let t=e.match(/^\/thread\/([^/]+)\/full$/);if(!t)return null;try{return decodeURIComponent(t[1])}catch{return null}}function Dx(e,t){let n=bx(t);return n===void 0||e==null?!0:e===n}var Ox=`https://github.com`,kx=null,Ax=new Set;function jx(e){let t=e??null;if(t!==kx){kx=t;for(let e of Ax)e()}}function Mx(){return kx}function Nx(e){return Ax.add(e),()=>Ax.delete(e)}var Px=`[A-Za-z0-9][A-Za-z0-9._-]*`,Fx=RegExp(`^https://github\\.com/(${Px})/(${Px})/(?:(issues|pull)/([1-9]\\d{0,9})|commit/([0-9a-f]{7,40}))(?:[/?#].*)?$`,`i`);function Ix(e){if(!e)return null;let t=Fx.exec(e.trim());if(!t)return null;let[,n,r,,i,a]=t;return i?`${n}/${r}#${i}`:`${n}/${r}@${a.toLowerCase()}`}var Lx=RegExp(`(^|[^\\w#/&@-])(?:(${Px}/${Px})@([0-9a-f]{7,40})|(${Px}/${Px})?#([1-9]\\d{0,9})|([0-9a-f]{7,40}))(?![\\w-])`,`g`);function Rx(e){return/\d/.test(e)&&/[a-f]/.test(e)}function zx(e){return{type:`text`,raw:e,text:e}}function Bx(e,t,n){return{type:`link`,raw:e,href:t,title:n,text:e,tokens:[zx(e)]}}function Vx(e){if(!kx)return[];let t=[];Lx.lastIndex=0;for(let n=Lx.exec(e);n;n=Lx.exec(e)){let[e,r,i,a,o,s,c]=n,l=a??c;if(l&&!Rx(l))continue;let u=s?`${Ox}/${o??kx}/issues/${s}`:`${Ox}/${i??kx}/commit/${l}`,d=s?`${o??kx}#${s}`:`${i??kx}@${l}`;t.push({start:n.index+r.length,text:e.slice(r.length),href:u,title:d})}return t}function Hx(e){let t=Vx(e);if(t.length===0)return null;let n=[],r=0;for(let{start:i,text:a,href:o,title:s}of t)i>r&&n.push(zx(e.slice(r,i))),n.push(Bx(a,o,s)),r=i+a.length;return r<e.length&&n.push(zx(e.slice(r))),n}var Ux=new Set([`code`,`codespan`,`html`,`link`,`image`]);function Wx(e){let t=[],n=e;Array.isArray(n.tokens)&&t.push(n.tokens),Array.isArray(n.items)&&t.push(n.items);for(let e of n.header??[])Array.isArray(e.tokens)&&t.push(e.tokens);for(let e of n.rows??[])for(let n of e)Array.isArray(n.tokens)&&t.push(n.tokens);return t}function Gx(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(Ux.has(n.type))continue;let r=Wx(n);for(let e of r)Gx(e);if(n.type!==`text`||r.length>0)continue;let i=Hx(n.text);i&&e.splice(t,1,...i)}}var Kx=`frizz-boot-id`;function qx(e){try{return sessionStorage.getItem(e)}catch{return null}}function Jx(e,t){try{sessionStorage.setItem(e,t)}catch{}}function Yx(e){switch(oy(qx(Kx),e)){case`noop`:return;case`record`:Jx(Kx,e);return;case`adopt`:Jx(Kx,e);return}}var Xx={board:`query`,threadBody:`query`,threadTranscript:`query`,threadTranscriptEarlier:`query`,subAgentTranscript:`query`,subAgentSteer:`mutation`,subAgentStop:`mutation`,backgroundShellOutput:`query`,backgroundShellActivity:`query`,stopBackgroundOp:`mutation`,pendingInteractions:`query`,interactionGet:`query`,interactionResolve:`mutation`,interactionCancel:`mutation`,dispatch:`mutation`,adoptThread:`mutation`,followUp:`mutation`,unqueueFollowUp:`mutation`,deliverQueuedNow:`mutation`,setThreadPermission:`mutation`,threadProfileOptions:`query`,threadSkills:`query`,setThreadProfile:`mutation`,markRead:`mutation`,threadSeen:`mutation`,setThreadState:`mutation`,completeThread:`mutation`,setThreadSnooze:`mutation`,setThreadRecurringPrompt:`mutation`,setOwnThreadRecurringPrompt:`mutation`,addOwnPrWatch:`mutation`,dropOwnPrWatch:`mutation`,listOwnPrWatches:`mutation`,getOwnThreadRecurringPrompt:`mutation`,setOwnThreadStopHook:`mutation`,setOwnThreadHeartbeat:`mutation`,setThreadHeartbeat:`mutation`,setOwnThreadTimer:`mutation`,cancelOwnThreadTimer:`mutation`,listOwnThreadTimers:`mutation`,listOwnThreadActivity:`mutation`,reloadThreadPlugins:`mutation`,snoozeAwaitingBackground:`mutation`,forgetThread:`mutation`,threadTerminalCommand:`query`,openExternal:`mutation`,openLocalFile:`mutation`,localMarkdown:`query`,resolveLocalPaths:`query`,markComplete:`mutation`,setThreadStatus:`mutation`,dismissThread:`mutation`,repairThread:`mutation`,archiveThread:`mutation`,killAgent:`mutation`,renameThread:`mutation`,aiRenameThread:`mutation`,codexModels:`query`,quota:`query`,authStatus:`query`,accountLogout:`mutation`,accountLoginStart:`mutation`,accountLoginStatus:`query`,accountLoginCancel:`mutation`,threadLocate:`query`,projectsList:`query`,projectPick:`mutation`,projectAdd:`mutation`,projectsReorder:`mutation`,projectsQueueCounts:`query`,projectIconPick:`mutation`,projectIconSet:`mutation`,projectIconClear:`mutation`,settingsGet:`query`,settingsSet:`mutation`,settingsReset:`mutation`,dispatchPreferencesGet:`query`,dispatchPreferenceSet:`mutation`,githubPromptDefaults:`query`,githubStatus:`query`,githubList:`query`,githubDispatchBatch:`mutation`,githubRefPreview:`query`},Zx=`Frizz is updating and restarting. Your draft is preserved; wait until it is ready before sending or changing settings.`;function Qx(e){return e?.retryableRpc===!0}function $x(e){return Object.defineProperty(e,"retryableRpc",{value:!0,enumerable:!1}),e}function eS(e){if(e===`mutation`&&Z.controlPlaneState===`restarting`)throw $x(Error(Zx))}async function tS(e,t){let n=await e.text(),r;try{r=JSON.parse(n)}catch{throw e.status===404||e.status===405?Error(`Frizz server restart required — this control is newer than the running server`):e.status===403?Error(`RPC ${t} was refused (403) — the page's origin does not match the server it is talking to. Reload from the URL frizz is actually serving.`):Error(`RPC ${t} returned a non-JSON response (HTTP ${e.status})`)}if(!e.ok){let e=Error(typeof r.error==`string`?r.error:`RPC ${t} failed`);throw r.retryable===!0?$x(e):e}return r.result}async function nS(e,t,n,r){if(eS(t),t===`query`){let t=new URL(`${Tx()}/rpc/${e}`,location.origin);n!==void 0&&t.searchParams.set(`input`,JSON.stringify(n));let i=await fetch(t.toString(),{signal:r?.signal});return Yx(i.headers.get(`x-frizz-boot`)),tS(i,e)}let i=await fetch(`${Tx()}/rpc/${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n??{}),signal:r?.signal});return Yx(i.headers.get(`x-frizz-boot`)),tS(i,e)}var X=new Proxy({},{get(e,t){let n=Xx[t];if(n)return(e,r)=>nS(t,n,e,r)}}),rS=6e4,iS=80,aS=100,oS={loading:!0},sS=new Map,cS=new Set,lS=new Set,uS;function dS(){for(let e of cS)e()}function fS(e){return cS.add(e),()=>cS.delete(e)}function pS(e){return sS.get(e)}function mS(e,t=Date.now()){return!e?.card||e.card.kind===`commit`?!1:t-e.card.fetchedAt>rS}var hS=/data-gh-ref="([^"]+)"/g;function gS(e){if(!e.includes(`data-gh-ref`))return[];let t=new Set;for(let n of e.matchAll(hS))t.add(n[1]);return[...t]}function _S(e){let t=!1;for(let n of e)sS.has(n)||lS.has(n)||(lS.add(n),t=!0);!t||uS!==void 0||(uS=setTimeout(()=>{uS=void 0,yS()},iS))}function vS(e,t){for(let e of t.cards)sS.set(e.ref,{card:e});for(let e of t.missing)sS.set(e,{missing:!0});for(let t of e)sS.get(t)===oS&&sS.delete(t);dS()}async function yS(){let e=[...lS].slice(0,aS);if(e.length!==0){for(let t of e)lS.delete(t),sS.set(t,oS);dS();try{vS(e,await X.githubRefPreview({refs:e}))}catch{vS(e,{cards:[],missing:[]})}lS.size>0&&uS===void 0&&(uS=setTimeout(()=>{uS=void 0,yS()},0))}}var bS=new Set;function xS(e){bS.has(e)||(bS.add(e),X.githubRefPreview({refs:[e],refresh:!0}).then(e=>{for(let t of e.cards)sS.set(t.ref,{card:t});dS()}).catch(()=>{}).finally(()=>bS.delete(e)))}function SS(){sS.clear(),lS.clear(),bS.clear(),uS!==void 0&&(clearTimeout(uS),uS=void 0),dS()}var CS={dir:``,home:``},wS=CS,TS=new Set;function ES(e,t){let n={dir:e??``,home:t??``};if(!(n.dir===wS.dir&&n.home===wS.home)){wS=n.dir||n.home?n:CS;for(let e of TS)e()}}function DS(){return wS}function OS(e){return TS.add(e),()=>TS.delete(e)}function kS(e){if(typeof document>`u`)return null;let t=document.querySelector(`[data-queue-card="${CSS.escape(e)}"]`);return t?t.querySelector(`[data-queue-card-root="${CSS.escape(e)}"]`)??t:null}function AS(e){let t=kS(e);if(!t)return null;let n=typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 800px)`).matches?40:0;return Math.max(0,dx()+t.getBoundingClientRect().top-40-n)}var Z=Rf({board:null,view:`todos`,connection:`connecting`,controlPlaneState:`ready`,controlPlaneMessage:null,controlPlaneRestartPending:!1,showSettings:!1,showPalette:!1,showNewThread:!1,showGithubPicker:!1,sidebarCollapsed:{active:!1,held:!0,inactive:!0,external:!0},drawers:[],notificationsEnabled:!1,socketTranscripts:!1,socketBoardFallback:null,socketTranscriptFallbacks:{},routeThreadSlug:null,toast:null});function jS(){Z.showNewThread=!0}function MS(){Z.showGithubPicker=!0}function NS(){Z.showGithubPicker=!1}var PS=0;function Q(e,t){Z.toast={id:++PS,text:e,...t}}var FS=0,IS=0;function LS(e,t){return e.kind===t.kind?e.kind===`markdown`?e.path===t.path:e.kind===`subagent`||e.kind===`shell`?e.subId===t.subId:e.slug===t.slug:!1}function RS(e,t){return t.kind===`markdown`?!0:t.kind===`subagent`||t.kind===`shell`?(e.kind===`thread`||e.kind===`doc`)&&e.slug===t.slug:t.kind===`doc`?e.kind===`thread`&&e.slug===t.slug:t.kind===`thread`?e.kind===`doc`&&e.slug===t.slug:!1}function zS(e){let t=Z.drawers.filter(t=>!t.closing&&!LS(t,e)&&!RS(t,e)).map(e=>e.id);t.length&&QS(t);let n=Z.drawers.filter(t=>LS(t,e));if(!n.length){Z.drawers.push({...e,id:++FS,openedAt:++IS});return}let r=[...n].reverse().find(e=>!e.closing)??n[n.length-1],{closing:i,...a}=r,o={...a,...e,openedAt:++IS};Z.drawers=[...Z.drawers.filter(t=>!LS(t,e)),o],queueMicrotask(()=>ux(r.id))}function BS(e,t,n){zS({kind:e,slug:t,routed:n?.routed})}function VS(e,t,n){zS({kind:`subagent`,slug:e,subId:t,label:n.label,subagentType:n.subagentType,startedAt:n.startedAt})}function HS(e,t,n){zS({kind:`shell`,slug:e,subId:t,label:n.label,startedAt:n.startedAt})}function US(e){let t=Z.board?.threads.find(t=>t.id===e);t?.needsYou&&GS(e)||BS(t&&t.runtime===`none`?`doc`:`thread`,e)}function WS(){let e=Z.routeThreadSlug;if(!e||!Z.board)return;Z.routeThreadSlug=null;let t=gx(Z.board,e);if(t.kind===`missing`){typeof location<`u`&&location.replace(Ex(e));return}t.kind===`found`&&t.thread.needsYou&&GS(e)||BS(`thread`,e,{routed:!0})}function GS(e){let t=kS(e);if(!t)return!1;let n=AS(e),r=Z.drawers.filter(e=>!e.closing).map(e=>e.id);return r.length&&QS(r),n!==null&&(fx()?mx(n):Math.abs(window.scrollY-n)>.5&&window.scrollTo({top:n,left:0,behavior:`auto`})),qS(e,t),!0}var KS=new Map;function qS(e,t){let n=KS.get(e);n!==void 0&&window.clearTimeout(n),t.removeAttribute(`data-queue-flash`),t.offsetWidth,t.setAttribute(`data-queue-flash`,``),KS.set(e,window.setTimeout(()=>{KS.delete(e),t.removeAttribute(`data-queue-flash`)},1100))}function JS(e){zS({kind:`markdown`,slug:e,path:e,label:e.split(`/`).filter(Boolean).pop()||e})}function YS(){return Z.drawers[Z.drawers.length-1]}function XS(e){let t=Z.drawers.find(t=>t.id===e);t&&(t.closing=!0)}function ZS(e){Z.drawers.find(t=>t.id===e)?.closing&&(Z.drawers=Z.drawers.filter(t=>t.id!==e))}function QS(e){let t=[];for(let n of e)cx(n)||t.push(n);if(t.length){let e=new Set(t);Z.drawers=Z.drawers.filter(t=>!e.has(t.id))}}function $S(){for(let e=Z.drawers.length-1;e>=0;e--){let t=Z.drawers[e];if(t.kind===`thread`&&!t.closing)return t.slug}return null}function eC(e){Dx(e.projectSlug)&&(jx(e.githubRepo),ES(e.projectDir,e.homeDir),Z.board=e)}function tC(){jx(null),ES(null),SS(),Z.board=null,Z.view=`todos`,Z.connection=`connecting`,Z.drawers=[],Z.routeThreadSlug=null,Z.socketBoardFallback=null,Z.socketTranscriptFallbacks={},Z.showSettings=!1,Z.showNewThread=!1,Z.showGithubPicker=!1}function nC(e){Dx(e.projectSlug)&&Z.board===null&&(jx(e.githubRepo),ES(e.projectDir,e.homeDir),Z.board=e)}function rC(e){return Z.board===null?!1:(iy(Z.board,e),!0)}function iC(e,t){if(!(!e||!t))return e.threads.find(e=>e.id===t)}var aC=`fixed inset-0 bg-black/40 backdrop-blur-[1px] transition-opacity duration-200 ease-out motion-reduce:transition-none`,oC=`frizz-sheet-panel flex h-full flex-col border-l border-border bg-panel shadow-2xl shadow-black/50 transition-transform duration-200 ease-out motion-reduce:transition-none`;function sC(e,t=0){let n=Math.max(0,e-t);return`min(${720-n*28}px, ${80-n*4}vw)`}function cC(){return typeof window<`u`&&!!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches}function lC(e,t=!1){let[n,r]=(0,B.useState)(t),i=(0,B.useRef)(!1),a=Hf(Z);(0,B.useEffect)(()=>{if(t)return;let e=!1,n=()=>{e||i.current||(e=!0,r(!0))},a=requestAnimationFrame(n),o=window.setTimeout(n,120);return()=>{cancelAnimationFrame(a),window.clearTimeout(o)}},[t]);let o=(0,B.useCallback)(()=>{i.current||(i.current=!0,XS(e),r(!1),window.setTimeout(()=>ZS(e),cC()?0:210))},[e]);return(0,B.useEffect)(()=>(sx(e,o),()=>sx(e,null)),[e,o]),(0,B.useEffect)(()=>{a.drawers.find(t=>t.id===e)?.closing||!i.current||(i.current=!1,r(!0))},[a.drawers,e]),{shown:n,close:o,closingRef:i}}var uC=`[data-radix-popper-content-wrapper],[role='menu'],[role='listbox'],[role='dialog']`;function dC(e){return document.body.style.pointerEvents===`none`||e.closest(uC)!==null}function fC(e,t,n,r){(0,B.useEffect)(()=>{function i(i){let a=i.target;if(!(a instanceof Element)||t.current?.contains(a)||dC(a))return;let o=Z.drawers.findIndex(t=>t.id===e);o===-1||o<Z.drawers.length-1||r&&a.closest(`[data-subagent-parent]`)?.getAttribute(`data-subagent-parent`)===r||n()}return window.addEventListener(`pointerdown`,i,!0),()=>window.removeEventListener(`pointerdown`,i,!0)},[e,t,n,r])}function pC({id:e,depth:t,widthDepth:n,widthOffset:r=0,subagentParent:i,children:a}){let{shown:o,close:s}=lC(e),c=(0,B.useRef)(null);return fC(e,c,s,i),(0,V.jsx)(`div`,{className:`${aC} pointer-events-none flex justify-end ${o?`opacity-100`:`opacity-0`}`,style:{zIndex:50+t*2},children:(0,V.jsx)(`div`,{ref:c,className:`${oC} pointer-events-auto ${o?`translate-x-0`:`translate-x-full`}`,style:{width:sC(n,r)},children:a(s)})})}var mC=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),hC=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),gC=e=>{let t=hC(e);return t.charAt(0).toUpperCase()+t.slice(1)},_C=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),vC=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},yC={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},bC=(0,B.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,B.createElement)(`svg`,{ref:c,...yC,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:_C(`lucide`,i),...!a&&!vC(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,B.createElement)(e,t)),...Array.isArray(a)?a:[a]])),xC=(e,t)=>{let n=(0,B.forwardRef)(({className:n,...r},i)=>(0,B.createElement)(bC,{ref:i,iconNode:t,className:_C(`lucide-${mC(gC(e))}`,`lucide-${e}`,n),...r}));return n.displayName=gC(e),n},SC=xC(`alarm-clock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),CC=xC(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),wC=xC(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),TC=xC(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),EC=xC(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),DC=xC(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),OC=xC(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),kC=xC(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),AC=xC(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),jC=xC(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),MC=xC(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),NC=xC(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),PC=xC(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),FC=xC(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),IC=xC(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),LC=xC(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),RC=xC(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),zC=xC(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),BC=xC(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),VC=xC(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),HC=xC(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),UC=xC(`clock`,[[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),WC=xC(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),GC=xC(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),KC=xC(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),qC=xC(`file-text`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),JC=xC(`git-branch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),YC=xC(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),XC=xC(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),ZC=xC(`git-pull-request-closed`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`m21 3-6 6`,key:`16nqsk`}],[`path`,{d:`m21 9-6-6`,key:`9j17rh`}],[`path`,{d:`M18 11.5V15`,key:`65xf6f`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),QC=xC(`git-pull-request-draft`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M18 6V5`,key:`1oao2s`}],[`path`,{d:`M18 11v-1`,key:`11c8tz`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),$C=xC(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),ew=xC(`github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),tw=xC(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),nw=xC(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),rw=xC(`image-plus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),iw=xC(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),aw=xC(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),ow=xC(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),sw=xC(`list-checks`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),cw=xC(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),lw=xC(`message-square-code`,[[`path`,{d:`M10 7.5 8 10l2 2.5`,key:`xb17xw`}],[`path`,{d:`m14 7.5 2 2.5-2 2.5`,key:`5rap1v`}],[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),uw=xC(`message-square`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),dw=xC(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),fw=xC(`package-check`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),pw=xC(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),mw=xC(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),hw=xC(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),gw=xC(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),_w=xC(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),vw=xC(`repeat`,[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]),yw=xC(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),bw=xC(`settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),xw=xC(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Sw=xC(`signpost`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M12 3v3`,key:`1n5kay`}],[`path`,{d:`M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z`,key:`gqqp9m`}]]),Cw=xC(`sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),ww=xC(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Tw=xC(`square-dot`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Ew=xC(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Dw=xC(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Ow=xC(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),kw=xC(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Aw=xC(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),jw=xC(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Mw({title:e,subtitle:t,icon:n,meta:r,actions:i,onClose:a,initialFocus:o}){return(0,V.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-2.5 border-b border-border bg-panel px-4`,children:[n,(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,title:e,children:e}),r]}),t&&(0,V.jsx)(`span`,{className:`truncate text-[10px] text-muted/60`,children:t})]}),i,(0,V.jsx)(`button`,{type:`button`,"aria-label":`Close`,onClick:a,...o?{"data-dialog-initial-focus":``}:{},className:`rounded-md p-1.5 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,V.jsx)(jw,{size:15})})]})}function Nw(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((e,n)=>Object.is(e,t[n]))}var Pw=class extends B.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[frizz] render error in ${this.props.label}:`,e,t.componentStack)}componentDidUpdate(e){!this.state.error||Nw(e.resetKeys,this.props.resetKeys)||this.setState({error:null})}retry=()=>this.setState({error:null});render(){let{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.retry):(0,V.jsx)(Lw,{label:this.props.label,error:e,onRetry:this.retry}):this.props.children}};function Fw(e){let t=e instanceof Error?`${e.name}: ${e.message}`:String(e);return t.length>300?`${t.slice(0,300)}…`:t}var Iw=`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`;function Lw({label:e,error:t,onRetry:n,onClose:r}){return(0,V.jsxs)(`div`,{"data-error-panel":!0,className:`m-4 rounded-md border border-border-strong bg-panel-2 px-3.5 py-3 text-[12.5px]`,children:[(0,V.jsxs)(`p`,{className:`text-fg/90`,children:[`Something went wrong rendering `,e,`.`]}),(0,V.jsx)(`p`,{className:`font-mono-keep mt-1.5 break-words text-[11.5px] text-muted`,children:Fw(t)}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,className:Iw,onClick:n,children:`Try again`}),r&&(0,V.jsx)(`button`,{type:`button`,className:Iw,onClick:r,children:`Close`}),(0,V.jsx)(`button`,{type:`button`,className:Iw,onClick:()=>window.location.reload(),children:`Reload frizz`})]})]})}function Rw({children:e}){return(0,V.jsx)(Pw,{label:`frizz`,fallback:(e,t)=>(0,V.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-bg p-6 text-fg`,children:(0,V.jsx)(`div`,{className:`w-full max-w-lg`,children:(0,V.jsx)(Lw,{label:`frizz`,error:e,onRetry:t})})}),children:e})}function zw({id:e,depth:t,widthDepth:n,error:r,onRetry:i}){let a=()=>{Z.drawers=Z.drawers.filter(t=>t.id!==e)};return(0,V.jsx)(pC,{id:e,depth:t,widthDepth:n,children:e=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Mw,{title:`This drawer could not be rendered`,onClose:()=>{e(),a()}}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:(0,V.jsx)(Lw,{label:`this drawer`,error:r,onRetry:i,onClose:a})})]})})}var Bw=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Vw=/^[\\/]{2}/;function Hw(e,t){return t+e.replace(/\\/g,`/`)}var Uw=`popstate`;function Ww(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Gw(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Xw(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:Zw(t)}return $w(t,n,null,e)}function Kw(e,t){if(e===!1||e==null)throw Error(t)}function qw(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Jw(){return Math.random().toString(36).substring(2,10)}function Yw(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Xw(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Qw(t):t,state:n,key:t&&t.key||r||Jw(),mask:i}}function Zw({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function Qw(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function $w(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=Ww(e)?e:Xw(h.location,e,t);n&&n(r,e),l=u()+1;let d=Yw(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=Ww(e)?e:Xw(h.location,e,t);n&&n(r,e),l=u();let i=Yw(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return eT(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Uw,d),c=e,()=>{i.removeEventListener(Uw,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function eT(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),Kw(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:Zw(t);return i=i.replace(/ $/,`%20`),!n&&Vw.test(i)&&(i=r+i),new URL(i,r)}var tT=class{#e=new Map;constructor(e){if(e)for(let[t,n]of e)this.set(t,n)}get(e){if(this.#e.has(e))return this.#e.get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){this.#e.set(e,t)}},nT=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function rT(e){return nT.has(e)}var iT=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function aT(e){return iT.has(e)}function oT(e){return e.index===!0}function sT(e){let t={};return e.Component&&Object.assign(t,{element:B.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:B.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:B.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function cT(e,t=sT,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(Kw(e.index!==!0||!e.children,`Cannot specify children on an index route`),Kw(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),oT(e)){let n={...e,id:s};return r[s]=lT(n,t(n)),n}else{let n={...e,id:s,children:void 0};return r[s]=lT(n,t(n)),e.children&&(n.children=cT(e.children,t,o,r,i)),n}})}function lT(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function uT(e,t,n=`/`){return dT(e,t,n,!1)}function dT(e,t,n,r,i){let a=NT((typeof t==`string`?Qw(t):t).pathname||`/`,n);if(a==null)return null;let o=i??pT(e),s=null,c=MT(a);for(let e=0;s==null&&e<o.length;++e)s=OT(o[e],c,r);return s}function fT(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,loaderData:t[n.id],handle:n.handle}}function pT(e){let t=mT(e);return gT(t),t}function mT(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;Kw(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=UT([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(Kw(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),mT(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:ET(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=jT(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of hT(e.path))a(e,t,!0,n)}),t}function hT(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=hT(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function gT(e){e.sort((e,t)=>e.score===t.score?DT(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var _T=/^:[\w-]+$/,vT=/^:[\w-]+/,yT=3.5,bT=3,xT=2,ST=1,CT=10,wT=-2,TT=e=>e===`*`;function ET(e,t){let n=e.split(`/`),r=n.length;return n.some(TT)&&(r+=wT),t&&(r+=xT),n.filter(e=>!TT(e)).reduce((e,t)=>e+(_T.test(t)?bT:vT.test(t)?yT:t===``?ST:CT),r)}function DT(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function OT(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?AT(u,l,s.matcher,s.compiledParams):kT(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=kT({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:UT([a,d.pathname]),pathnameBase:GT(UT([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=UT([a,d.pathnameBase]))}return o}function kT(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=jT(e.path,e.caseSensitive,e.end);return AT(e,t,n,r)}function AT(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function jT(e,t=!1,n=!0){qw(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function MT(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return qw(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function NT(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function PT({basename:e,pathname:t}){return t===`/`?e:UT([e,t])}var FT=e=>Bw.test(e);function IT(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Qw(e):e,a;return n?(n=HT(n),a=n.startsWith(`/`)?LT(n.substring(1),`/`):LT(n,t)):a=t,{pathname:a,search:KT(r),hash:qT(i)}}function LT(e,t){let n=WT(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function RT(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function zT(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function BT(e){let t=zT(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function VT(e,t,n,r=!1){let i;typeof e==`string`?i=Qw(e):(i={...e},Kw(!i.pathname||!i.pathname.includes(`?`),RT(`?`,`pathname`,`search`,i)),Kw(!i.pathname||!i.pathname.includes(`#`),RT(`#`,`pathname`,`hash`,i)),Kw(!i.search||!i.search.includes(`#`),RT(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=IT(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var HT=e=>e.replace(/[\\/]{2,}/g,`/`),UT=e=>HT(e.join(`/`)),WT=e=>e.replace(/\/+$/,``),GT=e=>WT(e).replace(/^\/*/,`/`),KT=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,qT=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,JT=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],YT=class{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function XT(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function ZT(e){return UT(e.map(e=>e.route.path).filter(Boolean))||`/`}function QT(e,t){let n=new URL(typeof e==`string`||e instanceof URL?e:e.url),r=typeof t==`string`?Qw(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);let i=e.toString();n.search=i?`?${i}`:``}else n.search=``;return n.hash=r.hash||``,n}var $T=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function eE(e,t){let n=e;if(typeof n!=`string`||!Bw.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if($T)try{let e=new URL(window.location.href),r=Vw.test(n)?new URL(Hw(n,e.protocol)):new URL(n),a=NT(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{qw(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var tE=Symbol(`Uninstrumented`),nE=new WeakMap;function rE(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){e.lazy!=null&&n.lazy.push(e.lazy),e[`lazy.loader`]!=null&&n[`lazy.loader`].push(e[`lazy.loader`]),e[`lazy.action`]!=null&&n[`lazy.action`].push(e[`lazy.action`]),e[`lazy.middleware`]!=null&&n[`lazy.middleware`].push(e[`lazy.middleware`]),e.middleware!=null&&n.middleware.push(e.middleware),e.loader!=null&&n.loader.push(e.loader),e.action!=null&&n.action.push(e.action)}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=t.lazy;r.lazy=async(...t)=>lE(await uE(n.lazy,void 0,()=>e(...t),dE))}if(typeof t.lazy==`object`){let e=t.lazy;if(typeof e.middleware==`function`&&n[`lazy.middleware`].length>0){let t=e.middleware;r.lazy=Object.assign(r.lazy||{},{middleware:async(...e)=>lE(await uE(n[`lazy.middleware`],void 0,()=>t(...e),dE))})}if(typeof e.loader==`function`&&n[`lazy.loader`].length>0){let t=e.loader;r.lazy=Object.assign(r.lazy||{},{loader:async(...e)=>lE(await uE(n[`lazy.loader`],void 0,()=>t(...e),dE))})}if(typeof e.action==`function`&&n[`lazy.action`].length>0){let t=e.action;r.lazy=Object.assign(r.lazy||{},{action:async(...e)=>lE(await uE(n[`lazy.action`],void 0,()=>t(...e),dE))})}}if(typeof t.loader==`function`&&n.loader.length>0){let e=aE(t.loader),i=async(...t)=>lE(await uE(n.loader,fE(t[0]),()=>e(...t),dE));e.hydrate===!0&&(i.hydrate=!0),oE(i,e),r.loader=i}if(typeof t.action==`function`&&n.action.length>0){let e=aE(t.action),i=async(...t)=>lE(await uE(n.action,fE(t[0]),()=>e(...t),dE));oE(i,e),r.action=i}return t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=aE(e),r=async(...e)=>lE(await uE(n.middleware,fE(e[0]),()=>t(...e),dE));return oE(r,t),r})),r}function iE(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){e.navigate!=null&&n.navigate.push(e.navigate),e.fetch!=null&&n.fetch.push(e.fetch)}})),n.navigate.length>0){let t=aE(e.navigate),r=async(...r)=>{let[i,a]=r,o,s={to:typeof i==`number`||typeof i==`string`?i:i?Zw(i):`.`,...pE(e,a??{})};return lE(await uE(n.navigate,s,async()=>{if(typeof i==`number`)return await t(...r);let n=sE(e,e=>{o=e});try{return await t(...r)}finally{n()}},e=>({...dE(e),meta:o})))};oE(r,t),e.navigate=r}if(n.fetch.length>0){let t=aE(e.fetch),r=async(...r)=>{let[i,a,o,s]=r,c;return lE(await uE(n.fetch,{href:o??`.`,fetcherKey:i,...pE(e,s??{})},async()=>{let n=sE(e,e=>{c=e});try{return await t(...r)}finally{n()}},e=>({...dE(e),meta:c})))};oE(r,t),e.fetch=r}return e}function aE(e){return e[tE]??e}function oE(e,t){e[tE]=t}function sE(e,t){return nE.set(e,t),()=>{nE.get(e)===t&&nE.delete(e)}}function cE(e){let t=nE.get(e);return nE.delete(e),t}function lE(e){if(e.type===`error`)throw e.value;return e.value}async function uE(e,t,n,r,i={result:null,innerResult:null},a=e.length-1){let o=e[a];if(o){let s,c=async()=>(s?console.error(`You cannot call instrumented handlers more than once`):s=uE(e,t,n,r,i,a-1),await s,Kw(i.innerResult,`Expected an inner result`),i.innerResult);try{await o(c,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}s||await c(),await s}else{try{i.result={type:`success`,value:await n()}}catch(e){i.result={type:`error`,value:e}}i.innerResult=r(i.result,t)}return i.result?i.result:(i.result={type:`error`,value:Error(`No result assigned in instrumentation chain.`)},i.innerResult=r(i.result,t),i.result)}function dE(e){return e.type===`error`&&e.value instanceof Error?{status:`error`,error:e.value}:{status:`success`,error:void 0}}function fE(e){let{request:t,context:n,params:r}=e;return{...e,request:mE(t),params:{...r},context:hE(n)}}function pE(e,t){return{currentUrl:Zw(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function mE(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function hE(e){return{get:t=>e.get(t)}}var gE=[`POST`,`PUT`,`PATCH`,`DELETE`],_E=new Set(gE),vE=[`GET`,...gE],yE=new Set(vE),bE=new Set([301,302,303,307,308]),xE=new Set([307,308]),SE={state:`idle`,location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},_ee={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},CE={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},wE=`remix-router-transitions`,TE=Symbol(`ResetLoaderData`),vee=class{#e;#t;#n;#r;constructor(e){this.#e=e,this.#t=pT(e)}get stableRoutes(){return this.#e}get activeRoutes(){return this.#n??this.#e}get branches(){return this.#r??this.#t}get hasHMRRoutes(){return this.#n!=null}setRoutes(e){this.#e=e,this.#t=pT(e)}setHmrRoutes(e){this.#n=e,this.#r=pT(e)}commitHmrRoutes(){this.#n&&(this.#e=this.#n,this.#t=this.#r,this.#n=void 0,this.#r=void 0)}};function yee(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;Kw(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties,a=i||(()=>({}));if(e.instrumentations){let t=e.instrumentations;a=e=>({...i?.(e),...rE(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=new vee(cT(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||wee,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,g=null,_=e.hydrationData!=null,v=dT(s.activeRoutes,e.history.location,c,!1,s.branches),y=!1,b=null,x,S;if(v==null&&!e.patchRoutesOnNavigation){let t=aD(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=iD(s.activeRoutes);x=!0,S=!x,v=n,b={[r.id]:t}}else if(v&&!e.hydrationData&&Je(v,s.activeRoutes,e.history.location.pathname).active&&(v=null),!v){x=!1,S=!x,v=[];let t=Je(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}else if(v.some(e=>e.route.lazy))x=!1,S=!x;else if(!v.some(e=>kE(e.route)))x=!0,S=!x;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=v;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}S=!1,x=!0,r.forEach(e=>{let r=AE(e.route,t,n);S||=r.renderFallback,x&&=!r.shouldLoad})}let C,w={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,renderFallback:S,navigation:SE,restoreScrollPosition:e.hydrationData==null?null:!1,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},T=`POP`,E=null,D=!1,O,k=!1,A=new Map,j=null,M=!1,N=!1,P=new Set,ee=new Map,F=0,te=-1,ne=new Map,re=new Set,ie=new Map,ae=new Map,oe=new Set,se=new Map,ce,le=null;function ue(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(ce){ce(),ce=void 0;return}qw(se.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=He({currentLocation:w.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{ce=e});e.history.go(r*-1),Ve(i,{state:`blocked`,location:n,proceed(){Ve(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(w.blockers);e.set(i,CE),pe({blockers:e})}}),E?.resolve(),E=null;return}return _e(t,n)}),n){kee(t,A);let e=()=>OD(t,A);t.addEventListener(`pagehide`,e),j=()=>t.removeEventListener(`pagehide`,e)}return w.initialized||_e(`POP`,w.location,{initialHydration:!0}),C}function de(){d&&d(),j&&j(),f.clear(),O&&O.abort(),w.fetchers.forEach((e,t)=>Ne(w.fetchers,t)),w.blockers.forEach((e,t)=>Be(t))}function fe(e){if(f.add(e),p){let{newErrors:t}=p;p=null,e(w,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(e)}function pe(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),w={...w,...e};let n=[],r=[];w.fetchers.forEach((e,t)=>{e.state===`idle`&&(oe.has(t)?n.push(t):r.push(t))}),oe.forEach(e=>{!w.fetchers.has(e)&&!ee.has(e)&&n.push(e)}),f.size===0&&(p={newErrors:e.errors??null}),[...f].forEach(r=>r(w,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>Ne(w.fetchers,e)),r.forEach(e=>w.fetchers.delete(e))}function me(t,n,{flushSync:r}={}){let i=w.actionData!=null&&w.navigation.formMethod!=null&&yD(w.navigation.formMethod)&&w.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?w.actionData:null;let o=n.loaderData?tD(w.loaderData,n.loaderData,n.matches||[],n.errors):w.loaderData,c=w.blockers;c.size>0&&!M&&(c=new Map(c),c.forEach((e,t)=>c.set(t,CE)));let l=M?!1:qe(t,n.matches||w.matches),u=D===!0||w.navigation.formMethod!=null&&yD(w.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),M||T===`POP`||(T===`PUSH`?e.history.push(t,t.state):T===`REPLACE`&&e.history.replace(t,t.state));let d;if(T===`POP`){let e=A.get(w.location.pathname);e&&e.has(t.pathname)?d={currentLocation:w.location,nextLocation:t}:A.has(t.pathname)&&(d={currentLocation:t,nextLocation:w.location})}else if(k){let e=A.get(w.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),A.set(w.location.pathname,e)),d={currentLocation:w.location,nextLocation:t}}pe({...n,actionData:a,loaderData:o,historyAction:T,location:t,initialized:!0,renderFallback:!1,navigation:SE,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),T=`POP`,D=!1,k=!1,M=!1,N=!1,E?.resolve(),E=null,le?.resolve(),le=null}async function he(t,n){if(E?.resolve(),E=null,typeof t==`number`){E||=kD();let n=E.promise;return e.history.go(t),n}let r=cE(C),{path:i,submission:a,error:o}=DE(!1,EE(w.location,w.matches,c,t,n?.fromRouteId,n?.relative),n),s;n?.mask&&(s={pathname:``,search:``,hash:``,...typeof n.mask==`string`?Qw(n.mask):{...w.location.mask,...n.mask}});let l=w.location,u=Xw(l,i,n&&n.state,void 0,s);u={...u,...e.history.encodeLocation(u)};let d=n&&n.replace!=null?n.replace:void 0,f=`PUSH`;d===!0?f=`REPLACE`:d===!1||a!=null&&yD(a.formMethod)&&a.formAction===w.location.pathname+w.location.search&&(f=`REPLACE`);let p=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,m=(n&&n.flushSync)===!0,h=He({currentLocation:l,nextLocation:u,historyAction:f});if(h){Ve(h,{state:`blocked`,location:u,proceed(){Ve(h,{state:`proceeding`,proceed:void 0,reset:void 0,location:u}),he(t,n)},reset(){let e=new Map(w.blockers);e.set(h,CE),pe({blockers:e})}});return}await _e(f,u,{submission:a,pendingError:o,preventScrollReset:p,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:m,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate,instrumentationNavigateMetaReceiver:r})}function ge(){le||=kD(),Oe(),pe({revalidation:`loading`});let e=le.promise;return w.navigation.state===`submitting`?e:w.navigation.state===`idle`?(_e(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),e):(_e(T||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:k===!0}),e)}async function _e(t,n,r){O&&O.abort(),O=null,T=t,M=(r&&r.startUninterruptedRevalidation)===!0,Ke(w.location,w.matches),D=(r&&r.preventScrollReset)===!0,k=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&w.matches&&w.matches.length>0&&!y?w.matches:dT(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&w.initialized&&!N&&Dee(w.location,n)&&!(r&&r.submission&&yD(r.submission.formMethod))){me(n,{matches:a},{flushSync:o});return}let l=Je(a,i,n.pathname);if(l.active&&l.matches&&(a=l.matches),r?.instrumentationNavigateMetaReceiver){let t=SD(e.history,n,a);r.instrumentationNavigateMetaReceiver(t)}if(!a){let{error:e,notFoundMatches:t,route:r}=Ue(n.pathname);me(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;O=new AbortController;let d=XE(e.history,n,O.signal,r&&r.submission),f=e.getContext?await e.getContext():new tT,p;if(r&&r.pendingError)p=[rD(a).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&yD(r.submission.formMethod)){let i=await ve(d,n,r.submission,a,t,f,l.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:o});if(i.shortCircuited)return;if(i.pendingActionResult){let[e,t]=i.pendingActionResult;if(fD(t)&&XT(t.error)&&t.error.status===404){O=null,me(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=wD(n,a,t,r.submission),o=!1,l.active=!1,d=XE(e.history,d.url,d.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_,workingFetchers:v}=await ye(d,n,a,t,f,l.active,u,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,o,p,r&&r.callSiteDefaultShouldRevalidate);m||(O=null,me(n,{matches:h||a,...nD(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function ve(t,n,i,l,u,d,f,p,m={}){if(Oe(),pe({navigation:TD(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await Ye(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=iD(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=rD(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}else if(e.matches)l=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Ue(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=xD(l,n);if(!g.route.action&&!g.route.lazy)h={type:`error`,error:aD(405,{method:t.method,pathname:n.pathname,routeId:g.route.id})};else{let e=await Ee(t,n,HE(a,o,t,n,l,g,p?[]:r,d),d,null);if(h=e[g.route.id],!h){for(let t of l)if(e[t.route.id]){h=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(pD(h)){let n;return n=m&&m.replace!=null?m.replace:YE(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===w.location.pathname+w.location.search,await Te(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(fD(h)){let e=rD(l,g.route.id);return(m&&m.replace)!==!0&&(T=`PUSH`),{matches:l,pendingActionResult:[e.route.id,h,g.route.id]}}return{matches:l,pendingActionResult:[g.route.id,h]}}async function ye(t,n,i,l,u,d,f,p,m,h,g,_,v,y){let b=f||wD(n,i,l,p),x=p||m||CD(b),S=!M&&!g;if(d){if(S){let e=be(v);pe({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await Ye(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=iD(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=rD(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}else if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Ue(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:T,revalidatingFetchers:E}=OE(t,u,a,o,e.history,w,i,x,n,g?[]:r,g===!0,N,P,oe,ie,re,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(te=++F,!e.dataStrategy&&!T.some(e=>e.shouldLoad)&&!T.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=new Map(w.fetchers),t=Le(e);return me(n,{matches:i,loaderData:{},errors:v&&fD(v[1])?{[v[0]]:v[1].error}:null,...nD(v),...t?{fetchers:e}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=be(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=xe(E)),pe(e,{flushSync:_})}E.forEach(e=>{Fe(e.key),e.controller&&ee.set(e.key,e.controller)});let D=()=>E.forEach(e=>Fe(e.key));O&&O.signal.addEventListener(`abort`,D);let{loaderResults:k,fetcherResults:A}=await De(T,E,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener(`abort`,D),E.forEach(e=>ee.delete(e.key));let j=oD(k);if(j)return await Te(t,j.result,!0,{replace:h}),{shortCircuited:!0};if(j=oD(A),j)return re.add(j.key),await Te(t,j.result,!0,{replace:h}),{shortCircuited:!0};let ne=new Map(w.fetchers),{loaderData:ae,errors:se}=eD(w,i,k,v,E,A,ne);g&&w.errors&&(se={...w.errors,...se});let ce=Le(ne),le=Re(te,ne),ue=ce||le||E.length>0;return{matches:i,loaderData:ae,errors:se,...ue?{workingFetchers:ne}:{}}}function be(e){if(e&&!fD(e[1]))return{[e[0]]:e[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function xe(e){let t=new Map(w.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=ED(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function Se(t,n,r,i){Fe(t);let a=(i&&i.flushSync)===!0,o=cE(C),l=s.activeRoutes,u=EE(w.location,w.matches,c,r,n,i?.relative),d=dT(l,u,c,!1,s.branches),f=Je(d,l,u);if(f.active&&f.matches&&(d=f.matches),o&&o(SD(e.history,u,d)),!d){Ae(t,n,aD(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=DE(!0,u,i);if(h){Ae(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new tT,_=(i&&i.preventScrollReset)===!0;if(m&&yD(m.formMethod)){await Ce(t,n,p,d,g,f.active,a,_,m,i&&i.defaultShouldRevalidate);return}ie.set(t,{routeId:n,path:p}),await we(t,n,p,d,g,f.active,a,_,m)}async function Ce(t,n,i,l,u,d,f,p,m,h){Oe(),ie.delete(t),ke(t,Oee(m,w.fetchers.get(t)),{flushSync:f});let g=new AbortController,_=XE(e.history,i,g.signal,m);if(d){let e=await Ye(l,new URL(_.url).pathname,_.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ae(t,n,e.error,{flushSync:f});return}else if(e.matches)l=e.matches;else{Ae(t,n,aD(404,{pathname:i}),{flushSync:f});return}}let v=xD(l,i);if(!v.route.action&&!v.route.lazy){Ae(t,n,aD(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}ee.set(t,g);let y=F,b=HE(a,o,_,i,l,v,r,u),x=await Ee(_,i,b,u,t),S=x[v.route.id];if(!S){for(let e of b)if(x[e.route.id]){S=x[e.route.id];break}}if(_.signal.aborted){ee.get(t)===g&&ee.delete(t);return}if(oe.has(t)){if(pD(S)||fD(S)){ke(t,DD(void 0));return}}else{if(pD(S))if(ee.delete(t),te>y){ke(t,DD(void 0));return}else return re.add(t),ke(t,ED(m)),Te(_,S,!1,{fetcherSubmission:m,preventScrollReset:p});if(fD(S)){Ae(t,n,S.error);return}}let C=w.navigation.location||w.location,E=XE(e.history,C,g.signal),D=s.activeRoutes,k=w.navigation.state===`idle`?w.matches:dT(D,w.navigation.location,c,!1,s.branches);Kw(k,`Didn't find any matches after fetcher action`);let A=++F;ne.set(t,A);let{dsMatches:j,revalidatingFetchers:M}=OE(E,u,a,o,e.history,w,k,m,C,r,!1,N,P,oe,ie,re,D,c,e.patchRoutesOnNavigation!=null,s.branches,[v.route.id,S],h),ae=ED(m,S.data),se=new Map(w.fetchers);se.set(t,ae),M.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=se.get(t),r=ED(void 0,n?n.data:void 0);se.set(t,r),Fe(t),e.controller&&ee.set(t,e.controller)}),pe({fetchers:se});let ce=()=>M.forEach(e=>Fe(e.key));g.signal.addEventListener(`abort`,ce);let{loaderResults:le,fetcherResults:ue}=await De(j,M,E,C,u);if(g.signal.aborted)return;g.signal.removeEventListener(`abort`,ce),ne.delete(t),ee.delete(t),M.forEach(e=>ee.delete(e.key));let de=w.fetchers.has(t),fe=e=>{if(!de)return e;let n=new Map(e.fetchers);return n.set(t,DD(S.data)),{...e,fetchers:n}},he=oD(le);if(he)return w=fe(w),Te(E,he.result,!1,{preventScrollReset:p});if(he=oD(ue),he)return re.add(he.key),w=fe(w),Te(E,he.result,!1,{preventScrollReset:p});let ge=new Map(w.fetchers);de&&ge.set(t,DD(S.data));let{loaderData:_e,errors:ve}=eD(w,k,le,void 0,M,ue,ge);Re(A,ge),w.navigation.state===`loading`&&A>te?(Kw(T,`Expected pending action`),O&&O.abort(),me(w.navigation.location,{matches:k,loaderData:_e,errors:ve,fetchers:ge})):(pe({errors:ve,loaderData:tD(w.loaderData,_e,k,ve),fetchers:ge}),N=!1)}async function we(t,n,i,s,c,l,u,d,f){let p=w.fetchers.get(t);ke(t,ED(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=XE(e.history,i,m.signal);if(l){let e=await Ye(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ae(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{Ae(t,n,aD(404,{pathname:i}),{flushSync:u});return}}let g=xD(s,i);ee.set(t,m);let _=F,v=await Ee(h,i,HE(a,o,h,i,s,g,r,c),c,t),y=v[g.route.id];if(!y){for(let e of s)if(v[e.route.id]){y=v[e.route.id];break}}if(ee.get(t)===m&&ee.delete(t),!h.signal.aborted){if(oe.has(t)){ke(t,DD(void 0));return}if(pD(y))if(te>_){ke(t,DD(void 0));return}else{re.add(t),await Te(h,y,!1,{preventScrollReset:d});return}if(fD(y)){Ae(t,n,y.error);return}ke(t,DD(y.data))}}async function Te(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(E?.resolve(),E=null),i.response.headers.has(`X-Remix-Revalidate`)&&(N=!0);let d=i.response.headers.get(`Location`);Kw(d,`Expected a Location header on the redirect Response`),d=YE(d,new URL(r.url),c,e.history);let f=Xw(w.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(FT(d)){let n=eT(t,d,!0);e=n.origin!==t.location.origin||NT(n.pathname,c)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}O=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:h,formEncType:g}=w.navigation;!o&&!s&&m&&h&&g&&(o=CD(w.navigation));let _=o||s;xE.has(i.response.status)&&_&&yD(_.formMethod)?await _e(p,f,{submission:{..._,formAction:d},preventScrollReset:l||D,enableViewTransition:a?k:void 0}):await _e(p,f,{overrideNavigation:wD(f,[],p,o),fetcherSubmission:s,preventScrollReset:l||D,enableViewTransition:a?k:void 0})}async function Ee(e,t,n,r,i){let a,o={};try{a=await UE(l,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!yD(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!w.loaderData.hasOwnProperty(e.route.id)&&(!w.errors||!w.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(dD(r)){let i=r.result;o[t]={type:`redirect`,response:KE(i,e,t,n,c)}}else o[t]=await GE(r);return o}async function De(e,t,n,r,i){let a=Ee(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await Ee(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}else return Promise.resolve({[e.key]:{type:`error`,error:aD(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function Oe(){N=!0,ie.forEach((e,t)=>{ee.has(t)&&P.add(t),Fe(t)})}function ke(e,t,n={}){let r=new Map(w.fetchers);r.set(e,t),pe({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function Ae(e,t,n,r={}){let i=rD(w.matches,t),a=new Map(w.fetchers);Ne(a,e),pe({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function je(e){return ae.set(e,(ae.get(e)||0)+1),oe.has(e)&&oe.delete(e),w.fetchers.get(e)||_ee}function Me(e,t){Fe(e,t?.reason),ke(e,DD(null))}function Ne(e,t){let n=w.fetchers.get(t);ee.has(t)&&!(n&&n.state===`loading`&&ne.has(t))&&Fe(t),ie.delete(t),ne.delete(t),re.delete(t),oe.delete(t),P.delete(t),e.delete(t)}function Pe(e){let t=(ae.get(e)||0)-1;t<=0?(ae.delete(e),oe.add(e)):ae.set(e,t),pe({fetchers:new Map(w.fetchers)})}function Fe(e,t){let n=ee.get(e);n&&(n.abort(t),ee.delete(e))}function Ie(e,t){for(let n of e){let e=t.get(n);Kw(e,`Expected fetcher: ${n}`);let r=DD(e.data);t.set(n,r)}}function Le(e){let t=[],n=!1;for(let r of re){let i=e.get(r);Kw(i,`Expected fetcher: ${r}`),i.state===`loading`&&(re.delete(r),t.push(r),n=!0)}return Ie(t,e),n}function Re(e,t){let n=[];for(let[r,i]of ne)if(i<e){let e=t.get(r);Kw(e,`Expected fetcher: ${r}`),e.state===`loading`&&(Fe(r),ne.delete(r),n.push(r))}return Ie(n,t),n.length>0}function ze(e,t){let n=w.blockers.get(e)||CE;return se.get(e)!==t&&se.set(e,t),n}function Be(e){w.blockers.delete(e),se.delete(e)}function Ve(e,t){let n=w.blockers.get(e)||CE;Kw(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(w.blockers);r.set(e,t),pe({blockers:r})}function He({currentLocation:e,nextLocation:t,historyAction:n}){if(se.size===0)return;se.size>1&&qw(!1,`A router only supports one blocker at a time`);let r=Array.from(se.entries()),[i,a]=r[r.length-1],o=w.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Ue(e){let t=aD(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=iD(n);return{notFoundMatches:r,route:i,error:t}}function We(e,t,n){if(m=e,g=t,h=n||null,!_&&w.navigation===SE){_=!0;let e=qe(w.location,w.matches);e!=null&&pe({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Ge(e,t){return h&&h(e,t.map(e=>fT(e,w.loaderData)))||e.key}function Ke(e,t){if(m&&g){let n=Ge(e,t);m[n]=g()}}function qe(e,t){if(m){let n=Ge(e,t),r=m[n];if(typeof r==`number`)return r}return null}function Je(t,n,r){if(e.patchRoutesOnNavigation){let e=s.branches;if(!t)return{active:!0,matches:dT(n,r,c,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:dT(n,r,c,!0,e)}}return{active:!1,matches:null}}async function Ye(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let l=t;for(;;){let t=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:l,fetcherKey:i,patch:(e,n)=>{r.aborted||ME(e,n,s,t,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}if(r.aborted)return{type:`aborted`};let u=s.branches,d=dT(s.activeRoutes,n,c,!1,u),f=null;if(d&&(Object.keys(d[0].params).length===0||(f=dT(s.activeRoutes,n,c,!0,u),!(f&&l.length<f.length&&Xe(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||=dT(s.activeRoutes,n,c,!0,u),!f||Xe(l,f))return{type:`success`,matches:null};l=f}}function Xe(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function Ze(e){o={},s.setHmrRoutes(cT(e,a,void 0,o))}function Qe(e,t,n=!1){ME(e,t,s,o,a,n),s.hasHMRRoutes||pe({})}return C={get basename(){return c},get future(){return u},get state(){return w},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:ue,subscribe:fe,enableScrollRestoration:We,navigate:he,fetch:Se,revalidate:ge,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:je,resetFetcher:Me,deleteFetcher:Pe,dispose:de,getBlocker:ze,deleteBlocker:Be,patchRoutes:Qe,_internalFetchControllers:ee,_internalSetRoutes:Ze,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){pe(e)}},e.instrumentations&&(C=iE(C,e.instrumentations.map(e=>e.router).filter(Boolean))),C}function bee(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function EE(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=VT(r||`.`,BT(o),NT(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=bD(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=PT({basename:n,pathname:c.pathname})),Zw(c)}function DE(e,t,n){if(!n||!bee(n))return{path:t};if(n.formMethod&&!vD(n.formMethod))return{path:t,error:aD(405,{method:n.formMethod})};let r=()=>({path:t,error:aD(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=sD(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!yD(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}\n`,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}else if(n.formEncType===`application/json`){if(!yD(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}Kw(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=ZE(n.formData),s=n.formData;else if(n.body instanceof FormData)o=ZE(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=QE(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=QE(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(yD(c.formMethod))return{path:t,submission:c};let l=Qw(t);return e&&l.search&&bD(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:Zw(l),submission:c}}function OE(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let S=b?fD(b[1])?b[1].error:b[1].data:void 0,C=i.createURL(a.location),w=i.createURL(c),T;if(u&&a.errors){let e=Object.keys(a.errors)[0];T=o.findIndex(t=>t.route.id===e)}else if(b&&fD(b[1])){let e=b[0];T=o.findIndex(t=>t.route.id===e)-1}let E=b?b[1].statusCode:void 0,D=E&&E>=400,O={currentUrl:C,currentParams:a.matches[0]?.params||{},nextUrl:w,nextParams:o[0].params,...s,actionResult:S,actionStatus:E},k=ZT(o),A=o.map((i,o)=>{let{route:s}=i,f=null;if(T!=null&&o>T)f=!1;else if(s.lazy)f=!0;else if(!kE(s))f=!1;else if(u){let{shouldLoad:e}=AE(s,a.loaderData,a.errors);f=e}else xee(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return VE(n,r,e,c,k,i,l,t,f);let p=!1;typeof x==`boolean`?p=x:D?p=!1:d||C.pathname+C.search===w.pathname+w.search?p=!0:C.search===w.search?See(a.matches[o],i)&&(p=!0):p=!0;let m={...O,defaultShouldRevalidate:p};return VE(n,r,e,c,k,i,l,t,jE(i,m),m,x)}),j=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,b=dT(g,e.path,_??`/`,!1,y);if(!b){if(v&&m)return;j.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let S=xD(b,e.path),C=new AbortController,w=XE(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=HE(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=HE(n,r,w,e.path,b,S,l,t));else{let i;i=typeof x==`boolean`?x:D?!1:d;let a={...O,defaultShouldRevalidate:i};jE(S,a)&&(T=HE(n,r,w,e.path,b,S,l,t,a))}T&&j.push({key:s,routeId:e.routeId,path:e.path,matches:T,match:S,request:w,controller:C})}),{dsMatches:A,revalidatingFetchers:j}}function kE(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function AE(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!kE(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function xee(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function See(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function jE(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function ME(e,t,n,r,i,a){let o;if(e){let t=r[e];Kw(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>NE(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=cT(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=cT([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function NE(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>NE(e,t)))??!1:!1}var PE=new WeakMap,FE=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(Kw(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=PE.get(i);o||(o={},PE.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=rT(e),n=i[e]!==void 0;if(t)qw(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)qw(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},IE=new WeakMap;function Cee(e,t,n,r,i){let a=n[e.id];if(Kw(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=IE.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{Kw(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=aT(e),o=a[e]!==void 0;i?qw(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?qw(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return IE.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=FE({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function LE(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function wee(e){return e.matches.some(e=>e.route.middleware)?RE(e,()=>LE(e)):LE(e)}function RE(e,t){return Tee(e,t,e=>{if(_D(e))throw e;return e},lD,n);async function n(t,n,r){if(r)return Object.assign(r.value,{[n]:{type:`error`,result:t}});{let{matches:r}=e,i=Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0)),a=r[i].route.id;for(let e of r.slice(0,i+1))try{await e._lazyPromises?.route}catch{a=e.route.id;break}return{[rD(r,a).route.id]:{type:`error`,result:t}}}}}async function Tee(e,t,n,r,i){let{matches:a,...o}=e;return await zE(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function zE(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await zE(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function BE(e,t,n,r,i){let a=FE({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=Cee(r.route,yD(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function VE(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=BE(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?jE(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?jE(a,{...l,defaultShouldRevalidate:e}):jE(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!yD(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(yD(n.method)||!p)?WE({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function HE(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?VE(e,t,n,r,ZT(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:BE(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function UE(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,url:QT(t,n),pattern:ZT(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return RE(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function WE({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=yD(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,url:QT(e,t),pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a)if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw aD(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}else if(t)c=await f(t);else{let t=new URL(e.url);throw aD(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function Eee(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function GE(e){let{result:t,type:n}=e;if(hD(t)){let e;try{e=await Eee(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new YT(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?mD(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:cD(t),statusCode:XT(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:XT(t)?t.status:void 0}:mD(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function KE(e,t,n,r,i){let a=e.headers.get(`Location`);if(Kw(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!FT(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=EE(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var qE=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function JE(e){try{return qE.includes(new URL(e).protocol)}catch{return!1}}function YE(e,t,n,r){if(FT(e)){let r=e,i=Vw.test(r)?new URL(Hw(r,t.protocol)):new URL(r);if(JE(i.toString()))throw Error(`Invalid redirect location`);let a=NT(i.pathname,n)!=null;if(i.origin===t.origin&&a)return HT(i.pathname)+i.search+i.hash}try{if(JE(r.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function XE(e,t,n,r){let i=e.createURL(sD(t)).toString(),a={signal:n};if(r&&yD(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):t===`text/plain`?a.body=r.text:t===`application/x-www-form-urlencoded`&&r.formData?a.body=ZE(r.formData):a.body=r.formData}return new Request(i,a)}function ZE(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function QE(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function $E(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&fD(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(Kw(!pD(f),`Cannot handle redirect results in processLoaderData`),fD(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=rD(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=TE),c||(c=!0,s=XT(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function eD(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=$E(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(Kw(s,`Did not find corresponding fetcher result`),fD(s)){let t=rD(e.matches,r?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if(pD(s))Kw(!1,`Unhandled fetcher revalidation redirect`);else{let e=DD(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function tD(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==TE).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function nD(e){return e?fD(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function rD(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.ErrorBoundary!=null||e.route.errorElement!=null)||e[0]}function iD(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function aD(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new YT(e||500,o,Error(s),!0)}function oD(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(pD(r))return{key:n,result:r}}}function sD(e){return Zw({...typeof e==`string`?Qw(e):e,hash:``})}function Dee(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash?!0:t.hash!==``}function cD(e){return new YT(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function lD(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&uD(t))}function uD(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function dD(e){return hD(e.result)&&bE.has(e.result.status)}function fD(e){return e.type===`error`}function pD(e){return(e&&e.type)===`redirect`}function mD(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function hD(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function gD(e){return bE.has(e)}function _D(e){return hD(e)&&gD(e.status)&&e.headers.has(`Location`)}function vD(e){return yE.has(e.toUpperCase())}function yD(e){return _E.has(e.toUpperCase())}function bD(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function xD(e,t){let n=typeof t==`string`?Qw(t).search:t.search;if(e[e.length-1].route.index&&bD(n||``))return e[e.length-1];let r=zT(e);return r[r.length-1]}function SD(e,t,n){return{url:QT(e.createURL(t),t),pattern:n?ZT(n):``,params:n?.[0]?.params?{...n[0].params}:{}}}function CD(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function wD(e,t,n,r){return r?{state:`loading`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:`loading`,location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function TD(e,t,n,r){return{state:`submitting`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function ED(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Oee(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function DD(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function kee(e,t){try{let n=e.sessionStorage.getItem(wE);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function OD(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(wE,JSON.stringify(n))}catch(e){qw(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function kD(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var AD=B.createContext(null);AD.displayName=`DataRouter`;var jD=B.createContext(null);jD.displayName=`DataRouterState`;var MD=B.createContext(!1);function ND(){return B.useContext(MD)}var PD=B.createContext({isTransitioning:!1});PD.displayName=`ViewTransition`;var FD=B.createContext(new Map);FD.displayName=`Fetchers`;var ID=B.createContext(null);ID.displayName=`Await`;var LD=B.createContext(null);LD.displayName=`Navigation`;var RD=B.createContext(null);RD.displayName=`Location`;var zD=B.createContext({outlet:null,matches:[],isDataRoute:!1});zD.displayName=`Route`;var BD=B.createContext(null);BD.displayName=`RouteError`;var VD=`REACT_ROUTER_ERROR`,HD=`REDIRECT`,UD=`ROUTE_ERROR_RESPONSE`;function WD(e){if(e.startsWith(`${VD}:${HD}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function GD(e){if(e.startsWith(`${VD}:${UD}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new YT(t.status,t.statusText,t.data)}catch{}}function KD(e,{relative:t}={}){Kw(qD(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=B.useContext(LD),{hash:i,pathname:a,search:o}=tO(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:UT([n,a])),r.createHref({pathname:s,search:o,hash:i})}function qD(){return B.useContext(RD)!=null}function JD(){return Kw(qD(),`useLocation() may be used only in the context of a <Router> component.`),B.useContext(RD).location}var YD=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function XD(){let{isDataRoute:e}=B.useContext(zD);return e?yO():ZD()}function ZD(){Kw(qD(),`useNavigate() may be used only in the context of a <Router> component.`);let e=B.useContext(AD),{basename:t,navigator:n}=B.useContext(LD),{matches:r}=B.useContext(zD),{pathname:i}=JD(),a=JSON.stringify(BT(r)),o=B.useRef(!1);return B.useLayoutEffect(()=>{o.current=!0}),B.useCallback((r,s={})=>{if(qw(o.current,YD),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=VT(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:UT([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var QD=B.createContext(null);function $D(e){let t=B.useContext(zD).outlet;return B.useMemo(()=>t&&B.createElement(QD.Provider,{value:e},t),[t,e])}function eO(){let{matches:e}=B.useContext(zD);return e[e.length-1]?.params??{}}function tO(e,{relative:t}={}){let{matches:n}=B.useContext(zD),{pathname:r}=JD(),i=JSON.stringify(BT(n));return B.useMemo(()=>VT(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function nO(e,t,n){Kw(qD(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=B.useContext(LD),{matches:i}=B.useContext(zD),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=JD(),l;if(t){let e=typeof t==`string`?Qw(t):t;Kw(s===`/`||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),l=e}else l=c;let u=l.pathname||`/`,d=u;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);d=`/`+u.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let f=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):uT(e,{pathname:d}),p=lO(f&&f.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:UT([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:UT([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&p?B.createElement(RD.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},p):p}function rO(){let e=vO(),t=XT(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return B.createElement(B.Fragment,null,B.createElement(`h2`,null,`Unexpected Application Error!`),B.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?B.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var iO=B.createElement(rO,null),aO=class extends B.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=MD;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=GD(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:B.createElement(zD.Provider,{value:this.props.routeContext},B.createElement(BD.Provider,{value:e,children:this.props.component}));return this.context?B.createElement(sO,{error:e},t):t}},oO=new WeakMap;function sO({children:e,error:t}){let{basename:n}=B.useContext(LD);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=WD(t.digest);if(e){let r=oO.get(t);if(r)throw r;let i=eE(e.location,n),a=i.absoluteURL||i.to;if(JE(a))throw Error(`Invalid redirect location`);if($T&&!oO.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw oO.set(t,n),n}return B.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function cO({routeContext:e,match:t,children:n}){let r=B.useContext(AD);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),B.createElement(zD.Provider,{value:e},n)}function lO(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);Kw(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:ZT(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||iO,o&&(s<0&&c===0?(xO(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?B.createElement(n.route.Component,null):n.route.element?n.route.element:e,B.createElement(cO,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?B.createElement(aO,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function uO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function dO(e){let t=B.useContext(AD);return Kw(t,uO(e)),t}function fO(e){let t=B.useContext(jD);return Kw(t,uO(e)),t}function pO(e){let t=B.useContext(zD);return Kw(t,uO(e)),t}function mO(e){let t=pO(e),n=t.matches[t.matches.length-1];return Kw(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function hO(){return mO(`useRouteId`)}function gO(){let e=fO(`useNavigation`);return B.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function _O(){let{matches:e,loaderData:t}=fO(`useMatches`);return B.useMemo(()=>e.map(e=>fT(e,t)),[e,t])}function vO(){let e=B.useContext(BD),t=fO(`useRouteError`),n=mO(`useRouteError`);return e===void 0?t.errors?.[n]:e}function yO(){let{router:e}=dO(`useNavigate`),t=mO(`useNavigate`),n=B.useRef(!1);return B.useLayoutEffect(()=>{n.current=!0}),B.useCallback(async(r,i={})=>{qw(n.current,YD),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var bO={};function xO(e,t,n){!t&&!bO[e]&&(bO[e]=!0,qw(!1,n))}var SO={};function CO(e,t){!e&&!SO[t]&&(SO[t]=!0,console.warn(t))}var Aee=[`HydrateFallback`,`hydrateFallbackElement`],jee=class{status=`pending`;promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function Mee({router:e,flushSync:t,onError:n,useTransitions:r}){r=ND()||r;let[i,a]=B.useState(e.state),[o,s]=(0,B.useOptimistic)(i),[c,l]=B.useState(),[u,d]=B.useState({isTransitioning:!1}),[f,p]=B.useState(),[m,h]=B.useState(),[g,_]=B.useState(),v=B.useRef(new Map),y=B.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:g})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},pattern:ZT(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&v.current.set(t,e.data)}),o.forEach(e=>v.current.delete(e)),CO(u===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let y=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(CO(g==null||y,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!g||!y){t&&u?t(()=>a(i)):r===!1?a(i):B.startTransition(()=>{r===!0&&s(e=>wO(e,i)),a(i)});return}if(t&&u){t(()=>{m&&(f?.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})})}),t(()=>h(n));return}m?(f?.resolve(),m.skipTransition(),_({state:i,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(l(i),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[e.window,t,m,f,r,s,n]);B.useLayoutEffect(()=>e.subscribe(y),[e,y]),B.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new jee)},[u]),B.useEffect(()=>{if(f&&c&&e.window){let t=c,n=f.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):B.startTransition(()=>{r===!0&&s(e=>wO(e,t)),a(t)}),await n});i.finished.finally(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})}),h(i)}},[c,f,e.window,r,s]),B.useEffect(()=>{f&&c&&o.location.key===c.location.key&&f.resolve()},[f,m,o.location,c]),B.useEffect(()=>{!u.isTransitioning&&g&&(l(g.state),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),_(void 0))},[u.isTransitioning,g]);let b=B.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),x=e.basename||`/`,S=B.useMemo(()=>({router:e,navigator:b,static:!1,basename:x,onError:n}),[e,b,x,n]);return B.createElement(B.Fragment,null,B.createElement(AD.Provider,{value:S},B.createElement(jD.Provider,{value:o},B.createElement(FD.Provider,{value:v.current},B.createElement(PD.Provider,{value:u},B.createElement(TO,{basename:x,location:o.location,navigationType:o.historyAction,navigator:b,useTransitions:r},B.createElement(Nee,{routes:e.routes,manifest:e.manifest,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function wO(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var Nee=B.memo(Pee);function Pee({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return nO(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Fee(e){return $D(e.context)}function TO({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){Kw(!qD(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=B.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Qw(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=B.useMemo(()=>{let e=NT(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return qw(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:B.createElement(LD.Provider,{value:c},B.createElement(RD.Provider,{children:t,value:h}))}B.Component;var EO=`application/x-www-form-urlencoded`;function DO(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Iee(e){return DO(e)&&e.tagName.toLowerCase()===`button`}function Lee(e){return DO(e)&&e.tagName.toLowerCase()===`form`}function Ree(e){return DO(e)&&e.tagName.toLowerCase()===`input`}function zee(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function OO(e,t){return e.button===0&&(!t||t===`_self`)&&!zee(e)}var kO=null;function AO(){if(kO===null)try{new FormData(document.createElement(`form`),0),kO=!1}catch{kO=!0}return kO}var jO=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function MO(e){return e!=null&&!jO.has(e)?(qw(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${EO}"`),null):e}function NO(e,t){let n,r,i,a,o;if(Lee(e)){let o=e.getAttribute(`action`);r=o?NT(o,t):null,n=e.getAttribute(`method`)||`get`,i=MO(e.getAttribute(`enctype`))||EO,a=new FormData(e)}else if(Iee(e)||Ree(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?NT(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=MO(e.getAttribute(`formenctype`))||MO(o.getAttribute(`enctype`))||EO,a=new FormData(o,e),!AO()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(DO(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=EO,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}function PO(e,t){if(e===!1||e==null)throw Error(t)}var FO={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},IO=/[&><\u2028\u2029]/g;function LO(e){return e.replace(IO,e=>FO[e])}function RO(e,t){let n=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n.pathname.endsWith(`/`)?n.pathname=`${n.pathname}_.${t}`:n.pathname=`${n.pathname}.${t}`,n}var zO=`modulepreload`,BO=function(e){return`/`+e},VO={},HO=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=BO(t,n),t=s(t),t in VO)return;VO[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:zO,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};async function UO(e,t){if(e.id in t)return t[e.id];try{let n=await HO(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function WO(e){return e!=null&&typeof e.page==`string`}function GO(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function KO(e,t,n){return ZO((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await UO(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(GO).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function qO(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function JO(e,t,{includeHydrateFallback:n}={}){return YO(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function YO(e){return[...new Set(e)]}function XO(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ZO(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!WO(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(XO(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function QO(){let e=B.useContext(AD);return PO(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function $O(){let e=B.useContext(jD);return PO(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var ek=B.createContext(void 0);ek.displayName=`FrameworkContext`;function tk(){let e=B.useContext(ek);return PO(e,`You must render this element inside a <HydratedRouter> element`),e}function nk(e,t){let n=B.useContext(ek),[r,i]=B.useState(!1),[a,o]=B.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=B.useRef(null);B.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),B.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:rk(s,p),onBlur:rk(c,m),onMouseEnter:rk(l,p),onMouseLeave:rk(u,m),onTouchStart:rk(d,p)}]:[a,f,{}]:[!1,f,{}]}function rk(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function ik({page:e,...t}){let n=ND(),{nonce:r}=tk(),{router:i}=QO(),a=B.useMemo(()=>uT(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?B.createElement(ok,{page:e,matches:a,...t}):B.createElement(sk,{page:e,matches:a,...t})):null}function ak(e){let{manifest:t,routeModules:n}=tk(),[r,i]=B.useState([]);return B.useEffect(()=>{let r=!1;return KO(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function ok({page:e,matches:t,...n}){let r=JD(),i=B.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=RO(e,`rsc`),i=!1,a=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?i=!0:a.push(e.route.id);return i&&a.length>0&&n.searchParams.set(`_routes`,a.join(`,`)),[n.pathname+n.search]},[e,r,t]);return B.createElement(B.Fragment,null,i.map(e=>B.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function sk({page:e,matches:t,...n}){let r=JD(),{manifest:i,routeModules:a}=tk(),{loaderData:o,matches:s}=$O(),c=B.useMemo(()=>qO(e,t,s,i,r,`data`),[e,t,s,i,r]),l=B.useMemo(()=>qO(e,t,s,i,r,`assets`),[e,t,s,i,r]),u=B.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];!t||!t.hasLoader||(!c.some(t=>t.route.id===e.route.id)&&e.route.id in o&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let l=RO(e,`data`);return s&&n.size>0&&l.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[l.pathname+l.search]},[o,r,i,c,t,e,a]),d=B.useMemo(()=>JO(l,i),[l,i]),f=ak(l);return B.createElement(B.Fragment,null,u.map(e=>B.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),d.map(e=>B.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),f.map(({key:e,link:t})=>B.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function ck(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var lk=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{lk&&(window.__reactRouterVersion=`8.3.0`)}catch{}function uk(e,t){return yee({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:Gw({window:t?.window}),hydrationData:t?.hydrationData||dk(),routes:e,mapRouteProperties:sT,hydrationRouteProperties:Aee,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function dk(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:fk(e.errors)}),e}function fk(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new YT(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&JT.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}function pk({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=B.useState({action:n.action,location:n.location}),o=B.useCallback(e=>{r===!1?a(e):B.startTransition(()=>a(e))},[r]);return B.useLayoutEffect(()=>n.listen(o),[n,o]),B.createElement(TO,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}pk.displayName=`unstable_HistoryRouter`;var mk=B.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=B.useContext(LD),v=typeof l==`string`&&Bw.test(l),y=eE(l,h);l=y.to;let b=KD(l,{relative:r}),x=JD(),S=null;if(o){let e=VT(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:UT([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=nk(n,p),E=xk(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=B.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:ck(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?B.createElement(B.Fragment,null,k,B.createElement(ik,{page:b})):k});mk.displayName=`Link`;var hk=B.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=tO(a,{relative:c.relative}),d=JD(),f=B.useContext(jD),{navigator:p,basename:m}=B.useContext(LD),h=f!=null&&jk(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=NT(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(y)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return B.createElement(mk,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});hk.displayName=`NavLink`;var gk=B.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=B.useContext(LD),g=wk(),_=Tk(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Bw.test(s);return B.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?B.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});gk.displayName=`Form`;function _k({getKey:e,storageKey:t,...n}){let r=B.useContext(ek),{basename:i}=B.useContext(LD),a=JD(),o=_O();kk({getKey:e,storageKey:t});let s=B.useMemo(()=>{if(!r||!e)return null;let t=Ok(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),B.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${LO(JSON.stringify(t||Ek))}, ${LO(JSON.stringify(s))})`}})}_k.displayName=`ScrollRestoration`;function vk(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yk(e){let t=B.useContext(AD);return Kw(t,vk(e)),t}function bk(e){let t=B.useContext(jD);return Kw(t,vk(e)),t}function xk(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=XD(),d=JD(),f=tO(e,{relative:o});return B.useCallback(p=>{if(OO(p,t)){p.preventDefault();let t=n===void 0?Zw(d)===Zw(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?B.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var Sk=0,Ck=()=>`__${String(++Sk)}__`;function wk(){let{router:e}=yk(`useSubmit`),{basename:t}=B.useContext(LD),n=hO(),r=e.fetch,i=e.navigate;return B.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=NO(e,t);a.navigate===!1?await r(a.fetcherKey||Ck(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Tk(e,{relative:t}={}){let{basename:n}=B.useContext(LD),r=B.useContext(zD);Kw(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...tO(e||`.`,{relative:t})},o=JD();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:UT([n,a.pathname])),Zw(a)}var Ek=`react-router-scroll-positions`,Dk={};function Ok(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:NT(e.pathname,n)||e.pathname},t)),i??=e.key,i}function kk({getKey:e,storageKey:t}={}){let{router:n}=yk(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=bk(`useScrollRestoration`),{basename:a}=B.useContext(LD),o=JD(),s=_O(),c=gO();B.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Ak(B.useCallback(()=>{if(c.state===`idle`){let t=Ok(o,s,a,e);Dk[t]=window.scrollY}try{sessionStorage.setItem(t||Ek,JSON.stringify(Dk))}catch(e){qw(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(B.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Ek);e&&(Dk=JSON.parse(e))}catch{}},[t]),B.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Dk,()=>window.scrollY,e?(t,n)=>Ok(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),B.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{qw(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Ak(e,t){let{capture:n}=t||{};B.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function jk(e,{relative:t}={}){let n=B.useContext(PD);Kw(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=yk(`useViewTransitionState`),i=tO(e,{relative:t});if(!n.isTransitioning)return!1;let a=NT(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=NT(n.nextLocation.pathname,r)||n.nextLocation.pathname;return kT(i.pathname,o)!=null||kT(i.pathname,a)!=null}var Mk=class{currentSeq=-1;resync;interactionsInvalidated;constructor(e,t=()=>{}){this.resync=e,this.interactionsInvalidated=t}reset(){this.currentSeq=-1}handle(e){switch(e.type){case`board`:Yx(e.bootId),eC(e.board),this.currentSeq=typeof e.seq==`number`?e.seq:-1;break;case`board-delta`:switch(Yx(e.bootId),ay(this.currentSeq,e.seq)){case`apply`:rC(e)?this.currentSeq=e.seq:this.resync();break;case`ignore`:break;case`resync`:this.resync();break}break;case`notify`:Nk(e);break;case`interactions-invalidated`:this.interactionsInvalidated(e);break}}};function Nk(e){if(!Z.notificationsEnabled||!document.hidden||typeof Notification>`u`||Notification.permission!==`granted`)return;let t=new Notification(e.title,{body:e.body,tag:`${Sx()}/${e.slug}`}),n=bx()??Z.board?.projectSlug;t.onclick=()=>{window.focus(),n===void 0||bx()===n?US(e.slug):location.assign(`${xx(n)}/thread/${encodeURIComponent(e.slug)}`),t.close()}}var Pk=(e,t)=>[`interactions`,`pending`,e,t],Fk=(e,t,n)=>[`interactions`,`record`,e,t,n];function Ik(e,t){let n=Pk(t.owner.threadSlug,t.owner.sessionId);e.setQueryData(n,e=>e&&(t.lifecycle===`pending`?{interactions:e.interactions.map(e=>e.id===t.id?t:e)}:{interactions:e.interactions.filter(e=>e.id!==t.id)}))}function Lk(e,t){Ik(e,{...t,delivery:{effect:`reconnect-required`}})}async function Rk(e,t){await Promise.all([e.invalidateQueries({queryKey:Pk(t.slug,t.sessionId),exact:!0}),e.invalidateQueries({queryKey:Fk(t.slug,t.sessionId,t.interactionId),exact:!0})])}var zk=null,Bk=null,Vk=0,Hk=null,Uk=0,Wk=null,Gk=new Mk(()=>Yk(),e=>{Wk&&Rk(Wk,e)}),Kk=35e3;function qk(){if(zk)return;Z.connection!==`open`&&(Z.connection=`connecting`),zk=new EventSource(`${Tx()}/events`);let e=bx();if(Vk=Date.now(),zk.onopen=()=>{Bk&&=(clearTimeout(Bk),null),Uk=0,Vk=Date.now(),Z.connection=`open`},zk.addEventListener(`heartbeat`,()=>{Vk=Date.now()}),zk.onmessage=t=>{if(e===bx()){Vk=Date.now();try{Gk.handle(JSON.parse(t.data))}catch(e){console.error(`bad SSE event`,e)}}},zk.onerror=()=>Jk(),!Hk){Hk=setInterval(()=>{zk&&Date.now()-Vk>Kk&&Jk()},1e4);let e=()=>{(!zk||Date.now()-Vk>Kk)&&Jk(!0)};window.addEventListener(`focus`,e),window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,()=>{document.hidden||e()})}}function Jk(e=!1){if(zk?.close(),zk=null,Gk.reset(),Uk++,Z.connection=Uk>3?`closed`:`connecting`,Bk){if(!e)return;clearTimeout(Bk),Bk=null}let t=e?0:Math.min(1e3*2**Math.min(Uk-1,4),15e3);Bk=setTimeout(()=>{Bk=null,qk()},t)}function Yk(){Gk.reset(),zk?.close(),zk=null,qk()}function Xk(){Gk.reset(),zk?.close(),zk=null,Z.connection=`connecting`,qk()}function Zk(e){e&&(Wk=e),document.readyState===`complete`?qk():window.addEventListener(`load`,qk,{once:!0})}function Qk(e,t){let n=new Set(e.filter(e=>e.role===`user`&&e.sourceId).map(e=>e.sourceId));return t.filter(e=>e.role===`user`&&e.sourceId&&!n.has(e.sourceId)).map(e=>e.text.trim())}function $k(e,t){let n=new Set;for(let r of t)for(let t=0;t<e.length;t++){if(n.has(t))continue;let i=e[t].text.trim();if(r===i){n.add(t);break}if(!r.startsWith(i))continue;let a=i.length;for(let i=t+1;i<e.length&&!n.has(i);i++){let o=e[i].text.trim();if(!r.startsWith(`
318
+
319
+ `,a)||!r.startsWith(o,a+2))break;if(a+=2+o.length,a===r.length){for(let e=t;e<=i;e++)n.add(e);break}}if(n.has(t))break}return n}function eA(e,t){if(!e?.length)return t;let n=e.filter(e=>e.queued&&!e.sourceId&&e.role===`user`&&e.text.trim());if(!n.length)return t;let r=new Set(t.map(e=>e.deliveryId).filter(e=>!!e)),i=$k(n,Qk(e,t)),a=n.filter((e,t)=>!i.has(t)&&!(e.deliveryId&&r.has(e.deliveryId)));if(!a.length)return t;let o=a.filter(n=>iA(n,rA(t),rA(e)));return o.length?[...t,...o]:t}var tA=6e4,nA=new WeakMap;function rA(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.queued&&!n.sourceId)continue;let r=n.at?Date.parse(n.at):NaN;if(Number.isFinite(r))return r}return NaN}function iA(e,t,n){if(!Number.isFinite(t))return!0;let r=nA.get(e);return r===void 0?(nA.set(e,Number.isFinite(n)?n:t),iA(e,t,n)):t-r<=tA?!0:(console.warn(`[frizz] retiring a stranded optimistic send: the transcript advanced past it without ever recording it`,{text:e.text.slice(0,120),advancedMs:t-r}),!1)}var aA=new WeakMap;function oA(e){let t=aA.get(e);return t===void 0&&(t=JSON.stringify(e),aA.set(e,t)),t}function sA(e,t){if(!e?.length||!t.length)return t;let n=new Map;for(let t of e)t.sourceId&&n.set(t.sourceId,t);if(!n.size)return t;let r=!1,i=t.map(e=>{if(e===n.get(e.sourceId??``))return e;let t=e.sourceId?n.get(e.sourceId):void 0;return t&&oA(t)===oA(e)?(r=!0,t):e});return r?i:t}function cA(e,t,n){if(!e)return!1;let r=Date.parse(e);if(!Number.isFinite(r))return!1;let i=t?Date.parse(t):0;return t&&!Number.isFinite(i)?!1:r-i>n}function lA(e){if(e)for(let t=e.length-1;t>=0;t--){let n=e[t].at;if(n)return n}}function uA(e,t){let n=Math.max(0,Math.min(e.length,t));for(let t=n-1;t>=0;t--)if(e[t].role===`user`)return t;return n>0?0:null}function dA(e,t,n){if(!t)return n;let r=e.findIndex(e=>e.sourceId===t);return r>=0?r:0}function fA(e,t){let n=new Map;e.forEach((e,t)=>{e.sourceId&&n.set(e.sourceId,t)});for(let e=0;e<t.length;e++){let r=t[e].sourceId,i=r?n.get(r):void 0;if(i!==void 0)return{previousIndex:i,incomingIndex:e}}}function pA(e,t){if(!e?.historyLoaded||e.transcriptKey!==t.transcriptKey)return t;let n=fA(e.messages,t.messages);return n?{...t,messages:[...e.messages.slice(0,n.previousIndex).filter(e=>!e.pinnedFromSourceId),...t.messages.slice(n.incomingIndex)],beforeCursor:e.beforeCursor,hasEarlier:e.hasEarlier,reachedTurnBoundary:e.reachedTurnBoundary,historyLoaded:!0}:t}function mA(e,t){if(!e)return{messages:[...t]};let n=fA(e.messages,t);return n?e.historyLoaded?{...e,messages:[...e.messages.slice(0,n.previousIndex).filter(e=>!e.pinnedFromSourceId),...t.slice(n.incomingIndex)]}:{...e,messages:[...t]}:{messages:[...t]}}function hA(e,t){if(e.transcriptKey!==t.transcriptKey)return e;let n=new Set(t.messages.map(e=>e.sourceId).filter(Boolean)),r=e.messages.filter(e=>!e.pinnedFromSourceId||!n.has(e.pinnedFromSourceId)),i=new Set(r.map(e=>e.sourceId).filter(Boolean)),a=t.messages.filter(e=>!e.sourceId||!i.has(e.sourceId));return{...e,messages:[...a,...r],beforeCursor:t.beforeCursor,hasEarlier:t.hasEarlier,reachedTurnBoundary:t.reachedTurnBoundary,historyLoaded:!0}}function gA(e,t=0){if(!e)return null;let n=[...e.querySelectorAll(`[data-transcript-source-id]`)].filter(e=>e.dataset.transcriptSticky!==`true`),r=n.find(e=>e.getBoundingClientRect().bottom>t)??n[0],i=r?.dataset.transcriptSourceId;return r&&i?{sourceId:i,top:r.getBoundingClientRect().top}:null}function _A(e,t){return t-e}function vA(e,t,n){if(!e||!t)return!1;let r=[...e.querySelectorAll(`[data-transcript-source-id]`)].find(e=>e.dataset.transcriptSourceId===t.sourceId);return r?(n(_A(t.top,r.getBoundingClientRect().top)),!0):!1}function yA(e){let{remaining:t,scrollY:n,maxScrollY:r,alreadyReserved:i}=e;return!(t>.5)||r<=0||i?`settle`:n>=r-1?`reserve`:`settle`}var bA=null,xA=null,SA=null,CA=null,wA=0,TA=0,EA=!1,DA=!1,OA=!1,kA=new Map,AA=new Mk(()=>VA(),e=>{xA&&Rk(xA,e)}),jA=35e3;function MA(){return`${location.origin.replace(/^http/,`ws`)}${Tx()}/ws`}var NA,PA=!1;function FA(){NA=bx(),PA=!0}function IA(e){return PA&&NA===e}function LA(){if(bA||OA)return;Z.connection!==`open`&&(Z.connection=`connecting`),FA();let e=new WebSocket(MA()),t=bx();bA=e,EA=!1,TA=Date.now(),e.onopen=()=>{DA=!0,TA=Date.now(),Z.connection=`open`,Z.socketTranscripts=!0,SA&&=(clearTimeout(SA),null)},e.onmessage=n=>{if(!(bA!==e||t!==bx())){TA=Date.now();try{let e=JSON.parse(n.data),t=GA(e);t&&(wA=0),t&&e.t===`event`&&e.event.type===`board`&&(EA=!0,qA())}catch(e){console.error(`bad /ws message`,e)}}},e.onerror=()=>{},e.onclose=()=>{bA===e&&(bA=null,zA())},HA()}function RA(){let e=bA;if(bA=null,EA=!1,e){e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}}function zA(){if(AA.reset(),!DA){WA();return}wA++,Z.connection=wA>3?`closed`:`connecting`,BA()}function BA(e=!1){if(SA){if(!e)return;clearTimeout(SA),SA=null}let t=e?0:Math.min(1e3*2**Math.min(wA-1,4),15e3);SA=setTimeout(()=>{SA=null,LA()},t)}function VA(){AA.reset(),RA(),LA()}function HA(){if(CA)return;CA=setInterval(()=>{bA&&Date.now()-TA>jA&&UA()},1e4);let e=()=>{OA||(!bA||Date.now()-TA>jA)&&UA(!0)};window.addEventListener(`focus`,e),window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,()=>{document.hidden||e()})}function UA(e=!1){if(!OA){if(RA(),AA.reset(),!DA){WA();return}wA++,Z.connection=wA>3?`closed`:`connecting`,BA(e)}}function WA(e){OA||(OA=!0,e&&(Z.socketBoardFallback=e,Z.socketTranscriptFallbacks={}),RA(),Z.socketTranscripts=!1,Zk(xA??void 0))}function GA(e){switch(e.t){case`event`:return AA.handle(e.event),e.event.type===`board`&&(Z.socketBoardFallback=null),!0;case`transcript`:return xA?.setQueryData([`transcript`,e.slug],t=>{let n=mA(t,e.messages);return{...n,messages:sA(t?.messages,eA(t?.messages,n.messages))}}),delete Z.socketTranscriptFallbacks[e.slug],!0;case`payload-too-large`:return e.channel===`board`?(Z.socketBoardFallback||console.warn(`[frizz] live board payload exceeded the socket limit; using SSE`,{actualBytes:e.actualBytes,maxBytes:e.maxBytes}),WA({actualBytes:e.actualBytes,maxBytes:e.maxBytes})):(Z.socketTranscriptFallbacks[e.slug]||console.warn(`[frizz] live transcript payload exceeded the socket limit; updates paused`,{slug:e.slug,actualBytes:e.actualBytes,maxBytes:e.maxBytes}),Z.socketTranscriptFallbacks[e.slug]={kind:`payload-too-large`,actualBytes:e.actualBytes,maxBytes:e.maxBytes}),!1;case`resource-limited`:return Z.socketTranscriptFallbacks[e.slug]||console.warn(`[frizz] live transcript read budget reached; updates paused`,{slug:e.slug,scope:e.scope,retryAfterMs:e.retryAfterMs}),Z.socketTranscriptFallbacks[e.slug]={kind:`read-budget`,scope:e.scope,retryAfterMs:e.retryAfterMs},!1;case`hb`:return!0}}function KA(e){EA&&bA&&bA.readyState===WebSocket.OPEN&&bA.send(JSON.stringify(e))}function qA(){for(let e of kA.keys())Z.socketTranscriptFallbacks[e]||KA({t:`sub`,topic:`transcript`,slug:e})}function JA(e){let t=(kA.get(e)??0)+1;kA.set(e,t),t===1&&!Z.socketTranscriptFallbacks[e]&&KA({t:`sub`,topic:`transcript`,slug:e})}function YA(e){let t=(kA.get(e)??0)-1;t<=0?(kA.delete(e),KA({t:`unsub`,topic:`transcript`,slug:e})):kA.set(e,t)}function XA(e){Z.socketTranscriptFallbacks[e]&&(delete Z.socketTranscriptFallbacks[e],kA.has(e)&&KA({t:`sub`,topic:`transcript`,slug:e}))}function ZA(){kA.clear(),AA.reset(),RA(),Z.connection=`connecting`,FA(),OA?Xk():LA()}function QA(e){xA=e,FA();let t=()=>LA();document.readyState===`complete`?t():window.addEventListener(`load`,t,{once:!0})}function $A(){return Hf(Z).board}function ej(){return Hf(Z).board?.projectDir}function tj(e){return e}function nj(e){if(!(!e||e.kind!==`session`||e.foreign||!e.sessionId))return{slug:e.id,sessionId:e.sessionId}}function rj(e){let t=nj(e);if(!(!t||e?.pendingInteraction===!1))return t}function ij(e,t=Date.now()){let n=1/0;for(let t of e){if(!t.expiresAt)continue;let e=Date.parse(t.expiresAt);Number.isFinite(e)&&(n=Math.min(n,e))}return Number.isFinite(n)?Math.max(250,n-t+50):!1}function aj(e){let t=rj(e);return qd({queryKey:t?Pk(t.slug,t.sessionId):[`interactions`,`pending`,`unowned`],queryFn:()=>X.pendingInteractions(t),enabled:t!==void 0,refetchInterval:e=>ij(e.state.data?.interactions??[]),refetchOnReconnect:!0,refetchOnWindowFocus:!0})}var oj=7e3,sj=5e3,cj=3;function lj(e,t){let n=Md(),r=Hf(Z),i=r.socketTranscripts,a=r.socketTranscriptFallbacks[e],o=qd({queryKey:[`transcript`,e],queryFn:async()=>{let t=await X.threadTranscript({slug:e}),r=n.getQueryData([`transcript`,e]),i=pA(r,t);return{...i,messages:sA(r?.messages,eA(r?.messages,i.messages))}},refetchInterval:t.poll&&!i&&!a?1500:!1,refetchOnWindowFocus:!a});return(0,B.useEffect)(()=>{if(!t.poll&&!i||a)return;let r=!1,s=0,c,l=setInterval(()=>{if(r)return;let t=iC(Z.board,e)?.lastActivityAt,a=lA(n.getQueryData([`transcript`,e])?.messages);if(!cA(t,a,sj)){s=0;return}if(a!==c&&(s=0),s>=cj)return;s++,c=a;let l=t?Date.parse(t)-(a?Date.parse(a):0):0;console.warn(`[frizz] transcript watchdog: stale view — self-healing`,{slug:e,lagMs:l,transport:i?`socket`:`poll`,attempt:s}),i&&(YA(e),JA(e)),r=!0,o.refetch().finally(()=>{r=!1})},oj);return()=>clearInterval(l)},[e,t.poll,i,a]),{...o,transportFallback:a?a.kind===`payload-too-large`?{kind:`payload-too-large`,actualBytes:a.actualBytes,maxBytes:a.maxBytes}:{kind:`read-budget`,scope:a.scope,retryAfterMs:a.retryAfterMs}:null,retryLiveUpdates:()=>XA(e)}}function uj(e,t){return qd({queryKey:[`subAgentTranscript`,e,t],queryFn:()=>X.subAgentTranscript({slug:e,id:t}),refetchInterval:e=>e.state.data?.state===`running`?2500:!1})}function dj(e,t){return qd({queryKey:[`backgroundShellOutput`,e,t],queryFn:()=>X.backgroundShellOutput({slug:e,id:t}),refetchInterval:e=>e.state.data?.state===`running`?1500:!1})}function fj(e,t){let n=[...t].sort(),r=qd({queryKey:[`backgroundShellActivity`,e,n],queryFn:()=>X.backgroundShellActivity({slug:e,ids:n}),enabled:n.length>0,refetchInterval:e=>e.state.data&&!e.state.data.shells.some(e=>e.running)?!1:1500});return(0,B.useMemo)(()=>new Map((r.data?.shells??[]).flatMap(e=>e.lines===null?[]:[[e.id,e.lines]])),[r.data])}function pj(e,t,n,r={}){e.setQueryData([`transcript`,t],e=>{let t=e?.messages??[];return{...e,messages:[...t,{role:`user`,text:n,tools:[],parts:[],queued:!0,deliveryId:r.deliveryId}]}}),r.scrollToBottom!==!1&&typeof window<`u`&&requestAnimationFrame(()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:`smooth`}))}function mj(e,t,n,r){e.setQueryData([`transcript`,t],e=>{if(!e?.messages?.length)return e;let t=e.messages.findLastIndex(e=>e.queued&&e.role===`user`&&e.text===n&&(r===void 0||e.deliveryId===r));return t===-1?e:{...e,messages:e.messages.filter((e,n)=>n!==t)}})}function hj(){let e=$S();return e?`/thread/${encodeURIComponent(e)}`:Z.routeThreadSlug?`/thread/${encodeURIComponent(Z.routeThreadSlug)}`:Z.view.startsWith(`status:`)?`/status/${encodeURIComponent(Z.view.slice(7))}`:`/`}function gj(e){try{return decodeURIComponent(e)}catch{return null}}function _j(e,t=Z.board?.projectSlug){let n=wx(e);return n===`/`&&t?xx(t):n}function vj(e){let t=e.match(/^\/thread\/([^/]+)$/);if(t){let e=gj(t[1]);if(e===null){Z.routeThreadSlug=null,QS(Z.drawers.map(e=>e.id)),Z.view=`todos`;return}Z.view=`todos`;let n=Z.drawers.findIndex(t=>t.kind===`thread`&&t.slug===e&&!t.closing);if(n!==-1){Z.routeThreadSlug=null,QS(Z.drawers.slice(n+1).map(e=>e.id));return}Z.routeThreadSlug=e;return}let n=e.match(/^\/status\/([^/]+)$/);if(n){Z.routeThreadSlug=null,QS(Z.drawers.map(e=>e.id));let e=gj(n[1]);Z.view=e===null?`todos`:`status:${e}`;return}Z.routeThreadSlug=null,QS(Z.drawers.map(e=>e.id)),Z.view=`todos`}function yj(e=location.pathname){vj(Cx(e))}function Bee(e){return yj(),zf(Z,()=>{let t=_j(hj());t!==location.pathname&&e(t,{replace:!hj().startsWith(`/thread/`)})})}function Vee(e,t){if(!t)return e;let n=e.projectDir!==t.projectDir,r=t.threads.length>0;return{projectDir:t.projectDir,hasBeenVisible:n?r:e.hasBeenVisible||r}}var bj=`frizz-sidebar-seen:`;function Hee(e){try{return localStorage.getItem(bj+(e??``))===`1`}catch{return!1}}function Uee(e,t){try{localStorage.setItem(bj+(e??``),t?`1`:`0`)}catch{}}var xj=3600*1e3,Sj=24*xj,Cj=[{value:`1h`,label:`1 hour`,detail:`60 minutes`,kind:`duration`},{value:`tomorrow`,label:`tomorrow`,detail:`9am`,kind:`calendar`},{value:`1d`,label:`1 day`,detail:`24 hours`,kind:`duration`},{value:`3d`,label:`3 days`,detail:`72 hours`,kind:`duration`},{value:`1w`,label:`1 week`,detail:`7 days`,kind:`duration`}],Wee=new Set(Cj.map(e=>e.value));function Gee(e){return typeof e==`string`&&Wee.has(e)}function wj(e){return Tj(e).label}function Tj(e){return Cj.find(t=>t.value===e)??Cj[2]}function Kee(e){let t=Tj(e);return t.kind===`calendar`?`Snooze until ${t.label}`:`Snooze ${t.label}`}function Ej(e,t=Date.now()){if(e===`tomorrow`){let e=new Date(t);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+1,9,0,0,0).toISOString()}return new Date(t+(e===`1h`?xj:e===`1d`?Sj:e===`3d`?3*Sj:7*Sj)).toISOString()}function Dj(e){return String(e).padStart(2,`0`)}function Oj(e){return`${e.getFullYear()}-${Dj(e.getMonth()+1)}-${Dj(e.getDate())}T${Dj(e.getHours())}:${Dj(e.getMinutes())}`}function qee(e,t=Date.now()){let n=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(!n)return{ok:!1,message:`Choose a local date and time`};let[,r,i,a,o,s]=n,c=[r,i,a,o,s].map(Number),l=new Date(c[0],c[1]-1,c[2],c[3],c[4],0,0);return!Number.isFinite(l.getTime())||l.getFullYear()!==c[0]||l.getMonth()!==c[1]-1||l.getDate()!==c[2]||l.getHours()!==c[3]||l.getMinutes()!==c[4]?{ok:!1,message:`That local time does not exist`}:l.getTime()<=t?{ok:!1,message:`Choose a time in the future`}:{ok:!0,until:l.toISOString()}}function kj(e,t=Date.now()){let n=new Date(e);if(!Number.isFinite(n.getTime()))return``;let r=new Date(t),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),a=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),o=Math.round((a-i)/Sj),s=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);if(o===0)return`Today at ${s}`;if(o===1)return`Tomorrow at ${s}`;if(o>1&&o<7)return`${new Intl.DateTimeFormat(void 0,{weekday:`long`}).format(n)} at ${s}`;let c={month:`short`,day:`numeric`};return n.getFullYear()!==r.getFullYear()&&(c.year=`numeric`),`${new Intl.DateTimeFormat(void 0,c).format(n)} at ${s}`}function Aj(e,t){if(!Number.isFinite(Date.parse(e)))return null;let n=kj(e,t);return n?n.replace(/^(Today|Tomorrow)/,e=>e.toLowerCase()):null}function Jee(e,t=Date.now()){let n=Aj(e,t);return n?`Snoozed until ${n}`:null}var Yee=120;function jj(e,t=Yee){let n=e.trim().replace(/\s+/g,` `);return n.length>t?`${n.slice(0,t-1)}…`:n}function Mj(e,t,n=Date.now()){let r=t?.trim();if(!r)return Jee(e,n);let i=Nj(e,n);return i?`${i} — then: ${jj(r)}`:null}function Nj(e,t=Date.now()){let n=Aj(e,t);return n?`Auto-snoozed until ${n}`:null}var Pj=`frizz.prefs.v1`;function Fj(e,t){return typeof e==`boolean`?e:e===`off`?!1:e===`compact`||e===`full`?!0:t}function Ij(e,t){return e===`fifo`||e===`lifo`?e:t}function Lj(e){let t={compactDiffs:!0,snoozePreset:`1d`,stickyUserMessage:!1,queueOrder:`fifo`,diffsRedefaulted:!0,stickyRedefaulted:!0};try{if(!e)return t;let n=JSON.parse(e);return n.diffsRedefaulted||=(n.compactDiffs=!0,!0),n.stickyRedefaulted||=(n.stickyUserMessage=!1,!0),{...t,...n,snoozePreset:Gee(n.snoozePreset)?n.snoozePreset:t.snoozePreset,stickyUserMessage:Fj(n.stickyUserMessage,t.stickyUserMessage),queueOrder:Ij(n.queueOrder,t.queueOrder)}}catch{return t}}function Rj(){try{return Lj(typeof localStorage>`u`?null:localStorage.getItem(Pj))}catch{return Lj(null)}}var zj=Rf(Rj());zf(zj,()=>{try{typeof localStorage<`u`&&localStorage.setItem(Pj,JSON.stringify(zj))}catch{}});function Bj(e){return e.kind===`session`&&e.foreign!==!0&&e.runtime===`exited`}var Vj=hy.options,Hj={planning:`text-sky-400 border-sky-400/40`,planned:`text-violet-400 border-violet-400/40`,active:`text-emerald-400 border-emerald-400/40`,"needs-human":`text-yellow-400 border-yellow-400/40`,blocked:`text-orange-400 border-orange-400/40`,done:`text-zinc-400 border-zinc-400/40`,dismissed:`text-rose-400 border-rose-400/40`,archived:`text-slate-500 border-slate-500/40`};function Uj(e){return e.foreign===!0&&e.title.trim()?e.title.trim():Xj(e)?Kj:e.aiTitle?.trim()&&!Wj(e)?Gj(e.aiTitle):e.backend===`codex`&&e.titleAuto===!0&&!e.aiTitle?.trim()?qj:e.titleAuto===!1&&e.title.trim()?e.title:e.title.trim()&&!(e.titleAuto===!0&&e.title.trim()===e.id)?e.titleAuto===!0?Gj(e.title):e.title.trim():e.titleAuto===!0?qj:e.id}function Wj(e){return e.titleLocked??e.titleAuto===!1}function Gj(e){let t=e.trim();if(!/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/i.test(t))return t;let n=t.split(/[-_]+/).filter(Boolean);if(n.length===0)return t;let r=n.join(` `).toLowerCase();return r.charAt(0).toUpperCase()+r.slice(1)}var Kj=`Spinning up a thread…`,qj=`Untitled thread`,Jj=6e4,Yj=15e3;function Xj(e){if(!e.titleAuto||e.aiTitle)return!1;if(e.backend===`codex`){if(e.runtime===`spawning`)return!0;let t=Date.parse(e.spawnedAt??``);return Number.isFinite(t)&&Date.now()-t<Yj}let t=Date.parse(e.spawnedAt??``);return Number.isFinite(t)&&Date.now()-t<Jj}function Zj(e){return e.status===`done`||e.status===`dismissed`?!1:!!(e.runtime===`perm-prompt`||e.pendingAsk||e.humanBlocked&&e.runtime!==`none`&&e.runtime!==`running`&&e.runtime!==`spawning`||e.pendingQuestion&&e.runtime!==`running`&&e.runtime!==`spawning`||(e.status===`active`||e.status===`planning`)&&(e.runtime===`exited`||e.runtime===`none`)&&e.spawnedAt&&!e.archived)}function Qj(e){let t=Date.parse(e.lastUserAt??``),n=Date.parse(e.spawnedAt??``),r=Math.max(Number.isFinite(t)?t:-1/0,Number.isFinite(n)?n:-1/0);return Number.isFinite(r)?r:0}function $j(e){if(dM(e))return Qj(e);let t=Date.parse(e.lastAssistantAt??``);return Number.isFinite(t)?t:Qj(e)}function eM(e){return dM(e)?e.lastActivityAt??e.spawnedAt:e.lastAssistantAt??e.lastActivityAt??e.spawnedAt}function tM(e){return[...e].sort((e,t)=>{let n=Zj(e);if(n!==Zj(t))return n?-1:1;let r=$j(t)-$j(e);return r===0?e.id.localeCompare(t.id):r})}function nM(e){return[...e].sort((e,t)=>{let n=$j(t)-$j(e);return n===0?e.id.localeCompare(t.id):n})}function rM(e,t=`fifo`){let n=t===`lifo`?-1:1;return[...e].sort((e,t)=>{let r=($j(e)-$j(t))*n;return r===0?e.id.localeCompare(t.id):r})}function iM(e){return hb(e)}function aM(e){return e.filter(e=>e.kind===`session`&&e.foreign===!0)}function oM(e){return e.runtime===`turn-idle`||e.runtime===`exited`}function sM(e){return(e.subAgents??[]).some(e=>Sy(e)&&e.state===`running`)}function cM(e){return sM(e)||e.awaitingBackground===!0}function lM(e,t=Date.now()){let n=Date.parse(e.snoozedUntil??``);return Number.isFinite(n)&&n>t?e.snoozedUntil:void 0}function uM(e,t=Date.now()){let n=lM(e,t)!==void 0;if(e.state===`archived`||cM(e))return!1;if(n)return e.runtime!==`running`&&e.runtime!==`spawning`;if(e.needsYou||e.pendingAsk||e.runtime===`perm-prompt`||!oM(e))return!1;if(e.limitPause?.autoResume)return!0;let r=e.lastFence?.kind===`awaiting`;return n||r}function dM(e){return e.runtime===`running`||e.runtime===`spawning`?!0:e.runtime===`turn-idle`&&cM(e)}function fM(e){return e.needsYou===!0&&oM(e)}function pM(e){return e.runtime===`turn-idle`&&e.awaitingBackground===!0&&!sM(e)}function mM(e){return pM(e)?(e.bgShells??[]).some(e=>e.state===`running`)?!0:(e.watches??[]).some(e=>e.kind===`github`&&e.state===`armed`&&e.github?.checks===`running`&&e.github.state===`open`):!1}function hM(e){let t=dM(e);return e.state===`archived`&&!t?`archived`:e.actionableInteraction||e.pendingAsk||e.pendingQuestion||e.runtime===`perm-prompt`||e.humanBlocked||e.status===`needs-human`?`needs-input`:t&&!fM(e)&&!pM(e)?`working`:uM(e)?`held`:e.lastFence?.kind===`done`&&oM(e)?`done`:mM(e)?`background`:Bj(e)?`stalled`:`rest`}function gM(e){let t=hM(e);return t===`stalled`?!0:t===`held`&&e.foreign!==!0&&!!e.limitPause?.autoResume}function _M(e){return e.kind===`session`?e.state===`archived`&&!dM(e)?`inactive`:uM(e)?`held`:`active`:null}function vM(e,t=`fifo`){let n=e.filter(yM);return[...rM(e.filter(e=>!yM(e)),t),...nM(n)]}function yM(e){return e.needsYou!==!0}function bM(e){return{running:e.filter(yM),rested:e.filter(e=>!yM(e))}}function xM(e,t=`fifo`){let n={active:[],held:[],inactive:[]};for(let t of e){if(t.kind===`session`&&t.foreign===!0)continue;let e=_M(t);e&&n[e].push(t)}return n.active=vM(n.active,t),n.held=nM(n.held),n.inactive=nM(n.inactive),n}function SM(e,t){for(let n of[e,t])if(n&&Number.isFinite(Date.parse(n)))return n}function CM(e,t=Date.now()){let n=wM(e,t);return n&&`Last active ${n}`}function wM(e,t=Date.now()){let n=EM(e,t);return n===null||n===TM?n:`${n} ago`}var TM=`just now`;function EM(e,t=Date.now()){let n=e?Date.parse(e):NaN;if(!Number.isFinite(n)||!Number.isFinite(t))return null;let r=Math.max(0,Math.floor((t-n)/1e3));if(r===0)return TM;if(r<60)return`${r} ${r===1?`second`:`seconds`}`;let i=Math.floor(r/60);if(i<60)return`${i} ${i===1?`minute`:`minutes`}`;let a=Math.floor(i/60);if(a<24)return`${a} ${a===1?`hour`:`hours`}`;let o=Math.floor(a/24);if(o<7)return`${o} ${o===1?`day`:`days`}`;let s=Math.floor(o/7);if(s<5)return`${s} ${s===1?`week`:`weeks`}`;let c=Math.floor(o/30);if(c<12)return`${c} ${c===1?`month`:`months`}`;let l=Math.floor(o/365);return`${l} ${l===1?`year`:`years`}`}var DM=3e4,OM=new Set,kM=Date.now(),AM;function jM(){kM=Date.now();for(let e of OM)e();MM()}function MM(){if(OM.size===0)return;let e=DM-kM%DM;AM=setTimeout(jM,e||DM)}function NM(e){return OM.add(e),OM.size===1&&(kM=Date.now(),MM()),()=>{OM.delete(e),OM.size===0&&AM&&(clearTimeout(AM),AM=void 0)}}function PM(){return kM}function FM(){return(0,B.useSyncExternalStore)(NM,PM,PM)}function IM({size:e=15}){return(0,V.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 15 15`,"aria-hidden":!0,className:`text-muted/85`,children:[(0,V.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`14`,height:`14`,rx:`3.5`,fill:`none`,stroke:`currentColor`,strokeOpacity:`0.5`,strokeWidth:`1`}),(0,V.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`14`,height:`14`,rx:`3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`,strokeLinecap:`round`,strokeDasharray:`11 39`,children:(0,V.jsx)(`animate`,{attributeName:`stroke-dashoffset`,from:`50`,to:`0`,dur:`1.1s`,repeatCount:`indefinite`})})]})}function LM(e){return e===`running`}function RM(e,t){return e===`pending`&&t===`background`}var zM=2e3;function BM(e,t){return e===`pending`&&t===void 0}function VM(e,t,n,r){if(!BM(e,t))return!1;let i=n?Date.parse(n):NaN;return Number.isFinite(i)?r-i>=zM:!0}function HM(e){return e?.split(`
320
+ `).find(e=>e.trim())?.trim().replace(/\s+/g,` `)||void 0}function UM(e,t){if(e.name===`Interrupt process`||e.status===`cancelled`||e.backgroundState!==`background`)return;let n=new Set([HM(e.desc),HM(e.detail),HM(e.command)].filter(e=>!!e));if(n.size===0)return;let r=t.filter(e=>n.has(HM(e.label)??``));return r.some(e=>e.state===`running`)?`running`:r.some(e=>e.state===`stale`)?`stale`:void 0}function WM(e){if(e<1)return`<1 ms`;if(e<1e3)return`${Math.round(e)} ms`;if(e<6e4)return`${e<1e4?(e/1e3).toFixed(1):Math.round(e/1e3)} sec`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n?`${t} min ${n} sec`:`${t} min`}function GM(e){return e<1?`just now`:e<60?`${e} min`:`${Math.floor(e/60)} hr ${e%60} min`}function KM(e){if(!Number.isFinite(e)||e<0)return``;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60),i=n%60;return i?`${r}hr ${i}m`:`${r}hr`}function qM(e){if(!Number.isFinite(e)||e<0)return``;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r<24)return n%60?`${r}h ${n%60}m`:`${r}h`;let i=Math.floor(r/24);if(i<7)return r%24?`${i}d ${r%24}h`:`${i}d`;let a=Math.floor(i/7);return i%7?`${a}w ${i%7}d`:`${a}w`}function JM(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);return Number.isFinite(n)?KM(t-n):``}function YM(e){if(!Number.isFinite(e)||e<0)return``;let t=Math.floor(e/6e4);return t<1?`<1 min`:GM(t)}function XM(e){if(!Number.isFinite(e)||e<=0)return`0s`;let t=e=>String(e).padStart(2,`0`),n=Math.ceil(e/1e3);if(n<60)return`${n}s`;let r=Math.floor(n/60);if(r<60)return`${r}m ${t(n%60)}s`;let i=Math.floor(r/60);if(i<24)return`${i}h ${t(r%60)}m`;let a=Math.floor(i/24);if(a<7)return i%24?`${a}d ${i%24}h`:`${a}d`;let o=Math.floor(a/7);return a%7?`${o}w ${a%7}d`:`${o}w`}function ZM(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);return Number.isFinite(n)?GM(Math.floor((t-n)/6e4)):``}function QM(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.floor((t-n)/6e4);return r<1?`just now`:`${GM(r)} ago`}var $M=`shrink-0 text-[11px] leading-none text-muted/45`,eN=`block h-1.5 w-1.5 rounded-full bg-muted/30`,tN=`stale — no recent output`,nN=`block h-1.5 w-1.5 rounded-full border border-muted/45`,rN=`rested — it stopped, but the work it launched is still running`,iN=`running — no recent output`,aN={AGENT:`Open sub-agent transcript`,SHELL:`Open background shell output`,GITHUB:`Open this pull request on GitHub`};function oN(e){if(!(typeof e!=`number`||!Number.isFinite(e)||e<0))return e===1?`1 line`:`${sN(e)??`0`} lines`}function sN(e){if(typeof e!=`number`||!Number.isFinite(e)||e<=0)return;let t=(e,t)=>`${e<100?e.toFixed(1).replace(/\.0$/,``):Math.round(e)}${t}`;return e<1e3?String(Math.round(e)):e<1e6?t(e/1e3,`k`):t(e/1e6,`M`)}var cN={running:`Stop — end this operation and everything it spawned, then clear the row`,settled:`Clear — stop tracking this finished operation`},lN={running:`Stop`,settled:`Clear`},uN={AGENT:`sub-agent`,SHELL:`background shell`,GITHUB:`PR watcher`};function dN(e,t){let n=new Map;for(let t of e){if(!t.parentId)continue;let e=n.get(t.parentId);e?e.push(t):n.set(t.parentId,[t])}let r=[],i=new Set([t]),a=(e,t)=>{for(let o of n.get(e)??[])o.id&&i.has(o.id)||(o.id&&i.add(o.id),r.push({...o,displayDepth:t}),o.id&&a(o.id,t+1))};return a(t,1),r}var fN=e=>e.state===`running`||e.state===`stale`||e.state===`rested`;function pN(e,t){return t===`card`?e.filter(fN):t===`rail`?e.filter(e=>!!e.id&&fN(e)):e}var mN=e=>{let t=e.launchId??e.id;return[...t?[`id:${t}`]:[],...e.command?[`cmd:${e.command}`]:[],`launch:${e.label}\u0000${e.startedAt??``}`]};function hN(e,t){let n=[...e],r=new Set(n.flatMap(mN));for(let e of t)mN(e).some(e=>r.has(e))||n.push(e);return n}function gN({kind:e,label:t,state:n,density:r,depth:i,startedAt:a,counter:o,counterTitle:s,parentSlug:c,onOpen:l,onDismiss:u,title:d}){let f=LM(n),p={AGENT:`frizz-live-dot--agent`,SHELL:`frizz-live-dot--shell`,GITHUB:`frizz-live-dot--github`},m={AGENT:`AGENT`,SHELL:`SHELL`,GITHUB:`WATCH`},h=!!l,g=r===`rail`,_=r===`sheet`,v=JM(a,FM()),y=Math.min(Math.max((i??1)-1,0),4)*13,b=f?`running`:`settled`,x=aN[e],S=d??(h?x:void 0),C=n===`rested`?(0,V.jsx)(`span`,{className:nN,title:rN}):(0,V.jsx)(`span`,{className:eN,title:tN}),w=g?(0,V.jsx)(`span`,{className:`flex w-3.5 shrink-0 items-center justify-center`,children:f?(0,V.jsx)(IM,{size:12}):C}):(0,V.jsx)(`span`,{className:`frizz-op-dot-slot flex w-[9px] shrink-0 justify-center`,children:f?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot ${p[e]}`,"data-running-indicator":r===`card`?`queue-subagent`:`operation`}):e===`SHELL`?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot-quiet frizz-live-dot-quiet--shell`,"data-running-indicator":`operation-quiet`,title:iN}):C}),T=o||v?(0,V.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 pl-1.5 text-muted/40`,children:[o&&(0,V.jsx)(`span`,{"data-child-op-counter":!0,title:s,children:o}),o&&v&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`text-muted/25`,children:`·`}),v&&(0,V.jsx)(`span`,{title:`Working for ${v}`,children:v})]}):null,E=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":!0,className:$M,children:`⤷`}),w,_&&(0,V.jsx)(`span`,{className:`petite-caps shrink-0 text-[9.5px] text-muted/45`,children:m[e]}),(0,V.jsx)(`span`,{className:`min-w-0 truncate text-muted/70 ${g?`leading-[16px]`:h?`group-hover:text-fg/80 group-hover:underline`:``}`,children:t})]}),D=g?`group flex min-w-0 items-center gap-2 pl-[26px] text-left outline-none`:`group flex min-w-0 max-w-[60%] items-center gap-1.5 overflow-hidden text-left text-[11.5px] ${h?`cursor-pointer rounded-sm outline-none transition-colors focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`:``}`,O=g&&y>0?{paddingLeft:26+y}:void 0,k=h?(0,V.jsx)(`button`,{type:`button`,style:O,onClick:l,onMouseDown:_?e=>e.stopPropagation():void 0,title:S,"aria-label":`${x}: ${t}`,className:D,children:E}):(0,V.jsx)(`div`,{style:O,title:S,className:D,children:E});return(0,V.jsxs)(`div`,{className:g?`flex w-full min-w-0 items-center gap-1.5 rounded-md py-0.5 pr-1.5 text-[11.5px] transition-colors hover:bg-white/[0.04]`:`flex min-w-0 items-center gap-1.5 text-[11.5px]`,style:!g&&y>0?{marginLeft:y}:void 0,"data-op-row":u?``:void 0,"data-subagent-depth":i&&i>1?i:void 0,"data-subagent-parent":c,children:[k,u&&(0,V.jsx)(`button`,{type:`button`,onClick:u,onMouseDown:e=>e.stopPropagation(),title:cN[b],"aria-label":`${lN[b]} ${uN[e]}: ${t}`,className:`shrink-0 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-fg/60`,children:(0,V.jsx)(jw,{size:11})}),T]})}function _N(e,t,n=`AGENT`){let r=n===`SHELL`?`Background shell`:`Sub-agent`;X.stopBackgroundOp({slug:e,id:t}).then(({stopped:e,note:t,descendantsStopped:i})=>{if(e){if(t)return Q(`${r} stopped. ${t}`,{duration:7e3});if(n===`SHELL`)return Q(`Background shell stopped — the worker was told`);Q(i>0?`Sub-agent and ${i} descendant${i===1?``:`s`} stopped`:`Sub-agent stopped`)}}).catch(e=>{Q(`Couldn’t stop: ${(e instanceof Error?e.message:String(e)).slice(0,100)}`,{duration:7e3})})}function vN(e,t,n=`AGENT`){if(!t.id||!Sy(t)||t.state===`running`&&!t.stoppable)return;let r=t.id;return()=>_N(e,r,n)}typeof window<`u`&&window.document&&window.document.createElement;function yN(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function bN(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function xN(...e){return t=>{let n=!1,r=e.map(e=>{let r=bN(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():bN(e[t],null)}}}}function SN(...e){return B.useCallback(xN(...e),e)}function CN(e,t=[]){let n=[];function r(t,r){let i=B.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=B.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=B.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>B.createContext(e));return function(n){let r=n?.[e]||t;return B.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,wN(i,...t)]}function wN(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var TN=globalThis?.document?B.useLayoutEffect:()=>{},EN=B.useEffectEvent,DN=B.useInsertionEffect;function ON(e){if(typeof EN==`function`)return EN(e);let t=B.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof DN==`function`?DN(()=>{t.current=e}):TN(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}var kN=B.useInsertionEffect||TN;function AN({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=jN({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=B.useRef(e!==void 0);B.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,B.useCallback(t=>{if(s){let n=MN(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function jN({defaultProp:e,onChange:t}){let[n,r]=B.useState(e),i=B.useRef(n),a=B.useRef(t);return kN(()=>{a.current=t},[t]),B.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function MN(e){return typeof e==`function`}function NN(e){let t=B.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];VN(r)&&typeof GN==`function`&&(r=GN(r._payload)),B.Children.forEach(r,e=>{if(zN(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;VN(n)&&typeof GN==`function`&&(n=GN(n._payload)),a=IN(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=B.cloneElement(a,void 0,s):!o&&B.Children.count(r)===1&&B.isValidElement(r)&&(a=r);let c=a?RN(a):void 0,l=SN(n,c);if(!a){if(r||r===0)throw Error(o?WN(e):UN(e));return r}let u=LN(i,a.props??{});return a.type!==B.Fragment&&(u.ref=n?l:c),B.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var PN=Symbol.for(`radix.slottable`);function FN(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=PN,t}var IN=(e,t)=>{if(`child`in e.props){let t=e.props.child;return B.isValidElement(t)?B.cloneElement(t,void 0,e.props.children(t.props.children)):null}return B.isValidElement(t)?t:null};function LN(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function RN(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function zN(e){return B.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===PN}var BN=Symbol.for(`react.lazy`);function VN(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===BN&&`_payload`in e&&HN(e._payload)}function HN(e){return typeof e==`object`&&!!e&&`then`in e}var UN=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,WN=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,GN=B.use,KN=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=NN(`Primitive.${t}`),r=B.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function qN(e,t){e&&Xd.flushSync(()=>e.dispatchEvent(t))}function JN(e){let t=e+`CollectionProvider`,[n,r]=CN(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=B.useRef(null),a=B.useRef(new Map).current;return(0,V.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=NN(s),l=B.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=SN(t,a(s,n).collectionRef);return(0,V.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=NN(u),p=B.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=B.useRef(null),s=SN(t,o),c=a(u,n);return B.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,V.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return B.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var YN=B.createContext(void 0);function XN(e){let t=B.useContext(YN);return e||t||`ltr`}function ZN(e){let t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}var QN=`DismissableLayer`,$N=`dismissableLayer.update`,eP=`dismissableLayer.pointerDownOutside`,tP=`dismissableLayer.focusOutside`,nP,rP=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),iP=B.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=B.useContext(rP),[d,f]=B.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=B.useState({}),h=SN(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(_),y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=B.useRef(!1),C=cP(e=>{let t=e.target;if(!(t instanceof Node))return;let n=[...u.branches].some(e=>e.contains(t));!x||n||(a?.(e),s?.(e),e.defaultPrevented||c?.())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces}),w=lP(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=ON(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return B.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T]),B.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(nP=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),uP(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=nP))}},[d,p,n,u]),B.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),uP())},[d,u]),B.useEffect(()=>{let e=()=>m({});return document.addEventListener($N,e),()=>document.removeEventListener($N,e)},[]),(0,V.jsx)(KN.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:yN(e.onFocusCapture,w.onFocusCapture),onBlurCapture:yN(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:yN(e.onPointerDownCapture,C.onPointerDownCapture)})});iP.displayName=QN;var aP=`DismissableLayerBranch`,oP=B.forwardRef((e,t)=>{let n=B.useContext(rP),r=B.useRef(null),i=SN(t,r);return B.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(KN.div,{...e,ref:i})});oP.displayName=aP;function sP(){let e=B.useContext(rP),[t,n]=B.useState(null);return B.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function cP(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a}=t,o=ZN(e),s=B.useRef(!1),c=B.useRef(!1),l=B.useRef(new Map),u=B.useRef(()=>{});return B.useEffect(()=>{function e(){c.current=!1,i.current=!1,l.current.clear()}function t(){return Array.from(l.current.values()).some(Boolean)}function d(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||l.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{c.current&&u.current()},0)}function f(e){c.current&&l.current.set(e.type,!1)}let p=a=>{if(a.target&&!s.current){let s=function(){n.removeEventListener(`click`,u.current);let r=t();e(),r||dP(eP,o,d,{discrete:!0})},d={originalEvent:a};c.current=!0,i.current=r&&a.button===0,l.current.clear(),!r||a.button!==0?s():(n.removeEventListener(`click`,u.current),u.current=s,n.addEventListener(`click`,u.current,{once:!0}))}else n.removeEventListener(`click`,u.current),e();s.current=!1},m=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of m)n.addEventListener(e,d,!0),n.addEventListener(e,f);let h=window.setTimeout(()=>{n.addEventListener(`pointerdown`,p)},0);return()=>{window.clearTimeout(h),n.removeEventListener(`pointerdown`,p),n.removeEventListener(`click`,u.current);for(let e of m)n.removeEventListener(e,d,!0),n.removeEventListener(e,f)}},[n,o,r,i,a]),{onPointerDownCapture:()=>s.current=!0}}function lP(e,t=globalThis?.document){let n=ZN(e),r=B.useRef(!1);return B.useEffect(()=>{let e=e=>{e.target&&!r.current&&dP(tP,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function uP(){let e=new CustomEvent($N);document.dispatchEvent(e)}function dP(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?qN(i,a):i.dispatchEvent(a)}var fP=0,pP=null;function mP(){B.useEffect(()=>{pP||={start:hP(),end:hP()};let{start:e,end:t}=pP;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),fP++,()=>{fP===1&&(pP?.start.remove(),pP?.end.remove(),pP=null),fP=Math.max(0,fP-1)}},[])}function hP(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var gP=`focusScope.autoFocusOnMount`,_P=`focusScope.autoFocusOnUnmount`,vP={bubbles:!1,cancelable:!0},yP=`FocusScope`,bP=B.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=ZN(i),u=ZN(a),d=B.useRef(null),f=SN(t,c),p=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:DP(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||DP(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&DP(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),B.useEffect(()=>{if(s){OP.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(gP,vP);s.addEventListener(gP,l),s.dispatchEvent(t),t.defaultPrevented||(xP(jP(CP(s)),{select:!0}),document.activeElement===e&&DP(s))}return()=>{s.removeEventListener(gP,l),setTimeout(()=>{let t=new CustomEvent(_P,vP);s.addEventListener(_P,u),s.dispatchEvent(t),t.defaultPrevented||DP(e??document.body,{select:!0}),s.removeEventListener(_P,u),OP.remove(p)},0)}}},[s,l,u,p]);let m=B.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=SP(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&DP(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&DP(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(KN.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});bP.displayName=yP;function xP(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(DP(r,{select:t}),document.activeElement!==n)return}function SP(e){let t=CP(e);return[wP(t,e),wP(t.reverse(),e)]}function CP(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function wP(e,t){for(let n of e)if(!TP(n,{upTo:t}))return n}function TP(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function EP(e){return e instanceof HTMLInputElement&&`select`in e}function DP(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&EP(e)&&t&&e.select()}}var OP=kP();function kP(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=AP(e,t),e.unshift(t)},remove(t){e=AP(e,t),e[0]?.resume()}}}function AP(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function jP(e){return e.filter(e=>e.tagName!==`A`)}var MP=B.useId||(()=>void 0),NP=0;function PP(e){let[t,n]=B.useState(MP());return TN(()=>{e||n(e=>e??String(NP++))},[e]),e||(t?`radix-${t}`:``)}var FP=[`top`,`right`,`bottom`,`left`],IP=Math.min,LP=Math.max,RP=Math.round,zP=Math.floor,BP=e=>({x:e,y:e}),VP={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function HP(e,t,n){return LP(e,IP(t,n))}function UP(e,t){return typeof e==`function`?e(t):e}function WP(e){return e.split(`-`)[0]}function GP(e){return e.split(`-`)[1]}function KP(e){return e===`x`?`y`:`x`}function qP(e){return e===`y`?`height`:`width`}function JP(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function YP(e){return KP(JP(e))}function XP(e,t,n){n===void 0&&(n=!1);let r=GP(e),i=YP(e),a=qP(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=aF(o)),[o,aF(o)]}function ZP(e){let t=aF(e);return[QP(e),t,QP(t)]}function QP(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var $P=[`left`,`right`],eF=[`right`,`left`],tF=[`top`,`bottom`],nF=[`bottom`,`top`];function rF(e,t,n){switch(e){case`top`:case`bottom`:return n?t?eF:$P:t?$P:eF;case`left`:case`right`:return t?tF:nF;default:return[]}}function iF(e,t,n,r){let i=GP(e),a=rF(WP(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(QP)))),a}function aF(e){let t=WP(e);return VP[t]+e.slice(t.length)}function oF(e){return{top:0,right:0,bottom:0,left:0,...e}}function sF(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:oF(e)}function cF(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function lF(e,t,n){let{reference:r,floating:i}=e,a=JP(t),o=YP(t),s=qP(o),c=WP(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(GP(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function uF(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=UP(t,e),p=sF(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=cF(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=cF(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var dF=50,fF=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:uF},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=lF(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<dF&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=lF(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},pF=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=UP(e,t)||{};if(l==null)return{};let d=sF(u),f={x:n,y:r},p=YP(i),m=qP(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=IP(d[_],T),D=IP(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=HP(O,A,k),M=!c.arrow&&GP(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),mF=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=UP(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=WP(r),_=JP(o),v=WP(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[aF(o)]:ZP(o)),x=p!==`none`;!d&&x&&b.push(...iF(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=XP(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==JP(t))||T.every(e=>JP(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=JP(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function hF(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gF(e){return FP.some(t=>e[t]>=0)}var _F=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=UP(e,t);switch(i){case`referenceHidden`:{let e=hF(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:gF(e)}}}case`escaped`:{let e=hF(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:gF(e)}}}default:return{}}}}},vF=new Set([`left`,`top`]);async function yF(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=WP(n),s=GP(n),c=JP(n)===`y`,l=vF.has(o)?-1:1,u=a&&c?-1:1,d=UP(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var bF=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await yF(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},xF=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=UP(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=JP(WP(i)),p=KP(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=HP(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=HP(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},SF=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=UP(e,t),u={x:n,y:r},d=JP(i),f=KP(d),p=u[f],m=u[d],h=UP(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=vF.has(WP(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},CF=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=UP(e,t),u=await o.detectOverflow(t,l),d=WP(i),f=GP(i),p=JP(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=IP(h-u[g],v),x=IP(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=LP(u.left,0),t=LP(u.right,0),n=LP(u.top,0),r=LP(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:LP(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:LP(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function wF(){return typeof window<`u`}function TF(e){return OF(e)?(e.nodeName||``).toLowerCase():`#document`}function EF(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function DF(e){return((OF(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function OF(e){return wF()?e instanceof Node||e instanceof EF(e).Node:!1}function kF(e){return wF()?e instanceof Element||e instanceof EF(e).Element:!1}function AF(e){return wF()?e instanceof HTMLElement||e instanceof EF(e).HTMLElement:!1}function jF(e){return!wF()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof EF(e).ShadowRoot}function MF(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=UF(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function NF(e){return/^(table|td|th)$/.test(TF(e))}function PF(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var FF=/transform|translate|scale|rotate|perspective|filter/,IF=/paint|layout|strict|content/,LF=e=>!!e&&e!==`none`,RF;function zF(e){let t=kF(e)?UF(e):e;return LF(t.transform)||LF(t.translate)||LF(t.scale)||LF(t.rotate)||LF(t.perspective)||!VF()&&(LF(t.backdropFilter)||LF(t.filter))||FF.test(t.willChange||``)||IF.test(t.contain||``)}function BF(e){let t=GF(e);for(;AF(t)&&!HF(t);){if(zF(t))return t;if(PF(t))return null;t=GF(t)}return null}function VF(){return RF??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),RF}function HF(e){return/^(html|body|#document)$/.test(TF(e))}function UF(e){return EF(e).getComputedStyle(e)}function WF(e){return kF(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function GF(e){if(TF(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||jF(e)&&e.host||DF(e);return jF(t)?t.host:t}function KF(e){let t=GF(e);return HF(t)?e.ownerDocument?e.ownerDocument.body:e.body:AF(t)&&MF(t)?t:KF(t)}function qF(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=KF(e),i=r===e.ownerDocument?.body,a=EF(r);if(i){let e=JF(a);return t.concat(a,a.visualViewport||[],MF(r)?r:[],e&&n?qF(e):[])}else return t.concat(r,qF(r,[],n))}function JF(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function YF(e){let t=UF(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=AF(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=RP(n)!==a||RP(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function XF(e){return kF(e)?e:e.contextElement}function ZF(e){let t=XF(e);if(!AF(t))return BP(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=YF(t),o=(a?RP(n.width):n.width)/r,s=(a?RP(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var QF=BP(0);function $F(e){let t=EF(e);return!VF()||!t.visualViewport?QF:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function eI(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==EF(e)?!1:t}function tI(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=XF(e),o=BP(1);t&&(r?kF(r)&&(o=ZF(r)):o=ZF(e));let s=eI(a,n,r)?$F(a):BP(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=EF(a),t=r&&kF(r)?EF(r):r,n=e,i=JF(n);for(;i&&r&&t!==n;){let e=ZF(i),t=i.getBoundingClientRect(),r=UF(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=EF(i),i=JF(n)}}return cF({width:u,height:d,x:c,y:l})}function nI(e,t){let n=WF(e).scrollLeft;return t?t.left+n:tI(DF(e)).left+n}function rI(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-nI(e,n),y:n.top+t.scrollTop}}function iI(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=DF(r),s=t?PF(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=BP(1),u=BP(0),d=AF(r);if((d||!d&&!a)&&((TF(r)!==`body`||MF(o))&&(c=WF(r)),d)){let e=tI(r);l=ZF(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?rI(o,c):BP(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function aI(e){return Array.from(e.getClientRects())}function oI(e){let t=DF(e),n=WF(e),r=e.ownerDocument.body,i=LP(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=LP(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+nI(e),s=-n.scrollTop;return UF(r).direction===`rtl`&&(o+=LP(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var sI=25;function cI(e,t){let n=EF(e),r=DF(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=VF();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=nI(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=sI&&(a-=o)}else l<=sI&&(a+=l);return{width:a,height:o,x:s,y:c}}function lI(e,t){let n=tI(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=AF(e)?ZF(e):BP(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function uI(e,t,n){let r;if(t===`viewport`)r=cI(e,n);else if(t===`document`)r=oI(DF(e));else if(kF(t))r=lI(t,n);else{let n=$F(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return cF(r)}function dI(e,t){let n=GF(e);return n===t||!kF(n)||HF(n)?!1:UF(n).position===`fixed`||dI(n,t)}function fI(e,t){let n=t.get(e);if(n)return n;let r=qF(e,[],!1).filter(e=>kF(e)&&TF(e)!==`body`),i=null,a=UF(e).position===`fixed`,o=a?GF(e):e;for(;kF(o)&&!HF(o);){let t=UF(o),n=zF(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||MF(o)&&!n&&dI(e,o))?r=r.filter(e=>e!==o):i=t,o=GF(o)}return t.set(e,r),r}function pI(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?PF(t)?[]:fI(t,this._c):[].concat(n),r],o=uI(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=uI(t,a[e],i);s=LP(n.top,s),c=IP(n.right,c),l=IP(n.bottom,l),u=LP(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function mI(e){let{width:t,height:n}=YF(e);return{width:t,height:n}}function hI(e,t,n){let r=AF(t),i=DF(t),a=n===`fixed`,o=tI(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=BP(0);function l(){c.x=nI(i)}if(r||!r&&!a)if((TF(t)!==`body`||MF(i))&&(s=WF(t)),r){let e=tI(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?rI(i,s):BP(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function gI(e){return UF(e).position===`static`}function _I(e,t){if(!AF(e)||UF(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return DF(e)===n&&(n=n.ownerDocument.body),n}function vI(e,t){let n=EF(e);if(PF(e))return n;if(!AF(e)){let t=GF(e);for(;t&&!HF(t);){if(kF(t)&&!gI(t))return t;t=GF(t)}return n}let r=_I(e,t);for(;r&&NF(r)&&gI(r);)r=_I(r,t);return r&&HF(r)&&gI(r)&&!zF(r)?n:r||BF(e)||n}var yI=async function(e){let t=this.getOffsetParent||vI,n=this.getDimensions,r=await n(e.floating);return{reference:hI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function bI(e){return UF(e).direction===`rtl`}var xI={convertOffsetParentRelativeRectToViewportRelativeRect:iI,getDocumentElement:DF,getClippingRect:pI,getOffsetParent:vI,getElementRects:yI,getClientRects:aI,getDimensions:mI,getScale:ZF,isElement:kF,isRTL:bI};function SI(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function CI(e,t){let n=null,r,i=DF(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=zP(d),h=zP(i.clientWidth-(u+f)),g=zP(i.clientHeight-(d+p)),_=zP(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:LP(0,IP(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!SI(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function wI(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=XF(e),u=i||a?[...l?qF(l):[],...t?qF(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?CI(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?tI(e):null;c&&g();function g(){let t=tI(e);h&&!SI(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var TI=bF,EI=xF,DI=mF,OI=CF,kI=_F,AI=pF,jI=SF,MI=(e,t,n)=>{let r=new Map,i={platform:xI,...n},a={...i.platform,_c:r};return fF(e,t,{...i,platform:a})},NI=typeof document<`u`?B.useLayoutEffect:function(){};function PI(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!PI(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!PI(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function FI(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function II(e,t){let n=FI(e);return Math.round(t*n)/n}function LI(e){let t=B.useRef(e);return NI(()=>{t.current=e}),t}function RI(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=B.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=B.useState(r);PI(f,r)||p(r);let[m,h]=B.useState(null),[g,_]=B.useState(null),v=B.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=B.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=B.useRef(null),C=B.useRef(null),w=B.useRef(u),T=c!=null,E=LI(c),D=LI(i),O=LI(l),k=B.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),MI(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!PI(w.current,t)&&(w.current=t,Xd.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);NI(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=B.useRef(!1);NI(()=>(A.current=!0,()=>{A.current=!1}),[]),NI(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=B.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=B.useMemo(()=>({reference:b,floating:x}),[b,x]),N=B.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=II(M.floating,u.x),r=II(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...FI(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return B.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var zI=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:AI({element:r.current,padding:i}).fn(n):r?AI({element:r,padding:i}).fn(n):{}}}},BI=(e,t)=>{let n=TI(e);return{name:n.name,fn:n.fn,options:[e,t]}},VI=(e,t)=>{let n=EI(e);return{name:n.name,fn:n.fn,options:[e,t]}},HI=(e,t)=>({fn:jI(e).fn,options:[e,t]}),UI=(e,t)=>{let n=DI(e);return{name:n.name,fn:n.fn,options:[e,t]}},WI=(e,t)=>{let n=OI(e);return{name:n.name,fn:n.fn,options:[e,t]}},GI=(e,t)=>{let n=kI(e);return{name:n.name,fn:n.fn,options:[e,t]}},KI=(e,t)=>{let n=zI(e);return{name:n.name,fn:n.fn,options:[e,t]}},qI=`Arrow`,JI=B.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,V.jsx)(KN.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,V.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});JI.displayName=qI;var YI=JI;function XI(e){let[t,n]=B.useState(void 0);return TN(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var ZI=`Popper`,[QI,$I]=CN(ZI),[eL,tL]=QI(ZI),nL=e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,V.jsx)(eL,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};nL.displayName=ZI;var rL=`PopperAnchor`,iL=B.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=tL(rL,n),o=B.useRef(null),s=a.onAnchorChange,c=SN(t,B.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=B.useRef(null);B.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&mL(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,V.jsx)(KN.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});iL.displayName=rL;var aL=`PopperContent`,[oL,sL]=QI(aL),cL=B.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=tL(aL,n),[_,v]=B.useState(null),y=SN(t,v),[b,x]=B.useState(null),S=XI(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(fL),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=RI({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>wI(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[BI({mainAxis:i+w,alignmentAxis:o}),c&&VI({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?HI():void 0,...k}),c&&UI({...k}),WI({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&KI({element:b,padding:s}),pL({arrowWidth:C,arrowHeight:w}),f&&GI({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),ee=g.setPlacementState;TN(()=>(ee(M),()=>{ee(void 0)}),[M,ee]);let[F,te]=mL(M),ne=ZN(m);TN(()=>{N&&ne?.()},[N,ne]);let re=P.arrow?.x,ie=P.arrow?.y,ae=P.arrow?.centerOffset!==0,[oe,se]=B.useState();return TN(()=>{_&&se(window.getComputedStyle(_).zIndex)},[_]),(0,V.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(oL,{scope:n,placedSide:F,placedAlign:te,onArrowChange:x,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,V.jsx)(KN.div,{"data-side":F,"data-align":te,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});cL.displayName=aL;var lL=`PopperArrow`,uL={top:`bottom`,right:`left`,bottom:`top`,left:`right`},dL=B.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=sL(lL,n),a=uL[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(YI,{...r,ref:t,style:{...r.style,display:`block`}})})});dL.displayName=lL;function fL(e){return e!==null}var pL=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=mL(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function mL(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var hL=nL,gL=iL,_L=cL,vL=dL,yL=`Portal`,bL=B.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=B.useState(!1);TN(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Xd.createPortal((0,V.jsx)(KN.div,{...r,ref:t}),o):null});bL.displayName=yL;function xL(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}var SL=e=>{let{present:t,children:n}=e,r=CL(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=TL(r.ref,DL(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null};SL.displayName=`Presence`;function CL(e){let[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),a=B.useRef(`none`),[o,s]=xL(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return B.useEffect(()=>{let e=EL(r.current);a.current=o===`mounted`?e:`none`},[o]),TN(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=EL(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),TN(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=EL(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=EL(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:B.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function wL(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function TL(...e){let t=B.useRef(e);return t.current=e,B.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=wL(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():wL(n[e],null)}}},[])}function EL(e){return e?.animationName||`none`}function DL(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var OL=`rovingFocusGroup.onEntryFocus`,kL={bubbles:!1,cancelable:!0},AL=`RovingFocusGroup`,[jL,ML,NL]=JN(AL),[PL,FL]=CN(AL,[NL]),[IL,LL]=PL(AL),RL=B.forwardRef((e,t)=>(0,V.jsx)(jL.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(jL.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(zL,{...e,ref:t})})}));RL.displayName=AL;var zL=B.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=B.useRef(null),p=SN(t,f),m=XN(a),[h,g]=AN({prop:o,defaultProp:s??null,onChange:c,caller:AL}),[_,v]=B.useState(!1),y=ZN(l),b=ML(n),x=B.useRef(!1),[S,C]=B.useState(0);return B.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(OL,y),()=>e.removeEventListener(OL,y)},[y]),(0,V.jsx)(IL,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:B.useCallback(e=>g(e),[g]),onItemShiftTab:B.useCallback(()=>v(!0),[]),onFocusableItemAdd:B.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:B.useCallback(()=>C(e=>e-1),[]),children:(0,V.jsx)(KN.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:yN(e.onMouseDown,()=>{x.current=!0}),onFocus:yN(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(OL,kL);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);GL([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:yN(e.onBlur,()=>v(!1))})})}),BL=`RovingFocusGroupItem`,VL=B.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=PP(),l=a||c,u=LL(BL,n),d=u.currentTabStopId===l,f=ML(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return B.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,V.jsx)(jL.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,V.jsx)(KN.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:yN(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:yN(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:yN(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=WL(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?KL(n,r+1):n.slice(r+1)}setTimeout(()=>GL(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});VL.displayName=BL;var HL={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function UL(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function WL(e,t,n){let r=UL(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return HL[r]}function GL(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function KL(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var qL=RL,JL=VL,YL=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},XL=new WeakMap,ZL=new WeakMap,QL={},$L=0,eR=function(e){return e&&(e.host||eR(e.parentNode))},tR=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=eR(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},nR=function(e,t,n,r){var i=tR(t,Array.isArray(e)?e:[e]);QL[n]||(QL[n]=new WeakMap);var a=QL[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(XL.get(e)||0)+1,l=(a.get(e)||0)+1;XL.set(e,c),a.set(e,l),o.push(e),c===1&&i&&ZL.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),$L++,function(){o.forEach(function(e){var t=XL.get(e)-1,i=a.get(e)-1;XL.set(e,t),a.set(e,i),t||(ZL.has(e)||e.removeAttribute(r),ZL.delete(e)),i||e.removeAttribute(n)}),$L--,$L||(XL=new WeakMap,XL=new WeakMap,ZL=new WeakMap,QL={})}},rR=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||YL(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),nR(r,i,n,`aria-hidden`)):function(){return null}},iR=function(){return iR=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},iR.apply(this,arguments)};function aR(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function oR(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var sR=`right-scroll-bar-position`,cR=`width-before-scroll-bar`,lR=`with-scroll-bars-hidden`,uR=`--removed-body-scroll-bar-size`;function dR(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function fR(e,t){var n=(0,B.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var pR=typeof window<`u`?B.useLayoutEffect:B.useEffect,mR=new WeakMap;function hR(e,t){var n=fR(t||null,function(t){return e.forEach(function(e){return dR(e,t)})});return pR(function(){var t=mR.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||dR(e,null)}),i.forEach(function(e){r.has(e)||dR(e,a)})}mR.set(n,e)},[e]),n}function gR(e){return e}function _R(e,t){t===void 0&&(t=gR);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function vR(e){e===void 0&&(e={});var t=_R(null);return t.options=iR({async:!0,ssr:!1},e),t}var yR=function(e){var t=e.sideCar,n=aR(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return B.createElement(r,iR({},n))};yR.isSideCarExport=!0;function bR(e,t){return e.useMedium(t),yR}var xR=vR(),SR=function(){},CR=B.forwardRef(function(e,t){var n=B.useRef(null),r=B.useState({onScrollCapture:SR,onWheelCapture:SR,onTouchMoveCapture:SR}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=aR(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=hR([n,t]),C=iR(iR({},b),i);return B.createElement(B.Fragment,null,u&&B.createElement(x,{sideCar:xR,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?B.cloneElement(B.Children.only(s),iR(iR({},C),{ref:S})):B.createElement(v,iR({},C,{className:c,ref:S}),s))});CR.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},CR.classNames={fullWidth:cR,zeroRight:sR};var wR,TR=function(){if(wR)return wR;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function ER(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=TR();return t&&e.setAttribute(`nonce`,t),e}function DR(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function OR(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var kR=function(){var e=0,t=null;return{add:function(n){e==0&&(t=ER())&&(DR(t,n),OR(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},AR=function(){var e=kR();return function(t,n){B.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},jR=function(){var e=AR();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},MR={left:0,top:0,right:0,gap:0},NR=function(e){return parseInt(e||``,10)||0},PR=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[NR(n),NR(r),NR(i)]},FR=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return MR;var t=PR(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},IR=jR(),LR=`data-scroll-locked`,RR=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
321
321
  .${lR} {
322
322
  overflow: hidden ${r};
323
323
  padding-right: ${s}px ${r};
@@ -357,16 +357,16 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
357
357
  `},zR=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},BR=function(){B.useEffect(function(){return document.body.setAttribute(LR,(zR()+1).toString()),function(){var e=zR()-1;e<=0?document.body.removeAttribute(LR):document.body.setAttribute(LR,e.toString())}},[])},VR=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;BR();var a=B.useMemo(function(){return FR(i)},[i]);return B.createElement(IR,{styles:RR(a,!t,i,n?``:`!important`)})},HR=!1;if(typeof window<`u`)try{var UR=Object.defineProperty({},"passive",{get:function(){return HR=!0,!0}});window.addEventListener(`test`,UR,UR),window.removeEventListener(`test`,UR,UR)}catch{HR=!1}var WR=HR?{passive:!1}:!1,GR=function(e){return e.tagName===`TEXTAREA`},KR=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!GR(e)&&n[t]===`visible`)},qR=function(e){return KR(e,`overflowY`)},JR=function(e){return KR(e,`overflowX`)},YR=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),QR(e,r)){var i=$R(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},XR=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},ZR=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},QR=function(e,t){return e===`v`?qR(t):JR(t)},$R=function(e,t){return e===`v`?XR(t):ZR(t)},ez=function(e,t){return e===`h`&&t===`rtl`?-1:1},tz=function(e,t,n,r,i){var a=ez(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=$R(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&QR(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},nz=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},rz=function(e){return[e.deltaX,e.deltaY]},iz=function(e){return e&&`current`in e?e.current:e},az=function(e,t){return e[0]===t[0]&&e[1]===t[1]},oz=function(e){return`
358
358
  .block-interactivity-${e} {pointer-events: none;}
359
359
  .allow-interactivity-${e} {pointer-events: all;}
360
- `},sz=0,cz=[];function lz(e){var t=B.useRef([]),n=B.useRef([0,0]),r=B.useRef(),i=B.useState(sz++)[0],a=B.useState(jR)[0],o=B.useRef(e);B.useEffect(function(){o.current=e},[e]),B.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=oR([e.lockRef.current],(e.shards||[]).map(iz),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=B.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=nz(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=YR(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=YR(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return tz(h,t,e,h===`h`?s:c,!0)},[]),c=B.useCallback(function(e){var n=e;if(!(!cz.length||cz[cz.length-1]!==a)){var r=`deltaY`in n?rz(n):nz(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&az(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(iz).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=B.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:uz(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=B.useCallback(function(e){n.current=nz(e),r.current=void 0},[]),d=B.useCallback(function(t){l(t.type,rz(t),t.target,s(t,e.lockRef.current))},[]),f=B.useCallback(function(t){l(t.type,nz(t),t.target,s(t,e.lockRef.current))},[]);B.useEffect(function(){return cz.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,WR),document.addEventListener(`touchmove`,c,WR),document.addEventListener(`touchstart`,u,WR),function(){cz=cz.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,WR),document.removeEventListener(`touchmove`,c,WR),document.removeEventListener(`touchstart`,u,WR)}},[]);var p=e.removeScrollBar,m=e.inert;return B.createElement(B.Fragment,null,m?B.createElement(a,{styles:oz(i)}):null,p?B.createElement(VR,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function uz(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var dz=bR(xR,lz),fz=B.forwardRef(function(e,t){return B.createElement(CR,iR({},e,{ref:t,sideCar:dz}))});fz.classNames=CR.classNames;var pz=[`Enter`,` `],mz=[`ArrowDown`,`PageUp`,`Home`],hz=[`ArrowUp`,`PageDown`,`End`],gz=[...mz,...hz],_z={ltr:[...pz,`ArrowRight`],rtl:[...pz,`ArrowLeft`]},vz={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},yz=`Menu`,[bz,Xee,Zee]=JN(yz),[xz,Sz]=CN(yz,[Zee,$I,FL]),Cz=$I(),wz=FL(),[Tz,Ez]=xz(yz),[Qee,Dz]=xz(yz),Oz=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Cz(t),[c,l]=B.useState(null),u=B.useRef(!1),d=ZN(a),f=XN(i);return B.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),B.useEffect(()=>{if(!n)return;let e=()=>d(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,V.jsx)(hL,{...s,children:(0,V.jsx)(Tz,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,V.jsx)(Qee,{scope:t,onClose:B.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Oz.displayName=yz;var $ee=`MenuAnchor`,kz=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Cz(n);return(0,V.jsx)(gL,{...i,...r,ref:t})});kz.displayName=$ee;var Az=`MenuPortal`,[ete,jz]=xz(Az,{forceMount:void 0}),Mz=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Ez(Az,t);return(0,V.jsx)(ete,{scope:t,forceMount:n,children:(0,V.jsx)(SL,{present:n||a.open,children:(0,V.jsx)(bL,{asChild:!0,container:i,children:r})})})};Mz.displayName=Az;var Nz=`MenuContent`,[tte,Pz]=xz(Nz),Fz=B.forwardRef((e,t)=>{let n=jz(Nz,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Ez(Nz,e.__scopeMenu),o=Dz(Nz,e.__scopeMenu);return(0,V.jsx)(bz.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(SL,{present:r||a.open,children:(0,V.jsx)(bz.Slot,{scope:e.__scopeMenu,children:o.modal?(0,V.jsx)(nte,{...i,ref:t}):(0,V.jsx)(rte,{...i,ref:t})})})})}),nte=B.forwardRef((e,t)=>{let n=Ez(Nz,e.__scopeMenu),r=B.useRef(null),i=SN(t,r);return B.useEffect(()=>{let e=r.current;if(e)return rR(e)},[]),(0,V.jsx)(Iz,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:yN(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),rte=B.forwardRef((e,t)=>{let n=Ez(Nz,e.__scopeMenu);return(0,V.jsx)(Iz,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ite=NN(`MenuContent.ScrollLock`),Iz=B.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Ez(Nz,n),_=Dz(Nz,n),v=Cz(n),y=wz(n),b=Xee(n),[x,S]=B.useState(null),C=B.useRef(null),w=SN(t,C,g.onContentChange),T=B.useRef(0),E=B.useRef(``),D=B.useRef(0),O=B.useRef(null),k=B.useRef(`right`),A=B.useRef(0),j=m?fz:B.Fragment,M=m?{as:ite,allowPinchZoom:!0}:void 0,N=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=uB(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};B.useEffect(()=>()=>window.clearTimeout(T.current),[]),mP();let P=B.useCallback(e=>k.current===O.current?.side&&fB(e,O.current?.area),[]);return(0,V.jsx)(tte,{scope:n,searchRef:E,onItemEnter:B.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:B.useCallback(e=>{P(e)||(C.current?.focus(),S(null))},[P]),onTriggerLeave:B.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:D,onPointerGraceIntentChange:B.useCallback(e=>{O.current=e},[]),children:(0,V.jsx)(j,{...M,children:(0,V.jsx)(bP,{asChild:!0,trapped:i,onMountAutoFocus:yN(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,V.jsx)(iP,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,V.jsx)(qL,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:yN(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,V.jsx)(_L,{role:`menu`,"aria-orientation":`vertical`,"data-state":aB(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:yN(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&N(e.key));let i=C.current;if(e.target!==i||!gz.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);hz.includes(e.key)&&a.reverse(),cB(a)}),onBlur:yN(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:yN(e.onPointerMove,pB(e=>{let t=e.target,n=A.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>A.current?`right`:`left`;k.current=t,A.current=e.clientX}}))})})})})})})});Fz.displayName=Nz;var ate=`MenuGroup`,Lz=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(KN.div,{role:`group`,...r,ref:t})});Lz.displayName=ate;var ote=`MenuLabel`,Rz=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(KN.div,{...r,ref:t})});Rz.displayName=ote;var zz=`MenuItem`,Bz=`menu.itemSelect`,Vz=B.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=B.useRef(null),o=Dz(zz,e.__scopeMenu),s=Pz(zz,e.__scopeMenu),c=SN(t,a),l=B.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Bz,{bubbles:!0,cancelable:!0});e.addEventListener(Bz,e=>r?.(e),{once:!0}),qN(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,V.jsx)(Hz,{...i,ref:c,disabled:n,onClick:yN(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:yN(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:yN(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||pz.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Vz.displayName=zz;var Hz=B.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Pz(zz,n),s=wz(n),c=B.useRef(null),l=SN(t,c),[u,d]=B.useState(!1),[f,p]=B.useState(``);return B.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,V.jsx)(bz.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,V.jsx)(JL,{asChild:!0,...s,focusable:!r,children:(0,V.jsx)(KN.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:yN(e.onPointerMove,pB(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:yN(e.onPointerLeave,pB(e=>o.onItemLeave(e))),onFocus:yN(e.onFocus,()=>d(!0)),onBlur:yN(e.onBlur,()=>d(!1))})})})}),ste=`MenuCheckboxItem`,Uz=B.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,V.jsx)(Yz,{scope:e.__scopeMenu,checked:n,children:(0,V.jsx)(Vz,{role:`menuitemcheckbox`,"aria-checked":oB(n)?`mixed`:n,...i,ref:t,"data-state":sB(n),onSelect:yN(i.onSelect,()=>r?.(oB(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Uz.displayName=ste;var Wz=`MenuRadioGroup`,[cte,lte]=xz(Wz,{value:void 0,onValueChange:()=>{}}),Gz=B.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=ZN(r);return(0,V.jsx)(cte,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,V.jsx)(Lz,{...i,ref:t})})});Gz.displayName=Wz;var Kz=`MenuRadioItem`,qz=B.forwardRef((e,t)=>{let{value:n,...r}=e,i=lte(Kz,e.__scopeMenu),a=n===i.value;return(0,V.jsx)(Yz,{scope:e.__scopeMenu,checked:a,children:(0,V.jsx)(Vz,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":sB(a),onSelect:yN(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});qz.displayName=Kz;var Jz=`MenuItemIndicator`,[Yz,ute]=xz(Jz,{checked:!1}),Xz=B.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=ute(Jz,n);return(0,V.jsx)(SL,{present:r||oB(a.checked)||a.checked===!0,children:(0,V.jsx)(KN.span,{...i,ref:t,"data-state":sB(a.checked)})})});Xz.displayName=Jz;var dte=`MenuSeparator`,Zz=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(KN.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Zz.displayName=dte;var fte=`MenuArrow`,Qz=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Cz(n);return(0,V.jsx)(vL,{...i,...r,ref:t})});Qz.displayName=fte;var $z=`MenuSub`,[pte,eB]=xz($z),mte=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Ez($z,t),o=Cz(t),[s,c]=B.useState(null),[l,u]=B.useState(null),d=ZN(i);return B.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,V.jsx)(hL,{...o,children:(0,V.jsx)(Tz,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,V.jsx)(pte,{scope:t,contentId:PP(),triggerId:PP(),trigger:s,onTriggerChange:c,children:n})})})};mte.displayName=$z;var tB=`MenuSubTrigger`,nB=B.forwardRef((e,t)=>{let n=Ez(tB,e.__scopeMenu),r=Dz(tB,e.__scopeMenu),i=eB(tB,e.__scopeMenu),a=Pz(tB,e.__scopeMenu),o=B.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=B.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);B.useEffect(()=>u,[u]),B.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]);let d=SN(t,i.onTriggerChange);return(0,V.jsx)(kz,{asChild:!0,...l,children:(0,V.jsx)(Hz,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":aB(n.open),...e,ref:d,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:yN(e.onPointerMove,pB(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:yN(e.onPointerLeave,pB(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:yN(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||_z[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});nB.displayName=tB;var rB=`MenuSubContent`,iB=B.forwardRef((e,t)=>{let n=jz(Nz,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=Ez(Nz,e.__scopeMenu),s=Dz(Nz,e.__scopeMenu),c=eB(rB,e.__scopeMenu),l=B.useRef(null),u=SN(t,l);return(0,V.jsx)(bz.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(SL,{present:r||o.open,children:(0,V.jsx)(bz.Slot,{scope:e.__scopeMenu,children:(0,V.jsx)(Iz,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:yN(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:yN(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:yN(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=vz[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});iB.displayName=rB;function aB(e){return e?`open`:`closed`}function oB(e){return e===`indeterminate`}function sB(e){return oB(e)?`indeterminate`:e?`checked`:`unchecked`}function cB(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function lB(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function uB(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=lB(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function dB(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function fB(e,t){return t?dB({x:e.clientX,y:e.clientY},t):!1}function pB(e){return t=>t.pointerType===`mouse`?e(t):void 0}var mB=Oz,hB=kz,gB=Mz,_B=Fz,vB=Lz,yB=Rz,bB=Vz,xB=Uz,SB=Gz,CB=qz,wB=Xz,TB=Zz,EB=Qz,DB=nB,OB=iB,kB=`DropdownMenu`,[AB,hte]=CN(kB,[Sz]),jB=Sz(),[MB,NB]=AB(kB),PB=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=jB(t),l=B.useRef(null),[u,d]=AN({prop:i,defaultProp:a??!1,onChange:o,caller:kB});return(0,V.jsx)(MB,{scope:t,triggerId:PP(),triggerRef:l,contentId:PP(),open:u,onOpenChange:d,onOpenToggle:B.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,V.jsx)(mB,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};PB.displayName=kB;var FB=`DropdownMenuTrigger`,IB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=NB(FB,n),o=jB(n),s=SN(t,a.triggerRef);return(0,V.jsx)(hB,{asChild:!0,...o,children:(0,V.jsx)(KN.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:yN(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:yN(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});IB.displayName=FB;var LB=`DropdownMenuPortal`,RB=e=>{let{__scopeDropdownMenu:t,...n}=e,r=jB(t);return(0,V.jsx)(gB,{...r,...n})};RB.displayName=LB;var zB=`DropdownMenuContent`,BB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=NB(zB,n),a=jB(n),o=B.useRef(!1);return(0,V.jsx)(_B,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:yN(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:yN(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});BB.displayName=zB;var VB=`DropdownMenuGroup`,HB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(vB,{...i,...r,ref:t})});HB.displayName=VB;var UB=`DropdownMenuLabel`,WB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(yB,{...i,...r,ref:t})});WB.displayName=UB;var GB=`DropdownMenuItem`,KB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(bB,{...i,...r,ref:t})});KB.displayName=GB;var qB=`DropdownMenuCheckboxItem`,JB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(xB,{...i,...r,ref:t})});JB.displayName=qB;var YB=`DropdownMenuRadioGroup`,XB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(SB,{...i,...r,ref:t})});XB.displayName=YB;var ZB=`DropdownMenuRadioItem`,QB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(CB,{...i,...r,ref:t})});QB.displayName=ZB;var $B=`DropdownMenuItemIndicator`,eV=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(wB,{...i,...r,ref:t})});eV.displayName=$B;var tV=`DropdownMenuSeparator`,nV=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(TB,{...i,...r,ref:t})});nV.displayName=tV;var rV=`DropdownMenuArrow`,iV=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(EB,{...i,...r,ref:t})});iV.displayName=rV;var aV=`DropdownMenuSubTrigger`,oV=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(DB,{...i,...r,ref:t})});oV.displayName=aV;var sV=`DropdownMenuSubContent`,cV=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(OB,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});cV.displayName=sV;var lV=PB,uV=IB,dV=RB,fV=BB,pV=HB,mV=WB,hV=KB,gV=XB,_V=QB,vV=eV,yV=nV,bV=`isolate bg-elevated opacity-100 border border-border shadow-2xl shadow-black/40`,xV=`z-[110]`,SV=`${xV} ${bV}`,CV=`z-[250]`,wV=`z-[250]`;function TV({modal:e=!1,...t}){return(0,V.jsx)(lV,{modal:e,...t})}var EV=uV;function DV({children:e,align:t=`end`,sideOffset:n=6}){return(0,V.jsx)(dV,{children:(0,V.jsx)(fV,{align:t,sideOffset:n,className:`${SV} min-w-[184px] overflow-hidden rounded-lg p-1`,children:e})})}function OV({children:e,onSelect:t,icon:n,danger:r}){return(0,V.jsxs)(hV,{onSelect:t,className:`flex cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-1.5 text-[12px] outline-none transition-colors data-[highlighted]:bg-panel-2 ${r?`text-red-400 data-[highlighted]:text-red-300`:`text-muted data-[highlighted]:text-fg`}`,children:[n&&(0,V.jsx)(`span`,{className:`flex w-3.5 shrink-0 items-center justify-center`,children:n}),e]})}function kV(){return(0,V.jsx)(yV,{className:`my-1 h-px bg-border`})}var AV=(0,B.memo)(function({slug:e,size:t=`md`,onDone:n,doneBusy:r,onMutateStart:i,onApplied:a,onFailed:o}){let[s,c]=(0,B.useState)(`done`),[l,u]=(0,B.useState)(!1),d=(s===`done`&&n?r:l)??!1,f=()=>{if(i?.(),s===`done`&&n)return n();u(!0),X.setThreadStatus({slug:e,status:s}).then(()=>{Q(`Status → ${s}`),a?.()}).catch(()=>o?.()).finally(()=>u(!1))},p=t===`sm`;return(0,V.jsxs)(`div`,{className:`flex items-stretch overflow-hidden rounded-md border border-border-strong`,children:[(0,V.jsxs)(`button`,{onClick:f,disabled:d,onMouseDown:e=>e.preventDefault(),className:`flex items-center bg-panel-2 font-medium text-fg transition-colors hover:bg-elevated disabled:opacity-50 ${p?`gap-1 px-1.5 text-[11px]`:`gap-1.5 px-2.5 py-1 text-[12px]`}`,children:[d&&(0,V.jsx)(cw,{size:p?11:12,className:`animate-spin`}),`Mark as `,s]}),(0,V.jsxs)(TV,{children:[(0,V.jsx)(EV,{"aria-label":`Set status…`,className:`flex items-center border-l border-border-strong bg-panel-2 text-muted outline-none transition-colors hover:bg-elevated hover:text-fg data-[state=open]:bg-elevated data-[state=open]:text-fg ${p?`px-1`:`px-1.5`}`,children:(0,V.jsx)(MC,{size:p?11:12})}),(0,V.jsx)(DV,{children:Vj.map(e=>(0,V.jsxs)(OV,{onSelect:()=>c(e),children:[`Mark as `,e]},e))})]})]})}),jV=`Dialog`,[MV,gte]=CN(jV),[NV,PV]=MV(jV),FV=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=B.useRef(null),c=B.useRef(null),[l,u]=AN({prop:r,defaultProp:i??!1,onChange:a,caller:jV});return(0,V.jsx)(NV,{scope:t,triggerRef:s,contentRef:c,contentId:PP(),titleId:PP(),descriptionId:PP(),open:l,onOpenChange:u,onOpenToggle:B.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};FV.displayName=jV;var IV=`DialogTrigger`,LV=B.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=PV(IV,n),a=SN(t,i.triggerRef);return(0,V.jsx)(KN.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":rH(i.open),...r,ref:a,onClick:yN(e.onClick,i.onOpenToggle)})});LV.displayName=IV;var RV=`DialogPortal`,[zV,BV]=MV(RV,{forceMount:void 0}),VV=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=PV(RV,t);return(0,V.jsx)(zV,{scope:t,forceMount:n,children:B.Children.map(r,e=>(0,V.jsx)(SL,{present:n||a.open,children:(0,V.jsx)(bL,{asChild:!0,container:i,children:e})}))})};VV.displayName=RV;var HV=`DialogOverlay`,UV=B.forwardRef((e,t)=>{let n=BV(HV,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=PV(HV,e.__scopeDialog);return a.modal?(0,V.jsx)(SL,{present:r||a.open,children:(0,V.jsx)(GV,{...i,ref:t})}):null});UV.displayName=HV;var WV=NN(`DialogOverlay.RemoveScroll`),GV=B.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=PV(HV,n),a=SN(t,sP());return(0,V.jsx)(fz,{as:WV,allowPinchZoom:!0,shards:[i.contentRef],children:(0,V.jsx)(KN.div,{"data-state":rH(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})}),KV=`DialogContent`,qV=B.forwardRef((e,t)=>{let n=BV(KV,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=PV(KV,e.__scopeDialog);return(0,V.jsx)(SL,{present:r||a.open,children:a.modal?(0,V.jsx)(JV,{...i,ref:t}):(0,V.jsx)(YV,{...i,ref:t})})});qV.displayName=KV;var JV=B.forwardRef((e,t)=>{let n=PV(KV,e.__scopeDialog),r=B.useRef(null),i=SN(t,n.contentRef,r);return B.useEffect(()=>{let e=r.current;if(e)return rR(e)},[]),(0,V.jsx)(XV,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:yN(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:yN(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:yN(e.onFocusOutside,e=>e.preventDefault())})}),YV=B.forwardRef((e,t)=>{let n=PV(KV,e.__scopeDialog),r=B.useRef(!1),i=B.useRef(!1);return(0,V.jsx)(XV,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),XV=B.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=PV(KV,n);return mP(),(0,V.jsx)(V.Fragment,{children:(0,V.jsx)(bP,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(iP,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":rH(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),ZV=`DialogTitle`,QV=B.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=PV(ZV,n);return(0,V.jsx)(KN.h2,{id:i.titleId,...r,ref:t})});QV.displayName=ZV;var $V=`DialogDescription`,eH=B.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=PV($V,n);return(0,V.jsx)(KN.p,{id:i.descriptionId,...r,ref:t})});eH.displayName=$V;var tH=`DialogClose`,nH=B.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=PV(tH,n);return(0,V.jsx)(KN.button,{type:`button`,...r,ref:t,onClick:yN(e.onClick,()=>i.onOpenChange(!1))})});nH.displayName=tH;function rH(e){return e?`open`:`closed`}var iH=new Set([`artifact-template`,`code-comment`,`created-thread`,`git-stage`,`git-commit`,`git-create-branch`,`git-push`,`git-create-pr`,`archive`,`archive-thread`,`automation-update`]),aH=/[a-zA-Z_][a-zA-Z0-9_-]*/y,oH=/^-?(?:0|[1-9]\d*)(?:\.\d+)?$/;function sH(e){let t={},n=0;for(;n<e.length;){for(;/\s/.test(e[n]??``);)n++;if(n>=e.length)break;aH.lastIndex=n;let r=aH.exec(e);if(!r||Object.hasOwn(t,r[0]))return null;let i=r[0];if(n=aH.lastIndex,e[n]!==`=`)return null;if(n++,e[n]===`"`){let r=n;n++;let a=!1;for(;n<e.length;){let t=e[n++];if(a)a=!1;else if(t===`\\`)a=!0;else if(t===`"`)break}if(e[n-1]!==`"`)return null;try{t[i]=JSON.parse(e.slice(r,n))}catch{return null}}else{let r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let a=e.slice(r,n);if(a===`true`||a===`false`)t[i]=a===`true`;else if(oH.test(a))t[i]=Number(a);else return null}if(n<e.length&&!/\s/.test(e[n]))return null}return t}function cH(e){let t=e.match(/^\s*::([a-z][a-z0-9-]*)\{([^\n]*)\}\s*$/);if(!t||!iH.has(t[1]))return null;let n=sH(t[2]);return n?{name:t[1],attrs:n}:null}var lH=String.raw`(?:[^\s\`]|[ ](?!/))+`,uH=new RegExp(String.raw`^\s*\`?(/${lH}\.(?:png|jpe?g|gif|webp))\`?\s*$`,`i`),dH=new RegExp(String.raw`^\s*\`?(/${lH}\.(?:${ly.join(`|`)}))\`?\s*$`,`i`),fH=/^\s{0,3}(?:```|~~~)/,pH=/^\s{0,3}(`{3,}|~{3,})\s*mermaid\s*$/i,mH=/^\s*::codex-inline-vis\{file="([a-z0-9][a-z0-9-]{0,127}\.html)"\}\s*$/;function hH(e){let t=e.split(`
360
+ `},sz=0,cz=[];function lz(e){var t=B.useRef([]),n=B.useRef([0,0]),r=B.useRef(),i=B.useState(sz++)[0],a=B.useState(jR)[0],o=B.useRef(e);B.useEffect(function(){o.current=e},[e]),B.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=oR([e.lockRef.current],(e.shards||[]).map(iz),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=B.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=nz(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=YR(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=YR(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return tz(h,t,e,h===`h`?s:c,!0)},[]),c=B.useCallback(function(e){var n=e;if(!(!cz.length||cz[cz.length-1]!==a)){var r=`deltaY`in n?rz(n):nz(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&az(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(iz).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=B.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:uz(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=B.useCallback(function(e){n.current=nz(e),r.current=void 0},[]),d=B.useCallback(function(t){l(t.type,rz(t),t.target,s(t,e.lockRef.current))},[]),f=B.useCallback(function(t){l(t.type,nz(t),t.target,s(t,e.lockRef.current))},[]);B.useEffect(function(){return cz.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,WR),document.addEventListener(`touchmove`,c,WR),document.addEventListener(`touchstart`,u,WR),function(){cz=cz.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,WR),document.removeEventListener(`touchmove`,c,WR),document.removeEventListener(`touchstart`,u,WR)}},[]);var p=e.removeScrollBar,m=e.inert;return B.createElement(B.Fragment,null,m?B.createElement(a,{styles:oz(i)}):null,p?B.createElement(VR,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function uz(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var dz=bR(xR,lz),fz=B.forwardRef(function(e,t){return B.createElement(CR,iR({},e,{ref:t,sideCar:dz}))});fz.classNames=CR.classNames;var pz=[`Enter`,` `],mz=[`ArrowDown`,`PageUp`,`Home`],hz=[`ArrowUp`,`PageDown`,`End`],gz=[...mz,...hz],_z={ltr:[...pz,`ArrowRight`],rtl:[...pz,`ArrowLeft`]},vz={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},yz=`Menu`,[bz,Xee,Zee]=JN(yz),[xz,Sz]=CN(yz,[Zee,$I,FL]),Cz=$I(),wz=FL(),[Tz,Ez]=xz(yz),[Qee,Dz]=xz(yz),Oz=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Cz(t),[c,l]=B.useState(null),u=B.useRef(!1),d=ZN(a),f=XN(i);return B.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),B.useEffect(()=>{if(!n)return;let e=()=>d(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,V.jsx)(hL,{...s,children:(0,V.jsx)(Tz,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,V.jsx)(Qee,{scope:t,onClose:B.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Oz.displayName=yz;var $ee=`MenuAnchor`,kz=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Cz(n);return(0,V.jsx)(gL,{...i,...r,ref:t})});kz.displayName=$ee;var Az=`MenuPortal`,[ete,jz]=xz(Az,{forceMount:void 0}),Mz=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Ez(Az,t);return(0,V.jsx)(ete,{scope:t,forceMount:n,children:(0,V.jsx)(SL,{present:n||a.open,children:(0,V.jsx)(bL,{asChild:!0,container:i,children:r})})})};Mz.displayName=Az;var Nz=`MenuContent`,[tte,Pz]=xz(Nz),Fz=B.forwardRef((e,t)=>{let n=jz(Nz,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Ez(Nz,e.__scopeMenu),o=Dz(Nz,e.__scopeMenu);return(0,V.jsx)(bz.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(SL,{present:r||a.open,children:(0,V.jsx)(bz.Slot,{scope:e.__scopeMenu,children:o.modal?(0,V.jsx)(nte,{...i,ref:t}):(0,V.jsx)(rte,{...i,ref:t})})})})}),nte=B.forwardRef((e,t)=>{let n=Ez(Nz,e.__scopeMenu),r=B.useRef(null),i=SN(t,r);return B.useEffect(()=>{let e=r.current;if(e)return rR(e)},[]),(0,V.jsx)(Iz,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:yN(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),rte=B.forwardRef((e,t)=>{let n=Ez(Nz,e.__scopeMenu);return(0,V.jsx)(Iz,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ite=NN(`MenuContent.ScrollLock`),Iz=B.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Ez(Nz,n),_=Dz(Nz,n),v=Cz(n),y=wz(n),b=Xee(n),[x,S]=B.useState(null),C=B.useRef(null),w=SN(t,C,g.onContentChange),T=B.useRef(0),E=B.useRef(``),D=B.useRef(0),O=B.useRef(null),k=B.useRef(`right`),A=B.useRef(0),j=m?fz:B.Fragment,M=m?{as:ite,allowPinchZoom:!0}:void 0,N=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=uB(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};B.useEffect(()=>()=>window.clearTimeout(T.current),[]),mP();let P=B.useCallback(e=>k.current===O.current?.side&&fB(e,O.current?.area),[]);return(0,V.jsx)(tte,{scope:n,searchRef:E,onItemEnter:B.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:B.useCallback(e=>{P(e)||(C.current?.focus(),S(null))},[P]),onTriggerLeave:B.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:D,onPointerGraceIntentChange:B.useCallback(e=>{O.current=e},[]),children:(0,V.jsx)(j,{...M,children:(0,V.jsx)(bP,{asChild:!0,trapped:i,onMountAutoFocus:yN(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,V.jsx)(iP,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,V.jsx)(qL,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:yN(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,V.jsx)(_L,{role:`menu`,"aria-orientation":`vertical`,"data-state":aB(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:yN(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&N(e.key));let i=C.current;if(e.target!==i||!gz.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);hz.includes(e.key)&&a.reverse(),cB(a)}),onBlur:yN(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:yN(e.onPointerMove,pB(e=>{let t=e.target,n=A.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>A.current?`right`:`left`;k.current=t,A.current=e.clientX}}))})})})})})})});Fz.displayName=Nz;var ate=`MenuGroup`,Lz=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(KN.div,{role:`group`,...r,ref:t})});Lz.displayName=ate;var ote=`MenuLabel`,Rz=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(KN.div,{...r,ref:t})});Rz.displayName=ote;var zz=`MenuItem`,Bz=`menu.itemSelect`,Vz=B.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=B.useRef(null),o=Dz(zz,e.__scopeMenu),s=Pz(zz,e.__scopeMenu),c=SN(t,a),l=B.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Bz,{bubbles:!0,cancelable:!0});e.addEventListener(Bz,e=>r?.(e),{once:!0}),qN(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,V.jsx)(Hz,{...i,ref:c,disabled:n,onClick:yN(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:yN(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:yN(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||pz.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Vz.displayName=zz;var Hz=B.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Pz(zz,n),s=wz(n),c=B.useRef(null),l=SN(t,c),[u,d]=B.useState(!1),[f,p]=B.useState(``);return B.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,V.jsx)(bz.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,V.jsx)(JL,{asChild:!0,...s,focusable:!r,children:(0,V.jsx)(KN.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:yN(e.onPointerMove,pB(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:yN(e.onPointerLeave,pB(e=>o.onItemLeave(e))),onFocus:yN(e.onFocus,()=>d(!0)),onBlur:yN(e.onBlur,()=>d(!1))})})})}),ste=`MenuCheckboxItem`,Uz=B.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,V.jsx)(Yz,{scope:e.__scopeMenu,checked:n,children:(0,V.jsx)(Vz,{role:`menuitemcheckbox`,"aria-checked":oB(n)?`mixed`:n,...i,ref:t,"data-state":sB(n),onSelect:yN(i.onSelect,()=>r?.(oB(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Uz.displayName=ste;var Wz=`MenuRadioGroup`,[cte,lte]=xz(Wz,{value:void 0,onValueChange:()=>{}}),Gz=B.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=ZN(r);return(0,V.jsx)(cte,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,V.jsx)(Lz,{...i,ref:t})})});Gz.displayName=Wz;var Kz=`MenuRadioItem`,qz=B.forwardRef((e,t)=>{let{value:n,...r}=e,i=lte(Kz,e.__scopeMenu),a=n===i.value;return(0,V.jsx)(Yz,{scope:e.__scopeMenu,checked:a,children:(0,V.jsx)(Vz,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":sB(a),onSelect:yN(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});qz.displayName=Kz;var Jz=`MenuItemIndicator`,[Yz,ute]=xz(Jz,{checked:!1}),Xz=B.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=ute(Jz,n);return(0,V.jsx)(SL,{present:r||oB(a.checked)||a.checked===!0,children:(0,V.jsx)(KN.span,{...i,ref:t,"data-state":sB(a.checked)})})});Xz.displayName=Jz;var dte=`MenuSeparator`,Zz=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(KN.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Zz.displayName=dte;var fte=`MenuArrow`,Qz=B.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Cz(n);return(0,V.jsx)(vL,{...i,...r,ref:t})});Qz.displayName=fte;var $z=`MenuSub`,[pte,eB]=xz($z),mte=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Ez($z,t),o=Cz(t),[s,c]=B.useState(null),[l,u]=B.useState(null),d=ZN(i);return B.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,V.jsx)(hL,{...o,children:(0,V.jsx)(Tz,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,V.jsx)(pte,{scope:t,contentId:PP(),triggerId:PP(),trigger:s,onTriggerChange:c,children:n})})})};mte.displayName=$z;var tB=`MenuSubTrigger`,nB=B.forwardRef((e,t)=>{let n=Ez(tB,e.__scopeMenu),r=Dz(tB,e.__scopeMenu),i=eB(tB,e.__scopeMenu),a=Pz(tB,e.__scopeMenu),o=B.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=B.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);B.useEffect(()=>u,[u]),B.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]);let d=SN(t,i.onTriggerChange);return(0,V.jsx)(kz,{asChild:!0,...l,children:(0,V.jsx)(Hz,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":aB(n.open),...e,ref:d,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:yN(e.onPointerMove,pB(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:yN(e.onPointerLeave,pB(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:yN(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||_z[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});nB.displayName=tB;var rB=`MenuSubContent`,iB=B.forwardRef((e,t)=>{let n=jz(Nz,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=Ez(Nz,e.__scopeMenu),s=Dz(Nz,e.__scopeMenu),c=eB(rB,e.__scopeMenu),l=B.useRef(null),u=SN(t,l);return(0,V.jsx)(bz.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(SL,{present:r||o.open,children:(0,V.jsx)(bz.Slot,{scope:e.__scopeMenu,children:(0,V.jsx)(Iz,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:yN(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:yN(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:yN(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=vz[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});iB.displayName=rB;function aB(e){return e?`open`:`closed`}function oB(e){return e===`indeterminate`}function sB(e){return oB(e)?`indeterminate`:e?`checked`:`unchecked`}function cB(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function lB(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function uB(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=lB(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function dB(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function fB(e,t){return t?dB({x:e.clientX,y:e.clientY},t):!1}function pB(e){return t=>t.pointerType===`mouse`?e(t):void 0}var mB=Oz,hB=kz,gB=Mz,_B=Fz,vB=Lz,yB=Rz,bB=Vz,xB=Uz,SB=Gz,CB=qz,wB=Xz,TB=Zz,EB=Qz,DB=nB,OB=iB,kB=`DropdownMenu`,[AB,hte]=CN(kB,[Sz]),jB=Sz(),[MB,NB]=AB(kB),PB=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=jB(t),l=B.useRef(null),[u,d]=AN({prop:i,defaultProp:a??!1,onChange:o,caller:kB});return(0,V.jsx)(MB,{scope:t,triggerId:PP(),triggerRef:l,contentId:PP(),open:u,onOpenChange:d,onOpenToggle:B.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,V.jsx)(mB,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};PB.displayName=kB;var FB=`DropdownMenuTrigger`,IB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=NB(FB,n),o=jB(n),s=SN(t,a.triggerRef);return(0,V.jsx)(hB,{asChild:!0,...o,children:(0,V.jsx)(KN.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:yN(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:yN(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});IB.displayName=FB;var LB=`DropdownMenuPortal`,RB=e=>{let{__scopeDropdownMenu:t,...n}=e,r=jB(t);return(0,V.jsx)(gB,{...r,...n})};RB.displayName=LB;var zB=`DropdownMenuContent`,BB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=NB(zB,n),a=jB(n),o=B.useRef(!1);return(0,V.jsx)(_B,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:yN(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:yN(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});BB.displayName=zB;var VB=`DropdownMenuGroup`,HB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(vB,{...i,...r,ref:t})});HB.displayName=VB;var UB=`DropdownMenuLabel`,WB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(yB,{...i,...r,ref:t})});WB.displayName=UB;var GB=`DropdownMenuItem`,KB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(bB,{...i,...r,ref:t})});KB.displayName=GB;var qB=`DropdownMenuCheckboxItem`,JB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(xB,{...i,...r,ref:t})});JB.displayName=qB;var YB=`DropdownMenuRadioGroup`,XB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(SB,{...i,...r,ref:t})});XB.displayName=YB;var ZB=`DropdownMenuRadioItem`,QB=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(CB,{...i,...r,ref:t})});QB.displayName=ZB;var $B=`DropdownMenuItemIndicator`,eV=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(wB,{...i,...r,ref:t})});eV.displayName=$B;var tV=`DropdownMenuSeparator`,nV=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(TB,{...i,...r,ref:t})});nV.displayName=tV;var rV=`DropdownMenuArrow`,iV=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(EB,{...i,...r,ref:t})});iV.displayName=rV;var aV=`DropdownMenuSubTrigger`,oV=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(DB,{...i,...r,ref:t})});oV.displayName=aV;var sV=`DropdownMenuSubContent`,cV=B.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jB(n);return(0,V.jsx)(OB,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});cV.displayName=sV;var lV=PB,uV=IB,dV=RB,fV=BB,pV=HB,mV=WB,hV=KB,gV=XB,_V=QB,vV=eV,yV=nV,bV=`isolate bg-elevated opacity-100 border border-border shadow-2xl shadow-black/40`,xV=`z-[110]`,SV=`${xV} ${bV}`,CV=`z-[250]`,wV=`z-[250]`;function TV({modal:e=!1,...t}){return(0,V.jsx)(lV,{modal:e,...t})}var EV=uV;function DV({children:e,align:t=`end`,sideOffset:n=6}){return(0,V.jsx)(dV,{children:(0,V.jsx)(fV,{align:t,sideOffset:n,className:`${SV} min-w-[184px] overflow-hidden rounded-lg p-1`,children:e})})}function OV({children:e,onSelect:t,icon:n,danger:r}){return(0,V.jsxs)(hV,{onSelect:t,className:`flex cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-1.5 text-[12px] outline-none transition-colors data-[highlighted]:bg-panel-2 ${r?`text-red-400 data-[highlighted]:text-red-300`:`text-muted data-[highlighted]:text-fg`}`,children:[n&&(0,V.jsx)(`span`,{className:`flex w-3.5 shrink-0 items-center justify-center`,children:n}),e]})}function kV(){return(0,V.jsx)(yV,{className:`my-1 h-px bg-border`})}var AV=(0,B.memo)(function({slug:e,size:t=`md`,onDone:n,doneBusy:r,onMutateStart:i,onApplied:a,onFailed:o}){let[s,c]=(0,B.useState)(`done`),[l,u]=(0,B.useState)(!1),d=(s===`done`&&n?r:l)??!1,f=()=>{if(i?.(),s===`done`&&n)return n();u(!0),X.setThreadStatus({slug:e,status:s}).then(()=>{Q(`Status → ${s}`),a?.()}).catch(()=>o?.()).finally(()=>u(!1))},p=t===`sm`;return(0,V.jsxs)(`div`,{className:`flex items-stretch overflow-hidden rounded-md border border-border-strong`,children:[(0,V.jsxs)(`button`,{onClick:f,disabled:d,onMouseDown:e=>e.preventDefault(),className:`flex items-center bg-panel-2 font-medium text-fg transition-colors hover:bg-elevated disabled:opacity-50 ${p?`gap-1 px-1.5 text-[11px]`:`gap-1.5 px-2.5 py-1 text-[12px]`}`,children:[d&&(0,V.jsx)(cw,{size:p?11:12,className:`animate-spin`}),`Mark as `,s]}),(0,V.jsxs)(TV,{children:[(0,V.jsx)(EV,{"aria-label":`Set status…`,className:`flex items-center border-l border-border-strong bg-panel-2 text-muted outline-none transition-colors hover:bg-elevated hover:text-fg data-[state=open]:bg-elevated data-[state=open]:text-fg ${p?`px-1`:`px-1.5`}`,children:(0,V.jsx)(MC,{size:p?11:12})}),(0,V.jsx)(DV,{children:Vj.map(e=>(0,V.jsxs)(OV,{onSelect:()=>c(e),children:[`Mark as `,e]},e))})]})]})}),jV=`Dialog`,[MV,gte]=CN(jV),[NV,PV]=MV(jV),FV=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=B.useRef(null),c=B.useRef(null),[l,u]=AN({prop:r,defaultProp:i??!1,onChange:a,caller:jV});return(0,V.jsx)(NV,{scope:t,triggerRef:s,contentRef:c,contentId:PP(),titleId:PP(),descriptionId:PP(),open:l,onOpenChange:u,onOpenToggle:B.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};FV.displayName=jV;var IV=`DialogTrigger`,LV=B.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=PV(IV,n),a=SN(t,i.triggerRef);return(0,V.jsx)(KN.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":rH(i.open),...r,ref:a,onClick:yN(e.onClick,i.onOpenToggle)})});LV.displayName=IV;var RV=`DialogPortal`,[zV,BV]=MV(RV,{forceMount:void 0}),VV=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=PV(RV,t);return(0,V.jsx)(zV,{scope:t,forceMount:n,children:B.Children.map(r,e=>(0,V.jsx)(SL,{present:n||a.open,children:(0,V.jsx)(bL,{asChild:!0,container:i,children:e})}))})};VV.displayName=RV;var HV=`DialogOverlay`,UV=B.forwardRef((e,t)=>{let n=BV(HV,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=PV(HV,e.__scopeDialog);return a.modal?(0,V.jsx)(SL,{present:r||a.open,children:(0,V.jsx)(GV,{...i,ref:t})}):null});UV.displayName=HV;var WV=NN(`DialogOverlay.RemoveScroll`),GV=B.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=PV(HV,n),a=SN(t,sP());return(0,V.jsx)(fz,{as:WV,allowPinchZoom:!0,shards:[i.contentRef],children:(0,V.jsx)(KN.div,{"data-state":rH(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})}),KV=`DialogContent`,qV=B.forwardRef((e,t)=>{let n=BV(KV,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=PV(KV,e.__scopeDialog);return(0,V.jsx)(SL,{present:r||a.open,children:a.modal?(0,V.jsx)(JV,{...i,ref:t}):(0,V.jsx)(YV,{...i,ref:t})})});qV.displayName=KV;var JV=B.forwardRef((e,t)=>{let n=PV(KV,e.__scopeDialog),r=B.useRef(null),i=SN(t,n.contentRef,r);return B.useEffect(()=>{let e=r.current;if(e)return rR(e)},[]),(0,V.jsx)(XV,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:yN(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:yN(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:yN(e.onFocusOutside,e=>e.preventDefault())})}),YV=B.forwardRef((e,t)=>{let n=PV(KV,e.__scopeDialog),r=B.useRef(!1),i=B.useRef(!1);return(0,V.jsx)(XV,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),XV=B.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=PV(KV,n);return mP(),(0,V.jsx)(V.Fragment,{children:(0,V.jsx)(bP,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(iP,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":rH(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),ZV=`DialogTitle`,QV=B.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=PV(ZV,n);return(0,V.jsx)(KN.h2,{id:i.titleId,...r,ref:t})});QV.displayName=ZV;var $V=`DialogDescription`,eH=B.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=PV($V,n);return(0,V.jsx)(KN.p,{id:i.descriptionId,...r,ref:t})});eH.displayName=$V;var tH=`DialogClose`,nH=B.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=PV(tH,n);return(0,V.jsx)(KN.button,{type:`button`,...r,ref:t,onClick:yN(e.onClick,()=>i.onOpenChange(!1))})});nH.displayName=tH;function rH(e){return e?`open`:`closed`}var iH=new Set([`artifact-template`,`code-comment`,`created-thread`,`git-stage`,`git-commit`,`git-create-branch`,`git-push`,`git-create-pr`,`archive`,`archive-thread`,`automation-update`]),aH=/[a-zA-Z_][a-zA-Z0-9_-]*/y,oH=/^-?(?:0|[1-9]\d*)(?:\.\d+)?$/;function sH(e){let t={},n=0;for(;n<e.length;){for(;/\s/.test(e[n]??``);)n++;if(n>=e.length)break;aH.lastIndex=n;let r=aH.exec(e);if(!r||Object.hasOwn(t,r[0]))return null;let i=r[0];if(n=aH.lastIndex,e[n]!==`=`)return null;if(n++,e[n]===`"`){let r=n;n++;let a=!1;for(;n<e.length;){let t=e[n++];if(a)a=!1;else if(t===`\\`)a=!0;else if(t===`"`)break}if(e[n-1]!==`"`)return null;try{t[i]=JSON.parse(e.slice(r,n))}catch{return null}}else{let r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let a=e.slice(r,n);if(a===`true`||a===`false`)t[i]=a===`true`;else if(oH.test(a))t[i]=Number(a);else return null}if(n<e.length&&!/\s/.test(e[n]))return null}return t}function cH(e){let t=e.match(/^\s*::([a-z][a-z0-9-]*)\{([^\n]*)\}\s*$/);if(!t||!iH.has(t[1]))return null;let n=sH(t[2]);return n?{name:t[1],attrs:n}:null}var lH=String.raw`(?:[^\s\`]|[ ](?!/))+`,uH=new RegExp(String.raw`^\s*\`?(/${lH}\.(?:png|jpe?g|gif|webp))\`?\s*$`,`i`),dH=new RegExp(String.raw`^\s*\`?(/${lH}\.(?:${cy.join(`|`)}))\`?\s*$`,`i`),fH=/^\s{0,3}(?:```|~~~)/,pH=/^\s{0,3}(`{3,}|~{3,})\s*mermaid\s*$/i,mH=/^\s*::codex-inline-vis\{file="([a-z0-9][a-z0-9-]{0,127}\.html)"\}\s*$/;function hH(e){let t=e.split(`
361
361
  `),n=[],r=[],i=!1,a=()=>{if(r.length){let e=r.join(`
362
362
  `);e.trim()&&n.push({kind:`md`,text:e}),r=[]}};for(let e=0;e<t.length;e++){let o=t[e];if(!i){let r=o.match(pH)?.[1];if(r){let i=RegExp(`^\\s{0,3}${r[0]==="`"?"`":`~`}{${r.length},}\\s*$`),o=e+1;for(;o<t.length&&!i.test(t[o]);)o++;if(o<t.length){a(),n.push({kind:`mermaid`,source:t.slice(e+1,o).join(`
363
363
  `)}),e=o;continue}}}if(fH.test(o)){i=!i,r.push(o);continue}if(i){r.push(o);continue}let s=o.match(mH);if(s){a(),n.push({kind:`visualization`,file:s[1]});continue}let c=cH(o);if(c){a(),n.push({kind:`directive`,directive:c});continue}let l=o.match(uH);if(l){a(),n.push({kind:`image`,path:l[1]});continue}let u=o.match(dH);if(u){a(),n.push({kind:`file`,path:u[1]});continue}r.push(o)}return a(),n}function gH(e){let t=e.split(`
364
364
  `),n=Array(t.length),r=!1;for(let e=0;e<t.length;e++)fH.test(t[e])?(r=!r,n[e]=!0):n[e]=r;let i=[],a=t.length;for(;a>0&&!n[a-1];){let e=t[a-1],n=e.match(uH),r=n?null:e.match(dH);if(n)i.unshift({path:n[1],kind:`image`});else if(r)i.unshift({path:r[1],kind:`file`});else break;a--}return{prose:t.slice(0,a).join(`
365
365
  `),attachments:i}}function _H(e,t){return t.length?`${e}${e?`
366
366
  `:``}${t.join(`
367
- `)}`:e}function vH(e,t){return t&&e.key===`Enter`&&!e.isComposing&&e.keyCode!==229&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey}function yH(e){return e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.isComposing&&e.keyCode!==229}function bH(e,t){return t&&e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.isComposing&&e.keyCode!==229&&!e.altKey&&!e.shiftKey}function xH(e){return e.key===`Enter`&&e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.isComposing}function SH(e,t,n){return e===`queueComposer`&&t===`Enter`&&n}var CH=`gap-3`,wH=`-mx-1`,TH=`-mx-[3px]`,EH=`-mx-2`,DH=`-mx-[7px]`,OH=`right-2`,kH=`right-[71px]`,AH=`right-[44px]`,jH=`pr-[6.6875rem]`,MH=`pr-20`,NH=/^[a-zA-Z]:[\\/]/,PH=/^(?:cursor|vscode|vscode-insiders|windsurf):\/\/file\/(.*)$/i;function FH(e){try{return decodeURIComponent(e)}catch{return e}}function IH(e){if(e===`/`||e.startsWith(`/?`)||e.startsWith(`/#`))return!0;let t=e.replace(/[?#].*$/u,``);if(bx(t))return!0;let n=Cx(t).split(`/`)[1]??``;return _x.has(n)}function LH(e){let t=e?.trim();if(!t)return null;let n=FH(t);if(NH.test(n))return{display:n};if(n.startsWith(`/`)&&!n.startsWith(`//`)&&!IH(n)){let e=n;return{display:e,posixPath:e}}let r=PH.exec(t);if(r){let e=FH(r[1].replace(/[?#].*$/u,``)).replace(/^\/+/,``);if(!e)return null;if(NH.test(e))return{display:e};let t=`/${e}`;return{display:t,posixPath:t}}if(!/^file:/i.test(t))return null;try{let e=new URL(t);if(e.protocol!==`file:`)return null;if(e.hostname&&e.hostname!==`localhost`)return{display:t};let n=FH(e.pathname);return{display:n,posixPath:n}}catch{return{display:t}}}function RH(e){return`${Tx()}/local-image?path=${encodeURIComponent(e)}`}var zH=/\.(?:png|jpe?g|gif|webp)$/i;function BH(e){return e.posixPath&&zH.test(e.posixPath)?RH(e.posixPath):null}var VH=/\.(?:md|markdown)$/i;function HH(e){return VH.test(e.trim().replace(/:\d+(?::\d+)?$/,``))}function UH(e,t,n){let r=e?.trim();if(!r||/^[a-z][a-z0-9+.-]*:/i.test(r)||r.startsWith(`/`)||r.startsWith(`#`)||r.startsWith(`?`))return null;let i=FH(r.replace(/[?#].*$/u,``));if(!i)return null;let a=i===`~`||i.startsWith(`~/`);if(a&&!n?.startsWith(`/`))return null;let o=a?n:t;if(!o.startsWith(`/`))return null;let s=`${o}/${a?i.slice(1):i}`.split(`/`),c=[];for(let e of s)!e||e===`.`||(e===`..`?c.pop():c.push(e));return`/${c.join(`/`)}`}function WH(e){let t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):`/`}async function GH(e,t){let n=Tx(),r=await e.arrayBuffer(),i=``,a=new Uint8Array(r);for(let e=0;e<a.length;e+=32768)i+=String.fromCharCode(...a.subarray(e,e+32768));let o=await fetch(`${n}/attach`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t,data:btoa(i)})});return o.ok?(await o.json()).path??null:null}function KH({value:e,onChange:t,onSubmit:n,surface:r,placeholder:i,id:a,minHeight:o=44,maxHeight:s=220,autoFocus:c,busy:l,footer:u,leftAction:d,slashSuggest:f,onInterruptSubmit:p}){let m=(0,B.useRef)(null),h=(0,B.useRef)(null),[g,_]=(0,B.useState)(!1),[v,y]=(0,B.useState)(!1),{prose:b,attachments:x}=(0,B.useMemo)(()=>gH(e),[e]),S=x.map(e=>e.path),C=(0,B.useRef)(e);C.current=e;let w=e=>t(_H(e,S)),T=e=>t(_H(b,e));async function E(e){if(!e)return;if(v){Q(`An upload is already in progress — try again in a moment`);return}let n=[...e].map(e=>{let t=e.type.startsWith(`image/`)?e.type.slice(6).toLowerCase():``,n=t===`jpeg`?`jpg`:t===`svg+xml`?`svg`:t;return{file:e,name:e.name||(n?`pasted.${n}`:``)}}).filter(({name:e})=>my(e)?!0:(Q(`${e||`File`}: unsupported file type`),!1));if(!n.length)return;let r=n.filter(({file:e,name:t})=>e.size>dy?(Q(`${t} is too large (max ${Math.floor(dy/1e6)} MB)`),!1):!0);if(!r.length)return;let i=C.current;y(!0);let a=[];try{for(let{file:e,name:t}of r){let n=await GH(e,t);n?a.push(n):Q(`Could not attach ${t}`)}}finally{y(!1)}if(a.length&&i!==``&&C.current===``){Q(`Attachment discarded — the message was sent before the upload finished`),requestAnimationFrame(()=>m.current?.focus());return}if(a.length){let e=gH(C.current);t(_H(e.prose,[...e.attachments.map(e=>e.path),...a]))}requestAnimationFrame(()=>m.current?.focus())}(0,B.useLayoutEffect)(()=>{let e=!0,t=()=>{let t=m.current;!t||!e||(t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,s)}px`)};t();let n=requestAnimationFrame(t);document.fonts?.ready.then(t);let r=m.current,i=r?.clientWidth??0,a,o=r?new ResizeObserver(([e])=>{let n=Math.round(e.contentRect.width);n!==i&&(i=n,a!==void 0&&cancelAnimationFrame(a),a=requestAnimationFrame(t))}):void 0;return r&&o?.observe(r),()=>{e=!1,cancelAnimationFrame(n),a!==void 0&&cancelAnimationFrame(a),o?.disconnect()}},[e,s,!!u]);let D=(0,B.useRef)(!1);(0,B.useEffect)(()=>{let e=m.current;if(!e)return;let t=()=>{D.current=e.disabled};return e.addEventListener(`focusout`,t),()=>e.removeEventListener(`focusout`,t)},[]),(0,B.useEffect)(()=>{if(l||!D.current)return;D.current=!1;let e=m.current,t=document.activeElement;e&&(!t||t.contains(e))&&e.focus({preventScroll:!0})},[l]);let[O,k]=(0,B.useState)(null),[A,j]=(0,B.useState)(0),[M,N]=(0,B.useState)(null),P=!!f&&/^\/\S*$/.test(b);(0,B.useEffect)(()=>{if(!P||O!==null)return;let e=!0;return f().then(t=>{e&&k(t)},()=>{e&&k([])}),()=>{e=!1}},[P,O,f]);let ee=(0,B.useMemo)(()=>{if(!P||!O||M===b)return[];let e=b.slice(1).toLowerCase(),t=O.filter(t=>t.name.toLowerCase().startsWith(e)),n=O.filter(t=>!t.name.toLowerCase().startsWith(e)&&t.name.toLowerCase().includes(e));return[...t,...n]},[P,O,M,b]),F=ee.length>0;(0,B.useEffect)(()=>{j(0)},[b]);let te=(0,B.useRef)(null);(0,B.useEffect)(()=>{te.current?.querySelector(`[data-suggest-index="${A}"]`)?.scrollIntoView({block:`nearest`})},[A]);function ne(e){let t=`/${e.name} `;w(t),requestAnimationFrame(()=>m.current?.setSelectionRange(t.length,t.length))}let re=e.trim().length>0,ie=d??null;function ae(e){let t=e.currentTarget,i={key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing,keyCode:e.keyCode};if(F&&!e.nativeEvent.isComposing){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),j(t=>(t+(e.key===`ArrowDown`?1:-1)+ee.length)%ee.length);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),ne(ee[A]??ee[0]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),N(b);return}}if(SH(r,e.key,e.altKey)){e.preventDefault(),e.stopPropagation();let n=t.selectionStart??t.value.length,r=t.selectionEnd??n;w(t.value.slice(0,n)+`
367
+ `)}`:e}function vH(e,t){return t&&e.key===`Enter`&&!e.isComposing&&e.keyCode!==229&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey}function yH(e){return e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.isComposing&&e.keyCode!==229}function bH(e,t){return t&&e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.isComposing&&e.keyCode!==229&&!e.altKey&&!e.shiftKey}function xH(e){return e.key===`Enter`&&e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.isComposing}function SH(e,t,n){return e===`queueComposer`&&t===`Enter`&&n}var CH=`gap-3`,wH=`-mx-1`,TH=`-mx-[3px]`,EH=`-mx-2`,DH=`-mx-[7px]`,OH=`right-2`,kH=`right-[71px]`,AH=`right-[44px]`,jH=`pr-[6.6875rem]`,MH=`pr-20`,NH=/^[a-zA-Z]:[\\/]/,PH=/^(?:cursor|vscode|vscode-insiders|windsurf):\/\/file\/(.*)$/i;function FH(e){try{return decodeURIComponent(e)}catch{return e}}function IH(e){if(e===`/`||e.startsWith(`/?`)||e.startsWith(`/#`))return!0;let t=e.replace(/[?#].*$/u,``);if(bx(t))return!0;let n=Cx(t).split(`/`)[1]??``;return _x.has(n)}function LH(e){let t=e?.trim();if(!t)return null;let n=FH(t);if(NH.test(n))return{display:n};if(n.startsWith(`/`)&&!n.startsWith(`//`)&&!IH(n)){let e=n;return{display:e,posixPath:e}}let r=PH.exec(t);if(r){let e=FH(r[1].replace(/[?#].*$/u,``)).replace(/^\/+/,``);if(!e)return null;if(NH.test(e))return{display:e};let t=`/${e}`;return{display:t,posixPath:t}}if(!/^file:/i.test(t))return null;try{let e=new URL(t);if(e.protocol!==`file:`)return null;if(e.hostname&&e.hostname!==`localhost`)return{display:t};let n=FH(e.pathname);return{display:n,posixPath:n}}catch{return{display:t}}}function RH(e){return`${Tx()}/local-image?path=${encodeURIComponent(e)}`}var zH=/\.(?:png|jpe?g|gif|webp)$/i;function BH(e){return e.posixPath&&zH.test(e.posixPath)?RH(e.posixPath):null}var VH=/\.(?:md|mdx|markdown)$/i;function HH(e){return VH.test(e.trim().replace(/:\d+(?::\d+)?$/,``))}function UH(e,t,n){let r=e?.trim();if(!r||/^[a-z][a-z0-9+.-]*:/i.test(r)||r.startsWith(`/`)||r.startsWith(`#`)||r.startsWith(`?`))return null;let i=FH(r.replace(/[?#].*$/u,``));if(!i)return null;let a=i===`~`||i.startsWith(`~/`);if(a&&!n?.startsWith(`/`))return null;let o=a?n:t;if(!o.startsWith(`/`))return null;let s=`${o}/${a?i.slice(1):i}`.split(`/`),c=[];for(let e of s)!e||e===`.`||(e===`..`?c.pop():c.push(e));return`/${c.join(`/`)}`}function WH(e){let t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):`/`}async function GH(e,t){let n=Tx(),r=await e.arrayBuffer(),i=``,a=new Uint8Array(r);for(let e=0;e<a.length;e+=32768)i+=String.fromCharCode(...a.subarray(e,e+32768));let o=await fetch(`${n}/attach`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t,data:btoa(i)})});return o.ok?(await o.json()).path??null:null}function KH({value:e,onChange:t,onSubmit:n,surface:r,placeholder:i,id:a,minHeight:o=44,maxHeight:s=220,autoFocus:c,busy:l,footer:u,leftAction:d,slashSuggest:f,onInterruptSubmit:p}){let m=(0,B.useRef)(null),h=(0,B.useRef)(null),[g,_]=(0,B.useState)(!1),[v,y]=(0,B.useState)(!1),{prose:b,attachments:x}=(0,B.useMemo)(()=>gH(e),[e]),S=x.map(e=>e.path),C=(0,B.useRef)(e);C.current=e;let w=e=>t(_H(e,S)),T=e=>t(_H(b,e));async function E(e){if(!e)return;if(v){Q(`An upload is already in progress — try again in a moment`);return}let n=[...e].map(e=>{let t=e.type.startsWith(`image/`)?e.type.slice(6).toLowerCase():``,n=t===`jpeg`?`jpg`:t===`svg+xml`?`svg`:t;return{file:e,name:e.name||(n?`pasted.${n}`:``)}}).filter(({name:e})=>py(e)?!0:(Q(`${e||`File`}: unsupported file type`),!1));if(!n.length)return;let r=n.filter(({file:e,name:t})=>e.size>uy?(Q(`${t} is too large (max ${Math.floor(uy/1e6)} MB)`),!1):!0);if(!r.length)return;let i=C.current;y(!0);let a=[];try{for(let{file:e,name:t}of r){let n=await GH(e,t);n?a.push(n):Q(`Could not attach ${t}`)}}finally{y(!1)}if(a.length&&i!==``&&C.current===``){Q(`Attachment discarded — the message was sent before the upload finished`),requestAnimationFrame(()=>m.current?.focus());return}if(a.length){let e=gH(C.current);t(_H(e.prose,[...e.attachments.map(e=>e.path),...a]))}requestAnimationFrame(()=>m.current?.focus())}(0,B.useLayoutEffect)(()=>{let e=!0,t=()=>{let t=m.current;!t||!e||(t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,s)}px`)};t();let n=requestAnimationFrame(t);document.fonts?.ready.then(t);let r=m.current,i=r?.clientWidth??0,a,o=r?new ResizeObserver(([e])=>{let n=Math.round(e.contentRect.width);n!==i&&(i=n,a!==void 0&&cancelAnimationFrame(a),a=requestAnimationFrame(t))}):void 0;return r&&o?.observe(r),()=>{e=!1,cancelAnimationFrame(n),a!==void 0&&cancelAnimationFrame(a),o?.disconnect()}},[e,s,!!u]);let D=(0,B.useRef)(!1);(0,B.useEffect)(()=>{let e=m.current;if(!e)return;let t=()=>{D.current=e.disabled};return e.addEventListener(`focusout`,t),()=>e.removeEventListener(`focusout`,t)},[]),(0,B.useEffect)(()=>{if(l||!D.current)return;D.current=!1;let e=m.current,t=document.activeElement;e&&(!t||t.contains(e))&&e.focus({preventScroll:!0})},[l]);let[O,k]=(0,B.useState)(null),[A,j]=(0,B.useState)(0),[M,N]=(0,B.useState)(null),P=!!f&&/^\/\S*$/.test(b);(0,B.useEffect)(()=>{if(!P||O!==null)return;let e=!0;return f().then(t=>{e&&k(t)},()=>{e&&k([])}),()=>{e=!1}},[P,O,f]);let ee=(0,B.useMemo)(()=>{if(!P||!O||M===b)return[];let e=b.slice(1).toLowerCase(),t=O.filter(t=>t.name.toLowerCase().startsWith(e)),n=O.filter(t=>!t.name.toLowerCase().startsWith(e)&&t.name.toLowerCase().includes(e));return[...t,...n]},[P,O,M,b]),F=ee.length>0;(0,B.useEffect)(()=>{j(0)},[b]);let te=(0,B.useRef)(null);(0,B.useEffect)(()=>{te.current?.querySelector(`[data-suggest-index="${A}"]`)?.scrollIntoView({block:`nearest`})},[A]);function ne(e){let t=`/${e.name} `;w(t),requestAnimationFrame(()=>m.current?.setSelectionRange(t.length,t.length))}let re=e.trim().length>0,ie=d??null;function ae(e){let t=e.currentTarget,i={key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing,keyCode:e.keyCode};if(F&&!e.nativeEvent.isComposing){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),j(t=>(t+(e.key===`ArrowDown`?1:-1)+ee.length)%ee.length);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),ne(ee[A]??ee[0]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),N(b);return}}if(SH(r,e.key,e.altKey)){e.preventDefault(),e.stopPropagation();let n=t.selectionStart??t.value.length,r=t.selectionEnd??n;w(t.value.slice(0,n)+`
368
368
  `+t.value.slice(r)),requestAnimationFrame(()=>t.setSelectionRange(n+1,n+1));return}if(vH(i,re&&!l&&!v)){e.preventDefault(),e.stopPropagation(),n();return}if(bH(i,!!p&&re&&!l&&!v)){e.preventDefault(),e.stopPropagation(),p();return}if(xH(i)){let e=t.value,n=t.selectionStart??e.length,r=t.selectionEnd??n;requestAnimationFrame(()=>{t.value===e&&(w(e.slice(0,n)+`
369
- `+e.slice(r)),requestAnimationFrame(()=>t.setSelectionRange(n+1,n+1)))})}e.key===`Escape`&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.stopPropagation(),t.blur())}return(0,V.jsxs)(`div`,{className:`group relative rounded-xl border bg-bg transition-colors focus-within:border-accent ${g?`border-dashed border-accent`:`border-border`}`,onDragOver:e=>{[...e.dataTransfer.items].some(e=>e.kind===`file`)&&(e.preventDefault(),_(!0))},onDragLeave:()=>_(!1),onDrop:e=>{e.preventDefault(),_(!1),E(e.dataTransfer.files)},children:[g&&(0,V.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-xl bg-bg/80 text-[12px] text-muted`,children:`Drop file to attach`}),F&&(0,V.jsx)(`div`,{ref:te,"data-slash-menu":!0,className:`absolute bottom-full left-0 right-0 z-20 mb-1.5 max-h-56 overflow-y-auto rounded-lg border border-border bg-bg py-1 shadow-lg`,children:ee.map((e,t)=>(0,V.jsxs)(`button`,{type:`button`,"data-suggest-index":t,onMouseDown:e=>e.preventDefault(),onClick:()=>ne(e),onMouseEnter:()=>j(t),className:`flex w-full items-baseline gap-2 px-3.5 py-1.5 text-left ${t===A?`bg-panel-2`:``}`,children:[(0,V.jsxs)(`span`,{className:`shrink-0 text-[12px] font-medium text-fg`,children:[`/`,e.name]}),e.description&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-muted`,children:e.description})]},e.name))}),(0,V.jsx)(`textarea`,{id:a,ref:m,"data-surface":r,value:b,autoFocus:c,disabled:l,onChange:e=>w(e.target.value),onKeyDown:ae,onPaste:e=>{let t=[...e.clipboardData.items].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(Boolean);t.length&&(e.preventDefault(),E(t))},placeholder:i,rows:1,spellCheck:!1,style:{minHeight:o,maxHeight:s},className:`block w-full resize-none bg-transparent px-3.5 ${u?`py-2.5 pb-3`:`py-2.5 ${ie?jH:MH}`} text-[13px] leading-relaxed text-fg outline-none placeholder:text-muted scrollbar-none disabled:opacity-60`}),x.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5 px-3 pb-2 ${ie?`pr-[6.6875rem]`:`pr-20`}`,children:x.map((e,t)=>(0,V.jsx)(qH,{attachment:e,disabled:l,onRemove:()=>T(S.filter((e,n)=>n!==t))},`${e.path}-${t}`))}),u&&(0,V.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1 pl-1.5 pb-1.5 ${ie?`pr-[6.6875rem]`:`pr-20`}`,children:u}),ie&&(0,V.jsx)(`div`,{className:`absolute bottom-2 right-[43px] flex items-center`,children:ie}),(0,V.jsx)(`input`,{ref:h,type:`file`,multiple:!0,accept:hy,className:`hidden`,onChange:e=>{E(e.target.files),e.target.value=``}}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>h.current?.click(),disabled:l||v,title:`Attach files`,"aria-label":`Attach files`,className:`absolute bottom-2 ${ie?kH:AH} flex h-7 w-7 items-center justify-center rounded-lg text-muted transition-[color,background-color] enabled:hover:bg-panel-2/70 enabled:hover:text-fg disabled:opacity-50`,children:v?(0,V.jsx)(cw,{size:15,strokeWidth:2,className:`animate-spin`}):(0,V.jsx)(pw,{size:15,strokeWidth:2})}),(0,V.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:n,disabled:!re||l||v,title:`Send (Enter)`,"aria-label":`Send`,className:`absolute bottom-2 ${OH} flex h-7 w-7 items-center justify-center rounded-lg transition-all ${re&&!l&&!v?`bg-fg text-bg hover:opacity-90 active:scale-95`:`bg-panel-2 text-muted`}`,children:l?(0,V.jsx)(cw,{size:14,strokeWidth:2.5,className:`animate-spin`}):(0,V.jsx)(DC,{size:14,strokeWidth:2.5})})]})}function qH({attachment:e,disabled:t,onRemove:n}){let[r,i]=(0,B.useState)(!1),a=e.path.split(`/`).filter(Boolean).pop()||e.path,o=(a.includes(`.`)?a.split(`.`).pop():``).toUpperCase();return(0,V.jsxs)(`div`,{className:`group/att relative h-11 w-11`,title:a,children:[e.kind===`image`&&!r?(0,V.jsx)(`img`,{src:RH(e.path),alt:a,onError:()=>i(!0),className:`h-11 w-11 rounded-md border border-border object-cover`}):(0,V.jsxs)(`div`,{className:`flex h-11 w-11 flex-col items-center justify-center gap-0.5 rounded-md border border-border bg-panel-2 px-1`,children:[(0,V.jsx)(qC,{size:15,strokeWidth:2,className:`shrink-0 text-muted`}),o&&(0,V.jsx)(`span`,{className:`max-w-full truncate text-[8px] font-medium leading-none text-muted/80`,children:o})]}),(0,V.jsx)(`button`,{type:`button`,onClick:n,disabled:t,title:`Remove ${a}`,"aria-label":`Remove ${a}`,className:`absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full border border-border bg-bg text-muted opacity-0 transition-opacity hover:text-fg focus-visible:opacity-100 group-hover/att:opacity-100 disabled:hidden`,children:(0,V.jsx)(jw,{size:10,strokeWidth:2.5})})]})}function JH(){return qd({queryKey:[`githubStatus`],queryFn:()=>X.githubStatus(),staleTime:3e4,refetchOnWindowFocus:!0,refetchInterval:e=>{let t=e.state.data;return t?.inRepo&&t.authed?!1:6e4}})}function YH(){let e=JH();return!!(e.data?.inRepo&&e.data.authed)}function XH({className:e=``}){return YH()?(0,V.jsx)(`button`,{type:`button`,onClick:MS,onMouseDown:e=>e.preventDefault(),title:`Investigate this issue and make recommendations`,"aria-label":`Investigate this issue and make recommendations`,className:`flex h-7 w-7 items-center justify-center rounded-lg text-muted outline-none transition-[color,background-color,box-shadow] enabled:hover:bg-panel-2/70 enabled:hover:text-fg enabled:focus-visible:bg-panel-2/70 enabled:focus-visible:text-muted enabled:focus-visible:ring-1 enabled:focus-visible:ring-muted/80 enabled:focus-visible:ring-offset-1 enabled:focus-visible:ring-offset-bg enabled:active:bg-elevated enabled:active:text-muted disabled:bg-transparent disabled:text-muted/35 ${e}`,children:(0,V.jsx)(ew,{size:15,strokeWidth:2})}):null}var ZH=`prompt-control-type petite-caps`,QH=ZH,$H=ZH,eU=`profile-grid-cell relative flex h-6 cursor-pointer select-none items-center justify-start rounded border border-transparent px-1 text-left text-muted outline-none transition-colors ${QH} data-[highlighted]:border-border data-[highlighted]:bg-panel-2 data-[highlighted]:text-fg data-[highlighted]:outline data-[highlighted]:outline-1 data-[highlighted]:outline-offset-1 data-[highlighted]:outline-fg/55 data-[state=checked]:border-accent/70 data-[state=checked]:bg-accent/10 data-[state=checked]:font-medium data-[state=checked]:text-fg data-[state=checked]:ring-1 data-[state=checked]:ring-inset data-[state=checked]:ring-accent/90`;function tU(e){return`minmax(6rem, 7rem) repeat(${Math.max(0,e)}, auto)`}var nU=[`ultra`,`ultracode`],rU=[`low`,`medium`,`high`,`xhigh`,`max`,...nU];function iU(e){return[...new Set(e.flatMap(e=>e.options.flatMap(e=>e.efforts)))].sort((e,t)=>{let n=rU.indexOf(e),r=rU.indexOf(t);return n===-1&&r===-1?e.localeCompare(t):n===-1?1:r===-1?-1:n-r})}function aU(e){let t=[];for(let n of iU(e)){let e=nU.includes(n)?t.find(e=>nU.includes(e[0])):void 0;e?e.push(n):t.push([n])}return t}function oU(e){return e.flatMap(e=>e.options.flatMap(t=>t.efforts.map(n=>({provider:e.id,model:t.model,effort:n}))))}function sU(e){return JSON.stringify([e.provider,e.model,e.effort])}function cU(e,t){return oU(e).find(e=>sU(e)===t)}function lU(e,t){return!t?.model||!t.effort?!1:e.some(e=>(!t.provider||e.id===t.provider)&&e.options.some(e=>e.model===t.model&&e.efforts.includes(t.effort)))}function uU(e,t,n=`Profile unknown`){if(!t?.model&&!t?.effort)return n;let r=e.flatMap(e=>e.options).find(e=>e.model===t.model)?.label??t.model??`Model unknown`;return t.effort?`${r} › ${t.effort}`:r}function dU(e,t,n){let r=aU(e),i=e=>r.findIndex(t=>t.includes(e)),a=e.flatMap(e=>e.options.map(t=>({provider:e.id,option:t}))),o=a.findIndex(e=>e.provider===t.provider&&e.option.model===t.model);if(o===-1)return null;let s=a[o],c=s.option.efforts.indexOf(t.effort);if(c===-1)return null;if(n===`Home`||n===`End`||n===`ArrowLeft`||n===`ArrowRight`){let e=n===`Home`?0:n===`End`?s.option.efforts.length-1:c+(n===`ArrowLeft`?-1:1),t=s.option.efforts[e];return t?{provider:s.provider,model:s.option.model,effort:t}:null}let l=a[o+(n===`ArrowUp`?-1:1)];if(!l)return null;let u=i(t.effort),d=l.option.efforts.reduce((e,t)=>e?Math.abs(i(t)-u)<Math.abs(i(e)-u)?t:e:t,void 0);return d?{provider:l.provider,model:l.option.model,effort:d}:null}var fU,pU=!1;function mU(){pU||typeof window>`u`||(pU=!0,window.addEventListener(`keydown`,e=>{e.key!==`Escape`||!fU||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),gU())},{capture:!0}))}function hU(e){mU();let t={dismiss:e};return fU=t,()=>{fU===t&&(fU=void 0)}}function gU(){let e=fU;return e?(fU=void 0,e.dismiss(),!0):!1}function _U(e){gU()&&e.preventDefault(),e.stopPropagation()}function vU(e){return e===`xhigh`?`X-high`:e.charAt(0).toUpperCase()+e.slice(1)}function yU({groups:e,value:t,pending:n,onValueChange:r,placeholder:i,ariaLabel:a,menuAriaLabel:o=`Choose model and effort`,title:s,disabled:c=!1,compact:l=!1,side:u=`bottom`,menuZClass:d=xV,className:f=``}){let[p,m]=(0,B.useState)(!1),h=(0,B.useRef)(p),g=(0,B.useRef)(c),_=(0,B.useRef)(void 0),v=(0,B.useRef)(new Map),y=(0,B.useRef)(void 0),b=(0,B.useMemo)(()=>aU(e),[e]),x=(0,B.useMemo)(()=>e.flatMap(e=>e.options.flatMap(t=>t.efforts.map(n=>({provider:e.id,model:t.model,effort:n})))),[e]),S=l?$H:QH,C=c?`cursor-not-allowed opacity-45`:`cursor-pointer transition-colors hover:border-border hover:bg-panel-2 hover:text-fg`,w=lU(e,t),T=w&&t?.provider&&t.model&&t.effort?sU(t):void 0,E=n?.model||n?.effort?uU(e,n,`Pending profile`):void 0;h.current=p,g.current=c;function D(){h.current=!1,_.current=void 0,m(!1)}(0,B.useLayoutEffect)(()=>{let e=e=>{e.key!==`Escape`||!h.current||g.current||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_.current?.(),D())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]),(0,B.useLayoutEffect)(()=>{!c||!p||(_.current?.(),D())},[c,p]),(0,B.useLayoutEffect)(()=>()=>_.current?.(),[]),(0,B.useLayoutEffect)(()=>{T===y.current&&(y.current=void 0)},[T]);function O(e){let t=sU(e);y.current!==t&&(y.current=t,r(e))}function k(t,n){if(![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(t.key))return;let r=dU(e,n,t.key);r&&(t.preventDefault(),t.stopPropagation(),v.current.get(sU(r))?.focus())}return(0,V.jsxs)(lV,{modal:!1,open:p,onOpenChange:e=>{_.current?.(),_.current=void 0,h.current=e,m(e),e&&(_.current=hU(D))},children:[(0,V.jsx)(uV,{asChild:!0,disabled:c,children:(0,V.jsxs)(`button`,{type:`button`,"aria-label":a,"aria-invalid":!w&&(t?.model||t?.effort)?!0:void 0,"aria-description":E?`Pending ${E}`:void 0,title:s,"data-profile-known":w?`true`:`false`,"data-profile-pending":E?`true`:void 0,className:`profile-grid-trigger group inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border border-border/50 bg-transparent px-2 py-1 text-left text-muted outline-none data-[state=open]:border-border data-[state=open]:bg-panel-2 ${C} ${f} ${S}`,children:[(0,V.jsx)(`span`,{className:`profile-grid-value relative -top-px min-w-0 flex-1 truncate text-left ${S}`,children:uU(e,t,i)}),E&&(0,V.jsx)(cw,{"aria-hidden":`true`,size:l?10:11,className:`shrink-0 animate-spin text-muted/65`}),(0,V.jsx)(MC,{"aria-hidden":`true`,size:l?11:13,className:`shrink-0 text-fg/65 transition-transform group-data-[state=open]:rotate-180`})]})}),(0,V.jsx)(dV,{children:(0,V.jsxs)(fV,{"aria-label":o,align:`start`,side:u,sideOffset:5,collisionPadding:8,onEscapeKeyDown:e=>e.stopPropagation(),className:`profile-grid-menu ${d} ${bV} max-h-[min(360px,var(--radix-dropdown-menu-content-available-height))] max-w-[calc(100vw-1rem)] overflow-auto rounded-lg p-1.5 ${S}`,children:[e.map(t=>(0,V.jsxs)(pV,{children:[t.label&&(0,V.jsx)(mV,{className:`px-1.5 pb-1 pt-1 text-left font-medium tracking-[0.07em] text-muted/55 first:pt-0.5`,children:t.label}),(0,V.jsx)(gV,{value:T,onValueChange:t=>{let n=cU(e,t);n&&O(n)},children:t.options.map(e=>(0,V.jsxs)(`div`,{"data-profile-grid-row":e.model,className:`grid w-max items-center gap-1 py-0.5`,style:{gridTemplateColumns:tU(b.length)},children:[(0,V.jsx)(`span`,{className:`profile-grid-model-label min-w-0 max-w-[9.5rem] truncate px-1.5 text-left text-muted ${S}`,title:e.label,children:e.label}),b.map(n=>{let r=n.find(t=>e.efforts.includes(t)),i=n.reduce((e,t)=>vU(t).length>vU(e).length?t:e);if(!r)return(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`invisible cursor-default border border-transparent px-1 text-left font-medium ${S}`,children:vU(i)},i);let a={provider:t.id,model:e.model,effort:r},o=sU(a);return(0,V.jsx)(_V,{value:o,ref:e=>{e?v.current.set(o,e):v.current.delete(o)},onKeyDown:e=>k(e,a),onSelect:e=>{e.preventDefault(),O(a),_.current?.(),D()},"aria-label":`${e.label}, ${vU(r)} effort`,title:`${e.label} › ${vU(r)}`,className:eU,children:(0,V.jsxs)(`span`,{className:`grid`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`invisible col-start-1 row-start-1 font-medium`,children:vU(r)}),(0,V.jsx)(`span`,{className:`col-start-1 row-start-1`,children:vU(r)})]})},r)})]},e.model))}),t!==e.at(-1)&&(0,V.jsx)(yV,{className:`my-1 h-px bg-border`})]},t.id)),x.length===0&&(0,V.jsx)(`div`,{className:`px-2 py-1.5 text-muted/60`,children:`No profiles available`})]})})]})}async function bU(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}if(!xU(e))throw Error(`the browser blocked clipboard access`)}function xU(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`0`,t.style.left=`0`,t.style.opacity=`0`,document.body.append(t);let n=document.getSelection(),r=n&&n.rangeCount>0?n.getRangeAt(0):null;t.select(),t.setSelectionRange(0,e.length);let i=!1;try{i=document.execCommand(`copy`)}catch{i=!1}return t.remove(),r&&n&&(n.removeAllRanges(),n.addRange(r)),i}var SU={claude:`claude auth login`,codex:`codex login`},CU={claude:`Claude`,codex:`Codex`};function wU(e){let t=e.trim();return t===`/login`?`login`:t===`/logout`?`logout`:null}var TU=(0,B.lazy)(()=>HO(()=>import(`./TerminalPane-Cb8jOFP9.js`).then(e=>({default:e.TerminalPane})),__vite__mapDeps([0,1])));function EU({backend:e,onClose:t,onAuthed:n}){let r=Md(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(null),c=(0,B.useRef)(!1),l=SU[e],u=CU[e],d=Jd({mutationFn:()=>X.accountLoginStart({backend:e}),onSuccess:e=>{c.current=!1,s(e.attemptId)},onError:e=>Q(`Couldn't start the sign-in terminal: ${e.message.slice(0,80)} — use the command below instead`,{duration:7e3})}),f=qd({queryKey:[`accountLoginStatus`,o],queryFn:()=>X.accountLoginStatus({attemptId:o}),enabled:!!o,refetchInterval:2e3});(0,B.useEffect)(()=>{if(!o||c.current)return;let t=f.data;if(!(!t||t.state===`running`||t.state===`unknown`)){if(c.current=!0,t.auth!==`signed-out`){r.setQueryData([`authStatus`],n=>n&&{...n,[e]:t.auth}),Q(`Signed in to ${u}`),n();return}Q(`${u} sign-in didn't complete — try again or use the command below`,{duration:7e3}),s(null)}},[o,f.data,e,u]);function p(){o&&!c.current&&X.accountLoginCancel({attemptId:o}).catch(()=>{})}let m=(0,B.useRef)({attempt:null,settled:!1});m.current={attempt:o,settled:c.current},(0,B.useEffect)(()=>()=>{let{attempt:e,settled:t}=m.current;e&&!t&&X.accountLoginCancel({attemptId:e}).catch(()=>{})},[]);async function h(){try{await bU(l),a(!0),window.setTimeout(()=>a(!1),1500)}catch{Q(`Couldn't copy — select the command and copy it manually`,{duration:6e3})}}let g=Jd({mutationFn:()=>X.authStatus(),onSuccess:t=>{if(r.setQueryData([`authStatus`],t),t[e]===`signed-out`){Q(`Still signed out of ${u} — run the command, then retry`,{duration:6e3});return}n()},onError:()=>n()});return(0,V.jsx)(FV,{open:!0,onOpenChange:e=>{e||(p(),t())},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] ${o?`w-[680px]`:`w-[440px]`} max-w-[92vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,V.jsxs)(QV,{className:`mb-1 text-[14px] font-medium`,children:[`Signed out of `,u]}),o?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:`mb-3 text-[12.5px] leading-relaxed text-muted`,children:[`This terminal is running `,(0,V.jsx)(`code`,{className:`font-mono-keep text-fg/90`,children:l}),` — follow its prompts (it may open your browser). Frizz detects completion automatically.`]}),(0,V.jsx)(`div`,{className:`mb-4 h-[340px] overflow-hidden rounded-lg border border-border bg-[#0d0e10]`,children:(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-muted`,children:`Opening terminal…`}),children:(0,V.jsx)(TU,{slug:o})})}),(0,V.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>{p(),s(null)},className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:`Cancel sign-in`})})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:`mb-4 text-[12.5px] leading-relaxed text-muted`,children:[`Frizz can't start a `,u,` thread until you're signed in. Sign in here, or run the command in your own terminal and retry:`]}),(0,V.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg border border-border bg-panel-2 px-3 py-2`,children:[(0,V.jsx)(`code`,{className:`flex-1 select-all font-mono-keep text-[12.5px] text-fg`,children:l}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Copy command`,onClick:h,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel hover:text-fg`,children:i?(0,V.jsx)(jC,{size:14,strokeWidth:2,className:`text-green-400`}):(0,V.jsx)(WC,{size:14,strokeWidth:1.8})})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>g.mutate(),disabled:g.isPending,className:`flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-[12.5px] text-fg/90 outline-none transition-colors hover:bg-panel-2 disabled:opacity-60`,children:[g.isPending&&(0,V.jsx)(cw,{size:13,className:`animate-spin`}),`Retry`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>d.mutate(),disabled:d.isPending,className:`flex items-center gap-1.5 rounded-md bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white outline-none transition-opacity hover:opacity-90 disabled:opacity-60`,children:[d.isPending&&(0,V.jsx)(cw,{size:13,className:`animate-spin`}),`Sign in here`]})]})]})]})]})})}function DU({backend:e,onClose:t}){let n=Md(),r=CU[e],i=Jd({mutationFn:()=>X.accountLogout({backend:e}),onSuccess:i=>{n.setQueryData([`authStatus`],t=>t&&{...t,[e]:i.auth}),i.status===`done`?Q(`Signed out of ${r}`):i.status===`blocked`?Q(`Not signed out — ${i.activeThreads} active ${r} thread${i.activeThreads===1?``:`s`}. Let them finish (or complete them) first.`,{duration:7e3}):Q(`${r} sign-out failed: ${i.detail??`unknown error`}`,{duration:7e3}),t()},onError:e=>{Q(`${r} sign-out failed: ${e.message.slice(0,80)}`,{duration:7e3}),t()}});return(0,V.jsx)(FV,{open:!0,onOpenChange:e=>{!e&&!i.isPending&&t()},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] w-[420px] max-w-[86vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,V.jsxs)(QV,{className:`mb-1 text-[14px] font-medium`,children:[`Sign out of `,r,`?`]}),(0,V.jsxs)(`p`,{className:`mb-4 text-[12.5px] leading-relaxed text-muted`,children:[`New `,r,` threads will be blocked until you sign in again. Running `,r,` threads are left untouched — sign-out is refused while any are active.`]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:t,disabled:i.isPending,className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-60`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>i.mutate(),disabled:i.isPending,className:`flex items-center gap-1.5 rounded-md bg-red-500/90 px-3 py-1.5 text-[12.5px] font-medium text-white outline-none transition-opacity hover:opacity-90 disabled:opacity-60`,children:[i.isPending&&(0,V.jsx)(cw,{size:13,className:`animate-spin`}),`Sign out`]})]})]})]})})}var OU=Sb.options,kU={auto:`Auto`,default:`Default`,acceptEdits:`Accept edits`,plan:`Plan`,bypassPermissions:`Bypass`},AU={auto:`auto — safe actions auto-approved, risky ones prompt`,default:`default — prompt for every permission`,acceptEdits:`accept edits — file edits auto-approved`,plan:`plan — read-only planning, approval before changes`,bypassPermissions:`bypass — never prompt (dangerous)`};OU.filter(e=>e!==`plan`).map(e=>({value:e,label:kU[e],title:AU[e]}));var jU=[`auto`,`bypassPermissions`].map(e=>({value:e,label:kU[e],title:AU[e]})),MU=[{value:`fable`,label:`Fable`},{value:`opus`,label:`Opus`},{value:`sonnet`,label:`Sonnet`},{value:`haiku`,label:`Haiku`}];new Set([{slug:`gpt-5.6-sol`,displayName:`GPT-5.6 Sol`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-terra`,displayName:`GPT-5.6 Terra`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-luna`,displayName:`GPT-5.6 Luna`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`]},{slug:`gpt-5.5`,displayName:`GPT-5.5`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`]}].map(e=>e.slug));function NU(e){return e===`plan`?`auto`:e}var PU=[`low`,`medium`,`high`,`xhigh`,`max`],FU=`ultracode`,IU=new Set([`fable`,`opus`,`sonnet`]);function LU(e){return e&&IU.has(e)?[...PU,FU]:[...PU]}var RU={low:`Low`,medium:`Medium`,high:`High`,xhigh:`X-high`,max:`Max`,ultra:`Ultra`,ultracode:`Ultracode`};function zU(e){return RU[e]??e.charAt(0).toUpperCase()+e.slice(1)}function BU(e,t){let n=LU(e).map(e=>({value:e,label:zU(e)}));return t.withDefault?[{value:``,label:`Default`},...n]:n}function VU(e,t){let n=(e?.efforts??[]).map(e=>({value:e,label:zU(e)}));return t.withDefault?[{value:``,label:`Default`},...n]:n}function HU(e,t){return t.field===`backend`?{...e,backend:t.value}:t.field===`profile`?{...e,backend:t.backend,[t.backend]:{...e[t.backend],model:t.model,effort:t.effort}}:{...e,...t.field===`model`?{backend:t.backend}:{},[t.backend]:{...e[t.backend],[t.field]:t.value}}}function UU(e){return[{id:`claude`,label:`Claude Code`,options:MU.map(e=>({model:e.value,label:e.label,defaultEffort:`high`,efforts:LU(e.value)}))},{id:`codex`,label:`Codex`,options:e.map(e=>({model:e.slug,label:e.displayName,defaultEffort:e.defaultEffort,efforts:e.efforts}))}]}function WU(e,t){let n=e.backend,r=e[n],i=r.model??(n===`claude`?`opus`:t[0]?.slug??``),a=n===`codex`?t.find(e=>e.slug===i):void 0,o=n===`claude`?MU.some(e=>e.value===i):t.some(e=>e.slug===i),s=n===`claude`?`high`:a?.defaultEffort??``,c=r.effort??s,l=n===`claude`?BU(i,{withDefault:!1}):VU(a,{withDefault:!1}),u=l.some(e=>e.value===c);return{backend:n,model:i,effort:c,codexModel:a,modelAvailable:o,effortAvailable:u,effortOptions:c&&!u?[{value:c,label:`${c} (unavailable)`,title:`Saved reasoning level is not available for this model`},...l]:l}}function GU(){let e=Md(),t=qd({queryKey:[`dispatchPreferencesGet`],queryFn:()=>X.dispatchPreferencesGet()}),n=qd({queryKey:[`codexModels`],queryFn:()=>X.codexModels()}),r=n.data??[],i=Jd({mutationFn:e=>X.dispatchPreferenceSet(e),scope:{id:`dispatch-preferences`},onMutate:t=>{let n=e.getQueryData([`dispatchPreferencesGet`]);n&&e.setQueryData([`dispatchPreferencesGet`],HU(n,t))},onError:t=>{e.invalidateQueries({queryKey:[`dispatchPreferencesGet`]}),Q(`Could not save new-thread preference: ${t.message.slice(0,80)}`)}}),a=!!t.data&&!!n.data;return{resolved:(0,B.useMemo)(()=>a?WU(t.data,r):void 0,[a,t.data,r]),codexList:r,loadError:t.isError||n.isError,saveProfile:i.mutate}}var KU=`frizz-drafts:v1`,qU=80,JU=512*1024,YU=2*1024*1024,XU=new TextEncoder;function ZU(e){return XU.encode(e).byteLength}function QU(){return{version:1,entries:{}}}function $U(e){if(!e)return QU();try{let t=JSON.parse(e);if(!t||typeof t!=`object`||t.version!==1)return QU();let n=t.entries;if(!n||typeof n!=`object`||Array.isArray(n))return QU();let r={};for(let[e,t]of Object.entries(n))typeof t?.value!=`string`||typeof t?.touchedAt!=`number`||!Number.isFinite(t.touchedAt)||e.length>512||ZU(t.value)>JU||(r[e]={value:t.value,touchedAt:t.touchedAt});return{version:1,entries:r}}catch{return QU()}}function eW(e){let t=Object.entries(e.entries).filter(([,e])=>e.value&&ZU(e.value)<=JU).sort((e,t)=>t[1].touchedAt-e[1].touchedAt),n={};for(let[e,r]of t){if(Object.keys(n).length>=qU)break;n[e]=r,ZU(JSON.stringify({version:1,entries:n}))>YU&&delete n[e]}return{version:1,entries:n}}var tW=new class{snapshot;listeners=new Set;storage;constructor(e=typeof sessionStorage>`u`?void 0:sessionStorage){this.storage=e;let t=null;try{t=e?.getItem(`frizz-drafts:v1`)??null}catch{}this.snapshot=eW($U(t))}getSnapshot=()=>this.snapshot;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));get(e){return this.snapshot.entries[e]?.value??``}set(e,t){let n={...this.snapshot.entries};t?n[e]={value:t,touchedAt:Date.now()}:delete n[e],this.commit({version:1,entries:n})}clear(e){this.snapshot.entries[e]&&this.commit({version:1,entries:Object.fromEntries(Object.entries(this.snapshot.entries).filter(([t])=>t!==e))})}commit(e){this.snapshot=e;try{this.storage?.setItem(KU,JSON.stringify(eW(e)))}catch{}for(let e of this.listeners)e()}};function nW(e){return encodeURIComponent(e||`unresolved-project`)}var rW={dispatch:e=>`dispatch:${nW(e)}:new`,followUp:(e,t,n)=>`followup:${nW(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n??`unowned`)}`,adopt:(e,t)=>`adopt:${nW(e)}:${encodeURIComponent(t)}`,answer:(e,t,n,r,i)=>`answer:${nW(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n??`unowned`)}:${encodeURIComponent(r)}:${i}`,interaction:(e,t,n,r,i,a,o)=>`interaction:${nW(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n)}:${encodeURIComponent(r)}:${i}:${encodeURIComponent(a)}:${encodeURIComponent(o)}`};function iW(){return Hf(Z).board?.projectDir}function aW(e){return Hf(Z).board?.threads.find(t=>t.id===e)?.sessionId}function oW(e){let t=(0,B.useCallback)(()=>tW.get(e),[e]);return[(0,B.useSyncExternalStore)(tW.subscribe,t,t),(0,B.useCallback)(t=>tW.set(e,t),[e]),(0,B.useCallback)(()=>tW.clear(e),[e])]}function sW(e){let t=(0,B.useCallback)(()=>JSON.stringify(Object.fromEntries(e.map(e=>[e,tW.get(e)]))),[e.join(`\0`)]),n=(0,B.useSyncExternalStore)(tW.subscribe,t,t);return(0,B.useMemo)(()=>new Map(Object.entries(JSON.parse(n))),[n])}function cW({autoFocus:e,onDispatched:t}){let{resolved:n,codexList:r,loadError:i,saveProfile:a}=GU(),o=YH(),s=iW(),[c,l,u]=oW(rW.dispatch(s)),d=rW.dispatch(s),f=(0,B.useRef)(``),[p,m]=(0,B.useState)(null),h=qd({queryKey:[`authStatus`],queryFn:()=>X.authStatus(),staleTime:3e4}),[g,_]=(0,B.useState)(null),[v,y]=(0,B.useState)(null),b=(0,B.useRef)(null),x=Jd({mutationFn:e=>X.dispatch(e),onMutate:()=>Q(`Starting thread…`,{spinner:!0,sticky:!0}),onSuccess:e=>{m(null),t?.(),Q(`Thread started`,{link:{label:`Open thread`,slug:e.slug}})},onError:(e,t)=>{tW.get(d)||l(f.current||t.prompt),m(null);let n=/^AUTH_REQUIRED:(claude|codex)$/.exec(e.message);if(n){b.current=t,_(n[1]),Q(`Signed out of ${n[1]===`claude`?`Claude`:`Codex`}`,{duration:3e3});return}Q(`Dispatch failed: ${e.message.slice(0,80)}`)}});function S(e){f.current=c,u(),m(e.prompt),x.mutate(e)}function C(){if(!c.trim()||!n)return;let e=wU(c);if(e){u(),e===`login`?(b.current=null,_(n.backend)):y(n.backend);return}if(!n.modelAvailable){Q(`Saved model is unavailable — choose a model before starting the thread`);return}if(!n.effortAvailable){Q(`Saved reasoning level is unavailable for this model — choose another level`);return}let t={prompt:c.trim(),model:n.model,backend:n.backend,effort:n.effort};if(h.data?.[n.backend]===`signed-out`){b.current=t,_(n.backend);return}S(t)}let w=(0,B.useMemo)(()=>n?(0,V.jsx)(yU,{groups:UU(r),value:{provider:n.backend,model:n.model,effort:n.effort},onValueChange:e=>a({field:`profile`,backend:e.provider,model:e.model,effort:e.effort}),ariaLabel:`Model and effort`,title:n.modelAvailable&&n.effortAvailable?`Model and reasoning effort`:`Saved model or reasoning effort unavailable — choose a supported pair`,className:`max-w-[min(21rem,72vw)]`}):(0,V.jsx)(yU,{groups:[],value:void 0,onValueChange:()=>{},placeholder:i?`Profile unavailable`:`Profile loading…`,ariaLabel:`Model and effort loading`,disabled:!0}),[n,r,i,a]);return(0,V.jsxs)(`div`,{className:`w-full flex flex-col gap-3`,children:[(0,V.jsx)(KH,{surface:`newComposer`,autoFocus:e,value:c,onChange:l,onSubmit:C,placeholder:`Describe the task…`,minHeight:96,maxHeight:340,busy:x.isPending,footer:w,leftAction:o?(0,V.jsx)(XH,{}):void 0}),x.isError&&(0,V.jsx)(`span`,{className:`px-0.5 text-[11px] text-red-400 truncate`,children:x.error.message}),p&&(0,V.jsxs)(`div`,{"data-pending-dispatch":!0,role:`status`,className:`rounded-lg border border-border bg-panel-2 px-3 py-2.5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted`,children:[(0,V.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-accent`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:`Starting thread…`})]}),(0,V.jsx)(`p`,{className:`mt-1 line-clamp-2 whitespace-pre-wrap text-[12px] leading-relaxed text-fg`,children:p})]}),g&&(0,V.jsx)(EU,{backend:g,onClose:()=>_(null),onAuthed:()=>{let e=b.current;b.current=null,_(null),e&&S(e)}}),v&&(0,V.jsx)(DU,{backend:v,onClose:()=>y(null)})]})}function lW({onClose:e}){let t=(0,B.useRef)(null),n=(0,B.useRef)(typeof document<`u`&&document.activeElement instanceof HTMLElement?document.activeElement:null);return(0,B.useEffect)(()=>()=>{let e=n.current;window.setTimeout(()=>{e?.isConnected&&e.focus({preventScroll:!0})},0)},[]),(0,V.jsx)(FV,{open:!0,onOpenChange:t=>{t||e()},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-50 bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{ref:t,"aria-modal":`true`,"aria-describedby":void 0,onEscapeKeyDown:_U,onCloseAutoFocus:e=>{e.preventDefault();let t=n.current;t?.isConnected&&t.focus({preventScroll:!0})},onOpenAutoFocus:e=>{e.preventDefault(),t.current?.querySelector(`textarea`)?.focus({preventScroll:!0})},className:`fixed left-1/2 top-1/2 z-50 w-[640px] max-w-[86vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none max-[700px]:top-[calc(env(safe-area-inset-top)+56px)] max-[700px]:w-[calc(100vw-24px)] max-[700px]:max-w-none max-[700px]:translate-y-0`,children:[(0,V.jsx)(QV,{className:`mb-1 text-[14px] font-medium`,children:`New thread`}),(0,V.jsx)(cW,{autoFocus:!0,onDispatched:e})]})]})})}function uW({children:e,onClose:t}){return(0,V.jsx)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center bg-black/30 backdrop-blur-md backdrop-saturate-150`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:e})}var dW=`-mx-1.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-fg/75 outline-none transition-colors hover:bg-elevated hover:text-fg focus-visible:ring-1 focus-visible:ring-border-strong disabled:opacity-55`,fW={claude:`size-[11px] translate-y-px`,codex:`size-[10px]`},pW={claude:{backend:`claude`,label:`Claude Code`},codex:{backend:`codex`,label:`OpenAI Codex`}};function mW(e){return e===`claude`||e===`codex`?pW[e]:void 0}function hW({backend:e,className:t}){let n=mW(e);return n?(0,V.jsx)(`span`,{role:`img`,"aria-label":n.label,className:`inline-flex shrink-0 text-muted/65 ${fW[n.backend]} ${t??``}`,children:n.backend===`codex`?(0,V.jsx)(gW,{}):(0,V.jsx)(_W,{})}):null}function gW(){return(0,V.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,className:`size-full`,fill:`currentColor`,children:(0,V.jsx)(`path`,{d:`M22.282 9.821a6 6 0 0 0-.516-4.91a6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9a6.05 6.05 0 0 0 .743 7.097a5.98 5.98 0 0 0 .51 4.911a6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206a6 6 0 0 0 3.997-2.9a6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081l4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085l4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354l-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023l-.141-.085l-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365l2.602-1.5l2.607 1.5v2.999l-2.597 1.5l-2.607-1.5Z`})})}function _W(){return(0,V.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,className:`size-full`,fill:`currentColor`,children:(0,V.jsx)(`path`,{d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`})})}typeof window<`u`&&window.document&&window.document.createElement;function vW(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}function yW(e,t=[]){let n=[];function r(t,r){let i=B.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=B.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=B.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>B.createContext(e));return function(n){let r=n?.[e]||t;return B.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,bW(i,...t)]}function bW(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var xW=`DismissableLayer`,SW=`dismissableLayer.update`,CW=`dismissableLayer.pointerDownOutside`,wW=`dismissableLayer.focusOutside`,TW,EW=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),DW=B.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=B.useContext(EW),[d,f]=B.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=B.useState({}),h=SN(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=B.useRef(!1),C=jW(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:B.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=MW(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=ZN(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return B.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),B.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(TW=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),NW(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=TW))}},[d,p,n,u]),B.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),NW())},[d,u]),B.useEffect(()=>{let e=()=>m({});return document.addEventListener(SW,e),()=>document.removeEventListener(SW,e)},[]),(0,V.jsx)(KN.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:vW(e.onFocusCapture,w.onFocusCapture),onBlurCapture:vW(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:vW(e.onPointerDownCapture,C.onPointerDownCapture)})});DW.displayName=xW;var OW=`DismissableLayerBranch`,kW=B.forwardRef((e,t)=>{let n=B.useContext(EW),r=B.useRef(null),i=SN(t,r);return B.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(KN.div,{...e,ref:i})});kW.displayName=OW;var AW=()=>!0;function jW(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=AW}=t,s=ZN(e),c=B.useRef(!1),l=B.useRef(!1),u=B.useRef(new Map),d=B.useRef(()=>{});return B.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}function p(e){l.current&&u.current.set(e.type,!1)}let m=a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||PW(CW,s,p,{discrete:!0})};if(!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:()=>c.current=!0}}function MW(e,t=globalThis?.document){let n=ZN(e),r=B.useRef(!1);return B.useEffect(()=>{let e=e=>{e.target&&!r.current&&PW(wW,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function NW(){let e=new CustomEvent(SW);document.dispatchEvent(e)}function PW(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?qN(i,a):i.dispatchEvent(a)}var FW=`focusScope.autoFocusOnMount`,IW=`focusScope.autoFocusOnUnmount`,LW={bubbles:!1,cancelable:!0},RW=`FocusScope`,zW=B.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=ZN(i),u=ZN(a),d=B.useRef(null),f=SN(t,c),p=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:KW(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||KW(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&KW(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),B.useEffect(()=>{if(s){qW.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(FW,LW);s.addEventListener(FW,l),s.dispatchEvent(t),t.defaultPrevented||(BW(XW(HW(s)),{select:!0}),document.activeElement===e&&KW(s))}return()=>{s.removeEventListener(FW,l),setTimeout(()=>{let t=new CustomEvent(IW,LW);s.addEventListener(IW,u),s.dispatchEvent(t),t.defaultPrevented||KW(e??document.body,{select:!0}),s.removeEventListener(IW,u),qW.remove(p)},0)}}},[s,l,u,p]);let m=B.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=VW(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&KW(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&KW(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(KN.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});zW.displayName=RW;function BW(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(KW(r,{select:t}),document.activeElement!==n)return}function VW(e){let t=HW(e);return[UW(t,e),UW(t.reverse(),e)]}function HW(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function UW(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):WW(r,{upTo:t})))return r}function WW(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function GW(e){return e instanceof HTMLInputElement&&`select`in e}function KW(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&GW(e)&&t&&e.select()}}var qW=JW();function JW(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=YW(e,t),e.unshift(t)},remove(t){e=YW(e,t),e[0]?.resume()}}}function YW(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function XW(e){return e.filter(e=>e.tagName!==`A`)}var ZW=`Popper`,[QW,$W]=yW(ZW),[eG,tG]=QW(ZW),nG=e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,V.jsx)(eG,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};nG.displayName=ZW;var rG=`PopperAnchor`,iG=B.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=tG(rG,n),o=B.useRef(null),s=a.onAnchorChange,c=SN(t,B.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=B.useRef(null);B.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&mG(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,V.jsx)(KN.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});iG.displayName=rG;var aG=`PopperContent`,[oG,sG]=QW(aG),cG=B.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=tG(aG,n),[_,v]=B.useState(null),y=SN(t,v),[b,x]=B.useState(null),S=XI(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(fG),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=RI({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>wI(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[BI({mainAxis:i+w,alignmentAxis:o}),c&&VI({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?HI():void 0,...k}),c&&UI({...k}),WI({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&KI({element:b,padding:s}),pG({arrowWidth:C,arrowHeight:w}),f&&GI({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),ee=g.setPlacementState;TN(()=>(ee(M),()=>{ee(void 0)}),[M,ee]);let[F,te]=mG(M),ne=ZN(m);TN(()=>{N&&ne?.()},[N,ne]);let re=P.arrow?.x,ie=P.arrow?.y,ae=P.arrow?.centerOffset!==0,[oe,se]=B.useState();return TN(()=>{_&&se(window.getComputedStyle(_).zIndex)},[_]),(0,V.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(oG,{scope:n,placedSide:F,placedAlign:te,onArrowChange:x,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,V.jsx)(KN.div,{"data-side":F,"data-align":te,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});cG.displayName=aG;var lG=`PopperArrow`,uG={top:`bottom`,right:`left`,bottom:`top`,left:`right`},dG=B.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=sG(lG,n),a=uG[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(YI,{...r,ref:t,style:{...r.style,display:`block`}})})});dG.displayName=lG;function fG(e){return e!==null}var pG=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=mG(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function mG(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var hG=nG,gG=iG,_G=cG,vG=dG;function yG(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}var bG=e=>{let{present:t,children:n}=e,r=xG(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=CG(r.ref,TG(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null};bG.displayName=`Presence`;function xG(e){let[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),a=B.useRef(`none`),o=B.useRef(void 0),[s,c]=yG(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return B.useEffect(()=>{s===`mounted`?(a.current=o.current??wG(r.current),o.current=void 0):a.current=`none`},[s]),TN(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=wG(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),TN(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=wG(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=wG(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:B.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=wG(t)}else r.current=null;n(e)},[])}}function SG(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function CG(...e){let t=B.useRef(e);return t.current=e,B.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=SG(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():SG(n[e],null)}}},[])}function wG(e){return e?.animationName||`none`}function TG(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var EG=`Popover`,[DG,_te]=yW(EG,[$W]),OG=$W(),[kG,AG]=DG(EG),jG=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=OG(t),c=B.useRef(null),[l,u]=B.useState(!1),[d,f]=AN({prop:r,defaultProp:i??!1,onChange:a,caller:EG});return(0,V.jsx)(hG,{...s,children:(0,V.jsx)(kG,{scope:t,contentId:PP(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:B.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:B.useCallback(()=>u(!0),[]),onCustomAnchorRemove:B.useCallback(()=>u(!1),[]),modal:o,children:n})})};jG.displayName=EG;var MG=`PopoverAnchor`,NG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=AG(MG,n),a=OG(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return B.useEffect(()=>(o(),()=>s()),[o,s]),(0,V.jsx)(gG,{...a,...r,ref:t})});NG.displayName=MG;var PG=`PopoverTrigger`,FG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=AG(PG,n),a=OG(n),o=SN(t,i.triggerRef),s=(0,V.jsx)(KN.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":XG(i.open),...r,ref:o,onClick:vW(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,V.jsx)(gG,{asChild:!0,...a,children:s})});FG.displayName=PG;var IG=`PopoverPortal`,[LG,RG]=DG(IG,{forceMount:void 0}),zG=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=AG(IG,t);return(0,V.jsx)(LG,{scope:t,forceMount:n,children:(0,V.jsx)(bG,{present:n||a.open,children:(0,V.jsx)(bL,{asChild:!0,container:i,children:r})})})};zG.displayName=IG;var BG=`PopoverContent`,VG=B.forwardRef((e,t)=>{let n=RG(BG,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=AG(BG,e.__scopePopover);return(0,V.jsx)(bG,{present:r||a.open,children:a.modal?(0,V.jsx)(UG,{...i,ref:t}):(0,V.jsx)(WG,{...i,ref:t})})});VG.displayName=BG;var HG=NN(`PopoverContent.RemoveScroll`),UG=B.forwardRef((e,t)=>{let n=AG(BG,e.__scopePopover),r=B.useRef(null),i=SN(t,r),a=B.useRef(!1);return B.useEffect(()=>{let e=r.current;if(e)return rR(e)},[]),(0,V.jsx)(fz,{as:HG,allowPinchZoom:!0,children:(0,V.jsx)(GG,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:vW(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:vW(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:vW(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),WG=B.forwardRef((e,t)=>{let n=AG(BG,e.__scopePopover),r=B.useRef(!1),i=B.useRef(!1);return(0,V.jsx)(GG,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),GG=B.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=AG(BG,n),p=OG(n);return mP(),(0,V.jsx)(zW,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(DW,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,V.jsx)(_G,{"data-state":XG(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),KG=`PopoverClose`,qG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=AG(KG,n);return(0,V.jsx)(KN.button,{type:`button`,...r,ref:t,onClick:vW(e.onClick,()=>i.onOpenChange(!1))})});qG.displayName=KG;var JG=`PopoverArrow`,YG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=OG(n);return(0,V.jsx)(vG,{...i,...r,ref:t})});YG.displayName=JG;function XG(e){return e?`open`:`closed`}var ZG=jG,QG=NG,$G=FG,eK=zG,tK=VG;function nK({modal:e=!1,...t}){return(0,V.jsx)(ZG,{modal:e,...t})}var rK=$G,iK=QG;function aK({children:e,side:t=`top`,align:n=`center`,sideOffset:r=6,className:i=``,...a}){return(0,V.jsx)(eK,{children:(0,V.jsx)(tK,{side:t,align:n,sideOffset:r,avoidCollisions:!0,collisionPadding:12,onEscapeKeyDown:e=>e.stopPropagation(),className:`${bV} ${wV} rounded-lg outline-none ${i}`,...a,children:e})})}var oK=3e4,sK=45e3;function cK(e,t){return t?AbortSignal.any([t,AbortSignal.timeout(e)]):AbortSignal.timeout(e)}var lK=`text-[9px]`,uK={claude:`text-fg/75! size-[14px]! translate-y-0!`,codex:`text-fg/75! size-[12.75px]! translate-y-0!`};function dK(){let e=qd({queryKey:[`quota`],queryFn:()=>X.quota(),staleTime:1e4}),t=qd({queryKey:[`authStatus`],queryFn:()=>X.authStatus(),staleTime:3e4});return[`claude`,`codex`].some(n=>fK(e.data?.[n],t.data?.[n],e.isLoading))}function fK(e,t,n){return t===`signed-out`||!e&&n?!1:!!e&&e.status===`ok`&&e.windows.length>0}function pK(){let e=Md(),t=(0,B.useRef)(null),[n,r]=(0,B.useState)(!1),i=qd({queryKey:[`quota`],queryFn:({signal:e})=>X.quota(void 0,{signal:cK(oK,e)}),refetchInterval:e=>{let t=e.state.data;return!t||t.claude.status!==`ok`||t.codex.status!==`ok`?15e3:3e4},staleTime:1e4,refetchOnWindowFocus:!0}),a=qd({queryKey:[`authStatus`],queryFn:({signal:e})=>X.authStatus(void 0,{signal:cK(oK,e)}),refetchInterval:12e4,staleTime:3e4,refetchOnWindowFocus:!0}),o=n=>{if(t.current)return;r(!0);let i=Promise.all([X.quota({force:n===`claude`},{signal:cK(sK)}).then(t=>e.setQueryData([`quota`],t)),e.refetchQueries({queryKey:[`authStatus`]})]).then(()=>{}).catch(()=>{}).finally(()=>{t.current=null,r(!1)});t.current=i};return(0,V.jsxs)(`div`,{"data-quota-bar":!0,className:`flex shrink-0 items-center gap-3 ${lK}`,children:[(0,V.jsx)(mK,{backend:`claude`,quota:i.data?.claude,auth:a.data?.claude,email:a.data?.emails?.claude,loading:i.isLoading,fetching:i.isFetching||n,onRecheck:()=>o(`claude`)}),(0,V.jsx)(mK,{backend:`codex`,quota:i.data?.codex,auth:a.data?.codex,email:a.data?.emails?.codex,loading:i.isLoading,fetching:i.isFetching||n,onRecheck:()=>o(`codex`)})]})}function mK({backend:e,quota:t,auth:n,email:r,loading:i,fetching:a,onRecheck:o}){let s=CU[e];if(!fK(t,n,i))return null;let c=hK(100-_K(t.windows).usedPercent);return(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(nK,{onOpenChange:e=>{e&&o()},children:[(0,V.jsx)(rK,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,"aria-label":`${s} quota: ${c}% remaining`,className:`flex items-center gap-1.5 min-w-0 rounded outline-none transition-opacity hover:opacity-80 focus-visible:ring-1 focus-visible:ring-border-strong`,children:[(0,V.jsx)(hW,{backend:e,className:uK[e]}),(0,V.jsxs)(`span`,{className:`tabular-nums ${vK(c)}`,children:[c,`%`]})]})}),(0,V.jsxs)(aK,{side:`bottom`,align:`start`,className:`w-[min(15rem,calc(100vw-1.5rem))] p-3 text-[11px] leading-relaxed text-fg`,children:[(0,V.jsxs)(`div`,{className:`mb-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,V.jsx)(hW,{backend:e}),(0,V.jsx)(`span`,{children:s}),t?.planType&&(0,V.jsxs)(`span`,{className:`text-muted/70`,children:[`· `,yK(t.planType),` plan`]}),a&&(0,V.jsx)(cw,{size:11,className:`animate-spin text-muted/60`,"aria-label":`Rechecking`})]}),r&&(0,V.jsx)(`div`,{"data-quota-account":!0,className:`truncate text-muted/70 select-text`,title:r,children:r})]}),(0,V.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[t.windows.map(e=>{let t=hK(100-e.usedPercent),n=bK(e);return(0,V.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`span`,{className:`text-muted/80`,children:e.label}),(0,V.jsxs)(`span`,{className:`flex items-center gap-2 tabular-nums`,children:[(0,V.jsxs)(`span`,{className:vK(t),children:[t,`% left`]}),n&&(0,V.jsxs)(`span`,{className:`text-muted/55`,children:[`resets `,n]})]})]},e.key)}),t.detail&&(0,V.jsx)(`li`,{className:`pt-1 text-muted/55`,children:t.detail})]})]})]})})}function hK(e){return Math.max(0,Math.min(100,Math.round(e)))}var gK=25;function _K(e){return e.find(e=>e.key===`5h`)??e.reduce((e,t)=>t.usedPercent>e.usedPercent?t:e)}function vK(e){return e<=8?`text-red-400`:e<=gK?`text-accent`:`text-fg/70`}function yK(e){return e&&e[0].toUpperCase()+e.slice(1)}function bK(e){if(!e.resetsAt)return null;let t=e.resetsAt*1e3,n=new Date(t);if(Number.isNaN(n.getTime()))return null;let r=t-Date.now();if(r<=0)return null;if(r<24*36e5){let e=n.getHours(),t=n.getMinutes(),r=e>=12?`pm`:`am`;return e=e%12||12,t===0?`${e}${r}`:`${e}:${String(t).padStart(2,`0`)}${r}`}return n.toLocaleDateString(void 0,{weekday:`short`})}var xK=`frizz:supervisor-status-wake`;function SK(e){return e!==null}function CK(e){return e?.updateRestart===!0&&e.updateAvailable!==!1}function wK(e){return e?.dev===!0}async function TK(e=fetch){try{let t=await e(`/_frizz/control/status`,{headers:{"cache-control":`no-store`}});if(!t.ok||!t.headers.get(`content-type`)?.includes(`application/json`))return null;let n=await t.json();return n.protocol===1&&(n.state===`ready`||n.state===`restarting`||n.state===`failed`)?n:null}catch{return null}}async function EK(e,t){let n=await t(e,{method:`POST`,headers:{"cache-control":`no-store`}}),r;try{r=await n.json()}catch{}if(!n.headers.get(`content-type`)?.includes(`application/json`)||!r||r.protocol!==1||r.state!==`ready`&&r.state!==`restarting`&&r.state!==`failed`)throw Error(`Frizz restart controls are unavailable for this server`);if(!n.ok)throw Error(r.message??`Restart request failed (${n.status})`);if(r.state===`failed`)throw Error(r.message??`Frizz did not become ready`);return r}function DK(e=fetch){return EK(`/_frizz/control/restart`,e)}function OK(e=fetch){return EK(`/_frizz/control/update-restart`,e)}var kK=`Install the latest version of Frizz. Your running threads will not be affected.`,AK=`A newer version of Frizz is available. Your running threads will not be affected.`,jK=`Restart Frizz. Your running threads will not be affected.`,MK=`fixed left-3 right-3 top-12 z-50 w-auto text-left font-sans sm:absolute sm:right-auto sm:-left-1.5 sm:top-[calc(100%+0.65rem)]`,NK=`sm:w-[min(23rem,calc(100vw-1.5rem))]`,PK=`sm:w-[min(34rem,calc(100vw-1.5rem))]`,FK=`rounded-xl bg-elevated p-3.5 shadow-xl shadow-black/45`;function IK({open:e,update:t,version:n,updateVersion:r}){if(!e)return null;let i=t?`Update Frizz`:`Restart Frizz`,a=t?r:void 0;return(0,V.jsxs)(`div`,{id:`update-restart-popover`,role:`tooltip`,"aria-label":i,className:`${MK} ${NK} ${FK} border border-border-strong`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-1.5 left-1.5 h-3 w-3 rotate-45 border-l border-t border-border-strong bg-elevated`}),(0,V.jsxs)(`div`,{className:`relative flex items-center gap-2.5`,children:[(0,V.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-fg/10 text-fg`,children:(0,V.jsx)(_w,{"aria-hidden":`true`,size:14,strokeWidth:2.25})}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-fg`,children:i}),n&&(0,V.jsx)(`span`,{className:`font-mono text-[11px] leading-snug text-muted`,children:a?`${n} → ${a}`:n})]})]}),(0,V.jsx)(`p`,{className:`relative mt-2.5 text-[12px] leading-relaxed text-muted`,children:t?a?AK:kK:jK})]})}var LK=`Frizz kept running the previous version, and your threads are unaffected.`;function RK({update:e,message:t,onDismiss:n}){return(0,V.jsxs)(`div`,{role:`alert`,className:`${MK} ${PK} ${FK} border border-red-500/45`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-1.5 left-1.5 h-3 w-3 rotate-45 border-l border-t border-red-500/45 bg-elevated`}),(0,V.jsxs)(`div`,{className:`relative flex items-center gap-2.5`,children:[(0,V.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-red-500/15 text-red-300`,children:(0,V.jsx)(kw,{"aria-hidden":`true`,size:14,strokeWidth:2.25})}),(0,V.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-fg`,children:e?`Update failed`:`Restart failed`}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Dismiss`,onClick:n,className:`-mr-1 ml-auto flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-border-strong`,children:(0,V.jsx)(jw,{"aria-hidden":`true`,size:14,strokeWidth:2.25})})]}),(0,V.jsx)(`p`,{className:`relative mt-2.5 text-[12px] leading-relaxed text-muted`,children:LK}),(0,V.jsx)(`pre`,{className:`relative mt-2.5 max-h-64 overflow-y-auto whitespace-pre-wrap break-words rounded-md border border-border bg-panel px-2.5 py-2 font-mono text-[11px] leading-relaxed text-fg/70`,children:t})]})}function zK({update:e,busy:t,updateVersion:n,onFocus:r,onBlur:i,onClick:a}){return(0,V.jsxs)(`button`,{type:`button`,"aria-describedby":`update-restart-popover`,"aria-label":e?`Update Frizz`:`Restart Frizz`,disabled:t,"aria-busy":t||void 0,className:`relative ${dW}`,onFocus:r,onBlur:i,onClick:a,children:[(0,V.jsx)(_w,{size:14,"aria-hidden":`true`,className:t?`animate-spin`:void 0}),e&&!t&&n&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-[2px] top-[2px] h-[4px] w-[4px] rounded-full bg-accent`})]})}function BK(){let e=Hf(Z),[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(),[s,c]=(0,B.useState)(),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)({}),h=(0,B.useRef)(!1),g=(0,B.useRef)(null);if((0,B.useEffect)(()=>{let e=!0;return TK().then(t=>{e&&(u(SK(t)),f(CK(t)),m({version:t?.version,updateVersion:t?.updateVersion}))}),()=>{e=!1}},[]),l!==!0)return null;let _=h.current&&e.controlPlaneState===`failed`?e.controlPlaneMessage??`Frizz did not become ready`:void 0,v=a??_,y=v&&v!==s?v:void 0,b=async()=>{if(r)return;h.current=!0,n(!1),i(!0),o(void 0),c(void 0);let e=`${window.location.pathname}${window.location.search}${window.location.hash}`;d&&(Z.controlPlaneState=`restarting`,Z.controlPlaneMessage=null,Z.controlPlaneRestartPending=!0);try{d?await OK():await DK(),d?(sessionStorage.setItem(`frizz:reload-after-update-restart`,e),window.dispatchEvent(new Event(xK)),i(!1)):window.location.replace(e)}catch(e){d&&(Z.controlPlaneRestartPending=!1,Z.controlPlaneState=`ready`,Z.controlPlaneMessage=null);let t=e.message.slice(0,140);i(!1),o(t),Q(`${d?`Update & Restart`:`Restart Frizz`} failed`)}};return(0,V.jsxs)(`div`,{ref:g,className:`relative`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[(0,V.jsx)(zK,{update:d,busy:r,updateVersion:p.updateVersion,onFocus:()=>n(!0),onBlur:()=>n(!1),onClick:()=>void b()}),y&&(0,V.jsx)(RK,{update:d,message:y,onDismiss:()=>c(y)}),(0,V.jsx)(IK,{open:t&&!y,update:d,version:p.version,updateVersion:p.updateVersion})]})}function VK(){return(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`})}function HK({state:e,fallback:t}){let n={open:{cls:`bg-live`,word:`connected`},connecting:{cls:`bg-accent`,word:`connecting…`},closed:{cls:`bg-red-500`,word:`disconnected`}}[e],r=t?`connected · SSE fallback`:n.word;return(0,V.jsx)(`span`,{role:`img`,"aria-label":r,title:r,"data-board-sync-fallback":t||void 0,className:`h-1.5 w-1.5 shrink-0 rounded-full ${t?`bg-accent`:n.cls}`})}function UK(){let e=Hf(Z),t=iY($A()),n=dK(),r=e.connection===`open`&&!!e.socketBoardFallback,i=t.state===`verified`?t.repo:t.state===`local`?t.name:null,a=t.state===`verified`?t.label:i??void 0,o=t.state===`verified`?`Project: ${t.label}`:t.state===`local`?`Project: ${t.name}; local repository with no git remote`:t.state===`loading`?`Project identity loading`:`Project identity unavailable`;return(0,V.jsxs)(`div`,{"data-status-row":!0,className:`mb-2.5 flex min-w-0 items-center gap-3 text-[12px]`,children:[(0,V.jsx)(`a`,{href:`/`,title:`All projects`,"aria-label":`All projects`,className:`${dW} -ml-px`,children:(0,V.jsx)(nw,{size:14,"aria-hidden":`true`})}),(0,V.jsx)(VK,{}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Settings`,title:`Settings`,className:dW,onClick:()=>Z.showSettings=!0,children:(0,V.jsx)(bw,{size:14,"aria-hidden":`true`})}),(0,V.jsx)(BK,{}),n&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(VK,{}),(0,V.jsx)(pK,{})]}),(0,V.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-center gap-1.5`,"data-project-identity-state":t.state,"aria-label":o,"aria-busy":t.state===`loading`||void 0,children:[(0,V.jsx)(HK,{state:e.connection,fallback:r}),i?(0,V.jsx)(`span`,{className:`block min-w-0 truncate font-semibold text-fg/90`,title:a,children:i}):(0,V.jsx)(`span`,{className:`identity-placeholder w-24`,"aria-hidden":`true`})]})]})}var WK=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),GK=`VisuallyHidden`,KK=B.forwardRef((e,t)=>(0,V.jsx)(KN.span,{...e,ref:t,style:{...WK,...e.style}}));KK.displayName=GK;var qK=KK,[JK,vte]=CN(`Tooltip`,[$I]),YK=$I(),XK=`TooltipProvider`,ZK=700,QK=`tooltip.open`,[$K,eq]=JK(XK),tq=e=>{let{__scopeTooltip:t,delayDuration:n=ZK,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=B.useRef(!0),s=B.useRef(!1),c=B.useRef(0);return B.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,V.jsx)($K,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:B.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:B.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:B.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};tq.displayName=XK;var nq=`Tooltip`,[rq,iq]=JK(nq),aq=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=eq(nq,e.__scopeTooltip),l=YK(t),[u,d]=B.useState(null),f=PP(),p=B.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=B.useRef(!1),[_,v]=AN({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(QK))):c.onClose(),a?.(e)},caller:nq}),y=B.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=B.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=B.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=B.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return B.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,V.jsx)(hL,{...l,children:(0,V.jsx)(rq,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:B.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:B.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};aq.displayName=nq;var oq=`TooltipTrigger`,sq=B.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=iq(oq,n),a=eq(oq,n),o=YK(n),s=SN(t,B.useRef(null),i.onTriggerChange),c=B.useRef(!1),l=B.useRef(!1),u=B.useCallback(()=>c.current=!1,[]);return B.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,V.jsx)(gL,{asChild:!0,...o,children:(0,V.jsx)(KN.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:yN(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:yN(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:yN(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:yN(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:yN(e.onBlur,i.onClose),onClick:yN(e.onClick,i.onClose)})})});sq.displayName=oq;var cq=`TooltipPortal`,[lq,uq]=JK(cq,{forceMount:void 0}),dq=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=iq(cq,t);return(0,V.jsx)(lq,{scope:t,forceMount:n,children:(0,V.jsx)(SL,{present:n||a.open,children:(0,V.jsx)(bL,{asChild:!0,container:i,children:r})})})};dq.displayName=cq;var fq=`TooltipContent`,pq=B.forwardRef((e,t)=>{let n=uq(fq,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=iq(fq,e.__scopeTooltip);return(0,V.jsx)(SL,{present:r||o.open,children:o.disableHoverableContent?(0,V.jsx)(vq,{side:i,...a,ref:t}):(0,V.jsx)(mq,{side:i,...a,ref:t})})}),mq=B.forwardRef((e,t)=>{let n=iq(fq,e.__scopeTooltip),r=eq(fq,e.__scopeTooltip),i=B.useRef(null),a=SN(t,i),[o,s]=B.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=B.useCallback(()=>{s(null),d(!1)},[d]),p=B.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Sq(r,xq(r,n.getBoundingClientRect())),a=Cq(t.getBoundingClientRect()),o=Tq([...i,...a]);s(o),d(!0)},[d]);return B.useEffect(()=>()=>f(),[f]),B.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),B.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!wq(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,V.jsx)(vq,{...e,ref:a})}),[hq,gq]=JK(nq,{isInside:!1}),_q=FN(`TooltipContent`),vq=B.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=iq(fq,n),l=YK(n),{onClose:u}=c;return B.useEffect(()=>(document.addEventListener(QK,u),()=>document.removeEventListener(QK,u)),[u]),B.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,V.jsx)(iP,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,V.jsxs)(_L,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,V.jsx)(_q,{children:r}),(0,V.jsx)(hq,{scope:n,isInside:!0,children:(0,V.jsx)(qK,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});pq.displayName=fq;var yq=`TooltipArrow`,bq=B.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=YK(n);return gq(yq,n).isInside?null:(0,V.jsx)(vL,{...i,...r,ref:t})});bq.displayName=yq;function xq(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Sq(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Cq(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function wq(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Tq(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Eq(t)}function Eq(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Dq=tq,Oq=aq,kq=sq,Aq=dq,jq=pq,Mq=bq;function Nq({children:e}){return(0,V.jsx)(Dq,{delayDuration:0,skipDelayDuration:0,disableHoverableContent:!0,children:e})}function Pq({label:e,children:t,side:n=`top`,clickable:r=!1,multiline:i=!1,disabled:a=!1}){let o=i?`whitespace-pre-line`:`whitespace-normal`,[s,c]=(0,B.useState)(!1),l=(0,B.useId)(),u=r&&(0,B.isValidElement)(t)?t:null,d=u?(0,B.cloneElement)(u,{"aria-describedby":l}):t,f=(0,B.useRef)(null);if(u){let t=f.current?.getBoundingClientRect(),n=t?Math.min(Math.max(12,t.right+8),window.innerWidth-364):12,r=t?Math.min(Math.max(12,t.top-6),window.innerHeight-96):12;return(0,V.jsxs)(`span`,{ref:f,className:`inline-flex`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onFocus:()=>c(!0),onBlur:()=>c(!1),onClick:()=>c(e=>!e),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),c(!1))},children:[d,s&&(0,Xd.createPortal)((0,V.jsx)(`span`,{id:l,role:`tooltip`,className:`z-[250] max-w-[min(22rem,calc(100vw-1.5rem))] rounded-md border border-border bg-elevated px-3 py-2 text-[11px] leading-relaxed text-fg shadow-md shadow-black/40 break-words ${o}`,style:{position:`fixed`,left:n,top:r},children:e}),document.body)]})}return(0,V.jsxs)(Oq,{open:s&&!a,onOpenChange:c,children:[(0,V.jsx)(kq,{asChild:!0,children:d}),(0,V.jsx)(Aq,{children:(0,V.jsxs)(jq,{id:l,side:n,sideOffset:5,collisionPadding:12,className:`${wV} max-w-[min(22rem,calc(100vw-1.5rem))] select-none rounded-md border border-border bg-elevated px-3 py-2 text-[11px] leading-relaxed text-fg shadow-md shadow-black/40 break-words ${o}`,children:[e,(0,V.jsx)(Mq,{className:`fill-elevated`})]})})]})}var Fq=Rf({at:{}}),Iq=12e3,Lq=new Map;function Rq(e,t=Date.now()){Fq.at[e]=t;let n=Lq.get(e);n!==void 0&&clearTimeout(n),Lq.set(e,setTimeout(()=>{Lq.delete(e),delete Fq.at[e]},Iq))}function zq(e){let t=Lq.get(e);t!==void 0&&(clearTimeout(t),Lq.delete(e)),delete Fq.at[e]}function Bq(e,t,n=Date.now()){if(t===void 0||n-t>12e3)return!1;let r=e.lastActivityAt?Date.parse(e.lastActivityAt):NaN;return!(Number.isFinite(r)&&r>t)}function Vq(){return Hf(Fq).at}function Hq(e,t,n=Date.now()){return t===void 0||!Bq(e,t,n)?e:{...e,runtime:`running`,needsYou:!1,pendingAsk:void 0,pendingQuestion:!1,actionableInteraction:!1,lastUserAt:new Date(t).toISOString()}}function Uq(e){let t=Vq();return(0,B.useMemo)(()=>e.map(e=>Hq(e,t[e.id])),[e,t])}var Wq=0;function Gq(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():(Wq+=1,`browser-${Date.now()}-${Wq}`)}function Kq({optimistic:e,request:t,success:n,failure:r}){e(),t().then(()=>n?.(),e=>r(e instanceof Error?e:Error(String(e))))}var qq=new Map;function Jq(e,t){let n=(qq.get(e)??Promise.resolve()).then(t,t);return qq.set(e,n.then(()=>{},()=>{})),n}var Yq=[300,800,1800,3500],Xq=e=>new Promise(t=>{setTimeout(t,e)});async function Zq(e,t,n=Xq){for(let r=0;;r++){try{await e()}catch(e){if(r>=Yq.length||!Qx(e))throw e;t(),await n(Yq[r]);continue}t();return}}function Qq(e,t,n,r,i){return Zq(()=>X.followUp({slug:e,sessionId:iC(Z.board,e)?.sessionId??``,message:t,deliveryId:n,freshProcess:r,interrupt:i}),()=>Rq(e))}function $q(e,t,n,r={}){let i=n.trim();if(!i)return!1;let a=Gq();return Kq({optimistic:()=>{r.onOptimistic?.(),pj(e,t,i,{scrollToBottom:r.scrollToBottom,deliveryId:a}),Rq(t),X.markRead({slug:t}).catch(()=>{})},request:()=>Jq(t,()=>Qq(t,i,a,r.freshProcess,r.interrupt)),success:()=>r.onSuccess?.(),failure:n=>{mj(e,t,i,a),zq(t),r.onRollback?.(),Q(r.failureToast?.(n.message)??`Steer failed — ${n.message.slice(0,90)}`)}}),!0}function eJ(e){let t=Md(),[n,r]=(0,B.useState)(0);return{submit:(0,B.useCallback)((n,i={})=>$q(t,e,n,{...i,onOptimistic:()=>{r(e=>e+1),i.onOptimistic?.()},onSuccess:()=>{r(e=>Math.max(0,e-1)),i.onSuccess?.()},onRollback:()=>{r(e=>Math.max(0,e-1)),i.onRollback?.()}}),[t,e]),pending:n>0}}function tJ(e,t){return new Promise(n=>{$q(e,t,`Continue exactly where you left off.`,{onSuccess:()=>{Q(`Retrying…`),n()},onRollback:()=>n(),failureToast:e=>`Retry failed: ${e.slice(0,80)}`})||n()})}function nJ(e){let t=/^([A-Za-z0-9][\w.-]*)\/([A-Za-z0-9][\w.-]*)#(\d+)$/.exec(e.trim());return t?`https://github.com/${t[1]}/${t[2]}/pull/${t[3]}`:null}var rJ=`Snooze`;function iJ(e,t=Date.now()){return null}function aJ(e){let t=new Set;return e.flatMap(e=>{if(e.kind!==`pr`)return[];let n=e.value.trim();return!n||t.has(n)?[]:(t.add(n),[{ref:n,url:nJ(n)}])})}function oJ(e){let t=(e.body??``).split(/\n\s*\n/).map(e=>e.trim()).find(Boolean);return t?lJ(sJ(t.replace(/\s*\n\s*/g,` `))):null}function sJ(e){if(e.length<=cJ)return e;let t=e.slice(0,cJ),n=t.lastIndexOf(` `);return`${(n>cJ/2?t.slice(0,n):t).replace(/[.,;:]$/,``)}…`}var cJ=240;function lJ(e){let t=(e.split(/\s/,1)[0]??``).replace(/[.,:;]+$/,``);return/[^a-zA-Z]/.test(t)||/[A-Z]/.test(t.slice(1))||uJ.has(t)?e:e.charAt(0).toUpperCase()+e.slice(1)}var uJ=new Set([`npm`,`npx`,`pnpm`,`nub`,`nubx`,`gh`,`git`,`node`,`bun`,`tsc`,`vite`,`curl`,`ssh`]);function dJ(e){return mJ(e)||`Waiting for an external update.`}function fJ(e){return e&&mJ(e)||null}var pJ=new Set([...ky,`shells`,`agents`,`timers`,`prs`,`for`]);function mJ(e){return e.split(`
369
+ `+e.slice(r)),requestAnimationFrame(()=>t.setSelectionRange(n+1,n+1)))})}e.key===`Escape`&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.stopPropagation(),t.blur())}return(0,V.jsxs)(`div`,{className:`group relative rounded-xl border bg-bg transition-colors focus-within:border-accent ${g?`border-dashed border-accent`:`border-border`}`,onDragOver:e=>{[...e.dataTransfer.items].some(e=>e.kind===`file`)&&(e.preventDefault(),_(!0))},onDragLeave:()=>_(!1),onDrop:e=>{e.preventDefault(),_(!1),E(e.dataTransfer.files)},children:[g&&(0,V.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-xl bg-bg/80 text-[12px] text-muted`,children:`Drop file to attach`}),F&&(0,V.jsx)(`div`,{ref:te,"data-slash-menu":!0,className:`absolute bottom-full left-0 right-0 z-20 mb-1.5 max-h-56 overflow-y-auto rounded-lg border border-border bg-bg py-1 shadow-lg`,children:ee.map((e,t)=>(0,V.jsxs)(`button`,{type:`button`,"data-suggest-index":t,onMouseDown:e=>e.preventDefault(),onClick:()=>ne(e),onMouseEnter:()=>j(t),className:`flex w-full items-baseline gap-2 px-3.5 py-1.5 text-left ${t===A?`bg-panel-2`:``}`,children:[(0,V.jsxs)(`span`,{className:`shrink-0 text-[12px] font-medium text-fg`,children:[`/`,e.name]}),e.description&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-muted`,children:e.description})]},e.name))}),(0,V.jsx)(`textarea`,{id:a,ref:m,"data-surface":r,value:b,autoFocus:c,disabled:l,onChange:e=>w(e.target.value),onKeyDown:ae,onPaste:e=>{let t=[...e.clipboardData.items].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(Boolean);t.length&&(e.preventDefault(),E(t))},placeholder:i,rows:1,spellCheck:!1,style:{minHeight:o,maxHeight:s},className:`block w-full resize-none bg-transparent px-3.5 ${u?`py-2.5 pb-3`:`py-2.5 ${ie?jH:MH}`} text-[13px] leading-relaxed text-fg outline-none placeholder:text-muted scrollbar-none disabled:opacity-60`}),x.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5 px-3 pb-2 ${ie?`pr-[6.6875rem]`:`pr-20`}`,children:x.map((e,t)=>(0,V.jsx)(qH,{attachment:e,disabled:l,onRemove:()=>T(S.filter((e,n)=>n!==t))},`${e.path}-${t}`))}),u&&(0,V.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1 pl-1.5 pb-1.5 ${ie?`pr-[6.6875rem]`:`pr-20`}`,children:u}),ie&&(0,V.jsx)(`div`,{className:`absolute bottom-2 right-[43px] flex items-center`,children:ie}),(0,V.jsx)(`input`,{ref:h,type:`file`,multiple:!0,accept:my,className:`hidden`,onChange:e=>{E(e.target.files),e.target.value=``}}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>h.current?.click(),disabled:l||v,title:`Attach files`,"aria-label":`Attach files`,className:`absolute bottom-2 ${ie?kH:AH} flex h-7 w-7 items-center justify-center rounded-lg text-muted transition-[color,background-color] enabled:hover:bg-panel-2/70 enabled:hover:text-fg disabled:opacity-50`,children:v?(0,V.jsx)(cw,{size:15,strokeWidth:2,className:`animate-spin`}):(0,V.jsx)(pw,{size:15,strokeWidth:2})}),(0,V.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:n,disabled:!re||l||v,title:`Send (Enter)`,"aria-label":`Send`,className:`absolute bottom-2 ${OH} flex h-7 w-7 items-center justify-center rounded-lg transition-all ${re&&!l&&!v?`bg-fg text-bg hover:opacity-90 active:scale-95`:`bg-panel-2 text-muted`}`,children:l?(0,V.jsx)(cw,{size:14,strokeWidth:2.5,className:`animate-spin`}):(0,V.jsx)(DC,{size:14,strokeWidth:2.5})})]})}function qH({attachment:e,disabled:t,onRemove:n}){let[r,i]=(0,B.useState)(!1),a=e.path.split(`/`).filter(Boolean).pop()||e.path,o=(a.includes(`.`)?a.split(`.`).pop():``).toUpperCase();return(0,V.jsxs)(`div`,{className:`group/att relative h-11 w-11`,title:a,children:[e.kind===`image`&&!r?(0,V.jsx)(`img`,{src:RH(e.path),alt:a,onError:()=>i(!0),className:`h-11 w-11 rounded-md border border-border object-cover`}):(0,V.jsxs)(`div`,{className:`flex h-11 w-11 flex-col items-center justify-center gap-0.5 rounded-md border border-border bg-panel-2 px-1`,children:[(0,V.jsx)(qC,{size:15,strokeWidth:2,className:`shrink-0 text-muted`}),o&&(0,V.jsx)(`span`,{className:`max-w-full truncate text-[8px] font-medium leading-none text-muted/80`,children:o})]}),(0,V.jsx)(`button`,{type:`button`,onClick:n,disabled:t,title:`Remove ${a}`,"aria-label":`Remove ${a}`,className:`absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full border border-border bg-bg text-muted opacity-0 transition-opacity hover:text-fg focus-visible:opacity-100 group-hover/att:opacity-100 disabled:hidden`,children:(0,V.jsx)(jw,{size:10,strokeWidth:2.5})})]})}function JH(){return qd({queryKey:[`githubStatus`],queryFn:()=>X.githubStatus(),staleTime:3e4,refetchOnWindowFocus:!0,refetchInterval:e=>{let t=e.state.data;return t?.inRepo&&t.authed?!1:6e4}})}function YH(){let e=JH();return!!(e.data?.inRepo&&e.data.authed)}function XH({className:e=``}){return YH()?(0,V.jsx)(`button`,{type:`button`,onClick:MS,onMouseDown:e=>e.preventDefault(),title:`Investigate this issue and make recommendations`,"aria-label":`Investigate this issue and make recommendations`,className:`flex h-7 w-7 items-center justify-center rounded-lg text-muted outline-none transition-[color,background-color,box-shadow] enabled:hover:bg-panel-2/70 enabled:hover:text-fg enabled:focus-visible:bg-panel-2/70 enabled:focus-visible:text-muted enabled:focus-visible:ring-1 enabled:focus-visible:ring-muted/80 enabled:focus-visible:ring-offset-1 enabled:focus-visible:ring-offset-bg enabled:active:bg-elevated enabled:active:text-muted disabled:bg-transparent disabled:text-muted/35 ${e}`,children:(0,V.jsx)(ew,{size:15,strokeWidth:2})}):null}var ZH=`prompt-control-type petite-caps`,QH=ZH,$H=ZH,eU=`profile-grid-cell relative flex h-6 cursor-pointer select-none items-center justify-start rounded border border-transparent px-1 text-left text-muted outline-none transition-colors ${QH} data-[highlighted]:border-border data-[highlighted]:bg-panel-2 data-[highlighted]:text-fg data-[highlighted]:outline data-[highlighted]:outline-1 data-[highlighted]:outline-offset-1 data-[highlighted]:outline-fg/55 data-[state=checked]:border-accent/70 data-[state=checked]:bg-accent/10 data-[state=checked]:font-medium data-[state=checked]:text-fg data-[state=checked]:ring-1 data-[state=checked]:ring-inset data-[state=checked]:ring-accent/90`;function tU(e){return`minmax(6rem, 7rem) repeat(${Math.max(0,e)}, auto)`}var nU=[`ultra`,`ultracode`],rU=[`low`,`medium`,`high`,`xhigh`,`max`,...nU];function iU(e){return[...new Set(e.flatMap(e=>e.options.flatMap(e=>e.efforts)))].sort((e,t)=>{let n=rU.indexOf(e),r=rU.indexOf(t);return n===-1&&r===-1?e.localeCompare(t):n===-1?1:r===-1?-1:n-r})}function aU(e){let t=[];for(let n of iU(e)){let e=nU.includes(n)?t.find(e=>nU.includes(e[0])):void 0;e?e.push(n):t.push([n])}return t}function oU(e){return e.flatMap(e=>e.options.flatMap(t=>t.efforts.map(n=>({provider:e.id,model:t.model,effort:n}))))}function sU(e){return JSON.stringify([e.provider,e.model,e.effort])}function cU(e,t){return oU(e).find(e=>sU(e)===t)}function lU(e,t){return!t?.model||!t.effort?!1:e.some(e=>(!t.provider||e.id===t.provider)&&e.options.some(e=>e.model===t.model&&e.efforts.includes(t.effort)))}function uU(e,t,n=`Profile unknown`){if(!t?.model&&!t?.effort)return n;let r=e.flatMap(e=>e.options).find(e=>e.model===t.model)?.label??t.model??`Model unknown`;return t.effort?`${r} › ${t.effort}`:r}function dU(e,t,n){let r=aU(e),i=e=>r.findIndex(t=>t.includes(e)),a=e.flatMap(e=>e.options.map(t=>({provider:e.id,option:t}))),o=a.findIndex(e=>e.provider===t.provider&&e.option.model===t.model);if(o===-1)return null;let s=a[o],c=s.option.efforts.indexOf(t.effort);if(c===-1)return null;if(n===`Home`||n===`End`||n===`ArrowLeft`||n===`ArrowRight`){let e=n===`Home`?0:n===`End`?s.option.efforts.length-1:c+(n===`ArrowLeft`?-1:1),t=s.option.efforts[e];return t?{provider:s.provider,model:s.option.model,effort:t}:null}let l=a[o+(n===`ArrowUp`?-1:1)];if(!l)return null;let u=i(t.effort),d=l.option.efforts.reduce((e,t)=>e?Math.abs(i(t)-u)<Math.abs(i(e)-u)?t:e:t,void 0);return d?{provider:l.provider,model:l.option.model,effort:d}:null}var fU,pU=!1;function mU(){pU||typeof window>`u`||(pU=!0,window.addEventListener(`keydown`,e=>{e.key!==`Escape`||!fU||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),gU())},{capture:!0}))}function hU(e){mU();let t={dismiss:e};return fU=t,()=>{fU===t&&(fU=void 0)}}function gU(){let e=fU;return e?(fU=void 0,e.dismiss(),!0):!1}function _U(e){gU()&&e.preventDefault(),e.stopPropagation()}function vU(e){return e===`xhigh`?`X-high`:e.charAt(0).toUpperCase()+e.slice(1)}function yU({groups:e,value:t,pending:n,onValueChange:r,placeholder:i,ariaLabel:a,menuAriaLabel:o=`Choose model and effort`,title:s,disabled:c=!1,compact:l=!1,side:u=`bottom`,menuZClass:d=xV,className:f=``}){let[p,m]=(0,B.useState)(!1),h=(0,B.useRef)(p),g=(0,B.useRef)(c),_=(0,B.useRef)(void 0),v=(0,B.useRef)(new Map),y=(0,B.useRef)(void 0),b=(0,B.useMemo)(()=>aU(e),[e]),x=(0,B.useMemo)(()=>e.flatMap(e=>e.options.flatMap(t=>t.efforts.map(n=>({provider:e.id,model:t.model,effort:n})))),[e]),S=l?$H:QH,C=c?`cursor-not-allowed opacity-45`:`cursor-pointer transition-colors hover:border-border hover:bg-panel-2 hover:text-fg`,w=lU(e,t),T=w&&t?.provider&&t.model&&t.effort?sU(t):void 0,E=n?.model||n?.effort?uU(e,n,`Pending profile`):void 0;h.current=p,g.current=c;function D(){h.current=!1,_.current=void 0,m(!1)}(0,B.useLayoutEffect)(()=>{let e=e=>{e.key!==`Escape`||!h.current||g.current||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_.current?.(),D())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]),(0,B.useLayoutEffect)(()=>{!c||!p||(_.current?.(),D())},[c,p]),(0,B.useLayoutEffect)(()=>()=>_.current?.(),[]),(0,B.useLayoutEffect)(()=>{T===y.current&&(y.current=void 0)},[T]);function O(e){let t=sU(e);y.current!==t&&(y.current=t,r(e))}function k(t,n){if(![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(t.key))return;let r=dU(e,n,t.key);r&&(t.preventDefault(),t.stopPropagation(),v.current.get(sU(r))?.focus())}return(0,V.jsxs)(lV,{modal:!1,open:p,onOpenChange:e=>{_.current?.(),_.current=void 0,h.current=e,m(e),e&&(_.current=hU(D))},children:[(0,V.jsx)(uV,{asChild:!0,disabled:c,children:(0,V.jsxs)(`button`,{type:`button`,"aria-label":a,"aria-invalid":!w&&(t?.model||t?.effort)?!0:void 0,"aria-description":E?`Pending ${E}`:void 0,title:s,"data-profile-known":w?`true`:`false`,"data-profile-pending":E?`true`:void 0,className:`profile-grid-trigger group inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border border-border/50 bg-transparent px-2 py-1 text-left text-muted outline-none data-[state=open]:border-border data-[state=open]:bg-panel-2 ${C} ${f} ${S}`,children:[(0,V.jsx)(`span`,{className:`profile-grid-value relative -top-px min-w-0 flex-1 truncate text-left ${S}`,children:uU(e,t,i)}),E&&(0,V.jsx)(cw,{"aria-hidden":`true`,size:l?10:11,className:`shrink-0 animate-spin text-muted/65`}),(0,V.jsx)(MC,{"aria-hidden":`true`,size:l?11:13,className:`shrink-0 text-fg/65 transition-transform group-data-[state=open]:rotate-180`})]})}),(0,V.jsx)(dV,{children:(0,V.jsxs)(fV,{"aria-label":o,align:`start`,side:u,sideOffset:5,collisionPadding:8,onEscapeKeyDown:e=>e.stopPropagation(),className:`profile-grid-menu ${d} ${bV} max-h-[min(360px,var(--radix-dropdown-menu-content-available-height))] max-w-[calc(100vw-1rem)] overflow-auto rounded-lg p-1.5 ${S}`,children:[e.map(t=>(0,V.jsxs)(pV,{children:[t.label&&(0,V.jsx)(mV,{className:`px-1.5 pb-1 pt-1 text-left font-medium tracking-[0.07em] text-muted/55 first:pt-0.5`,children:t.label}),(0,V.jsx)(gV,{value:T,onValueChange:t=>{let n=cU(e,t);n&&O(n)},children:t.options.map(e=>(0,V.jsxs)(`div`,{"data-profile-grid-row":e.model,className:`grid w-max items-center gap-1 py-0.5`,style:{gridTemplateColumns:tU(b.length)},children:[(0,V.jsx)(`span`,{className:`profile-grid-model-label min-w-0 max-w-[9.5rem] truncate px-1.5 text-left text-muted ${S}`,title:e.label,children:e.label}),b.map(n=>{let r=n.find(t=>e.efforts.includes(t)),i=n.reduce((e,t)=>vU(t).length>vU(e).length?t:e);if(!r)return(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`invisible cursor-default border border-transparent px-1 text-left font-medium ${S}`,children:vU(i)},i);let a={provider:t.id,model:e.model,effort:r},o=sU(a);return(0,V.jsx)(_V,{value:o,ref:e=>{e?v.current.set(o,e):v.current.delete(o)},onKeyDown:e=>k(e,a),onSelect:e=>{e.preventDefault(),O(a),_.current?.(),D()},"aria-label":`${e.label}, ${vU(r)} effort`,title:`${e.label} › ${vU(r)}`,className:eU,children:(0,V.jsxs)(`span`,{className:`grid`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`invisible col-start-1 row-start-1 font-medium`,children:vU(r)}),(0,V.jsx)(`span`,{className:`col-start-1 row-start-1`,children:vU(r)})]})},r)})]},e.model))}),t!==e.at(-1)&&(0,V.jsx)(yV,{className:`my-1 h-px bg-border`})]},t.id)),x.length===0&&(0,V.jsx)(`div`,{className:`px-2 py-1.5 text-muted/60`,children:`No profiles available`})]})})]})}async function bU(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}if(!xU(e))throw Error(`the browser blocked clipboard access`)}function xU(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`0`,t.style.left=`0`,t.style.opacity=`0`,document.body.append(t);let n=document.getSelection(),r=n&&n.rangeCount>0?n.getRangeAt(0):null;t.select(),t.setSelectionRange(0,e.length);let i=!1;try{i=document.execCommand(`copy`)}catch{i=!1}return t.remove(),r&&n&&(n.removeAllRanges(),n.addRange(r)),i}var SU={claude:`claude auth login`,codex:`codex login`},CU={claude:`Claude`,codex:`Codex`};function wU(e){let t=e.trim();return t===`/login`?`login`:t===`/logout`?`logout`:null}var TU=(0,B.lazy)(()=>HO(()=>import(`./TerminalPane-ubcEP7X3.js`).then(e=>({default:e.TerminalPane})),__vite__mapDeps([0,1])));function EU({backend:e,onClose:t,onAuthed:n}){let r=Md(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(null),c=(0,B.useRef)(!1),l=SU[e],u=CU[e],d=Jd({mutationFn:()=>X.accountLoginStart({backend:e}),onSuccess:e=>{c.current=!1,s(e.attemptId)},onError:e=>Q(`Couldn't start the sign-in terminal: ${e.message.slice(0,80)} — use the command below instead`,{duration:7e3})}),f=qd({queryKey:[`accountLoginStatus`,o],queryFn:()=>X.accountLoginStatus({attemptId:o}),enabled:!!o,refetchInterval:2e3});(0,B.useEffect)(()=>{if(!o||c.current)return;let t=f.data;if(!(!t||t.state===`running`||t.state===`unknown`)){if(c.current=!0,t.auth!==`signed-out`){r.setQueryData([`authStatus`],n=>n&&{...n,[e]:t.auth}),Q(`Signed in to ${u}`),n();return}Q(`${u} sign-in didn't complete — try again or use the command below`,{duration:7e3}),s(null)}},[o,f.data,e,u]);function p(){o&&!c.current&&X.accountLoginCancel({attemptId:o}).catch(()=>{})}let m=(0,B.useRef)({attempt:null,settled:!1});m.current={attempt:o,settled:c.current},(0,B.useEffect)(()=>()=>{let{attempt:e,settled:t}=m.current;e&&!t&&X.accountLoginCancel({attemptId:e}).catch(()=>{})},[]);async function h(){try{await bU(l),a(!0),window.setTimeout(()=>a(!1),1500)}catch{Q(`Couldn't copy — select the command and copy it manually`,{duration:6e3})}}let g=Jd({mutationFn:()=>X.authStatus(),onSuccess:t=>{if(r.setQueryData([`authStatus`],t),t[e]===`signed-out`){Q(`Still signed out of ${u} — run the command, then retry`,{duration:6e3});return}n()},onError:()=>n()});return(0,V.jsx)(FV,{open:!0,onOpenChange:e=>{e||(p(),t())},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] ${o?`w-[680px]`:`w-[440px]`} max-w-[92vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,V.jsxs)(QV,{className:`mb-1 text-[14px] font-medium`,children:[`Signed out of `,u]}),o?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:`mb-3 text-[12.5px] leading-relaxed text-muted`,children:[`This terminal is running `,(0,V.jsx)(`code`,{className:`font-mono-keep text-fg/90`,children:l}),` — follow its prompts (it may open your browser). Frizz detects completion automatically.`]}),(0,V.jsx)(`div`,{className:`mb-4 h-[340px] overflow-hidden rounded-lg border border-border bg-[#0d0e10]`,children:(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-muted`,children:`Opening terminal…`}),children:(0,V.jsx)(TU,{slug:o})})}),(0,V.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>{p(),s(null)},className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:`Cancel sign-in`})})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:`mb-4 text-[12.5px] leading-relaxed text-muted`,children:[`Frizz can't start a `,u,` thread until you're signed in. Sign in here, or run the command in your own terminal and retry:`]}),(0,V.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg border border-border bg-panel-2 px-3 py-2`,children:[(0,V.jsx)(`code`,{className:`flex-1 select-all font-mono-keep text-[12.5px] text-fg`,children:l}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Copy command`,onClick:h,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel hover:text-fg`,children:i?(0,V.jsx)(jC,{size:14,strokeWidth:2,className:`text-green-400`}):(0,V.jsx)(WC,{size:14,strokeWidth:1.8})})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>g.mutate(),disabled:g.isPending,className:`flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-[12.5px] text-fg/90 outline-none transition-colors hover:bg-panel-2 disabled:opacity-60`,children:[g.isPending&&(0,V.jsx)(cw,{size:13,className:`animate-spin`}),`Retry`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>d.mutate(),disabled:d.isPending,className:`flex items-center gap-1.5 rounded-md bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white outline-none transition-opacity hover:opacity-90 disabled:opacity-60`,children:[d.isPending&&(0,V.jsx)(cw,{size:13,className:`animate-spin`}),`Sign in here`]})]})]})]})]})})}function DU({backend:e,onClose:t}){let n=Md(),r=CU[e],i=Jd({mutationFn:()=>X.accountLogout({backend:e}),onSuccess:i=>{n.setQueryData([`authStatus`],t=>t&&{...t,[e]:i.auth}),i.status===`done`?Q(`Signed out of ${r}`):i.status===`blocked`?Q(`Not signed out — ${i.activeThreads} active ${r} thread${i.activeThreads===1?``:`s`}. Let them finish (or complete them) first.`,{duration:7e3}):Q(`${r} sign-out failed: ${i.detail??`unknown error`}`,{duration:7e3}),t()},onError:e=>{Q(`${r} sign-out failed: ${e.message.slice(0,80)}`,{duration:7e3}),t()}});return(0,V.jsx)(FV,{open:!0,onOpenChange:e=>{!e&&!i.isPending&&t()},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] w-[420px] max-w-[86vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,V.jsxs)(QV,{className:`mb-1 text-[14px] font-medium`,children:[`Sign out of `,r,`?`]}),(0,V.jsxs)(`p`,{className:`mb-4 text-[12.5px] leading-relaxed text-muted`,children:[`New `,r,` threads will be blocked until you sign in again. Running `,r,` threads are left untouched — sign-out is refused while any are active.`]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:t,disabled:i.isPending,className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-60`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>i.mutate(),disabled:i.isPending,className:`flex items-center gap-1.5 rounded-md bg-red-500/90 px-3 py-1.5 text-[12.5px] font-medium text-white outline-none transition-opacity hover:opacity-90 disabled:opacity-60`,children:[i.isPending&&(0,V.jsx)(cw,{size:13,className:`animate-spin`}),`Sign out`]})]})]})]})})}var OU=xb.options,kU={auto:`Auto`,default:`Default`,acceptEdits:`Accept edits`,plan:`Plan`,bypassPermissions:`Bypass`},AU={auto:`auto — safe actions auto-approved, risky ones prompt`,default:`default — prompt for every permission`,acceptEdits:`accept edits — file edits auto-approved`,plan:`plan — read-only planning, approval before changes`,bypassPermissions:`bypass — never prompt (dangerous)`};OU.filter(e=>e!==`plan`).map(e=>({value:e,label:kU[e],title:AU[e]}));var jU=[`auto`,`bypassPermissions`].map(e=>({value:e,label:kU[e],title:AU[e]})),MU=[{value:`fable`,label:`Fable`},{value:`opus`,label:`Opus`},{value:`sonnet`,label:`Sonnet`},{value:`haiku`,label:`Haiku`}];new Set([{slug:`gpt-5.6-sol`,displayName:`GPT-5.6 Sol`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-terra`,displayName:`GPT-5.6 Terra`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-luna`,displayName:`GPT-5.6 Luna`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`]},{slug:`gpt-5.5`,displayName:`GPT-5.5`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`]}].map(e=>e.slug));function NU(e){return e===`plan`?`auto`:e}var PU=[`low`,`medium`,`high`,`xhigh`,`max`],FU=`ultracode`,IU=new Set([`fable`,`opus`,`sonnet`]);function LU(e){return e&&IU.has(e)?[...PU,FU]:[...PU]}var RU={low:`Low`,medium:`Medium`,high:`High`,xhigh:`X-high`,max:`Max`,ultra:`Ultra`,ultracode:`Ultracode`};function zU(e){return RU[e]??e.charAt(0).toUpperCase()+e.slice(1)}function BU(e,t){let n=LU(e).map(e=>({value:e,label:zU(e)}));return t.withDefault?[{value:``,label:`Default`},...n]:n}function VU(e,t){let n=(e?.efforts??[]).map(e=>({value:e,label:zU(e)}));return t.withDefault?[{value:``,label:`Default`},...n]:n}function HU(e,t){return t.field===`backend`?{...e,backend:t.value}:t.field===`profile`?{...e,backend:t.backend,[t.backend]:{...e[t.backend],model:t.model,effort:t.effort}}:{...e,...t.field===`model`?{backend:t.backend}:{},[t.backend]:{...e[t.backend],[t.field]:t.value}}}function UU(e){return[{id:`claude`,label:`Claude Code`,options:MU.map(e=>({model:e.value,label:e.label,defaultEffort:`high`,efforts:LU(e.value)}))},{id:`codex`,label:`Codex`,options:e.map(e=>({model:e.slug,label:e.displayName,defaultEffort:e.defaultEffort,efforts:e.efforts}))}]}function WU(e,t){let n=e.backend,r=e[n],i=r.model??(n===`claude`?`opus`:t[0]?.slug??``),a=n===`codex`?t.find(e=>e.slug===i):void 0,o=n===`claude`?MU.some(e=>e.value===i):t.some(e=>e.slug===i),s=n===`claude`?`high`:a?.defaultEffort??``,c=r.effort??s,l=n===`claude`?BU(i,{withDefault:!1}):VU(a,{withDefault:!1}),u=l.some(e=>e.value===c);return{backend:n,model:i,effort:c,codexModel:a,modelAvailable:o,effortAvailable:u,effortOptions:c&&!u?[{value:c,label:`${c} (unavailable)`,title:`Saved reasoning level is not available for this model`},...l]:l}}function GU(){let e=Md(),t=qd({queryKey:[`dispatchPreferencesGet`],queryFn:()=>X.dispatchPreferencesGet()}),n=qd({queryKey:[`codexModels`],queryFn:()=>X.codexModels()}),r=n.data??[],i=Jd({mutationFn:e=>X.dispatchPreferenceSet(e),scope:{id:`dispatch-preferences`},onMutate:t=>{let n=e.getQueryData([`dispatchPreferencesGet`]);n&&e.setQueryData([`dispatchPreferencesGet`],HU(n,t))},onError:t=>{e.invalidateQueries({queryKey:[`dispatchPreferencesGet`]}),Q(`Could not save new-thread preference: ${t.message.slice(0,80)}`)}}),a=!!t.data&&!!n.data;return{resolved:(0,B.useMemo)(()=>a?WU(t.data,r):void 0,[a,t.data,r]),codexList:r,loadError:t.isError||n.isError,saveProfile:i.mutate}}var KU=`frizz-drafts:v1`,qU=80,JU=512*1024,YU=2*1024*1024,XU=new TextEncoder;function ZU(e){return XU.encode(e).byteLength}function QU(){return{version:1,entries:{}}}function $U(e){if(!e)return QU();try{let t=JSON.parse(e);if(!t||typeof t!=`object`||t.version!==1)return QU();let n=t.entries;if(!n||typeof n!=`object`||Array.isArray(n))return QU();let r={};for(let[e,t]of Object.entries(n))typeof t?.value!=`string`||typeof t?.touchedAt!=`number`||!Number.isFinite(t.touchedAt)||e.length>512||ZU(t.value)>JU||(r[e]={value:t.value,touchedAt:t.touchedAt});return{version:1,entries:r}}catch{return QU()}}function eW(e){let t=Object.entries(e.entries).filter(([,e])=>e.value&&ZU(e.value)<=JU).sort((e,t)=>t[1].touchedAt-e[1].touchedAt),n={};for(let[e,r]of t){if(Object.keys(n).length>=qU)break;n[e]=r,ZU(JSON.stringify({version:1,entries:n}))>YU&&delete n[e]}return{version:1,entries:n}}var tW=new class{snapshot;listeners=new Set;storage;constructor(e=typeof sessionStorage>`u`?void 0:sessionStorage){this.storage=e;let t=null;try{t=e?.getItem(`frizz-drafts:v1`)??null}catch{}this.snapshot=eW($U(t))}getSnapshot=()=>this.snapshot;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));get(e){return this.snapshot.entries[e]?.value??``}set(e,t){let n={...this.snapshot.entries};t?n[e]={value:t,touchedAt:Date.now()}:delete n[e],this.commit({version:1,entries:n})}clear(e){this.snapshot.entries[e]&&this.commit({version:1,entries:Object.fromEntries(Object.entries(this.snapshot.entries).filter(([t])=>t!==e))})}commit(e){this.snapshot=e;try{this.storage?.setItem(KU,JSON.stringify(eW(e)))}catch{}for(let e of this.listeners)e()}};function nW(e){return encodeURIComponent(e||`unresolved-project`)}var rW={dispatch:e=>`dispatch:${nW(e)}:new`,followUp:(e,t,n)=>`followup:${nW(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n??`unowned`)}`,adopt:(e,t)=>`adopt:${nW(e)}:${encodeURIComponent(t)}`,answer:(e,t,n,r,i)=>`answer:${nW(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n??`unowned`)}:${encodeURIComponent(r)}:${i}`,interaction:(e,t,n,r,i,a,o)=>`interaction:${nW(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n)}:${encodeURIComponent(r)}:${i}:${encodeURIComponent(a)}:${encodeURIComponent(o)}`};function iW(){return Hf(Z).board?.projectDir}function aW(e){return Hf(Z).board?.threads.find(t=>t.id===e)?.sessionId}function oW(e){let t=(0,B.useCallback)(()=>tW.get(e),[e]);return[(0,B.useSyncExternalStore)(tW.subscribe,t,t),(0,B.useCallback)(t=>tW.set(e,t),[e]),(0,B.useCallback)(()=>tW.clear(e),[e])]}function sW(e){let t=(0,B.useCallback)(()=>JSON.stringify(Object.fromEntries(e.map(e=>[e,tW.get(e)]))),[e.join(`\0`)]),n=(0,B.useSyncExternalStore)(tW.subscribe,t,t);return(0,B.useMemo)(()=>new Map(Object.entries(JSON.parse(n))),[n])}function cW({autoFocus:e,onDispatched:t}){let{resolved:n,codexList:r,loadError:i,saveProfile:a}=GU(),o=YH(),s=iW(),[c,l,u]=oW(rW.dispatch(s)),d=rW.dispatch(s),f=(0,B.useRef)(``),[p,m]=(0,B.useState)(null),h=qd({queryKey:[`authStatus`],queryFn:()=>X.authStatus(),staleTime:3e4}),[g,_]=(0,B.useState)(null),[v,y]=(0,B.useState)(null),b=(0,B.useRef)(null),x=Jd({mutationFn:e=>X.dispatch(e),onMutate:()=>Q(`Starting thread…`,{spinner:!0,sticky:!0}),onSuccess:e=>{m(null),t?.(),Q(`Thread started`,{link:{label:`Open thread`,slug:e.slug}})},onError:(e,t)=>{tW.get(d)||l(f.current||t.prompt),m(null);let n=/^AUTH_REQUIRED:(claude|codex)$/.exec(e.message);if(n){b.current=t,_(n[1]),Q(`Signed out of ${n[1]===`claude`?`Claude`:`Codex`}`,{duration:3e3});return}Q(`Dispatch failed: ${e.message.slice(0,80)}`)}});function S(e){f.current=c,u(),m(e.prompt),x.mutate(e)}function C(){if(!c.trim()||!n)return;let e=wU(c);if(e){u(),e===`login`?(b.current=null,_(n.backend)):y(n.backend);return}if(!n.modelAvailable){Q(`Saved model is unavailable — choose a model before starting the thread`);return}if(!n.effortAvailable){Q(`Saved reasoning level is unavailable for this model — choose another level`);return}let t={prompt:c.trim(),model:n.model,backend:n.backend,effort:n.effort};if(h.data?.[n.backend]===`signed-out`){b.current=t,_(n.backend);return}S(t)}let w=(0,B.useMemo)(()=>n?(0,V.jsx)(yU,{groups:UU(r),value:{provider:n.backend,model:n.model,effort:n.effort},onValueChange:e=>a({field:`profile`,backend:e.provider,model:e.model,effort:e.effort}),ariaLabel:`Model and effort`,title:n.modelAvailable&&n.effortAvailable?`Model and reasoning effort`:`Saved model or reasoning effort unavailable — choose a supported pair`,className:`max-w-[min(21rem,72vw)]`}):(0,V.jsx)(yU,{groups:[],value:void 0,onValueChange:()=>{},placeholder:i?`Profile unavailable`:`Profile loading…`,ariaLabel:`Model and effort loading`,disabled:!0}),[n,r,i,a]);return(0,V.jsxs)(`div`,{className:`w-full flex flex-col gap-3`,children:[(0,V.jsx)(KH,{surface:`newComposer`,autoFocus:e,value:c,onChange:l,onSubmit:C,placeholder:`Describe the task…`,minHeight:96,maxHeight:340,busy:x.isPending,footer:w,leftAction:o?(0,V.jsx)(XH,{}):void 0}),x.isError&&(0,V.jsx)(`span`,{className:`px-0.5 text-[11px] text-red-400 truncate`,children:x.error.message}),p&&(0,V.jsxs)(`div`,{"data-pending-dispatch":!0,role:`status`,className:`rounded-lg border border-border bg-panel-2 px-3 py-2.5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted`,children:[(0,V.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-accent`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:`Starting thread…`})]}),(0,V.jsx)(`p`,{className:`mt-1 line-clamp-2 whitespace-pre-wrap text-[12px] leading-relaxed text-fg`,children:p})]}),g&&(0,V.jsx)(EU,{backend:g,onClose:()=>_(null),onAuthed:()=>{let e=b.current;b.current=null,_(null),e&&S(e)}}),v&&(0,V.jsx)(DU,{backend:v,onClose:()=>y(null)})]})}function lW({onClose:e}){let t=(0,B.useRef)(null),n=(0,B.useRef)(typeof document<`u`&&document.activeElement instanceof HTMLElement?document.activeElement:null);return(0,B.useEffect)(()=>()=>{let e=n.current;window.setTimeout(()=>{e?.isConnected&&e.focus({preventScroll:!0})},0)},[]),(0,V.jsx)(FV,{open:!0,onOpenChange:t=>{t||e()},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-50 bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{ref:t,"aria-modal":`true`,"aria-describedby":void 0,onEscapeKeyDown:_U,onCloseAutoFocus:e=>{e.preventDefault();let t=n.current;t?.isConnected&&t.focus({preventScroll:!0})},onOpenAutoFocus:e=>{e.preventDefault(),t.current?.querySelector(`textarea`)?.focus({preventScroll:!0})},className:`fixed left-1/2 top-1/2 z-50 w-[640px] max-w-[86vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none max-[700px]:top-[calc(env(safe-area-inset-top)+56px)] max-[700px]:w-[calc(100vw-24px)] max-[700px]:max-w-none max-[700px]:translate-y-0`,children:[(0,V.jsx)(QV,{className:`mb-1 text-[14px] font-medium`,children:`New thread`}),(0,V.jsx)(cW,{autoFocus:!0,onDispatched:e})]})]})})}function uW({children:e,onClose:t}){return(0,V.jsx)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center bg-black/30 backdrop-blur-md backdrop-saturate-150`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:e})}var dW=`-mx-1.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-fg/75 outline-none transition-colors hover:bg-elevated hover:text-fg focus-visible:ring-1 focus-visible:ring-border-strong disabled:opacity-55`,fW={claude:`size-[11px] translate-y-px`,codex:`size-[10px]`},pW={claude:{backend:`claude`,label:`Claude Code`},codex:{backend:`codex`,label:`OpenAI Codex`}};function mW(e){return e===`claude`||e===`codex`?pW[e]:void 0}function hW({backend:e,className:t}){let n=mW(e);return n?(0,V.jsx)(`span`,{role:`img`,"aria-label":n.label,className:`inline-flex shrink-0 text-muted/65 ${fW[n.backend]} ${t??``}`,children:n.backend===`codex`?(0,V.jsx)(gW,{}):(0,V.jsx)(_W,{})}):null}function gW(){return(0,V.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,className:`size-full`,fill:`currentColor`,children:(0,V.jsx)(`path`,{d:`M22.282 9.821a6 6 0 0 0-.516-4.91a6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9a6.05 6.05 0 0 0 .743 7.097a5.98 5.98 0 0 0 .51 4.911a6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206a6 6 0 0 0 3.997-2.9a6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081l4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085l4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354l-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023l-.141-.085l-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365l2.602-1.5l2.607 1.5v2.999l-2.597 1.5l-2.607-1.5Z`})})}function _W(){return(0,V.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,className:`size-full`,fill:`currentColor`,children:(0,V.jsx)(`path`,{d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`})})}typeof window<`u`&&window.document&&window.document.createElement;function vW(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}function yW(e,t=[]){let n=[];function r(t,r){let i=B.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=B.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=B.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>B.createContext(e));return function(n){let r=n?.[e]||t;return B.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,bW(i,...t)]}function bW(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var xW=`DismissableLayer`,SW=`dismissableLayer.update`,CW=`dismissableLayer.pointerDownOutside`,wW=`dismissableLayer.focusOutside`,TW,EW=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),DW=B.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=B.useContext(EW),[d,f]=B.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=B.useState({}),h=SN(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=B.useRef(!1),C=jW(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:B.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=MW(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=ZN(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return B.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),B.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(TW=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),NW(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=TW))}},[d,p,n,u]),B.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),NW())},[d,u]),B.useEffect(()=>{let e=()=>m({});return document.addEventListener(SW,e),()=>document.removeEventListener(SW,e)},[]),(0,V.jsx)(KN.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:vW(e.onFocusCapture,w.onFocusCapture),onBlurCapture:vW(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:vW(e.onPointerDownCapture,C.onPointerDownCapture)})});DW.displayName=xW;var OW=`DismissableLayerBranch`,kW=B.forwardRef((e,t)=>{let n=B.useContext(EW),r=B.useRef(null),i=SN(t,r);return B.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(KN.div,{...e,ref:i})});kW.displayName=OW;var AW=()=>!0;function jW(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=AW}=t,s=ZN(e),c=B.useRef(!1),l=B.useRef(!1),u=B.useRef(new Map),d=B.useRef(()=>{});return B.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}function p(e){l.current&&u.current.set(e.type,!1)}let m=a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||PW(CW,s,p,{discrete:!0})};if(!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:()=>c.current=!0}}function MW(e,t=globalThis?.document){let n=ZN(e),r=B.useRef(!1);return B.useEffect(()=>{let e=e=>{e.target&&!r.current&&PW(wW,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function NW(){let e=new CustomEvent(SW);document.dispatchEvent(e)}function PW(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?qN(i,a):i.dispatchEvent(a)}var FW=`focusScope.autoFocusOnMount`,IW=`focusScope.autoFocusOnUnmount`,LW={bubbles:!1,cancelable:!0},RW=`FocusScope`,zW=B.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=ZN(i),u=ZN(a),d=B.useRef(null),f=SN(t,c),p=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:KW(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||KW(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&KW(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),B.useEffect(()=>{if(s){qW.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(FW,LW);s.addEventListener(FW,l),s.dispatchEvent(t),t.defaultPrevented||(BW(XW(HW(s)),{select:!0}),document.activeElement===e&&KW(s))}return()=>{s.removeEventListener(FW,l),setTimeout(()=>{let t=new CustomEvent(IW,LW);s.addEventListener(IW,u),s.dispatchEvent(t),t.defaultPrevented||KW(e??document.body,{select:!0}),s.removeEventListener(IW,u),qW.remove(p)},0)}}},[s,l,u,p]);let m=B.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=VW(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&KW(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&KW(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(KN.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});zW.displayName=RW;function BW(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(KW(r,{select:t}),document.activeElement!==n)return}function VW(e){let t=HW(e);return[UW(t,e),UW(t.reverse(),e)]}function HW(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function UW(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):WW(r,{upTo:t})))return r}function WW(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function GW(e){return e instanceof HTMLInputElement&&`select`in e}function KW(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&GW(e)&&t&&e.select()}}var qW=JW();function JW(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=YW(e,t),e.unshift(t)},remove(t){e=YW(e,t),e[0]?.resume()}}}function YW(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function XW(e){return e.filter(e=>e.tagName!==`A`)}var ZW=`Popper`,[QW,$W]=yW(ZW),[eG,tG]=QW(ZW),nG=e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,V.jsx)(eG,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};nG.displayName=ZW;var rG=`PopperAnchor`,iG=B.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=tG(rG,n),o=B.useRef(null),s=a.onAnchorChange,c=SN(t,B.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=B.useRef(null);B.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&mG(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,V.jsx)(KN.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});iG.displayName=rG;var aG=`PopperContent`,[oG,sG]=QW(aG),cG=B.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=tG(aG,n),[_,v]=B.useState(null),y=SN(t,v),[b,x]=B.useState(null),S=XI(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(fG),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=RI({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>wI(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[BI({mainAxis:i+w,alignmentAxis:o}),c&&VI({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?HI():void 0,...k}),c&&UI({...k}),WI({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&KI({element:b,padding:s}),pG({arrowWidth:C,arrowHeight:w}),f&&GI({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),ee=g.setPlacementState;TN(()=>(ee(M),()=>{ee(void 0)}),[M,ee]);let[F,te]=mG(M),ne=ZN(m);TN(()=>{N&&ne?.()},[N,ne]);let re=P.arrow?.x,ie=P.arrow?.y,ae=P.arrow?.centerOffset!==0,[oe,se]=B.useState();return TN(()=>{_&&se(window.getComputedStyle(_).zIndex)},[_]),(0,V.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(oG,{scope:n,placedSide:F,placedAlign:te,onArrowChange:x,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,V.jsx)(KN.div,{"data-side":F,"data-align":te,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});cG.displayName=aG;var lG=`PopperArrow`,uG={top:`bottom`,right:`left`,bottom:`top`,left:`right`},dG=B.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=sG(lG,n),a=uG[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(YI,{...r,ref:t,style:{...r.style,display:`block`}})})});dG.displayName=lG;function fG(e){return e!==null}var pG=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=mG(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function mG(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var hG=nG,gG=iG,_G=cG,vG=dG;function yG(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}var bG=e=>{let{present:t,children:n}=e,r=xG(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=CG(r.ref,TG(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null};bG.displayName=`Presence`;function xG(e){let[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),a=B.useRef(`none`),o=B.useRef(void 0),[s,c]=yG(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return B.useEffect(()=>{s===`mounted`?(a.current=o.current??wG(r.current),o.current=void 0):a.current=`none`},[s]),TN(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=wG(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),TN(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=wG(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=wG(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:B.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=wG(t)}else r.current=null;n(e)},[])}}function SG(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function CG(...e){let t=B.useRef(e);return t.current=e,B.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=SG(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():SG(n[e],null)}}},[])}function wG(e){return e?.animationName||`none`}function TG(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var EG=`Popover`,[DG,_te]=yW(EG,[$W]),OG=$W(),[kG,AG]=DG(EG),jG=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=OG(t),c=B.useRef(null),[l,u]=B.useState(!1),[d,f]=AN({prop:r,defaultProp:i??!1,onChange:a,caller:EG});return(0,V.jsx)(hG,{...s,children:(0,V.jsx)(kG,{scope:t,contentId:PP(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:B.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:B.useCallback(()=>u(!0),[]),onCustomAnchorRemove:B.useCallback(()=>u(!1),[]),modal:o,children:n})})};jG.displayName=EG;var MG=`PopoverAnchor`,NG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=AG(MG,n),a=OG(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return B.useEffect(()=>(o(),()=>s()),[o,s]),(0,V.jsx)(gG,{...a,...r,ref:t})});NG.displayName=MG;var PG=`PopoverTrigger`,FG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=AG(PG,n),a=OG(n),o=SN(t,i.triggerRef),s=(0,V.jsx)(KN.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":XG(i.open),...r,ref:o,onClick:vW(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,V.jsx)(gG,{asChild:!0,...a,children:s})});FG.displayName=PG;var IG=`PopoverPortal`,[LG,RG]=DG(IG,{forceMount:void 0}),zG=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=AG(IG,t);return(0,V.jsx)(LG,{scope:t,forceMount:n,children:(0,V.jsx)(bG,{present:n||a.open,children:(0,V.jsx)(bL,{asChild:!0,container:i,children:r})})})};zG.displayName=IG;var BG=`PopoverContent`,VG=B.forwardRef((e,t)=>{let n=RG(BG,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=AG(BG,e.__scopePopover);return(0,V.jsx)(bG,{present:r||a.open,children:a.modal?(0,V.jsx)(UG,{...i,ref:t}):(0,V.jsx)(WG,{...i,ref:t})})});VG.displayName=BG;var HG=NN(`PopoverContent.RemoveScroll`),UG=B.forwardRef((e,t)=>{let n=AG(BG,e.__scopePopover),r=B.useRef(null),i=SN(t,r),a=B.useRef(!1);return B.useEffect(()=>{let e=r.current;if(e)return rR(e)},[]),(0,V.jsx)(fz,{as:HG,allowPinchZoom:!0,children:(0,V.jsx)(GG,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:vW(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:vW(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:vW(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),WG=B.forwardRef((e,t)=>{let n=AG(BG,e.__scopePopover),r=B.useRef(!1),i=B.useRef(!1);return(0,V.jsx)(GG,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),GG=B.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=AG(BG,n),p=OG(n);return mP(),(0,V.jsx)(zW,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(DW,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,V.jsx)(_G,{"data-state":XG(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),KG=`PopoverClose`,qG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=AG(KG,n);return(0,V.jsx)(KN.button,{type:`button`,...r,ref:t,onClick:vW(e.onClick,()=>i.onOpenChange(!1))})});qG.displayName=KG;var JG=`PopoverArrow`,YG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=OG(n);return(0,V.jsx)(vG,{...i,...r,ref:t})});YG.displayName=JG;function XG(e){return e?`open`:`closed`}var ZG=jG,QG=NG,$G=FG,eK=zG,tK=VG;function nK({modal:e=!1,...t}){return(0,V.jsx)(ZG,{modal:e,...t})}var rK=$G,iK=QG;function aK({children:e,side:t=`top`,align:n=`center`,sideOffset:r=6,className:i=``,...a}){return(0,V.jsx)(eK,{children:(0,V.jsx)(tK,{side:t,align:n,sideOffset:r,avoidCollisions:!0,collisionPadding:12,onEscapeKeyDown:e=>e.stopPropagation(),className:`${bV} ${wV} rounded-lg outline-none ${i}`,...a,children:e})})}var oK=3e4,sK=45e3;function cK(e,t){return t?AbortSignal.any([t,AbortSignal.timeout(e)]):AbortSignal.timeout(e)}var lK=`text-[9px]`,uK={claude:`text-fg/75! size-[14px]! translate-y-0!`,codex:`text-fg/75! size-[12.75px]! translate-y-0!`};function dK(){let e=qd({queryKey:[`quota`],queryFn:()=>X.quota(),staleTime:1e4}),t=qd({queryKey:[`authStatus`],queryFn:()=>X.authStatus(),staleTime:3e4});return[`claude`,`codex`].some(n=>fK(e.data?.[n],t.data?.[n],e.isLoading))}function fK(e,t,n){return t===`signed-out`||!e&&n?!1:!!e&&e.status===`ok`&&e.windows.length>0}function pK(){let e=Md(),t=(0,B.useRef)(null),[n,r]=(0,B.useState)(!1),i=qd({queryKey:[`quota`],queryFn:({signal:e})=>X.quota(void 0,{signal:cK(oK,e)}),refetchInterval:e=>{let t=e.state.data;return!t||t.claude.status!==`ok`||t.codex.status!==`ok`?15e3:3e4},staleTime:1e4,refetchOnWindowFocus:!0}),a=qd({queryKey:[`authStatus`],queryFn:({signal:e})=>X.authStatus(void 0,{signal:cK(oK,e)}),refetchInterval:12e4,staleTime:3e4,refetchOnWindowFocus:!0}),o=n=>{if(t.current)return;r(!0);let i=Promise.all([X.quota({force:n===`claude`},{signal:cK(sK)}).then(t=>e.setQueryData([`quota`],t)),e.refetchQueries({queryKey:[`authStatus`]})]).then(()=>{}).catch(()=>{}).finally(()=>{t.current=null,r(!1)});t.current=i};return(0,V.jsxs)(`div`,{"data-quota-bar":!0,className:`flex shrink-0 items-center gap-3 ${lK}`,children:[(0,V.jsx)(mK,{backend:`claude`,quota:i.data?.claude,auth:a.data?.claude,email:a.data?.emails?.claude,loading:i.isLoading,fetching:i.isFetching||n,onRecheck:()=>o(`claude`)}),(0,V.jsx)(mK,{backend:`codex`,quota:i.data?.codex,auth:a.data?.codex,email:a.data?.emails?.codex,loading:i.isLoading,fetching:i.isFetching||n,onRecheck:()=>o(`codex`)})]})}function mK({backend:e,quota:t,auth:n,email:r,loading:i,fetching:a,onRecheck:o}){let s=CU[e];if(!fK(t,n,i))return null;let c=hK(100-_K(t.windows).usedPercent);return(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(nK,{onOpenChange:e=>{e&&o()},children:[(0,V.jsx)(rK,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,"aria-label":`${s} quota: ${c}% remaining`,className:`flex items-center gap-1.5 min-w-0 rounded outline-none transition-opacity hover:opacity-80 focus-visible:ring-1 focus-visible:ring-border-strong`,children:[(0,V.jsx)(hW,{backend:e,className:uK[e]}),(0,V.jsxs)(`span`,{className:`tabular-nums ${vK(c)}`,children:[c,`%`]})]})}),(0,V.jsxs)(aK,{side:`bottom`,align:`start`,className:`w-[min(15rem,calc(100vw-1.5rem))] p-3 text-[11px] leading-relaxed text-fg`,children:[(0,V.jsxs)(`div`,{className:`mb-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,V.jsx)(hW,{backend:e}),(0,V.jsx)(`span`,{children:s}),t?.planType&&(0,V.jsxs)(`span`,{className:`text-muted/70`,children:[`· `,yK(t.planType),` plan`]}),a&&(0,V.jsx)(cw,{size:11,className:`animate-spin text-muted/60`,"aria-label":`Rechecking`})]}),r&&(0,V.jsx)(`div`,{"data-quota-account":!0,className:`truncate text-muted/70 select-text`,title:r,children:r})]}),(0,V.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[t.windows.map(e=>{let t=hK(100-e.usedPercent),n=bK(e);return(0,V.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`span`,{className:`text-muted/80`,children:e.label}),(0,V.jsxs)(`span`,{className:`flex items-center gap-2 tabular-nums`,children:[(0,V.jsxs)(`span`,{className:vK(t),children:[t,`% left`]}),n&&(0,V.jsxs)(`span`,{className:`text-muted/55`,children:[`resets `,n]})]})]},e.key)}),t.detail&&(0,V.jsx)(`li`,{className:`pt-1 text-muted/55`,children:t.detail})]})]})]})})}function hK(e){return Math.max(0,Math.min(100,Math.round(e)))}var gK=25;function _K(e){return e.find(e=>e.key===`5h`)??e.reduce((e,t)=>t.usedPercent>e.usedPercent?t:e)}function vK(e){return e<=8?`text-red-400`:e<=gK?`text-accent`:`text-fg/70`}function yK(e){return e&&e[0].toUpperCase()+e.slice(1)}function bK(e){if(!e.resetsAt)return null;let t=e.resetsAt*1e3,n=new Date(t);if(Number.isNaN(n.getTime()))return null;let r=t-Date.now();if(r<=0)return null;if(r<24*36e5){let e=n.getHours(),t=n.getMinutes(),r=e>=12?`pm`:`am`;return e=e%12||12,t===0?`${e}${r}`:`${e}:${String(t).padStart(2,`0`)}${r}`}return n.toLocaleDateString(void 0,{weekday:`short`})}var xK=`frizz:supervisor-status-wake`;function SK(e){return e!==null}function CK(e){return e?.updateRestart===!0&&e.updateAvailable!==!1}function wK(e){return e?.dev===!0}async function TK(e=fetch){try{let t=await e(`/_frizz/control/status`,{headers:{"cache-control":`no-store`}});if(!t.ok||!t.headers.get(`content-type`)?.includes(`application/json`))return null;let n=await t.json();return n.protocol===1&&(n.state===`ready`||n.state===`restarting`||n.state===`failed`)?n:null}catch{return null}}async function EK(e,t){let n=await t(e,{method:`POST`,headers:{"cache-control":`no-store`}}),r;try{r=await n.json()}catch{}if(!n.headers.get(`content-type`)?.includes(`application/json`)||!r||r.protocol!==1||r.state!==`ready`&&r.state!==`restarting`&&r.state!==`failed`)throw Error(`Frizz restart controls are unavailable for this server`);if(!n.ok)throw Error(r.message??`Restart request failed (${n.status})`);if(r.state===`failed`)throw Error(r.message??`Frizz did not become ready`);return r}function DK(e=fetch){return EK(`/_frizz/control/restart`,e)}function OK(e=fetch){return EK(`/_frizz/control/update-restart`,e)}var kK=`Install the latest version of Frizz. Your running threads will not be affected.`,AK=`A newer version of Frizz is available. Your running threads will not be affected.`,jK=`Restart Frizz. Your running threads will not be affected.`,MK=`fixed left-3 right-3 top-12 z-50 w-auto text-left font-sans sm:absolute sm:right-auto sm:-left-1.5 sm:top-[calc(100%+0.65rem)]`,NK=`sm:w-[min(23rem,calc(100vw-1.5rem))]`,PK=`sm:w-[min(34rem,calc(100vw-1.5rem))]`,FK=`rounded-xl bg-elevated p-3.5 shadow-xl shadow-black/45`;function IK({open:e,update:t,version:n,updateVersion:r}){if(!e)return null;let i=t?`Update Frizz`:`Restart Frizz`,a=t?r:void 0;return(0,V.jsxs)(`div`,{id:`update-restart-popover`,role:`tooltip`,"aria-label":i,className:`${MK} ${NK} ${FK} border border-border-strong`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-1.5 left-1.5 h-3 w-3 rotate-45 border-l border-t border-border-strong bg-elevated`}),(0,V.jsxs)(`div`,{className:`relative flex items-center gap-2.5`,children:[(0,V.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-fg/10 text-fg`,children:(0,V.jsx)(_w,{"aria-hidden":`true`,size:14,strokeWidth:2.25})}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-fg`,children:i}),n&&(0,V.jsx)(`span`,{className:`font-mono text-[11px] leading-snug text-muted`,children:a?`${n} → ${a}`:n})]})]}),(0,V.jsx)(`p`,{className:`relative mt-2.5 text-[12px] leading-relaxed text-muted`,children:t?a?AK:kK:jK})]})}var LK=`Frizz kept running the previous version, and your threads are unaffected.`;function RK({update:e,message:t,onDismiss:n}){return(0,V.jsxs)(`div`,{role:`alert`,className:`${MK} ${PK} ${FK} border border-red-500/45`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-1.5 left-1.5 h-3 w-3 rotate-45 border-l border-t border-red-500/45 bg-elevated`}),(0,V.jsxs)(`div`,{className:`relative flex items-center gap-2.5`,children:[(0,V.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-red-500/15 text-red-300`,children:(0,V.jsx)(kw,{"aria-hidden":`true`,size:14,strokeWidth:2.25})}),(0,V.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-fg`,children:e?`Update failed`:`Restart failed`}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Dismiss`,onClick:n,className:`-mr-1 ml-auto flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-border-strong`,children:(0,V.jsx)(jw,{"aria-hidden":`true`,size:14,strokeWidth:2.25})})]}),(0,V.jsx)(`p`,{className:`relative mt-2.5 text-[12px] leading-relaxed text-muted`,children:LK}),(0,V.jsx)(`pre`,{className:`relative mt-2.5 max-h-64 overflow-y-auto whitespace-pre-wrap break-words rounded-md border border-border bg-panel px-2.5 py-2 font-mono text-[11px] leading-relaxed text-fg/70`,children:t})]})}function zK({update:e,busy:t,updateVersion:n,onFocus:r,onBlur:i,onClick:a}){return(0,V.jsxs)(`button`,{type:`button`,"aria-describedby":`update-restart-popover`,"aria-label":e?`Update Frizz`:`Restart Frizz`,disabled:t,"aria-busy":t||void 0,className:`relative ${dW}`,onFocus:r,onBlur:i,onClick:a,children:[(0,V.jsx)(_w,{size:14,"aria-hidden":`true`,className:t?`animate-spin`:void 0}),e&&!t&&n&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-[2px] top-[2px] h-[4px] w-[4px] rounded-full bg-accent`})]})}function BK(){let e=Hf(Z),[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(),[s,c]=(0,B.useState)(),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)({}),h=(0,B.useRef)(!1),g=(0,B.useRef)(null);if((0,B.useEffect)(()=>{let e=!0;return TK().then(t=>{e&&(u(SK(t)),f(CK(t)),m({version:t?.version,updateVersion:t?.updateVersion}))}),()=>{e=!1}},[]),l!==!0)return null;let _=h.current&&e.controlPlaneState===`failed`?e.controlPlaneMessage??`Frizz did not become ready`:void 0,v=a??_,y=v&&v!==s?v:void 0,b=async()=>{if(r)return;h.current=!0,n(!1),i(!0),o(void 0),c(void 0);let e=`${window.location.pathname}${window.location.search}${window.location.hash}`;d&&(Z.controlPlaneState=`restarting`,Z.controlPlaneMessage=null,Z.controlPlaneRestartPending=!0);try{d?await OK():await DK(),d?(sessionStorage.setItem(`frizz:reload-after-update-restart`,e),window.dispatchEvent(new Event(xK)),i(!1)):window.location.replace(e)}catch(e){d&&(Z.controlPlaneRestartPending=!1,Z.controlPlaneState=`ready`,Z.controlPlaneMessage=null);let t=e.message.slice(0,140);i(!1),o(t),Q(`${d?`Update & Restart`:`Restart Frizz`} failed`)}};return(0,V.jsxs)(`div`,{ref:g,className:`relative`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[(0,V.jsx)(zK,{update:d,busy:r,updateVersion:p.updateVersion,onFocus:()=>n(!0),onBlur:()=>n(!1),onClick:()=>void b()}),y&&(0,V.jsx)(RK,{update:d,message:y,onDismiss:()=>c(y)}),(0,V.jsx)(IK,{open:t&&!y,update:d,version:p.version,updateVersion:p.updateVersion})]})}function VK(){return(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`})}function HK({state:e,fallback:t}){let n={open:{cls:`bg-live`,word:`connected`},connecting:{cls:`bg-accent`,word:`connecting…`},closed:{cls:`bg-red-500`,word:`disconnected`}}[e],r=t?`connected · SSE fallback`:n.word;return(0,V.jsx)(`span`,{role:`img`,"aria-label":r,title:r,"data-board-sync-fallback":t||void 0,className:`h-1.5 w-1.5 shrink-0 rounded-full ${t?`bg-accent`:n.cls}`})}function UK(){let e=Hf(Z),t=iY($A()),n=dK(),r=e.connection===`open`&&!!e.socketBoardFallback,i=t.state===`verified`?t.repo:t.state===`local`?t.name:null,a=t.state===`verified`?t.label:i??void 0,o=t.state===`verified`?`Project: ${t.label}`:t.state===`local`?`Project: ${t.name}; local repository with no git remote`:t.state===`loading`?`Project identity loading`:`Project identity unavailable`;return(0,V.jsxs)(`div`,{"data-status-row":!0,className:`mb-2.5 flex min-w-0 items-center gap-3 text-[12px]`,children:[(0,V.jsx)(`a`,{href:`/`,title:`All projects`,"aria-label":`All projects`,className:`${dW} -ml-px`,children:(0,V.jsx)(nw,{size:14,"aria-hidden":`true`})}),(0,V.jsx)(VK,{}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Settings`,title:`Settings`,className:dW,onClick:()=>Z.showSettings=!0,children:(0,V.jsx)(bw,{size:14,"aria-hidden":`true`})}),(0,V.jsx)(BK,{}),n&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(VK,{}),(0,V.jsx)(pK,{})]}),(0,V.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-center gap-1.5`,"data-project-identity-state":t.state,"aria-label":o,"aria-busy":t.state===`loading`||void 0,children:[(0,V.jsx)(HK,{state:e.connection,fallback:r}),i?(0,V.jsx)(`span`,{className:`block min-w-0 truncate font-semibold text-fg/90`,title:a,children:i}):(0,V.jsx)(`span`,{className:`identity-placeholder w-24`,"aria-hidden":`true`})]})]})}var WK=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),GK=`VisuallyHidden`,KK=B.forwardRef((e,t)=>(0,V.jsx)(KN.span,{...e,ref:t,style:{...WK,...e.style}}));KK.displayName=GK;var qK=KK,[JK,vte]=CN(`Tooltip`,[$I]),YK=$I(),XK=`TooltipProvider`,ZK=700,QK=`tooltip.open`,[$K,eq]=JK(XK),tq=e=>{let{__scopeTooltip:t,delayDuration:n=ZK,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=B.useRef(!0),s=B.useRef(!1),c=B.useRef(0);return B.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,V.jsx)($K,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:B.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:B.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:B.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};tq.displayName=XK;var nq=`Tooltip`,[rq,iq]=JK(nq),aq=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=eq(nq,e.__scopeTooltip),l=YK(t),[u,d]=B.useState(null),f=PP(),p=B.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=B.useRef(!1),[_,v]=AN({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(QK))):c.onClose(),a?.(e)},caller:nq}),y=B.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=B.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=B.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=B.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return B.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,V.jsx)(hL,{...l,children:(0,V.jsx)(rq,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:B.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:B.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};aq.displayName=nq;var oq=`TooltipTrigger`,sq=B.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=iq(oq,n),a=eq(oq,n),o=YK(n),s=SN(t,B.useRef(null),i.onTriggerChange),c=B.useRef(!1),l=B.useRef(!1),u=B.useCallback(()=>c.current=!1,[]);return B.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,V.jsx)(gL,{asChild:!0,...o,children:(0,V.jsx)(KN.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:yN(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:yN(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:yN(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:yN(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:yN(e.onBlur,i.onClose),onClick:yN(e.onClick,i.onClose)})})});sq.displayName=oq;var cq=`TooltipPortal`,[lq,uq]=JK(cq,{forceMount:void 0}),dq=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=iq(cq,t);return(0,V.jsx)(lq,{scope:t,forceMount:n,children:(0,V.jsx)(SL,{present:n||a.open,children:(0,V.jsx)(bL,{asChild:!0,container:i,children:r})})})};dq.displayName=cq;var fq=`TooltipContent`,pq=B.forwardRef((e,t)=>{let n=uq(fq,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=iq(fq,e.__scopeTooltip);return(0,V.jsx)(SL,{present:r||o.open,children:o.disableHoverableContent?(0,V.jsx)(vq,{side:i,...a,ref:t}):(0,V.jsx)(mq,{side:i,...a,ref:t})})}),mq=B.forwardRef((e,t)=>{let n=iq(fq,e.__scopeTooltip),r=eq(fq,e.__scopeTooltip),i=B.useRef(null),a=SN(t,i),[o,s]=B.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=B.useCallback(()=>{s(null),d(!1)},[d]),p=B.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Sq(r,xq(r,n.getBoundingClientRect())),a=Cq(t.getBoundingClientRect()),o=Tq([...i,...a]);s(o),d(!0)},[d]);return B.useEffect(()=>()=>f(),[f]),B.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),B.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!wq(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,V.jsx)(vq,{...e,ref:a})}),[hq,gq]=JK(nq,{isInside:!1}),_q=FN(`TooltipContent`),vq=B.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=iq(fq,n),l=YK(n),{onClose:u}=c;return B.useEffect(()=>(document.addEventListener(QK,u),()=>document.removeEventListener(QK,u)),[u]),B.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,V.jsx)(iP,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,V.jsxs)(_L,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,V.jsx)(_q,{children:r}),(0,V.jsx)(hq,{scope:n,isInside:!0,children:(0,V.jsx)(qK,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});pq.displayName=fq;var yq=`TooltipArrow`,bq=B.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=YK(n);return gq(yq,n).isInside?null:(0,V.jsx)(vL,{...i,...r,ref:t})});bq.displayName=yq;function xq(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Sq(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Cq(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function wq(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Tq(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Eq(t)}function Eq(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Dq=tq,Oq=aq,kq=sq,Aq=dq,jq=pq,Mq=bq;function Nq({children:e}){return(0,V.jsx)(Dq,{delayDuration:0,skipDelayDuration:0,disableHoverableContent:!0,children:e})}function Pq({label:e,children:t,side:n=`top`,clickable:r=!1,multiline:i=!1,disabled:a=!1}){let o=i?`whitespace-pre-line`:`whitespace-normal`,[s,c]=(0,B.useState)(!1),l=(0,B.useId)(),u=r&&(0,B.isValidElement)(t)?t:null,d=u?(0,B.cloneElement)(u,{"aria-describedby":l}):t,f=(0,B.useRef)(null);if(u){let t=f.current?.getBoundingClientRect(),n=t?Math.min(Math.max(12,t.right+8),window.innerWidth-364):12,r=t?Math.min(Math.max(12,t.top-6),window.innerHeight-96):12;return(0,V.jsxs)(`span`,{ref:f,className:`inline-flex`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onFocus:()=>c(!0),onBlur:()=>c(!1),onClick:()=>c(e=>!e),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),c(!1))},children:[d,s&&(0,Xd.createPortal)((0,V.jsx)(`span`,{id:l,role:`tooltip`,className:`z-[250] max-w-[min(22rem,calc(100vw-1.5rem))] rounded-md border border-border bg-elevated px-3 py-2 text-[11px] leading-relaxed text-fg shadow-md shadow-black/40 break-words ${o}`,style:{position:`fixed`,left:n,top:r},children:e}),document.body)]})}return(0,V.jsxs)(Oq,{open:s&&!a,onOpenChange:c,children:[(0,V.jsx)(kq,{asChild:!0,children:d}),(0,V.jsx)(Aq,{children:(0,V.jsxs)(jq,{id:l,side:n,sideOffset:5,collisionPadding:12,className:`${wV} max-w-[min(22rem,calc(100vw-1.5rem))] select-none rounded-md border border-border bg-elevated px-3 py-2 text-[11px] leading-relaxed text-fg shadow-md shadow-black/40 break-words ${o}`,children:[e,(0,V.jsx)(Mq,{className:`fill-elevated`})]})})]})}var Fq=Rf({at:{}}),Iq=12e3,Lq=new Map;function Rq(e,t=Date.now()){Fq.at[e]=t;let n=Lq.get(e);n!==void 0&&clearTimeout(n),Lq.set(e,setTimeout(()=>{Lq.delete(e),delete Fq.at[e]},Iq))}function zq(e){let t=Lq.get(e);t!==void 0&&(clearTimeout(t),Lq.delete(e)),delete Fq.at[e]}function Bq(e,t,n=Date.now()){if(t===void 0||n-t>12e3)return!1;let r=e.lastActivityAt?Date.parse(e.lastActivityAt):NaN;return!(Number.isFinite(r)&&r>t)}function Vq(){return Hf(Fq).at}function Hq(e,t,n=Date.now()){return t===void 0||!Bq(e,t,n)?e:{...e,runtime:`running`,needsYou:!1,pendingAsk:void 0,pendingQuestion:!1,actionableInteraction:!1,lastUserAt:new Date(t).toISOString()}}function Uq(e){let t=Vq();return(0,B.useMemo)(()=>e.map(e=>Hq(e,t[e.id])),[e,t])}var Wq=0;function Gq(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():(Wq+=1,`browser-${Date.now()}-${Wq}`)}function Kq({optimistic:e,request:t,success:n,failure:r}){e(),t().then(()=>n?.(),e=>r(e instanceof Error?e:Error(String(e))))}var qq=new Map;function Jq(e,t){let n=(qq.get(e)??Promise.resolve()).then(t,t);return qq.set(e,n.then(()=>{},()=>{})),n}var Yq=[300,800,1800,3500],Xq=e=>new Promise(t=>{setTimeout(t,e)});async function Zq(e,t,n=Xq){for(let r=0;;r++){try{await e()}catch(e){if(r>=Yq.length||!Qx(e))throw e;t(),await n(Yq[r]);continue}t();return}}function Qq(e,t,n,r,i){return Zq(()=>X.followUp({slug:e,sessionId:iC(Z.board,e)?.sessionId??``,message:t,deliveryId:n,freshProcess:r,interrupt:i}),()=>Rq(e))}function $q(e,t,n,r={}){let i=n.trim();if(!i)return!1;let a=Gq();return Kq({optimistic:()=>{r.onOptimistic?.(),pj(e,t,i,{scrollToBottom:r.scrollToBottom,deliveryId:a}),Rq(t),X.markRead({slug:t}).catch(()=>{})},request:()=>Jq(t,()=>Qq(t,i,a,r.freshProcess,r.interrupt)),success:()=>r.onSuccess?.(),failure:n=>{mj(e,t,i,a),zq(t),r.onRollback?.(),Q(r.failureToast?.(n.message)??`Steer failed — ${n.message.slice(0,90)}`)}}),!0}function eJ(e){let t=Md(),[n,r]=(0,B.useState)(0);return{submit:(0,B.useCallback)((n,i={})=>$q(t,e,n,{...i,onOptimistic:()=>{r(e=>e+1),i.onOptimistic?.()},onSuccess:()=>{r(e=>Math.max(0,e-1)),i.onSuccess?.()},onRollback:()=>{r(e=>Math.max(0,e-1)),i.onRollback?.()}}),[t,e]),pending:n>0}}function tJ(e,t){return new Promise(n=>{$q(e,t,`Continue exactly where you left off.`,{onSuccess:()=>{Q(`Retrying…`),n()},onRollback:()=>n(),failureToast:e=>`Retry failed: ${e.slice(0,80)}`})||n()})}function nJ(e){let t=/^([A-Za-z0-9][\w.-]*)\/([A-Za-z0-9][\w.-]*)#(\d+)$/.exec(e.trim());return t?`https://github.com/${t[1]}/${t[2]}/pull/${t[3]}`:null}var rJ=`Snooze`;function iJ(e,t=Date.now()){return null}function aJ(e){let t=new Set;return e.flatMap(e=>{if(e.kind!==`pr`)return[];let n=e.value.trim();return!n||t.has(n)?[]:(t.add(n),[{ref:n,url:nJ(n)}])})}function oJ(e){let t=(e.body??``).split(/\n\s*\n/).map(e=>e.trim()).find(Boolean);return t?lJ(sJ(t.replace(/\s*\n\s*/g,` `))):null}function sJ(e){if(e.length<=cJ)return e;let t=e.slice(0,cJ),n=t.lastIndexOf(` `);return`${(n>cJ/2?t.slice(0,n):t).replace(/[.,;:]$/,``)}…`}var cJ=240;function lJ(e){let t=(e.split(/\s/,1)[0]??``).replace(/[.,:;]+$/,``);return/[^a-zA-Z]/.test(t)||/[A-Z]/.test(t.slice(1))||uJ.has(t)?e:e.charAt(0).toUpperCase()+e.slice(1)}var uJ=new Set([`npm`,`npx`,`pnpm`,`nub`,`nubx`,`gh`,`git`,`node`,`bun`,`tsc`,`vite`,`curl`,`ssh`]);function dJ(e){return mJ(e)||`Waiting for an external update.`}function fJ(e){return e&&mJ(e)||null}var pJ=new Set([...Oy,`shells`,`agents`,`timers`,`prs`,`for`]);function mJ(e){return e.split(`
370
370
  `).filter(e=>{let t=/^\s*([a-z][a-z-]*):/i.exec(e)?.[1]?.toLowerCase();return!(t&&pJ.has(t))}).join(`
371
371
  `).trim()}function hJ(e){let t=[];for(let n of e){let e=n.value.trim();e&&(n.kind===`shell`?t.push(`shell ${e}`):n.kind===`agent`?t.push(`sub-agent ${e}`):n.kind===`timer`&&t.push(`a timer`))}return t}function gJ(e){let t=e.find(e=>e.kind===`for`)?.value.trim();return t?`for ${t}`:null}function _J(e){let t=t=>e.filter(e=>e.kind===t&&e.value.trim()).length,n=[...aJ(e).map(e=>e.ref),vJ(t(`shell`),`background shell`,`background shells`),vJ(t(`agent`),`sub-agent`,`sub-agents`),vJ(t(`timer`),`timer`,`timers`)].filter(e=>e!==null);return n.length>0?`waiting on ${yJ(n)}`:null}function vJ(e,t,n){return e<=0?null:e===1?`a ${t}`:`${e} ${n}`}function yJ(e){return e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`}function bJ(e){let t=e.find(e=>e.kind===`pr`);return t?`PR ${t.value}`:null}var xJ=Rf({at:{}}),SJ=12e3,CJ=new Map;function wJ(e,t=Date.now()){xJ.at[e]=t;let n=CJ.get(e);n!==void 0&&clearTimeout(n),CJ.set(e,setTimeout(()=>{CJ.delete(e),delete xJ.at[e]},SJ))}function TJ(e){let t=CJ.get(e);t!==void 0&&(clearTimeout(t),CJ.delete(e)),delete xJ.at[e]}function EJ(){return Hf(xJ).at}function DJ(e,t,n=Date.now()){return t===void 0||n-t>12e3||e.state===`archived`?e:{...e,state:`archived`,archived:!0,needsYou:!1,pendingAsk:void 0,pendingQuestion:!1,actionableInteraction:!1}}function OJ(e){let t=EJ();return(0,B.useMemo)(()=>e.map(e=>DJ(e,t[e.id])),[e,t])}var kJ=.5;function AJ(e,t,n=!1){let r=e.map(e=>({id:e.id,height:Math.max(0,e.bottom-e.top),visible:Math.min(e.bottom,t)-Math.max(e.top,0)})).filter(e=>e.visible>0);if(!r.length)return null;if(n)return r[r.length-1].id;let i=t*kJ,a=r[0];for(let e of r)if(e.visible>a.visible&&(a=e),e.visible>=Math.min(i,e.height)&&e.visible>=a.visible)return e.id;return a.id}function jJ(e,t,n,r){return!e||e.top<=r&&e.bottom>r?!0:Math.abs(t-n)>1}function MJ(e,t,n,r,i=8){return n<e+i?n-e-i:r>t-i?r-t+i:0}var NJ=`sticky top-0 self-start h-screen w-[clamp(272px,34vw,680px)] shrink-0 flex flex-col justify-center max-[800px]:static max-[800px]:h-auto max-[800px]:w-full max-[800px]:justify-start max-[800px]:pt-16`;function PJ(){let e=Hf(Z),t=OJ(Uq(tj($A()?.threads??[]))),n=xM(t,Hf(zj).queueOrder),r=nM(aM(t)),i=e.sidebarCollapsed,a=n.active,o=n.held,s=n.inactive,c=(0,B.useRef)(null),[l,u]=(0,B.useState)(null),d=(0,B.useRef)(null),f=(0,B.useCallback)(()=>{let e=[...document.querySelectorAll(`[data-queue-card][data-queue-leaving="false"]`)].map(e=>{let t=e.dataset.queueCard;if(!t)return null;let{top:n,bottom:r}=(e.querySelector(`[data-queue-card-root]`)??e).getBoundingClientRect();return{id:t,top:n,bottom:r}}).filter(e=>e!==null),t=d.current;if(t)if(jJ(e.find(e=>e.id===t.id),window.scrollY,t.landedY,40))d.current=null;else{u(t.id);return}let n=Math.max(0,document.documentElement.scrollHeight-window.innerHeight),r=n>0&&window.scrollY>=n-1,i=AJ(e,window.innerHeight,r);u(e=>e===i?e:i)},[]);(0,B.useEffect)(()=>{let e=0,t=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(f)};t(),document.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,t);let n=document.getElementById(`workpane`),r=n?new ResizeObserver(t):null,i=n?new MutationObserver(t):null;return n&&r?.observe(n),n&&i?.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-queue-card`,`data-queue-leaving`,`style`,`class`]}),()=>{cancelAnimationFrame(e),document.removeEventListener(`scroll`,t,!0),window.removeEventListener(`resize`,t),r?.disconnect(),i?.disconnect()}},[f,e.view,e.drawers.length]),(0,B.useLayoutEffect)(()=>{let e=c.current;if(!e||!l||window.matchMedia(`(max-width: 800px)`).matches)return;let t=e.querySelector(`[data-sidebar-item="${CSS.escape(l)}"]`);if(!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=MJ(n.top,n.bottom,r.top,r.bottom);Math.abs(i)>.5&&(e.scrollTop+=i)},[l]);let p=(0,B.useCallback)(e=>{d.current={id:e,landedY:AS(e)??window.scrollY},u(e)},[]);return(0,V.jsx)(`aside`,{className:NJ,children:(0,V.jsxs)(`div`,{className:`flex max-h-[calc(100vh-32px)] min-h-0 min-w-0 w-full flex-col max-[800px]:max-h-none`,children:[(0,V.jsxs)(`div`,{className:`mb-5 shrink-0 px-0.5`,children:[(0,V.jsx)(UK,{}),(0,V.jsx)(cW,{})]}),(0,V.jsxs)(`div`,{ref:c,"data-sidebar-rail":!0,className:`min-h-0 min-w-0 overflow-y-auto overflow-x-hidden max-[800px]:overflow-y-visible`,children:[a.length>0?(()=>{let{running:e,rested:t}=bM(a),n=e=>t=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(zJ,{t,active:l===t.id,onQueueNavigate:p,restedAge:e}),(0,V.jsx)(HJ,{t})]},t.id);return(0,V.jsxs)(V.Fragment,{children:[t.map(n(!0)),e.length>0&&t.length>0&&(0,V.jsx)(`hr`,{className:`my-3 border-border/50`}),e.map(n(!1))]})})():(0,V.jsx)(`div`,{className:`py-1 pl-5 pr-1.5 text-[11.5px] text-muted/50`,children:`No open threads`}),o.length>0&&(0,V.jsxs)(`section`,{"aria-label":`Held`,children:[(0,V.jsx)(`hr`,{className:`my-3 border-border/50`}),(0,V.jsx)(FJ,{label:`Held`,count:o.length,collapsed:i.held,onToggle:()=>Z.sidebarCollapsed.held=!Z.sidebarCollapsed.held}),!i.held&&o.map(e=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(zJ,{t:e,active:l===e.id,onQueueNavigate:p}),(0,V.jsx)(HJ,{t:e})]},e.id))]}),s.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`hr`,{className:`my-3 border-border/50`}),(0,V.jsx)(FJ,{label:`Done`,count:s.length,collapsed:i.inactive,onToggle:()=>Z.sidebarCollapsed.inactive=!Z.sidebarCollapsed.inactive}),!i.inactive&&s.map(e=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(zJ,{t:e,active:l===e.id,onQueueNavigate:p}),(0,V.jsx)(HJ,{t:e})]},e.id))]}),r.length>0&&(0,V.jsxs)(`section`,{"aria-label":`External`,children:[(0,V.jsx)(`hr`,{className:`my-3 border-border/50`}),(0,V.jsx)(FJ,{label:`External`,count:r.length,collapsed:i.external,onToggle:()=>Z.sidebarCollapsed.external=!Z.sidebarCollapsed.external}),!i.external&&r.map(e=>(0,V.jsx)(zJ,{t:e,active:l===e.id,onQueueNavigate:p,restedAge:!0},e.id))]})]})]})})}function FJ({label:e,count:t,collapsed:n,onToggle:r}){let i=(0,V.jsxs)(V.Fragment,{children:[r?(0,V.jsx)(PC,{size:11,className:`transition-transform ${n?``:`rotate-90`}`}):(0,V.jsx)(`span`,{className:`w-[11px] shrink-0`,"aria-hidden":!0}),(0,V.jsx)(`span`,{children:e}),(0,V.jsx)(`span`,{className:`ml-1.5 tabular-nums text-muted/60`,children:t})]}),a=`flex w-full items-center gap-1 px-1.5 py-1 text-[11px] uppercase tracking-wide text-muted/70`;return r?(0,V.jsx)(`button`,{onClick:r,className:`${a} transition-colors hover:text-fg`,children:i}):(0,V.jsx)(`div`,{className:a,children:i})}var IJ=16,LJ=12;function RJ({title:e,children:t}){let n=e.trimEnd(),r=n.lastIndexOf(` `)+1,i=n.length-r<=IJ?r:n.length-LJ;return i>=n.length?(0,V.jsxs)(V.Fragment,{children:[e,t]}):(0,V.jsxs)(V.Fragment,{children:[n.slice(0,i),(0,V.jsxs)(`span`,{className:`whitespace-nowrap`,children:[n.slice(i),t]})]})}var zJ=(0,B.memo)(function({t:e,legacy:t,active:n=!1,onQueueNavigate:r,restedAge:i=!1}){let a=!t&&e.foreign===!0,o=!t&&uM(e),s=!t&&Xj(e),c=!t&&gM(e);return(0,V.jsxs)(`div`,{"data-sidebar-item":e.id,className:`group relative flex min-w-0 items-start rounded-md transition-[color,background-color,opacity] hover:bg-white/[0.04] ${t?`opacity-80`:o?`opacity-65 hover:opacity-90 focus-within:opacity-90`:``}`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,"data-sidebar-marker-rail":!0,className:`pointer-events-none absolute inset-y-0 left-0 w-5`,children:n&&(0,V.jsx)(`span`,{"data-sidebar-scroll-marker":!0,className:`absolute inset-y-0 left-1 w-[2px] rounded-full bg-accent`})}),(0,V.jsxs)(`button`,{onClick:()=>{if(e.needsYou&&GS(e.id)){r?.(e.id);return}US(e.id)},"aria-current":n?`location`:void 0,className:`min-w-0 flex-1 flex items-start gap-2 pb-1 pl-5 pr-1.5 pt-1 text-left`,children:[(0,V.jsx)(`span`,{className:`w-4 h-[19px] shrink-0 flex items-center justify-center`,children:(0,V.jsx)(qJ,{t:e,legacy:t})}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 flex flex-col`,children:(0,V.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-3`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-[13px] leading-[19px] ${s?`text-fg/50`:o?`text-fg/75`:`text-fg/90`}`,children:(0,V.jsxs)(RJ,{title:Uj(e),children:[!t&&(0,V.jsx)(hW,{backend:e.backend,className:`ml-1`}),a&&(0,V.jsx)(`span`,{className:`petite-caps ml-1.5 inline-block rounded border border-border/60 px-1 align-[2px] text-[9.5px] leading-[14px] text-muted/55`,title:`Read-only — running in an external terminal`,children:`terminal`}),t&&(0,V.jsx)(UJ,{status:e.archived?`archived`:e.status})]})}),i&&(0,V.jsx)(BJ,{t:e,yieldsToRetry:c})]})})]}),t&&(0,V.jsx)(`div`,{className:`absolute right-1 top-1 hidden group-hover:flex items-stretch rounded-md bg-panel shadow-sm shadow-black/30`,children:(0,V.jsx)(AV,{slug:e.id,size:`sm`})}),c&&(0,V.jsx)(VJ,{slug:e.id})]})});function BJ({t:e,yieldsToRetry:t}){let n=FM(),r=eM(e),i=EM(r,n);return!r||!i?null:(0,V.jsx)(`time`,{dateTime:r,"data-rail-rested-age":!0,title:wM(r,n)??void 0,"aria-label":`Rested ${wM(r,n)??i}`,className:`shrink-0 tabular-nums text-[10.5px] leading-[19px] text-muted/55 ${t?`transition-opacity group-hover:opacity-0 group-focus-within:opacity-0`:``}`,children:i})}function VJ({slug:e}){let t=Md(),[n,r]=(0,B.useState)(!1);return(0,V.jsx)(Pq,{label:`Retry — resume this session where it left off`,children:(0,V.jsx)(`button`,{"data-sidebar-retry":e,"aria-label":`Retry exited session`,disabled:n,onMouseDown:e=>e.preventDefault(),onClick:n=>{n.stopPropagation(),r(!0),tJ(t,e).finally(()=>r(!1))},className:`absolute right-1.5 top-1 hidden h-[19px] w-[19px] items-center justify-center rounded bg-panel text-muted/70 outline-none transition-colors group-hover:flex group-focus-within:flex hover:bg-panel-2 hover:text-fg disabled:opacity-50`,children:n?(0,V.jsx)(cw,{size:13,className:`animate-spin`}):(0,V.jsx)(yw,{size:13})})})}function HJ({t:e}){let t=pN(e.subAgents??[],`rail`);return t.length===0?null:(0,V.jsx)(`div`,{className:`flex flex-col`,children:t.map(t=>(0,V.jsx)(gN,{kind:`AGENT`,label:t.label,state:t.state,density:`rail`,depth:t.depth,startedAt:t.startedAt,parentSlug:e.id,onOpen:()=>VS(e.id,t.id,{label:t.label,subagentType:t.subagentType,startedAt:t.startedAt}),onDismiss:vN(e.id,t),title:t.subagentType?`[${t.subagentType}] ${t.label}`:t.label},t.id))})}function UJ({status:e}){let t=e===`archived`?`Done`:e;return(0,V.jsx)(`span`,{className:`petite-caps ml-1.5 inline-block rounded border px-1 align-[2px] leading-[14px] text-[9.5px] ${Hj[e]??`text-muted border-border`}`,children:t})}function WJ(e,t){return[[t,_J(e.lastFence?.kind===`awaiting`?e.lastFence.hints:[])].filter(e=>!!e).join(` — `),GJ(e)].filter(e=>!!e).join(`
372
372
 
@@ -457,35 +457,35 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
457
457
  `&&!t)break;o++}i(e.slice(a,o),`str`),a=o;continue}if(y$(n)){let t=a+1;for(;t<r&&/[0-9a-fA-FxXbBoO_.]/.test(e[t]);)t++;i(e.slice(a,t),`num`),a=t;continue}if(_$(n)){let n=a+1;for(;n<r&&v$(e[n]);)n++;let o=e.slice(a,n);i(o,t.keywords.has(o)?`kw`:t.types.has(o)?`type`:t.tagNames&&(e[a-1]===`<`||e[a-1]===`/`&&e[a-2]===`<`)?`kw`:t.keyChars&&t.keyChars.includes(h$(e,n))?`key`:e[n]===`(`?`fn`:`plain`),a=n;continue}if(b$.has(n)){i(n,`punct`),a++;continue}if(x$.has(n)){let t=a+1;for(;t<r&&x$.has(e[t]);)t++;i(e.slice(a,t),`op`),a=t;continue}let o=a+1;for(;o<r&&!_$(e[o])&&!y$(e[o])&&!t.quotes.includes(e[o])&&!b$.has(e[o])&&!x$.has(e[o])&&!(t.line&&e.startsWith(t.line,o));)o++;i(e.slice(a,o),`plain`),a=o}return n}function C$(e){let t=[[]];for(let n of e){let e=n.text.split(`
458
458
  `);for(let r=0;r<e.length;r++)r>0&&t.push([]),e[r]&&t[t.length-1].push({text:e[r],kind:n.kind})}return t}function w$(e,t){if(e===``)return[];let n=p$[t];return n?C$(S$(e,n)):e.split(`
459
459
  `).map(e=>e?[{text:e,kind:`plain`}]:[])}var T$={".ts":`typescript`,".tsx":`typescript`,".mts":`typescript`,".cts":`typescript`,".js":`javascript`,".jsx":`javascript`,".mjs":`javascript`,".cjs":`javascript`,".json":`json`,".jsonc":`json`,".css":`css`,".scss":`css`,".less":`css`,".py":`python`,".go":`go`,".rs":`rust`,".java":`java`,".c":`c`,".h":`c`,".cpp":`cpp`,".hpp":`cpp`,".cc":`cpp`,".sh":`shell`,".bash":`shell`,".zsh":`shell`,".yaml":`yaml`,".yml":`yaml`,".toml":`toml`,".html":`html`,".htm":`html`,".xml":`html`,".svg":`html`},E$={Dockerfile:`shell`,Makefile:`shell`,".gitignore":`shell`,".env":`shell`,".bashrc":`shell`,".zshrc":`shell`};function D$(e){let t=e.split(`/`).pop()??``,n=t.lastIndexOf(`.`),r=n>0?t.slice(n).toLowerCase():``,i=E$[t]??T$[r]??`text`;return g$.has(i)?i:`text`}function O$(e,t,n){let r=e.length,i=t.length,a=Array.from({length:r+1},()=>new Uint32Array(i+1));for(let n=r-1;n>=0;n--)for(let r=i-1;r>=0;r--)a[n][r]=e[n]===t[r]?a[n+1][r+1]+1:Math.max(a[n+1][r],a[n][r+1]);let o=[],s=0,c=0;for(;s<r&&c<i;)e[s]===t[c]?(o.push({type:`eq`,a:n+s,b:n+c}),s++,c++):a[s+1][c]>=a[s][c+1]?(o.push({type:`del`,a:n+s,b:null}),s++):(o.push({type:`add`,a:null,b:n+c}),c++);for(;s<r;)o.push({type:`del`,a:n+s++,b:null});for(;c<i;)o.push({type:`add`,a:null,b:n+c++});return o}function k$(e,t){let n=e.length,r=t.length,i=0;for(;i<n&&i<r&&e[i]===t[i];)i++;let a=0;for(;a<n-i&&a<r-i&&e[n-1-a]===t[r-1-a];)a++;let o=[];for(let e=0;e<i;e++)o.push({type:`eq`,a:e,b:e});o.push(...O$(e.slice(i,n-a),t.slice(i,r-a),i));for(let e=0;e<a;e++)o.push({type:`eq`,a:n-a+e,b:r-a+e});return o}var A$=3,j$=e=>e===``?[]:e.split(`
460
- `);function M$(e,t,n){return e.type===`del`?{type:`del`,oldLine:e.a+1,newLine:null,tokens:t[e.a]??[]}:e.type===`add`?{type:`add`,oldLine:null,newLine:e.b+1,tokens:n[e.b]??[]}:{type:`context`,oldLine:e.a+1,newLine:e.b+1,tokens:n[e.b]??[]}}function N$(e){let t=[];for(let n=0;n<e.length;n++)e[n].type!==`context`&&t.push(n);if(t.length===0)return{hunks:[],collapsedAfter:e.length};let n=[],r=Math.max(0,t[0]-A$),i=-1;for(let a=0;a<t.length;a++){let o=t[a],s=t[a+1];i=Math.min(e.length-1,o+A$),!(s!==void 0&&s-o<=7)&&(n.push({collapsedBefore:r,lines:e.slice(r,i+1)}),s!==void 0&&(r=Math.max(i+1,s-A$)))}let a=n.length?n[n.length-1].collapsedBefore+n[n.length-1].lines.length:0;return{hunks:n,collapsedAfter:Math.max(0,e.length-a)}}function P$(e,t,n){let r=D$(n),i=w$(e,r),a=w$(t,r),o=j$(e),s=j$(t),c=e===``?`added`:t===``?`deleted`:`modified`;if(c===`added`){let e=s.map((e,t)=>({type:`add`,oldLine:null,newLine:t+1,tokens:a[t]??[]}));return{file:n,lang:r,status:c,hunks:[{collapsedBefore:0,lines:e}],collapsedAfter:0,additions:e.length,deletions:0}}if(c===`deleted`){let e=o.map((e,t)=>({type:`del`,oldLine:t+1,newLine:null,tokens:i[t]??[]}));return{file:n,lang:r,status:c,hunks:[{collapsedBefore:0,lines:e}],collapsedAfter:0,additions:0,deletions:e.length}}let l=k$(o,s).map(e=>M$(e,i,a)),u=l.filter(e=>e.type===`add`).length,d=l.filter(e=>e.type===`del`).length,{hunks:f,collapsedAfter:p}=N$(l);return{file:n,lang:r,status:c,hunks:f,collapsedAfter:p,additions:u,deletions:d}}function F$(){let e=e=>{if(e.button!==0||e.defaultPrevented)return;let t=e.target instanceof Element?e.target.closest(`[data-local-path]`):null,n=t?.dataset.localPath;!t||!n||(e.preventDefault(),e.stopPropagation(),L$(n,t.dataset.localImage===`true`))};document.addEventListener(`click`,e);let t=I$();return document.addEventListener(`error`,t,!0),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`error`,t,!0)}}function I$(){return e=>{let t=e.target;if(!(t instanceof HTMLImageElement)||t.dataset.localImage!==`true`||!t.closest(`.md-body, .md-inline`))return;let n=t.dataset.localPath??t.getAttribute(`src`)??``,r=document.createElement(`span`);r.className=`md-image-missing font-mono-keep`,r.textContent=n,t.alt&&t.alt!==n&&(r.title=t.alt),(t.closest(`.md-image-frame`)??t).replaceWith(r)}}function L$(e,t=!1){if(!t&&HH(e)){JS(e);return}R$(e,t)}async function R$(e,t){try{let n=await X.openLocalFile({path:e,...t?{image:!0}:{}});n.action===`copy`&&(await bU(n.path),Q(`Copied local path`))}catch(e){Q(`Could not open local file: ${e.message.slice(0,100)}`)}}var z$=`a, button, input, select, textarea, summary, label, [role="button"], [role="link"]`;function B$(e){let t=e;return typeof t?.closest==`function`&&t.closest(z$)!=null}function V$({children:e,className:t,controls:n,expanded:r,label:i,meta:a,onToggle:o,chevronSize:s=12}){function c(e){if(B$(e.target))return;let t=typeof window>`u`?null:window.getSelection();t&&!t.isCollapsed&&t.toString().trim()!==``||o()}return(0,B.createElement)(`div`,{className:`${t} w-full cursor-pointer text-left`,"data-expanded":r,onClick:c},(0,B.createElement)(`span`,{className:`flex min-w-0 items-center gap-2`},e),(0,B.createElement)(`span`,{className:`flex shrink-0 items-center gap-1.5`},a,(0,B.createElement)(`button`,{type:`button`,"data-tool-disclosure":!0,"aria-controls":n,"aria-expanded":r,"aria-label":i,title:i,onClick:o,className:`-m-1 inline-flex shrink-0 items-center justify-center rounded p-1 text-muted outline-none transition-colors hover:text-fg/80 focus-visible:ring-1 focus-visible:ring-fg/60`},(0,B.createElement)(PC,{"aria-hidden":!0,size:s,className:`relative -top-px shrink-0 transition-transform ${r?`rotate-90`:``}`}))))}function H$({path:e,className:t=``,children:n}){return(0,V.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),L$(e)},title:e,className:`font-mono-keep block max-w-full cursor-pointer truncate text-left hover:underline hover:text-fg/80 ${t}`,children:n??e})}function U$(e){let t=e.split(`/`).filter(Boolean);return t.length?t[t.length-1]:e}function W$({edits:e,meta:t}){let{compactDiffs:n}=Hf(zj),r=(0,B.useId)(),i=e[0].file,a=(0,B.useMemo)(()=>e.map(e=>P$(e.old,e.new,e.file)),[e]),o=a.reduce((e,t)=>e+t.additions,0),s=a.reduce((e,t)=>e+t.deletions,0),[c,l]=(0,B.useState)(null);(0,B.useEffect)(()=>l(null),[n]);let u=c??!n;return(0,V.jsxs)(`div`,{className:`frizz-diff`,children:[(0,V.jsxs)(V$,{className:`frizz-diff-header`,controls:r,expanded:u,label:`${u?`Collapse`:`Expand`} Edit diff: ${i}`,onToggle:()=>l(!u),meta:t,chevronSize:11,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Edit`}),(0,V.jsx)(`span`,{className:`frizz-diff-file`,children:(0,V.jsx)(H$,{path:i,className:`text-inherit no-underline`,children:U$(i)})}),o>0&&(0,V.jsxs)(`span`,{className:`frizz-diff-add tabular-nums shrink-0`,children:[`+`,o]}),s>0&&(0,V.jsxs)(`span`,{className:`frizz-diff-del tabular-nums shrink-0`,children:[`−`,s]})]}),(0,V.jsx)(`div`,{id:r,className:`frizz-diff-body`,hidden:!u,children:u&&a.map((e,t)=>(0,V.jsx)(`div`,{className:t>0?`frizz-diff-editsep`:void 0,children:(0,V.jsx)(G$,{hunks:e.hunks,collapsedAfter:e.collapsedAfter})},t))})]})}function G$({hunks:e,collapsedAfter:t}){let n=0,r=[];return e.forEach((e,t)=>{let i=e.collapsedBefore-n;i>0&&r.push((0,V.jsx)(K$,{n:i},`s${t}`));for(let n of e.lines){let e=n.type===`del`?n.oldLine:n.newLine,i=n.type===`add`?`+`:n.type===`del`?`-`:` `;r.push((0,V.jsxs)(`div`,{className:`frizz-diff-line`,"data-type":n.type,children:[(0,V.jsx)(`span`,{className:`frizz-diff-gutter`,children:e}),(0,V.jsx)(`span`,{className:`frizz-diff-sign`,children:i}),(0,V.jsx)(`span`,{className:`frizz-diff-code`,children:n.tokens.map((e,t)=>(0,V.jsx)(`span`,{className:`ftk-${e.kind}`,children:e.text},t))})]},`${t}:${n.oldLine}:${n.newLine}`))}n=e.collapsedBefore+e.lines.length}),t>0&&r.push((0,V.jsx)(K$,{n:t},`safter`)),(0,V.jsx)(V.Fragment,{children:r})}function K$({n:e}){return(0,V.jsxs)(`div`,{className:`frizz-diff-sep`,children:[e,` unchanged line`,e===1?``:`s`]})}var q$=/<span\b[^>]*>|<\/span>|\n|[^<\n]+|</g;function J$(e){let t=[],n=[],r=``;for(let[i]of e.matchAll(q$))i===`
461
- `?(t.push(r+`</span>`.repeat(n.length)),r=n.join(``)):i===`</span>`?(n.pop(),r+=i):(i.startsWith(`<span`)&&n.push(i),r+=i);return t.push(r+`</span>`.repeat(n.length)),t}var Y$=/^(\s*\d+\t)([\s\S]*)$/,X$=/^\s*\d+$/;function Z$(e){let t=0,n=0,r=0;for(let i of e)i.trim()&&(t++,Y$.test(i)?(n++,r++):X$.test(i)&&n++);return t>0&&n===t&&r>0}function Q$(e){return e.replace(/[&<>"']/g,e=>e===`&`?`&amp;`:e===`<`?`&lt;`:e===`>`?`&gt;`:e===`"`?`&quot;`:`&#39;`)}var $$=`frizz-code-gutter`;function e1(e,t){let n=e.split(`
462
- `);if(!Z$(n))return wQ(e,t);let r=[],i=[];for(let e of n){let t=Y$.exec(e);t?(r.push(t[1]),i.push(t[2])):e.trim()&&X$.test(e)?(r.push(e),i.push(``)):(r.push(``),i.push(e))}let a=J$(wQ(i.join(`
463
- `),t));return r.map((e,t)=>(e?`<span class="${$$}">${Q$(e)}</span>`:``)+(a[t]??``)).join(`
464
- `)}function t1(e){return(0,B.useMemo)(()=>({__html:e}),[e])}function n1({text:e,language:t,className:n=``,...r}){let i=t1((0,B.useMemo)(()=>e1(e,t),[e,t]));return(0,V.jsx)(`pre`,{...r,className:`hljs ${n}`,dangerouslySetInnerHTML:i})}var r1=`Todos`,i1={pending:{Icon:Dw,className:`text-muted/50`},in_progress:{Icon:Tw,className:`text-accent`},completed:{Icon:ww,className:`text-muted/75`}},a1={pending:`text-fg/75`,in_progress:`text-fg`,completed:`text-muted/70`};function o1({status:e}){let{Icon:t,className:n}=i1[e];return(0,V.jsx)(t,{"aria-hidden":`true`,size:`1em`,strokeWidth:2,className:`frizz-todo-mark shrink-0 ${n}`})}var s1={pending:`to do`,in_progress:`in progress`,completed:`done`};function c1({todos:e,note:t,meta:n}){let[r,i]=(0,B.useState)(!1),a=(0,B.useId)(),o=e.filter(e=>e.status===`completed`).length,s=e.find(e=>e.status===`in_progress`),c=e.length>0||!!t,l=e.length>0?`${o}/${e.length}`:void 0,u=s?s.text:e.length===0?`empty`:void 0;return(0,V.jsxs)(`div`,{className:`frizz-bash`,"data-todo-card":!0,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>c&&i(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":c?a:void 0,"aria-expanded":c?r:void 0,"aria-label":`${c?`${r?`Collapse`:`Expand`} `:``}${r1}${u?`: ${u}`:``}${l?` — ${o} of ${e.length} done`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:r1}),u&&(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-[11.5px]`,title:u,"data-todo-headline":!0,children:[s&&(0,V.jsx)(o1,{status:`in_progress`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate text-muted`,children:u})]})]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[l&&(0,V.jsx)(`span`,{className:`frizz-tool-header-caps tabular-nums text-[11px] text-muted/55`,title:`${o} of ${e.length} done`,children:l}),n,c&&(0,V.jsx)(PC,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${r?`rotate-90`:``}`})]})]}),c&&(0,V.jsxs)(`div`,{id:a,hidden:!r,children:[r&&e.length>0&&(0,V.jsx)(`ul`,{className:`frizz-todo-list`,children:e.map((e,t)=>(0,V.jsxs)(`li`,{className:`frizz-todo-row`,"data-current":e.status===`in_progress`?`true`:void 0,children:[(0,V.jsx)(o1,{status:e.status}),(0,V.jsx)(`span`,{className:`min-w-0 ${a1[e.status]}`,children:e.text}),(0,V.jsx)(`span`,{className:`sr-only`,children:` — ${s1[e.status]}`})]},t))}),r&&t&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:`note`}),(0,V.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body`,children:t})]})]})]})}var l1=/^```question(?:[ \t]+([A-Za-z][^\r\n]*?))?[ \t]*\r?\n([\s\S]*?)\r?\n```[ \t]*$/gm;function u1(e){let t=(e??``).toLowerCase().split(/\s+/).filter(Boolean),n=e=>t.includes(e);return{kind:n(`multi`)?`multi`:`question`,danger:n(`danger`)}}function d1(e){let t=[],n=iy(e),r=0;l1.lastIndex=0;for(let i=l1.exec(e);i!==null;i=l1.exec(e)){if(n(i.index)){l1.lastIndex=i.index+1;continue}let a=e.slice(r,i.index);a.trim()&&t.push({kind:`prose`,text:a});let{kind:o,danger:s}=u1(i[1]);t.push({kind:`question`,text:i[2],questionKind:o,danger:s}),r=i.index+i[0].length}let i=e.slice(r);return i.trim()&&t.push({kind:`prose`,text:i}),f1(t)}function f1(e){for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(n.kind!==`question`||r.kind!==`prose`)continue;let i=w1(n.text,n.questionKind,n.danger),a=null;if(i.options.length>0){if(i.trailingMd!==void 0||i.recommendation!==void 0)continue;let e=D1(i.options[i.options.length-1]);if(!/^([A-Z]|\d+)$/.test(e))continue;a=e}let o=p1(r.text,a);o!==null&&(e[t]={...n,text:n.text.replace(/\s+$/,``)+`
465
-
466
- `+o.run},o.rest.trim()?e[t+1]={kind:`prose`,text:o.rest}:e.splice(t+1,1))}return e}function p1(e,t){let n=e.split(`
467
- `).map(e=>e.replace(/\r$/,``)),r=0;for(;r<n.length&&n[r].trim()===``;)r++;if(r>=n.length||!h1.test(n[r]))return null;let i=v1(n[r]);if(t===null?!b1(i):!y1(t,i))return null;let a=r,o=i;for(let e=r+1;e<n.length;e++){let t=n[e];if(h1.test(t)){if(!y1(o,v1(t)))break;o=v1(t),a=e;continue}if(t.trim()===``)continue;if(g1.test(t)){a=e;break}let r=n.findIndex((t,n)=>n>e&&h1.test(t));if(r===-1||!y1(o,v1(n[r])))break}let s=n.slice(r,a+1);return s.filter(e=>h1.test(e)).length<(t===null?2:1)?null:{run:s.join(`
460
+ `);function M$(e,t,n){return e.type===`del`?{type:`del`,oldLine:e.a+1,newLine:null,tokens:t[e.a]??[]}:e.type===`add`?{type:`add`,oldLine:null,newLine:e.b+1,tokens:n[e.b]??[]}:{type:`context`,oldLine:e.a+1,newLine:e.b+1,tokens:n[e.b]??[]}}function N$(e){let t=[];for(let n=0;n<e.length;n++)e[n].type!==`context`&&t.push(n);if(t.length===0)return{hunks:[],collapsedAfter:e.length};let n=[],r=Math.max(0,t[0]-A$),i=-1;for(let a=0;a<t.length;a++){let o=t[a],s=t[a+1];i=Math.min(e.length-1,o+A$),!(s!==void 0&&s-o<=7)&&(n.push({collapsedBefore:r,lines:e.slice(r,i+1)}),s!==void 0&&(r=Math.max(i+1,s-A$)))}let a=n.length?n[n.length-1].collapsedBefore+n[n.length-1].lines.length:0;return{hunks:n,collapsedAfter:Math.max(0,e.length-a)}}function P$(e,t,n){let r=D$(n),i=w$(e,r),a=w$(t,r),o=j$(e),s=j$(t),c=e===``?`added`:t===``?`deleted`:`modified`;if(c===`added`){let e=s.map((e,t)=>({type:`add`,oldLine:null,newLine:t+1,tokens:a[t]??[]}));return{file:n,lang:r,status:c,hunks:[{collapsedBefore:0,lines:e}],collapsedAfter:0,additions:e.length,deletions:0}}if(c===`deleted`){let e=o.map((e,t)=>({type:`del`,oldLine:t+1,newLine:null,tokens:i[t]??[]}));return{file:n,lang:r,status:c,hunks:[{collapsedBefore:0,lines:e}],collapsedAfter:0,additions:0,deletions:e.length}}let l=k$(o,s).map(e=>M$(e,i,a)),u=l.filter(e=>e.type===`add`).length,d=l.filter(e=>e.type===`del`).length,{hunks:f,collapsedAfter:p}=N$(l);return{file:n,lang:r,status:c,hunks:f,collapsedAfter:p,additions:u,deletions:d}}function F$(){let e=e=>{if(e.button!==0||e.defaultPrevented)return;let t=e.target instanceof Element?e.target.closest(`[data-local-path]`):null,n=t?.dataset.localPath;!t||!n||(e.preventDefault(),e.stopPropagation(),L$(n,t.dataset.localImage===`true`))};document.addEventListener(`click`,e);let t=I$();return document.addEventListener(`error`,t,!0),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`error`,t,!0)}}function I$(){return e=>{let t=e.target;if(!(t instanceof HTMLImageElement)||t.dataset.localImage!==`true`||!t.closest(`.md-body, .md-inline`))return;let n=t.dataset.localPath??t.getAttribute(`src`)??``,r=document.createElement(`span`);r.className=`md-image-missing font-mono-keep`,r.textContent=n,t.alt&&t.alt!==n&&(r.title=t.alt),(t.closest(`.md-image-frame`)??t).replaceWith(r)}}function L$(e,t=!1){if(!t&&HH(e)){JS(e);return}R$(e,t)}async function R$(e,t){try{let n=await X.openLocalFile({path:e,...t?{image:!0}:{}});n.action===`copy`&&(await bU(n.path),Q(`Copied local path`))}catch(e){Q(`Could not open local file: ${e.message.slice(0,100)}`)}}var z$=`a, button, input, select, textarea, summary, label, [role="button"], [role="link"]`;function B$(e){let t=e;return typeof t?.closest==`function`&&t.closest(z$)!=null}function V$({children:e,className:t,controls:n,expanded:r,label:i,meta:a,onToggle:o,chevronSize:s=12}){function c(e){if(B$(e.target))return;let t=typeof window>`u`?null:window.getSelection();t&&!t.isCollapsed&&t.toString().trim()!==``||o()}return(0,B.createElement)(`div`,{className:`${t} w-full cursor-pointer text-left`,"data-expanded":r,onClick:c},(0,B.createElement)(`span`,{className:`flex min-w-0 items-center gap-2`},e),(0,B.createElement)(`span`,{className:`flex shrink-0 items-center gap-1.5`},a,(0,B.createElement)(`button`,{type:`button`,"data-tool-disclosure":!0,"aria-controls":n,"aria-expanded":r,"aria-label":i,title:i,onClick:o,className:`-m-1 inline-flex shrink-0 items-center justify-center rounded p-1 text-muted outline-none transition-colors hover:text-fg/80 focus-visible:ring-1 focus-visible:ring-fg/60`},(0,B.createElement)(PC,{"aria-hidden":!0,size:s,className:`relative -top-px shrink-0 transition-transform ${r?`rotate-90`:``}`}))))}function H$({path:e,className:t=``,children:n}){return(0,V.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),L$(e)},title:e,className:`font-mono-keep block max-w-full cursor-pointer truncate text-left hover:underline hover:text-fg/80 ${t}`,children:n??e})}function U$(e){let t=e.split(`/`).filter(Boolean);return t.length?t[t.length-1]:e}function W$({edits:e,meta:t}){let{compactDiffs:n}=Hf(zj),r=(0,B.useId)(),i=e[0].file,a=(0,B.useMemo)(()=>e.map(e=>P$(e.old,e.new,e.file)),[e]),o=a.reduce((e,t)=>e+t.additions,0),s=a.reduce((e,t)=>e+t.deletions,0),[c,l]=(0,B.useState)(null);(0,B.useEffect)(()=>l(null),[n]);let u=c??!n;return(0,V.jsxs)(`div`,{className:`frizz-diff`,children:[(0,V.jsxs)(V$,{className:`frizz-diff-header`,controls:r,expanded:u,label:`${u?`Collapse`:`Expand`} Edit diff: ${i}`,onToggle:()=>l(!u),meta:t,chevronSize:11,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Edit`}),(0,V.jsx)(`span`,{className:`frizz-diff-file`,children:(0,V.jsx)(H$,{path:i,className:`text-inherit no-underline`,children:U$(i)})}),o>0&&(0,V.jsxs)(`span`,{className:`frizz-diff-add tabular-nums shrink-0`,children:[`+`,o]}),s>0&&(0,V.jsxs)(`span`,{className:`frizz-diff-del tabular-nums shrink-0`,children:[`−`,s]})]}),(0,V.jsx)(`div`,{id:r,className:`frizz-diff-body`,hidden:!u,children:u&&a.map((e,t)=>(0,V.jsx)(`div`,{className:t>0?`frizz-diff-editsep`:void 0,children:(0,V.jsx)(G$,{hunks:e.hunks,collapsedAfter:e.collapsedAfter})},t))})]})}function G$({hunks:e,collapsedAfter:t}){let n=0,r=[];return e.forEach((e,t)=>{let i=e.collapsedBefore-n;i>0&&r.push((0,V.jsx)(K$,{n:i},`s${t}`));for(let n of e.lines){let e=n.type===`del`?n.oldLine:n.newLine,i=n.type===`add`?`+`:n.type===`del`?`-`:` `;r.push((0,V.jsxs)(`div`,{className:`frizz-diff-line`,"data-type":n.type,children:[(0,V.jsx)(`span`,{className:`frizz-diff-gutter`,children:e}),(0,V.jsx)(`span`,{className:`frizz-diff-sign`,children:i}),(0,V.jsx)(`span`,{className:`frizz-diff-code`,children:n.tokens.map((e,t)=>(0,V.jsx)(`span`,{className:`ftk-${e.kind}`,children:e.text},t))})]},`${t}:${n.oldLine}:${n.newLine}`))}n=e.collapsedBefore+e.lines.length}),t>0&&r.push((0,V.jsx)(K$,{n:t},`safter`)),(0,V.jsx)(V.Fragment,{children:r})}function K$({n:e}){return(0,V.jsxs)(`div`,{className:`frizz-diff-sep`,children:[e,` unchanged line`,e===1?``:`s`]})}function q$(e){return(0,B.useMemo)(()=>({__html:e}),[e])}var J$=/^[\w.@+-]+\.[a-z][a-z0-9]{0,7}$/i;function Y$(e){let t=e.trim();return!t||t.length>1024||/\s/.test(t)||/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?!1:t===`~`||t.startsWith(`~/`)||t.startsWith(`/`)||t.includes(`/`)?!0:J$.test(t)}var X$=new Map,Z$=new Set,Q$=0,$$=new Set,e1=e=>($$.add(e),()=>{$$.delete(e)}),t1=()=>Q$,n1=128;async function r1(e){let t=[...new Set(e)].filter(e=>!X$.has(e)&&!Z$.has(e));if(!t.length)return;for(let e of t)Z$.add(e);let n=[];for(let e=0;e<t.length;e+=n1)n.push(t.slice(e,e+n1));let r=await Promise.all(n.map(async e=>{try{return(await X.resolveLocalPaths({paths:e})).resolved}catch{return e.map(e=>({input:e,path:null}))}})),i=!1;for(let e of r)for(let t of e)X$.has(t.input)||(X$.set(t.input,t.path),i=!0);for(let e of t)Z$.delete(e);if(i){Q$+=1;for(let e of $$)e()}}function i1(e,t){e.setAttribute(`data-local-path`,t),e.setAttribute(`title`,`Open ${t}`),e.classList.add(`local-file-code`)}function a1(e,t){(0,B.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=[];for(let e of t.querySelectorAll(`code`)){if(e.closest(`pre`)||e.closest(`a, [data-local-path]`))continue;let t=(e.textContent??``).trim();if(!Y$(t))continue;let r=X$.get(t);r===void 0?n.push(t):r&&i1(e,r)}n.length&&r1(n)},[e,t,(0,B.useSyncExternalStore)(e1,t1,t1)])}function o1({as:e=`div`,className:t,html:n}){let r=q$(n),i=(0,B.useRef)(null);return a1(i,n),(0,B.createElement)(e,{ref:i,className:t,dangerouslySetInnerHTML:r})}var s1=/<span\b[^>]*>|<\/span>|\n|[^<\n]+|</g;function c1(e){let t=[],n=[],r=``;for(let[i]of e.matchAll(s1))i===`
461
+ `?(t.push(r+`</span>`.repeat(n.length)),r=n.join(``)):i===`</span>`?(n.pop(),r+=i):(i.startsWith(`<span`)&&n.push(i),r+=i);return t.push(r+`</span>`.repeat(n.length)),t}var l1=/^(\s*\d+\t)([\s\S]*)$/,u1=/^\s*\d+$/;function d1(e){let t=0,n=0,r=0;for(let i of e)i.trim()&&(t++,l1.test(i)?(n++,r++):u1.test(i)&&n++);return t>0&&n===t&&r>0}function f1(e){return e.replace(/[&<>"']/g,e=>e===`&`?`&amp;`:e===`<`?`&lt;`:e===`>`?`&gt;`:e===`"`?`&quot;`:`&#39;`)}var p1=`frizz-code-gutter`;function m1(e,t){let n=e.split(`
462
+ `);if(!d1(n))return wQ(e,t);let r=[],i=[];for(let e of n){let t=l1.exec(e);t?(r.push(t[1]),i.push(t[2])):e.trim()&&u1.test(e)?(r.push(e),i.push(``)):(r.push(``),i.push(e))}let a=c1(wQ(i.join(`
463
+ `),t));return r.map((e,t)=>(e?`<span class="${p1}">${f1(e)}</span>`:``)+(a[t]??``)).join(`
464
+ `)}function h1({text:e,language:t,className:n=``,...r}){let i=q$((0,B.useMemo)(()=>m1(e,t),[e,t]));return(0,V.jsx)(`pre`,{...r,className:`hljs ${n}`,dangerouslySetInnerHTML:i})}var g1=`Todos`,_1={pending:{Icon:Dw,className:`text-muted/50`},in_progress:{Icon:Tw,className:`text-accent`},completed:{Icon:ww,className:`text-muted/75`}},v1={pending:`text-fg/75`,in_progress:`text-fg`,completed:`text-muted/70`};function y1({status:e}){let{Icon:t,className:n}=_1[e];return(0,V.jsx)(t,{"aria-hidden":`true`,size:`1em`,strokeWidth:2,className:`frizz-todo-mark shrink-0 ${n}`})}var b1={pending:`to do`,in_progress:`in progress`,completed:`done`};function x1({todos:e,note:t,meta:n}){let[r,i]=(0,B.useState)(!1),a=(0,B.useId)(),o=e.filter(e=>e.status===`completed`).length,s=e.find(e=>e.status===`in_progress`),c=e.length>0||!!t,l=e.length>0?`${o}/${e.length}`:void 0,u=s?s.text:e.length===0?`empty`:void 0;return(0,V.jsxs)(`div`,{className:`frizz-bash`,"data-todo-card":!0,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>c&&i(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":c?a:void 0,"aria-expanded":c?r:void 0,"aria-label":`${c?`${r?`Collapse`:`Expand`} `:``}${g1}${u?`: ${u}`:``}${l?` — ${o} of ${e.length} done`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:g1}),u&&(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-[11.5px]`,title:u,"data-todo-headline":!0,children:[s&&(0,V.jsx)(y1,{status:`in_progress`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate text-muted`,children:u})]})]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[l&&(0,V.jsx)(`span`,{className:`frizz-tool-header-caps tabular-nums text-[11px] text-muted/55`,title:`${o} of ${e.length} done`,children:l}),n,c&&(0,V.jsx)(PC,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${r?`rotate-90`:``}`})]})]}),c&&(0,V.jsxs)(`div`,{id:a,hidden:!r,children:[r&&e.length>0&&(0,V.jsx)(`ul`,{className:`frizz-todo-list`,children:e.map((e,t)=>(0,V.jsxs)(`li`,{className:`frizz-todo-row`,"data-current":e.status===`in_progress`?`true`:void 0,children:[(0,V.jsx)(y1,{status:e.status}),(0,V.jsx)(`span`,{className:`min-w-0 ${v1[e.status]}`,children:e.text}),(0,V.jsx)(`span`,{className:`sr-only`,children:` — ${b1[e.status]}`})]},t))}),r&&t&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:`note`}),(0,V.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body`,children:t})]})]})]})}var S1=/^```question(?:[ \t]+([A-Za-z][^\r\n]*?))?[ \t]*\r?\n([\s\S]*?)\r?\n```[ \t]*$/gm;function C1(e){let t=(e??``).toLowerCase().split(/\s+/).filter(Boolean),n=e=>t.includes(e);return{kind:n(`multi`)?`multi`:`question`,danger:n(`danger`)}}function w1(e){let t=[],n=ry(e),r=0;S1.lastIndex=0;for(let i=S1.exec(e);i!==null;i=S1.exec(e)){if(n(i.index)){S1.lastIndex=i.index+1;continue}let a=e.slice(r,i.index);a.trim()&&t.push({kind:`prose`,text:a});let{kind:o,danger:s}=C1(i[1]);t.push({kind:`question`,text:i[2],questionKind:o,danger:s}),r=i.index+i[0].length}let i=e.slice(r);return i.trim()&&t.push({kind:`prose`,text:i}),T1(t)}function T1(e){for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(n.kind!==`question`||r.kind!==`prose`)continue;let i=L1(n.text,n.questionKind,n.danger),a=null;if(i.options.length>0){if(i.trailingMd!==void 0||i.recommendation!==void 0)continue;let e=B1(i.options[i.options.length-1]);if(!/^([A-Z]|\d+)$/.test(e))continue;a=e}let o=E1(r.text,a);o!==null&&(e[t]={...n,text:n.text.replace(/\s+$/,``)+`
465
+
466
+ `+o.run},o.rest.trim()?e[t+1]={kind:`prose`,text:o.rest}:e.splice(t+1,1))}return e}function E1(e,t){let n=e.split(`
467
+ `).map(e=>e.replace(/\r$/,``)),r=0;for(;r<n.length&&n[r].trim()===``;)r++;if(r>=n.length||!O1.test(n[r]))return null;let i=j1(n[r]);if(t===null?!N1(i):!M1(t,i))return null;let a=r,o=i;for(let e=r+1;e<n.length;e++){let t=n[e];if(O1.test(t)){if(!M1(o,j1(t)))break;o=j1(t),a=e;continue}if(t.trim()===``)continue;if(k1.test(t)){a=e;break}let r=n.findIndex((t,n)=>n>e&&O1.test(t));if(r===-1||!M1(o,j1(n[r])))break}let s=n.slice(r,a+1);return s.filter(e=>O1.test(e)).length<(t===null?2:1)?null:{run:s.join(`
468
468
  `),rest:n.slice(a+1).join(`
469
- `)}}function m1(e){return e.includes("```question")&&d1(e).some(e=>e.kind===`question`)}var h1=/^\s*(?:[-*+]\s+)?([A-Z]|\d+)[.)]\s+\S/,g1=/^\s*recommendation\b/i;function _1(e){return e.trim().replace(/^[-*+]\s+/,``)}function v1(e){return _1(e).match(/^([A-Za-z]|\d+)[.)]/)?.[1].toUpperCase()??``}function y1(e,t){return/^\d+$/.test(e)?/^\d+$/.test(t)&&Number(t)===Number(e)+1:/^[A-Z]$/.test(e)&&/^[A-Z]$/.test(t)&&t.charCodeAt(0)===e.charCodeAt(0)+1}var b1=e=>e===`A`||e===`1`,x1=/(^|[^a-z])recommended([^a-z]|$)/i;function S1(e){return e.replace(/\s{2,}/g,` `).trim()}function C1(e){if(!x1.test(e))return{label:e,recommended:!1};let t=e.match(/\s*[—–-]?\s*[([]\s*[*_`~]*recommended\b(?:\s*[::,;—–-]\s*([^)\]]*?))?\s*[*_`~]*\s*[)\]]/i);if(t){let n=t[1]?.trim()||void 0;return{label:S1(e.slice(0,t.index)+e.slice(t.index+t[0].length)),recommended:!0,note:n}}let n=e.match(/\s*[—–:-]?\s*[*_`~]+recommended\b[*_`~]+\s*[—–:-]?\s*/i);if(n)return{label:S1(e.slice(0,n.index)+` `+e.slice(n.index+n[0].length)),recommended:!0};let r=e.match(/\s*[—–:-]?\s*recommended\b\s*$/i);if(r&&r.index>0)return{label:S1(e.slice(0,r.index)),recommended:!0};let i=e.match(/^(\s*(?:[A-Za-z]|\d+)[.)]\s*)?[*_`~]*recommended\b[*_`~]*\s*[::—–-]\s*/i);if(i){let t=S1((i[1]??``)+e.slice(i[0].length));if(t)return{label:t,recommended:!0}}return{label:e,recommended:!1}}function w1(e,t,n=!1){let r=e.split(`
470
- `).map(e=>e.replace(/\r$/,``)),i=e=>r.findIndex((t,n)=>n>e&&h1.test(t)),a=e=>{let t=[];for(let n=e;n<r.length;n++){if(h1.test(r[n])){t.push(n);continue}if(t.length===0||r[n].trim()===``)continue;if(g1.test(r[n]))break;let e=i(n);if(e===-1||!y1(v1(r[t[t.length-1]]),v1(r[e])))break}return t},o=e=>{for(let t=e.length-1;t>0;t--)if(!y1(v1(r[e[t-1]]),v1(r[e[t]])))return b1(v1(r[e[t]]))?t:0;return+(e.length===1&&!/^\s*[-*+]\s/.test(r[e[0]])&&!r.slice(0,e[0]).some(e=>e.trim()))},s=[];for(let e=0;e<r.length;){let t=a(e);if(t.length===0)break;let n=o(t);if(n<t.length){s=t.slice(n);break}e=t[0]+1}if(s.length===0)return{kind:t,danger:n,contextMd:e,options:[],recommendedIdx:null};let c=s[0],l=s[s.length-1],u=[],d=null,f,p=[];for(let[e,t]of s.entries()){let{label:n,recommended:i,note:a}=C1(_1(r[t]));i&&d===null&&(d=u.length,f=a),u.push(n);let o=e===0?[]:r.slice(s[e-1]+1,t).filter(e=>e.trim());p.push(o.length?o.join(`
469
+ `)}}function D1(e){return e.includes("```question")&&w1(e).some(e=>e.kind===`question`)}var O1=/^\s*(?:[-*+]\s+)?([A-Z]|\d+)[.)]\s+\S/,k1=/^\s*recommendation\b/i;function A1(e){return e.trim().replace(/^[-*+]\s+/,``)}function j1(e){return A1(e).match(/^([A-Za-z]|\d+)[.)]/)?.[1].toUpperCase()??``}function M1(e,t){return/^\d+$/.test(e)?/^\d+$/.test(t)&&Number(t)===Number(e)+1:/^[A-Z]$/.test(e)&&/^[A-Z]$/.test(t)&&t.charCodeAt(0)===e.charCodeAt(0)+1}var N1=e=>e===`A`||e===`1`,P1=/(^|[^a-z])recommended([^a-z]|$)/i;function F1(e){return e.replace(/\s{2,}/g,` `).trim()}function I1(e){if(!P1.test(e))return{label:e,recommended:!1};let t=e.match(/\s*[—–-]?\s*[([]\s*[*_`~]*recommended\b(?:\s*[::,;—–-]\s*([^)\]]*?))?\s*[*_`~]*\s*[)\]]/i);if(t){let n=t[1]?.trim()||void 0;return{label:F1(e.slice(0,t.index)+e.slice(t.index+t[0].length)),recommended:!0,note:n}}let n=e.match(/\s*[—–:-]?\s*[*_`~]+recommended\b[*_`~]+\s*[—–:-]?\s*/i);if(n)return{label:F1(e.slice(0,n.index)+` `+e.slice(n.index+n[0].length)),recommended:!0};let r=e.match(/\s*[—–:-]?\s*recommended\b\s*$/i);if(r&&r.index>0)return{label:F1(e.slice(0,r.index)),recommended:!0};let i=e.match(/^(\s*(?:[A-Za-z]|\d+)[.)]\s*)?[*_`~]*recommended\b[*_`~]*\s*[::—–-]\s*/i);if(i){let t=F1((i[1]??``)+e.slice(i[0].length));if(t)return{label:t,recommended:!0}}return{label:e,recommended:!1}}function L1(e,t,n=!1){let r=e.split(`
470
+ `).map(e=>e.replace(/\r$/,``)),i=e=>r.findIndex((t,n)=>n>e&&O1.test(t)),a=e=>{let t=[];for(let n=e;n<r.length;n++){if(O1.test(r[n])){t.push(n);continue}if(t.length===0||r[n].trim()===``)continue;if(k1.test(r[n]))break;let e=i(n);if(e===-1||!M1(j1(r[t[t.length-1]]),j1(r[e])))break}return t},o=e=>{for(let t=e.length-1;t>0;t--)if(!M1(j1(r[e[t-1]]),j1(r[e[t]])))return N1(j1(r[e[t]]))?t:0;return+(e.length===1&&!/^\s*[-*+]\s/.test(r[e[0]])&&!r.slice(0,e[0]).some(e=>e.trim()))},s=[];for(let e=0;e<r.length;){let t=a(e);if(t.length===0)break;let n=o(t);if(n<t.length){s=t.slice(n);break}e=t[0]+1}if(s.length===0)return{kind:t,danger:n,contextMd:e,options:[],recommendedIdx:null};let c=s[0],l=s[s.length-1],u=[],d=null,f,p=[];for(let[e,t]of s.entries()){let{label:n,recommended:i,note:a}=I1(A1(r[t]));i&&d===null&&(d=u.length,f=a),u.push(n);let o=e===0?[]:r.slice(s[e-1]+1,t).filter(e=>e.trim());p.push(o.length?o.join(`
471
471
  `):void 0)}let m=e=>{let t=0,n=e.length-1;for(;t<=n&&e[t].trim()===``;)t++;for(;n>=t&&e[n].trim()===``;)n--;return e.slice(t,n+1)},h=m(r.slice(0,c)).join(`
472
- `),g,_=[];for(let e of r.slice(l+1))g===void 0&&g1.test(e)?g=e.trim():_.push(e);let v=m(_).join(`
473
- `)||void 0;return d===null&&g&&(d=E1(g,u),d!==null&&(f=g)),{kind:t,danger:n,contextMd:h,options:u,recommendedIdx:d,recommendedNote:f,recommendation:g,trailingMd:v,...p.some(Boolean)?{optionHeadings:p}:{}}}var T1=/^[*_`~\s]+/;function E1(e,t){if(!e)return null;let n=e.replace(/^\s*recommendation\s*:?\s*/i,``).replace(T1,``).match(/^([A-Za-z]|\d+)(?![A-Za-z0-9])/);if(!n)return null;let r=n[1].toUpperCase(),i=t.findIndex(e=>{let t=e.replace(T1,``).match(/^([A-Za-z]|\d+)[.)]/);return t?t[1].toUpperCase()===r:!1});return i===-1?null:i}function D1(e){let t=e.match(/^\s*([A-Za-z]|\d+)[.)]/);return t?t[1].toUpperCase():e.trim()}function O1(e,t){let n=t.text.trim();if(e.kind===`multi`){let r=(t.chosenSet??[]).slice().sort((e,t)=>e-t).map(t=>D1(e.options[t]??``)).filter(Boolean).join(`, `);return r&&n?`${r} — ${n}`:r||n}return n||(t.chosen==null?``:e.options[t.chosen]??``)}var k1=/^```(done|awaiting)[ \t]*\r?\n([\s\S]*?)\r?\n```[ \t]*$/gm;function A1(e,t){return t===`done`?{body:e.trim(),hints:[]}:Ny(e)}function j1(e){let t=[],n=iy(e),r=0;k1.lastIndex=0;for(let i=k1.exec(e);i!==null;i=k1.exec(e)){if(n(i.index)){k1.lastIndex=i.index+1;continue}let a=e.slice(r,i.index);a.trim()&&t.push({kind:`prose`,text:a});let o=i[1],{body:s,hints:c}=A1(i[2],o);t.push({kind:`fence`,fenceKind:o,body:s,hints:c}),r=i.index+i[0].length}let i=e.slice(r);return i.trim()&&t.push({kind:`prose`,text:i}),t}var M1=/^(\d+)\.\s+(.*)$/;function N1(e){if(!e)return null;let t=e.replace(/\r\n?/g,`
472
+ `),g,_=[];for(let e of r.slice(l+1))g===void 0&&k1.test(e)?g=e.trim():_.push(e);let v=m(_).join(`
473
+ `)||void 0;return d===null&&g&&(d=z1(g,u),d!==null&&(f=g)),{kind:t,danger:n,contextMd:h,options:u,recommendedIdx:d,recommendedNote:f,recommendation:g,trailingMd:v,...p.some(Boolean)?{optionHeadings:p}:{}}}var R1=/^[*_`~\s]+/;function z1(e,t){if(!e)return null;let n=e.replace(/^\s*recommendation\s*:?\s*/i,``).replace(R1,``).match(/^([A-Za-z]|\d+)(?![A-Za-z0-9])/);if(!n)return null;let r=n[1].toUpperCase(),i=t.findIndex(e=>{let t=e.replace(R1,``).match(/^([A-Za-z]|\d+)[.)]/);return t?t[1].toUpperCase()===r:!1});return i===-1?null:i}function B1(e){let t=e.match(/^\s*([A-Za-z]|\d+)[.)]/);return t?t[1].toUpperCase():e.trim()}function V1(e,t){let n=t.text.trim();if(e.kind===`multi`){let r=(t.chosenSet??[]).slice().sort((e,t)=>e-t).map(t=>B1(e.options[t]??``)).filter(Boolean).join(`, `);return r&&n?`${r} — ${n}`:r||n}return n||(t.chosen==null?``:e.options[t.chosen]??``)}var H1=/^```(done|awaiting)[ \t]*\r?\n([\s\S]*?)\r?\n```[ \t]*$/gm;function U1(e,t){return t===`done`?{body:e.trim(),hints:[]}:My(e)}function W1(e){let t=[],n=ry(e),r=0;H1.lastIndex=0;for(let i=H1.exec(e);i!==null;i=H1.exec(e)){if(n(i.index)){H1.lastIndex=i.index+1;continue}let a=e.slice(r,i.index);a.trim()&&t.push({kind:`prose`,text:a});let o=i[1],{body:s,hints:c}=U1(i[2],o);t.push({kind:`fence`,fenceKind:o,body:s,hints:c}),r=i.index+i[0].length}let i=e.slice(r);return i.trim()&&t.push({kind:`prose`,text:i}),t}var G1=/^(\d+)\.\s+(.*)$/;function K1(e){if(!e)return null;let t=e.replace(/\r\n?/g,`
474
474
  `).split(`
475
- `),n=0;for(;n<t.length&&!t[n].trim();)n++;if(n>=t.length||t[n].trim()!==`Answers:`)return null;n++;let r=[];for(;n<t.length;n++){let e=t[n],i=e.match(M1);if(i)r.push({n:Number(i[1]),answer:i[2]});else if(r.length>0){let t=r[r.length-1];t.answer=t.answer?`${t.answer}\n${e}`:e}else if(e.trim())return null}if(r.length===0)return null;for(let e of r)e.answer=e.answer.replace(/\s+$/,``);return r}var P1=`Answers to earlier questions:`,F1=/^(\d+)\.\s+[“"](.*?)[”"]\s+→\s+(.*)$/;function I1(e){if(!e)return null;let t=e.replace(/\r\n?/g,`
475
+ `),n=0;for(;n<t.length&&!t[n].trim();)n++;if(n>=t.length||t[n].trim()!==`Answers:`)return null;n++;let r=[];for(;n<t.length;n++){let e=t[n],i=e.match(G1);if(i)r.push({n:Number(i[1]),answer:i[2]});else if(r.length>0){let t=r[r.length-1];t.answer=t.answer?`${t.answer}\n${e}`:e}else if(e.trim())return null}if(r.length===0)return null;for(let e of r)e.answer=e.answer.replace(/\s+$/,``);return r}var q1=`Answers to earlier questions:`,J1=/^(\d+)\.\s+[“"](.*?)[”"]\s+→\s+(.*)$/;function Y1(e){if(!e)return null;let t=e.replace(/\r\n?/g,`
476
476
  `).split(`
477
- `),n=0;for(;n<t.length&&!t[n].trim();)n++;if(n>=t.length||t[n].trim()!==P1)return null;n++;let r=[];for(;n<t.length;n++){let e=t[n],i=e.match(F1);if(i){let e=i[2].trim();r.push(e?{n:Number(i[1]),answer:i[3],question:e}:{n:Number(i[1]),answer:i[3]})}else if(r.length>0){let t=r[r.length-1];t.answer=t.answer?`${t.answer}\n${e}`:e}else if(e.trim())return null}if(r.length===0)return null;for(let e of r)e.answer=e.answer.replace(/\s+$/,``);return r}function L1(e){return I1(e)??N1(e)}function R1(e,t){for(let n=t-1;n>=0;n--){let t=e[n];if(t.kind===`event`||t.kind===`reasoning`||!t.text.trim())continue;if(t.role===`user`)return null;if(!t.text.includes("```question"))continue;let r=d1(t.text).filter(e=>e.kind===`question`);if(r.length>0)return r}return null}var z1=e=>e.kind===`question`?w1(e.text,e.questionKind,e.danger).contextMd.trim():``;function B1(e,t){if(t.length!==1)return null;let n=e.trim();if(!n)return null;let r=t[0];if(r.kind!==`question`)return null;let i=w1(r.text,r.questionKind,r.danger);if(!i.options.some(e=>e.trim()===n))return null;let a=i.contextMd.trim();return[a?{n:1,answer:n,question:a}:{n:1,answer:n}]}function V1(e,t){let n=e[t];if(!n||n.role!==`user`||n.kind===`event`)return null;let r=I1(n.text);if(r)return r;let i=N1(n.text),a=R1(e,t);return i?!a||!i.every((e,t)=>Number.isInteger(e.n)&&e.n>=1&&e.n<=a.length&&(t===0||e.n>i[t-1].n))?i:i.map(e=>{let t=z1(a[e.n-1]);return t?{...e,question:t}:{...e}}):a?B1(n.text,a):null}function H1(e){return e.map((t,n)=>V1(e,n))}var U1=`[overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`,W1=`rounded-xl`,G1=`rounded-t-xl`,K1=`rounded-b-[calc(var(--block-radius)_-_1px)]`,q1={neutral:{border:`border-border-strong`,head:`text-fg`},attention:{border:`border-accent/45`,head:`text-accent`},caution:{border:`border-border-strong`,head:`text-amber-400`},danger:{border:`border-red-500/45`,head:`text-red-400`}},J1=`card-icon-offset`;function Y1({icon:e,label:t,head:n=q1.neutral.head,aside:r}){return(0,V.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 text-[16px] font-semibold leading-6 tracking-tight ${n}`,children:t}),r&&(0,V.jsx)(`span`,{className:`shrink-0 leading-6`,children:r}),(0,V.jsx)(e,{"aria-hidden":`true`,size:16,className:`shrink-0 ${J1} ${n}`})]})}function X1({children:e}){return(0,V.jsx)(`div`,{className:`card-md mt-1 min-w-0 text-fg/75`,children:e})}function Z1({tone:e=`neutral`,icon:t,label:n,aside:r,children:i,className:a=``,...o}){let{border:s,head:c}=q1[e];return(0,V.jsxs)(`div`,{...o,className:`min-w-0 ${W1} border ${s} bg-panel-2 p-4 ${a}`,children:[(0,V.jsx)(Y1,{icon:t,label:n,head:c,aside:r}),i!=null&&(0,V.jsx)(X1,{children:i})]})}var Q1=`block min-w-0 text-[13px] leading-5 text-fg/75`;function $1({children:e,className:t=``}){return(0,V.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center justify-start gap-x-2.5 gap-y-2 ${t}`,children:e})}var e0=`min-w-0 flex-1 text-[11px] leading-snug text-muted/70`,t0=`text-accent underline underline-offset-2 decoration-accent/40 hover:decoration-accent`,n0=`flex shrink-0 items-center gap-1 rounded-md text-[11px] font-medium outline-none transition-colors focus-visible:ring-1 focus-visible:ring-fg/60 bg-fg px-2.5 py-1 text-bg hover:opacity-90`;function r0({h:e=14}){return(0,V.jsx)(`div`,{"aria-hidden":!0,className:`shrink-0`,style:{height:e}})}function i0({icon:e,children:t,sourceId:n,ariaLabel:r,marker:i,onClick:a,ariaExpanded:o,ariaControls:s}){let c=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`h-px flex-1 bg-border/70 transition-colors group-hover/wake:bg-border`}),(0,V.jsxs)(`span`,{className:`petite-caps flex min-w-0 items-center gap-1 break-words text-center text-[12px] text-muted/70 transition-colors group-hover/wake:text-fg`,children:[e&&(0,V.jsx)(e,{"aria-hidden":`true`,size:12,className:a0}),t]}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`h-px flex-1 bg-border/70 transition-colors group-hover/wake:bg-border`})]});return a?(0,V.jsx)(`button`,{type:`button`,"data-wake-divider":i,onClick:a,onMouseDown:e=>e.preventDefault(),"aria-label":r,"aria-expanded":o,"aria-controls":s,className:`group/wake my-1 flex w-full items-center gap-3 rounded-sm text-left outline-none focus-visible:ring-1 focus-visible:ring-fg/60`,children:c}):(0,V.jsx)(`div`,{"data-frizz-msg":n,"data-wake-divider":i,className:`my-1 flex items-center gap-3`,role:r?`separator`:void 0,"aria-label":r,children:c})}var a0=`shrink-0 translate-y-[0.04em]`;function o0(e,t=Date.now()){let n=e?Date.parse(e):NaN;if(!Number.isFinite(n)||!Number.isFinite(t))return null;let r=Math.max(0,Math.floor((t-n)/1e3));if(r<60)return`just now`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);if(a<24)return`${a}h ago`;let o=Math.floor(a/24);if(o<7)return`${o}d ago`;let s=Math.floor(o/7);if(s<5)return`${s}w ago`;let c=Math.floor(o/30);return c<12?`${c}mo ago`:`${Math.floor(o/365)}y ago`}function s0(e,t,n){return e===1?n?`New ${t} from @${n}`:`New ${t}`:`${e} new items`}var c0=`rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`;function l0({steer:e,text:t,sourceId:n,wrap:r}){let i=Yy(t);if(i)return(0,V.jsx)(m0,{wake:i,sourceId:n});let a=Zy(t);if(a)return(0,V.jsx)(u0,{wake:a,sourceId:n});let o=$y(t);if(o)return(0,V.jsx)(p0,{window:o.window,sourceId:n});let s=rb(t);if(s)return(0,V.jsx)(d0,{wake:s,sourceId:n});let c=ab(t);if(c)return(0,V.jsx)(f0,{watchRef:c.ref,sourceId:n});let l=Ub(t),u=e??zb(l?t.split(`
478
- `).filter(e=>!Ub(e)).join(`
479
- `):t);return!u&&!l?(0,V.jsx)(`div`,{"data-frizz-msg":n,"data-frizz-wake":!0,className:`min-w-0 max-w-[85%]`,children:(0,V.jsx)(Z1,{icon:OC,label:`Frizz`,children:(0,V.jsx)(`div`,{className:`${Q1} whitespace-pre-wrap [overflow-wrap:anywhere]${r?` ${U1}`:``}`,children:t})})}):l?(0,V.jsxs)(`div`,{"data-frizz-wake":!0,className:`flex flex-col`,children:[(0,V.jsx)(h0,{wake:l,sourceId:n}),u&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(r0,{}),(0,V.jsx)(g0,{steer:u,text:t})]})]}):(0,V.jsx)(g0,{steer:u,text:t,sourceId:n})}function u0({wake:e,sourceId:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useId)(),a=o0(e.at);return(0,V.jsxs)(`div`,{"data-frizz-msg":t,className:`flex flex-col`,children:[(0,V.jsxs)(i0,{icon:SC,marker:`timer`,onClick:()=>r(e=>!e),ariaExpanded:n,ariaControls:i,ariaLabel:`${n?`Collapse`:`Expand`} the text this timer handed back`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`Timer`}),a&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50`,children:`·`}),(0,V.jsx)(`span`,{title:e.at,className:`shrink-0 tabular-nums`,children:a})]}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50`,children:`·`}),(0,V.jsx)(`span`,{className:`shrink-0`,children:n?`Click to collapse`:`Click to expand`})]}),n&&(0,V.jsx)(`div`,{id:i,className:`mt-1.5 whitespace-pre-wrap border-l border-border/70 pl-3 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.prompt})]})}function d0({wake:e,sourceId:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useId)(),a=e.kind===`expired`?`Wait expired — nothing resolved`:`Wait over — its work finished`;return e.items.length?(0,V.jsxs)(`div`,{"data-frizz-msg":t,className:`flex flex-col`,children:[(0,V.jsxs)(i0,{icon:tw,marker:`event`,onClick:()=>r(e=>!e),ariaExpanded:n,ariaControls:i,ariaLabel:`${n?`Collapse`:`Expand`} what this wait named`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:a}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50`,children:`·`}),(0,V.jsx)(`span`,{className:`shrink-0`,children:n?`Click to collapse`:`Click to expand`})]}),n&&(0,V.jsx)(`div`,{id:i,className:`mt-1.5 whitespace-pre-wrap border-l border-border/70 pl-3 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.items.join(`
480
- `)})]}):(0,V.jsx)(i0,{icon:tw,sourceId:t,marker:`event`,ariaLabel:a,children:(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:a})})}function f0({watchRef:e,sourceId:t}){let n=nJ(e);return(0,V.jsx)(i0,{icon:ew,sourceId:t,marker:`event`,ariaLabel:`Watcher on ${e} expired`,children:(0,V.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Watcher on`,` `,n?(0,V.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,className:c0,children:e}):e,` `,`expired`]})})}function p0({window:e,sourceId:t}){let n=`${e===`weekly`?`Weekly usage limit`:e===`session`?`Session usage limit`:`Usage limit`} reset — resuming`;return(0,V.jsx)(i0,{icon:tw,sourceId:t,marker:`limit-resume`,ariaLabel:n,children:(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:n})})}function m0({wake:e,sourceId:t}){let n=`Background task «${e.label.length>64?`${e.label.slice(0,63)}…`:e.label}» ${e.outcome}`;return(0,V.jsx)(i0,{icon:Ew,sourceId:t,marker:`event`,ariaLabel:n,children:(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:n})})}function h0({wake:e,sourceId:t}){let n=nJ(e.ref),r=n?(0,V.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer noopener`,className:c0,children:e.ref}):(0,V.jsx)(`span`,{children:e.ref}),i=e.kind===`ci`?`CI ${e.verdict===`passing`?`passed`:`failed`} on `:`PR ${e.kind} on `,a=e.kind===`ci`&&e.verdict===`failing`&&e.failing.length?`: ${e.failing.join(`, `)}`:``,o=e.kind===`ci`&&e.verdict===`passing`&&e.passed!==void 0?`${e.passed} ${e.passed===1?`check`:`checks`} green`:null;return(0,V.jsxs)(i0,{icon:ew,sourceId:t,marker:`github`,ariaLabel:n?void 0:`${i}${e.ref}${a}${o?` · ${o}`:``}`,children:[(0,V.jsxs)(`span`,{className:`min-w-0 truncate`,children:[i,r,a]}),o&&(0,V.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[`· `,o]})]})}function g0({steer:e,text:t,sourceId:n}){let r=nJ(e.ref),i=e.items.length+e.omitted,a=Nb(t),o=!a&&e.items.length===1&&e.omitted===0?e.items[0]:null,s=o?o0(o.at):null,c=o?.url??r,l=a?`${i} ${i===1?`item`:`items`} already`:s0(i,e.items[0]?.label??`item`,o?.actor),u=c?(0,V.jsx)(`a`,{href:c,target:`_blank`,rel:`noreferrer noopener`,className:c0,children:e.ref}):(0,V.jsx)(`span`,{children:e.ref});return(0,V.jsxs)(i0,{icon:ew,sourceId:n,marker:`github`,ariaLabel:c?void 0:`${l} on ${e.ref}`,children:[(0,V.jsxs)(`span`,{className:`min-w-0 truncate`,children:[l,` on `,u]}),s&&(0,V.jsxs)(`span`,{title:o?.at,className:`shrink-0 tabular-nums`,children:[`· `,s]})]})}function _0({bump:e,sourceId:t}){let n=e.kind===`schedule`;if(e.kind===`signoff`){let e=`Frizz asked for a sign-off`;return(0,V.jsx)(i0,{icon:Sw,sourceId:t,marker:`rest`,ariaLabel:e,children:e})}let r=n?`Goal${e.every?` · every ${e.every}`:``}`:`Goal · at rest`;return(0,V.jsx)(i0,{icon:n?Ow:vw,sourceId:t,marker:n?`schedule`:`rest`,ariaLabel:r,children:r})}var v0=/(^|[^\w/.@-])(https?:\/\/[^\s<>`]+|www\.[a-z0-9-]+(?:\.[a-z0-9-]+)+(?:[^\s<>`]*)?)/gi,y0=new Set([`.`,`,`,`:`,`;`,`!`,`?`,`*`,`_`,`~`,`'`,`"`]),b0={")":`(`,"]":`[`,"}":`{`};function x0(e){let t=e;for(;;){let e=t[t.length-1];if(e!==void 0&&y0.has(e)){t=t.slice(0,-1);continue}let n=e===void 0?void 0:b0[e];if(n){let r=0;for(let i of t)i===n?r++:i===e&&r--;if(r<0){t=t.slice(0,-1);continue}}break}return t}function S0(e,t){if(t===``)return;let n=0;for(let r of Vx(t))r.start>n&&e.push({kind:`text`,text:t.slice(n,r.start)}),e.push({kind:`link`,text:r.text,href:r.href,title:r.title,ghRef:Ix(r.href)}),n=r.start+r.text.length;n<t.length&&e.push({kind:`text`,text:t.slice(n)})}function C0(e){let t=[],n=0;v0.lastIndex=0;for(let r=v0.exec(e);r;r=v0.exec(e)){let[,i,a]=r,o=x0(a);if(/^https?:\/\/$/i.test(o)||o===``)continue;let s=r.index+i.length;v0.lastIndex=s+o.length;let c=/^www\./i.test(o)?`http://${o}`:o;s>n&&S0(t,e.slice(n,s)),t.push({kind:`link`,text:o,href:c,ghRef:Ix(c)}),n=s+o.length}return n<e.length&&S0(t,e.slice(n)),t}function w0({text:e}){let t=(0,B.useMemo)(()=>C0(e),[e,a$()]),n=(0,B.useMemo)(()=>t.flatMap(e=>e.kind===`link`&&e.ghRef?[e.ghRef]:[]),[t]);return(0,B.useEffect)(()=>{n.length>0&&_S(n)},[n]),(0,V.jsx)(V.Fragment,{children:t.map((e,t)=>e.kind===`text`?e.text:(0,V.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,title:e.title,"data-gh-ref":e.ghRef??void 0,className:`underline underline-offset-2`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:e.text},t))})}function T0(e){return e.sourceId??`legacy-${F0(e.text)}`}function E0(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.kind===`event`||n.kind===`reasoning`)&&n.role===`assistant`&&n.text.trim())return t}return-1}var D0=e=>d1(e).filter(e=>e.kind===`question`).map(e=>e.kind===`question`?w1(e.text,e.questionKind,e.danger):w1(``,`question`));function O0(){let e=new Set;return(t,n)=>{let r=T0(t);return e.has(r)&&(r=`${r}#${n}`),e.add(r),r}}function k0(e){let t=E0(e),n=O0(),r=[];for(let i=0;i<e.length;i++){let a=e[i];if(a.kind===`event`||a.kind===`reasoning`||a.role!==`assistant`||!a.text.trim()||!a.text.includes("```question"))continue;let o=D0(a.text);o.length>0&&r.push({idx:i,identity:n(a,i),blocks:o,isLive:i===t})}return r}function A0(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.kind===`event`||n.kind===`reasoning`)){if(n.role===`user`&&n.text.trim())break;if(!(n.role!==`assistant`||!n.text.trim())&&D0(n.text).length>0)return t}}return-1}function j0(e){let{answered:t,live:n}=e;return t.length>0&&t.every(e=>e.isLive)&&n?`Answers:\n${n.numbered.map(({n:e,a:t})=>`${e}. ${t}`).join(`
477
+ `),n=0;for(;n<t.length&&!t[n].trim();)n++;if(n>=t.length||t[n].trim()!==q1)return null;n++;let r=[];for(;n<t.length;n++){let e=t[n],i=e.match(J1);if(i){let e=i[2].trim();r.push(e?{n:Number(i[1]),answer:i[3],question:e}:{n:Number(i[1]),answer:i[3]})}else if(r.length>0){let t=r[r.length-1];t.answer=t.answer?`${t.answer}\n${e}`:e}else if(e.trim())return null}if(r.length===0)return null;for(let e of r)e.answer=e.answer.replace(/\s+$/,``);return r}function X1(e){return Y1(e)??K1(e)}var Z1=e=>e.displayText??e.text;function Q1(e,t){for(let n=t-1;n>=0;n--){let t=e[n];if(t.kind===`event`||t.kind===`reasoning`||!t.text.trim())continue;if(t.role===`user`)return null;if(!t.text.includes("```question"))continue;let r=w1(t.text).filter(e=>e.kind===`question`);if(r.length>0)return r}return null}var $1=e=>e.kind===`question`?L1(e.text,e.questionKind,e.danger).contextMd.trim():``;function e0(e,t){if(t.length!==1)return null;let n=e.trim();if(!n)return null;let r=t[0];if(r.kind!==`question`)return null;let i=L1(r.text,r.questionKind,r.danger);if(!i.options.some(e=>e.trim()===n))return null;let a=i.contextMd.trim();return[a?{n:1,answer:n,question:a}:{n:1,answer:n}]}function t0(e,t){let n=e[t];if(!n||n.role!==`user`||n.kind===`event`)return null;let r=Z1(n),i=Y1(r);if(i)return i;let a=K1(r),o=Q1(e,t);return a?!o||!a.every((e,t)=>Number.isInteger(e.n)&&e.n>=1&&e.n<=o.length&&(t===0||e.n>a[t-1].n))?a:a.map(e=>{let t=$1(o[e.n-1]);return t?{...e,question:t}:{...e}}):o?e0(r,o):null}function n0(e){return e.map((t,n)=>t0(e,n))}var r0=`[overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`,i0=`rounded-xl`,a0=`rounded-t-xl`,o0=`rounded-b-[calc(var(--block-radius)_-_1px)]`,s0={neutral:{border:`border-border-strong`,head:`text-fg`},attention:{border:`border-accent/45`,head:`text-accent`},caution:{border:`border-border-strong`,head:`text-amber-400`},danger:{border:`border-red-500/45`,head:`text-red-400`}},c0=`card-icon-offset`;function l0({icon:e,label:t,head:n=s0.neutral.head,aside:r}){return(0,V.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 text-[16px] font-semibold leading-6 tracking-tight ${n}`,children:t}),r&&(0,V.jsx)(`span`,{className:`shrink-0 leading-6`,children:r}),(0,V.jsx)(e,{"aria-hidden":`true`,size:16,className:`shrink-0 ${c0} ${n}`})]})}function u0({children:e}){return(0,V.jsx)(`div`,{className:`card-md mt-1 min-w-0 text-fg/75`,children:e})}function d0({tone:e=`neutral`,icon:t,label:n,aside:r,children:i,className:a=``,...o}){let{border:s,head:c}=s0[e];return(0,V.jsxs)(`div`,{...o,className:`min-w-0 ${i0} border ${s} bg-panel-2 p-4 ${a}`,children:[(0,V.jsx)(l0,{icon:t,label:n,head:c,aside:r}),i!=null&&(0,V.jsx)(u0,{children:i})]})}var f0=`block min-w-0 text-[13px] leading-5 text-fg/75`;function p0({children:e,className:t=``}){return(0,V.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center justify-start gap-x-2.5 gap-y-2 ${t}`,children:e})}var m0=`min-w-0 flex-1 text-[11px] leading-snug text-muted/70`,h0=`text-accent underline underline-offset-2 decoration-accent/40 hover:decoration-accent`,g0=`flex shrink-0 items-center gap-1 rounded-md text-[11px] font-medium outline-none transition-colors focus-visible:ring-1 focus-visible:ring-fg/60 bg-fg px-2.5 py-1 text-bg hover:opacity-90`;function _0({h:e=14}){return(0,V.jsx)(`div`,{"aria-hidden":!0,className:`shrink-0`,style:{height:e}})}function v0({icon:e,children:t,sourceId:n,ariaLabel:r,marker:i,onClick:a,ariaExpanded:o,ariaControls:s}){let c=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`h-px flex-1 bg-border/70 transition-colors group-hover/wake:bg-border`}),(0,V.jsxs)(`span`,{className:`petite-caps flex min-w-0 items-center gap-1 break-words text-center text-[12px] text-muted/70 transition-colors group-hover/wake:text-fg`,children:[e&&(0,V.jsx)(e,{"aria-hidden":`true`,size:12,className:y0}),t]}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`h-px flex-1 bg-border/70 transition-colors group-hover/wake:bg-border`})]});return a?(0,V.jsx)(`button`,{type:`button`,"data-wake-divider":i,onClick:a,onMouseDown:e=>e.preventDefault(),"aria-label":r,"aria-expanded":o,"aria-controls":s,className:`group/wake my-1 flex w-full items-center gap-3 rounded-sm text-left outline-none focus-visible:ring-1 focus-visible:ring-fg/60`,children:c}):(0,V.jsx)(`div`,{"data-frizz-msg":n,"data-wake-divider":i,className:`my-1 flex items-center gap-3`,role:r?`separator`:void 0,"aria-label":r,children:c})}var y0=`shrink-0 translate-y-[0.04em]`;function b0(e,t=Date.now()){let n=e?Date.parse(e):NaN;if(!Number.isFinite(n)||!Number.isFinite(t))return null;let r=Math.max(0,Math.floor((t-n)/1e3));if(r<60)return`just now`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);if(a<24)return`${a}h ago`;let o=Math.floor(a/24);if(o<7)return`${o}d ago`;let s=Math.floor(o/7);if(s<5)return`${s}w ago`;let c=Math.floor(o/30);return c<12?`${c}mo ago`:`${Math.floor(o/365)}y ago`}function x0(e,t,n){return e===1?n?`New ${t} from @${n}`:`New ${t}`:`${e} new items`}var S0=`rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`;function C0({steer:e,text:t,sourceId:n,wrap:r}){let i=Jy(t);if(i)return(0,V.jsx)(O0,{wake:i,sourceId:n});let a=Xy(t);if(a)return(0,V.jsx)(w0,{wake:a,sourceId:n});let o=Qy(t);if(o)return(0,V.jsx)(D0,{window:o.window,sourceId:n});let s=nb(t);if(s)return(0,V.jsx)(T0,{wake:s,sourceId:n});let c=ib(t);if(c)return(0,V.jsx)(E0,{watchRef:c.ref,sourceId:n});let l=Hb(t),u=e??Rb(l?t.split(`
478
+ `).filter(e=>!Hb(e)).join(`
479
+ `):t);return!u&&!l?(0,V.jsx)(`div`,{"data-frizz-msg":n,"data-frizz-wake":!0,className:`min-w-0 max-w-[85%]`,children:(0,V.jsx)(d0,{icon:OC,label:`Frizz`,children:(0,V.jsx)(`div`,{className:`${f0} whitespace-pre-wrap [overflow-wrap:anywhere]${r?` ${r0}`:``}`,children:t})})}):l?(0,V.jsxs)(`div`,{"data-frizz-wake":!0,className:`flex flex-col`,children:[(0,V.jsx)(k0,{wake:l,sourceId:n}),u&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(_0,{}),(0,V.jsx)(A0,{steer:u,text:t})]})]}):(0,V.jsx)(A0,{steer:u,text:t,sourceId:n})}function w0({wake:e,sourceId:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useId)(),a=b0(e.at);return(0,V.jsxs)(`div`,{"data-frizz-msg":t,className:`flex flex-col`,children:[(0,V.jsxs)(v0,{icon:SC,marker:`timer`,onClick:()=>r(e=>!e),ariaExpanded:n,ariaControls:i,ariaLabel:`${n?`Collapse`:`Expand`} the text this timer handed back`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`Timer`}),a&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50`,children:`·`}),(0,V.jsx)(`span`,{title:e.at,className:`shrink-0 tabular-nums`,children:a})]}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50`,children:`·`}),(0,V.jsx)(`span`,{className:`shrink-0`,children:n?`Click to collapse`:`Click to expand`})]}),n&&(0,V.jsx)(`div`,{id:i,className:`mt-1.5 whitespace-pre-wrap border-l border-border/70 pl-3 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.prompt})]})}function T0({wake:e,sourceId:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useId)(),a=e.kind===`expired`?`Wait expired — nothing resolved`:`Wait over — its work finished`;return e.items.length?(0,V.jsxs)(`div`,{"data-frizz-msg":t,className:`flex flex-col`,children:[(0,V.jsxs)(v0,{icon:tw,marker:`event`,onClick:()=>r(e=>!e),ariaExpanded:n,ariaControls:i,ariaLabel:`${n?`Collapse`:`Expand`} what this wait named`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:a}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50`,children:`·`}),(0,V.jsx)(`span`,{className:`shrink-0`,children:n?`Click to collapse`:`Click to expand`})]}),n&&(0,V.jsx)(`div`,{id:i,className:`mt-1.5 whitespace-pre-wrap border-l border-border/70 pl-3 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.items.join(`
480
+ `)})]}):(0,V.jsx)(v0,{icon:tw,sourceId:t,marker:`event`,ariaLabel:a,children:(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:a})})}function E0({watchRef:e,sourceId:t}){let n=nJ(e);return(0,V.jsx)(v0,{icon:ew,sourceId:t,marker:`event`,ariaLabel:`Watcher on ${e} expired`,children:(0,V.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Watcher on`,` `,n?(0,V.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,className:S0,children:e}):e,` `,`expired`]})})}function D0({window:e,sourceId:t}){let n=`${e===`weekly`?`Weekly usage limit`:e===`session`?`Session usage limit`:`Usage limit`} reset — resuming`;return(0,V.jsx)(v0,{icon:tw,sourceId:t,marker:`limit-resume`,ariaLabel:n,children:(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:n})})}function O0({wake:e,sourceId:t}){let n=`Background task «${e.label.length>64?`${e.label.slice(0,63)}…`:e.label}» ${e.outcome}`;return(0,V.jsx)(v0,{icon:Ew,sourceId:t,marker:`event`,ariaLabel:n,children:(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:n})})}function k0({wake:e,sourceId:t}){let n=nJ(e.ref),r=n?(0,V.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer noopener`,className:S0,children:e.ref}):(0,V.jsx)(`span`,{children:e.ref}),i=e.kind===`ci`?`CI ${e.verdict===`passing`?`passed`:`failed`} on `:`PR ${e.kind} on `,a=e.kind===`ci`&&e.verdict===`failing`&&e.failing.length?`: ${e.failing.join(`, `)}`:``,o=e.kind===`ci`&&e.verdict===`passing`&&e.passed!==void 0?`${e.passed} ${e.passed===1?`check`:`checks`} green`:null;return(0,V.jsxs)(v0,{icon:ew,sourceId:t,marker:`github`,ariaLabel:n?void 0:`${i}${e.ref}${a}${o?` · ${o}`:``}`,children:[(0,V.jsxs)(`span`,{className:`min-w-0 truncate`,children:[i,r,a]}),o&&(0,V.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[`· `,o]})]})}function A0({steer:e,text:t,sourceId:n}){let r=nJ(e.ref),i=e.items.length+e.omitted,a=Mb(t),o=!a&&e.items.length===1&&e.omitted===0?e.items[0]:null,s=o?b0(o.at):null,c=o?.url??r,l=a?`${i} ${i===1?`item`:`items`} already`:x0(i,e.items[0]?.label??`item`,o?.actor),u=c?(0,V.jsx)(`a`,{href:c,target:`_blank`,rel:`noreferrer noopener`,className:S0,children:e.ref}):(0,V.jsx)(`span`,{children:e.ref});return(0,V.jsxs)(v0,{icon:ew,sourceId:n,marker:`github`,ariaLabel:c?void 0:`${l} on ${e.ref}`,children:[(0,V.jsxs)(`span`,{className:`min-w-0 truncate`,children:[l,` on `,u]}),s&&(0,V.jsxs)(`span`,{title:o?.at,className:`shrink-0 tabular-nums`,children:[`· `,s]})]})}function j0({bump:e,sourceId:t}){let n=e.kind===`schedule`;if(e.kind===`signoff`){let e=`Frizz asked for a sign-off`;return(0,V.jsx)(v0,{icon:Sw,sourceId:t,marker:`rest`,ariaLabel:e,children:e})}let r=n?`Goal${e.every?` · every ${e.every}`:``}`:`Goal · at rest`;return(0,V.jsx)(v0,{icon:n?Ow:vw,sourceId:t,marker:n?`schedule`:`rest`,ariaLabel:r,children:r})}var M0=/(^|[^\w/.@-])(https?:\/\/[^\s<>`]+|www\.[a-z0-9-]+(?:\.[a-z0-9-]+)+(?:[^\s<>`]*)?)/gi,N0=new Set([`.`,`,`,`:`,`;`,`!`,`?`,`*`,`_`,`~`,`'`,`"`]),P0={")":`(`,"]":`[`,"}":`{`};function F0(e){let t=e;for(;;){let e=t[t.length-1];if(e!==void 0&&N0.has(e)){t=t.slice(0,-1);continue}let n=e===void 0?void 0:P0[e];if(n){let r=0;for(let i of t)i===n?r++:i===e&&r--;if(r<0){t=t.slice(0,-1);continue}}break}return t}function I0(e,t){if(t===``)return;let n=0;for(let r of Vx(t))r.start>n&&e.push({kind:`text`,text:t.slice(n,r.start)}),e.push({kind:`link`,text:r.text,href:r.href,title:r.title,ghRef:Ix(r.href)}),n=r.start+r.text.length;n<t.length&&e.push({kind:`text`,text:t.slice(n)})}function L0(e){let t=[],n=0;M0.lastIndex=0;for(let r=M0.exec(e);r;r=M0.exec(e)){let[,i,a]=r,o=F0(a);if(/^https?:\/\/$/i.test(o)||o===``)continue;let s=r.index+i.length;M0.lastIndex=s+o.length;let c=/^www\./i.test(o)?`http://${o}`:o;s>n&&I0(t,e.slice(n,s)),t.push({kind:`link`,text:o,href:c,ghRef:Ix(c)}),n=s+o.length}return n<e.length&&I0(t,e.slice(n)),t}function R0({text:e}){let t=(0,B.useMemo)(()=>L0(e),[e,a$()]),n=(0,B.useMemo)(()=>t.flatMap(e=>e.kind===`link`&&e.ghRef?[e.ghRef]:[]),[t]);return(0,B.useEffect)(()=>{n.length>0&&_S(n)},[n]),(0,V.jsx)(V.Fragment,{children:t.map((e,t)=>e.kind===`text`?e.text:(0,V.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,title:e.title,"data-gh-ref":e.ghRef??void 0,className:`underline underline-offset-2`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:e.text},t))})}function z0(e){return e.sourceId??`legacy-${Y0(e.text)}`}function B0(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.kind===`event`||n.kind===`reasoning`)&&n.role===`assistant`&&n.text.trim())return t}return-1}var V0=e=>w1(e).filter(e=>e.kind===`question`).map(e=>e.kind===`question`?L1(e.text,e.questionKind,e.danger):L1(``,`question`));function H0(){let e=new Set;return(t,n)=>{let r=z0(t);return e.has(r)&&(r=`${r}#${n}`),e.add(r),r}}function U0(e){let t=B0(e),n=H0(),r=[];for(let i=0;i<e.length;i++){let a=e[i];if(a.kind===`event`||a.kind===`reasoning`||a.role!==`assistant`||!a.text.trim()||!a.text.includes("```question"))continue;let o=V0(a.text);o.length>0&&r.push({idx:i,identity:n(a,i),blocks:o,isLive:i===t})}return r}function W0(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.kind===`event`||n.kind===`reasoning`)){if(n.role===`user`&&n.text.trim())break;if(!(n.role!==`assistant`||!n.text.trim())&&V0(n.text).length>0)return t}}return-1}function G0(e){let{answered:t,live:n}=e;return t.length>0&&t.every(e=>e.isLive)&&n?`Answers:\n${n.numbered.map(({n:e,a:t})=>`${e}. ${t}`).join(`
481
481
  `)}`:`Answers to earlier questions:\n${t.map((e,t)=>`${t+1}. “${e.question}” → ${e.answer}`).join(`
482
- `)}`}function M0(e,t,n,r={}){let i=eJ(e),[a,o]=(0,B.useState)({}),s=(0,B.useMemo)(()=>k0(t),[t]),c=(0,B.useMemo)(()=>{for(let e=t.length-1;e>=0;e--)if(!(t[e].kind===`event`||t[e].kind===`reasoning`)&&t[e].role===`assistant`&&t[e].text.trim())return t[e]},[t]),l=(0,B.useMemo)(()=>A0(t)!==-1,[t]),u=iW(),d=aW(e),f=(0,B.useCallback)((t,n)=>rW.answer(u,e,d,t,n),[u,e,d]),p=(0,B.useMemo)(()=>s.flatMap(e=>e.blocks.map((t,n)=>f(e.identity,n))),[s,f]),m=sW(p),h=(0,B.useRef)(n);h.current=n;let g=(0,B.useCallback)((e,t)=>({...a[`${e}::${t}`]??{chosen:null,text:``},text:m.get(f(e,t))??``}),[a,m,f]),_=(0,B.useMemo)(()=>{let e=new Map;for(let t of s)e.set(t.identity,t);return e},[s]),v=(0,B.useCallback)((e,t,n)=>{let r=_.get(e)?.blocks[t],i=`${e}::${t}`;r?.kind!==`multi`&&tW.clear(f(e,t)),o(e=>{let t=e[i]??{chosen:null,text:``};if(r?.kind===`multi`){let r=new Set(t.chosenSet??[]);return r.has(n)?r.delete(n):r.add(n),{...e,[i]:{chosen:null,text:t.text,chosenSet:[...r].sort((e,t)=>e-t)}}}return{...e,[i]:{chosen:t.chosen===n?null:n,text:``}}})},[_,f]),y=(0,B.useCallback)((e,t,n)=>{let r=_.get(e)?.blocks[t];tW.set(f(e,t),n),o(i=>{let a=`${e}::${t}`,o=i[a]??{chosen:null,text:``};return r?.kind===`multi`?{...i,[a]:{chosen:null,text:n,chosenSet:o.chosenSet??[]}}:{...i,[a]:{chosen:null,text:n}}})},[_,f]),b=s.some(e=>e.blocks.some((t,n)=>O1(t,g(e.identity,n))!==``)),x=r.scrollToBottom!==!1,S=(0,B.useCallback)((e,t={})=>{i.submit(e,{...t,scrollToBottom:x})&&h.current?.()},[i,x]),C=(0,B.useCallback)(e=>{let t=typeof e==`string`?e:void 0,n=t?s.filter(e=>e.identity===t):s,r=t?n.flatMap(e=>e.blocks.map((t,n)=>f(e.identity,n))):p,i=n.flatMap(e=>e.blocks.map((t,n)=>`${e.identity}::${n}`)),c=(e,t)=>O1(e.blocks[t],g(e.identity,t)),l=n.flatMap(e=>e.blocks.map((t,n)=>({ask:e,bi:n,question:P0(t),answer:c(e,n)})).filter(e=>e.answer!==``));if(l.length===0)return;let u=n.find(e=>e.isLive),d=j0({answered:l.map(e=>({isLive:e.ask.isLive,question:e.question,answer:e.answer})),live:u&&{numbered:u.blocks.map((e,t)=>({n:t+1,a:c(u,t)})).filter(({a:e})=>e!==``)}}),m=a,h=r.map(e=>[e,tW.get(e)]);S(d,{onOptimistic:()=>{r.forEach(e=>tW.clear(e)),o(e=>{let t={...e};for(let e of i)delete t[e];return t})},onRollback:()=>{o(e=>{let t={...e};for(let e of i)m[e]?t[e]=m[e]:delete t[e];return t}),h.forEach(([e,t])=>{t&&!tW.get(e)&&tW.set(e,t)})}})},[a,s,g,S,p,f]),w=(0,B.useCallback)(e=>{let t=_.get(T0(e));if(t)return{answerFor:e=>g(t.identity,e),onChip:(e,n)=>v(t.identity,e,n),onText:(e,n)=>y(t.identity,e,n),onSubmit:()=>C(t.identity),anyAnswered:t.blocks.some((e,n)=>O1(e,g(t.identity,n))!==``),sending:i.pending}},[_,g,v,y,C,i.pending]);return{liveMsg:c,answering:(0,B.useMemo)(()=>c?w(c):void 0,[c,w]),answeringForMessage:w,answerable:l,anyAnswered:b,sending:i.pending,sendAnswers:C,sendMessage:S}}function N0(e){let t=e.split(`
483
- `).map(e=>e.trim()).find(e=>e.length>0)??``;return t.length>120?`${t.slice(0,117)}…`:t}function P0(e){return N0(e.contextMd)||N0(e.options.join(` / `))||`earlier question`}function F0(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return(t>>>0).toString(36)}var I0=/^[\w.@+-]+\.[a-z][a-z0-9]{0,7}$/i;function L0(e){let t=e.trim();return!t||t.length>1024||/\s/.test(t)||/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?!1:t===`~`||t.startsWith(`~/`)||t.startsWith(`/`)||t.includes(`/`)?!0:I0.test(t)}var R0=new Map,z0=new Set,B0=0,V0=new Set,H0=e=>(V0.add(e),()=>{V0.delete(e)}),U0=()=>B0,W0=128;async function G0(e){let t=[...new Set(e)].filter(e=>!R0.has(e)&&!z0.has(e));if(!t.length)return;for(let e of t)z0.add(e);let n=[];for(let e=0;e<t.length;e+=W0)n.push(t.slice(e,e+W0));let r=await Promise.all(n.map(async e=>{try{return(await X.resolveLocalPaths({paths:e})).resolved}catch{return e.map(e=>({input:e,path:null}))}})),i=!1;for(let e of r)for(let t of e)R0.has(t.input)||(R0.set(t.input,t.path),i=!0);for(let e of t)z0.delete(e);if(i){B0+=1;for(let e of V0)e()}}function K0(e,t){e.setAttribute(`data-local-path`,t),e.setAttribute(`title`,`Open ${t}`),e.classList.add(`local-file-code`)}function q0(e,t){(0,B.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=[];for(let e of t.querySelectorAll(`code`)){if(e.closest(`pre`)||e.closest(`a, [data-local-path]`))continue;let t=(e.textContent??``).trim();if(!L0(t))continue;let r=R0.get(t);r===void 0?n.push(t):r&&K0(e,r)}n.length&&G0(n)},[e,t,(0,B.useSyncExternalStore)(H0,U0,U0)])}function J0({raw:e,question:t,questionKind:n,danger:r,interactive:i,wrap:a}){let o=(0,B.useMemo)(()=>t??w1(e??``,n??`question`,r),[t,e,n,r]),s=s$(o.contextMd),c=s$(o.trailingMd??``),l=o.recommendedIdx,u=l$(o.recommendation??``),d=o.kind===`multi`,f=o.danger,p=i?.answer.chosen??null,m=i?.answer.chosenSet??[],h=i?.answer.text??``,g=(0,B.useRef)(null);return(0,B.useLayoutEffect)(()=>{let e=g.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)},[h]),(0,V.jsxs)(Z1,{tone:f?`danger`:`neutral`,icon:f?kw:d?sw:BC,label:d?`Select multiple`:`Question`,children:[s&&(0,V.jsx)(`div`,{className:`text-fg`,children:(0,V.jsx)(Y0,{className:`md-body${a?` [overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`:``}`,html:s})}),(o.options.length>0||i)&&(0,V.jsxs)(`div`,{className:`mt-2 grid grid-cols-1 gap-1.5`,children:[o.options.map((e,t)=>(0,V.jsxs)(B.Fragment,{children:[o.optionHeadings?.[t]&&(0,V.jsx)(X0,{md:o.optionHeadings[t],wrap:a}),(0,V.jsx)(Q0,{label:e,multi:d,recommended:l===t,recTitle:l===t?o.recommendedNote:void 0,selected:d?m.includes(t):p===t&&!h.trim(),disabled:!i,onClick:()=>{i?.onChip(t,e),!d&&g.current&&document.activeElement===g.current&&g.current.blur()}})]},t)),i&&(0,V.jsx)(`textarea`,{ref:g,rows:1,"data-surface":`questionAnswer`,value:h,onChange:e=>i.onText(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`){e.preventDefault(),e.currentTarget.blur();return}yH({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(),i.onSubmit())},onFocus:()=>{!d&&p!==null&&i.onText(h)},placeholder:d?`Add a note…`:o.options.length?`${Z0(o.options)} Something else…`:`Type your answer…`,className:`col-span-full w-full resize-none overflow-hidden rounded-md border px-3 py-1.5 text-[12px] leading-snug text-fg/90 outline-none placeholder:text-muted/80 transition-colors ${h.trim()?`border-accent bg-accent/10`:`border-border bg-transparent hover:bg-panel-2 focus:border-accent`}`})]}),o.trailingMd&&(0,V.jsx)(Y0,{className:`mt-2 md-body text-[12px] text-muted/70${a?` [overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`:``}`,html:c}),o.recommendation&&l===null&&(0,V.jsx)(Y0,{className:`md-inline mt-1.5 text-[11px] text-muted/70`,html:u})]})}function Y0({as:e=`div`,className:t,html:n}){let r=t1(n),i=(0,B.useRef)(null);return q0(i,n),(0,B.createElement)(e,{ref:i,className:t,dangerouslySetInnerHTML:r})}function X0({md:e,wrap:t}){let n=l$(e.split(`
484
- `).join(` `));return(0,V.jsx)(`div`,{className:`mt-1 text-fg`,children:(0,V.jsx)(Y0,{className:`md-body${t?` ${U1}`:``}`,html:n})})}function Z0(e){let t=e[e.length-1]?.match(/^\s*([A-Za-z]|\d+)([.)])\s/);if(!t)return`${String.fromCharCode(65+e.length)}.`;let[,n,r]=t;return/\d/.test(n)?`${Number(n)+1}${r}`:`${String.fromCharCode(n.toUpperCase().charCodeAt(0)+1)}${r}`}function Q0({label:e,selected:t,disabled:n,multi:r,recommended:i,recTitle:a,onClick:o}){let s=l$(e),c=(0,B.useId)();return(0,V.jsxs)(`div`,{"data-question-option":!0,title:a,className:`relative flex items-start gap-2 rounded-md border px-3 py-1.5 text-[12px] leading-snug transition-colors ${t?`border-accent bg-accent/10 text-fg`:n?`border-border text-muted/80`:`border-border text-fg/90 hover:bg-elevated hover:border-border-strong`}`,children:[(0,V.jsx)(`button`,{type:`button`,disabled:n,"aria-labelledby":c,onClick:o,onMouseDown:e=>e.preventDefault(),className:`absolute inset-0 rounded-md outline-none`}),r&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`mt-px flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-[3px] border ${t?`border-accent bg-accent text-bg`:`border-border-strong`}`,children:t&&(0,V.jsx)(jC,{size:10,strokeWidth:3})}),(0,V.jsxs)(`span`,{id:c,className:`min-w-0 flex-1`,children:[i&&(0,V.jsx)(`span`,{className:`pointer-events-none float-right ml-2 mt-px -translate-y-[2px] rounded-full border border-border-strong px-1.5 py-px text-[9.5px] uppercase tracking-wide text-muted`,children:`Recommended`}),(0,V.jsx)(Y0,{as:`span`,className:`md-inline`,html:s})]})]})}function $0({blocks:e,answering:t,onClose:n}){let[r,i]=(0,B.useState)(0),[a,o]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[]),(0,B.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopPropagation(),n())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[n]);let s=e[Math.min(r,e.length-1)];if(!s)return null;let c=r>=e.length-1;return(0,Xd.createPortal)((0,V.jsxs)(`div`,{"data-mobile-answer-sheet":!0,className:`fixed inset-0 z-[80] flex flex-col justify-end`,children:[(0,V.jsx)(`button`,{"aria-label":`Close`,onClick:n,className:`absolute inset-0 bg-black/50 transition-opacity duration-200 ${a?`opacity-100`:`opacity-0`}`}),(0,V.jsxs)(`div`,{className:`relative flex max-h-[86%] flex-col overflow-hidden rounded-t-[14px] border-t border-border-strong bg-panel pb-[env(safe-area-inset-bottom)] shadow-[0_-20px_60px_-10px_rgba(0,0,0,0.8)] transition-transform duration-200 ease-out motion-reduce:transition-none ${a?`translate-y-0`:`translate-y-full`}`,children:[(0,V.jsx)(`div`,{className:`mx-auto mt-[6px] h-[5px] w-[36px] shrink-0 rounded-full bg-muted/35`}),(0,V.jsxs)(`div`,{className:`flex h-[48px] shrink-0 items-center gap-2 border-b border-border/70 px-3`,children:[(0,V.jsx)(`button`,{onClick:n,className:`flex h-[44px] items-center px-2 text-[16px] text-fg/85`,children:`Cancel`}),(0,V.jsx)(`span`,{className:`flex-1 text-center text-[15px] font-semibold tracking-[-0.01em] text-fg`,children:e.length>1?`Question ${r+1} of ${e.length}`:`Question`}),(0,V.jsx)(`span`,{className:`flex h-[44px] w-[44px] items-center justify-center`,children:(0,V.jsx)(jw,{size:19,className:`opacity-0`,"aria-hidden":!0})})]}),(0,V.jsx)(`div`,{"data-mobile-answer-body":!0,className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:(0,V.jsx)(J0,{raw:s.raw,questionKind:s.kind,danger:s.danger,interactive:{answer:t.answerFor(s.bi),onChip:(e,n)=>t.onChip(s.bi,e,n),onText:e=>t.onText(s.bi,e),onSubmit:()=>c?l():i(e=>e+1)}},s.bi)}),(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-3 border-t border-border/70 px-4 pb-[30px] pt-3`,children:[e.length>1?(0,V.jsx)(`div`,{className:`flex items-center gap-1.5`,children:e.map((e,t)=>(0,V.jsx)(`span`,{className:`size-[6px] rounded-full ${t===r?`bg-accent`:`bg-muted/35`}`},e.bi))}):null,(0,V.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[r>0?(0,V.jsx)(`button`,{onClick:()=>i(e=>e-1),className:`flex h-[50px] shrink-0 items-center justify-center rounded-[14px] border border-border-strong bg-elevated px-5 text-[17px] text-fg active:bg-panel-2`,children:`Back`}):null,(0,V.jsx)(`button`,{onClick:()=>c?l():i(e=>e+1),disabled:c?!t.anyAnswered||t.sending:!1,className:`flex h-[50px] flex-1 items-center justify-center rounded-[14px] bg-accent px-5 text-[17px] font-semibold text-bg transition-[filter,opacity] active:brightness-90 disabled:opacity-40`,children:c?t.sending?`Sending…`:`Send answers`:`Continue`})]})]})]})]}),document.body);function l(){t.onSubmit(),n()}}function e2(e){return(0,B.useSyncExternalStore)(e=>zf(Z,e),()=>e?t2(e)!==`codex`:!1,()=>!1)}function t2(e){return iC(Z.board,e)?.backend}function n2(e,t,n,r){let i=rW.followUp(e,t,n),a=tW.get(i),o=a?`${r}\n\n${a}`:r;return tW.set(i,o),i}function r2(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 i2(e){let t=Md(),n=iW(),[r,i]=(0,B.useState)(!1);return{unqueue:(0,B.useCallback)(a=>{if(!e||r)return;let o=iC(Z.board,e)?.sessionId;if(!o){Q(`This thread has no live session to unqueue from`);return}i(!0),X.unqueueFollowUp({slug:e,sessionId:o,deliveryId:a.deliveryId}).then(r=>{if(i(!1),!r.unqueued){Q(r.reason??`That message could not be taken back`);return}mj(t,e,a.rawText,a.deliveryId),n2(n,e,o,a.text),r2(a.from)},e=>{i(!1),Q(`Couldn't unqueue — ${(e instanceof Error?e.message:String(e)).slice(0,90)}`)})},[r,n,t,e]),pending:r}}function a2(e){return(0,B.useSyncExternalStore)(e=>zf(Z,e),()=>{if(!e)return!1;let t=iC(Z.board,e);return t?.backend!==`codex`&&t?.runtime===`running`},()=>!1)}function o2(e){let[t,n]=(0,B.useState)(!1);return{deliverNow:(0,B.useCallback)(()=>{if(!e||t)return;let r=iC(Z.board,e)?.sessionId;if(!r){Q(`This thread has no live session to interrupt`);return}n(!0),X.deliverQueuedNow({slug:e,sessionId:r}).then(e=>{n(!1),e.interrupted||Q(e.reason??`That message could not be pushed through`)},e=>{n(!1),Q(`Couldn't push it through — ${(e instanceof Error?e.message:String(e)).slice(0,90)}`)})},[t,e]),pending:t}}function s2(e){return e.displayText??e.text}function c2(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.role===`user`&&!n.queued&&!n.peerFrom)return t}return-1}var l2=`icon-label-nudge`,u2=new Set([`planning`,`planned`,`active`,`needs-human`,`blocked`]);function d2(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&&u2.has(e.status))}function f2(e,t){let n=e.trim();if(!(!n||n===t.trim()))return n}function p2(e,t){let n=e.trim();return!n||n===t||n===`Untitled thread`||n===`Spinning up a thread…`?``:n}function m2(e){return e.kind!==`session`||e.foreign||e.backend===`codex`?{show:!1,enabled:!1,label:``}:e.runtime===`turn-idle`?{show:!0,enabled:!0,label:`Rename with Claude`}:e.runtime===`perm-prompt`||e.pendingAsk?{show:!0,enabled:!1,label:`Resolve Claude's terminal prompt before renaming`}:e.runtime===`running`||e.runtime===`spawning`?{show:!0,enabled:!1,label:`Rename with Claude when the current turn finishes`}:{show:!0,enabled:!1,label:`Resume this Claude thread to use AI rename`}}var h2=`sticky top-0 z-10 flex min-w-0 shrink-0 items-center gap-2.5 border-b border-border bg-panel px-3 py-1.5 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`,g2=`min-w-0 flex-1 pl-1 max-[640px]:basis-full`,_2=`flex shrink-0 items-center max-[640px]:w-full max-[640px]:justify-between`;function v2(e){return e?.trim()?{kind:`profile-error`,message:`Profile controls unavailable: ${e.trim().slice(0,160)}`}:null}function y2(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`)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 b2(e){return e.permissionChangePending===!0||e.permissionPending!==void 0||e.profileChangePending===!0||e.runtimeControlPending===!0}function x2(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 S2(e){return e===`right`?`pl-3 pr-7`:`pl-7 pr-3`}function C2(e,t,n,r){let i=(n?n.flatMap(e=>e.options):t??[]).find(t=>t.value===e);return i?{text:i.label,placeholder:!1}:e?{text:e,placeholder:!1}:{text:r??``,placeholder:!0}}var w2=`__frizz_empty_select_value__`,T2=e=>e===``?w2:e,E2=e=>e===w2?``:e,D2={ghost:`border-transparent bg-transparent hover:border-border hover:bg-panel-2 data-[state=open]:border-border data-[state=open]:bg-panel-2`,bordered:`w-full justify-between border-border bg-bg hover:bg-panel-2 data-[state=open]:bg-panel-2`,readout:`text-muted hover:text-fg border-border/50 bg-transparent hover:border-border hover:bg-panel-2 data-[state=open]:border-border data-[state=open]:bg-panel-2 [&_.select-caret]:text-fg/65 [&_.select-caret]:opacity-100`},O2={ghost:`border-transparent bg-transparent`,bordered:`w-full justify-between border-border bg-bg`,readout:`text-muted border-border/50 bg-transparent [&_.select-caret]:text-fg/65 [&_.select-caret]:opacity-100`};function k2({o:e,indicatorPosition:t,typography:n}){return(0,V.jsxs)(_V,{value:T2(e.value),title:e.title,className:`relative flex w-full min-w-0 cursor-pointer select-none items-center overflow-hidden rounded-md py-1.5 text-left text-[12px] text-muted outline-none data-[highlighted]:bg-panel-2 data-[highlighted]:text-fg data-[state=checked]:bg-panel-2 data-[state=checked]:font-medium data-[state=checked]:text-fg ${S2(t)} ${n??``}`,children:[(0,V.jsx)(vV,{className:`pointer-events-none absolute top-1/2 inline-flex -translate-y-1/2 items-center text-accent ${t===`right`?`right-2`:`left-2`}`,children:(0,V.jsx)(jC,{size:13})}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e.label})]})}function A2({value:e,onValueChange:t,options:n,groups:r,placeholder:i,ariaLabel:a,title:o,disabled:s=!1,variant:c=`ghost`,indicatorPosition:l=`left`,side:u=`bottom`,className:d=``}){let f=C2(e,n,r,i),p=s?O2[c]:D2[c],m=c===`readout`?ZH:``,[h,g]=(0,B.useState)(!1),_=(0,B.useRef)(h),v=(0,B.useRef)(s),y=(0,B.useRef)(void 0);return _.current=h,v.current=s,(0,B.useLayoutEffect)(()=>{let e=e=>{e.key!==`Escape`||!_.current||v.current||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_.current=!1,y.current?.(),y.current=void 0,g(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]),(0,B.useLayoutEffect)(()=>{!s||!h||(_.current=!1,y.current?.(),y.current=void 0,g(!1))},[s,h]),(0,B.useLayoutEffect)(()=>()=>y.current?.(),[]),(0,V.jsxs)(lV,{modal:!1,open:h,onOpenChange:e=>{y.current?.(),y.current=void 0,_.current=e,g(e),e&&(y.current=hU(()=>{_.current=!1,y.current=void 0,g(!1)}))},children:[(0,V.jsx)(uV,{asChild:!0,disabled:s,children:(0,V.jsxs)(`button`,{type:`button`,"aria-label":a,title:o,className:`group inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border px-2 py-1 text-left text-[12px] text-fg outline-none data-[placeholder]:text-muted ${s?`cursor-not-allowed opacity-45`:`cursor-pointer transition-colors`} ${p} ${c===`readout`?`select-trigger-readout`:``} ${m} ${d}`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left ${f.placeholder?`text-muted`:``}`,children:f.text}),(0,V.jsx)(MC,{className:`select-caret shrink-0 text-muted ${s?``:`transition-transform group-data-[state=open]:rotate-180`}`,size:13})]})}),(0,V.jsx)(dV,{children:(0,V.jsx)(fV,{align:`start`,side:u,sideOffset:5,onEscapeKeyDown:e=>e.stopPropagation(),className:`${SV} min-w-[var(--radix-dropdown-menu-trigger-width)] max-w-[calc(100vw-1rem)] overflow-hidden rounded-lg p-1 ${m}`,children:(0,V.jsx)(gV,{value:T2(e),onValueChange:e=>t(E2(e)),className:`max-h-[300px] min-w-0 overflow-y-auto`,children:r?r.map((e,t)=>(0,V.jsxs)(pV,{children:[e.label&&(0,V.jsx)(mV,{className:`${S2(l)} min-w-0 truncate pb-1 pt-2 text-left text-[10px] font-medium uppercase tracking-wide text-muted/60 first:pt-1`,children:e.label}),e.options.map(e=>(0,V.jsx)(k2,{o:e,indicatorPosition:l,typography:m},e.value))]},e.label||`g${t}`)):(n??[]).map(e=>(0,V.jsx)(k2,{o:e,indicatorPosition:l,typography:m},e.value))})})})]})}function j2(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 M2(e){let t=Hf(Z).board?.threads.find(t=>t.id===e),n=qd({queryKey:[`threadProfileOptions`,e],queryFn:()=>X.threadProfileOptions({slug:e}),enabled:!!(t&&!t.foreign&&t.kind===`session`),staleTime:5e3}),r=Jd({mutationFn:t=>X.setThreadProfile({slug:e,...t})}),i=Jd({mutationFn:t=>X.setThreadPermission({slug:e,permissionMode:t})}),a=r.isPending||i.isPending;if(!t||t.foreign||t.kind!==`session`)return{busy:a,footer:null,status:null};let o=a||b2(t),s=t.model?.trim(),c=t.effort?.trim(),l=t.backend===`codex`?`codex`:`claude`,u=r.isPending?r.variables:void 0,d=t.profilePendingModel??u?.model,f=t.profilePendingEffort??u?.effort,p=n.data?.options??[],{modelSelectable:m}=j2(p,s,c,t.runtime===`exited`),h=n.data!==void 0,g=[{id:l,label:l===`codex`?`Codex`:`Claude Code`,options:p}],_=v2(n.isError?n.error.message:void 0),v=t.permissionMode?NU(t.permissionMode):`auto`,y=jU.some(e=>e.value===v)?v:`auto`,b=i.isPending?i.variables:y,x=y2(t);function S(e){e!==y&&i.mutate(e,{onSuccess:e=>Q(x2(e.effect,`claude`)),onError:e=>Q(`Permission change failed: ${e.message.slice(0,120)}`)})}function C(e){r.mutate(e,{onSuccess:e=>Q(e.effect===`next-resume`?`Model and effort saved for the next resume`:`Model and effort applied`),onError:e=>Q(`Profile change failed: ${e.message.slice(0,120)}`)})}return{busy:o,footer:(0,V.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:[(0,V.jsx)(yU,{groups:g,value:{provider:l,model:s,effort:c},pending:d||f?{provider:l,model:d,effort:f}:void 0,onValueChange:({model:e,effort:t})=>C({model:e,effort:t}),placeholder:n.isPending?`Profile loading…`:`Profile unknown`,ariaLabel:`Thread model and effort`,menuAriaLabel:`Choose ${l===`codex`?`Codex`:`Claude Code`} model and effort`,title:m?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:o||!h||!m||n.isError,compact:!0,side:`top`,className:`min-w-0 max-w-[min(72%,20rem)] px-1.5 py-0.5`}),l===`claude`&&(0,V.jsx)(A2,{variant:`readout`,side:`top`,value:b,onValueChange:e=>S(e),options:jU,ariaLabel:`Thread permission mode`,title:x?`${x} — changing permissions restarts this thread's worker process`:b===`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:o||x!==null,className:`shrink-0`}),d&&f&&(0,V.jsxs)(`span`,{className:`min-w-0 truncate text-[9px] text-muted/50`,children:[`→ `,d,` · `,f,` pending`]})]}),status:_?(0,V.jsx)(`div`,{"data-thread-control-error":``,className:`px-1 pt-1 text-[9.5px] leading-tight text-muted/65`,children:_.message}):null}}var N2=new Map;function P2(e){let t=N2.get(e);if(t)return t;let n=X.threadSkills({slug:e}).then(e=>e.skills,()=>(N2.delete(e),[]));return N2.set(e,n),n}function F2({slug:e,surface:t,placeholder:n,className:r,id:i,ops:a,submitOverride:o}){let s=Hf(Z).board?.threads.find(t=>t.id===e),c=iW(),l=rW.followUp(c,e,s?.sessionId),[u,d,f]=oW(l),p=M2(e),m=eJ(e),[h,g]=(0,B.useState)(null),_=(0,B.useMemo)(()=>()=>P2(e),[e]),[v,y]=(0,B.useState)(null),b=!o&&s?.runtime===`running`&&s.backend!==`codex`;function x(e=!1){let t=u.trim();if(!t)return;let n=wU(t);if(n){f();let e=s?.backend===`codex`?`codex`:`claude`;n===`login`?g(e):y(e);return}let r={onOptimistic:f,onRollback:()=>{tW.get(l)||d(u)}};o?o(t,r):m.submit(t,{...r,interrupt:e})}return(0,V.jsxs)(`div`,{"data-thread-composer-box":t,...t===`chatComposer`?{"data-thread-action-bar":``}:{},className:r,children:[(0,V.jsx)(KH,{id:i,surface:t,value:u,onChange:d,onSubmit:()=>x(),onInterruptSubmit:b?()=>x(!0):void 0,slashSuggest:_,placeholder:n,busy:p.busy,footer:p.footer}),p.status,(0,V.jsx)(`div`,{className:`ops-column-optical-inset empty:hidden`,children:a}),h&&(0,V.jsx)(EU,{backend:h,onClose:()=>g(null),onAuthed:()=>g(null)}),v&&(0,V.jsx)(DU,{backend:v,onClose:()=>y(null)})]})}function I2({slug:e,ops:t}){let n=Hf(Z).board?.threads.find(t=>t.id===e);return n?(0,V.jsx)(F2,{slug:e,surface:`chatComposer`,id:`followup-input`,placeholder:n.foreign?`Send a message to take over this session…`:`Follow up…`,className:`shrink-0 px-3 py-3`,ops:t}):null}function L2({thread:e,openHref:t,onDoc:n,onDone:r,onCollapse:i,collapsed:a,doneBusy:o,onStatusMutate:s,onStatusApplied:c,onStatusFailed:l}){let u=e.kind===`session`;return(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[i&&(0,V.jsx)(B2,{label:a?`Expand`:`Collapse`,icon:a?IC:FC,size:13,onClick:i}),n&&(0,V.jsx)(B2,{label:`Frizz document`,icon:qC,size:14,onClick:n}),t&&(0,V.jsx)(V2,{label:`Open in new tab`,icon:EC,size:14,href:t}),u?gM(e)?(0,V.jsx)(R2,{slug:e.id}):null:(0,V.jsx)(`div`,{className:`ml-1`,children:(0,V.jsx)(AV,{slug:e.id,onDone:r,doneBusy:o,onMutateStart:s,onApplied:c,onFailed:l})})]})}function R2({slug:e}){let t=Md(),[n,r]=(0,B.useState)(!1);return(0,V.jsx)(Pq,{label:`Retry — resume this session where it left off`,children:(0,V.jsxs)(`button`,{onClick:()=>{r(!0),tJ(t,e).finally(()=>r(!1))},disabled:n,"aria-label":`Retry exited session`,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,V.jsx)(cw,{size:12,className:`animate-spin`}):(0,V.jsx)(yw,{size:12}),`Retry`]})})}var z2=`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:hover:bg-transparent disabled:hover:text-muted disabled:opacity-40`;function B2({label:e,icon:t,size:n,busy:r,...i}){return(0,V.jsx)(Pq,{label:e,children:(0,V.jsx)(`button`,{...i,"aria-label":e,onMouseDown:e=>e.preventDefault(),className:z2,children:r?(0,V.jsx)(cw,{size:n,strokeWidth:2,className:`animate-spin`}):(0,V.jsx)(t,{size:n,strokeWidth:2})})})}function V2({label:e,icon:t,size:n,href:r}){return(0,V.jsx)(Pq,{label:e,children:(0,V.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener`,"aria-label":e,onMouseDown:e=>e.preventDefault(),className:z2,children:(0,V.jsx)(t,{size:n,strokeWidth:2})})})}function H2(e){let t=e.kind===`session`&&e.foreign!==!0,n=t&&(e.state===`archived`||e.archived===!0),r=t,i=t&&!n;return{footer:r,done:n,snooze:i,archive:i}}function U2(e){if(e.runtime===`perm-prompt`||e.pendingAsk)return!0;if(e.runtime===`running`||e.runtime===`spawning`)return!1;let t=e=>e.state===`running`||e.state===`stale`;return!(e.subAgents?.some(e=>Cy(e)&&t(e))||e.bgShells?.some(t))}function W2(e){let t={lead:`This thread is still running.`,groups:[],trailer:`Marking it done will stop its agent session, then move it to Done.`};if(!e)return t;let n=[G2(`agent`,`sub-agent`,e.subAgents,e.subAgentCount),G2(`shell`,`background shell`,e.bgShells,e.bgShellCount)].filter(e=>e!==null);return e.unobservable?{lead:`This session is live, but its transcript can’t be read right now — it may still be working.`,groups:n,trailer:`Marking it done will stop the session anyway, then move it to Done.`}:!e.turnInFlight&&n.length===0?t:{lead:e.turnInFlight?n.length>0?`The agent is mid-turn, and it still owns background work:`:`The agent is mid-turn — it’s executing right now.`:`The agent is resting, but the background work it launched is still running:`,groups:n,trailer:n.length>0?`Marking it done will stop the session and everything running under it, then move it to Done.`:`Marking it done will stop its agent session mid-turn, then move it to Done.`}}function G2(e,t,n,r){let i=Math.max(r,n.length);return i===0?null:{kind:e,heading:`${i} ${t}${i===1?``:`s`}`,items:n.map(e=>({label:e.label,stale:e.state===`stale`})),overflow:Math.max(0,i-n.length)}}function K2({open:e,onOpenChange:t,title:n,children:r,footer:i,className:a=`w-[640px] max-w-[92vw] max-h-[82vh]`}){return(0,V.jsx)(FV,{open:e,onOpenChange:t,children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`overlay-in fixed inset-0 z-[200] bg-black/55 backdrop-blur-[1px]`}),(0,V.jsxs)(qV,{"aria-modal":`true`,onEscapeKeyDown:_U,className:`pop-in fixed left-1/2 top-1/2 z-[200] flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-border bg-panel shadow-2xl shadow-black/50 outline-none ${a}`,children:[(0,V.jsxs)(`header`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-border px-4`,children:[(0,V.jsx)(QV,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:n}),(0,V.jsx)(nH,{type:`button`,"aria-label":`Close`,className:`rounded-md p-1 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,V.jsx)(jw,{size:15})})]}),(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:r}),i&&(0,V.jsx)(`footer`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-border px-4 py-3`,children:i})]})]})})}function q2({thread:e,onSnoozed:t}){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(``),f=(0,B.useId)(),p=(0,B.useId)(),m=(0,B.useId)(),h=lM(e),g=Hf(zj).snoozePreset,_=wj(g),v=Kee(g),y=(0,B.useMemo)(()=>Oj(new Date(Date.now()+6e4)),[i]);async function b(n,i=null){r(!0);try{await X.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:n,prompt:n?i:null}),n?(Q(`${i?`Bump scheduled`:`Snoozed`} · ${kj(n)}`),t?.()):Q(`Snooze cleared`),a(!1),d(``)}catch(e){let t=e instanceof Error?e.message:`Snooze failed`;Q(t.slice(0,100)),d(t)}finally{r(!1)}}function x(e){zj.snoozePreset=e,b(Ej(e))}function S(){s(Oj(new Date(h??Ej(g)))),l(e.snoozePrompt??``),d(``),a(!0)}function C(){let e=qee(o);if(!e.ok){d(e.message);return}let t=c.trim();if(t.length>4e3){d(`Prompt is too long (${t.length}/${Iy})`);return}b(e.until,t||null)}return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`inline-flex items-stretch rounded-md border border-border-strong bg-panel-2/60`,children:[(0,V.jsxs)(`button`,{type:`button`,disabled:n,"aria-label":h?`Wake thread now`:v,title:h?`Wake now · ${kj(h)}`:v,onClick:()=>void b(h?null:Ej(g)),className:`flex items-center gap-1.5 rounded-l-md px-2.5 py-1 text-[12px] font-medium text-fg/75 outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-not-allowed disabled:opacity-45`,children:[n&&(0,V.jsx)(cw,{size:12,className:`animate-spin`}),h?`Wake now`:v]}),(0,V.jsx)(`span`,{"aria-hidden":!0,className:`my-1 w-px bg-border`}),(0,V.jsxs)(TV,{children:[(0,V.jsx)(EV,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,disabled:n,"aria-label":`Snooze options`,title:`Selected snooze: ${_}`,className:`flex min-w-0 items-center justify-center gap-1 rounded-r-md px-2 text-fg/75 outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-not-allowed disabled:opacity-45`,children:(0,V.jsx)(MC,{size:12})})}),(0,V.jsxs)(DV,{align:`end`,children:[Cj.map(e=>(0,V.jsx)(OV,{onSelect:()=>x(e.value),icon:(0,V.jsx)(UC,{size:12}),children:(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center justify-between gap-4`,children:[(0,V.jsx)(`span`,{children:e.label}),(0,V.jsx)(`span`,{className:`text-[10px] text-muted/55`,children:e.detail})]})},e.value)),(0,V.jsx)(kV,{}),(0,V.jsx)(OV,{onSelect:S,children:`Custom time & prompt…`}),h&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(kV,{}),(0,V.jsx)(OV,{onSelect:()=>void b(null),children:`Wake now`})]})]})]})]}),(0,V.jsx)(K2,{open:i,onOpenChange:e=>{n||a(e)},title:`Snooze thread`,className:`w-[360px] max-w-[92vw]`,footer:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>a(!1),className:`rounded-md px-3 py-1.5 text-[12px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-45`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`submit`,form:m,disabled:n,className:`flex items-center gap-1.5 rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-opacity hover:opacity-90 disabled:opacity-45`,children:[n&&(0,V.jsx)(cw,{size:12,className:`animate-spin`}),c.trim()?`Snooze & bump`:`Snooze`]})]}),children:(0,V.jsxs)(`form`,{id:m,className:`flex flex-col gap-2.5 p-4`,onSubmit:e=>{e.preventDefault(),C()},children:[(0,V.jsx)(`label`,{htmlFor:f,className:`text-[11px] font-medium text-muted`,children:`Wake at this local time`}),(0,V.jsx)(`input`,{id:f,type:`datetime-local`,required:!0,min:y,value:o,onChange:e=>{s(e.target.value),d(``)},className:`w-full rounded-md border border-border bg-bg px-2.5 py-2 text-[13px] text-fg outline-none focus:border-accent`}),(0,V.jsx)(`p`,{className:`text-[10.5px] text-muted/65`,children:`Stored as an exact instant; shown here in your browser’s local time zone.`}),(0,V.jsxs)(`label`,{htmlFor:p,className:`mt-1 text-[11px] font-medium text-muted`,children:[`Then send this prompt `,(0,V.jsx)(`span`,{className:`font-normal text-muted/55`,children:`(optional)`})]}),(0,V.jsx)(`textarea`,{id:p,autoFocus:!0,rows:3,maxLength:Iy,placeholder:`e.g. Check whether CI went green and land it if so.`,value:c,onChange:e=>{l(e.target.value),d(``)},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())},className:`w-full resize-y rounded-md border border-border bg-bg px-2.5 py-2 text-[13px] leading-5 text-fg outline-none placeholder:text-muted/40 focus:border-accent`}),(0,V.jsx)(`p`,{className:`min-h-4 text-[10.5px] text-muted/65`,children:c.trim()?`frizz will resume this thread with the prompt at the wake time.`:`Leave empty to just bring the card back to your queue.`}),u&&(0,V.jsx)(`p`,{role:`alert`,className:`text-[11px] text-red-400`,children:u})]})})]})}function J2(e,t){return new Promise(n=>{$q(e,t,`Your worker process was restarted so it picks up frizz's current tooling (hooks and worker contract). Re-read whatever you left in your scratch directory, then continue exactly where you left off.`,{freshProcess:!0,onSuccess:()=>{Q(`Restarting worker…`),n()},onRollback:()=>n(),failureToast:e=>`Restart failed: ${e.slice(0,80)}`})||n()})}var Y2=null,X2=null;function Z2(){return Y2===null?(X2??=TK().then(e=>e===null?!1:(Y2=wK(e),Y2)).catch(()=>!1).finally(()=>{X2=null}),X2):Promise.resolve(Y2)}function Q2(){let[e,t]=(0,B.useState)(Y2===!0);return(0,B.useEffect)(()=>{if(Y2!==null){t(Y2);return}let e=!0;return Z2().then(n=>{e&&t(n)}),()=>{e=!1}},[]),e}function $2({thread:e}){let t=Md(),[n,r]=(0,B.useState)(!1);return!Q2()||e.kind!==`session`||e.foreign||e.backend===`codex`||e.runtime===`exited`?null:(0,V.jsx)(Pq,{label:`Restart worker — same conversation, fresh process on current tooling`,side:`top`,children:(0,V.jsx)(`button`,{type:`button`,disabled:n,"aria-label":`Restart worker`,onMouseDown:e=>e.preventDefault(),onClick:()=>{r(!0),J2(t,e.id).finally(()=>r(!1))},className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-fg/55 outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-not-allowed disabled:opacity-45 ${DH}`,children:n?(0,V.jsx)(cw,{size:12,className:`animate-spin`}):(0,V.jsx)(_w,{size:12})})})}function e4({thread:e}){let[t,n]=(0,B.useState)(!1);if(e.kind!==`session`||e.foreign||e.claudeRuntime!==`broker`||e.runtime===`exited`)return null;async function r(){n(!0);try{let t=await X.reloadThreadPlugins({slug:e.id,sessionId:e.sessionId??``}),n=[`${t.plugins} plugin${t.plugins===1?``:`s`}`,`${t.commands} skill${t.commands===1?``:`s`}`,`${t.agents} agent${t.agents===1?``:`s`}`],r=t.mcpServers.length?` · MCP: ${t.mcpServers.join(`, `)}`:``,i=t.errorCount?` · ${t.errorCount} load error${t.errorCount===1?``:`s`}`:``;Q(`Reloaded ${n.join(`, `)}${r}${i}`)}catch(e){Q((e instanceof Error?e.message:`Plugin reload failed`).slice(0,120))}finally{n(!1)}}return(0,V.jsx)(Pq,{label:`Reload plugins — hooks, skills, agents and MCP re-read from disk, same conversation`,side:`top`,children:(0,V.jsx)(`button`,{type:`button`,"data-reload-plugins":!0,disabled:t,"aria-label":`Reload plugins`,onMouseDown:e=>e.preventDefault(),onClick:()=>void r(),className:`flex size-6 items-center justify-center rounded-md text-fg/55 hover:bg-panel-2 hover:text-fg/80 disabled:opacity-50 ${EH}`,children:(0,V.jsx)(mw,{size:13})})})}var t4=1.25,n4=7.5-t4/2,r4=2*Math.PI*n4;function i4(e,t){return Math.max(0,Math.min(100,Math.floor(e/t*100)))}function a4({thread:e}){let t=e.context;if(!t||t.window<=0)return null;let n=i4(t.tokens,t.window),r=Math.max(0,Math.min(1,t.tokens/t.window)),i=`Context ${n}% full\n${t.tokens.toLocaleString()} of ${t.window.toLocaleString()} tokens`;return(0,V.jsx)(Pq,{label:i,side:`top`,multiline:!0,children:(0,V.jsx)(`span`,{"data-context-meter":!0,"data-context-percent":n,"aria-label":i,className:`flex shrink-0 items-center text-muted/60`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 16 16`,className:`h-[1.05em] w-[1.05em]`,"aria-hidden":!0,style:{transform:`rotate(-90deg)`},children:[(0,V.jsx)(`circle`,{cx:`8`,cy:`8`,r:n4,fill:`none`,stroke:`currentColor`,strokeOpacity:.3,strokeWidth:t4}),(0,V.jsx)(`circle`,{cx:`8`,cy:`8`,r:n4,fill:`none`,stroke:`currentColor`,strokeWidth:t4,strokeDasharray:`${r4*r} ${r4}`})]})})})}var o4={sm:{track:`h-[16px] w-[28px]`,thumb:`size-[12px]`,travel:`translate-x-[12px]`,onCap:`translate-y-[calc(6px_-_0.5cap)]`},md:{track:`h-[20px] w-[34px]`,thumb:`size-[16px]`,travel:`translate-x-[14px]`,onCap:`translate-y-[calc(8px_-_0.5cap)]`}};function s4({checked:e,onChange:t,disabled:n,label:r,size:i=`sm`,testId:a}){let o=o4[i];return(0,V.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":r,disabled:n,"data-switch":a,"data-state":e?`checked`:`unchecked`,onMouseDown:e=>e.preventDefault(),onClick:()=>t(!e),className:`inline-flex shrink-0 cursor-pointer items-center self-baseline rounded-full p-[2px] outline-none transition-colors focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-default disabled:opacity-45 ${o.track} ${o.onCap} ${e?`bg-fg`:`bg-border hover:bg-border-strong`}`,children:(0,V.jsx)(`span`,{className:`pointer-events-none block rounded-full transition-transform duration-150 ease-out ${o.thumb} ${e?`bg-bg ${o.travel}`:`translate-x-0 bg-muted/70`}`})})}function c4({size:e=12,className:t=``}){return(0,V.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,"aria-hidden":`true`,children:[(0,V.jsx)(`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,V.jsx)(`path`,{d:`M12 7a5 5 0 1 0 5 5`}),(0,V.jsx)(`path`,{d:`M13 3.055a9 9 0 1 0 7.941 7.945`}),(0,V.jsx)(`path`,{d:`M15 6v3h3l3 -3h-3v-3l-3 3`}),(0,V.jsx)(`path`,{d:`M15 9l-3 3`})]})}function l4({thread:e}){let[t,n]=(0,B.useState)(`closed`),r=(0,B.useRef)(null),i=(0,B.useRef)(void 0);(0,B.useEffect)(()=>()=>clearTimeout(i.current),[]);let a=e.recurringPrompt,o=a?.stopHook===!0||a?.heartbeat===!0||a?.postCompaction===!0;function s(){clearTimeout(i.current),i.current=setTimeout(()=>n(e=>e===`closed`?`preview`:e),u4)}function c(){clearTimeout(i.current),n(e=>e===`preview`?`closed`:e)}let l=e=>{r.current?.contains(e.detail.originalEvent.target)&&e.preventDefault()};return(0,V.jsxs)(nK,{open:t!==`closed`,onOpenChange:e=>{e||(clearTimeout(i.current),n(`closed`))},children:[(0,V.jsx)(iK,{asChild:!0,children:(0,V.jsx)(`button`,{ref:r,type:`button`,"data-recurring-prompt":!0,"data-recurring-prompt-on":o?`true`:`false`,"aria-label":o?`Goal (on)`:`Goal`,"aria-haspopup":`dialog`,"aria-expanded":t===`full`,onClick:()=>{clearTimeout(i.current),n(e=>e===`full`?`closed`:`full`)},onPointerEnter:e=>{e.pointerType===`mouse`&&s()},onPointerLeave:e=>{e.pointerType===`mouse`&&c()},onFocus:()=>n(e=>e===`closed`?`preview`:e),onBlur:c,className:`flex items-center rounded-md px-0.5 py-0.5 outline-none ${TH}`,children:(0,V.jsx)(c4,{size:12,className:o?`text-amber-400/90`:`text-muted/60 hover:text-muted`})})}),t===`preview`?(0,V.jsx)(aK,{side:`top`,align:`start`,"data-recurring-preview":!0,onPointerDownOutside:l,className:`pointer-events-none max-w-[min(22rem,calc(100vw-1.5rem))] p-2.5 text-[11px] leading-snug text-fg`,onOpenAutoFocus:e=>e.preventDefault(),children:(0,V.jsx)(d4,{armed:a})}):(0,V.jsx)(aK,{side:`top`,align:`start`,className:`w-[min(46rem,calc(100vw-1.5rem))] p-3 text-[11px] leading-relaxed text-fg`,onPointerDownOutside:l,onOpenAutoFocus:e=>e.preventDefault(),children:(0,V.jsx)(b4,{thread:e,armed:a})})]})}var u4=260;function d4({armed:e}){let t=e?.prompt?.trim(),n=e?y4({stopHook:e.stopHook===!0,heartbeat:e.heartbeat===!0,postCompaction:e.postCompaction===!0,seconds:e.intervalSeconds??m4}):[];return(0,V.jsxs)(`div`,{"data-recurring-preview-body":!0,children:[(0,V.jsxs)(`div`,{className:`mb-1 flex items-baseline gap-2`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Goal`}),(0,V.jsx)(`span`,{className:`text-muted/70`,children:n.length>0?`sent ${n.join(`, `)}`:t?`no trigger is on`:`not set`})]}),(0,V.jsx)(`p`,{className:`line-clamp-4 whitespace-pre-wrap ${t?`text-fg/90`:`text-muted`}`,children:t||`Click to write what this thread is trying to achieve.`})]})}var f4=1,p4=1440,m4=600;function h4(e,t){if(e===String(Math.round(t/60)))return t;let n=Math.round(Number(e));return Number.isFinite(n)&&n>0?Math.min(p4,Math.max(f4,n))*60:t}var g4=null;function _4(e){return{prompt:e.text.trim(),stopHook:e.stopHook,heartbeat:e.heartbeat,postCompaction:e.postCompaction,seconds:e.seconds}}function v4(e,t){return!e.archived&&!t}function y4(e){return[e.stopHook?`at every rest`:null,e.heartbeat?`every ${Math.round(e.seconds/60)} min`:null,e.postCompaction?`after every compaction`:null].filter(e=>e!==null)}function b4({thread:e,armed:t}){let n=v4(e,t)?Vy:``,r=g4?.slug===e.id?g4.draft:null,[i,a]=(0,B.useState)(r?.text??t?.prompt??n),[o,s]=(0,B.useState)(r?.stopHook??t?.stopHook??!1),[c,l]=(0,B.useState)(r?.heartbeat??t?.heartbeat??!1),[u,d]=(0,B.useState)(r?.postCompaction??t?.postCompaction??!1),[f,p]=(0,B.useState)(r?.seconds??t?.intervalSeconds??m4),m=o||c||u,[h,g]=(0,B.useState)(String(Math.round((r?.seconds??t?.intervalSeconds??m4)/60))),_=(0,B.useRef)(null),v=(0,B.useRef)({prompt:t?.prompt??n,stopHook:t?.stopHook??!1,heartbeat:t?.heartbeat??!1,postCompaction:t?.postCompaction??!1,seconds:t?.intervalSeconds??m4}),y=e=>({text:i,stopHook:o,heartbeat:c,postCompaction:u,seconds:h4(h,f),...e}),b=(0,B.useRef)(y());b.current=y();let x=(0,B.useRef)(()=>Promise.resolve(!0));x.current=e=>C(e),(0,B.useEffect)(()=>()=>{x.current(b.current)},[]);let S=(0,B.useRef)(Promise.resolve(!0));function C(t){let n=S.current.catch(()=>!1).then(async()=>{let n=await w(t);return n?g4?.slug===e.id&&(g4=null):g4={slug:e.id,draft:t},n});return S.current=n,n}async function w(n){let r=n.text.trim()||null;if(r===(v.current.prompt||null)&&n.stopHook===v.current.stopHook&&n.heartbeat===v.current.heartbeat&&n.postCompaction===v.current.postCompaction&&n.seconds===v.current.seconds)return!0;if(r===null&&!t)return v.current={..._4(n),prompt:``},!0;try{await X.setThreadRecurringPrompt({slug:e.id,sessionId:e.sessionId??``,prompt:r,stopHook:n.stopHook,heartbeat:n.heartbeat,postCompaction:n.postCompaction,...r===null?{}:{intervalSeconds:n.seconds}}),v.current={..._4(n),prompt:r??``};let t=y4(n);Q(r===null?`Goal cleared`:t.length===0?`Goal saved — no trigger is on, so nothing is sent`:`Goal: sent ${t.join(`, `)}`)}catch(e){return Q((e instanceof Error?e.message:`Could not save the recurring prompt`).slice(0,100)),!1}return!0}let T=()=>void C(y());function E(){let e=h4(h,f);g(String(Math.round(e/60))),p(e),C(y({seconds:e}))}let D=[{at:t?.lastRestFiredAt,how:`at rest`},{at:t?.lastScheduleFiredAt,how:`on schedule`},{at:t?.lastCompactFiredAt,how:`after a compaction`}].filter(e=>e.at!==void 0),O=D.reduce((e,t)=>e&&Date.parse(e.at)>=Date.parse(t.at)?e:t,void 0),k=O===void 0?null:D.length>1?`Last sent ${QM(O.at)}`:`Last sent ${O.how} ${QM(O.at)}`;return(0,V.jsxs)(`section`,{"data-recurring-panel":!0,children:[(0,V.jsxs)(`div`,{className:`mb-2 flex items-center gap-3`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Goal`}),k&&(0,V.jsx)(`span`,{className:`ml-auto truncate text-muted/55`,children:k})]}),(0,V.jsx)(`textarea`,{ref:_,"data-recurring-text":!0,value:i,maxLength:Ry,onChange:e=>a(e.target.value),onBlur:T,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),T())},placeholder:`What is this thread trying to achieve?`,className:`field-sizing-content max-h-[28vh] min-h-[4rem] w-full resize-none overflow-y-auto rounded-md border border-border bg-bg px-2 py-1.5 text-[12px] leading-snug outline-none placeholder:text-muted/50 focus:border-border-strong ${m?`text-fg`:`text-muted`}`}),(0,V.jsxs)(`div`,{className:`mt-3 grid grid-cols-[auto_auto_1fr] items-baseline gap-x-2.5 gap-y-2`,children:[(0,V.jsx)(s4,{testId:`stop-hook`,label:`Stop hook`,checked:o,onChange:e=>{s(e),C(y({stopHook:e})),e&&!i.trim()&&requestAnimationFrame(()=>_.current?.focus())}}),(0,V.jsx)(`span`,{className:`font-medium ${o?`text-fg`:`text-muted`}`,children:`Stop hook`}),(0,V.jsx)(`span`,{className:`text-muted`,children:`every rest — unless it signed off or parked on a wait`}),(0,V.jsx)(s4,{testId:`heartbeat`,label:`Heartbeat`,checked:c,onChange:e=>{l(e),C(y({heartbeat:e})),e&&!i.trim()&&requestAnimationFrame(()=>_.current?.focus())}}),(0,V.jsx)(`span`,{className:`font-medium ${c?`text-fg`:`text-muted`}`,children:`Heartbeat`}),c?(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted`,children:[`every`,(0,V.jsx)(`input`,{type:`number`,"data-recurring-minutes":!0,inputMode:`numeric`,min:f4,max:p4,value:h,onChange:e=>g(e.target.value),onBlur:E,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),E())},"aria-label":`Heartbeat interval in minutes`,className:`w-[4.5ch] rounded-md border border-border bg-bg px-1 py-[3px] text-center text-[11px] leading-none tabular-nums text-fg outline-none focus:border-border-strong disabled:opacity-45 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none`}),`min, even mid-turn`]}):(0,V.jsx)(`span`,{className:`text-muted`,children:`on a clock, even mid-turn`}),(0,V.jsx)(s4,{testId:`post-compaction`,label:`Compaction`,checked:u,onChange:e=>{d(e),C(y({postCompaction:e})),e&&!i.trim()&&requestAnimationFrame(()=>_.current?.focus())}}),(0,V.jsx)(`span`,{className:`font-medium ${u?`text-fg`:`text-muted`}`,children:`Compaction`}),(0,V.jsx)(`span`,{className:`text-muted`,children:`when the context is summarized away — link the doc to re-read`})]})]})}function x4({thread:e,sticky:t=!1,safeArea:n=!1,onArchived:r,onDismissCancel:i,onSnoozed:a}){let o=H2(e);return o.footer?(0,V.jsxs)(`footer`,{"aria-label":`Thread lifecycle actions`,"data-thread-lifecycle-footer":!0,className:`${t?`z-20`:K1} flex min-h-10 shrink-0 flex-wrap items-center justify-end ${CH} border-t border-border/70 bg-panel/95 px-3 pt-2 text-[12px] ${n?`pb-[max(0.5rem,env(safe-area-inset-bottom))]`:`pb-2`} backdrop-blur-sm`,children:[(0,V.jsxs)(`span`,{className:`mr-auto flex items-center ${CH}`,children:[(0,V.jsx)(a4,{thread:e}),!o.done&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(e4,{thread:e}),(0,V.jsx)($2,{thread:e})]}),(0,V.jsx)(C4,{thread:e}),(0,V.jsx)(l4,{thread:e})]}),o.done?(0,V.jsx)(S4,{}):(0,V.jsxs)(V.Fragment,{children:[o.snooze&&(0,V.jsx)(q2,{thread:e,onSnoozed:a}),(0,V.jsx)(w4,{thread:e,onArchived:r,onDismissCancel:i})]})]}):null}function S4(){let e=`Marked done — send a message to reopen it`;return(0,V.jsx)(Pq,{label:e,side:`top`,children:(0,V.jsxs)(`span`,{"data-thread-done":!0,"aria-label":e,className:`flex items-center gap-1 rounded-md border border-transparent px-2.5 py-1 font-medium text-muted`,children:[(0,V.jsx)(jC,{size:12}),`Done`]})})}function C4({thread:e}){let t=lM(e);if(!t)return null;let n=e.snoozePrompt?.trim(),r=n?`Bumps ${kj(t)}\n${n}`:`Snoozed until ${kj(t)}`;return(0,V.jsx)(Pq,{label:r,side:`top`,multiline:!!n,children:(0,V.jsx)(`span`,{"data-pending-snooze":!0,"aria-label":r,className:`flex items-center px-0.5 text-muted/60 ${wH}`,children:(0,V.jsx)(tw,{size:12})})})}function w4({thread:e,onArchived:t,onDismissCancel:n,className:r=`rounded-md border border-border-strong bg-panel-2/60 px-2.5 py-1 text-[12px] text-fg/80 hover:bg-panel-2 hover:text-fg`,iconClassName:i=``}){let[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(void 0),d=(r,i)=>{o(!0),i&&t?.(),(r||U2(e))&&wJ(e.id),X.completeThread({slug:e.id,sessionId:e.sessionId??``,terminateLive:r}).then(r=>{if(r.needsConfirmation){TJ(e.id),i&&n?.(),u(r.hold),c(!0),o(!1);return}c(!1),Q(`Done`),i||t?.()}).catch(t=>{TJ(e.id),i&&n?.(),Q(`Couldn’t finish: ${t.message.slice(0,80)}`),o(!1)})},f=!!t&&!!n&&U2(e);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>d(!1,f),disabled:a,"aria-label":`Mark as done`,title:`Mark as done`,onMouseDown:e=>e.preventDefault(),className:`flex items-center gap-1 font-medium outline-none transition-colors focus-visible:ring-1 focus-visible:ring-fg/60 disabled:opacity-45 ${r}`,children:[(0,V.jsx)(jC,{size:12,className:i}),`Mark as done`]}),(0,V.jsx)(K2,{open:s,onOpenChange:e=>{a||c(e)},title:`End this session?`,className:`w-[390px] max-w-[92vw]`,footer:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>c(!1),className:`rounded-md px-3 py-1.5 text-[12px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-45`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>d(!0,!1),className:`flex items-center gap-1.5 rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-opacity hover:opacity-90 disabled:opacity-45`,children:[a&&(0,V.jsx)(cw,{size:12,className:`animate-spin`}),`End session & mark done`]})]}),children:(0,V.jsx)(T4,{hold:l})})]})}function T4({hold:e}){let t=W2(e);return(0,V.jsxs)(`div`,{"data-completion-hold":!0,className:`flex flex-col gap-2 p-4 text-[12px] leading-relaxed text-muted`,children:[(0,V.jsx)(`p`,{children:t.lead}),t.groups.map(e=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,V.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg/70`,children:e.heading}),(0,V.jsxs)(`ul`,{className:`flex flex-col gap-0.5`,children:[e.items.map((e,t)=>(0,V.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,V.jsx)(`span`,{"aria-hidden":!0,className:$M,children:`⤷`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate text-fg/80`,children:e.label}),e.stale&&(0,V.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted/60`,children:`no recent output`})]},`${e.label}-${t}`)),e.overflow>0&&(0,V.jsxs)(`li`,{className:`pl-[15px] text-muted/60`,children:[`+`,e.overflow,` more`]})]})]},e.kind)),(0,V.jsx)(`p`,{children:t.trailer})]})}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 D4={completed:`finished`,killed:`stopped`,failed:`failed`};function O4(e){let t=D4[e.agentStatus??`completed`],n=e.agentElapsedMs===void 0?void 0:YM(e.agentElapsedMs);return{outcome:t,tail:`${t}${n?` · ${n}`:``}`}}var k4=e=>e===void 0?void 0:WM(e),A4=e=>{if(e!==void 0)return YM(e)||void 0};function j4(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=k4(n);return{label:t===`completed`?void 0:D4[t],duration:A4(n),tone:r?`failed`:`muted`,title:`${e?`Stopped`:r?`Failed`:`Ran for`}${e||r?` after`:``} ${i??`an unknown time`}`}}if(r){let e=k4(i);return{label:void 0,duration:A4(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=k4(o);return{label:c?D4.killed:s?D4.failed:void 0,duration:A4(o),tone:s?`failed`:`muted`,title:`${c?`Stopped after`:s?`Failed after`:`Ran for`} ${l??`an unknown time`}`}}var M4=`text-[14px] leading-5 text-muted`,N4=`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 P4(e){return`${N4} ${e?`-mx-[0.208em] rotate-90`:`-mx-[0.333em]`}`}var $=B.createElement;function F4({payload:e}){return e.kind===`command-approval`?$(B.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,$(I4,{label:`Redacted command preview`,text:e.command.preview}),e.command.actions?$(L4,{actions:e.command.actions}):null,e.capabilities?$(z4,{capabilities:e.capabilities}):null):e.kind===`file-approval`?$(B.Fragment,null,$(`div`,{className:`text-[12px] text-muted`},U4(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-amber-400/35 bg-amber-500/[0.06] px-2.5 py-2`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-amber-100/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-amber-100/75`},e.scopeLabel):null):null,e.diffPreview?$(I4,{label:`Plain-text diff preview`,text:e.diffPreview}):null,e.changes?$(R4,{changes:e.changes}):null):$(B.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?$(z4,{capabilities:e.capabilities}):null)}function I4({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-fg/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 L4({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`},H4(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,$(I4,{label:`${H4(e.kind)} command detail`,text:e.commandPreview})))))}function R4({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`},U4(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?$(I4,{label:`${U4(e.operation)} plain-text diff`,text:e.diffPreview}):null))))}function z4({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 $(B.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},t),e.hosts.length>0?$(V4,{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 $(B.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},t),$(V4,{label:`Paths`,values:e.resources}))}return e.kind===`glob-scan`?$(B.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`?$(B.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},`Future command policy amendment`),$(V4,{label:`Command prefix tokens`,values:e.prefixes})):$(B.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},e.access===`allow`?`Allow future network hosts`:`Deny future network hosts`),$(V4,{label:`Hosts`,values:e.hosts}))}function V4({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 H4(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 U4(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 G4={semantic:`approve`,label:`Approve once`,order:10,tone:`primary`,durable:!1,scope:`Applies only to this request.`},K4={semantic:`approve`,label:`Approve for session`,order:20,tone:`primary`,durable:!0,scope:`Persists for later matching requests in this thread session.`},q4={semantic:`approve`,label:`Grant for turn`,order:10,tone:`primary`,durable:!1,scope:`Applies to this turn only.`},J4={semantic:`approve`,label:`Grant for session`,order:20,tone:`primary`,durable:!0,scope:`Persists until this thread session ends.`},Y4={semantic:`deny`,label:`Deny`,order:70,tone:`danger`,durable:!1,scope:`Rejects this request.`},X4={semantic:`decline`,label:`Decline`,order:70,tone:`danger`,durable:!1,scope:`Declines this request.`},Z4={semantic:`cancel`,label:`Cancel request`,order:80,tone:`neutral`,durable:!1,scope:`Cancels this pending request.`};function Q4(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`?G4:n===`acceptForSession`&&r===`approve`?K4:(n===`decline`||n===`deny`)&&r===`deny`?Y4:n===`cancel`&&r===`cancel`?Z4:void 0;if(e.kind===`permission-approval`)return n===`grant-turn`&&r===`approve`?q4:n===`grant-session`&&r===`approve`?J4:(n===`deny`||n===`decline`)&&r===`deny`?Y4:n===`cancel`&&r===`cancel`?Z4: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`?X4:n===`cancel`&&r===`cancel`?Z4: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 X4;if(n===`cancel`&&r===`cancel`)return Z4}function $4(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=Q4(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 e3(e){switch(e){case`claude`:return`Claude`;case`codex`:return`Codex`;case`frizz`:return`Frizz`}}function t3(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 n3(e,t){let n=e.options.findIndex(e=>JSON.stringify(e.value)===JSON.stringify(t));return n<0?``:String(n)}function r3(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?``:n3(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 i3(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 a3(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=Vv(i,a);e?r[i.id]=`Value ${e}.`:n[i.id]=a}}if(Object.keys(r).length>0)return{errors:r};let i=$v.safeParse(n);return i.success?{errors:r,values:i.data}:{errors:r,formError:`The response is too large or contains invalid values.`}}function o3(e,t){return JSON.stringify([e,t??null])}function s3(e,t){try{let n=new URL(e,t);return n.protocol===`http:`||n.protocol===`https:`?n.toString():null}catch{return null}}function c3(e,t){let n=e.getAttribute(`href`);if(!n)return!1;let r=s3(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 l3(e=()=>location.href){return t=>{if(t.defaultPrevented||t.button!==0)return;let n=d3(t);n&&c3(n,e())}}function u3(){let e=l3();return document.addEventListener(`click`,e,!0),()=>document.removeEventListener(`click`,e,!0)}function d3(e){let t=typeof e.composedPath==`function`?e.composedPath():[];for(let e of t)if(f3(e))return e;let n=e.target?.closest?.(`a[href]`);return f3(n)?n:null}function f3(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 p3(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 m3(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)=>`${p3(t)} ${e.label}`),recommendedIdx:null},...e?{optionFieldId:e.id}:{},optionValues:r.map(e=>e.value),...t?{notesFieldId:t.id}:{}}}function h3(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=m3(r,a);if(!e)return null;n.push(e)}else if(r.input===`text`||r.input===`multiline`){let e=m3(void 0,r);if(!e)return null;n.push(e)}else return null}return n.length>0?n:null}function g3(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}if(a){e.notesFieldId&&(n[e.notesFieldId]=a);return}let o=i.chosen;e.optionFieldId&&o!==null&&e.optionValues[o]!==void 0&&(n[e.optionFieldId]=e.optionValues[o])}),Object.keys(n).length>0?n:void 0}function _3(e){let t=e instanceof Error?e.message:`The request could not be updated.`;return t.length>240?`${t.slice(0,239)}…`:t}function v3(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`frizz-response-${Date.now()}-${Math.random().toString(36).slice(2)}`}function y3({thread:e,className:t=``,autoFocusFirst:n=!1}){let r=rj(e),i=aj(e),a=(0,B.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,V.jsxs)(`div`,{"data-interactions-error":!0,role:`alert`,className:`${W1} border border-amber-500/35 bg-amber-500/[0.07] p-4 text-[12px] text-amber-100 ${t}`,children:[(0,V.jsx)(`div`,{className:`font-medium`,children:`Pending requests could not be loaded.`}),(0,V.jsx)(`div`,{className:`mt-1 break-words text-amber-100/75`,children:_3(i.error)}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void i.refetch(),className:`mt-2 rounded-md border border-amber-400/40 px-2 py-1 text-[11px] hover:bg-amber-500/10`,children:`Try again`})]}):a.length===0?null:(0,V.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,V.jsx)(x3,{record:e,autoFocus:n&&t===0},e.id))}):null}function b3({record:e,questions:t,autoFocus:n}){let r=Md(),i=(0,B.useRef)(null),a=(0,B.useRef)(new Map),o=iW(),s=W4(e.delivery?.effect),c=(0,B.useMemo)(()=>$4(e).find(e=>e.semantic===`answer`),[e]),l=sW(t.flatMap(t=>t.notesFieldId?[rW.interaction(o,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId)]:[])),[u,d]=(0,B.useState)(()=>t.map(()=>({chosen:null,chosenSet:[]}))),f=t.map((t,n)=>({chosen:u[n]?.chosen??null,chosenSet:u[n]?.chosenSet??[],text:t.notesFieldId?l.get(rW.interaction(o,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId))??``:``})),p=g3(t,f),[m,h]=(0,B.useState)(),[g,_]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(!n)return;let e=document.activeElement;e&&e!==document.body||requestAnimationFrame(()=>i.current?.focus())},[n,e.id]);let v=Jd({mutationFn:async t=>X.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=>{_(!0),Ik(r,t.interaction),r.invalidateQueries({queryKey:Pk(e.owner.threadSlug,e.owner.sessionId)}),r.invalidateQueries({queryKey:Fk(e.owner.threadSlug,e.owner.sessionId,e.id)})},onError:t=>{Lk(r,e),h(_3(t))}}),y=()=>{if(!c||!p||v.isPending||g||!s.actionsEnabled)return;h(void 0);let e=o3(c.id,p),t=a.current.get(e)??v3();a.current.set(e,t),v.mutate({decisionId:c.id,values:p,responseId:t})},b=(t,n)=>{t.notesFieldId&&tW.set(rW.interaction(o,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId),n)};return(0,V.jsxs)(`article`,{ref:i,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,V.jsx)(J0,{question:e.question,interactive:s.actionsEnabled&&!g?{answer:f[t],onChip:n=>d(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 b(e,``),{...r,chosen:n}})),onText:t=>b(e,t),onSubmit:y}:void 0},e.optionFieldId??e.notesFieldId??t)),m&&(0,V.jsx)(`div`,{role:`alert`,className:`break-words text-[11px] leading-snug text-red-300`,children:m}),(s.status||v.isPending||g)&&(0,V.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`text-[11px] leading-snug text-muted`,children:s.status??(g?`Answer sent.`:`Sending…`)}),s.actionsEnabled&&!g&&(0,V.jsx)(`div`,{className:`flex justify-start`,children:(0,V.jsx)(`button`,{type:`button`,"data-send-answers":!0,disabled:!p||v.isPending,onClick:y,onMouseDown:e=>e.preventDefault(),className:`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 x3({record:e,autoFocus:t=!1}){let n=(0,B.useMemo)(()=>h3(e),[e]);return n?(0,V.jsx)(b3,{record:e,questions:n,autoFocus:t}):(0,V.jsx)(S3,{record:e,autoFocus:t})}function S3({record:e,autoFocus:t=!1}){let n=Md(),r=(0,B.useId)(),i=(0,B.useRef)(null),a=(0,B.useRef)(new Map),o=e.payload.kind===`mcp-elicitation-form`||e.payload.kind===`agent-question`?e.payload.fields:[],s=o.some(e=>e.secret),c=iW(),l=o.filter(e=>!e.secret&&(e.input===`text`||e.input===`multiline`)).map(t=>rW.interaction(c,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.id)),u=sW(l),[d,f]=(0,B.useState)(()=>r3(o)),p=(0,B.useMemo)(()=>{let t={...d};return o.forEach(n=>{if(!n.secret&&(n.input===`text`||n.input===`multiline`)){let r=rW.interaction(c,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,n.id);t[n.id]=u.get(r)??``}}),t},[o,d,u,c,e.id,e.owner]),[m,h]=(0,B.useState)({}),[g,_]=(0,B.useState)(),[v,y]=(0,B.useState)(),[b,x]=(0,B.useState)(!1),[S,C]=(0,B.useState)(),[w,T]=(0,B.useState)(!1),E=W4(e.delivery?.effect),D=(0,B.useMemo)(()=>$4(e),[e]).filter(e=>!(s&&e.requiresValues)),O=e.allowedDecisions.length-D.length,k=(0,B.useCallback)(t=>{for(let n of o)if(!n.secret&&(n.input===`text`||n.input===`multiline`)){let r=t[n.id];typeof r==`string`&&tW.set(rW.interaction(c,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,n.id),r)}f(t)},[o,c,e.id,e.owner]);(0,B.useEffect)(()=>{if(!t)return;let e=document.activeElement;e&&e!==document.body||requestAnimationFrame(()=>i.current?.focus())},[t,e.id]),(0,B.useEffect)(()=>{E.actionsEnabled||(C(void 0),T(!1))},[E.actionsEnabled]);let A=Jd({mutationFn:async({decision:t,values:n,responseId:r})=>{if(t.semantic===`cancel`&&e.provider.kind===`frizz`){let t=await X.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 X.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,r)=>{t.waitingForProvider||a.current.delete(o3(r.decision.id,r.values)),_(void 0),C(void 0),T(!1),x(!0),l.forEach(e=>tW.clear(e)),y(t.waitingForProvider?`Response sent. Waiting for the provider to acknowledge it…`:`Request completed.`),Ik(n,t.interaction),n.setQueryData(Fk(e.owner.threadSlug,e.owner.sessionId,e.id),{interaction:t.interaction}),n.invalidateQueries({queryKey:Pk(e.owner.threadSlug,e.owner.sessionId),exact:!0}),t.waitingForProvider&&window.setTimeout(()=>{n.invalidateQueries({queryKey:Pk(e.owner.threadSlug,e.owner.sessionId),exact:!0})},1e3)},onError:t=>{y(void 0),_(_3(t)),Lk(n,e),X.interactionGet({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id}).then(({interaction:t})=>{Ik(n,t),n.setQueryData(Fk(e.owner.threadSlug,e.owner.sessionId,e.id),{interaction:t}),t.delivery?.effect===`sending`?(_(void 0),y(void 0),x(!0)):t.delivery?.effect===`reconnect-required`?(_(void 0),y(void 0)):(t.lifecycle!==`pending`||t.recordRevision!==e.recordRevision)&&(_(void 0),y(t.lifecycle===`expired`?`This request expired.`:`This request changed in another client.`),n.invalidateQueries({queryKey:Pk(e.owner.threadSlug,e.owner.sessionId),exact:!0})),n.invalidateQueries({queryKey:Pk(e.owner.threadSlug,e.owner.sessionId),exact:!0})}).catch(()=>{})}});function j(e){if(!e.requiresValues){h({});return}let t=a3(o,p);return h(t.errors),t.formError?(_(t.formError),null):t.values?t.values:null}function M(e,t=!1){if(!E.actionsEnabled||A.isPending||b)return;_(void 0);let n=j(e);if(n===null)return;if(e.durable&&!t){C(e),T(!1);return}let r=o3(e.id,n),i=a.current.get(r)??v3();a.current.set(r,i),A.mutate({decision:e,values:n,responseId:i})}let N=D.find(e=>e.requiresValues&&e.tone===`primary`);function P(e){e.preventDefault(),E.actionsEnabled&&N&&M(N)}return(0,V.jsxs)(`article`,{ref:i,tabIndex:-1,"aria-labelledby":r,"data-interaction-id":e.id,"data-interaction-kind":e.payload.kind,"data-delivery-effect":e.delivery?.effect,className:`min-w-0 ${W1} border border-accent/45 bg-accent/[0.065] shadow-sm shadow-black/15 outline-none focus-visible:ring-2 focus-visible:ring-accent/60`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 border-b border-accent/20 px-4 py-3`,children:[(0,V.jsx)(xw,{"aria-hidden":`true`,size:16,className:`shrink-0 text-accent`}),(0,V.jsx)(`h3`,{id:r,className:`min-w-0 flex-1 break-words text-[14px] font-semibold leading-snug text-fg`,children:e.payload.title})]}),(0,V.jsx)(`form`,{onSubmit:P,className:`min-w-0 px-4 py-3.5`,noValidate:!0,children:(0,V.jsxs)(`fieldset`,{disabled:!E.actionsEnabled,className:`min-w-0 border-0 p-0`,children:[(0,V.jsx)(`legend`,{className:`sr-only`,children:`Interaction request`}),(0,V.jsx)(w3,{record:e,instanceId:r,draft:p,setDraft:k,errors:m,autoFocus:t}),s&&(0,V.jsxs)(`div`,{"data-secret-fallback":!0,className:`mt-3 rounded-md border border-amber-500/35 bg-amber-500/[0.07] p-3 text-[12px] leading-snug text-amber-100/90`,children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(aw,{"aria-hidden":`true`,size:14,className:`mt-0.5 shrink-0`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`font-medium`,children:`Secret input is unavailable in this page.`}),(0,V.jsx)(`div`,{className:`mt-1 text-amber-100/70`,children:`Frizz will not persist or send secret values through the current RPC.`})]})]}),(0,V.jsx)(`div`,{className:`mt-2 font-medium`,children:`Use the provider's trusted secret-input flow. The thread terminal cannot answer this typed request.`})]}),O>0&&(0,V.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-md border border-amber-500/25 bg-amber-500/[0.05] px-3 py-2 text-[11px] leading-snug text-amber-100/75`,children:[(0,V.jsx)(kw,{"aria-hidden":`true`,size:13,className:`mt-0.5 shrink-0`}),(0,V.jsxs)(`span`,{children:[O===1?`One advertised choice`:`${O} advertised choices`,` cannot be safely labeled or delivered in Frizz and is not shown.`]})]}),S&&(0,V.jsxs)(`div`,{"data-durable-confirmation":!0,role:`group`,"aria-label":`Confirm ${S.label}`,className:`mt-3 rounded-md border border-amber-400/45 bg-amber-500/[0.08] p-3`,children:[(0,V.jsx)(`div`,{className:`text-[12px] font-semibold text-amber-100`,children:`This approval persists beyond the current request.`}),(0,V.jsx)(`div`,{className:`mt-1 text-[11px] leading-snug text-amber-100/75`,children:S.scope}),(0,V.jsxs)(`label`,{className:`mt-2.5 flex cursor-pointer items-start gap-2 text-[11px] leading-snug text-fg/85`,children:[(0,V.jsx)(`input`,{type:`checkbox`,autoFocus:!0,checked:w,onChange:e=>T(e.target.checked),className:`mt-0.5 accent-[var(--color-accent)]`}),(0,V.jsx)(`span`,{children:`I understand this may authorize later matching actions in this session.`})]}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-start gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>{C(void 0),T(!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,V.jsxs)(`button`,{type:`button`,disabled:!w||A.isPending,onClick:()=>M(S,!0),className:`rounded-md border border-amber-400/50 bg-amber-500/15 px-2.5 py-1.5 text-[11px] font-semibold text-amber-50 hover:bg-amber-500/25 disabled:opacity-35`,children:[`Confirm `,S.label.toLowerCase()]})]})]}),g&&(0,V.jsx)(`div`,{role:`alert`,className:`mt-3 break-words text-[11px] leading-snug text-red-300`,children:g}),(E.status??v)&&(0,V.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`mt-3 text-[11px] leading-snug text-muted`,children:E.status??v}),E.actionsEnabled&&!S&&!b&&D.length>0&&(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap justify-start gap-2`,children:[D.map(e=>(0,V.jsxs)(`button`,{type:e===N?`submit`:`button`,"data-interaction-decision":e.id,disabled:A.isPending,"aria-describedby":e.durable?`${r}-scope-${e.id}`:void 0,onClick:e===N?void 0:()=>M(e),className:C3(e),children:[A.isPending?`Sending…`:e.label,e.durable&&(0,V.jsx)(`span`,{className:`sr-only`,children:`; persistent approval`})]},e.id)),D.filter(e=>e.durable).map(e=>(0,V.jsx)(`span`,{id:`${r}-scope-${e.id}`,className:`sr-only`,children:e.scope},`scope-${e.id}`))]}),!T3.has(e.payload.kind)&&(0,V.jsx)(O3,{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-fg/50 disabled:opacity-40`;return e.tone===`primary`?`${t} border-accent/55 bg-accent/15 text-fg hover:bg-accent/25`:e.tone===`danger`?`${t} border-red-400/35 bg-red-500/[0.07] text-red-200 hover:bg-red-500/15`:`${t} border-border bg-panel text-muted hover:bg-panel-2 hover:text-fg`}function w3({record:e,instanceId:t,draft:n,setDraft:r,errors:i,autoFocus:a}){let o=e.payload,s=(e,t)=>r(i3(n,e,t)),c;return c=o.kind===`command-approval`||o.kind===`file-approval`||o.kind===`permission-approval`?(0,V.jsx)(F4,{payload:o}):o.kind===`mcp-elicitation-url`?(0,V.jsx)(D3,{url:o.url}):(0,V.jsx)(k3,{instanceId:t,fields:o.fields,draft:n,setValue:s,errors:i,autoFocus:a}),(0,V.jsxs)(V.Fragment,{children:[`message`in o&&o.message&&(0,V.jsx)(E3,{text:o.message}),(0,V.jsx)(`div`,{className:`message`in o&&o.message?`mt-3`:``,children:c})]})}var T3=new Set([`command-approval`,`file-approval`,`permission-approval`]);function E3({text:e}){return e.length>600||e.split(`
485
- `).length>6?(0,V.jsxs)(`details`,{className:`rounded-md border border-border/70 bg-panel/60`,children:[(0,V.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-fg/50`,children:`Request message`}),(0,V.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,V.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})}function D3({url:e}){let t=s3(e,location.href);return(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-[11px] font-medium text-fg`,children:`Open this page to continue`}),(0,V.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,V.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,V.jsx)(KC,{"aria-hidden":`true`,size:12}),`Open page`]}):(0,V.jsx)(`div`,{role:`alert`,className:`mt-1.5 break-words text-[11px] text-red-300`,children:`This request did not provide a safe http(s) URL.`})]})}function O3({record:e}){return(0,V.jsxs)(`details`,{className:`mt-3 border-t border-border/50 pt-2 text-[10.5px] text-muted/70`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer w-fit outline-none hover:text-muted focus-visible:ring-1 focus-visible:ring-fg/50`,children:`Request details`}),(0,V.jsxs)(`dl`,{className:`mt-2 grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1`,children:[(0,V.jsx)(`dt`,{children:`Provider`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e3(e.provider.kind)}),e.provider.name&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Reported name`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.name})]}),e.provider.version&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Reported version`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.version})]}),(0,V.jsx)(`dt`,{children:`Source`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:t3(e.source.kind)}),e.source.label&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Reported source`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.source.label})]}),(0,V.jsx)(`dt`,{children:`Scope`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:`This thread · this request`}),e.expiresAt&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Expires`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.expiresAt})]})]})]})}function k3({instanceId:e,fields:t,draft:n,setValue:r,errors:i,autoFocus:a}){let o=t.findIndex(e=>!e.secret);return(0,V.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,V.jsx)(`legend`,{className:`sr-only`,children:`Requested information`}),(0,V.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:t.map((t,s)=>(0,V.jsx)(A3,{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 A3({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,V.jsxs)(V.Fragment,{children:[t.label,t.required&&(0,V.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-accent/40`,f;if(t.secret)f=(0,V.jsx)(`div`,{className:`mt-1 text-[11px] text-amber-100/70`,children:`Use the secure fallback below.`});else if(t.input===`multiline`)f=(0,V.jsx)(`textarea`,{id:o,name:t.id,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,V.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,V.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,V.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,V.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,V.jsx)(`span`,{children:u})]});else if(t.input===`select`)f=(0,V.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,V.jsx)(`option`,{value:``,children:`Choose an option…`}),t.options.map((e,t)=>(0,V.jsx)(`option`,{value:String(t),children:e.label},t))]});else if(t.input===`multi-select`){let e=Array.isArray(n)?n:[];f=(0,V.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,V.jsx)(`legend`,{className:`px-1 text-[11px] font-medium text-fg/85`,children:u}),(0,V.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.options.map((n,i)=>{let o=String(i);return(0,V.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-[12px] text-fg/85`,children:[(0,V.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,V.jsx)(`span`,{children:n.label})]},o)})})]})}return(0,V.jsxs)(`div`,{className:`min-w-0`,children:[t.secret?(0,V.jsx)(`div`,{className:`text-[11px] font-medium text-fg/85`,children:u}):t.input!==`boolean`&&t.input!==`multi-select`?(0,V.jsx)(`label`,{htmlFor:o,className:`block text-[11px] font-medium text-fg/85`,children:u}):null,t.description&&(0,V.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,V.jsx)(`div`,{id:c,role:`alert`,className:`mt-1 text-[10.5px] text-red-300`,children:i})]})}function j3(e){return(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).length}function M3(e,t={}){let n=(e.subAgents??[]).filter(e=>Cy(e)&&e.state===`running`).length,r=(e.bgShells??[]).filter(e=>e.state===`running`).length,i=t.watchers===!1?0:j3(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 N3(e){return(e.subAgents??[]).some(e=>Cy(e)&&e.state===`running`)}function P3(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length}function F3(e){return N3(e)||P3(e)>0}function I3(e){return L3(e)?`Background shells running`:`Awaiting`}function L3(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length>0&&!N3(e)&&j3(e)===0&&R3(e).length===0}function R3(e){return(e.watches??[]).filter(e=>e.kind===`timer`&&e.state===`armed`)}var z3={mergeable:`no conflicts`,blocked:`merge blocked`,conflicting:`has conflicts`,unknown:null};function B3(e){return e.state!==`open`||e.merge===`blocked`&&e.checks!==`passing`&&e.checks!==`none`?null:z3[e.merge]}var V3=`shrink-0 self-baseline translate-y-[calc(0.5em_-_0.5cap)]`;function H3({tone:e}){return(0,V.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-3 rounded-full border ${e} border-t-transparent motion-safe:animate-spin ${V3}`})}function U3({status:e}){return e?e.state===`merged`?(0,V.jsx)(XC,{size:12,className:`${V3} text-purple-400`}):e.state===`closed`?(0,V.jsx)(ZC,{size:12,className:`${V3} text-red-400`}):e.checks===`failing`?(0,V.jsx)(HC,{size:12,className:`${V3} text-red-400`}):e.checks===`passing`?(0,V.jsx)(LC,{size:12,className:`${V3} text-emerald-500`}):e.checks===`running`?(0,V.jsx)(H3,{tone:`border-amber-400`}):(0,V.jsx)(RC,{size:12,className:`${V3} text-muted/60`}):(0,V.jsx)(RC,{size:12,className:`${V3} text-muted/60`})}function W3(e){return[e.failed>0?`${e.failed} failing`:null,e.running>0?`${e.running} in progress`:null,e.passed>0?`${e.passed} successful`:null].filter(e=>e!==null).join(`, `)}function G3(e){if(!e)return`Checking…`;if(e.state===`merged`)return`Merged`;if(e.state===`closed`)return`Closed`;let t=W3(e),n=B3(e);return[t||`No checks`,n].filter(e=>e!==null).join(` · `)}var K3=`group relative col-span-4 grid grid-cols-subgrid items-baseline rounded-sm text-[12px] leading-5`,q3=`ml-1.5 min-w-0 truncate font-medium text-fg/90`,J3=`ml-3 min-w-0 truncate text-right text-muted/70`,Y3=`outline-none after:absolute after:inset-0 after:rounded-sm focus-visible:after:ring-1 focus-visible:after:ring-fg/60`;function X3(){return(0,V.jsx)(PC,{size:13,"aria-hidden":!0,className:`${V3} ml-[3px] -mr-[4px] text-muted/35 transition-colors group-hover:text-muted/70`})}function Z3({mark:e,name:t,status:n,onOpen:r,href:i,title:a,testKind:o,testId:s}){let c=i?(0,V.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer noopener`,title:a,onMouseDown:e=>e.stopPropagation(),className:`${q3} ${Y3} group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):r?(0,V.jsx)(`button`,{type:`button`,onClick:r,onMouseDown:e=>e.stopPropagation(),title:a,className:`${q3} ${Y3} text-left group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):(0,V.jsx)(`span`,{className:q3,title:a,children:t}),l=!!(i||r);return(0,V.jsxs)(`div`,{"data-wait-row":s,"data-wait-kind":o,className:`${K3} ${l?`cursor-pointer transition-colors hover:bg-fg/[0.045]`:``}`,children:[(0,V.jsx)(`span`,{className:`flex shrink-0`,children:e}),c,(0,V.jsx)(`span`,{"data-wait-status":!0,className:J3,children:n}),l?(0,V.jsx)(X3,{}):(0,V.jsx)(`span`,{})]})}function Q3({watch:e}){let t=e.github,n=nJ(e.target);return(0,V.jsx)(Z3,{testKind:`github`,testId:e.target,mark:(0,V.jsx)(U3,{status:t}),name:e.target,href:n??void 0,title:n?`Open ${e.target} on GitHub`:e.target,status:(0,V.jsxs)(V.Fragment,{children:[G3(t),t&&t.failing.length>0&&n&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsx)(`a`,{href:`${n}/checks`,target:`_blank`,rel:`noreferrer noopener`,onMouseDown:e=>e.stopPropagation(),className:`relative text-red-400/85 underline decoration-red-400/30 underline-offset-2 hover:decoration-red-400`,children:`view failures`})]})]})})}function $3(e,t){return(e.bgShells??[]).find(e=>e.id===t||e.taskId===t||e.label===t)}function e6(e){return(e.watches??[]).filter(e=>e.kind===`shell`&&e.state===`armed`)}function t6({watch:e,thread:t,slug:n,now:r}){let i=$3(t,e.target),a=JM(i?.startedAt??e.createdAt,r),o=i?.id&&!i.outputUnavailable;return(0,V.jsx)(Z3,{testKind:`shell`,testId:e.target,mark:(0,V.jsx)(Ew,{size:12,className:`${V3} text-shell`}),name:i?.label??e.target,onOpen:o?()=>HS(n,i.id,{label:i.label,startedAt:i.startedAt}):void 0,title:o?`Read this shell's output — running for ${a}`:i?.label??e.target,status:a?`running · ${a}`:`running`})}function n6({watch:e,now:t}){let n=Date.parse(e.timer?.fireAt??``),r=Number.isFinite(n)?n>t?`fires in ${KM(n-t)}`:`firing…`:`armed`;return(0,V.jsx)(Z3,{testKind:`timer`,testId:e.target,mark:(0,V.jsx)(UC,{size:12,className:`${V3} 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=>Cy(e)&&e.state===`running`)}function i6({agent:e,slug:t,now:n}){let r=JM(e.startedAt,n),i=e.subagentType?.replace(/^frizz:/,``);return(0,V.jsx)(Z3,{testKind:`agent`,testId:e.id??e.label,mark:(0,V.jsx)(H3,{tone:`border-accent`}),name:e.label,onOpen:e.id?()=>VS(t,e.id,{label:e.label,subagentType:e.subagentType,startedAt:e.startedAt}):void 0,title:e.id?`Open this sub-agent — working for ${r}`:e.label,status:[i,r].filter(Boolean).join(` · `)})}function a6(e){return e?.awaitingBackground===!0&&e.runtime===`turn-idle`&&e.bgSnoozed!==!0}function o6({thread:e,actions:t}){let n=N3(e),r=fJ(e.lastFence?.kind===`awaiting`?e.lastFence.body:void 0),i=t1(s$(r??``)),a=FM(),o=(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`),s=e6(e),c=r6(e),l=R3(e),u=[{head:`Sub-agents`,rows:c.map(t=>(0,V.jsx)(i6,{agent:t,slug:e.id,now:a},t.id??t.label))},{head:`Background shells`,rows:s.map(t=>(0,V.jsx)(t6,{watch:t,thread:e,slug:e.id,now:a},t.id))},{head:`Pull requests`,rows:o.map(e=>(0,V.jsx)(Q3,{watch:e},e.id))},{head:`Timers`,rows:l.map(e=>(0,V.jsx)(n6,{watch:e,now:a},e.id))}].filter(e=>e.rows.length>0);return(0,V.jsxs)(Z1,{"data-awaiting-background":!0,icon:L3(e)?Ew:tw,label:I3(e),className:t?`pb-0`:``,children:[r&&(0,V.jsx)(`div`,{className:`md-body [overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`,dangerouslySetInnerHTML:i}),u.length===0&&F3(e)&&(0,V.jsx)(`p`,{className:`block min-w-0 text-[13px] leading-5 text-fg/75`,children:n?(0,V.jsxs)(V.Fragment,{children:[`It’s awaiting the results from `,M3(e,{watchers:!1}),` it dispatched. It returns to the queue on its own when the work comes back.`]}):(0,V.jsxs)(V.Fragment,{children:[M3(e,{watchers:!1}),` `,P3(e)===1?`is`:`are`,` still running. It resumes on its own when`,` `,P3(e)===1?`it finishes`:`one of them finishes`,`.`]})}),r&&u.length>0&&(0,V.jsx)(`div`,{"aria-hidden":!0,className:`-mx-4 mt-3 border-t border-border`}),u.length>0&&(0,V.jsx)(`div`,{className:`mt-3 grid grid-cols-[auto_1fr_auto_auto] gap-y-px`,children:u.map((e,t)=>(0,V.jsxs)(B.Fragment,{children:[(0,V.jsx)(`div`,{className:`col-span-4 text-[10.5px] uppercase tracking-wide text-muted/45 ${t>0?`mt-2.5`:``}`,children:e.head}),e.rows]},e.head))}),t?(0,V.jsx)(`div`,{className:`-mx-4 mt-3 flex flex-wrap items-center gap-x-2.5 gap-y-2 border-t border-border bg-fg/[0.03] px-4 py-2.5 ${K1}`,children:t}):null]})}function s6(e,t=Date.now()){return e!==void 0&&lM(e,t)!==void 0}function c6(){let[e,t]=(0,B.useState)(()=>Date.now());return(0,B.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function l6({thread:e}){let t=c6(),[n,r]=(0,B.useState)(!1),i=lM(e,t);if(!i)return null;let a=Date.parse(i),o=kj(i,t).replace(/^(Today|Tomorrow)/,e=>e.toLowerCase()),s=e.snoozePrompt?.trim();async function c(){r(!0);try{await X.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:null,prompt:null}),Q(`Snooze cleared`)}catch(e){Q((e instanceof Error?e.message:`Wake failed`).slice(0,100))}finally{r(!1)}}return(0,V.jsxs)(Z1,{"data-snooze-card":!0,icon:tw,label:`Snoozed`,children:[(0,V.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:XM(a-t)}),(0,V.jsx)(`p`,{className:Q1,children:s?(0,V.jsxs)(V.Fragment,{children:[`Resumes `,o,` and sends: “`,jj(s),`”`]}):(0,V.jsxs)(V.Fragment,{children:[`Returns to the queue `,o,`.`]})}),e.foreign!==!0&&(0,V.jsx)($1,{children:(0,V.jsx)(`button`,{type:`button`,"data-snooze-wake-now":!0,disabled:n,onClick:()=>void c(),className:`${n0} disabled:cursor-not-allowed disabled:opacity-45`,children:`Wake now`})})]})}function u6({at:e,fallbackAt:t,className:n=``}){let r=FM(),i=SM(e,t),a=CM(i,r);return!a||!i?null:(0,V.jsx)(`time`,{dateTime:i,className:n,children:a})}var d6=1500;function f6(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},d6),a},fail(t){t===n&&(i(),e(!1))},dispose(){n++,i()}}}var p6=`Could not copy terminal command`,m6={attach:`Attach command copied`,resume:`Resume command copied`},h6={attach:`Copy command to attach to this thread's live terminal`,resume:`Copy command to resume this thread in a new terminal`},g6=e=>[`terminalCommand`,e];function _6(e){return X.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 v6(e){let t=_6(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 bU(n),r}function y6(e){let t=Jd({mutationFn:()=>v6(e)});return e=>t.mutate(void 0,{onSuccess:t=>{e?.onSuccess?.(),Q(m6[t])},onError:t=>{e?.onError?.(),Q(t instanceof Error?`${p6}: ${t.message}`:p6,{duration:7e3})}})}function b6({slug:e}){let[t,n]=(0,B.useState)(!1),r=(0,B.useRef)(null);r.current||=f6(n,{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)});let i=Md(),a=y6(e);(0,B.useEffect)(()=>()=>r.current?.dispose(),[]);function o(){i.prefetchQuery({queryKey:g6(e),queryFn:()=>_6(e),staleTime:15e3})}function s(){let t=i.getQueryData(g6(e));if(t){bU(t.command).then(()=>{r.current?.begin(),Q(m6[t.mode])},()=>Q(p6,{duration:7e3}));return}a({onSuccess:()=>r.current?.begin()})}let c=i.getQueryData(g6(e)),l=t?c?m6[c.mode]:`Terminal command copied`:c?h6[c.mode]:`Copy terminal command`;return(0,V.jsx)(Pq,{label:l,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":l,title:l,onClick:s,onPointerEnter:o,onFocus:o,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:t?(0,V.jsx)(jC,{size:14,strokeWidth:2.2,className:`text-fg`}):(0,V.jsx)(Ew,{size:14,strokeWidth:1.8})})})}function x6(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 S6(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 C6(e){return`legacy:${e.role}:${e.kind??`message`}:${e.at??``}:${e.text}`}function w6(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??C6(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 T6(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 E6(e,t){let n=e.map(e=>e.message);return e.filter((e,r)=>!T6(n,r,t))}var D6=new Set([`agent`,`follow up`,`interrupt`,`send message`,`spawn agent`,`wait for agents`]),O6=new Set([`poll process`,`wait`]);function k6(e){return(e.split(`__`).pop()||e).replaceAll(`_`,` `).trim()}function A6(e){return k6(e).toLowerCase()}function j6(e){return e.prompt!==void 0||e.agentId!==void 0||e.sendTo!==void 0||e.sendBody!==void 0||e.backgroundState!==void 0&&!N6(e)||M6(e)||D6.has(A6(e.name))}function M6(e){return e.outputImage!==void 0||e.sentImages!==void 0&&e.sentImages.length>0}function N6(e){return e.backgroundState===`unknown`&&O6.has(A6(e.name))}function P6(e){if(e.role!==`assistant`||e.kind||e.queued)return null;if(e.parts&&e.parts.length>0){let t=[];for(let n of e.parts)if(n.kind===`text`){if(n.text.trim())return null}else t.push(...n.tools);return t.length>0&&t.every(e=>!j6(e))?t:null}return e.text.trim()||e.tools.length===0?null:e.tools.every(e=>!j6(e))?e.tools:null}function F6(e){return e.role!==`assistant`||e.kind||e.queued||e.text.trim()||e.tools.length>0?!1:!e.parts?.some(e=>e.kind===`text`?e.text.trim().length>0:e.tools.length>0)}function I6(e){if(e.role!==`assistant`||e.kind||e.queued)return null;if(!e.parts?.length)return P6(e);for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.kind===`text`){if(n.text.trim())return null;continue}if(n.tools.length!==0)return n.tools.every(e=>!j6(e))?n.tools:null}return null}function L6(e,t,n){let r=[...e.tools,...t],i=e.parts?.map(e=>e.kind===`text`?e:{...e,tools:[...e.tools]})??[],a=-1;for(let e=i.length-1;e>=0;e--){let t=i[e];if(t.kind===`text`){if(t.text.trim())break;continue}if(t.tools.length>0){a=e;break}}let o=i[a];return o?.kind===`tools`?i[a]={kind:`tools`,tools:[...o.tools,...t]}:i.push({kind:`tools`,tools:t}),{...e,at:n??e.at,tools:r,parts:i}}function R6(e){let t=[],n=null;return e.forEach((e,r)=>{if(F6(e))return;if(e.queued){t.push({message:e,messageIndex:r});return}let i=P6(e);if(i&&n){n.message=L6(n.message,i,e.at);return}let a={message:e,messageIndex:r};t.push(a),I6(e)?(a.runStartedAt=e.at,n=a):n=null}),t}function z6(e){return e.status===`completed`||e.status===`failed`||e.status===`cancelled`}function B6(e){let t=V6(e);return t?.tools.some(e=>!z6(e))?t.tools.at(-1):void 0}function V6(e){let t=H6(e);if(!t)return;let n=I6(t.message);return n?{tools:n,at:t.message.at}:void 0}function H6(e){for(let t=e.length-1;t>=0;t--)if(!e[t].message.queued)return e[t]}function U6(e){let t=H6(e);if(t)return I6(t.message)?t.runStartedAt??t.message.at:t.message.at}function W6(e){let t=I6(e);if(!t)return e;let n=e.tools.length>=t.length?e.tools.slice(0,e.tools.length-t.length):e.tools.filter(e=>!t.includes(e)),r=!1,i=e.parts?e.parts.reduceRight((e,n)=>!r&&n.kind===`tools`&&n.tools===t?(r=!0,e):(e.unshift(n),e),[]):e.parts;return{...e,tools:n,parts:i}}function G6(e){let t;for(let n=e.length-1;n>=0;n--){let r=e[n].message;if(!r.queued){I6(r)&&(t=r);break}}if(!t)return[...e];let n=[];for(let r of e){let e=r.message===t?W6(r.message):r.message;F6(e)||n.push(e===r.message?r:{...r,message:e})}return n}function K6(e){return e.detail?.trim()||void 0}var q6={add:`Adding`,analyze:`Analyzing`,apply:`Applying`,audit:`Auditing`,benchmark:`Benchmarking`,build:`Building`,bump:`Bumping`,capture:`Capturing`,check:`Checking`,clean:`Cleaning`,collect:`Collecting`,commit:`Committing`,compare:`Comparing`,confirm:`Confirming`,copy:`Copying`,count:`Counting`,create:`Creating`,debug:`Debugging`,delete:`Deleting`,diff:`Diffing`,disable:`Disabling`,dispatch:`Dispatching`,drive:`Driving`,dump:`Dumping`,edit:`Editing`,enable:`Enabling`,extract:`Extracting`,fetch:`Fetching`,find:`Finding`,fix:`Fixing`,format:`Formatting`,generate:`Generating`,grep:`Grepping`,inspect:`Inspecting`,install:`Installing`,kill:`Killing`,launch:`Launching`,lint:`Linting`,list:`Listing`,load:`Loading`,measure:`Measuring`,merge:`Merging`,migrate:`Migrating`,move:`Moving`,open:`Opening`,parse:`Parsing`,patch:`Patching`,poll:`Polling`,print:`Printing`,probe:`Probing`,profile:`Profiling`,publish:`Publishing`,pull:`Pulling`,push:`Pushing`,query:`Querying`,read:`Reading`,rebase:`Rebasing`,refactor:`Refactoring`,regenerate:`Regenerating`,remove:`Removing`,rename:`Renaming`,render:`Rendering`,reproduce:`Reproducing`,restart:`Restarting`,revert:`Reverting`,review:`Reviewing`,run:`Running`,save:`Saving`,scan:`Scanning`,search:`Searching`,seed:`Seeding`,spawn:`Spawning`,start:`Starting`,stop:`Stopping`,summarize:`Summarizing`,sync:`Syncing`,tag:`Tagging`,test:`Testing`,trace:`Tracing`,typecheck:`Typechecking`,update:`Updating`,validate:`Validating`,verify:`Verifying`,wait:`Waiting`,watch:`Watching`,write:`Writing`};function J6(e,t){let n=e?.trim();if(!n)return t;let r=n.indexOf(` `),i=(r===-1?n:n.slice(0,r)).replace(/[.:]$/,``);if(/ing$/i.test(i))return i.charAt(0).toUpperCase()+i.slice(1)+(r===-1?``:n.slice(r));let a=q6[i.toLowerCase()];return a?a+(r===-1?``:n.slice(r)):n.charAt(0).toUpperCase()+n.slice(1)}function Y6(e,t){let n=t?.trim().replace(/\/+$/,``);if(!n||n===`/`||!n.startsWith(`/`))return e;let r=e.replaceAll(`${n}/`,``),i=/^(\/(?:Users|home)\/[^/]+)(?:\/|$)/.exec(n)?.[1];return i?r.replaceAll(`${i}/`,`~/`):r}function X6(e,t){return Y6(Z6(e),t)}function Z6(e){let t=A6(e.name),n=K6(e),r=n?` ${n}`:``;return t===`bash`||t===`exec`||t===`run command`?J6(e.desc,n?`Running ${n}`:`Running a command`):t===`read`||t===`view image`?`Reading${r||` a file`}`:t===`grep`||t===`search`||t===`search query`||t===`find`?n?`Searching for ${n}`:`Searching`:t===`glob`||t===`find files`?n?`Finding ${n}`:`Finding files`:t===`edit`||t===`write`||t===`apply patch`?n?`Editing ${n}`:`Editing files`:t===`todos`||t===`update plan`?`Updating the plan`:t===`screenshot`||t===`snapshot`?n?`Capturing ${n}`:`Capturing the page`:t===`navigate`?n?`Navigating to ${n}`:`Navigating`:t===`evaluate`?`Evaluating the page`:t===`pages`?`Listing pages`:t===`new page`?`Opening a new page`:t===`close page`?`Closing the page`:t===`select page`?`Selecting a page`:t===`console`||t===`console message`?`Reading the console`:t===`network`||t===`network request`?`Inspecting network traffic`:t===`press key`?n?`Pressing ${n}`:`Pressing a key`:t===`fill form`?`Filling the form`:t===`dialog`?`Handling a dialog`:t===`upload`?n?`Uploading ${n}`:`Uploading a file`:t===`wait for`||t===`wait`?n?`Waiting for ${n}`:`Waiting`:t===`resize`?`Resizing the page`:t===`ask`?`Preparing a question`:t===`web`||t===`web search`?n?`Searching for ${n}`:`Searching the web`:`Using ${k6(e.name)||`a tool`}`}var Q6=new Set([`edit`,`multiedit`,`write`,`apply patch`]);function $6(e){let t=new Set;for(let n of e){for(let e of n.edits??(n.edit?[n.edit]:[]))e.file.trim()&&t.add(e.file.trim());if(n.edit||n.edits?.length)continue;let e=n.detail?.trim();e&&Q6.has(A6(n.name))&&t.add(e)}return t.size}function e8(e,t=0){let n=`Ran ${e} tool ${e===1?`call`:`calls`}`;return t===0?n:`${n}, edited ${t} file${t===1?``:`s`}`}function t8(e){return e>0?`${e8(e)}. Thinking…`:`Thinking…`}function n8(e,t){let n=e[t];return typeof n==`string`&&n?n:void 0}function r8(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function i8(e,t){let n=n8(e,t);if(n)try{let e=new URL(n);return e.protocol===`https:`||e.protocol===`http:`?e.href:void 0}catch{return}}function a8({directive:e,icon:t,title:n,meta:r,children:i}){return(0,V.jsxs)(`section`,{"data-codex-directive":e.name,className:`min-w-0 ${W1} border border-border bg-panel-2/75 p-4`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-muted`,"aria-hidden":!0,children:t}),(0,V.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,V.jsx)(`div`,{className:`min-w-0 truncate text-[11px] font-normal leading-4 text-muted`,children:r})]}),i]})}function o8({children:e,mono:t=!1}){return(0,V.jsx)(`div`,{className:`ml-6 mt-1 break-words text-[11px] leading-4 text-muted${t?` font-mono-keep`:``}`,children:e})}function s8({directive:e}){let t=e.attrs,n=n8(t,`display_name`)??n8(t,`skill_name`)??`Artifact template`,r=n8(t,`artifact_kind`),i=n8(t,`skill_name`),a=n8(t,`skill_directory`),[o,s]=(0,B.useState)(!!a);return(0,V.jsxs)(a8,{directive:e,icon:(0,V.jsx)(ow,{size:15}),title:n,meta:r?`${r} template`:`Template`,children:[i&&(0,V.jsx)(o8,{mono:!0,children:i.startsWith(`$`)?i:`$${i}`}),o&&a&&(0,V.jsx)(`img`,{src:RH(`${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 c8({directive:e}){let t=e.attrs,n=n8(t,`file`),r=r8(t,`start`),i=r8(t,`end`)??r,a=r8(t,`priority`),o=n?`${n}${r?`:${r}${i&&i!==r?`-${i}`:``}`:``}`:`Code location unavailable`;return(0,V.jsxs)(a8,{directive:e,icon:(0,V.jsx)(lw,{size:15}),title:n8(t,`title`)??`Review finding`,meta:a===void 0?void 0:`P${a}`,children:[n8(t,`body`)&&(0,V.jsx)(o8,{children:n8(t,`body`)}),n?(0,V.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,V.jsx)(o8,{mono:!0,children:o})]})}var l8={"git-stage":[fw,`Changes staged`],"git-commit":[YC,`Commit created`],"git-create-branch":[JC,`Branch created`],"git-push":[Aw,`Branch pushed`],"git-create-pr":[$C,`Pull request created`]};function u8({directive:e}){let[t,n]=l8[e.name],r=n8(e.attrs,`branch`),i=i8(e.attrs,`url`),a=`${n}${e.attrs.isDraft===!0?` as draft`:``}`;return(0,V.jsx)(a8,{directive:e,icon:(0,V.jsx)(t,{size:15}),title:i?(0,V.jsx)(`a`,{className:`text-accent underline underline-offset-2`,href:i,target:`_blank`,rel:`noopener noreferrer`,children:a}):a,meta:r&&(0,V.jsx)(`span`,{className:`font-mono-keep`,children:r})})}function d8({directive:e}){let t=n8(e.attrs,`threadId`),n=n8(e.attrs,`pendingWorktreeId`);return(0,V.jsx)(a8,{directive:e,icon:(0,V.jsx)(dw,{size:15}),title:n?`Thread setup queued`:`Thread created`,meta:(t||n)&&(0,V.jsx)(`span`,{className:`font-mono-keep`,children:t??n})})}function f8({directive:e}){let t=n8(e.attrs,`reason`);return(0,V.jsx)(a8,{directive:e,icon:(0,V.jsx)(CC,{size:15}),title:`Archive suggested`,meta:t})}function p8(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 m8({directive:e}){let t=e.attrs,n=n8(t,`mode`),r=n8(t,`name`)??`Automation`,i=p8(t.rrule),a=[r,n,n8(t,`status`),i].filter(Boolean).join(` · `);return(0,V.jsx)(a8,{directive:e,icon:(0,V.jsx)(AC,{size:15}),title:`Automation suggested`,meta:a,children:n8(t,`prompt`)&&(0,V.jsx)(o8,{children:n8(t,`prompt`)})})}function h8({directive:e}){return e.name===`artifact-template`?(0,V.jsx)(s8,{directive:e}):e.name===`code-comment`?(0,V.jsx)(c8,{directive:e}):e.name.startsWith(`git-`)?(0,V.jsx)(u8,{directive:e}):e.name===`created-thread`?(0,V.jsx)(d8,{directive:e}):e.name===`archive`||e.name===`archive-thread`?(0,V.jsx)(f8,{directive:e}):(0,V.jsx)(m8,{directive:e})}var g8;function _8(){return g8??=HO(async()=>{let{default:e}=await import(`./mermaid.core-xNdwXb1r.js`);return{default:e}},__vite__mapDeps([2,3,4,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`dark`,themeVariables:{background:`#181b20`,primaryColor:`#181b20`,primaryTextColor:`#e6e7e9`,primaryBorderColor:`#33363c`,lineColor:`#8b8f96`,secondaryColor:`#26282d`,tertiaryColor:`#0d0e10`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`}}),e)),g8}function v8({source:e}){let t=(0,B.useId)(),[n,r]=(0,B.useState)({}),i=t1(n.html??``);return(0,B.useEffect)(()=>{let n=!0;if(r({}),e.length>5e4)return r({error:`Diagram source exceeds the 50 KB rendering limit`}),()=>{n=!1};let i=`frizz-mermaid-${t.replace(/[^a-zA-Z0-9]/g,``)}`;return _8().then(t=>t.render(i,e)).then(({svg:e})=>{n&&r({html:e})}).catch(e=>{if(!n)return;let t=e instanceof Error?e.message.split(/\n| for text:/,1)[0]:`Unknown diagram error`;r({error:t.slice(0,240)})}).finally(()=>document.getElementById(`d${i}`)?.remove()),()=>{n=!1}},[t,e]),n.error?(0,V.jsxs)(`section`,{"data-mermaid-state":`error`,className:`${W1} border border-border bg-panel-2/75 p-4`,children:[(0,V.jsx)(`div`,{className:`text-[12px] font-medium text-fg`,children:`Diagram unavailable`}),(0,V.jsx)(`div`,{className:`mt-1 text-[11px] text-muted`,children:n.error}),(0,V.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})]}):n.html?(0,V.jsx)(`div`,{"data-mermaid-state":`ready`,className:`overflow-x-auto ${W1} border border-border bg-panel-2/75 p-4 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:i}):(0,V.jsx)(`div`,{"data-mermaid-state":`loading`,role:`status`,"aria-label":`Rendering diagram`,className:`h-24 animate-pulse ${W1} bg-panel-2`})}var y8=(0,B.createContext)(null),b8=(0,B.createContext)(null);function x8(){let e=(0,B.useContext)(y8),t=(0,B.useContext)(b8);return e??t}var S8=(0,B.createContext)(null);function C8(e){return e.status===`pending`&&e.backgroundState===`background`}function w8(e){let t=[];for(let n of e)for(let e of n.tools)C8(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 T8(e){return e.map(e=>{if(!e.tools.some(C8))return e;let t=e.tools.filter(e=>!C8(e)),n=e.parts?.map(e=>e.kind===`tools`?{...e,tools:e.tools.filter(e=>!C8(e))}:e).filter(e=>e.kind!==`tools`||e.tools.length>0);return{...e,tools:t,parts:n}})}function E8({slug:e,onStatusApplied:t,onClose:n,virtualized:r=!1,showReturnToQueue:i=!1}){let a=iC($A(),e);return(0,V.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,V.jsx)(N8,{slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:i}),(0,V.jsx)(D8,{slug:e,virtualized:r}),a&&(0,V.jsx)(x4,{thread:a,sticky:!0,safeArea:!0,onArchived:t})]})}function D8({slug:e,virtualized:t}){let n=$A(),r=iC(n,e),i=r?.runtime===`running`||r?.runtime===`spawning`,a=y6(e),o=r?.pendingInteraction?void 0:r?.pendingAsk,s=lj(e,{poll:i}),c=Md(),l=(0,B.useRef)(!1),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(null),m=(0,B.useMemo)(()=>s.data?.messages??[],[s.data]),h=(0,B.useMemo)(()=>w8(m),[m]),g=(0,B.useMemo)(()=>T8(m),[m]),_=(0,B.useMemo)(()=>q8(g),[g]),v=(0,B.useMemo)(()=>R6(g),[g]),y=i?V6(v):void 0,b=i?B6(v):void 0,x=b?X6(b,n?.projectDir):void 0,S=i?U6(v):void 0,C=(0,B.useMemo)(()=>{let e=i?G6(v):v;return E6(e,J8(e,_))},[v,i,_]),w=i,T=(0,B.useMemo)(()=>H1(m),[m]),E=(0,B.useMemo)(()=>c2(m),[m]),{stickyUserMessage:D}=Hf(zj),{answeringForMessage:O}=M0(e,m),k=(0,B.useRef)(null),[A,j]=(0,B.useState)(null),M=s.data?.messages.length??0;(0,B.useEffect)(()=>{if(t)return;let e=k.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<=4&&(e.scrollTop=e.scrollHeight)},[M,i,t]);let N=(0,B.useCallback)(async()=>{if(l.current)return;let t=c.getQueryData([`transcript`,e]),n=t?.beforeCursor,r=t?.transcriptKey;if(!(!t?.hasEarlier||!n||!r)){l.current=!0,d(!0),p(null);try{let t=await X.threadTranscriptEarlier({slug:e,cursor:n}),i=c.getQueryData([`transcript`,e]);if(!i?.transcriptKey||i.transcriptKey!==r||t.transcriptKey!==r){await s.refetch(),Q(`Transcript changed while loading history; refreshed the current session`);return}c.setQueryData([`transcript`,e],hA(i,t))}catch(e){let t=e instanceof Error?e.message:`Could not load earlier transcript history`;p(t)}finally{l.current=!1,d(!1)}}},[s,c,e]);return(0,V.jsx)(y8.Provider,{value:e,children:(0,V.jsxs)(`div`,{"data-drawer-scroll-ready":s.isPending?`false`:`true`,className:`flex-1 min-h-0 flex flex-col overflow-hidden outline-none`,children:[(0,V.jsxs)(`div`,{className:`relative min-h-0 flex-1 flex flex-col`,children:[(0,V.jsx)(`div`,{ref:k,"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&&u?!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-fg/60`,children:t&&M>0?(0,V.jsx)(j8,{slug:e,transcriptRef:k,transcriptKey:s.data?.transcriptKey,messages:g,paired:T,answeringForMessage:O,thread:r,running:i,copyTerminalCommand:a,stickyUserMessage:D,transportFallback:s.transportFallback,isFetching:s.isFetching,refresh:()=>void s.refetch(),retryLiveUpdates:s.retryLiveUpdates,hasEarlier:s.data?.hasEarlier===!0,beforeCursor:s.data?.beforeCursor,loadingEarlier:u,earlierError:f,loadEarlier:()=>void N(),jumpOverlay:A}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(y3,{thread:r,className:`px-6 pt-5`,autoFocusFirst:!0}),s.transportFallback&&(0,V.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:s.transportFallback.kind===`payload-too-large`?`Live payload ${s.transportFallback.actualBytes} bytes; socket limit ${s.transportFallback.maxBytes} bytes`:`Transcript read budget reached (${s.transportFallback.scope}); retry after about ${s.transportFallback.retryAfterMs}ms`,children:[(0,V.jsx)(kw,{size:13,className:`shrink-0 text-muted`}),(0,V.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,s.transportFallback.kind===`payload-too-large`?`The transcript is too large for push; the last complete HTTP-loaded copy remains visible.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,V.jsx)(`button`,{type:`button`,disabled:s.isFetching,onClick:()=>void s.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:s.isFetching?`Refreshing…`:`Refresh once`}),(0,V.jsx)(`button`,{type:`button`,onClick:s.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,V.jsx)(`div`,{"data-transcript-column":!0,className:`flex min-h-full flex-col px-6 py-5`,children:M===0?(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted`,children:s.isPending?(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(t7,{}),` Loading…`]}):i?(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(t7,{}),` Session starting…`]}):d2(r)?(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`p`,{className:`mb-3`,children:`No session is attached to this thread yet.`}),(0,V.jsx)(`button`,{className:`btn-ghost border border-border text-[12px]`,onClick:()=>X.adoptThread({slug:e}).catch(()=>{}),children:`Start a session on this thread`})]}):`No conversation yet.`}):(0,V.jsxs)(V.Fragment,{children:[Q8(C.map(e=>e.message),(e,t)=>{let n=C[t].messageIndex,r=n===E&&D,i=(0,V.jsx)(M5,{m:e,answering:O(e),showSendButton:!0,paired:T[n],sticky:r,staleAwaiting:_>=0&&n<_},t);return r?(0,V.jsx)(A5,{children:i},t):i},e=>!!e.queued),(r?.providerFault||r?.limitPause||o||r?.runtime===`perm-prompt`||w||s6(r)||r?.awaitingBackground)&&(0,V.jsx)(r0,{h:w&&!r?.providerFault&&!r?.limitPause&&!o&&r?.runtime!==`perm-prompt`?Z8(C.map(e=>e.message)):14}),r?.providerFault&&!r.foreign?(0,V.jsx)(U5,{slug:e,sessionId:r.sessionId,fault:r.providerFault,retryText:E>=0?m[E]?.text:void 0}):r?.limitPause&&!r.foreign?(0,V.jsx)(G5,{slug:e,sessionId:r.sessionId,pause:r.limitPause}):o?(0,V.jsx)(Y5,{ask:o,onTerminal:a}):r?.runtime===`perm-prompt`?(0,V.jsx)(K5,{onTerminal:a}):w?(0,V.jsx)(n7,{since:r?.lastUserAt,startedAt:S,activityLabel:x,run:y}):s6(r)?(0,V.jsx)(l6,{thread:r}):a6(r)?(0,V.jsx)(o6,{thread:r}):null,r?.permPolicy?(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(q5,{policy:r.permPolicy,denies:r.permDenies})}):null,m.some(e=>e.queued)&&(0,V.jsx)(r0,{}),(0,V.jsx)(`div`,{className:`flex flex-col gap-3.5`,children:m.map((e,t)=>e.queued?(0,V.jsx)(M5,{m:e,paired:T[t]},`q${t}`):null)})]})})]})}),(0,V.jsx)(`div`,{ref:j,"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,V.jsx)(`div`,{"data-thread-chat-footer":!0,className:`z-10 shrink-0 border-t border-border/60 bg-panel`,children:(0,V.jsx)(I2,{slug:e,onTerminal:a,ops:(0,V.jsx)(J5,{slug:e,transcriptShells:h,className:`px-1 pt-1.5`})})})]})})}var O8=700,k8=250,A8=(()=>{try{return localStorage.getItem(`frizz.debugScroll`)===`1`}catch{return!1}})();function j8({slug:e,transcriptRef:t,transcriptKey:n,messages:r,paired:i,answeringForMessage:a,thread:o,running:s,copyTerminalCommand:c,stickyUserMessage:l,transportFallback:u,isFetching:d,refresh:f,retryLiveUpdates:p,hasEarlier:m,beforeCursor:h,loadingEarlier:g,earlierError:_,loadEarlier:v,jumpOverlay:y}){let b=ej(),x=(0,B.useMemo)(()=>R6(r),[r]),S=s?V6(x):void 0,C=s?B6(x):void 0,w=C?X6(C,b):void 0,T=s?U6(x):void 0,E=(0,B.useMemo)(()=>q8(r),[r]),D=(0,B.useMemo)(()=>{let e=s?G6(x):x;return E6(e,J8(e,E))},[x,s,E]),O=s,k=(0,B.useMemo)(()=>w6(D.map(e=>e.message),J8(D,E),G8).map(e=>({...e,messageIndex:D[e.messageIndex].messageIndex})),[D,E]),A=(0,B.useMemo)(()=>c2(r),[r]),j=!!(o?.providerFault&&!o.foreign||o?.limitPause&&!o.foreign||!o?.pendingInteraction&&o?.pendingAsk||o?.runtime===`perm-prompt`||O||s6(o)||o?.awaitingBackground),M=(0,B.useMemo)(()=>O&&!(o?.providerFault&&!o.foreign)&&!(o?.limitPause&&!o.foreign)&&!(!o?.pendingInteraction&&o?.pendingAsk)&&o?.runtime!==`perm-prompt`?Z8(D.map(e=>e.message)):14,[D,O,o]),N=(0,B.useMemo)(()=>{let e=[{key:`head-anchor`,kind:`head-anchor`}];u&&e.push({key:`transport-fallback`,kind:`transport-fallback`}),(m||g||_)&&e.push({key:`earlier-history:${h??`complete`}`,kind:`earlier-history`}),e.push(...k.map(e=>({...e,kind:`message`}))),e.push({key:`interactions`,kind:`interactions`}),j&&e.push({key:`runtime-status`,kind:`runtime-status`});let t=j||k.length>0?14:0;return r.forEach((n,r)=>{if(!n.queued)return;let i=`queued:${n.deliveryId??n.sourceId??r}`;e.push({key:i,kind:`queued`,message:n,messageIndex:r,gap:t}),t=14}),e},[h,_,m,j,g,k,r,u]),P=(0,B.useMemo)(()=>!l||A<0?-1:N.findIndex(e=>e.kind===`message`&&e.messageIndex===A),[A,N,l]),ee=tX({count:N.length,getScrollElement:()=>t.current,getItemKey:e=>N[e]?.key??e,estimateSize:e=>{let t=N[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===`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})}}),[F,te]=(0,B.useState)(!0),ne=(0,B.useRef)(!0),re=(0,B.useRef)(-1),ie=(0,B.useRef)(0),ae=(0,B.useRef)(null),oe=(0,B.useRef)(!1),se=(0,B.useRef)(!1),ce=(0,B.useRef)(!0),le=(0,B.useRef)(null),ue=(0,B.useRef)(void 0),de=(0,B.useRef)(null),fe=(0,B.useRef)(void 0),pe=(0,B.useRef)(void 0),me=(0,B.useRef)(0),he=(0,B.useCallback)(()=>{let e=t.current;if(e){let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-transcript-source-id]:not([data-transcript-sticky])`)).find(e=>e.getBoundingClientRect().bottom>t+1),r=n?.dataset.transcriptRowKey;n&&r&&(le.current={rowKey:r,viewportTop:n.getBoundingClientRect().top-t})}v()},[v,t]);(0,B.useLayoutEffect)(()=>{if(!n||N.length===0||ue.current===n)return;ue.current=n,oe.current=!1,se.current=!1,ce.current=!0;let e=requestAnimationFrame(()=>{ee.scrollToEnd({behavior:`instant`}),oe.current=!0,te(!0)});return()=>cancelAnimationFrame(e)},[N.length,n,ee]),(0,B.useLayoutEffect)(()=>{let e=le.current,n=t.current;if(!e||!n||g)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(),le.current===e&&(le.current=null)})});return()=>{cancelAnimationFrame(a),cancelAnimationFrame(i)}},[g,k.length,t]);let ge=(0,B.useCallback)(()=>{let e=t.current;if(!e)return null;let n=e.getBoundingClientRect().top,r=Array.from(e.querySelectorAll(`[data-transcript-row-key]:not([data-transcript-sticky])`)).find(e=>e.getBoundingClientRect().bottom>n+1),i=r?.dataset.transcriptRowKey;return!r||!i?null:{rowKey:i,viewportTop:r.getBoundingClientRect().top-n}},[t]),_e=(0,B.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&&t.dataset.transcriptSticky!==`true`);if(!r)return;let i=r.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=i-e.viewportTop},[t]),ve=P>=0?N[P]?.key:void 0;(0,B.useLayoutEffect)(()=>{let e=ve,t=fe.current;if(fe.current=e,t===void 0||t===e||ne.current)return;let n=de.current;if(!n||le.current)return;me.current=performance.now()+k8,_e(n);let r=0,i=0,a=requestAnimationFrame(()=>{_e(n),r=requestAnimationFrame(()=>{_e(n),i=requestAnimationFrame(()=>{_e(n),me.current=0})})});return()=>{cancelAnimationFrame(a),cancelAnimationFrame(r),cancelAnimationFrame(i),me.current=0}},[_e,ve]);let ye=k[0]?.key;(0,B.useLayoutEffect)(()=>{let e=pe.current;if(pe.current=ye,e===void 0||e===ye||!oe.current||ne.current||le.current)return;let t=de.current;if(!t)return;_e(t);let n=()=>{if(performance.now()<ie.current)return;let e=de.current;e&&_e(e)},r=0,i=requestAnimationFrame(()=>{n(),r=requestAnimationFrame(n)});return()=>{cancelAnimationFrame(i),cancelAnimationFrame(r)}},[_e,ye]);let be=(0,B.useCallback)(()=>{let e=t.current;if(!e||le.current||performance.now()<me.current)return;let n=x6({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,previousScrollHeight:re.current,following:ne.current,readerMoved:performance.now()<ie.current});if(ne.current=n.following,n.scrollTop!==null&&(e.scrollTop=n.scrollTop),re.current=e.scrollHeight,te(e=>e===n.following?e:n.following),A8&&!n.following&&performance.now()>=ie.current){let t=de.current,n=t&&Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.dataset.transcriptRowKey===t.rowKey&&e.dataset.transcriptSticky!==`true`);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 — pin=${fe.current??`none`} row=${t.rowKey}`)}}de.current=ge()??de.current},[ge,t]);(0,B.useLayoutEffect)(be),(0,B.useEffect)(()=>{let e=ae.current;if(!e)return;let t=new ResizeObserver(be);return t.observe(e),()=>t.disconnect()},[be]),(0,B.useEffect)(()=>{let e=t.current;if(!e)return;let n=()=>{be();let t=S6({armed:ce.current,scrollTop:e.scrollTop,readerMoved:oe.current&&se.current,hasEarlier:m,loading:g});ce.current=t.armed,t.shouldLoad&&he()},r=()=>{se.current=!0,ie.current=performance.now()+O8,requestAnimationFrame(n)},i=t=>{[`ArrowUp`,`PageUp`,`Home`,` `].includes(t.key)&&(e.scrollTop<=480&&(ce.current=!0),r())},a=t=>{t.deltaY<0&&e.scrollTop<=480&&(ce.current=!0),r()},o=()=>{e.scrollTop<=480&&(ce.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)}},[m,g,he,be,t]);let xe=ee.getVirtualItems(),Se=ee.getTotalSize(),Ce=P>=0?N[P]:void 0,we=Ce?.kind===`message`?Ce:void 0,Te=we?ee.measurementsCache[P]?.start??0:0;return(0,V.jsxs)(`div`,{ref:ae,"data-virtualized-transcript":!0,"data-virtual-row-count":xe.length,className:`relative w-full`,style:{height:Se},children:[we&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{"aria-hidden":!0,style:{height:Te}}),(0,V.jsx)(`div`,{ref:ee.measureElement,"data-index":P,"data-transcript-row-key":we.key,"data-transcript-source-id":we.message.sourceId,"data-transcript-sticky":`true`,className:`pointer-events-none [&>*]:pointer-events-auto sticky top-0 z-[9] flex w-full flex-col px-6 pt-3 pb-1.5`,children:(0,V.jsx)(M5,{m:we.message,answering:a(we.message),showSendButton:!0,paired:i[we.messageIndex],sticky:!0})},we.key)]}),xe.map(t=>{let n=N[t.index];return!n||t.index===P?null:(0,V.jsx)(`div`,{ref:ee.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`,style:{transform:`translateY(${t.start}px)`},children:n.kind===`head-anchor`?null:n.kind===`interactions`?(0,V.jsx)(y3,{thread:o,className:`px-6 pt-5`,autoFocusFirst:!0}):n.kind===`transport-fallback`?u?(0,V.jsx)(`div`,{className:`px-6 pt-3`,children:(0,V.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`flex flex-wrap items-center gap-2.5 ${W1} border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:u.kind===`payload-too-large`?`Live payload ${u.actualBytes} bytes; socket limit ${u.maxBytes} bytes`:`Transcript read budget reached (${u.scope}); retry after about ${u.retryAfterMs}ms`,children:[(0,V.jsx)(kw,{size:13,className:`shrink-0 text-muted`}),(0,V.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,u.kind===`payload-too-large`?`The transcript is too large for push; the last complete HTTP-loaded copy remains visible.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,V.jsx)(`button`,{type:`button`,disabled:d,onClick:f,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:d?`Refreshing…`:`Refresh once`}),(0,V.jsx)(`button`,{type:`button`,onClick:p,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,V.jsx)(`div`,{className:`flex min-h-10 items-center justify-center px-6 text-[11px] text-muted`,role:`status`,children:_?(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-2 text-center`,children:[(0,V.jsx)(`span`,{children:_}),(0,V.jsx)(`button`,{type:`button`,onClick:he,className:`rounded-md border border-border px-2 py-1 text-fg/90 hover:bg-panel-2`,children:`Retry`})]}):g?(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(cw,{size:12,className:`animate-spin`}),` Loading earlier messages…`]}):(0,V.jsx)(`button`,{type:`button`,onClick:he,className:`rounded-md px-2 py-1 outline-none hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:`Load earlier messages`})}):n.kind===`message`?(0,V.jsx)(`div`,{className:`flex flex-col px-6`,style:{paddingTop:n.gap},children:(0,V.jsx)(M5,{m:n.message,answering:a(n.message),showSendButton:!0,paired:i[n.messageIndex],staleAwaiting:E>=0&&n.messageIndex<E})}):n.kind===`runtime-status`?(0,V.jsxs)(`div`,{className:`px-6`,style:{paddingTop:M},children:[o?.providerFault&&!o.foreign?(0,V.jsx)(U5,{slug:e,sessionId:o.sessionId,fault:o.providerFault,retryText:A>=0?r[A]?.text:void 0}):o?.limitPause&&!o.foreign?(0,V.jsx)(G5,{slug:e,sessionId:o.sessionId,pause:o.limitPause}):!o?.pendingInteraction&&o?.pendingAsk?(0,V.jsx)(Y5,{ask:o.pendingAsk,onTerminal:c}):o?.runtime===`perm-prompt`?(0,V.jsx)(K5,{onTerminal:c}):O?(0,V.jsx)(n7,{since:o?.lastUserAt,startedAt:T,activityLabel:w,run:S}):s6(o)?(0,V.jsx)(l6,{thread:o}):a6(o)?(0,V.jsx)(o6,{thread:o}):null,o?.permPolicy?(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(q5,{policy:o.permPolicy,denies:o.permDenies})}):null]}):(0,V.jsx)(`div`,{className:`flex flex-col px-6`,style:{paddingTop:n.gap},children:(0,V.jsx)(M5,{m:n.message,paired:i[n.messageIndex]})})},n.key)}),(0,V.jsx)(M8,{overlay:y,hidden:F,onJump:()=>ee.scrollToEnd({behavior:`smooth`})})]})}function M8({overlay:e,hidden:t,onJump:n}){return!e||t?null:(0,Xd.createPortal)((0,V.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-black/30 hover:bg-panel-2`,children:[(0,V.jsx)(wC,{size:12}),`Jump to latest`]}),e)}function N8({slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:r=!1}){let i=iC($A(),e),a=Jd({mutationFn:()=>X.markComplete({slug:e})}),o=Jd({mutationFn:t=>X.renameThread({slug:e,title:t})}),s=Jd({mutationFn:()=>X.aiRenameThread({slug:e}),onSuccess:({title:e})=>Q(`Renamed to “${e}”`),onError:e=>Q(e instanceof Error?e.message:`Could not rename with Claude`,{duration:7e3})}),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!c)return;let e=requestAnimationFrame(()=>{f.current?.focus(),f.current?.select()});return()=>cancelAnimationFrame(e)},[c]),(0,B.useEffect)(()=>{l(!1),d(``)},[e]);let p=JQ(qd({queryKey:[`threadBody`,e],queryFn:()=>X.threadBody({slug:e})}).data?.markdown??``).trim().length>0;if(!i)return null;let m=i.kind===`session`&&i.foreign!==!0,h=i.foreign===!0,g=i.kind===`session`&&!h,_=Uj(i),v=m2(i),y=!v.enabled||s.isPending,b=s.isPending?`Claude is generating a title…`:v.enabled&&s.error instanceof Error?s.error.message:v.label;function x(){l(!1),d(``)}function S(){let e=f2(u,_);if(l(!1),!e){d(``);return}o.mutate(e,{onSuccess:()=>{d(``),Q(`Thread renamed`)},onError:t=>{d(e),l(!0),Q(t instanceof Error?t.message:`Could not rename thread`)}})}return(0,V.jsxs)(`header`,{"data-thread-header":!0,className:h2,children:[(0,V.jsx)(`div`,{className:g2,children:(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[r&&(0,V.jsx)(Pq,{label:`Return to queue`,children:(0,V.jsx)(`a`,{href:_j(`/`),"aria-label":`Return to queue`,"data-standalone-return":!0,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:(0,V.jsx)(TC,{size:14})})}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 leading-tight`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[c?(0,V.jsx)(`input`,{ref:f,"aria-label":`Thread title`,value:u,maxLength:200,onChange:e=>d(e.target.value),onBlur:S,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),S()):e.key===`Escape`&&(e.preventDefault(),x())},className:`min-w-0 flex-1 rounded-md border border-border bg-elevated px-1.5 py-1 font-semibold text-[15px] text-fg outline-none focus:border-accent`}):g?(0,V.jsx)(`button`,{type:`button`,title:`Edit title`,"aria-label":`Edit thread title: ${_}`,disabled:o.isPending||s.isPending,onClick:()=>{d(p2(_,i.id)),l(!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-fg/60 disabled:cursor-not-allowed disabled:opacity-40`,children:_}):(0,V.jsx)(`div`,{className:`min-w-0 max-w-full shrink truncate px-0.5 -mx-0.5 font-semibold text-[15px]`,title:_,children:_}),v.show&&!c&&(0,V.jsx)(Pq,{label:b,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":s.isPending?`Renaming with Claude`:v.enabled?`Rename with Claude`:v.label,title:b,"aria-busy":s.isPending,"aria-disabled":y,onClick:()=>{y||(s.reset(),s.mutate())},className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md outline-none transition-colors ${y?`cursor-not-allowed opacity-40`:``} ${s.error?`text-red-400 hover:bg-red-500/10`:`text-accent hover:bg-accent/10`}`,children:(0,V.jsx)(Cw,{size:13,strokeWidth:2,className:s.isPending?`animate-pulse`:``})})})]}),(0,V.jsx)(u6,{at:eM(i),fallbackAt:i.spawnedAt,className:`mt-0.5 block truncate text-[11px] leading-tight text-muted/75`})]})]})}),(0,V.jsxs)(`div`,{className:_2,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[m&&(0,V.jsx)(b6,{slug:e}),(0,V.jsx)(L2,{thread:i,onDoc:p?()=>BS(`doc`,i.id):void 0,onDone:()=>a.mutate(void 0,{onSuccess:t}),doneBusy:a.isPending,onStatusApplied:t}),n&&(0,V.jsx)(Pq,{label:`Open in new tab`,children:(0,V.jsx)(`a`,{href:Ex(e),target:`_blank`,rel:`noopener`,"aria-label":`Open in new tab`,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:(0,V.jsx)(EC,{size:14})})})]}),n&&(0,V.jsx)(`button`,{type:`button`,"aria-label":`Close`,"data-dialog-initial-focus":!0,onClick:n,className:`ml-0.5 shrink-0 rounded-md p-1.5 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,V.jsx)(jw,{size:15})})]})]})}function P8(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 F8(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 I8(e){return P8(e)!==null}function L8(e){return F8(e)!==null}function R8(e){return e.kind===`event`&&!e.boundary||e.kind===`reasoning`}function z8(e){return R8(e)||I8(e)}function B8(e){return R8(e)||L8(e)}function V8(e){if(R8(e))return!0;let t=P8(e);return t!==null&&!j6(t[t.length-1])}function H8(e){if(R8(e))return!0;let t=F8(e);return t!==null&&!j6(t[0])}function U8(e){let t=P8(e);return t!==null&&M6(t[t.length-1])}function W8(e){let t=F8(e);return t!==null&&M6(t[0])}function G8(e,t){let n=U8(e)||W8(t),r=!n&&z8(e)&&B8(t)&&!(V8(e)&&H8(t));return(n?22:r?6:14)+(e.role===`user`&&t.role!==`user`?3:0)}function K8(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:Y8(e,n.text,t)):(e.tools?.length??0)===0&&Y8(e,e.text,t)}function q8(e){for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`&&e[t].kind!==`event`)return t;return-1}function J8(e,t){let n=new WeakSet;if(t>=0)for(let r of e)r.messageIndex<t&&n.add(r.message);return e=>K8(e,n.has(e))}function Y8(e,t,n){return!e.fenceRefused&&!n?!t.trim():j1(t).every(e=>e.kind===`fence`&&e.fenceKind===`awaiting`)}function X8(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`&&!Y8(e,n.text,t)):typeof e.text==`string`&&!Y8(e,e.text,t)}function Z8(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.queued||K8(n)))return U8(n)?22:z8(n)&&!V8(n)?6:14+(n.role===`user`?3:0)}return 0}function Q8(e,t,n){let r=[],i=null;return e.forEach((e,a)=>{n?.(e,a)||K8(e)||(i!==null&&r.push((0,V.jsx)(r0,{h:G8(i,e)},`s${a}`)),r.push(t(e,a)),i=e)}),r}function $8(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 e5(e,t=14){let n=e.filter(e=>e!=null&&e!==!1),r=[];return n.forEach((e,n)=>{n>0&&r.push((0,V.jsx)(r0,{h:typeof t==`number`?t:t(n)},`vs${n}`)),r.push(e)}),r}var t5={head:!1,tail:!1};function n5(e,t){return n=>e[n-1]?.tail||e[n]?.head?22:t}function r5(e){return{head:M6(e[0]),tail:M6(e[e.length-1])}}function i5(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}):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 a5(e){return e.split(`__`).pop()||e}function o5(e){let t=Z.board?.projectDir;return t&&e.startsWith(t+`/`)?e.slice(t.length+1):e}function s5({tools:e,at:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useId)(),a=e.reduce((e,t)=>e+t.count,0),o=e8(a,$6(e));return(0,V.jsxs)(`div`,{"data-tool-activity":!0,"data-tool-activity-state":`settled`,className:`flex min-w-0 flex-col`,children:[(0,V.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-fg/60 ${M4}`,children:[(0,V.jsx)(`span`,{"data-tool-activity-label":!0,title:o,className:`min-w-0 truncate text-muted`,children:o}),(0,V.jsx)(PC,{"data-tool-activity-chevron":!0,"aria-hidden":`true`,size:13,className:P4(n)})]}),n&&(0,V.jsx)(`div`,{id:i,className:`mt-1.5 flex flex-col`,children:e5(e.map((e,n)=>(0,V.jsx)(l5,{t:e,startedAt:t},n)),6)}),!n&&(0,V.jsx)(`div`,{id:i,hidden:!0})]})}function c5({tools:e,at:t}){let n=[];for(let t of e){let e=j6(t),r=n[n.length-1];r?.exceptional===e?r.tools.push(t):n.push({exceptional:e,tools:[t]})}return(0,V.jsx)(`div`,{className:`flex flex-col`,children:e5(n.map((e,n)=>e.exceptional?(0,V.jsx)(`div`,{className:`flex flex-col`,children:e5(e.tools.map((e,n)=>(0,V.jsx)(l5,{t:e,startedAt:t},n)),n5(e.tools.map(e=>r5([e])),6))},`exceptions-${n}`):(0,V.jsx)(s5,{tools:e.tools,at:t},`activity-${n}`)),n5(n.map(e=>r5(e.tools)),6))})}function l5({t:e,startedAt:t}){let n=(0,B.useContext)(y8),r=$A(),i=UM(e,(n?iC(r,n):void 0)?.bgShells??[]);return e.edits&&e.status!==`failed`&&e.status!==`cancelled`?(0,V.jsx)(W$,{edits:e.edits,meta:(0,V.jsx)(p5,{status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,durationMs:e.durationMs})}):e.command?(0,V.jsx)(x5,{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,V.jsx)(v5,{name:e.name,detail:e.detail,outputImage:e.outputImage,output:e.output,status:e.status,durationMs:e.durationMs}):e.read?(0,V.jsx)(C5,{detail:e.detail,read:e.read,status:e.status,durationMs:e.durationMs}):e.prompt||e.agentId?(0,V.jsx)(T5,{detail:e.detail,prompt:e.prompt,input:e.input,subagentType:e.subagentType,agentId:e.agentId,agentStatus:e.agentStatus,agentElapsedMs:e.agentElapsedMs,status:e.status,durationMs:e.durationMs,output:e.output}):e.sendTo!==void 0||e.sendBody!==void 0?(0,V.jsx)(D5,{to:e.sendTo,summary:e.sendSummary,body:e.sendBody??``,type:e.sendType,dispatchId:e.sendDispatchId,targetLabel:e.sendTargetLabel,status:e.status,durationMs:e.durationMs}):e.sentImages||e.sentFiles?(0,V.jsx)(y5,{images:e.sentImages??[],files:e.sentFiles??[],caption:e.caption,status:e.status,durationMs:e.durationMs}):e.todos?(0,V.jsx)(c1,{todos:e.todos,note:e.input,meta:(0,V.jsx)(p5,{status:e.status,durationMs:e.durationMs})}):e.input||e.output?(0,V.jsx)(x5,{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,V.jsx)(_5,{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 u5({tone:e,indicator:t,label:n,duration:r,title:i}){return(0,V.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,V.jsx)(`span`,{children:[n,r].filter(Boolean).join(` · `)})]})}function d5(e,t,n){let[r,i]=(0,B.useState)(()=>Date.now()),a=BM(e,t),o=VM(e,t,n,r);return(0,B.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(zM-(Date.now()-e),0));return()=>clearTimeout(t)},[a,o,n]),o}function f5({status:e,backgroundState:t,liveBackgroundState:n,startedAt:r}){let i=d5(e,t,r),a=n===`running`?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):n===`stale`?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot-quiet frizz-live-dot-quiet--shell`,"data-running-indicator":`tool-quiet`,title:iN}):RM(e,t)||i?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):null;return a?(0,V.jsx)(`span`,{className:`frizz-tool-mark -mr-1 flex w-[9px] shrink-0 justify-center`,children:a}):null}function p5({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:WM(i),c=[o,s].filter(Boolean).join(` · `);return(0,V.jsx)(u5,{tone:e===`failed`?`frizz-tool-failed`:e===`cancelled`?`text-amber-400`:`text-muted/55`,title:c,label:a,duration:s})}function m5(e,t,n){let r=t?Date.parse(t):NaN,i=e===`pending`&&Number.isFinite(r),[a,o]=(0,B.useState)(()=>Date.now());return(0,B.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 h5(e,t,n){let r=t&&t!==Z.board?.projectDir?`in ${o5(t)}`:void 0;return[e,t?r:n!==void 0&&!e?.includes(String(n))?`session ${n}`:void 0].filter(Boolean).join(` · `)||void 0}function g5(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.includes(`…`)}function _5({name:e,detail:t,count:n,status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,cwd:s,sessionId:c,durationMs:l,startedAt:u}){let d=h5(t,s,c),f=d?o5(d):void 0,p=t&&g5(t)?t:void 0;return(0,V.jsx)(`div`,{className:`frizz-bash`,title:d,children:(0,V.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(f5,{status:r,backgroundState:i,liveBackgroundState:a,startedAt:u}),(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:a5(e)}),f&&(p?(0,V.jsx)(`span`,{className:`min-w-0 truncate`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(H$,{path:p,className:`text-[11.5px] text-muted`,children:f})}):(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:f}))]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(p5,{status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,durationMs:l}),n>1&&(0,V.jsxs)(`span`,{className:`tabular-nums text-[11px] text-muted/45`,children:[`×`,n]})]})]})})}function v5({name:e,detail:t,outputImage:n,output:r,status:i,durationMs:a}){let o=t?o5(t):void 0,s=(0,V.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:a5(e)}),o&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,title:t,children:o})]}),(0,V.jsx)(`span`,{className:`flex shrink-0 items-center gap-2`,children:(0,V.jsx)(p5,{status:i,durationMs:a})})]});return(0,V.jsxs)(`div`,{children:[(0,V.jsx)(F5,{path:n,hideCaption:!0,altText:o?`${a5(e)}: ${o}`:a5(e),header:s}),r&&(0,V.jsx)(`pre`,{className:`frizz-bash frizz-bash-body frizz-bash-output-body mt-1.5`,children:r})]})}function y5({images:e,files:t,caption:n,status:r,durationMs:i}){let[a,o]=(0,B.useState)(!0),s=(0,B.useId)(),c=[e.length?`${e.length} image${e.length===1?``:`s`}`:``,t.length?`${t.length} file${t.length===1?``:`s`}`:``].filter(Boolean).join(` · `);return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.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${c?`: ${c}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Sent to you`}),c&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:c})]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(p5,{status:r,durationMs:i}),(0,V.jsx)(PC,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${a?`rotate-90`:``}`})]})]}),(0,V.jsx)(`div`,{id:s,hidden:!a,children:a&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5 px-2.5 pb-2.5 pt-1.5`,children:[e.map((e,t)=>(0,V.jsx)(F5,{path:e,hideCaption:!0,altText:n??`delivered image`},`i${t}`)),t.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map((e,t)=>(0,V.jsx)(I5,{path:e},`f${t}`))}),n&&(0,V.jsx)(`div`,{className:`max-w-[65%] text-[12px] leading-snug text-muted`,children:n})]})})]})}var b5=16;function x5({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,B.useState)(!1),[m,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(!1),v=(0,B.useId)(),y=m5(i,d,l),b=(0,B.useMemo)(()=>e.split(`
486
- `).length,[e]),x=b>b5,S=(0,B.useMemo)(()=>n?n.split(`
487
- `).length:0,[n]),C=S>b5,w=h5(t,void 0,c),T=!!(e||n);return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.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`} `:``}${a5(r)}${w?`: ${w}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(f5,{status:i,backgroundState:a,liveBackgroundState:o,startedAt:d}),(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:a5(r)}),(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,title:w,children:w??``})]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(p5,{status:i,backgroundState:a,liveBackgroundState:o,exitCode:s,durationMs:y}),T&&(0,V.jsx)(PC,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${f?`rotate-90`:``}`})]})]}),T&&(0,V.jsxs)(`div`,{id:v,hidden:!f,children:[f&&e&&(0,V.jsxs)(V.Fragment,{children:[u&&(0,V.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:u}),(0,V.jsx)(n1,{text:e,language:u?`plaintext`:`bash`,className:`frizz-bash-body${u?` frizz-bash-output-body`:``}${x&&!m?` frizz-bash-clamp`:``}`}),x&&(0,V.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,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:`output`}),(0,V.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body${C&&!g?` frizz-bash-clamp`:``}`,children:n}),C&&(0,V.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 S5=16;function C5({detail:e,read:t,status:n,durationMs:r}){let[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),c=(0,B.useId)(),l=(0,B.useMemo)(()=>t.split(`
488
- `).length,[t]),u=l>S5,d=e?o5(e):void 0,f=e&&g5(e)?e:void 0;return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.jsxs)(V$,{className:`frizz-bash-header`,controls:c,expanded:i,label:`${i?`Collapse`:`Expand`} Read${e?`: ${e}`:``}`,onToggle:()=>a(e=>!e),meta:(0,V.jsx)(p5,{status:n,durationMs:r}),children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Read`}),d&&(f?(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,V.jsx)(H$,{path:f,className:`text-[11.5px] text-muted`,children:d})}):(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:d}))]}),(0,V.jsx)(`div`,{id:c,hidden:!i,children:i&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(n1,{text:t,language:_Q(e),className:`frizz-bash-body${u&&!o?` frizz-bash-clamp`:``}`}),u&&(0,V.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 w5=16;function T5({detail:e,prompt:t,input:n,subagentType:r,agentId:i,agentStatus:a,agentElapsedMs:o,status:s,durationMs:c,output:l}){let[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(!1),m=(0,B.useId)(),h=t??n,g=(0,B.useMemo)(()=>h?h.split(`
489
- `).length:0,[h]),_=g>w5,v=x8(),y=$A(),b=v?iC(y,v):void 0,x=!a&&i?(b?.subAgents??[]).find(e=>e.id===i):void 0,S=x?.state===`running`,C=!!(v&&i),w=e??`sub-agent`,T=FM(),E=j4({agentStatus:a,agentElapsedMs:o,liveState:x?.state,liveElapsedMs:x?.startedAt?Math.max(T-Date.parse(x.startedAt),0):void 0,status:s,durationMs:c}),D=S?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--agent`,"data-running-indicator":`subagent-disclosure`}):x?.state===`stale`?(0,V.jsx)(`span`,{className:eN,title:tN}):x?.state===`rested`?(0,V.jsx)(`span`,{className:nN,title:rN}):null;function O(){!v||!i||VS(v,i,{label:w,subagentType:r,startedAt:x?.startedAt})}return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.jsxs)(V$,{className:`frizz-bash-header`,controls:m,expanded:u,label:`${u?`Collapse`:`Expand`} Agent dispatch: ${w}`,onToggle:()=>d(e=>!e),meta:E&&(0,V.jsx)(u5,{tone:E.tone===`failed`?`frizz-tool-failed`:`text-muted/55`,title:E.title,label:E.label,duration:E.duration}),children:[D&&(0,V.jsx)(`span`,{className:`frizz-tool-mark -mr-1 flex w-[9px] shrink-0 justify-center`,children:D}),(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Agent`}),C?(0,V.jsx)(`button`,{type:`button`,"aria-label":`Open sub-agent transcript: ${w}`,title:r?`Open sub-agent transcript — ${r}`:`Open sub-agent transcript`,onClick:O,className:`min-w-[4rem] flex-1 truncate text-left text-[11.5px] text-muted outline-none hover:underline hover:text-fg/80 focus-visible:underline focus-visible:text-fg/80`,children:w}):(0,V.jsx)(`span`,{className:`min-w-[4rem] flex-1 truncate text-[11.5px] text-muted`,title:r,children:w})]}),(0,V.jsx)(`div`,{id:m,hidden:!u,children:u&&(0,V.jsxs)(V.Fragment,{children:[h&&(0,V.jsx)(`pre`,{className:`frizz-bash-body${_&&!f?` frizz-bash-clamp`:``}`,children:h}),_&&(0,V.jsx)(`button`,{type:`button`,onClick:()=>p(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand petite-caps px-2.5 pb-1.5`,children:f?`Collapse`:`Show all ${g} lines`}),l&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:`output`}),(0,V.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body`,children:l})]})]})})]})}function E5(e,t){return t===`shutdown_request`?`Shutdown`:t===`codex_followup`?`Followed up`:e===`main`?`Reported`:`Steered`}function D5({to:e,summary:t,body:n,type:r,dispatchId:i,targetLabel:a,status:o,durationMs:s}){return(0,B.useContext)(y8)===null?(0,V.jsx)(k5,{to:e,summary:t,body:n,type:r,status:o,durationMs:s}):(0,V.jsx)(Q5,{to:e,type:r,dispatchId:i,targetLabel:a})}var O5=16;function k5({to:e,summary:t,body:n,type:r,status:i,durationMs:a}){let[o,s]=(0,B.useState)(!t),[c,l]=(0,B.useState)(!1),u=(0,B.useId)(),d=t1(s$(n)),f=(0,B.useMemo)(()=>n.split(`
490
- `).length,[n]),p=f>O5,m=!!n.trim(),h=E5(e,r);return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":m?u:void 0,"aria-expanded":m?o:void 0,"aria-label":`${m?`${o?`Collapse`:`Expand`} `:``}${h}${e?` to ${e}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,disabled:!m,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:h}),t&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:t})]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(p5,{status:i,durationMs:a}),m&&(0,V.jsx)(PC,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${o?`rotate-90`:``}`})]})]}),m&&(0,V.jsx)(`div`,{id:u,hidden:!o,children:o&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`border-t border-border px-2.5 py-2${p&&!c?` frizz-bash-clamp`:``}`,children:(0,V.jsx)(`div`,{className:`md-body`,dangerouslySetInnerHTML:d})}),p&&(0,V.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand petite-caps px-2.5 pb-1.5`,children:c?`Collapse`:`Show all ${f} lines`})]})})]})}function A5({children:e,stickyTopPx:t,sourceId:n}){let r=t!==void 0;return(0,V.jsx)(`div`,{"data-transcript-source-id":n,"data-transcript-sticky":`true`,style:r?{"--sticky-user-top":`${t}px`}:void 0,className:`pointer-events-none [&>*]:pointer-events-auto sticky z-[9] flex flex-col pt-3 pb-1.5 ${r?`top-[var(--sticky-user-top)] max-[800px]:top-[calc(var(--sticky-user-top)_+_2.5rem)]`:`top-0`}`,children:e})}function j5({text:e,rawText:t,queued:n,sticky:r,deliveryUnconfirmed:i,deliveryId:a,sourceId:o}){let s=(0,B.useRef)(null),c=(0,B.useContext)(y8),l=e2(c),{unqueue:u,pending:d}=i2(c),f=!!(n&&a&&c&&l),p=a2(n?c:null),{deliverNow:m,pending:h}=o2(c),g=!!(n&&c&&p),{prose:_,attachments:v}=(0,B.useMemo)(()=>gH(e),[e]),[y,b]=(0,B.useState)(!1),[x,S]=(0,B.useState)(!1),[C,w]=(0,B.useState)(!1),[T,E]=(0,B.useState)(!1),[D,O]=(0,B.useState)(null),k=(0,B.useCallback)(()=>{let e=s.current;if(!r||!e){O(null),S(!1),w(!1);return}let t=Math.round((typeof window>`u`?800:window.innerHeight)*.85);S(e.scrollHeight>205),w(e.scrollHeight>t),O(y?`${Math.min(e.scrollHeight,t)}px`:`200px`)},[r,y]);(0,B.useLayoutEffect)(()=>{k()},[k,e]),(0,B.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>k();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[k]);let A=r===!0&&!y,j=r===!0&&y&&C&&T;return(0,V.jsxs)(`div`,{"data-frizz-msg":o,className:`self-end flex flex-col items-end gap-0.5 max-w-[85%]`,children:[_.trim()!==``&&(0,V.jsxs)(`div`,{className:`group relative`,children:[(0,V.jsxs)(`div`,{ref:s,...f?{role:`button`,tabIndex:0,"data-unqueue":a,"aria-label":`Unqueue this message and put it back in the prompt box`,title:d?`Taking it back…`:void 0,onClick:n=>u({deliveryId:a,text:e,rawText:t??e,from:n.currentTarget}),onKeyDown:n=>{n.key!==`Enter`&&n.key!==` `||(n.preventDefault(),u({deliveryId:a,text:e,rawText:t??e,from:n.currentTarget}))}}:{},onMouseEnter:r?()=>b(!0):void 0,onMouseLeave:r?()=>{b(!1),E(!1)}:void 0,onTransitionEnd:r?e=>{e.propertyName===`max-height`&&y&&C&&E(!0)}:void 0,style:{...D?{maxHeight:D}:{},...r&&C&&!j?{paddingRight:`calc(0.875rem + var(--sbw))`}:{}},className:`relative rounded-xl rounded-br-sm bg-user-bubble px-3.5 py-3 text-[14px] whitespace-pre-wrap [overflow-wrap:anywhere] text-bg ${n?`opacity-50`:``} ${f?`cursor-pointer transition-opacity group-hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg`:``} ${d?`!opacity-30`:``} ${r?`transition-[max-height] duration-200 ease-out ${j?`overflow-y-auto`:`overflow-hidden`}`:``}`,children:[(0,V.jsx)(w0,{text:_}),A&&x&&(0,V.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-user-bubble to-transparent`})]}),g&&(0,V.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:m,disabled:h,title:`Send now — interrupts what the worker is doing so it reads the queue immediately`,"aria-label":`Send now`,className:`absolute bottom-0 right-full mr-2 flex h-7 w-7 items-center justify-center rounded-lg text-muted opacity-0 outline-none transition-[opacity,color,background-color] group-hover:opacity-100 enabled:hover:bg-panel-2/70 enabled:hover:text-fg enabled:focus-visible:opacity-100 enabled:focus-visible:bg-panel-2/70 enabled:focus-visible:ring-1 enabled:focus-visible:ring-muted/80 enabled:focus-visible:ring-offset-1 enabled:focus-visible:ring-offset-bg enabled:active:bg-elevated`,children:h?(0,V.jsx)(cw,{size:15,strokeWidth:2.2,className:`animate-spin`}):(0,V.jsx)(DC,{size:15,strokeWidth:2.2})})]}),v.length>0&&(0,V.jsxs)(`div`,{className:`mt-1 flex flex-col items-end gap-1.5`,children:[v.filter(e=>e.kind===`image`).map((e,t)=>(0,V.jsx)(F5,{path:e.path,hideCaption:!0},`i${t}-${e.path}`)),v.some(e=>e.kind===`file`)&&(0,V.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1.5`,children:v.filter(e=>e.kind===`file`).map((e,t)=>(0,V.jsx)(I5,{path:e.path},`f${t}-${e.path}`))})]}),i&&(0,V.jsx)(`div`,{className:`text-[11px] text-amber-400/80`,children:`Delivery unconfirmed — no receipt from the worker`}),f&&d&&(0,V.jsx)(`div`,{"aria-hidden":!0,className:`h-0 overflow-visible text-[11px] text-muted`,children:`Taking it back…`})]})}var M5=(0,B.memo)(function({m:e,answering:t,dense:n,paired:r,sticky:i,textOnly:a,showSendButton:o,staleAwaiting:s}){let c=kY(),[l,u]=(0,B.useState)(!1);if(e.kind===`event`)return(0,V.jsx)($5,{text:e.text,boundary:e.boundary,sourceId:e.sourceId});if(e.kind===`reasoning`)return(0,V.jsx)(e7,{text:e.text,sourceId:e.sourceId});let d=E4(e);if(d)return(0,V.jsx)(X5,{call:d,sourceId:e.sourceId});if(e.role===`user`){let t=s2(e).replace(/\r\n?/g,`
491
- `),a=r===void 0?L1(t):r;if(a)return(0,V.jsx)(N5,{answers:a,queued:e.queued,sourceId:e.sourceId});let o=e.wake?Gy(t):void 0;return o?(0,V.jsx)(_0,{bump:o,sourceId:e.sourceId}):e.wake?(0,V.jsx)(l0,{steer:e.wakeSteer,text:t,sourceId:e.sourceId,wrap:n}):e.peerFrom?(0,V.jsx)(Z5,{from:e.peerFrom,unnamed:e.peerUnnamed,dispatchId:e.peerDispatchId,sourceId:e.sourceId}):(0,V.jsx)(j5,{text:t,rawText:e.text,queued:e.queued,sticky:i,deliveryUnconfirmed:e.deliveryState===`unconfirmed`,deliveryId:e.deliveryId,sourceId:e.sourceId})}let f=[],p=[],m=(e,t=t5)=>{f.push(e),p.push(t)},h={n:-1},g=[],_=(r,i)=>{for(let[a,o]of j1(r).entries()){if(o.kind===`fence`){if(o.fenceKind===`awaiting`&&(e.fenceRefused||s))continue;m((0,V.jsx)(B5,{fenceKind:o.fenceKind,body:o.body,hints:o.hints,wrap:n},`${i}-f${a}`));continue}for(let[e,r]of d1(o.text).entries()){if(r.kind===`prose`){for(let[t,o]of hH(r.text).entries()){let r=`${i}-${a}-p${e}-${t}`;m(o.kind===`image`?(0,V.jsx)(F5,{path:o.path},r):o.kind===`file`?(0,V.jsx)(I5,{path:o.path},r):o.kind===`visualization`?(0,V.jsx)(z5,{file:o.file},r):o.kind===`directive`?(0,V.jsx)(h8,{directive:o.directive},r):o.kind===`mermaid`?(0,V.jsx)(v8,{source:o.source},r):(0,V.jsx)(P5,{md:o.text,wrap:n},r))}continue}h.n+=1;let o=h.n;t&&g.push({raw:r.text,kind:r.questionKind,danger:r.danger,bi:o});let s=t&&!c?{answer:t.answerFor(o),onChip:(e,n)=>t.onChip(o,e,n),onText:e=>t.onText(o,e),onSubmit:t.onSubmit}:void 0;m((0,V.jsx)(J0,{raw:r.text,questionKind:r.questionKind,danger:r.danger,interactive:s,wrap:n},`${i}-${a}-q${e}`))}}};if(e.parts&&e.parts.length>0)$8(e.parts).forEach((t,r)=>{if(t.kind===`tools`){if(a)return;let i=i5(t.tools);i.length&&m((0,V.jsx)(c5,{tools:i,dense:n,at:e.at},`t${r}`),r5(i))}else _(t.text,`x${r}`)});else{if(!a){let t=i5(e.tools);t.length>0&&m((0,V.jsx)(c5,{tools:t,dense:n,at:e.at},`tools`),r5(t))}_(e.text,`leg`)}return f.length===0?null:(o&&t&&c&&g.length>0?m((0,V.jsx)(`div`,{className:`flex justify-start`,children:(0,V.jsx)(`button`,{type:`button`,"data-mobile-answer-open":!0,onClick:()=>u(!0),className:`flex h-[40px] items-center justify-center rounded-[12px] bg-accent px-4 text-[15px] font-semibold text-bg active:brightness-90`,children:g.length>1?`Answer ${g.length} questions`:`Answer`})},`answer-open`)):o&&t&&m((0,V.jsx)(`div`,{className:`flex justify-start`,children:(0,V.jsx)(`button`,{type:`button`,"data-send-answers":!0,disabled:!t.anyAnswered||t.sending,onClick:t.onSubmit,onMouseDown:e=>e.preventDefault(),className:`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`})},`send-answers`)),(0,V.jsxs)(`div`,{"data-frizz-msg":e.sourceId,className:`flex flex-col text-[13px] min-w-0`,children:[e5(f,n5(p,14)),l&&t&&g.length>0?(0,V.jsx)($0,{blocks:g,answering:t,onClose:()=>u(!1)}):null]}))});function N5({answers:e,queued:t,sourceId:n}){return(0,V.jsx)(`div`,{"data-frizz-msg":n,"data-answers-card":!0,className:`self-end flex w-full max-w-[85%] flex-col items-end ${t?`opacity-50`:``}`,children:(0,V.jsxs)(`div`,{className:`w-full min-w-0 ${W1} rounded-br-sm border border-border-strong bg-elevated p-4`,children:[(0,V.jsx)(Y1,{icon:sw,label:`Answers`}),(0,V.jsx)(X1,{children:(0,V.jsx)(`div`,{className:`flex flex-col gap-2.5`,children:e.map((e,t)=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.question&&(0,V.jsx)(`div`,{title:e.question,className:`line-clamp-2 min-w-0 text-[11px] leading-snug text-muted`,children:e.question}),(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!e.question&&(0,V.jsx)(`span`,{className:`mt-1.5 shrink-0 text-[10px] uppercase tabular-nums tracking-wide text-muted/70`,children:e.n}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap [overflow-wrap:anywhere] rounded-md border border-border-strong border-l-2 border-l-accent/40 bg-bg/50 px-2.5 py-1.5 text-[12px] leading-snug text-fg`,children:(0,V.jsx)(w0,{text:e.answer})})]})]},t))})})]})})}function P5({md:e,wrap:t}){let n=s$(e),r=t1(n),i=(0,B.useRef)(null);return q0(i,n),n?(0,V.jsx)(`div`,{ref:i,className:`md-body${t?` ${U1}`:``}`,dangerouslySetInnerHTML:r}):null}function F5({path:e,hideCaption:t,altText:n,header:r}){let[i,a]=(0,B.useState)(!1);if(i)return(0,V.jsx)(`div`,{className:`font-mono-keep text-[12px] text-muted/70 break-all`,children:e});let o=e.split(`/`).filter(Boolean).pop()||e;return(0,V.jsx)(EQ,{header:r,caption:t?void 0:(0,V.jsx)(`figcaption`,{className:`bg-panel-2 px-2 pb-1.5 font-mono-keep text-[11px] text-muted/60 break-all`,children:o}),children:(0,V.jsx)(`img`,{src:RH(e),alt:n??o,"data-local-path":e,"data-local-image":`true`,onError:()=>a(!0),className:`cursor-pointer ${kQ}`})})}function I5({path:e}){let t=e.split(`/`).filter(Boolean).pop()||e;return(0,V.jsxs)(`button`,{type:`button`,className:`local-file-action inline-flex max-w-full items-center gap-1.5 ${W1} border border-border bg-panel-2 px-3 py-1.5 text-left align-top no-underline hover:border-accent`,"data-local-path":e,title:e,children:[(0,V.jsx)(qC,{size:14,strokeWidth:2,className:`shrink-0 text-muted`}),(0,V.jsx)(`span`,{className:`font-mono-keep truncate text-[12px] text-fg`,children:t})]})}var L5={"--background":`--color-bg`,"--foreground":`--color-fg`,"--card":`--color-panel-2`,"--card-foreground":`--color-fg`,"--popover":`--color-elevated`,"--popover-foreground":`--color-fg`,"--primary":`--color-fg`,"--primary-foreground":`--color-bg`,"--secondary":`--color-panel-2`,"--secondary-foreground":`--color-fg`,"--muted":`--color-panel-2`,"--muted-foreground":`--color-muted`,"--accent":`--color-border-strong`,"--accent-foreground":`--color-fg`,"--border":`--color-border-strong`,"--input":`--color-border-strong`,"--ring":`--color-accent`};function R5(){let e=getComputedStyle(document.documentElement),t=Object.fromEntries(Object.entries(L5).map(([t,n])=>[t,e.getPropertyValue(n).trim()]));return t[`--font-size-base`]=getComputedStyle(document.body).fontSize,{type:`frizz-inline-vis-theme`,colorScheme:e.colorScheme===`light`?`light`:`dark`,vars:t}}function z5({file:e}){let t=(0,B.useContext)(y8),n=(0,B.useRef)(null),[r,i]=(0,B.useState)(360),[a,o]=(0,B.useState)(null),s=t?`${Tx()}/local-visualization?slug=${encodeURIComponent(t)}&file=${encodeURIComponent(e)}`:null;return(0,B.useEffect)(()=>{if(!s){o(!1);return}let e=new AbortController;return o(null),fetch(s,{method:`HEAD`,signal:e.signal}).then(t=>{e.signal.aborted||o(t.ok)}).catch(()=>{e.signal.aborted||o(!1)}),()=>e.abort()},[s]),(0,B.useEffect)(()=>{let e=e=>{if(e.source!==n.current?.contentWindow||e.data?.type!==`frizz-inline-vis-height`)return;let t=Number(e.data.height);Number.isFinite(t)&&i(Math.max(80,Math.min(2400,Math.ceil(t))))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[]),a===!1||!s?(0,V.jsxs)(`div`,{role:`status`,className:`${W1} border border-border bg-panel-2 px-4 py-2.5 text-[12px] text-muted`,children:[`Visualization unavailable: `,(0,V.jsx)(`span`,{className:`font-mono-keep break-all`,children:e})]}):a===null?(0,V.jsx)(`div`,{role:`status`,className:`h-20 animate-pulse ${W1} bg-panel-2`,"aria-label":`Loading ${e}`}):(0,V.jsx)(`iframe`,{ref:n,src:s,title:e.replace(/\.html$/,``).replaceAll(`-`,` `),sandbox:`allow-scripts`,onLoad:()=>n.current?.contentWindow?.postMessage(R5(),`*`),className:`block w-full border-0 bg-transparent`,style:{height:r}})}function B5({fenceKind:e,body:t,hints:n,wrap:r}){let i=s$(t),a=t1(i),o=t1(s$(dJ(t))),s=hJ(n),c=gJ(n),l=(0,B.useContext)(y8),u=(0,B.useContext)(S8),d=$A(),f=l?iC(d,l):void 0,p=f?H2(f):void 0,m=!!(f&&p?.archive),h=(0,B.useRef)(null);m&&f&&(h.current=f);let g=m&&f?f:h.current;if(e===`done`)return(0,V.jsxs)(Z1,{icon:jC,label:`Done`,children:[i&&(0,V.jsx)(`div`,{className:`md-body${r?` [overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`:``}`,dangerouslySetInnerHTML:a}),g&&(0,V.jsx)($1,{children:(0,V.jsx)(w4,{thread:g,className:`rounded-md text-[11px] bg-fg px-2.5 py-1 text-bg hover:opacity-90`,iconClassName:`icon-label-nudge`,onArchived:u?.dismiss,onDismissCancel:u?.cancel})})]});let _=iJ(n),v=_?.title??`Awaiting`,y=n.some(e=>e.kind===`pr`)?gw:tw,b=aJ(n);return _===null&&f!=null&&a6(f)?null:(0,V.jsxs)(Z1,{"data-awaiting-fence":!0,icon:y,label:v,aside:b.length===1?(0,V.jsx)(V5,{watch:b[0]}):void 0,children:[(0,V.jsx)(`div`,{className:`md-body${r?` ${U1}`:``}`,dangerouslySetInnerHTML:o}),(s.length>0||c)&&(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[12px] text-muted`,children:[s.map((e,t)=>(0,V.jsx)(`span`,{children:e},`${t}-${e}`)),c&&(0,V.jsx)(`span`,{className:`text-muted/70`,children:c})]}),b.length>1&&(0,V.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:b.map(e=>(0,V.jsx)(V5,{watch:e},e.ref))}),m&&f&&(0,V.jsx)(H5,{thread:f,hints:n})]})}function V5({watch:e}){return e.url?(0,V.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,className:`${t0} text-[12px]`,children:e.ref}):(0,V.jsx)(`span`,{className:`text-[12px] text-muted`,children:e.ref})}function H5({thread:e,hints:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useContext)(S8),a=iJ(t);return a?(0,V.jsxs)($1,{children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=a.timerUntil??Ej(zj.snoozePreset);r(!0),X.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:t}).then(()=>{Q(`${a.toastVerb} · ${kj(t)}`),i?.dismiss()}).catch(e=>Q(`Couldn’t snooze: ${e.message.slice(0,80)}`)).finally(()=>r(!1))},disabled:n,"aria-label":rJ,title:a.explainer,onMouseDown:e=>e.preventDefault(),className:`whitespace-nowrap disabled:opacity-45 ${n0}`,children:[n&&(0,V.jsx)(cw,{size:11,className:`animate-spin`}),rJ]}),(0,V.jsx)(`span`,{className:e0,children:a.explainer})]}):null}function U5({slug:e,sessionId:t,fault:n,retryText:r}){let[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),c=Md(),l=CU[n.backend],u=t=>{s(!0),$q(c,e,t,{onSuccess:()=>{s(!1),Q(`Retrying with the previous message…`)},onRollback:()=>s(!1),failureToast:e=>`Retry failed: ${e.slice(0,80)}`})||s(!1)};return(0,V.jsxs)(Z1,{"data-provider-fault":!0,tone:`danger`,icon:aw,label:`${l} sign-in required`,children:[(0,V.jsx)(`span`,{className:Q1,children:`The provider rejected this session's credential. Sign in, then retry.`}),(0,V.jsxs)($1,{children:[r?.trim()&&(0,V.jsx)(`button`,{onClick:()=>u(r),disabled:o,onMouseDown:e=>e.preventDefault(),className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel hover:border-border-strong disabled:opacity-60`,children:`Retry`}),(0,V.jsx)(`button`,{onClick:()=>a(!0),onMouseDown:e=>e.preventDefault(),className:n0,children:`Sign in`})]}),i&&(0,V.jsx)(EU,{backend:n.backend,onClose:()=>a(!1),onAuthed:()=>a(!1)})]})}function W5(e){let t=new Date(e*1e3),n=t.toDateString()===new Date().toDateString(),r=t.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`});return n?r:`${t.toLocaleDateString([],{weekday:`short`})} ${r}`}function G5({slug:e,sessionId:t,pause:n}){let r=CU[n.backend],i=n.window===`weekly`?`weekly limit`:n.window===`session`?`session limit`:`usage limit`,[a,o]=(0,B.useState)(!1),s=Md();return(0,V.jsxs)(Z1,{"data-limit-pause":!0,tone:`caution`,icon:tw,label:`Paused by the ${r} ${i}`,children:[(0,V.jsx)(`span`,{className:Q1,children:n.autoResume?n.resumesAt?`Continuing automatically at ${W5(n.resumesAt)}.`:`Continuing automatically once the window resets.`:`Continue it whenever you have capacity again.`}),(0,V.jsx)($1,{children:(0,V.jsx)(`button`,{onClick:()=>{o(!0),$q(s,e,`Continue exactly where you left off.`,{onSuccess:()=>{o(!1),Q(`Continuing…`)},onRollback:()=>o(!1),failureToast:e=>`Continue failed: ${e.slice(0,80)}`})||o(!1)},disabled:a,onMouseDown:e=>e.preventDefault(),className:`disabled:opacity-45 ${n0}`,children:`Continue now`})})]})}function K5({onTerminal:e}){return(0,V.jsxs)(Z1,{tone:`attention`,icon:aw,label:`Permission approval`,children:[(0,V.jsx)(`span`,{className:Q1,children:`The agent is waiting on your approval — respond in your external terminal.`}),(0,V.jsx)($1,{children:(0,V.jsx)(`button`,{onClick:()=>e(),onMouseDown:e=>e.preventDefault(),className:n0,children:`Copy terminal command`})})]})}function q5({policy:e,denies:t}){let n=[e.tool,e.command].filter(Boolean).join(`: `);return(0,V.jsxs)(Z1,{tone:`caution`,icon:kw,label:`Blocked by frizz's permission policy`,children:[n?(0,V.jsx)(`code`,{className:`mb-1.5 block min-w-0 break-all rounded bg-panel px-1.5 py-1 text-[11px] text-fg/85`,children:n}):null,(0,V.jsx)(`span`,{className:Q1,children:e.reason}),(0,V.jsxs)(`span`,{className:`mt-1.5 block text-[11px] text-muted`,children:[`Rule `,(0,V.jsx)(`code`,{className:`rounded bg-panel px-1 py-0.5`,children:e.rule}),t&&t>1?` · ${t} denials this session`:``]})]})}function J5({slug:e,className:t=`px-4 pb-2 pt-1`,includeAgents:n=!0,transcriptShells:r=[],parentAgentId:i}){let a=iC($A(),e),o=a?.subAgents??[],s=n?i?dN(o,i):o:[],c=i?[...r]:hN(a?.bgShells??[],r),l=i?[]:(a?.watches??[]).filter(e=>e.kind===`github`),u=s.length+c.length+l.length,d=new Set((a?.watches??[]).filter(e=>e.kind===`shell`&&e.state===`armed`).map(e=>e.target)),f=e=>d.has(e.taskId??``)||d.has(e.id??``)||d.has(e.label),[,p]=(0,B.useState)(0);(0,B.useEffect)(()=>{if(u===0)return;let e=setInterval(()=>p(e=>e+1),3e4);return()=>clearInterval(e)},[u]);let m=fj(e,c.flatMap(e=>e.id&&!e.outputUnavailable?[e.id]:[]));return u===0?null:(0,V.jsxs)(`div`,{className:`flex flex-col gap-0.5 ${t}`,"data-background-ops":!0,children:[pN(s,`sheet`).map((t,n)=>(0,V.jsx)(gN,{kind:`AGENT`,label:t.label,state:t.state,density:`sheet`,depth:t.displayDepth??t.depth,startedAt:t.startedAt,onOpen:t.id?()=>VS(e,t.id,{label:t.label,subagentType:t.subagentType,startedAt:t.startedAt}):void 0,onDismiss:vN(e,t)},`a${n}`)),pN(c,`sheet`).map((t,n)=>(0,V.jsx)(gN,{kind:`SHELL`,label:t.label,state:t.state,density:`sheet`,startedAt:t.startedAt,counter:t.id?oN(m.get(t.id)):void 0,counterTitle:`Lines of output so far — open the row to read them`,onOpen:t.id&&!t.outputUnavailable?()=>HS(e,t.id,{label:t.label,startedAt:t.startedAt}):void 0,onDismiss:vN(e,t,`SHELL`),title:f(t)?`${t.label}\nWatched — this thread wakes when it finishes`:void 0},`s${n}`)),l.map(e=>(0,V.jsx)(gN,{kind:`GITHUB`,label:e.target,state:`running`,density:`sheet`,startedAt:e.createdAt,onOpen:()=>window.open(nJ(e.target)??`https://github.com/${e.target.replace(`#`,`/pull/`)}`,`_blank`,`noreferrer,noopener`)},e.id))]})}function Y5({ask:e,onTerminal:t}){return(0,V.jsxs)(Z1,{tone:`attention`,icon:BC,label:`Waiting on your answer — in your external terminal`,children:[(0,V.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e.header&&(0,V.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-muted/55`,children:e.header}),(0,V.jsx)(`div`,{className:`min-w-0 text-[12px] font-medium leading-5 text-fg`,children:e.question}),e.options.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.options.map((e,t)=>(0,V.jsxs)(`div`,{className:`rounded-md border border-border bg-elevated px-3 py-1.5 text-[12px] text-fg/80`,children:[(0,V.jsx)(`span`,{className:`font-medium text-fg/90`,children:e.label}),e.description&&(0,V.jsxs)(`span`,{className:`text-muted/70`,children:[` — `,e.description]})]},t)),e.multiSelect&&(0,V.jsx)(`div`,{className:`text-[10px] text-muted/50`,children:`select one or more`})]})]},t))}),(0,V.jsx)($1,{children:(0,V.jsxs)(`button`,{onClick:()=>t(),onMouseDown:e=>e.preventDefault(),className:n0,children:[(0,V.jsx)(aw,{size:12,className:`shrink-0 ${l2}`}),`Copy terminal command`]})})]})}function X5({call:e,sourceId:t}){let n=x8(),r=e.detail??`sub-agent`,{tail:i}=O4(e),a=!!(n&&e.agentId);return(0,V.jsxs)(i0,{icon:kC,sourceId:t,marker:`agent`,ariaLabel:a?void 0:`Sub-agent ${r} ${i}`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`Sub-agent`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`«`}),a?(0,V.jsx)(`button`,{type:`button`,"data-subagent-completion-open":!0,title:aN.AGENT,"aria-label":`${aN.AGENT}: ${r}`,onClick:()=>VS(n,e.agentId,{label:r,subagentType:e.subagentType}),onMouseDown:e=>e.preventDefault(),className:`min-w-0 truncate rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:r}):(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`»`})]}),(0,V.jsx)(`span`,{className:`shrink-0`,children:i})]})}function Z5({from:e,unnamed:t,dispatchId:n,sourceId:r}){let i=x8(),a=!!(i&&n),o=t?void 0:e,s=t&&e?`${aN.AGENT} — ${e}`:aN.AGENT;return o===void 0?(0,V.jsx)(i0,{icon:kC,sourceId:r,marker:`agent-report`,ariaLabel:a?void 0:`Sub-agent reported`,children:a?(0,V.jsx)(`button`,{type:`button`,"data-subagent-report-open":!0,title:s,"aria-label":`${aN.AGENT}${e?`: ${e}`:``}`,onClick:()=>VS(i,n,{label:`Sub-agent`,subagentType:e}),onMouseDown:e=>e.preventDefault(),className:`shrink-0 rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:`Sub-agent reported`}):(0,V.jsx)(`span`,{className:`shrink-0`,title:e||void 0,children:`Sub-agent reported`})}):(0,V.jsxs)(i0,{icon:kC,sourceId:r,marker:`agent-report`,ariaLabel:a?void 0:`Sub-agent ${o} reported`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`Sub-agent`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`«`}),a?(0,V.jsx)(`button`,{type:`button`,"data-subagent-report-open":!0,title:aN.AGENT,"aria-label":`${aN.AGENT}: ${o}`,onClick:()=>VS(i,n,{label:o,subagentType:e}),onMouseDown:e=>e.preventDefault(),className:`min-w-0 truncate rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:o}):(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:o}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`»`})]}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`reported`})]})}function Q5({to:e,type:t,dispatchId:n,targetLabel:r,sourceId:i}){let a=x8(),o=E5(e,t),s=e===`main`?void 0:r??e,c=!!(a&&n);return(0,V.jsxs)(i0,{icon:kC,sourceId:i,marker:`agent-steer`,ariaLabel:c?void 0:`${o}${s?` ${s}`:``}`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:o}),s&&(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`«`}),c?(0,V.jsx)(`button`,{type:`button`,"data-subagent-steer-open":!0,title:aN.AGENT,"aria-label":`${aN.AGENT}: ${s}`,onClick:()=>VS(a,n,{label:s}),onMouseDown:e=>e.preventDefault(),className:`min-w-0 truncate rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:s}):(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:s}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`»`})]})]})}function $5({text:e,boundary:t,sourceId:n}){return t?(0,V.jsx)(i0,{icon:t===`wake`?Ew:void 0,sourceId:n,marker:t===`rest`?`rest`:`event`,ariaLabel:e,children:e}):(0,V.jsx)(`div`,{"data-frizz-msg":n,className:M4,children:e})}function e7({text:e,sourceId:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useId)();return(0,V.jsxs)(`div`,{"data-frizz-msg":t,className:`flex flex-col`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":i,"aria-expanded":n,"aria-label":`${n?`Collapse`:`Expand`} model reasoning`,className:`${M4} flex items-baseline gap-1.5 self-start rounded outline-none transition-colors hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:[(0,V.jsx)(`span`,{children:`Reasoning`}),(0,V.jsx)(PC,{"aria-hidden":`true`,size:13,className:P4(n)})]}),n&&(0,V.jsx)(`div`,{id:i,className:`frizz-reasoning mt-1.5 ml-[5px] border-l border-border/70 pl-3`,children:(0,V.jsx)(P5,{md:e,wrap:!0})})]})}function t7(){return(0,V.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-full border border-muted/70 border-t-transparent animate-spin`})}function n7({since:e,startedAt:t,activityLabel:n,run:r}){let[i]=(0,B.useState)(()=>Date.now()),a=(0,B.useMemo)(()=>{for(let n of[t,e]){let e=Date.parse(n??``);if(Number.isFinite(e)&&e<=Date.now())return e}return i},[t,e,i]),[o,s]=(0,B.useState)(()=>Date.now()),[c,l]=(0,B.useState)(!1),u=(0,B.useId)();(0,B.useEffect)(()=>{let e=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(e)},[]);let d=qM(Math.max(0,o-a)),f=(0,B.useMemo)(()=>i5([...r?.tools??[]]),[r]),p=f.reduce((e,t)=>e+t.count,0),m=p>0,h=`group flex min-w-0 items-baseline justify-between gap-3 rounded text-left outline-none focus-visible:ring-1 focus-visible:ring-fg/60 ${M4}`,g=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate shimmer-text`,children:n??t8(p)}),m&&(0,V.jsx)(PC,{"data-working-chevron":!0,"aria-hidden":`true`,size:13,className:P4(c)})]}),(0,V.jsx)(`span`,{className:`shrink-0 whitespace-nowrap tabular-nums text-[12px] text-muted/60`,children:d})]});return(0,V.jsxs)(`div`,{"data-working-indicator":!0,"data-working-activity":n?`tool`:`generic`,className:`flex min-w-0 flex-col`,children:[m?(0,V.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":u,"aria-expanded":c,"aria-label":`${c?`Collapse`:`Expand`} ${p} tool ${p===1?`call`:`calls`}${n?`: ${n}`:``}`,className:`${h} w-full`,children:g}):(0,V.jsx)(`div`,{className:h,children:g}),m&&c&&(0,V.jsx)(`div`,{id:u,className:`mt-1.5 flex flex-col`,children:e5(f.map((e,t)=>(0,V.jsx)(l5,{t:e,startedAt:r?.at},t)),6)}),m&&!c&&(0,V.jsx)(`div`,{id:u,hidden:!0})]})}function r7(){let[e,t]=(0,B.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: 800px)`).matches);return(0,B.useEffect)(()=>{let e=window.matchMedia(`(max-width: 800px)`),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function i7({id:e,slug:t,depth:n,widthDepth:r,initiallyOpen:i}){let{shown:a,close:o,closingRef:s}=lC(e,i===!0),[c,l]=(0,B.useState)(i===!0),u=(0,B.useRef)(null),d=(0,B.useRef)(null),f=[...Hf(Z).drawers].reverse().find(e=>!e.closing)?.id===e,p=r7(),m=(0,B.useRef)(typeof document<`u`&&document.activeElement instanceof HTMLElement?document.activeElement:null),h=(0,B.useCallback)(()=>{let e=m.current,t=document.activeElement;t&&t!==document.body||e?.isConnected&&e.focus({preventScroll:!0})},[]);(0,B.useEffect)(()=>()=>{window.setTimeout(h,0)},[h]);let g=$A(),_=gx(g,t),v=_.kind===`found`?_.thread:void 0;g?.projectDir;let y=v?v.runtime===`turn-idle`||v.runtime===`exited`||v.runtime===`none`:!1;return(0,B.useEffect)(()=>{!v||!y||X.threadSeen({slug:t}).catch(()=>{})},[t,y,y?v?.lastActivityAt:void 0]),(0,B.useEffect)(()=>{let t=u.current;if(!t||!c)return;let n=()=>t.querySelector(`[data-drawer-scroll-ready]`),r=()=>t.querySelector(`[data-drawer-transcript-scroll]`),i=new jY({isActive:()=>[...Z.drawers].reverse().find(e=>!e.closing)?.id===e,isContentReady:()=>n()?.dataset.drawerScrollReady===`true`,scrollToBottom:()=>{let e=r();return e?(e.scrollTop=e.scrollHeight,!0):!1},preserveAnchor:()=>location.hash.length>1});d.current=i;let a=null,o=new ResizeObserver(()=>i.layoutChanged()),s=()=>{let e=n();e!==a&&(a&&o.unobserve(a),a=e,e&&o.observe(e)),i.layoutChanged()},l=new MutationObserver(s);l.observe(t,{attributes:!0,attributeFilter:[`data-drawer-scroll-ready`],childList:!0,subtree:!0});let f=()=>i.userIntent(),p=e=>{[`Shift`,`Control`,`Alt`,`Meta`].includes(e.key)||f()};return t.addEventListener(`wheel`,f,{capture:!0,passive:!0}),t.addEventListener(`touchstart`,f,{capture:!0,passive:!0}),t.addEventListener(`pointerdown`,f,!0),t.addEventListener(`keydown`,p,!0),s(),()=>{i.dispose(),d.current===i&&(d.current=null),t.removeEventListener(`wheel`,f,!0),t.removeEventListener(`touchstart`,f,!0),t.removeEventListener(`pointerdown`,f,!0),t.removeEventListener(`keydown`,p,!0),o.disconnect(),l.disconnect()}},[c,e]),(0,B.useEffect)(()=>{d.current?.activationChanged()},[f]),(0,B.useEffect)(()=>{if(i)return;let e=!1,t=()=>{e||s.current||(e=!0,l(!0))},n=0,r=requestAnimationFrame(()=>{n=requestAnimationFrame(t)}),a=window.setTimeout(t,120);return()=>{window.clearTimeout(a),cancelAnimationFrame(r),n&&cancelAnimationFrame(n)}},[i]),(0,B.useEffect)(()=>{let e=u.current;if(!c||!e||document.activeElement!==e)return;let t=requestAnimationFrame(()=>{e.querySelector(`[data-dialog-initial-focus]`)?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(t)},[c]),(0,B.useEffect)(()=>(ux(e,()=>{(u.current?.querySelector(`[data-dialog-initial-focus]`)??u.current)?.focus({preventScroll:!0})}),()=>ux(e,null)),[e]),(0,V.jsx)(FV,{modal:p,open:!0,onOpenChange:e=>{e||o()},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`${aC} ${a?`opacity-100`:`opacity-0`}`,style:{zIndex:50+n*2}}),(0,V.jsxs)(qV,{ref:u,"aria-modal":p||void 0,"aria-describedby":void 0,tabIndex:-1,onEscapeKeyDown:_U,onPointerDownOutside:n=>{let r=Z.drawers.findIndex(t=>t.id===e);if(r!==-1&&r<Z.drawers.length-1){n.preventDefault();return}(n.target instanceof Element?n.target.closest(`[data-subagent-parent]`):null)?.getAttribute(`data-subagent-parent`)===t&&n.preventDefault()},onFocusOutside:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),h()},onOpenAutoFocus:e=>{e.preventDefault();let t=u.current;(t?.querySelector(`[data-dialog-initial-focus]`)??t)?.focus({preventScroll:!0})},className:`fixed right-0 top-0 overflow-hidden outline-none ${oC} ${a?`translate-x-0`:`translate-x-full`}`,style:{zIndex:51+n*2,width:sC(r)},children:[(0,V.jsx)(QV,{className:`sr-only`,children:_.kind===`found`?`Thread: ${Uj(_.thread)}`:`Thread: ${t}`}),c&&_.kind===`found`?(0,V.jsx)(E8,{slug:t,onStatusApplied:o,onClose:o,virtualized:!0}):c&&_.kind===`missing`?(0,V.jsx)(a7,{slug:t,onClose:o}):(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,V.jsx)(`span`,{className:`block h-5 w-5 rounded-full border-2 border-muted/50 border-t-transparent animate-spin`})})]})]})})}function a7({slug:e,onClose:t}){return(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,V.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-border bg-panel px-4`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:`Thread unavailable`}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Close`,"data-dialog-initial-focus":!0,onClick:t,className:`p-1 text-muted hover:text-fg`,children:`×`})]}),(0,V.jsxs)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-muted`,role:`status`,children:[`Thread “`,e,`” was not found in this project.`]})]})}var o7=new Set([`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]);function s7(e,t){let n=e.lastIndexOf(t);if(n<=0)return{model:e};let r=e.slice(n+1);return o7.has(r)?{model:e.slice(0,n),effort:r}:{model:e}}function c7(e){let t=e?.trim();if(!t)return`Profile unknown`;if(t.startsWith(`frizz:`)){let{model:e,effort:n}=s7(t.slice(6).replace(/^frizz-/,``),`-`);return n?`${e} › ${n}`:e}let n=t.split(/\s+/),{model:r,effort:i}=s7(n.at(-1)??t,`/`);if(!i)return t;let a=n.slice(0,-1).join(` `);return`${a?`${a} · `:``}${r} › ${i}`}function l7({id:e,slug:t,subId:n,label:r,subagentType:i,startedAt:a,depth:o,widthDepth:s}){let[c,l]=(0,B.useState)(!1),u=(0,B.useRef)(null),d=uj(t,n),f=ej(),p=(0,B.useMemo)(()=>d.data?.messages??[],[d.data]),m=d.data?.state,h=m===`running`,g=(0,B.useMemo)(()=>w8(p),[p]),_=(0,B.useMemo)(()=>T8(p),[p]),v=(0,B.useMemo)(()=>R6(_),[_]),y=h?V6(v):void 0,b=h?B6(v):void 0,x=b?X6(b,f):void 0,S=h?U6(v):void 0,C=(0,B.useMemo)(()=>h?G6(v):v,[v,h]),w=h,T=d.isError||m===`gone`||p.length===0&&(m===`done`||m===`stale`);return(0,B.useEffect)(()=>{let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>l(!0))});return()=>{cancelAnimationFrame(t),e&&cancelAnimationFrame(e)}},[]),(0,B.useEffect)(()=>{let e=u.current;if(!e||!c)return;let t=!0,n=()=>{t&&(e.scrollTop=e.scrollHeight)},r=()=>{t=e.scrollHeight-e.scrollTop-e.clientHeight<160};e.addEventListener(`scroll`,r,{passive:!0});let i=new ResizeObserver(n);for(let t of e.children)i.observe(t);return n(),()=>{e.removeEventListener(`scroll`,r),i.disconnect()}},[c]),(0,V.jsx)(pC,{id:e,depth:o,widthDepth:s,children:e=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Mw,{title:r,onClose:e}),(0,V.jsx)(`div`,{ref:u,className:`flex-1 min-h-0 overflow-y-auto`,children:T?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center px-8 text-center text-[13px] text-muted`,children:`Transcript unavailable (agent completed or cleaned up).`}):!c||d.isLoading||p.length===0?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,V.jsx)(`span`,{className:`block h-5 w-5 rounded-full border-2 border-muted/50 border-t-transparent animate-spin`})}):(0,V.jsx)(b8.Provider,{value:t,children:(0,V.jsxs)(`div`,{"data-transcript-column":!0,className:`flex flex-col px-6 py-5`,children:[Q8(C.map(e=>e.message),(e,t)=>(0,V.jsx)(M5,{m:e},t)),w&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(r0,{h:Z8(C.map(e=>e.message))}),(0,V.jsx)(n7,{since:a,startedAt:S,activityLabel:x,run:y})]})]})})}),(0,V.jsx)(u7,{slug:t,subId:n,subagentType:i,steerable:d.data?.steerable===!0,note:d.data?.steerNote??null,stoppable:d.data?.stoppable===!0,stopNote:d.data?.stopNote??null,ops:e=>(0,V.jsx)(J5,{slug:t,parentAgentId:n,transcriptShells:g,className:e})})]})})}function u7({slug:e,subId:t,subagentType:n,steerable:r,note:i,stoppable:a,stopNote:o,ops:s}){let[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(!1),m=Md();function h(){let n=c.trim();!n||u||(d(!0),l(``),X.subAgentSteer({slug:e,id:t,message:n}).then(()=>{m.invalidateQueries({queryKey:[`subAgentTranscript`,e,t]}),Q(`Steer sent`)}).catch(e=>{l(n),Q(e instanceof Error?e.message:`Could not steer this sub-agent`)}).finally(()=>d(!1)))}function g(){f||(p(!0),X.subAgentStop({slug:e,id:t}).then(({descendantsStopped:n,note:r})=>{r?Q(`Sub-agent stopped. ${r}`,{duration:7e3}):Q(n>0?`Sub-agent and ${n} descendant${n===1?``:`s`} stopped`:`Sub-agent stopped`),m.invalidateQueries({queryKey:[`subAgentTranscript`,e,t]})}).catch(e=>{Q(e instanceof Error?e.message:`Could not stop this sub-agent`)}).finally(()=>p(!1)))}if(!r&&!a){let e=i??o;return e?(0,V.jsxs)(`div`,{"data-subagent-steer-note":!0,className:`w-full shrink-0 border-t border-border bg-panel px-3 py-3`,children:[(0,V.jsx)(`div`,{className:`px-1 pb-2 text-[11.5px] text-muted/70`,children:e}),(0,V.jsx)(`div`,{className:`pl-1.5`,children:(0,V.jsx)(d7,{subagentType:n})}),s?.(`px-1 pt-1.5 ops-column-optical-inset`)]}):(0,V.jsx)(V.Fragment,{children:s?.(`w-full shrink-0 border-t border-border bg-panel px-4 pb-2 pt-3`)})}return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{"data-subagent-steer":!0,className:`w-full shrink-0 border-t border-border bg-panel px-3 py-3`,children:[r?(0,V.jsx)(KH,{value:c,onChange:l,onSubmit:h,surface:`subAgentComposer`,placeholder:`Steer this sub-agent…`,busy:u||f,footer:(0,V.jsx)(d7,{subagentType:n})}):i?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`px-1 pb-2 text-[11.5px] text-muted/70`,children:i}),(0,V.jsx)(`div`,{className:`pl-1.5`,children:(0,V.jsx)(d7,{subagentType:n})})]}):null,r&&!a&&o&&(0,V.jsx)(`div`,{className:`mt-2 px-1 text-[11.5px] text-muted/70`,children:o}),s?.(`px-1 pt-1.5 ops-column-optical-inset`)]}),a&&(0,V.jsx)(`footer`,{"aria-label":`Sub-agent lifecycle actions`,"data-subagent-lifecycle-footer":!0,className:`flex min-h-10 w-full shrink-0 items-center justify-end gap-1.5 border-t border-border/70 bg-panel/95 px-3 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] text-[12px] backdrop-blur-sm`,children:(0,V.jsx)(`button`,{type:`button`,"data-stop-subagent":!0,disabled:f,onClick:g,className:`rounded-md border border-border-strong bg-panel-2/60 px-2.5 py-1 text-[12px] text-fg/80 transition-colors hover:border-red-400/40 hover:bg-red-400/10 hover:text-red-300 disabled:opacity-50`,children:f?`Stopping…`:`Stop sub-agent`})})]})}function d7({subagentType:e}){let t=c7(e);return(0,V.jsx)(`span`,{"data-subagent-profile":!0,"aria-label":`Sub-agent profile: ${t}`,title:e?.trim()||`The provider did not report this sub-agent's model and effort`,className:`inline-flex min-w-0 max-w-[min(72%,20rem)] items-center rounded-md border border-border/50 bg-transparent px-1.5 py-0.5 text-muted ${ZH}`,children:(0,V.jsx)(`span`,{className:`profile-grid-value relative -top-px min-w-0 truncate`,children:t})})}var f7=`font-mono-keep overflow-x-auto whitespace-pre-wrap break-words ${W1} border border-border bg-bg/75 px-4 py-2.5 text-[12px] leading-relaxed text-fg/85`;function p7({id:e,slug:t,shellId:n,label:r,startedAt:i,depth:a,widthDepth:o}){let s=(0,B.useRef)(null),c=dj(t,n),l=c.data?.state,u=c.data?.command,d=c.data?.output??``,[f,p]=(0,B.useState)(!1),m=Md();(0,B.useEffect)(()=>{let e=s.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<160&&(e.scrollTop=e.scrollHeight)},[d]);let h=ZM(i),g=l===`running`?`running${h?` ${h}`:``}`:l===`done`?`finished`:l===`gone`?`unavailable`:``,_=c.isError||l===`gone`;function v(){f||(p(!0),X.subAgentStop({slug:t,id:n}).then(({note:e})=>{e?Q(`Background shell stopped. ${e}`,{duration:7e3}):Q(`Background shell stopped — the worker was told`),m.invalidateQueries({queryKey:[`backgroundShellOutput`,t,n]})}).catch(e=>{Q(e instanceof Error?e.message:`Could not stop this background shell`)}).finally(()=>p(!1)))}async function y(){if(u)try{await bU(u),Q(`Command copied`)}catch{Q(`Could not copy command`)}}return(0,V.jsx)(pC,{id:e,depth:a,widthDepth:o,children:e=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Mw,{title:r,icon:(0,V.jsx)(Ew,{"aria-hidden":!0,size:14,className:`shrink-0 text-muted/60`}),meta:g?(0,V.jsx)(`span`,{className:`shrink-0 whitespace-nowrap text-[11.5px] text-muted/60`,children:g}):void 0,onClose:e}),(0,V.jsx)(`div`,{ref:s,className:`min-h-0 flex-1 overflow-y-auto px-5 py-5`,children:_?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center px-8 text-center text-[13px] text-muted`,children:`Background shell output is no longer available.`}):(0,V.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,V.jsxs)(`section`,{children:[(0,V.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h2`,{className:`petite-caps text-[10px] text-muted/65`,children:`Command`}),u&&(0,V.jsxs)(`button`,{type:`button`,onClick:y,className:`flex items-center gap-1 rounded px-1.5 py-1 text-[10.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:[(0,V.jsx)(WC,{"aria-hidden":!0,size:11}),` Copy`]})]}),u?(0,V.jsx)(n1,{"data-background-shell-command":!0,text:u,language:`bash`,className:f7}):(0,V.jsx)(`pre`,{"data-background-shell-command":!0,className:f7,children:c.isLoading?`Loading…`:`Command unavailable for this background operation.`})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,V.jsx)(`h2`,{className:`petite-caps text-[10px] text-muted/65`,children:`Output`}),l===`running`&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`shell-drawer`}),c.data?.truncated&&(0,V.jsx)(`span`,{className:`text-[10.5px] text-muted/50`,children:`Showing latest 512 KB`})]}),d?(0,V.jsx)(`pre`,{"data-background-shell-output":!0,className:`font-mono-keep min-h-40 whitespace-pre-wrap break-words ${W1} border border-border bg-[#090b10] px-4 py-3 text-[12px] leading-relaxed text-fg/85`,children:d}):(0,V.jsx)(`div`,{"data-background-shell-output":!0,className:`flex min-h-40 items-center justify-center ${W1} border border-border bg-[#090b10] px-4 text-center text-[12px] text-muted/60`,children:l===`done`?`No output was captured.`:`No output yet.`})]})]})}),!_&&c.data?.stoppable&&(0,V.jsx)(`footer`,{"aria-label":`Background shell lifecycle actions`,"data-background-shell-lifecycle-footer":!0,className:`flex min-h-10 w-full shrink-0 items-center justify-end gap-1.5 border-t border-border/70 bg-panel/95 px-3 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] text-[12px] backdrop-blur-sm`,children:(0,V.jsx)(`button`,{type:`button`,"data-stop-background-shell":!0,disabled:f,onClick:v,className:`rounded-md border border-border-strong bg-panel-2/60 px-2.5 py-1 text-[12px] text-fg/80 transition-colors hover:border-red-400/40 hover:bg-red-400/10 hover:text-red-300 disabled:opacity-50`,children:f?`Stopping…`:`Stop shell`})}),!_&&!c.data?.stoppable&&l===`running`&&c.data?.stopNote&&(0,V.jsx)(`footer`,{"data-background-shell-stop-note":!0,className:`w-full shrink-0 border-t border-border/70 bg-panel/95 px-4 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] text-[11.5px] text-muted/70`,children:c.data.stopNote})]})})}var m7={paddingBottom:`max(0.75rem, env(safe-area-inset-bottom))`};function h7({path:e}){return(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{X.openLocalFile({path:e}).then(async e=>{e.action===`copy`&&(await bU(e.path),Q(`Copied local path`))}).catch(e=>Q(`Could not open local file: ${e.message.slice(0,100)}`))},onMouseDown:e=>e.preventDefault(),className:`flex items-center gap-1.5 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-fg/60`,title:`Open ${e} outside Frizz`,"aria-label":`Open`,children:[(0,V.jsx)(KC,{size:12,"aria-hidden":`true`}),` Open`]})}function g7({id:e,path:t,title:n,depth:r,widthDepth:i}){let a=qd({queryKey:[`localMarkdown`,t],queryFn:()=>X.localMarkdown({path:t})}),o=a.data?.path??t,s=s$(a.data?.markdown??``,{baseDir:WH(o),asDocument:!0}),c=t1(s),l=(0,B.useRef)(null);return q0(l,s),(0,V.jsx)(pC,{id:e,depth:r,widthDepth:i,children:e=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Mw,{title:n,subtitle:o,onClose:e}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4`,children:a.isLoading?(0,V.jsx)(`div`,{className:`text-[13px] text-muted`,children:`Loading…`}):a.error?(0,V.jsxs)(`div`,{className:`text-[13px] text-red-400/90`,children:[`Couldn’t read this file: `,a.error.message]}):s?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{ref:l,className:`md-body`,dangerouslySetInnerHTML:c}),a.data?.truncated&&(0,V.jsx)(`p`,{className:`mt-4 border-t border-border/60 pt-3 text-[12px] text-muted`,children:`This file is too long to render in full — everything above the cut is shown. Open it to read the rest.`})]}):(0,V.jsx)(`div`,{className:`text-[13px] text-muted`,children:`This file is empty.`})}),(0,V.jsx)(`div`,{className:`shrink-0 flex items-center justify-end gap-1.5 border-t border-border/60 bg-panel px-5 pt-3`,style:m7,children:(0,V.jsx)(h7,{path:o})})]})})}function _7({id:e,slug:t,title:n,depth:r,widthDepth:i}){let a=qd({queryKey:[`threadBody`,t],queryFn:()=>X.threadBody({slug:t})}),o=Hf(Z);(0,B.useEffect)(()=>{a.refetch()},[o.board]);let s=d2(iC(o.board,t)),c=iW(),l=rW.adopt(c,t),[u,d,f]=oW(l),p=Jd({mutationFn:async e=>{await X.adoptThread({slug:t,message:e.trim()||void 0})},onSuccess:()=>{Z.drawers.find(t=>t.id===e)?.closing||(Z.drawers=Z.drawers.map(t=>t.id===e?{...t,kind:`thread`}:t))},onError:(e,t)=>{tW.get(l)||d(t),Q(`Start failed: ${e.message.slice(0,80)}`)}}),m=s$(JQ(a.data?.markdown??``)),h=t1(m);return(0,V.jsx)(pC,{id:e,depth:r,widthDepth:i,widthOffset:1,subagentParent:t,children:e=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Mw,{title:n,subtitle:`${t}.md`,onClose:e}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4`,children:a.isLoading?(0,V.jsx)(`div`,{className:`text-[13px] text-muted`,children:`Loading…`}):m?(0,V.jsx)(`div`,{className:`md-body`,dangerouslySetInnerHTML:h}):(0,V.jsx)(`div`,{className:`text-[13px] text-muted`,children:`No thread file found.`})}),s&&(0,V.jsxs)(`div`,{className:`shrink-0 border-t border-border/60 px-5 pb-4 pt-3`,children:[(0,V.jsx)(`p`,{className:`mb-2.5 text-[11.5px] text-muted/80`,children:`No session is attached to this thread yet. Send a message below to start one on this plan.`}),(0,V.jsx)(KH,{surface:`adoptComposer`,value:u,onChange:d,onSubmit:()=>{if(!u.trim()||p.isPending)return;let e=u;f(),Q(`Starting thread…`,{spinner:!0,sticky:!0}),p.mutate(e)},placeholder:`Kick off work on this thread…`,minHeight:44,busy:p.isPending})]})]})})}function v7(){let e=Hf(Z),t=$A();(0,B.useEffect)(()=>{function e(e){if(e.key===`Escape`&&!(e.target instanceof Element&&e.target.closest(`.xterm`))){if(gU()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(Z.showPalette)Z.showPalette=!1;else if(Z.showNewThread)Z.showNewThread=!1;else if(Z.showGithubPicker)NS();else if(Z.showSettings)ax()||(Z.showSettings=!1);else if(Z.drawers.length>0){let e=Z.drawers[Z.drawers.length-1];lx(e.id)||Z.drawers.pop()}}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let n=0;return(0,V.jsx)(V.Fragment,{children:e.drawers.map((e,r)=>{let i=n;e.closing||n++;let a=e.kind===`thread`?(0,V.jsx)(i7,{id:e.id,slug:e.slug,depth:r,widthDepth:i,initiallyOpen:e.routed},e.id):e.kind===`subagent`?(0,V.jsx)(l7,{id:e.id,slug:e.slug,subId:e.subId??``,label:e.label??e.slug,subagentType:e.subagentType,startedAt:e.startedAt,depth:r,widthDepth:i},e.id):e.kind===`shell`?(0,V.jsx)(p7,{id:e.id,slug:e.slug,shellId:e.subId??``,label:e.label??`Background shell`,startedAt:e.startedAt,depth:r,widthDepth:i},e.id):e.kind===`markdown`?(0,V.jsx)(g7,{id:e.id,path:e.path??e.slug,title:e.label??e.slug,depth:r,widthDepth:i},e.id):(0,V.jsx)(_7,{id:e.id,slug:e.slug,depth:r,widthDepth:i,title:(()=>{let n=iC(t,e.slug);return n?Uj(n):e.slug})()},e.id);return(0,V.jsx)(Pw,{label:`this drawer`,resetKeys:[e.kind,e.slug,e.subId,e.path],fallback:(t,n)=>(0,V.jsx)(Rw,{id:e.id,depth:r,widthDepth:i,error:t,onRetry:n}),children:a},e.id)})})}function y7(e){let t=d1(e).filter(e=>e.kind===`question`);if(t.length!==0)return JSON.stringify(t.map(e=>e.kind===`question`?[e.questionKind,e.danger===!0,e.text.trim()]:null))}function b7(e){let t=new Map,n=[];for(let r=0;r<e.length;r++){let i=y7(e[r].text);n.push(i),i!==void 0&&t.set(i,r)}let r=new Set;for(let e=0;e<n.length;e++){let i=n[e];i!==void 0&&t.get(i)!==e&&r.add(e)}return r}function x7(e,t,n){return m1(e.text)?!n.has(t):e.wake===!0}function S7(e){return e.wake===!0}function C7(e,t){let n=[],r,i=!1,a=()=>{r&&r.start<=r.end&&n.push(r),r=void 0};for(let n=Math.max(0,t);n<e.length;n++){let t=e[n];if(t.closes===!0){a(),i=!0;continue}if(t.skip===!0)continue;if(t.opens===!0){a(),i=!0,r={start:n+1,end:n,open:-1,close:-1,steps:0,tools:0,resumed:!0,waker:-1};continue}let o=r===void 0;r||={start:n,end:n,open:-1,close:-1,steps:0,tools:0,resumed:i,waker:-1},o&&t.completion===!0&&r.resumed&&(r.waker=n),r.end=n,r.tools+=t.tools??0,t.text===!0&&(r.open<0&&(r.open=n),r.close=n)}a();for(let t of n)for(let n=t.start;n<=t.end;n++){let r=e[n];r.skip===!0||r.survives===!0||n===t.open||n===t.close||n===t.waker||r.countable===!0&&t.steps++}return n}function w7(e){return e.open<0||e.tools<1&&e.steps<1?!1:e.resumed||e.open!==e.close}function T7(e){if(e.length<3)return{kept:[...e]};let t=e[0],n=e[e.length-1],r=e.slice(1,-1);return{kept:[t,n],middle:{start:Math.max(t.end+1,r[0].start-1),end:r[r.length-1].end,runs:r.length,tools:r.reduce((e,t)=>e+t.tools,0)}}}function E7(e){return pN(e,`card`).length>0}function D7({slug:e,subAgents:t,className:n=`px-1 pt-1.5`}){let r=pN(t,`card`);return r.length===0?null:(0,V.jsx)(`div`,{"data-queue-subagents":!0,className:`flex min-w-0 flex-col gap-0.5 ${n}`,children:r.map((t,n)=>(0,V.jsx)(gN,{kind:`AGENT`,label:t.label,state:t.state,density:`card`,depth:t.depth,startedAt:t.startedAt,parentSlug:e,onOpen:t.id?()=>VS(e,t.id,{label:t.label,subagentType:t.subagentType,startedAt:t.startedAt}):void 0,onDismiss:vN(e,t)},t.id??`${t.startedAt}-${n}`))})}var O7=320;function k7(e){let t=[...document.querySelectorAll(`[data-queue-card]`)],n=t.findIndex(t=>t.dataset.queueCard===e);if(n<0)return null;let r=window.innerHeight,i=e=>{if(!e||e.dataset.queueLeaving===`true`||!e.dataset.queueCard)return!1;let t=e.getBoundingClientRect();return t.bottom>0&&t.top<r},a=i(t[n-1])?t[n-1]:i(t[n+1])?t[n+1]:null;return a?{slug:a.dataset.queueCard,top:a.getBoundingClientRect().top}:null}function A7(e){let t=[...document.querySelectorAll(`[data-queue-card]`)],n=t.findIndex(t=>t.dataset.queueCard===e);if(n<0)return null;let r=e=>e.dataset.queueLeaving!==`true`&&!!e.dataset.queueCard;for(let e=n+1;e<t.length;e++)if(r(t[e]))return t[e].dataset.queueCard;for(let e=n-1;e>=0;e--)if(r(t[e]))return t[e].dataset.queueCard;return null}var j7=0,M7=``;function N7(){j7++===0&&(M7=document.documentElement.style.overflowAnchor,document.documentElement.style.overflowAnchor=`none`)}function P7(){j7>0&&--j7===0&&(document.documentElement.style.overflowAnchor=M7)}var F7=`Hides card until new activity is detected`;function I7({thread:e,onSnooze:t,onSnoozeFailed:n}){let[r,i]=(0,B.useState)(!1);return(0,V.jsx)(o6,{thread:e,actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{i(!0),t(),X.snoozeAwaitingBackground({slug:e.id,sessionId:e.sessionId??``}).then(()=>Q(`Snoozed until the background work returns`)).catch(e=>{n(),Q(`Couldn’t snooze: ${e.message.slice(0,80)}`),i(!1)})},disabled:r,onMouseDown:e=>e.preventDefault(),title:F7,className:`disabled:opacity-45 ${n0}`,children:[(0,V.jsx)(tw,{size:12,className:l2}),`Snooze`]}),(0,V.jsx)(`span`,{className:e0,children:F7})]})})}function L7(){let e=$A(),t=rM(tj(e?.threads??[]).filter(iM),Hf(zj).queueOrder),n=t.map(e=>e.id).join(`,`),[r,i]=(0,B.useState)(()=>new Set),a=(0,B.useRef)(t);a.current=t;let o=(0,B.useRef)(r);o.current=r;let s=new Set(t.map(e=>e.id)),c=(0,B.useRef)([]),l=(0,B.useRef)([]),u=(0,B.useRef)(new Map),d=(0,B.useRef)(new Set),f=(0,B.useRef)(new Set),p=(0,B.useRef)(new Map),m=(0,B.useRef)(new Map),h=(0,B.useRef)(null),[g,_]=(0,B.useState)(0);c.current.forEach(e=>{if(!s.has(e.id)&&!f.current.has(e.id)){let t=l.current.indexOf(e.id);u.current.delete(e.id),u.current.set(e.id,{view:e,index:t>=0?t:l.current.length}),r.has(e.id)&&d.current.add(e.id)}}),c.current=t;for(let e of[...f.current])s.has(e)?r.has(e)||(f.current.delete(e),d.current.delete(e)):r.has(e)||(f.current.delete(e),u.current.delete(e),d.current.delete(e));for(;u.current.size>32;){let e=u.current.keys().next().value;if(e===void 0)break;u.current.delete(e),d.current.delete(e);let t=p.current.get(e);t&&(clearTimeout(t),p.current.delete(e))}let v=e=>s.has(e)?r.has(e):d.current.has(e),y=(0,B.useMemo)(()=>{let e=t.filter(e=>!f.current.has(e.id)),n=[...u.current.entries()].filter(([e])=>!s.has(e)&&!f.current.has(e)).map(([,e])=>e).sort((e,t)=>e.index-t.index);for(let{view:t,index:r}of n)e.splice(Math.min(r,e.length),0,t);return e},[t,r,g]);l.current=y.map(e=>e.id),(0,B.useEffect)(()=>{let e=[...u.current.keys()].filter(e=>!s.has(e)&&!f.current.has(e)),t=e.filter(e=>!d.current.has(e)),n;t.length&&(n=requestAnimationFrame(()=>{t.forEach(e=>{u.current.has(e)&&d.current.add(e)}),_(e=>e+1)}));let i=new Set;for(let e of r)f.current.has(e)||i.add(e);for(let t of e)i.add(t);for(let e of i){if(p.current.has(e))continue;let t=setTimeout(()=>{if(p.current.delete(e),o.current.has(e)){let t=A7(e);h.current=t?{kind:`top`,slug:t}:null}else{let t=k7(e);h.current=t?{kind:`hold`,...t}:null}f.current.add(e),d.current.delete(e),_(e=>e+1)},O7);p.current.set(e,t)}return()=>{n!==void 0&&cancelAnimationFrame(n)}},[n,r,g]),(0,B.useEffect)(()=>{let e=[...r].filter(e=>f.current.has(e)&&!s.has(e));if(e.length!==0){for(let t of e)f.current.delete(t),u.current.delete(t),d.current.delete(t);i(t=>{let n=new Set(t);for(let t of e)n.delete(t);return n})}},[n,g]),(0,B.useEffect)(()=>()=>{for(let e of p.current.values())clearTimeout(e);for(let e of m.current.values())clearTimeout(e)},[]),(0,B.useLayoutEffect)(()=>{let e=h.current;if(!e)return;h.current=null;let t=document.querySelector(`[data-queue-card="${CSS.escape(e.slug)}"]`);if(!t)return;if(e.kind===`hold`){let n=t.getBoundingClientRect().top-e.top;Math.abs(n)>.5&&window.scrollBy({top:n,left:0,behavior:`auto`});return}N7();let n=()=>{let t=AS(e.slug);t!==null&&Math.abs(fx()-t)>.5&&window.scrollTo({top:t,left:0,behavior:`auto`})};n(),requestAnimationFrame(()=>{n(),requestAnimationFrame(()=>{n(),P7()})})},[g]);let b=(0,B.useCallback)(e=>{i(t=>new Set(t).add(e));let t=m.current.get(e);t&&clearTimeout(t);let n=setTimeout(()=>{m.current.delete(e),a.current.some(t=>t.id===e)&&(f.current.delete(e),d.current.delete(e),i(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),_(e=>e+1))},8e3);m.current.set(e,n)},[]),x=(0,B.useCallback)(e=>{let t=m.current.get(e);t&&(clearTimeout(t),m.current.delete(e));let n=p.current.get(e);n&&(clearTimeout(n),p.current.delete(e)),f.current.delete(e),d.current.delete(e),i(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),_(e=>e+1)},[]),S=(e?.threads.length??0)===0;return(0,V.jsxs)(`div`,{className:`my-auto w-full min-w-0 flex flex-col py-8`,children:[(0,V.jsx)(R7,{board:e}),y.length>0&&(0,V.jsx)(`div`,{className:`flex flex-col`,children:y.map((e,t)=>(0,V.jsxs)(B.Fragment,{children:[(0,V.jsx)(yte,{slug:e.id,leaving:v(e.id),children:(0,V.jsx)(Ste,{thread:e,leaving:v(e.id),onResolve:b,onUnresolve:x})}),t<y.length-1&&(0,V.jsx)(`hr`,{className:`my-10 border-0 border-t border-border/60`})]},e.id))}),S?(0,V.jsxs)(`div`,{className:`w-full flex flex-col gap-3`,children:[(0,V.jsx)(`h2`,{className:`text-[15px] font-medium text-center`,children:`What should the agent do?`}),(0,V.jsx)(UK,{}),(0,V.jsx)(cW,{autoFocus:!0})]}):y.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-2 pt-2`,children:[(0,V.jsx)(iw,{size:40,strokeWidth:1.25,className:`text-muted/30`}),(0,V.jsx)(`div`,{className:`text-[13px] text-muted/80`,children:`No threads awaiting human input`})]}):null]})}function R7({board:e}){let t=e?.errorItems??[],n=e?.errors??[];return t.length===0&&n.length===0?null:(0,V.jsxs)(`div`,{className:`mb-6 ${W1} border border-amber-500/25 bg-amber-500/[0.06] px-4 py-2.5 text-[12px] text-amber-200/90`,children:[(0,V.jsx)(`div`,{className:`font-medium mb-0.5`,children:`Board errors`}),t.length>0?t.slice(0,6).map((e,t)=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2 py-0.5`,children:[(0,V.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,title:`${e.file?`${e.file}: `:``}${e.message}`,children:[e.file?`${e.file}: `:``,e.message]}),e.kind===`no-frontmatter`&&(0,V.jsx)(z7,{file:e.file})]},t)):n.slice(0,3).map((e,t)=>(0,V.jsx)(`div`,{className:`truncate`,title:e,children:e},t))]})}function z7({file:e}){let t=Jd({mutationFn:()=>X.repairThread({file:e}),onSuccess:({slug:e})=>Q(`Repaired ${e} — verify its status`),onError:e=>Q(e instanceof Error?e.message:`Repair failed`)});return(0,V.jsx)(`button`,{onClick:()=>t.mutate(),disabled:t.isPending,className:`shrink-0 rounded border border-amber-400/50 bg-amber-500/10 px-2 py-0.5 text-[11px] font-medium text-amber-100 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,title:`Prepend minimal frontmatter (title + status: active) so this thread becomes visible again`,children:t.isPending?`Repairing…`:`Repair`})}function yte({leaving:e,slug:t,children:n}){return(0,V.jsx)(`div`,{"data-queue-card":t,"data-queue-leaving":e,className:`frizz-card-slot min-w-0`,children:(0,V.jsx)(`div`,{className:`frizz-card-clip min-h-0 min-w-0`,children:(0,V.jsx)(`div`,{className:`frizz-card-body min-w-0`,children:n})})})}function bte({runs:e,toolCount:t,onExpand:n}){let r=t>0?`${t} tool call${t===1?``:`s`}`:``,i=`${e} more round${e===1?``:`s`}`;return(0,V.jsxs)(i0,{icon:IC,marker:`middle-runs-summary`,onClick:n,ariaLabel:`Expand ${i}${r?` and ${r}`:``} of intermediate agent activity`,children:[(0,V.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:i}),r&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50`,children:`·`}),(0,V.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:r})]}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50`,children:`·`}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`Click to expand`})]})}function xte({toolCount:e,onExpand:t}){let n=e>0?`${e} tool call${e===1?``:`s`}`:``;return(0,V.jsxs)(i0,{icon:IC,marker:`intermediate-summary`,onClick:t,ariaLabel:`Expand ${n?`${n} of `:``}intermediate agent activity`,children:[n&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:n}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50`,children:`·`})]}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`Click to expand`})]})}var Ste=(0,B.memo)(function({thread:e,leaving:t,onResolve:n,onUnresolve:r}){let[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(null),[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(0),g=(0,B.useRef)(null),_=(0,B.useRef)(null),[v,y]=(0,B.useState)(0),b=(0,B.useRef)(null),x=(0,B.useRef)(!1),S=(0,B.useRef)(!1),C=(0,B.useRef)(null),w=Md(),T=y6(e.id),{stickyUserMessage:E}=Hf(zj);(0,B.useLayoutEffect)(()=>{let e=_.current;if(!e)return;let t=()=>y(e.getBoundingClientRect().height);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[i]);let D=lj(e.id,{poll:!1}),O=(0,B.useMemo)(()=>D.data?.messages??[],[D.data]),k=(0,B.useMemo)(()=>q8(O),[O]),A=e=>k>=0&&e<k,j=(0,B.useMemo)(()=>H1(O),[O]),M=(0,B.useMemo)(()=>{for(let e=O.length-1;e>=0;e--){let t=O[e];if(t.role===`user`&&!t.wake&&!t.queued)return e}return 0},[O]),N=(0,B.useMemo)(()=>{for(let e=O.length-1;e>=0;e--)if(O[e].boundary===`rest`)for(let t=e+1;t<O.length;t++){let n=O[t];if(!(n.queued||n.boundary===`rest`||K8(n,A(t))))return e+1}return 0},[O]),P=(0,B.useMemo)(()=>{for(let e=O.length-1;e>=0;e--)if(O[e].role===`user`&&!O[e].queued)return e;return-1},[O]),ee=(0,B.useMemo)(()=>b7(O),[O]),F=(0,B.useMemo)(()=>O.map((e,t)=>{if(!e||e.queued||K8(e,A(t)))return{skip:!0};if(e.boundary===`rest`)return{skip:!0,closes:!0};let n=E4(e),r=n?0:e.tools.length;return{text:X8(e,A(t)),tools:r,countable:X8(e,A(t))||r>0||n!==void 0||e.kind!==void 0,survives:x7(e,t,ee),opens:S7(e),completion:e.boundary===`wake`||n!==void 0}}),[O,ee]),te=(0,B.useMemo)(()=>C7(F,M+1),[F,M]),{kept:ne,middle:re}=(0,B.useMemo)(()=>T7(te),[te]),ie=(0,B.useMemo)(()=>ne.filter(w7),[ne]),ae=(0,B.useMemo)(()=>{let e=new Map;return ie.forEach((t,n)=>{for(let r=t.start;r<=t.end;r++)e.set(r,n)}),e},[ie]),oe=!o&&(P>=0||N>0)&&ie.length>0,se=dA(O,u,M),ce=(0,B.useMemo)(()=>O.slice(se),[O,se]),le=(0,B.useMemo)(()=>R6(ce).map(e=>({...e,messageIndex:e.messageIndex+se})),[ce,se]),ue=se>0||D.data?.hasEarlier===!0;(0,B.useLayoutEffect)(()=>{let e=b.current,t=g.current;if(!e||!t||![...t.querySelectorAll(`[data-transcript-source-id]`)].some(t=>t.dataset.transcriptSourceId===e.targetStartId))return;let n=()=>{vA(t,e.anchor,e=>{e!==0&&window.scrollBy({top:e,left:0,behavior:`auto`})});let n=0;return vA(t,e.anchor,e=>{n=e}),n},r=n();if(yA({remaining:r,scrollY:window.scrollY,maxScrollY:Math.max(0,document.documentElement.scrollHeight-window.innerHeight),alreadyReserved:e.reserved===!0})===`reserve`){e.reserved=!0,h(e=>e+Math.ceil(r));return}S.current||(S.current=!0,requestAnimationFrame(()=>{n(),requestAnimationFrame(()=>{n(),b.current=null,S.current=!1,x.current&&(x.current=!1,P7())})}))},[m,O,u]),(0,B.useEffect)(()=>{let e=D.data?.transcriptKey;if(!e)return;let t=C.current;C.current=e,!(!t||t===e)&&(d(null),h(0),s(!1),b.current=null,S.current=!1,x.current&&(x.current=!1,P7()))},[D.data?.transcriptKey]),(0,B.useEffect)(()=>()=>{x.current&&(x.current=!1,P7())},[]);let de=e=>{let t=gA(g.current);!e||!t||(x.current||(x.current=!0,N7()),b.current={anchor:t,targetStartId:e})},fe=async()=>{if(f||!ue)return;let t=uA(O,se),n=t!==null&&O[t]?.role===`user`?t:null;if(n!==null){let e=O[n].sourceId;de(e),d(e??null);return}let r=D.data?.beforeCursor;if(!r){if(se>0){let e=O[0]?.sourceId;de(e),d(e??null)}return}let i=D.data?.transcriptKey;if(i){p(!0);try{let t=await X.threadTranscriptEarlier({slug:e.id,cursor:r}),n=w.getQueryData([`transcript`,e.id]);if(!n?.transcriptKey||n.transcriptKey!==i||t.transcriptKey!==i){await D.refetch(),d(null),Q(`Transcript changed while loading history; refreshed the current session`);return}let a=t.messages[0]?.sourceId??O[0]?.sourceId;de(a);let o=hA(n,t);w.setQueryData([`transcript`,e.id],o),d(a??null)}catch(e){await D.refetch(),d(null),Q(e instanceof Error?e.message:`Could not load earlier transcript history`)}finally{p(!1)}}},pe=Jd({mutationFn:()=>X.markComplete({slug:e.id})}),{answeringForMessage:me,answerable:he,anyAnswered:ge,sendAnswers:_e,sendMessage:ve}=M0(e.id,O,()=>{document.activeElement?.blur(),n(e.id)},{scrollToBottom:!1}),ye=he||ge,be=(0,B.useCallback)(()=>n(e.id),[n,e.id]),xe=(0,B.useCallback)(()=>r(e.id),[r,e.id]),Se=(0,B.useMemo)(()=>({dismiss:be,cancel:xe}),[be,xe]);return(0,V.jsx)(y8.Provider,{value:e.id,children:(0,V.jsx)(S8.Provider,{value:Se,children:(0,V.jsxs)(`div`,{"data-queue-card-root":e.id,"data-queue-leaving":t,style:m?{marginBottom:m}:void 0,className:`flex flex-col min-w-0 max-w-full ${W1} border border-border-strong bg-panel shadow-lg shadow-black/25 transition-opacity ${c?`opacity-40`:``}`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[(0,V.jsxs)(`div`,{ref:_,className:`sticky top-0 z-10 flex items-center gap-2 bg-panel px-5 py-3.5 max-[800px]:top-10 ${i?W1:`${G1} border-b border-border/60`}`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`div`,{className:`flex min-w-0 items-center gap-1`,children:(0,V.jsx)(`div`,{className:`min-w-0 flex-1 truncate font-semibold text-[15px] leading-snug`,title:Uj(e),children:Uj(e)})}),(0,V.jsx)(u6,{at:eM(e),fallbackAt:e.spawnedAt,className:`mt-0.5 block truncate text-[11px] leading-tight text-muted/75`}),e.statusText&&e.status===`needs-human`&&(0,V.jsx)(`div`,{className:`text-[11px] text-muted/80 mt-0.5 truncate`,title:e.statusText,children:e.statusText})]}),e.kind===`session`&&e.foreign!==!0&&(0,V.jsx)(b6,{slug:e.id}),(0,V.jsx)(L2,{thread:e,collapsed:i,onCollapse:()=>a(e=>!e),openHref:Ex(e.id),onDone:()=>pe.mutate(void 0,{onSuccess:()=>n(e.id),onError:()=>l(!1)}),doneBusy:pe.isPending,onStatusMutate:()=>l(!0),onStatusApplied:()=>n(e.id),onStatusFailed:()=>l(!1)})]}),i?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`px-5 pt-5 ${ye?`pb-2`:`pb-5`}`,children:[(0,V.jsx)(y3,{thread:e,className:`mb-4`}),!e.pendingInteraction&&e.pendingAsk?(0,V.jsx)(`div`,{className:`mb-4`,children:(0,V.jsx)(Y5,{ask:e.pendingAsk,onTerminal:T})}):e.runtime===`perm-prompt`?(0,V.jsx)(`div`,{className:`mb-4`,children:(0,V.jsx)(K5,{onTerminal:T})}):null,e.permPolicy?(0,V.jsx)(`div`,{className:`mb-4`,children:(0,V.jsx)(q5,{policy:e.permPolicy,denies:e.permDenies})}):null,O.length===0?(0,V.jsx)(`p`,{className:`text-[13px] text-muted`,children:D.isLoading?`Loading…`:e.statusText||`No message yet.`}):(0,V.jsxs)(`div`,{ref:g,className:`flex flex-col`,children:[ue&&(0,V.jsx)(`button`,{className:`mb-3.5 self-center rounded-md border border-border px-2 py-0.5 text-[11px] text-muted transition-colors hover:text-fg hover:bg-panel-2 outline-none`,onClick:()=>void fe(),onMouseDown:e=>e.preventDefault(),disabled:f,children:f?`Loading earlier messages…`:D.data?.reachedTurnBoundary===!1?`Continue loading this turn`:`Load earlier messages`}),(()=>{let e=se,t=[],n=null,r=new Set;return le.forEach(({message:e,messageIndex:i},a)=>{if(e.queued||K8(e,A(i))||e.boundary===`rest`)return;if(oe&&re&&i>=re.start&&i<=re.end){i===re.start&&(n!==null&&t.push((0,V.jsx)(r0,{h:14},`middle-runs-space`)),t.push((0,V.jsx)(bte,{runs:re.runs,toolCount:re.tools,onExpand:()=>s(!0)},`middle-runs-summary`)),n=!1);return}let o=oe?ae.get(i):void 0,c=o===void 0?void 0:ie[o],l=c!==void 0,u=c!==void 0&&i===c.open,d=c!==void 0&&i===c.close,f=l&&!u&&!d&&!m1(e.text)&&x7(e,i,ee);if(c!==void 0&&i===c.waker){n!==null&&t.push((0,V.jsx)(r0,{h:n&&B8(e)?6:14},`s${a}`));let r=e.sourceId??`legacy-${i}`;t.push((0,V.jsx)(`div`,{"data-transcript-source-id":r,className:`flex flex-col`,children:(0,V.jsx)(M5,{m:e,dense:!0})},r)),n=z8(e);return}if(l&&!f){if(!u&&!d&&!x7(e,i,ee)||(!u&&o!==void 0&&!r.has(o)&&(n!==null&&t.push((0,V.jsx)(r0,{h:14},`im-space-${o}`)),t.push((0,V.jsx)(xte,{toolCount:c.tools,onExpand:()=>s(!0)},`intermediate-summary-${o}`)),n=!1,r.add(o)),!X8(e,A(i))))return;n!==null&&t.push((0,V.jsx)(r0,{h:14},`s${a}`));let l=e.sourceId??`legacy-${i}`;t.push((0,V.jsx)(`div`,{"data-transcript-source-id":l,className:`flex flex-col`,children:(0,V.jsx)(M5,{m:e,dense:!0,textOnly:!0,answering:me(e),paired:j[i],staleAwaiting:A(i)})},l)),n=!1;return}n!==null&&t.push((0,V.jsx)(r0,{h:n&&B8(e)?6:14},`s${a}`));let p=e.sourceId??`legacy-${i}`,m=i===P&&E,h=(0,V.jsx)(M5,{m:e,dense:!0,staleAwaiting:A(i),answering:me(e),paired:j[i],sticky:m});t.push(m?(0,V.jsx)(A5,{sourceId:p,stickyTopPx:v,children:h},p):(0,V.jsx)(`div`,{"data-transcript-source-id":p,className:`flex flex-col`,children:h},p)),n=z8(e)}),ce.forEach((n,r)=>{n.queued&&(t.push((0,V.jsx)(r0,{},`qs${r}`)),t.push((0,V.jsx)(M5,{m:n,dense:!0,paired:j[e+r]},`q${e+r}`)))}),t})()]}),e.awaitingBackground&&(0,V.jsx)(`div`,{className:`mt-4`,children:(0,V.jsx)(I7,{thread:e,onSnooze:be,onSnoozeFailed:xe})})]}),ye&&(0,V.jsx)(`div`,{className:`shrink-0 px-5 pt-0`,children:(0,V.jsx)(`div`,{className:`mb-4 flex items-center justify-start gap-2`,children:(0,V.jsx)(`button`,{disabled:!ge,onClick:()=>_e(),onMouseDown:e=>e.preventDefault(),className:`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`})})}),(0,V.jsx)(F2,{slug:e.id,surface:`queueComposer`,className:`shrink-0 px-5 pb-3 pt-0`,placeholder:he?`Or skip the questions and reply…`:`Reply to the agent…`,submitOverride:ve,ops:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(D7,{slug:e.id,subAgents:e.subAgents??[],className:`px-1 pt-1.5`}),(0,V.jsx)(J5,{slug:e.id,includeAgents:!1,className:`px-1 ${E7(e.subAgents??[])?`pt-0.5`:`pt-1.5`}`})]})})]})]}),(0,V.jsx)(x4,{thread:e,onArchived:()=>n(e.id),onDismissCancel:()=>r(e.id),onSnoozed:()=>n(e.id)})]})})})},Cte);function Cte(e,t){return e.leaving===t.leaving&&e.onResolve===t.onResolve&&e.onUnresolve===t.onUnresolve&&(e.thread===t.thread||JSON.stringify(e.thread)===JSON.stringify(t.thread))}function wte(e,t){if(e.backend===`claude`)return MU.some(t=>t.value===e.model)?LU(e.model).includes(e.effort)?void 0:`Reasoning level ${e.effort} is not available for ${e.model}`:`Claude model ${e.model} is no longer available`;let n=t.find(t=>t.slug===e.model);if(!n)return`Codex model ${e.model} is no longer available`;if(!n.efforts.includes(e.effort))return`Reasoning level ${e.effort} is not available for ${e.model}`}function Tte(e,t){return{items:t.map(e=>({...e})),backend:e.backend,model:e.model,effort:e.effort}}function Ete({keys:e,key:t,shiftKey:n,anchor:r,selected:i}){let a=e.indexOf(t),o=r===null?-1:e.indexOf(r);if(!n||a===-1||o===-1||r===null){let e=new Set(i);return e.has(t)?e.delete(t):e.add(t),{selected:e,anchor:a===-1?r:t}}let s=a>=o?1:-1,c=i.has(r),l=new Set(i);for(let t=o;;t+=s){let n=e[t];if(c?l.add(n):l.delete(n),t===a)break}return{selected:l,anchor:r}}var Dte=30;function Ote({onClose:e}){let t=JH(),{resolved:n,codexList:r,loadError:i,saveProfile:a}=GU(),[o,s]=(0,B.useState)(`issues`),[c,l]=(0,B.useState)(`recent`),[u,d]=(0,B.useState)(1),[f,p]=(0,B.useState)(()=>new Set),[m,h]=(0,B.useState)(null),g=qd({queryKey:[`githubList`,o,c,u],queryFn:()=>X.githubList({kind:o,sort:c,page:u,perPage:Dte}),placeholderData:Wu}),_=g.data?.items??[],v=g.data?.page??u,y=g.data?.pageCount??1,b=g.data?.total??0,x=(0,B.useRef)(null);(0,B.useEffect)(()=>{x.current&&(x.current.scrollTop=0)},[u,o,c]);let S=Jd({mutationFn:e=>X.githubDispatchBatch(e),onMutate:e=>Q(`Starting ${e.items.length} thread${e.items.length===1?``:`s`}…`,{spinner:!0,sticky:!0}),onSuccess:t=>{let n=t.dispatched.length,r=t.failed.length;Q(`Started ${n} thread${n===1?``:`s`}${r?` (${r} failed)`:``}`),e()},onError:e=>Q(`Dispatch failed: ${e.message.slice(0,80)}`)});function C(e){e!==o&&(s(e),d(1),p(new Set),h(null))}function w(e){e!==c&&(l(e),d(1),p(new Set),h(null))}function T(e,t){let n=Ete({keys:_.map(e=>e.number),key:e,shiftKey:t,anchor:m,selected:f});p(n.selected),h(n.anchor)}function E(){p(new Set),h(null)}let D=t.data?.nameWithOwner??`this repo`,O=f.size,k=(0,B.useMemo)(()=>UU(r),[r]),A=n?{backend:n.backend,model:n.model,effort:n.effort}:void 0,j=A?wte(A,r):i?`Could not load the model catalogue — reopen once it loads`:void 0,M=j??(A?void 0:`Loading the model catalogue…`);function N(){if(!A||M){Q(M??`Choose a model and reasoning level`);return}S.mutate(Tte(A,[...f].map(e=>({kind:o===`issues`?`issue`:`pr`,number:e}))))}return(0,V.jsx)(uW,{onClose:e,children:(0,V.jsxs)(`div`,{className:`flex max-h-[85vh] w-[720px] max-w-[90vw] flex-col rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50`,onKeyDownCapture:t=>{t.key===`Escape`&&(t.stopPropagation(),e())},children:[(0,V.jsxs)(`h2`,{className:`mb-4 flex items-center gap-2 text-[14px] font-medium`,children:[(0,V.jsx)(ew,{size:15,className:`text-muted`}),(0,V.jsx)(`span`,{children:`Investigate this issue and make recommendations`}),(0,V.jsx)(`span`,{className:`text-muted/40`,children:`—`}),(0,V.jsx)(`span`,{className:`font-mono-keep text-[12.5px] text-muted`,children:D})]}),(0,V.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,V.jsx)(V7,{value:o,onChange:e=>C(e),options:[{value:`issues`,label:`Issues`},{value:`prs`,label:`PRs`}]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps text-[11px] text-muted/70`,children:`Sort`}),(0,V.jsx)(V7,{value:c,onChange:w,options:[{value:`recent`,label:`Recent`},{value:`reactions`,label:`Reactions`}]})]})]}),(0,V.jsx)(`div`,{ref:x,className:`min-h-[240px] flex-1 overflow-y-auto rounded-lg border border-border/70 bg-bg/40 transition-opacity ${g.isPlaceholderData?`opacity-40`:``}`,children:g.isLoading?(0,V.jsx)(Ite,{}):g.isError?(0,V.jsxs)(W7,{children:[(0,V.jsxs)(`span`,{className:`text-[12.5px] text-muted/80`,children:[`Couldn't load `,o===`issues`?`issues`:`pull requests`,`.`]}),(0,V.jsx)(`span`,{className:`max-w-[80%] text-center text-[11px] text-muted/45`,children:g.error.message.slice(0,140)})]}):_.length===0?(0,V.jsxs)(W7,{children:[(0,V.jsx)(iw,{size:28,strokeWidth:1.25,className:`text-muted/30`}),(0,V.jsxs)(`span`,{className:`text-[12.5px] text-muted/60`,children:[`No open `,o===`issues`?`issues`:`pull requests`]})]}):_.map(e=>(0,V.jsx)(Mte,{item:e,checked:f.has(e.number),onActivate:t=>T(e.number,t)},e.number))}),!g.isLoading&&!g.isError&&(0,V.jsxs)(`div`,{className:`mt-2.5 flex items-center justify-between gap-3 whitespace-nowrap text-[11.5px] text-muted/60`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,V.jsxs)(`span`,{className:`truncate tabular-nums`,children:[b,` open `,o===`issues`?b===1?`issue`:`issues`:b===1?`pull request`:`pull requests`]}),O>0&&(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`text-muted/30`,children:`·`}),(0,V.jsxs)(`span`,{className:`tabular-nums text-fg/70`,children:[O,` selected`]}),(0,V.jsx)(`button`,{onClick:E,onMouseDown:e=>e.preventDefault(),className:`rounded py-0.5 text-muted/60 underline-offset-2 outline-none transition-colors hover:text-fg hover:underline`,children:`Clear`})]})]}),y>1&&(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,V.jsx)(B7,{label:`Previous page`,disabled:v<=1,onClick:()=>d(Math.max(1,v-1)),children:(0,V.jsx)(NC,{size:14})}),(0,V.jsxs)(`span`,{className:`relative px-2 text-center tabular-nums`,children:[(0,V.jsxs)(`span`,{"aria-hidden":!0,className:`invisible`,children:[`Page `,y,` of `,y]}),(0,V.jsxs)(`span`,{className:`absolute inset-0`,children:[`Page `,v,` of `,y]})]}),(0,V.jsx)(B7,{label:`Next page`,disabled:v>=y,onClick:()=>d(Math.min(y,v+1)),children:(0,V.jsx)(PC,{size:14})})]})]}),(0,V.jsxs)(`div`,{className:`mt-4 flex items-end justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(yU,{groups:k,value:n?{provider:n.backend,model:n.model,effort:n.effort}:void 0,onValueChange:e=>a({field:`profile`,backend:e.provider,model:e.model,effort:e.effort}),placeholder:i?`Profile unavailable`:`Profile loading…`,ariaLabel:`Model and effort`,title:M??`Model and reasoning effort for every thread this batch starts`,disabled:!n,side:`top`,menuZClass:CV,className:`max-w-[min(21rem,60vw)]`}),j&&(0,V.jsx)(`p`,{className:`mt-1 max-w-[430px] text-[10.5px] text-red-400`,children:j})]}),(0,V.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,V.jsxs)(`button`,{disabled:O===0||S.isPending||!!M,onClick:N,onMouseDown:e=>e.preventDefault(),className:`flex items-center gap-2 rounded-md bg-fg px-3.5 py-1.5 text-[12.5px] font-medium text-bg outline-none transition-all hover:opacity-90 active:scale-95 disabled:opacity-30 disabled:hover:opacity-30`,children:[S.isPending&&(0,V.jsx)(cw,{size:13,className:`animate-spin`}),O<=1?`Start investigation`:`Start ${O} investigations`]})})]})]})})}function B7({label:e,disabled:t,onClick:n,children:r}){return(0,V.jsx)(`button`,{type:`button`,"aria-label":e,title:e,disabled:t,onClick:n,onMouseDown:e=>e.preventDefault(),className:`inline-flex h-[22px] w-[22px] items-center justify-center rounded-md border border-border/70 text-muted/70 outline-none transition-colors hover:border-border hover:bg-elevated hover:text-fg disabled:pointer-events-none disabled:opacity-30`,children:r})}function V7({value:e,onChange:t,options:n}){return(0,V.jsx)(`div`,{className:`inline-flex items-center gap-0.5 rounded-lg border border-border bg-panel-2 p-0.5`,children:n.map(n=>(0,V.jsx)(`button`,{onClick:()=>t(n.value),onMouseDown:e=>e.preventDefault(),className:`rounded-md px-3 py-1 text-[12px] font-medium outline-none transition-colors ${e===n.value?`bg-elevated text-fg shadow-sm shadow-black/20`:`text-muted hover:text-fg`}`,children:n.label},n.value))})}function kte({item:e}){let t=(e.state??`OPEN`).toUpperCase();return e.kind===`pr`?t===`MERGED`?(0,V.jsx)(XC,{size:15,className:`shrink-0 text-purple-400`}):t===`CLOSED`?(0,V.jsx)(ZC,{size:15,className:`shrink-0 text-red-400`}):e.isDraft?(0,V.jsx)(QC,{size:15,className:`shrink-0 text-muted/70`}):(0,V.jsx)($C,{size:15,className:`shrink-0 text-emerald-500`}):t===`CLOSED`?(0,V.jsx)(LC,{size:15,className:`shrink-0 text-purple-400`}):(0,V.jsx)(zC,{size:15,className:`shrink-0 text-emerald-500`})}function Ate(e){if(!e)return``;let t=Date.parse(e);if(!Number.isFinite(t))return``;let n=Math.max(0,(Date.now()-t)/1e3),r=n/60,i=r/60,a=i/24;return n<45?`just now`:r<60?`${Math.round(r)}m ago`:i<24?`${Math.round(i)}h ago`:a<30?`${Math.round(a)}d ago`:a<365?`${Math.round(a/30)}mo ago`:`${Math.round(a/365)}y ago`}function jte({name:e,color:t}){let n=/^[0-9a-fA-F]{6}$/.test(t)?`#${t}`:void 0;return(0,V.jsx)(`span`,{className:`max-w-[130px] shrink-0 truncate rounded-full border px-1.5 py-px text-[9.5px] leading-[13px]`,style:n?{borderColor:`${n}59`,color:n,backgroundColor:`${n}14`}:void 0,title:e,children:e})}function Mte({item:e,checked:t,onActivate:n}){let r=Ate(e.createdAt),i=[e.author,r?`opened ${r}`:``].filter(Boolean).join(` `);return(0,V.jsxs)(`div`,{role:`button`,tabIndex:0,"data-row-number":e.number,"aria-pressed":t,onClick:e=>n(e.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(e.shiftKey))},className:`group flex w-full cursor-pointer items-start gap-2.5 border-b border-border/40 px-3 py-2.5 text-left outline-none transition-colors last:border-b-0 hover:bg-white/[0.03]`,children:[(0,V.jsx)(`span`,{className:`mt-px shrink-0`,children:(0,V.jsx)(Nte,{checked:t})}),(0,V.jsx)(`span`,{className:`mt-px`,children:(0,V.jsx)(kte,{item:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,V.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,onClick:e=>e.stopPropagation(),title:e.title,className:`min-w-0 truncate text-[13px] font-medium text-fg/90 hover:underline`,children:e.title}),e.labels.slice(0,4).map(e=>(0,V.jsx)(jte,{name:e.name,color:e.color},e.name))]}),(0,V.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] text-muted/55`,children:[(0,V.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,onClick:e=>e.stopPropagation(),className:`shrink-0 tabular-nums hover:text-muted hover:underline`,children:[`#`,e.number]}),i?(0,V.jsxs)(`span`,{className:`truncate`,children:[`· `,i]}):null]})]}),(0,V.jsxs)(`span`,{className:`mt-px flex shrink-0 items-center gap-2.5 text-[11.5px] text-muted/70`,children:[e.linkedPrs?(0,V.jsx)(Fte,{prs:e.linkedPrs}):null,e.comments?(0,V.jsx)(U7,{icon:uw,n:e.comments,label:`comments`}):null,e.reactions?(0,V.jsx)(U7,{emoji:`👍`,n:e.reactions,label:`reactions`}):null]})]})}function Nte({checked:e}){return(0,V.jsx)(`span`,{className:`inline-flex h-[15px] w-[15px] items-center justify-center rounded-[4px] border transition-colors ${e?`border-fg bg-fg`:`border-muted/45 group-hover:border-muted/80`}`,children:e&&(0,V.jsx)(jC,{size:11,strokeWidth:3,className:`text-bg`})})}var H7={octicon:`-0.1em`,stroke:`-0.112em`};function Pte({size:e=12,className:t}){return(0,V.jsx)(`svg`,{viewBox:`0 0 16 16`,width:e,height:e,fill:`currentColor`,"aria-hidden":!0,className:t,style:{transform:`translateY(${H7.octicon})`},children:(0,V.jsx)(`path`,{d:`M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z`})})}function Fte({prs:e}){let t=e.state.toUpperCase()===`MERGED`,n=e.count>1?`${e.count} linked pull requests — `:``,r=t?`#${e.number} merged`:e.isDraft?`#${e.number} open (draft)`:`#${e.number} open`;return(0,V.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,onClick:e=>e.stopPropagation(),title:`${n}${r}`,className:`inline-flex items-center gap-1 tabular-nums hover:text-fg/90`,children:[(0,V.jsx)(Pte,{size:12}),e.count]})}function U7({icon:e,emoji:t,n,label:r}){return(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 tabular-nums`,title:`${n} ${r}`,children:[t?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`text-[11px] leading-none`,children:t}):e?(0,V.jsx)(`span`,{className:`inline-flex`,style:{transform:`translateY(${H7.stroke})`},children:(0,V.jsx)(e,{size:12,strokeWidth:2})}):null,n]})}function Ite(){return(0,V.jsx)(`div`,{className:`animate-pulse`,children:Array.from({length:6}).map((e,t)=>(0,V.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border/40 px-3 py-2.5 last:border-b-0`,children:[(0,V.jsx)(`span`,{className:`h-[15px] w-[15px] shrink-0 rounded-[4px] bg-muted/20`}),(0,V.jsx)(`span`,{className:`h-3 w-8 shrink-0 rounded bg-muted/20`}),(0,V.jsx)(`span`,{className:`h-3 flex-1 rounded bg-muted/15`,style:{maxWidth:`${55+t*7%35}%`}})]},t))})}function W7({children:e}){return(0,V.jsx)(`div`,{className:`flex h-full min-h-[240px] flex-col items-center justify-center gap-1.5`,children:e})}var G7={permissionMode:`The permission mode new Claude Code threads launch with. Auto runs safe actions and asks you to approve the risky ones in the thread. Bypass launches the worker with --dangerously-skip-permissions: it never asks, so nothing waits on you and nothing is checked either. Takes effect on the next thread you dispatch; to change a thread that already exists, use the picker beside its model in the prompt box. Codex threads always run with full workspace access and are unaffected.`,font:`Changes the interface reading font for this browser.`,localFileOpener:`Chooses how vetted local artifact links open. Markdown files open in Frizz's own reader (which carries an Open action that uses this setting), and image clicks always use the OS default viewer.`,density:`How much of a diff shows before you ask for it, in this browser. Compact collapses every diff to its header row (click one to open it); Comfortable shows them in full. Applies immediately.`,stickyUserMessage:`Keeps your most recent message stuck to the top of a thread while the reply scrolls underneath. It stays collapsed to a small card (hover to expand it) so a long message never blocks much of the view. Applies immediately in this browser.`,queueOrder:`Orders the Needs-you queue and the sidebar's rested threads by when each was last active. Oldest first (FIFO, default) surfaces the longest-waiting item first so you cycle through everything; Newest first (LIFO) keeps the most recently active on top. Applies immediately in this browser.`,notifications:`Shows a desktop notification when work needs attention while this window is hidden.`,projectRail:`Shows a permanent column of every project on this machine down the left edge. Off by default: Frizz's home is one board, and a standing list of the others is an easy way to leave the thread you were in. With it off, the home crumb in the status bar is the way back to the projects page.`};function Lte(){return typeof Notification>`u`?`unsupported`:Notification.permission}var Rte=500,zte=1600,Bte=2e3,Vte=6;function Hte(){let[e,t]=(0,B.useState)(`idle`),n=(0,B.useRef)(null),r=(0,B.useRef)(void 0),i=(0,B.useRef)(Promise.resolve()),a=(0,B.useRef)(0),o=(0,B.useRef)(void 0),s=(0,B.useRef)(0),c=(0,B.useRef)(()=>{}),l=(0,B.useCallback)(()=>{r.current!==void 0&&window.clearTimeout(r.current),r.current=void 0;let e=n.current;e&&(n.current=null,a.current+=1,t(`saving`),i.current=i.current.then(()=>X.settingsSet(e)).then(e=>{$9.setQueryData([`settingsGet`],e),--a.current,s.current=0,!(a.current>0||n.current)&&(t(`saved`),o.current!==void 0&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>t(`idle`),zte))}).catch(i=>{--a.current,t(`error`),!(n.current||!Qx(i)||s.current>=Vte)&&(s.current+=1,n.current=e,r.current=window.setTimeout(c.current,Bte))}))},[]);c.current=l;let u=(0,B.useCallback)((e,t=!1)=>{if(n.current=e,s.current=0,r.current!==void 0&&window.clearTimeout(r.current),r.current=void 0,!t)return l();r.current=window.setTimeout(l,Rte)},[l]);return(0,B.useEffect)(()=>()=>{l(),o.current!==void 0&&window.clearTimeout(o.current)},[l]),{state:e,queue:u,flush:l}}function Ute(){let e=qd({queryKey:[`settingsGet`],queryFn:()=>X.settingsGet()}),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(Lte()),{state:a,queue:o,flush:s}=Hte(),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=requestAnimationFrame(()=>l(!0));return()=>cancelAnimationFrame(e)},[]),(0,B.useEffect)(()=>(ix(p),()=>ix(null)),[]),(0,B.useEffect)(()=>{e.data&&!t&&n(e.data)},[e.data,t]);let f=(0,B.useCallback)((e,t)=>{n(e),o(e,t?.debounce)},[o]);function p(){u||(s(),d(!0),l(!1),window.setTimeout(()=>Z.showSettings=!1,cC()?0:210))}async function m(e){if(t){if(e&&typeof Notification<`u`&&Notification.permission==="default"){let e=await Notification.requestPermission();i(e)}f({...t,notifications:e})}}return(0,V.jsx)(`div`,{className:`${aC} z-50 flex justify-end ${c?`opacity-100`:`opacity-0`}`,onMouseDown:e=>e.target===e.currentTarget&&p(),children:(0,V.jsxs)(`div`,{className:`${oC} w-[560px] max-w-[94vw] ${c?`translate-x-0`:`translate-x-full`}`,children:[(0,V.jsx)(Mw,{title:`Settings`,actions:(0,V.jsx)(Wte,{state:a}),onClose:p}),t?(0,V.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-5 flex flex-col gap-6`,children:[(0,V.jsx)(q7,{label:`Font`,help:G7.font,children:(0,V.jsx)(Xte,{value:t.font??`mono`,onChange:e=>f({...t,font:e})})}),(0,V.jsx)(q7,{label:`Project sidebar`,help:G7.projectRail,children:(0,V.jsx)(A2,{variant:`bordered`,value:t.projectRail?`shown`:`hidden`,onValueChange:e=>f({...t,projectRail:e===`shown`}),options:[{value:`hidden`,label:`Hidden`},{value:`shown`,label:`Always shown`}],indicatorPosition:`right`,ariaLabel:`Project sidebar`})}),(0,V.jsx)(q7,{label:`Local file links`,help:G7.localFileOpener,children:(0,V.jsx)(A2,{variant:`bordered`,value:t.localFileOpener??`system`,onValueChange:e=>f({...t,localFileOpener:e}),options:[{value:`system`,label:`System default`},{value:`cursor`,label:`Cursor`},{value:`vscode`,label:`VS Code`},{value:`finder`,label:`Reveal in Finder`},{value:`copy`,label:`Copy path`}],indicatorPosition:`right`,ariaLabel:`Local file link opener`})}),(0,V.jsx)(q7,{label:`Density`,help:G7.density,children:(0,V.jsx)(Zte,{})}),(0,V.jsx)(q7,{label:`Sticky message`,help:G7.stickyUserMessage,children:(0,V.jsx)(Qte,{})}),(0,V.jsx)(q7,{label:`Queue order`,help:G7.queueOrder,children:(0,V.jsx)($te,{})}),(0,V.jsxs)(q7,{label:`Desktop notifications`,help:G7.notifications,children:[(0,V.jsx)(Y7,{value:t.notifications,onChange:m}),t.notifications&&(0,V.jsx)(tne,{perm:r})]}),(0,V.jsx)(Kte,{draft:t,setDraft:f}),(0,V.jsx)(qte,{draft:t,setDraft:f})]}):(0,V.jsx)(`div`,{className:`p-4 text-[13px] text-muted`,children:`Loading…`})]})})}function Wte({state:e}){return e===`idle`?null:e===`error`?(0,V.jsx)(`span`,{className:`text-[11px] font-normal text-accent`,children:`Couldn't save`}):(0,V.jsx)(`span`,{className:`text-[11px] font-normal text-muted transition-opacity ${e===`saved`?`opacity-70`:`opacity-100`}`,children:e===`saving`?`Saving…`:`Saved`})}function K7({label:e,help:t}){return(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] uppercase tracking-wide text-muted`,children:[e,(0,V.jsx)(Pq,{label:t,side:`right`,clickable:!0,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":`About ${e}`,className:`inline-flex size-4 items-center justify-center text-muted/60 hover:text-fg transition-colors`,children:(0,V.jsx)(BC,{size:12})})})]})}function q7({label:e,help:t,children:n}){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(K7,{label:e,help:t}),n]})}var Gte=[{token:`repo`,gloss:`repository`},{token:`n`,gloss:`number`},{token:`title`,gloss:`title`},{token:`url`,gloss:`link`},{token:`labels`,gloss:`labels`},{token:`body`,gloss:`description`}];function Kte({draft:e,setDraft:t}){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,V.jsx)(J7,{label:`Claude`}),(0,V.jsxs)(q7,{label:`Permissions`,help:G7.permissionMode,children:[(0,V.jsx)(A2,{variant:`bordered`,value:e.permissionMode===`bypassPermissions`?`bypassPermissions`:`auto`,onValueChange:n=>t({...e,permissionMode:n}),options:jU,indicatorPosition:`right`,ariaLabel:`Claude permission mode`}),e.permissionMode===`bypassPermissions`&&(0,V.jsx)(ene,{})]})]})}function qte({draft:e,setDraft:t}){let n=qd({queryKey:[`githubPromptDefaults`],queryFn:()=>X.githubPromptDefaults()});return(0,V.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,V.jsx)(J7,{label:`Prompts`}),n.data?(0,V.jsx)(Yte,{label:`Issue and PR triage prompt`,help:`The prompt for every item dispatched from the GitHub picker, issues and PRs alike. The default has the worker read the whole thread, classify it, and branch — reproduce + fix-plan for a bug, a plan for a feature, an adversarial review for a PR.`,value:e.githubPrompt,fallback:n.data.prompt,onChange:(n,r)=>t({...e,githubPrompt:n},r)}):(0,V.jsx)(`div`,{className:`text-[12px] text-muted`,children:`Loading defaults…`})]})}function J7({label:e}){return(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5 text-[11px] uppercase tracking-wide text-muted/70`,children:[(0,V.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border/60`}),(0,V.jsx)(`span`,{className:`shrink-0`,children:e}),(0,V.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border/60`})]})}function Jte(){let[e,t]=(0,B.useState)(!1);return(0,V.jsxs)(nK,{open:e,onOpenChange:t,children:[(0,V.jsx)(rK,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:`shrink-0 text-[11px] transition-colors ${e?`text-accent`:`text-muted hover:text-accent`}`,children:`Tokens`})}),(0,V.jsxs)(aK,{side:`top`,align:`end`,className:`w-56 p-3`,children:[(0,V.jsx)(`div`,{className:`mb-2 text-[11px] font-medium text-fg`,children:`Substitution tokens`}),(0,V.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:Gte.map(({token:e,gloss:t})=>(0,V.jsxs)(`li`,{className:`flex items-center justify-between gap-3 text-[11px]`,children:[(0,V.jsx)(`code`,{className:`font-mono-keep rounded border border-border bg-bg px-1 py-0.5 text-[10px] text-fg/80`,children:`{${e}}`}),(0,V.jsx)(`span`,{className:`text-muted/80`,children:t})]},e))})]})]})}function Yte({label:e,help:t,value:n,fallback:r,onChange:i}){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,V.jsx)(K7,{label:e,help:t}),(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[n!=null&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:`text-[11px] text-muted hover:text-accent transition-colors`,onClick:()=>i(void 0),children:`Reset to default`}),(0,V.jsx)(`span`,{"aria-hidden":!0,className:`text-[11px] text-muted/40`,children:`·`})]}),(0,V.jsx)(Jte,{})]})]}),(0,V.jsx)(`textarea`,{value:n??r,onChange:e=>i(e.target.value===``?void 0:e.target.value,{debounce:!0}),rows:10,className:`input resize-none text-[12px] leading-relaxed font-mono-keep`,spellCheck:!1})]})}function Xte({value:e,onChange:t}){return(0,V.jsx)(`div`,{className:`inline-flex w-fit rounded-md border border-border bg-bg p-0.5`,children:[{v:`mono`,label:`Mono`,cls:``},{v:`sans`,label:`Sans`,cls:``}].map(n=>(0,V.jsx)(`button`,{onClick:()=>t(n.v),className:`rounded px-3 py-1 text-[12px] transition-colors ${n.cls} ${e===n.v?`bg-fg text-bg`:`text-muted hover:text-fg`}`,children:n.label},n.v))})}function Y7({value:e,onChange:t}){return(0,V.jsx)(`div`,{className:`inline-flex w-fit rounded-md border border-border bg-bg p-0.5`,children:[{v:!1,label:`Off`},{v:!0,label:`On`}].map(n=>(0,V.jsx)(`button`,{onClick:()=>t(n.v),className:`rounded px-3 py-1 text-[12px] transition-colors ${e===n.v?`bg-fg text-bg`:`text-muted hover:text-fg`}`,children:n.label},n.label))})}function Zte(){let{compactDiffs:e}=Hf(zj);return(0,V.jsx)(`div`,{className:`inline-flex w-fit rounded-md border border-border bg-bg p-0.5`,children:[{v:!1,label:`Comfortable`},{v:!0,label:`Compact`}].map(t=>(0,V.jsx)(`button`,{onClick:()=>zj.compactDiffs=t.v,className:`rounded px-3 py-1 text-[12px] transition-colors ${e===t.v?`bg-fg text-bg`:`text-muted hover:text-fg`}`,children:t.label},t.label))})}function Qte(){let{stickyUserMessage:e}=Hf(zj);return(0,V.jsx)(Y7,{value:e,onChange:e=>zj.stickyUserMessage=e})}function $te(){let{queueOrder:e}=Hf(zj);return(0,V.jsx)(`div`,{className:`inline-flex w-fit rounded-md border border-border bg-bg p-0.5`,children:[{v:`fifo`,label:`Oldest first`},{v:`lifo`,label:`Newest first`}].map(t=>(0,V.jsx)(`button`,{onClick:()=>zj.queueOrder=t.v,className:`rounded px-3 py-1 text-[12px] transition-colors ${e===t.v?`bg-fg text-bg`:`text-muted hover:text-fg`}`,children:t.label},t.v))})}function ene(){return(0,V.jsx)(`span`,{className:`text-[11px] text-muted/70`,children:`New Claude threads will run every command, edit, and network call without asking you first.`})}function tne({perm:e}){return e===`denied`?(0,V.jsx)(rne,{}):(0,V.jsx)(`span`,{className:`text-[11px] text-muted/70`,children:{granted:`Browser permission granted — notifications fire when the window is hidden.`,default:`Browser permission not yet granted — notifications won't fire until you allow them.`,unsupported:`This browser does not support desktop notifications.`}[e]})}function nne(){let e=typeof navigator<`u`?navigator.userAgent:``;return/Firefox\//.test(e)?`firefox`:/Edg\//.test(e)?`edge`:/OPR\/|Brave\//.test(e)?`other`:/Chrome\//.test(e)?`chrome`:/Safari\//.test(e)?`safari`:`other`}function rne(){let e=(0,B.useMemo)(nne,[]),t=typeof location<`u`?location.origin:``,n=`${e===`edge`?`edge`:`chrome`}://settings/content/siteDetails?site=${encodeURIComponent(t)}`;return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 text-[11px] text-muted/70`,children:[(0,V.jsx)(`span`,{children:`Notifications are blocked for this site. Re-enable them in your browser, then reload.`}),e===`chrome`||e===`edge`?(0,V.jsx)(ane,{url:n,hint:`Paste this into a new tab, set Notifications → Allow:`}):e===`safari`?(0,V.jsxs)(`span`,{children:[`Safari → Settings → Websites → Notifications → allow `,ine(t),`, then reload.`]}):e===`firefox`?(0,V.jsx)(`span`,{children:`Firefox → Settings → Privacy & Security → Permissions → Notifications → Settings → allow this site.`}):(0,V.jsx)(`span`,{children:`Open this site's notification permission in your browser's settings and set it to Allow.`})]})}function ine(e){try{return new URL(e).host}catch{return e}}function ane({url:e,hint:t}){let[n,r]=(0,B.useState)(!1);async function i(){try{await bU(e),r(!0),window.setTimeout(()=>r(!1),1500)}catch{}}return(0,V.jsxs)(`span`,{className:`flex w-full flex-col gap-1`,children:[(0,V.jsx)(`span`,{children:t}),(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,V.jsx)(`code`,{className:`min-w-0 flex-1 font-mono-keep select-all rounded border border-border bg-bg px-1.5 py-0.5 text-[10.5px] text-fg/90 break-all`,children:e}),(0,V.jsx)(`button`,{type:`button`,onClick:i,"aria-label":`Copy address`,className:`shrink-0 rounded border border-border p-1 text-muted hover:bg-panel-2 hover:text-fg transition-colors`,children:n?(0,V.jsx)(jC,{size:11,className:`text-live`}):(0,V.jsx)(WC,{size:11})})]})]})}var X7=1,one=.9,sne=.8,cne=.17,Z7=.1,Q7=.999,lne=.9999,une=.99,dne=/[\\\/_+.#"@\[\(\{&]/,fne=/[\\\/_+.#"@\[\(\{&]/g,pne=/[\s-]/,$7=/[\s-]/g;function e9(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?X7:une;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=e9(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=X7:dne.test(e.charAt(l-1))?(d*=sne,p=e.slice(i,l-1).match(fne),p&&i>0&&(d*=Q7**+p.length)):pne.test(e.charAt(l-1))?(d*=one,m=e.slice(i,l-1).match($7),m&&i>0&&(d*=Q7**+m.length)):(d*=cne,i>0&&(d*=Q7**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=lne)),(d<Z7&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=e9(e,t,n,r,l+1,a+2,o),f*Z7>d&&(d=f*Z7)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function t9(e){return e.toLowerCase().replace($7,` `)}function mne(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,e9(e,t,t9(e),t9(t),0,0,{})}var n9=`[cmdk-group=""]`,r9=`[cmdk-group-items=""]`,hne=`[cmdk-group-heading=""]`,i9=`[cmdk-item=""]`,a9=`${i9}:not([aria-disabled="true"])`,o9=`cmdk-item-select`,s9=`data-value`,gne=(e,t,n)=>mne(e,t,n),c9=B.createContext(void 0),l9=()=>B.useContext(c9),u9=B.createContext(void 0),d9=()=>B.useContext(u9),f9=B.createContext(void 0),p9=B.forwardRef((e,t)=>{let n=_9(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=_9(()=>new Set),i=_9(()=>new Map),a=_9(()=>new Map),o=_9(()=>new Set),s=h9(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=PP(),y=PP(),b=PP(),x=B.useRef(null),S=Dne();g9(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),g9(()=>{S(6,k)},[]);let C=B.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=B.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??gne;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(r9);t?t.appendChild(e.parentElement===t?e:e.closest(`${r9} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${r9} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${n9}[${s9}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(s9);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(n9)?.querySelector(hne))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${i9}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(a9)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(s9))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(s9))}function P(e){let t=A()?.closest(n9),n;for(;t&&!n;)t=e>0?Tne(t,n9):Ene(t,n9),n=t?.querySelector(a9);n?C.setState(`value`,n.getAttribute(s9)):N(e)}let ee=()=>M(j().length-1),F=e=>{e.preventDefault(),e.metaKey?ee():e.altKey?P(1):N(1)},te=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return B.createElement(KN.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&F(e);break;case`ArrowDown`:F(e);break;case`p`:case`k`:g&&e.ctrlKey&&te(e);break;case`ArrowUp`:te(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),ee();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(o9);t.dispatchEvent(e)}}}}},B.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:kne},c),b9(e,e=>B.createElement(u9.Provider,{value:C},B.createElement(c9.Provider,{value:w},e))))}),_ne=B.forwardRef((e,t)=>{let n=PP(),r=B.useRef(null),i=B.useContext(f9),a=l9(),o=h9(e),s=o.current?.forceMount??i?.forceMount;g9(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=y9(n,r,[e.value,e.children,r],e.keywords),l=d9(),u=v9(e=>e.value&&e.value===c.current),d=v9(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);B.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(o9,f),()=>t.removeEventListener(o9,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return B.createElement(KN.div,{ref:xN(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),vne=B.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=PP(),s=B.useRef(null),c=B.useRef(null),l=PP(),u=l9(),d=v9(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);g9(()=>u.group(o),[]),y9(o,s,[e.value,e.heading,c]);let f=B.useMemo(()=>({id:o,forceMount:i}),[i]);return B.createElement(KN.div,{ref:xN(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&B.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),b9(e,e=>B.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},B.createElement(f9.Provider,{value:f},e))))}),yne=B.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=B.useRef(null),a=v9(e=>!e.search);return!n&&!a?null:B.createElement(KN.div,{ref:xN(i,t),...r,"cmdk-separator":``,role:`separator`})}),bne=B.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=d9(),o=v9(e=>e.search),s=v9(e=>e.selectedItemId),c=l9();return B.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),B.createElement(KN.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),xne=B.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=B.useRef(null),o=B.useRef(null),s=v9(e=>e.selectedItemId),c=l9();return B.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),B.createElement(KN.div,{ref:xN(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},b9(e,e=>B.createElement(`div`,{ref:xN(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Sne=B.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return B.createElement(FV,{open:n,onOpenChange:r},B.createElement(VV,{container:o},B.createElement(UV,{"cmdk-overlay":``,className:i}),B.createElement(qV,{"aria-label":e.label,"cmdk-dialog":``,className:a},B.createElement(p9,{ref:t,...s}))))}),Cne=B.forwardRef((e,t)=>v9(e=>e.filtered.count===0)?B.createElement(KN.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),wne=B.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return B.createElement(KN.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},b9(e,e=>B.createElement(`div`,{"aria-hidden":!0},e)))}),m9=Object.assign(p9,{List:xne,Item:_ne,Input:bne,Group:vne,Separator:yne,Dialog:Sne,Empty:Cne,Loading:wne});function Tne(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ene(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function h9(e){let t=B.useRef(e);return g9(()=>{t.current=e}),t}var g9=typeof window>`u`?B.useEffect:B.useLayoutEffect;function _9(e){let t=B.useRef();return t.current===void 0&&(t.current=e()),t}function v9(e){let t=d9(),n=()=>e(t.snapshot());return B.useSyncExternalStore(t.subscribe,n,n)}function y9(e,t,n,r=[]){let i=B.useRef(),a=l9();return g9(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(s9,s),i.current=s}),i}var Dne=()=>{let[e,t]=B.useState(),n=_9(()=>new Map);return g9(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function One(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function b9({asChild:e,children:t},n){return e&&B.isValidElement(t)?B.cloneElement(One(t),{ref:t.ref},n(t.props.children)):n(t)}var kne={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function Ane(){let e=Hf(Z),t=$A(),[n,r]=(0,B.useState)(``);if((0,B.useEffect)(()=>{e.showPalette&&r(``)},[e.showPalette]),!e.showPalette)return null;let i=tM(tj(t?.threads??[])),a=e.drawers.length?[...e.drawers].reverse().find(e=>e.kind===`thread`)?.slug:void 0,o=t?.threads.find(e=>e.id===a);function s(){Z.showPalette=!1}function c(e){e(),s()}function l(e){US(e)}return(0,V.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-start justify-center bg-black/50 pt-[12vh]`,onMouseDown:e=>e.target===e.currentTarget&&s(),children:(0,V.jsxs)(m9,{label:`Command palette`,className:`w-[560px] max-w-[92vw] rounded-lg border border-border bg-panel shadow-2xl overflow-hidden`,filter:(e,t,n)=>+!!e.toLowerCase().includes(t.toLowerCase()),children:[(0,V.jsx)(m9.Input,{autoFocus:!0,value:n,onValueChange:r,placeholder:`Jump to a thread or run a command…`,className:`w-full px-4 h-12 bg-transparent outline-none border-b border-border text-sm placeholder:text-muted`}),(0,V.jsxs)(m9.List,{className:`max-h-[52vh] overflow-y-auto py-1.5`,children:[(0,V.jsx)(m9.Empty,{className:`px-4 py-6 text-center text-sm text-muted`,children:`No matches.`}),(0,V.jsxs)(m9.Group,{heading:`Actions`,className:`cmdk-group`,children:[(0,V.jsx)(x9,{value:`new thread create home`,onSelect:()=>c(()=>jS()),children:`New thread`}),(0,V.jsx)(x9,{value:`queue todos inbox pending`,onSelect:()=>c(()=>{QS(Z.drawers.map(e=>e.id)),Z.view=`todos`}),children:`Queue`}),(0,V.jsx)(x9,{value:`open settings preferences`,onSelect:()=>c(()=>Z.showSettings=!0),children:`Open settings`}),o&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x9,{value:`open details drawer doc ${Uj(o)}`,onSelect:()=>c(()=>{let e=$S();e&&BS(`doc`,e)}),children:`Open thread details`}),(0,V.jsxs)(x9,{value:`mark complete done ${Uj(o)}`,onSelect:()=>c(()=>X.markComplete({slug:o.id}).catch(()=>{})),children:[`Mark “`,Uj(o),`” complete`]}),(0,V.jsxs)(x9,{value:`mark read ${Uj(o)}`,onSelect:()=>c(()=>X.markRead({slug:o.id}).catch(()=>{})),children:[`Mark “`,Uj(o),`” read`]})]})]}),i.length>0&&(0,V.jsx)(m9.Group,{heading:`Threads`,className:`cmdk-group`,children:i.map(e=>(0,V.jsxs)(x9,{value:`${Uj(e)} ${e.id}`,onSelect:()=>c(()=>l(e.id)),children:[(0,V.jsx)(`span`,{className:`truncate`,children:Uj(e)}),(0,V.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted/70`,children:e.id})]},e.id))})]})]})})}function x9({value:e,onSelect:t,children:n}){return(0,V.jsx)(m9.Item,{value:e,onSelect:t,className:`mx-1.5 px-2.5 py-1.5 rounded flex items-center gap-2 text-sm cursor-pointer data-[selected=true]:bg-panel-2 data-[selected=true]:text-fg text-muted`,children:n})}var S9=`Updating and restarting Frizz`,jne=`This may take a moment while the new build is being prepared. All of your threads will continue running normally.`;function Mne(e){if(e.key===`Tab`||e.key===`Enter`)return!0;if(e.metaKey||e.ctrlKey){let t=e.key.toLowerCase();if(t===`k`||t===`i`)return!0}return!1}function Nne({open:e,message:t}){let n=(0,B.useRef)(null);if((0,B.useEffect)(()=>{if(!e)return;let t=document.activeElement;t instanceof HTMLElement&&t.blur(),n.current?.focus({preventScroll:!0});let r=e=>{Mne(e)&&(e.preventDefault(),e.stopImmediatePropagation())};return window.addEventListener(`keydown`,r,{capture:!0}),()=>window.removeEventListener(`keydown`,r,{capture:!0})},[e]),!e)return null;let r=t?.trim()?t.trim():null;return(0,V.jsx)(`div`,{role:`alertdialog`,"aria-modal":`true`,"aria-label":S9,className:`fixed inset-0 z-[300] flex items-center justify-center bg-black/55 px-4 backdrop-blur-md backdrop-saturate-150`,children:(0,V.jsxs)(`div`,{ref:n,tabIndex:-1,className:`w-[min(26rem,calc(100vw-2rem))] rounded-2xl border border-border-strong bg-elevated p-6 text-center shadow-2xl shadow-black/60 outline-none`,children:[(0,V.jsx)(`span`,{className:`mx-auto flex h-11 w-11 items-center justify-center rounded-full bg-fg/10 text-fg`,children:(0,V.jsx)(_w,{size:20,strokeWidth:2.25,className:`animate-spin`,"aria-hidden":`true`})}),(0,V.jsx)(`h2`,{className:`mt-4 text-[15px] font-semibold tracking-[-0.01em] text-fg`,children:S9}),(0,V.jsx)(`p`,{className:`mt-2 text-[12.5px] leading-relaxed text-muted`,children:jne}),r&&(0,V.jsx)(`p`,{"aria-live":`polite`,className:`mt-2 text-[11.5px] leading-relaxed text-muted/80`,children:r})]})})}var C9=`frizz:reload-after-update-restart`,w9=!1;function Pne(){w9||(w9=!0,Q("Sign in to the GitHub CLI (`gh auth login`) to dispatch from issues/PRs.",{duration:6e3}))}function Fne(){let e=Hf(Z),t=(0,B.useRef)({projectDir:null,hasBeenVisible:!1});(0,B.useEffect)(()=>{X.board().then(nC).catch(()=>{})},[]);let n=YD();(0,B.useEffect)(()=>Bee((e,t)=>n(e,t)),[n]),(0,B.useEffect)(()=>{let e=!0,t,n=null,r=!1,i=async()=>{if(r)return;r=!0;let a=await TK();if(!e){r=!1;return}if(a){Z.controlPlaneRestartPending?a.state!==`ready`&&(Z.controlPlaneRestartPending=!1,Z.controlPlaneState=a.state,Z.controlPlaneMessage=a.message??null):(Z.controlPlaneState=a.state,Z.controlPlaneMessage=a.message??null);let e=sessionStorage.getItem(C9);if(a.state===`ready`&&e&&!Z.controlPlaneRestartPending){sessionStorage.removeItem(C9),window.location.replace(e),r=!1;return}a.state===`failed`&&e&&(sessionStorage.removeItem(C9),n!==a.message&&(n=a.message??`Update & Restart failed`,Q(`Update & Restart failed — Frizz kept running the previous version`,{duration:7e3})))}r=!1,t=setTimeout(i,Z.controlPlaneState===`restarting`?500:8e3)},a=()=>{t&&clearTimeout(t),i()};return window.addEventListener(xK,a),i(),()=>{e=!1,window.removeEventListener(xK,a),t&&clearTimeout(t)}},[]);let r=e.drawers.length>0||e.showSettings||e.showNewThread||e.showGithubPicker||e.showPalette;(0,B.useEffect)(()=>{if(!r)return;let e=window.scrollY,t=document.body;return hx(),t.style.position=`fixed`,t.style.top=`-${e}px`,t.style.left=`0`,t.style.right=`0`,t.style.width=`100%`,()=>{t.style.position=``,t.style.top=``,t.style.left=``,t.style.right=``,t.style.width=``,window.scrollTo(0,hx()??e)}},[r]);let i=qd({queryKey:[`settingsGet`],queryFn:()=>X.settingsGet()});(0,B.useEffect)(()=>{Z.notificationsEnabled=i.data?.notifications??!1},[i.data?.notifications]);let a=JH();(0,B.useEffect)(()=>{a.data?.inRepo&&!a.data.authed&&Pne()},[a.data?.inRepo,a.data?.authed]),(0,B.useEffect)(()=>{function e(e){if(e.target instanceof Element&&e.target.closest(`.xterm`)||!(e.metaKey||e.ctrlKey))return;let t=e.key.toLowerCase();if(t===`k`)e.preventDefault(),Z.showPalette=!Z.showPalette;else if(t===`i`){let t=YS(),n=$S();t?.kind===`doc`?(e.preventDefault(),lx(t.id)||Z.drawers.pop()):n&&(e.preventDefault(),BS(`doc`,n))}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let o=$A(),s=kY();(0,B.useEffect)(()=>{WS()},[o,e.routeThreadSlug]),t.current=Vee(t.current,o);let c=o!==null&&t.current.hasBeenVisible,l=o===null&&Hee(bx()),u=t.current.hasBeenVisible;(0,B.useEffect)(()=>{o!==null&&Uee(bx(),u)},[o,u]);let d=o?.projectLabel??o?.projectName;return(0,B.useEffect)(()=>{let e=window.matchMedia?.(`(display-mode: standalone)`).matches;document.title=e?d??`Frizz`:d?`${d} — Frizz`:`Frizz`},[d]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Nne,{open:e.controlPlaneState===`restarting`,message:e.controlPlaneMessage}),(0,V.jsxs)(`div`,{inert:e.controlPlaneState===`restarting`,className:`relative min-h-screen bg-bg text-fg text-sm`,children:[s?(0,V.jsx)(CY,{}):(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(`div`,{className:`flex min-h-screen justify-center gap-[clamp(28px,3.4vw,52px)] px-5 max-[800px]:flex-col max-[800px]:justify-start max-[800px]:gap-0 max-[800px]:px-3`,children:[c&&(0,V.jsx)(Pw,{label:`the sidebar`,children:(0,V.jsx)(PJ,{})}),l&&(0,V.jsx)(`aside`,{"aria-hidden":!0,className:`sticky top-0 self-start h-screen w-[clamp(272px,34vw,680px)] shrink-0 flex flex-col justify-center max-[800px]:static max-[800px]:h-auto max-[800px]:w-full max-[800px]:justify-start max-[800px]:pt-16`,"data-sidebar-reserved":!0}),(0,V.jsx)(`main`,{id:`workpane`,className:`w-[720px] max-w-[62vw] min-w-0 flex flex-col py-5 max-[800px]:w-full max-[800px]:max-w-none ${e.view===`todos`||!o?`min-h-screen`:``} ${e.view===`todos`?``:`rounded-lg border border-border bg-panel`}`,children:o?(0,V.jsxs)(Pw,{label:`the queue`,resetKeys:[e.view],children:[e.view.startsWith(`status:`)&&(0,V.jsx)(oY,{status:e.view.slice(7)}),e.view===`todos`&&(0,V.jsx)(L7,{})]}):(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,V.jsx)(`span`,{className:`block h-5 w-5 rounded-full border-2 border-muted/50 border-t-transparent animate-spin`})})})]})}),(0,V.jsx)(v7,{}),e.showSettings&&(0,V.jsx)(Ute,{}),e.showNewThread&&(0,V.jsx)(lW,{onClose:()=>{Z.showNewThread=!1}}),e.showGithubPicker&&(0,V.jsx)(Ote,{onClose:NS}),(0,V.jsx)(Ane,{})]})]})}function T9(e,t,n){let r=[...e];if(t<0||t>=r.length||n<0||n>=r.length||t===n)return r;let[i]=r.splice(t,1);return r.splice(n,0,i),r}function Ine(e,t,n,r=48){let i=Math.round(t/r);return Math.max(0,Math.min(n-1,e+i))}function Lne(e,t,n,r=48){return e===t?0:n>t&&e>t&&e<=n?-r:n<t&&e>=n&&e<t?r:0}function E9(e,t,n=44,r=14){let i=t.top+n-e;if(i>0)return-Math.min(r,i/n*r);let a=e-(t.bottom-n);return a>0?Math.min(r,a/n*r):0}var Rne=`w-[57px]`,zne=`max-[800px]:pl-0 pl-[57px]`;function Bne(e){let t=0;for(let n=0;n<e.length;n++)t=(t*31+e.charCodeAt(n))%360;return t}function Vne(e){let t=e.split(/[\s\-_./]+/u).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[1][0]).toUpperCase()}function Hne(e){let t=e.iconVersion?`&v=${encodeURIComponent(e.iconVersion)}`:``;return`/_frizz/project-icon?id=${encodeURIComponent(e.id)}${t}`}function D9({project:e,size:t}){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1),o=Bne(e.id),s=e.iconStatus!==`none`,[c,l]=(0,B.useState)(!1),u=!s||c;return(0,V.jsxs)(`span`,{className:`relative block overflow-hidden rounded-[30%] bg-elevated`,style:{width:t,height:t,background:s&&!c?void 0:`hsl(${o} 32% 24%)`},children:[u&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-0 flex items-center justify-center font-semibold leading-none`,style:{fontSize:t*.4,color:`hsl(${o} 55% 78%)`},children:(0,V.jsx)(`span`,{style:{textBox:`trim-both cap alphabetic`},children:Vne(e.name)})}),s&&!c&&(0,V.jsx)(`img`,{src:Hne(e),alt:``,width:t,height:t,loading:`eager`,decoding:`async`,onLoad:e=>{let t=e.currentTarget;t.naturalWidth>0&&t.naturalHeight>0&&a(Math.abs(t.naturalWidth/t.naturalHeight-1)<=.05),r(!0)},onError:()=>l(!0),className:`relative h-full w-full transition-opacity ${i?`object-cover`:`object-contain p-[6%]`} ${n?`opacity-100`:`opacity-0`}`})]})}var Une=40;function Wne({project:e,current:t,count:n,index:r,drag:i,onPointerDown:a,onKeyDown:o}){let s=i?.fromIndex===r,c=i?s?i.deltaY:Lne(r,i.fromIndex,i.toIndex):0;return(0,V.jsx)(Pq,{side:`right`,disabled:i!==null,label:e.stale?`${e.name} — directory is missing`:n?`${e.name} — ${n} in the queue`:e.name,children:(0,V.jsxs)(mk,{to:xx(e.slug),"aria-current":t?`page`:void 0,"aria-grabbed":s||void 0,onPointerDown:e=>a(e,r),onKeyDown:e=>o(e,r),onClick:e=>{(i||qne())&&e.preventDefault()},onDragStart:e=>e.preventDefault(),className:`group relative flex h-10 w-full items-center justify-center outline-none ${s?`z-10 cursor-grabbing`:``}`,style:{transform:c?`translateY(${c}px)`:void 0,transition:s?`none`:`transform 160ms ease`},children:[(0,V.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 w-[3px] rounded-r-full bg-fg transition-all duration-150 ${t?`h-7 opacity-100`:`h-2.5 opacity-0 group-hover:opacity-60`}`}),(0,V.jsx)(`span`,{className:`rounded-[30%] transition-[transform,opacity,box-shadow] duration-150 group-focus-visible:ring-1 group-focus-visible:ring-fg/60 ${s?`scale-[1.12] opacity-100 shadow-lg shadow-black/50`:`group-hover:scale-[1.06] ${t?``:`opacity-75 group-hover:opacity-100`}`} ${e.stale?`grayscale`:``}`,children:(0,V.jsx)(D9,{project:e,size:Une})}),n?(0,V.jsx)(`span`,{"aria-label":`${n} in the queue`,"data-rail-queue-count":n,className:`pointer-events-none absolute -bottom-[5px] right-[3px] flex h-[16px] min-w-[16px] items-center justify-center rounded-full border-[1.5px] border-bg bg-accent px-[3.5px] text-[10px] font-semibold leading-none proportional-nums text-bg`,children:(0,V.jsx)(`span`,{style:{textBox:`trim-both cap alphabetic`},children:n})}):null]})})}function Gne({project:e,children:t}){let n=(0,B.useRef)(null),r=Md(),i=()=>r.invalidateQueries({queryKey:[`projectsList`]}),a=e=>Q(e instanceof Error?e.message:String(e),{duration:7e3}),o=Jd({mutationFn:async t=>{let n=new Uint8Array(await t.arrayBuffer()),r=``;for(let e=0;e<n.length;e+=8192)r+=String.fromCharCode(...n.subarray(e,e+8192));return X.projectIconSet({id:e.id,name:t.name,data:btoa(r)})},onSuccess:()=>void i(),onError:a}),s=Jd({mutationFn:()=>X.projectIconClear({id:e.id}),onSuccess:()=>void i(),onError:a}),c=Jd({mutationFn:()=>X.projectIconPick({id:e.id}),onSuccess:e=>{if(e.kind!==`cancelled`){if(e.kind===`unavailable`){n.current?.click();return}i()}},onError:()=>n.current?.click()}),l=`cursor-default rounded px-2 py-1.5 text-[12.5px] text-fg outline-none data-[highlighted]:bg-panel-2`;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`input`,{ref:n,type:`file`,accept:tx.map(e=>`.${e}`).join(`,`),className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&o.mutate(t)}}),(0,V.jsxs)(lV,{children:[(0,V.jsx)(uV,{asChild:!0,children:t}),(0,V.jsx)(dV,{children:(0,V.jsxs)(fV,{align:`start`,sideOffset:6,className:`z-[220] min-w-[190px] rounded-lg border border-border bg-panel p-1 shadow-xl shadow-black/40`,children:[(0,V.jsx)(hV,{className:l,onSelect:()=>c.mutate(),children:o.isPending?`Uploading…`:`Choose an icon…`}),(0,V.jsx)(hV,{className:l,onSelect:()=>s.mutate(),children:e.iconIsCustom?`Use the detected icon`:`Look for an icon again`})]})})]})]})}var Kne=4,O9=0;function qne(){return Date.now()-O9<250}function Jne(e,t){let n=qd({queryKey:[`projectsQueueCounts`],queryFn:()=>X.projectsQueueCounts(),refetchInterval:5e3}),r=Hf(Z).board,i=e!==void 0&&r?tj(r.threads).filter(iM).length:void 0,a=e===void 0?void 0:t.find(t=>t.slug===e)?.id;return e=>e.id===a&&i!==void 0?i:n.data?.[e.id]}function Yne(){let e=Md(),{data:t}=qd({queryKey:[`projectsList`],queryFn:()=>X.projectsList()}),n=bx(),[r,i]=(0,B.useState)(!1),a=YD(),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),u=(0,B.useRef)(null),d=Jd({mutationFn:()=>X.projectPick({}),onSuccess:e=>{e.kind===`picked`?a(xx(e.project.slug)):e.kind===`unavailable`&&a(`/`)},onSettled:()=>i(!1)}),f=Jd({mutationFn:e=>X.projectsReorder({ids:e}),onSuccess:async()=>{await e.invalidateQueries({queryKey:[`projectsList`]}),l(null)},onError:()=>l(null)}),p=c??t??[],m=Jne(n,p),[h,g]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=u.current;if(!e)return;let t=()=>g(e.scrollTop+e.clientHeight<e.scrollHeight-1);t(),e.addEventListener(`scroll`,t,{passive:!0});let n=new ResizeObserver(t);return n.observe(e),window.addEventListener(`resize`,t),()=>{e.removeEventListener(`scroll`,t),n.disconnect(),window.removeEventListener(`resize`,t)}},[p.length]);let _=(0,B.useCallback)((e,t)=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let n=e.currentTarget,r=e.clientY,i=p,a=!1,o=null,c=0,d=e=>{let n=u.current,a=0;if(n){let t=E9(e,n.getBoundingClientRect());if(t){let e=n.scrollTop;n.scrollTop+=t,a=n.scrollTop-e}}m+=a;let c=e-r+m;o={id:i[t].id,fromIndex:t,toIndex:Ine(t,c,i.length),deltaY:c},s(o)},m=0,h=e=>{if(!a){if(Math.abs(e.clientY-r)<Kne)return;a=!0,n.setPointerCapture(e.pointerId)}e.preventDefault();let t=e.clientY;cancelAnimationFrame(c);let i=()=>{d(t),u.current&&E9(t,u.current.getBoundingClientRect())&&(c=requestAnimationFrame(i))};c=requestAnimationFrame(i)},g=()=>{if(cancelAnimationFrame(c),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g),s(null),!a||!o)return;O9=Date.now();let e=T9(i,o.fromIndex,o.toIndex);o.fromIndex!==o.toIndex&&(l(e),f.mutate(e.map(e=>e.id)))};window.addEventListener(`pointermove`,h,{passive:!1}),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[p,f]),v=(0,B.useCallback)((e,t)=>{if(!e.altKey||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;let n=t+(e.key===`ArrowUp`?-1:1);if(n<0||n>=p.length)return;e.preventDefault();let r=T9(p,t,n);l(r),f.mutate(r.map(e=>e.id)),requestAnimationFrame(()=>{u.current?.querySelectorAll(`a`)[n]?.focus()})},[p,f]);return(0,V.jsxs)(`nav`,{"aria-label":`Projects`,className:`fixed inset-y-0 left-0 z-[60] flex flex-col items-center border-r border-border bg-panel/60 py-3 max-[800px]:hidden ${Rne}`,children:[(0,V.jsx)(Pq,{side:`right`,label:`All projects`,children:(0,V.jsx)(mk,{to:`/`,"aria-label":`All projects`,"aria-current":n?void 0:`page`,className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted/70 outline-none transition-colors hover:bg-elevated hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:(0,V.jsx)(nw,{size:17})})}),(0,V.jsx)(`hr`,{className:`my-2.5 w-6 shrink-0 border-0 border-t border-border`}),(0,V.jsx)(`div`,{ref:u,"data-overflowing":h||void 0,className:`frizz-rail-scroll flex w-full min-h-0 flex-1 flex-col items-center gap-2 overflow-y-auto pb-1.5`,children:p.map((e,t)=>(0,V.jsx)(Wne,{project:e,index:t,current:e.slug===n,count:m(e),drag:o,onPointerDown:_,onKeyDown:v},e.id))}),(0,V.jsx)(Pq,{side:`right`,label:`Add a project`,children:(0,V.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>{i(!0),d.mutate()},"aria-label":`Add a project`,className:`mt-3 flex h-10 w-10 shrink-0 items-center justify-center rounded-[30%] border-[1.5px] border-dotted border-border-strong text-muted/80 outline-none transition-colors hover:border-accent hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 disabled:opacity-50`,children:(0,V.jsx)(hw,{size:16})})})]})}var k9=76;function Xne(e,t){return t&&e.startsWith(`${t}/`)?`~${e.slice(t.length)}`:e}var A9=`flex flex-col gap-1 rounded-lg border px-4 py-3 outline-none transition-colors focus-visible:ring-1 focus-visible:ring-fg/60`,Zne=`max-[700px]:rounded-none max-[700px]:border-x-0 max-[700px]:border-t-0 max-[700px]:border-b-border/70 max-[700px]:bg-transparent max-[700px]:py-3.5`,j9=38;function Qne({project:e,home:t}){let n=wM(e.lastOpenedAt);return(0,V.jsxs)(`div`,{className:`group/card relative`,children:[(0,V.jsxs)(mk,{to:xx(e.slug),className:`${A9} ${Zne} flex-row items-center gap-3 border-border bg-panel group-hover/card:border-border-strong group-hover/card:bg-panel-2 ${e.stale?`opacity-60`:``}`,children:[(0,V.jsx)(`span`,{className:`shrink-0 ${e.stale?`grayscale`:``}`,children:(0,V.jsx)(D9,{project:e,size:j9})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium text-fg`,children:e.name}),e.slug===e.name?null:(0,V.jsxs)(`span`,{className:`max-w-[45%] shrink-0 truncate font-mono text-[11px] text-muted/70`,children:[`/`,e.slug]})]}),(0,V.jsx)(`span`,{className:`truncate text-[11px] text-muted`,title:e.path,children:Xne(e.path,t)}),(0,V.jsx)(`span`,{className:`truncate text-[11px] text-muted/70`,children:e.stale?`Directory is missing`:n?`Opened ${n}`:`Never opened`})]})]}),(0,V.jsx)(Gne,{project:e,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":`Change the icon for ${e.name}`,style:{width:j9,height:j9},className:`absolute left-[17px] top-1/2 flex -translate-y-1/2 items-center justify-center rounded-[30%] bg-black/75 text-fg opacity-0 outline-none transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-1 focus-visible:ring-fg/60 data-[state=open]:opacity-100 max-[700px]:left-4 max-[700px]:top-[calc(50%-0.5px)]`,children:(0,V.jsx)(rw,{size:16,strokeWidth:1.75})})})]})}function $ne({hero:e,pending:t,onClick:n}){return(0,V.jsxs)(`button`,{type:`button`,onClick:n,disabled:t,className:`${A9} items-center justify-center gap-1.5 border-dashed border-border-strong bg-transparent text-muted hover:border-accent hover:text-fg max-[700px]:mx-4 max-[700px]:mt-4 ${e?`min-h-[118px]`:`min-h-[74px]`}`,children:[(0,V.jsx)(`span`,{className:`text-[17px] leading-none text-muted/70`,children:`+`}),(0,V.jsx)(`span`,{className:`text-[12.5px]`,children:t?`Choosing a folder…`:`Add a project`}),e?(0,V.jsx)(`span`,{className:`text-[11px] text-muted/70`,children:`Point Frizz at a folder on this machine`}):null]})}function ere({reason:e,proposed:t,onClose:n}){let[r,i]=(0,B.useState)(t??``),a=YD(),o=Md(),s=Jd({mutationFn:e=>X.projectAdd({path:e}),onSuccess:e=>{o.invalidateQueries({queryKey:[`projectsList`]}),a(xx(e.slug))}}),c=s.error instanceof Error?s.error.message:s.error?String(s.error):null;return(0,V.jsx)(FV,{open:!0,onOpenChange:e=>{!e&&!s.isPending&&n()},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] w-[460px] max-w-[90vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,V.jsx)(QV,{className:`mb-1 text-[14px] font-medium`,children:t?`Add this folder as a project?`:`Add a project`}),(0,V.jsx)(`p`,{className:`mb-3.5 text-[12.5px] leading-relaxed text-muted`,children:t?`You ran Frizz here and it is not a project yet. Nothing has been written — adding it is what creates its board.`:e?`${e}. Paste the folder instead — Frizz walks up to the repository root, the same way it does when you run it in a terminal.`:`Paste the folder you want a board for. Frizz walks up to the repository root, the same way it does when you run it in a terminal.`}),(0,V.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),s.isPending||s.mutate(r)},children:[(0,V.jsx)(`input`,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),placeholder:`~/code/my-project`,spellCheck:!1,className:`w-full rounded-md border bg-bg px-2.5 py-2 font-mono text-[12px] text-fg outline-none placeholder:text-muted/50 focus-visible:ring-1 focus-visible:ring-fg/60 ${c?`border-red-500/60`:`border-border-strong`}`}),c?(0,V.jsx)(`p`,{className:`mt-1.5 text-[11.5px] text-red-400`,children:c}):null,(0,V.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:n,disabled:s.isPending,className:`rounded-md border border-border-strong bg-elevated px-3 py-1.5 text-[12.5px] text-fg outline-none hover:bg-panel-2 focus-visible:ring-1 focus-visible:ring-fg/60 disabled:opacity-50`,children:t?`Not now`:`Cancel`}),(0,V.jsx)(`button`,{type:`submit`,disabled:s.isPending||r.trim().length===0,className:`rounded-md border border-accent bg-accent px-3 py-1.5 text-[12.5px] font-medium text-bg outline-none hover:brightness-110 focus-visible:ring-1 focus-visible:ring-fg/60 disabled:opacity-50`,children:s.isPending?`Adding…`:t?`Add it`:`Add project`})]})]})]})]})})}function tre(){let[e]=(0,B.useState)(()=>{let e=new URLSearchParams(location.search).get(`add`)??void 0;return e&&history.replaceState(null,``,location.pathname),e}),[t,n]=(0,B.useState)(e?{}:null);(0,B.useEffect)(()=>{let e=new URLSearchParams(location.search).get(`unknown`);e&&(history.replaceState(null,``,location.pathname),Q(`No project named ${e} — showing all projects instead`,{duration:7e3}))},[]);let r=YD(),i=Md(),a=Jd({mutationFn:()=>X.projectPick({}),onSuccess:e=>{if(e.kind!==`cancelled`){if(e.kind===`unavailable`){n({reason:e.reason});return}i.invalidateQueries({queryKey:[`projectsList`]}),r(xx(e.project.slug))}},onError:e=>n({reason:e instanceof Error?e.message:String(e)})}),{data:o,isPending:s,error:c}=qd({queryKey:[`projectsList`],queryFn:()=>X.projectsList()}),l=o?.[0]?.path.match(/^(\/(?:Users|home)\/[^/]+)\//u)?.[1],u=o!==void 0&&o.length===0;return(0,V.jsxs)(`div`,{className:`flex min-h-dvh w-full flex-col px-6 py-14 max-[700px]:px-0 max-[700px]:py-10`,children:[(0,V.jsxs)(`div`,{className:`m-auto flex w-full flex-col items-center`,children:[(0,V.jsxs)(`div`,{className:`mb-8 flex flex-col items-center gap-2.5 text-center`,children:[(0,V.jsx)(`img`,{src:`/favicon.svg`,width:k9,height:k9,alt:``,className:`rounded-[17px]`}),(0,V.jsx)(`h1`,{className:`text-[19px] font-semibold tracking-[-0.01em] text-fg`,children:u?`Welcome to Frizz`:`Select a project`}),u?(0,V.jsx)(`p`,{className:`max-w-[420px] text-[13px] leading-relaxed text-muted`,children:`A project is a folder on this machine. Frizz keeps one board of threads per project, and serves them all from here.`}):null]}),c?(0,V.jsxs)(`p`,{className:`text-[13px] text-muted`,children:[`Could not read the project registry: `,String(c)]}):s?(0,V.jsx)(`p`,{className:`text-[13px] text-muted`,children:`Loading…`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`grid w-full gap-2.5 max-[700px]:gap-0 ${u?`max-w-[360px] grid-cols-1`:`max-w-[720px] grid-cols-1 sm:grid-cols-2`}`,children:[o.map(e=>(0,V.jsx)(Qne,{project:e,home:l},e.id)),(0,V.jsx)($ne,{hero:u,pending:a.isPending,onClick:()=>a.mutate()})]}),u?(0,V.jsxs)(`p`,{className:`mt-6 text-[11.5px] text-muted/70`,children:[`Or run`,` `,(0,V.jsx)(`code`,{className:`rounded border border-border bg-panel px-1.5 py-0.5 font-mono text-muted`,children:`frizz`}),` `,`inside any folder — it registers itself and opens.`]}):null]})]}),t?(0,V.jsx)(ere,{reason:t.reason,proposed:e,onClose:()=>n(null)}):null]})}function M9(){let e=Hf(Z),t=e.toast,[n,r]=(0,B.useState)(!1),i=e.drawers.some(e=>!e.closing);return(0,B.useEffect)(()=>{if(!t||(r(!0),t.sticky))return;let e=setTimeout(()=>r(!1),t.duration??(t.link?5e3:1600));return()=>clearTimeout(e)},[t?.id]),t?(0,V.jsx)(`div`,{className:`pointer-events-none fixed right-4 z-[70] flex justify-end ${i?`bottom-20`:`bottom-4`}`,children:(0,V.jsxs)(`div`,{"data-toast":!0,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`flex max-w-[min(30rem,calc(100vw-2rem))] items-center gap-2.5 break-words rounded-lg border border-border-strong bg-elevated px-4 py-2 text-[13px] font-medium text-fg shadow-xl shadow-black/40 transition-all duration-200 ease-out ${n?`translate-y-0 opacity-100`:`translate-y-8 opacity-0`}`,children:[t.spinner&&(0,V.jsx)(cw,{size:13,className:`animate-spin text-muted`}),t.text,t.link&&(0,V.jsx)(`button`,{onClick:()=>{BS(`thread`,t.link.slug),Z.toast=null},className:`pointer-events-auto shrink-0 rounded-md border border-border px-2 py-0.5 text-[12px] text-fg/90 transition-colors hover:bg-panel-2`,children:t.link.label})]})}):null}function N9(e,t){return`${xx(e)}${Ex(t,`/`)}`}function nre({slug:e}){let t=$A(),n=gx(t,e),r=n.kind===`found`?n.thread:void 0;t?.projectDir,(0,B.useEffect)(()=>{X.board().then(nC).catch(()=>{})},[]);let i=r?.runtime===`turn-idle`||r?.runtime===`exited`||r?.runtime===`none`;return(0,B.useEffect)(()=>{!r||!i||X.threadSeen({slug:e}).catch(()=>{})},[i,e,r?.lastActivityAt]),(0,B.useEffect)(()=>{let n=t?.projectLabel??t?.projectName,i=r?Uj(r):e;document.title=n?`${i} · ${n} — Frizz`:`${i} · Frizz`},[t?.projectLabel,t?.projectName,e,r]),(0,V.jsx)(Nq,{children:(0,V.jsxs)(`div`,{className:`h-dvh min-h-0 bg-bg px-0 text-sm text-fg sm:px-5`,children:[(0,V.jsx)(`main`,{"data-standalone-thread":!0,className:`mx-auto flex h-full w-full max-w-[900px] min-w-0 flex-col overflow-hidden border-border bg-panel sm:border-x`,children:n.kind===`loading`?(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,role:`status`,"aria-label":`Loading thread`,children:(0,V.jsx)(`span`,{className:`block h-5 w-5 animate-spin rounded-full border-2 border-muted/50 border-t-transparent`})}):n.kind===`missing`?(0,V.jsx)(rre,{slug:e}):(0,V.jsx)(E8,{slug:e,virtualized:!0,showReturnToQueue:!0})}),(0,V.jsx)(v7,{}),(0,V.jsx)(M9,{})]})})}function rre({slug:e}){let{data:t,isPending:n}=qd({queryKey:[`threadLocate`,e],queryFn:()=>X.threadLocate({slug:e})});return(0,B.useEffect)(()=>{t?.length===1&&location.replace(N9(t[0].projectSlug,e))},[t,e]),(0,V.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 px-6 text-center`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h1`,{className:`font-medium text-fg`,children:`Thread unavailable`}),n?(0,V.jsxs)(`p`,{className:`mt-1 text-muted`,children:[`Looking for “`,e,`” in your other projects…`]}):t&&t.length>0?(0,V.jsxs)(`p`,{className:`mt-1 text-muted`,children:[`“`,e,`” lives in `,t.length===1?`another project`:`these projects`,` — opening it there.`]}):(0,V.jsxs)(`p`,{className:`mt-1 text-muted`,children:[`Thread “`,e,`” was not found in any project on this machine.`]})]}),t&&t.length>1?(0,V.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:t.map(t=>(0,V.jsx)(`a`,{href:N9(t.projectSlug,e),className:`rounded-md border border-border px-3 py-1.5 text-[12px] text-fg/90 hover:bg-panel-2`,children:t.projectName},t.projectSlug))}):(0,V.jsx)(`a`,{href:`/`,className:`rounded-md border border-border px-3 py-1.5 text-[12px] text-fg/90 hover:bg-panel-2`,children:`All projects`})]})}var ire={OPEN_ISSUE:{bg:`#238636`,icon:zC,label:`Open`},CLOSED_ISSUE:{bg:`#8957e5`,icon:LC,label:`Closed`},NOT_PLANNED:{bg:`#656c76`,icon:VC,label:`Closed as not planned`},OPEN_PR:{bg:`#238636`,icon:$C,label:`Open`},DRAFT:{bg:`#656c76`,icon:QC,label:`Draft`},MERGED:{bg:`#8957e5`,icon:XC,label:`Merged`},CLOSED_PR:{bg:`#da3633`,icon:ZC,label:`Closed`}};function are(e){return e.kind===`commit`?null:e.state===`MERGED`?`MERGED`:e.state===`DRAFT`?`DRAFT`:e.state===`OPEN`?e.kind===`pr`?`OPEN_PR`:`OPEN_ISSUE`:e.state===`CLOSED`?e.kind===`pr`?`CLOSED_PR`:e.stateReason===`NOT_PLANNED`?`NOT_PLANNED`:`CLOSED_ISSUE`:null}function P9(e,t=Date.now()){if(!e)return``;let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=n.getFullYear()===new Date(t).getFullYear();return n.toLocaleDateString(void 0,{month:`short`,day:`numeric`,...r?{}:{year:`numeric`}})}function ore(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.max(0,Math.floor((t-n)/1e3)),i=(e,t)=>`${e} ${t}${e===1?``:`s`} ago`;if(r<60)return`just now`;if(r<3600)return i(Math.floor(r/60),`minute`);if(r<86400)return i(Math.floor(r/3600),`hour`);let a=Math.floor(r/86400);return a<7?i(a,`day`):a<30?i(Math.floor(a/7),`week`):a<365?i(Math.floor(a/30),`month`):`on ${P9(e,t)}`}function sre(e,t){let n=e+t;if(n<=0)return[,,,,,].fill(`none`);let r=Math.min(5,Math.floor(e/n*5)),i=Math.min(5-r,Math.floor(t/n*5));return[...Array(r).fill(`add`),...Array(i).fill(`del`),...Array(5-r-i).fill(`none`)]}var F9={add:`#3fb950`,del:`#f85149`},cre={add:{backgroundColor:`#238636`,borderColor:`#238636`},del:{backgroundColor:`#da3633`,borderColor:`#da3633`},none:{backgroundColor:`#656c7633`,borderColor:`#3d444d`}};function I9({additions:e,deletions:t}){return(0,V.jsxs)(`div`,{className:`flex items-baseline gap-1.5 text-[12px] tabular-nums`,children:[(0,V.jsxs)(`span`,{"data-gh-add":!0,style:{color:F9.add},children:[`+`,e.toLocaleString()]}),(0,V.jsxs)(`span`,{"data-gh-del":!0,style:{color:F9.del},children:[`−`,t.toLocaleString()]}),(0,V.jsx)(`span`,{"data-gh-blocks":!0,className:`ml-0.5 inline-flex gap-[1px] self-baseline translate-y-[calc(4px_-_0.5cap)]`,children:sre(e,t).map((e,t)=>(0,V.jsx)(`span`,{className:`size-[8px] rounded-[2px] border`,style:cre[e]},t))})]})}function lre({card:e}){let t=are(e),n=t?ire[t]:void 0;if(!n)return null;let r=n.icon;return(0,V.jsxs)(`span`,{"data-gh-pill":!0,className:`inline-flex items-baseline gap-1 rounded-full px-2.5 py-1 text-[12px] font-medium text-white`,style:{backgroundColor:n.bg},children:[(0,V.jsx)(r,{strokeWidth:2,"aria-hidden":!0,className:`size-[1.1em] shrink-0 self-baseline -mr-px translate-y-[calc(0.55em_-_0.5cap)]`}),(0,V.jsx)(`span`,{"data-gh-pill-label":!0,children:n.label})]})}function ure({name:e,color:t}){let n=/^[0-9a-fA-F]{6}$/.test(t)?`#${t}`:`#8b8f96`;return(0,V.jsx)(`span`,{className:`inline-flex items-center rounded-full border px-2 py-[1px] text-[11px] font-medium`,style:{color:n,backgroundColor:`${n}26`,borderColor:`${n}59`},children:e})}var dre=/`([^`\n]+)`/g;function fre(e,t){if(!t)return[e];let n=[],r=0;for(let t of e.matchAll(dre))t.index>r&&n.push(e.slice(r,t.index)),n.push({code:t[1]}),r=t.index+t[0].length;return r<e.length&&n.push(e.slice(r)),n}function L9({text:e,code:t,className:n}){return(0,V.jsx)(`div`,{className:n,children:fre(e,t).map((e,t)=>typeof e==`string`?e:(0,V.jsx)(`code`,{className:`rounded-[3px] bg-panel-2 px-[3px] py-[1px] font-mono-keep text-[0.92em]`,children:e.code},t))})}var pre=new Set([`avatars.githubusercontent.com`,`camo.githubusercontent.com`]);function mre(e){if(e)try{let t=new URL(e);return t.protocol===`https:`&&pre.has(t.hostname)?e:void 0}catch{return}}function R9({card:e,nowMs:t}){let n=mre(e.authorAvatar),r=e.authorLogin??e.authorName??`Someone`,i=e.kind===`commit`?`committed`:e.kind===`pr`?`opened this pull request`:`opened this issue`,a=ore(e.at,t);return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border px-3 py-2 text-[12px] text-muted`,children:[n?(0,V.jsx)(`img`,{"data-gh-avatar":!0,src:n,alt:``,className:`size-[18px] shrink-0 rounded-full`}):(0,V.jsx)(`span`,{"data-gh-avatar":!0,className:`size-[18px] shrink-0 rounded-full bg-border`}),(0,V.jsxs)(`span`,{"data-gh-byline-text":!0,className:`truncate`,children:[(0,V.jsx)(`span`,{className:`text-fg`,children:r}),` `,i,` `,a]})]})}var z9=`w-[360px] max-w-[min(360px,calc(100vw-24px))] leading-normal`;function hre({card:e,nowMs:t=Date.now()}){let n=e.additions!==void 0&&e.deletions!==void 0;if(e.kind===`commit`)return(0,V.jsxs)(`div`,{className:z9,children:[(0,V.jsxs)(`div`,{className:`flex items-baseline gap-2 px-3 pt-3 pb-2.5`,children:[(0,V.jsx)(`span`,{"data-gh-commit-glyph":!0,className:`shrink-0 self-baseline -mr-px text-[14px] translate-y-[calc(0.5em_-_0.5cap)]`,children:(0,V.jsx)(YC,{className:`size-[1em] text-muted`,"aria-hidden":!0})}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-[14px] font-semibold leading-snug text-fg`,children:e.title}),e.body?(0,V.jsx)(L9,{text:e.body,code:!1,className:`mt-1.5 line-clamp-6 text-[12px] text-muted`}):null,n?(0,V.jsx)(`div`,{className:`mt-2.5`,children:(0,V.jsx)(I9,{additions:e.additions,deletions:e.deletions})}):null]})]}),(0,V.jsx)(R9,{card:e,nowMs:t})]});let r=e.ref.slice(e.ref.indexOf(`#`));return(0,V.jsxs)(`div`,{className:z9,children:[(0,V.jsxs)(`div`,{className:`px-3 pt-3 pb-3`,children:[(0,V.jsxs)(`div`,{className:`text-[12px] text-muted`,children:[(0,V.jsx)(`span`,{className:`underline decoration-border underline-offset-2`,children:e.repo}),e.at?` on ${P9(e.at,t)}`:``]}),(0,V.jsxs)(`div`,{className:`mt-1 text-[14px] font-semibold leading-snug text-fg`,children:[e.title,` `,(0,V.jsx)(`span`,{className:`font-normal text-muted`,children:r})]}),(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,V.jsx)(lre,{card:e}),n?(0,V.jsx)(I9,{additions:e.additions,deletions:e.deletions}):null]})]}),e.body||e.labels.length>0?(0,V.jsxs)(`div`,{className:`border-t border-border px-3 py-2.5`,children:[e.body?(0,V.jsx)(L9,{text:e.body,code:!0,className:`line-clamp-2 text-[12px] text-muted`}):null,e.labels.length>0?(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1 ${e.body?`mt-2`:``}`,children:e.labels.map(e=>(0,V.jsx)(ure,{name:e.name,color:e.color},e.name))}):null]}):null,(0,V.jsx)(R9,{card:e,nowMs:t})]})}var gre=250,_re=180;function vre(e){let t=e.getClientRects()[0]??e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}}function yre(){let[e,t]=(0,B.useState)(null),n=(0,B.useRef)(void 0),r=(0,B.useRef)(void 0),i=(0,B.useRef)(!1),a=(0,B.useCallback)(()=>{clearTimeout(n.current),clearTimeout(r.current),n.current=void 0,r.current=void 0},[]),o=(0,B.useCallback)(()=>{clearTimeout(r.current),r.current=setTimeout(()=>{i.current||t(null)},_re)},[]);return(0,B.useEffect)(()=>{let i=i=>{if(i.pointerType!==`mouse`)return;let a=i.target?.closest?.(`a[data-gh-ref]`)??null,o=a?.getAttribute(`data-gh-ref`);!a||!o||(clearTimeout(r.current),e?.ref!==o&&(clearTimeout(n.current),_S([o]),n.current=setTimeout(()=>t({ref:o,rect:vre(a)}),gre)))},a=e=>{e.pointerType===`mouse`&&e.target?.closest?.(`a[data-gh-ref]`)&&(clearTimeout(n.current),o())};return document.addEventListener(`pointerover`,i),document.addEventListener(`pointerout`,a),()=>{document.removeEventListener(`pointerover`,i),document.removeEventListener(`pointerout`,a)}},[e?.ref,o]),(0,B.useEffect)(()=>{if(!e)return;let n=()=>{i.current=!1,a(),t(null)};return window.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[e,a]),(0,B.useEffect)(()=>a,[a]),(0,V.jsxs)(nK,{open:e!==null,children:[(0,V.jsx)(iK,{asChild:!0,children:(0,V.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none fixed`,style:{top:e?.rect.top??0,left:e?.rect.left??0,width:e?.rect.width??0,height:e?.rect.height??0}})}),e?(0,V.jsx)(aK,{side:`top`,align:`start`,sideOffset:8,alignOffset:-8,"aria-hidden":!0,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onPointerEnter:()=>{i.current=!0,clearTimeout(r.current)},onPointerLeave:()=>{i.current=!1,o()},className:`overflow-hidden`,children:(0,V.jsx)(bre,{refKey:e.ref})}):null]})}function bre({refKey:e}){let t=(0,B.useSyncExternalStore)(fS,()=>pS(e),()=>pS(e));return(0,B.useEffect)(()=>{mS(pS(e))&&xS(e)},[e]),t?.card?(0,V.jsx)(hre,{card:t.card}):(0,V.jsx)(`div`,{className:`flex h-[64px] w-[220px] items-center px-3 text-[12px] text-muted`,children:t?.missing?`Not found on GitHub`:`Loading…`})}var B9=`frizz-project-rail`;function xre(){try{return localStorage.getItem(B9)===`shown`}catch{return!1}}function Sre(e){try{localStorage.setItem(B9,e?`shown`:`hidden`)}catch{}}function Cre(){qD();let e=qd({queryKey:[`settingsGet`],queryFn:()=>X.settingsGet(),placeholderData:Wu}).data?.projectRail;return(0,B.useEffect)(()=>{e!==void 0&&Sre(e===!0)},[e]),e===void 0?xre():e===!0}var V9=`/project/:slug`;function wre(){let e=Cre();return(0,V.jsxs)(Nq,{children:[e?(0,V.jsx)(Yne,{}):null,(0,V.jsx)(`div`,{className:e?zne:void 0,children:(0,V.jsx)(Fee,{})}),(0,V.jsx)(M9,{}),(0,V.jsx)(yre,{})]})}function H9(e){(0,B.useEffect)(()=>{IA(e)||(tC(),ZA())},[e])}function U9(){let{slug:e}=$D();return H9(e),Ere(),(0,V.jsx)(Fne,{},e??`__launching__`)}function Tre(){return(0,V.jsx)(tre,{})}function Ere(){let e=qD();(0,B.useEffect)(()=>{vj(Cx(e.pathname))},[e.pathname])}function W9(){let{thread:e,slug:t}=$D();return H9(t),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(nre,{slug:e}),(0,V.jsx)(M9,{})]})}var Dre=[{index:!0,element:(0,V.jsx)(U9,{})},{path:`thread/:thread`,element:(0,V.jsx)(U9,{})},{path:`status/:status`,element:(0,V.jsx)(U9,{})}],Ore=uk([{path:`/thread/:thread/full`,element:(0,V.jsx)(W9,{})},{path:`${V9}/thread/:thread/full`,element:(0,V.jsx)(W9,{})},{element:(0,V.jsx)(wre,{}),children:[{path:`/`,element:(0,V.jsx)(Tre,{})},{path:`/thread/:thread`,element:(0,V.jsx)(U9,{})},{path:`/status/:status`,element:(0,V.jsx)(U9,{})},{path:V9,children:Dre},{path:`*`,element:(0,V.jsx)(U9,{})}]}]),kre=24,Are=6,jre=700,G9=new Map,K9=null,q9=null;function Mre(e){return!Array.isArray(e)||e.length!==2?null:e[0]===`transcript`&&typeof e[1]==`string`?e[1]:null}function J9(e){return Z.board?.threads.find(t=>t.id===e)?.lastActivityAt}function Nre(){let e=[...G9.entries()].filter(([,e])=>e.observers>0),t=new Set(e.slice(-24).map(([e])=>e));for(let[e,n]of G9){if(n.observers<=0){n.live&&(n.live=!1,YA(e)),G9.delete(e);continue}t.has(e)?!n.live&&!n.queued&&(n.queued=!0):(n.queued=!1,n.live&&(n.live=!1,YA(e)))}Y9()}function Y9(){q9||[...G9.values()].some(e=>e.queued)&&(q9=setTimeout(()=>{q9=null;let e=0,t=[...G9.values()].filter(e=>e.live).length;for(let[n,r]of G9){if(e>=Are||t>=kre)break;r.queued&&(r.queued=!1,!(r.observers<=0||r.live)&&(r.live=!0,t++,r.lastActivityAt=J9(n),JA(n),e++))}Y9()},jre))}function Pre(){if(K9)for(let[e,t]of G9){if(t.observers<=0)continue;let n=J9(e);n!==t.lastActivityAt&&(t.lastActivityAt=n,!(t.live&&Z.socketTranscripts)&&(Z.socketTranscriptFallbacks[e]||K9.refetchQueries({queryKey:[`transcript`,e],exact:!0,type:`active`})))}}function Fre(e){K9||(K9=e,e.getQueryCache().subscribe(e=>{let t=Mre(e.query.queryKey);if(!t||e.type!==`observerAdded`&&e.type!==`observerRemoved`)return;let n=e.query.getObserversCount(),r=G9.get(t);e.type===`observerAdded`?(G9.delete(t),G9.set(t,{observers:n,live:r?.live??!1,queued:r?.queued??!1,lastActivityAt:r?r.lastActivityAt:J9(t)})):r&&(r.observers=n),Nre()}),zf(Z,Pre))}var Ire=`ui-monospace, "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Mono", Consolas, Menlo, "DejaVu Sans Mono", monospace`,Lre=`system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`;function X9(e){let t=e===`mono`?`mono`:`sans`;document.documentElement.dataset.font=t,document.body&&(document.body.style.fontFamily=t===`sans`?Lre:Ire);try{localStorage.setItem(`frizz-font`,t)}catch{}}function Rre(e){let t=e.getQueryData([`settingsGet`]);t&&X9(t.font),X.settingsGet().then(e=>X9(e.font)).catch(()=>{}),e.getQueryCache().subscribe(()=>{let t=e.getQueryData([`settingsGet`]);t&&X9(t.font)})}function zre(){let e=e=>{if(e.button!==0||e.defaultPrevented)return;let t=e.target instanceof Element?e.target.closest(`.${xQ}`):null;t&&(e.preventDefault(),e.stopPropagation(),Vre(t))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)}function Bre(e){return e.closest(`.md-code`)?.querySelector(`pre code`)??null}async function Vre(e){let t=Bre(e);if(!t)return;let n=(t.textContent??``).replace(/\n$/,``);if(n){try{await bU(n)}catch(e){Q(`Could not copy code: ${e.message.slice(0,100)}`,{duration:7e3});return}Hre(e)}}var Z9=new WeakMap;function Hre(e){e.classList.add(SQ),e.title=`Copied`;let t=Z9.get(e);t!==void 0&&window.clearTimeout(t),Z9.set(e,window.setTimeout(()=>{e.classList.remove(SQ),e.title=CQ,Z9.delete(e)},d6))}var Ure=/^\/thread\/([a-z0-9][a-z0-9-]*)\/?$/;function Wre(){let e=e=>{if(e.button!==0||e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target instanceof Element?e.target.closest(`a[href*="/thread/"]`):null,n=t?.getAttribute(`href`);if(!t||!n||!n.startsWith(`/`))return;let r=bx(n);if(r&&r!==bx())return;let i=Ure.exec(Cx(n));i&&(e.preventDefault(),e.stopPropagation(),US(i[1]))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)}var Gre=new Set([`projectsList`,`projectsQueueCounts`,`threadLocate`,`dispatchPreferencesGet`]);function Kre(e){let t=e[0];return typeof t==`string`&&Gre.has(t)?Pu(e):Pu([`project:${bx()??``}`,...e])}var Q9=typeof window<`u`&&window.location.pathname.endsWith(`/settings-formatting-fixture.html`),qre=typeof window<`u`?gee(Cx()):null;!Q9&&!qre&&yj();var $9=new Od({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1,queryKeyHashFn:Kre}}});Q9||(QA($9),Fre($9),Rre($9),u3(),F$(),zre(),Wre()),Q9||(0,Yd.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(Nd,{client:$9,children:(0,V.jsx)(Lw,{children:(0,V.jsx)(Mee,{router:Ore})})}));export{mu as i,Tx as n,Ad as r,HO as t};
482
+ `)}`}function K0(e,t,n,r={}){let i=eJ(e),[a,o]=(0,B.useState)({}),s=(0,B.useMemo)(()=>U0(t),[t]),c=(0,B.useMemo)(()=>{for(let e=t.length-1;e>=0;e--)if(!(t[e].kind===`event`||t[e].kind===`reasoning`)&&t[e].role===`assistant`&&t[e].text.trim())return t[e]},[t]),l=(0,B.useMemo)(()=>W0(t)!==-1,[t]),u=iW(),d=aW(e),f=(0,B.useCallback)((t,n)=>rW.answer(u,e,d,t,n),[u,e,d]),p=(0,B.useMemo)(()=>s.flatMap(e=>e.blocks.map((t,n)=>f(e.identity,n))),[s,f]),m=sW(p),h=(0,B.useRef)(n);h.current=n;let g=(0,B.useCallback)((e,t)=>({...a[`${e}::${t}`]??{chosen:null,text:``},text:m.get(f(e,t))??``}),[a,m,f]),_=(0,B.useMemo)(()=>{let e=new Map;for(let t of s)e.set(t.identity,t);return e},[s]),v=(0,B.useCallback)((e,t,n)=>{let r=_.get(e)?.blocks[t],i=`${e}::${t}`;r?.kind!==`multi`&&tW.clear(f(e,t)),o(e=>{let t=e[i]??{chosen:null,text:``};if(r?.kind===`multi`){let r=new Set(t.chosenSet??[]);return r.has(n)?r.delete(n):r.add(n),{...e,[i]:{chosen:null,text:t.text,chosenSet:[...r].sort((e,t)=>e-t)}}}return{...e,[i]:{chosen:t.chosen===n?null:n,text:``}}})},[_,f]),y=(0,B.useCallback)((e,t,n)=>{let r=_.get(e)?.blocks[t];tW.set(f(e,t),n),o(i=>{let a=`${e}::${t}`,o=i[a]??{chosen:null,text:``};return r?.kind===`multi`?{...i,[a]:{chosen:null,text:n,chosenSet:o.chosenSet??[]}}:{...i,[a]:{chosen:null,text:n}}})},[_,f]),b=s.some(e=>e.blocks.some((t,n)=>V1(t,g(e.identity,n))!==``)),x=r.scrollToBottom!==!1,S=(0,B.useCallback)((e,t={})=>{i.submit(e,{...t,scrollToBottom:x})&&h.current?.()},[i,x]),C=(0,B.useCallback)(e=>{let t=typeof e==`string`?e:void 0,n=t?s.filter(e=>e.identity===t):s,r=t?n.flatMap(e=>e.blocks.map((t,n)=>f(e.identity,n))):p,i=n.flatMap(e=>e.blocks.map((t,n)=>`${e.identity}::${n}`)),c=(e,t)=>V1(e.blocks[t],g(e.identity,t)),l=n.flatMap(e=>e.blocks.map((t,n)=>({ask:e,bi:n,question:J0(t),answer:c(e,n)})).filter(e=>e.answer!==``));if(l.length===0)return;let u=n.find(e=>e.isLive),d=G0({answered:l.map(e=>({isLive:e.ask.isLive,question:e.question,answer:e.answer})),live:u&&{numbered:u.blocks.map((e,t)=>({n:t+1,a:c(u,t)})).filter(({a:e})=>e!==``)}}),m=a,h=r.map(e=>[e,tW.get(e)]);S(d,{onOptimistic:()=>{r.forEach(e=>tW.clear(e)),o(e=>{let t={...e};for(let e of i)delete t[e];return t})},onRollback:()=>{o(e=>{let t={...e};for(let e of i)m[e]?t[e]=m[e]:delete t[e];return t}),h.forEach(([e,t])=>{t&&!tW.get(e)&&tW.set(e,t)})}})},[a,s,g,S,p,f]),w=(0,B.useCallback)(e=>{let t=_.get(z0(e));if(t)return{answerFor:e=>g(t.identity,e),onChip:(e,n)=>v(t.identity,e,n),onText:(e,n)=>y(t.identity,e,n),onSubmit:()=>C(t.identity),anyAnswered:t.blocks.some((e,n)=>V1(e,g(t.identity,n))!==``),sending:i.pending}},[_,g,v,y,C,i.pending]);return{liveMsg:c,answering:(0,B.useMemo)(()=>c?w(c):void 0,[c,w]),answeringForMessage:w,answerable:l,anyAnswered:b,sending:i.pending,sendAnswers:C,sendMessage:S}}function q0(e){let t=e.split(`
483
+ `).map(e=>e.trim()).find(e=>e.length>0)??``;return t.length>120?`${t.slice(0,117)}…`:t}function J0(e){return q0(e.contextMd)||q0(e.options.join(` / `))||`earlier question`}function Y0(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return(t>>>0).toString(36)}function X0({raw:e,question:t,questionKind:n,danger:r,interactive:i,wrap:a}){let o=(0,B.useMemo)(()=>t??L1(e??``,n??`question`,r),[t,e,n,r]),s=s$(o.contextMd),c=s$(o.trailingMd??``),l=o.recommendedIdx,u=l$(o.recommendation??``),d=o.kind===`multi`,f=o.danger,p=i?.answer.chosen??null,m=i?.answer.chosenSet??[],h=i?.answer.text??``,g=(0,B.useRef)(null);return(0,B.useLayoutEffect)(()=>{let e=g.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)},[h]),(0,V.jsxs)(d0,{tone:f?`danger`:`neutral`,icon:f?kw:d?sw:BC,label:d?`Select multiple`:`Question`,children:[s&&(0,V.jsx)(`div`,{className:`text-fg`,children:(0,V.jsx)(o1,{className:`md-body${a?` [overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`:``}`,html:s})}),(o.options.length>0||i)&&(0,V.jsxs)(`div`,{className:`mt-2 grid grid-cols-1 gap-1.5`,children:[o.options.map((e,t)=>(0,V.jsxs)(B.Fragment,{children:[o.optionHeadings?.[t]&&(0,V.jsx)(Z0,{md:o.optionHeadings[t],wrap:a}),(0,V.jsx)($0,{label:e,multi:d,recommended:l===t,recTitle:l===t?o.recommendedNote:void 0,selected:d?m.includes(t):p===t&&!h.trim(),disabled:!i,onClick:()=>{i?.onChip(t,e),!d&&g.current&&document.activeElement===g.current&&g.current.blur()}})]},t)),i&&(0,V.jsx)(`textarea`,{ref:g,rows:1,"data-surface":`questionAnswer`,value:h,onChange:e=>i.onText(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`){e.preventDefault(),e.currentTarget.blur();return}yH({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(),i.onSubmit())},onFocus:()=>{!d&&p!==null&&i.onText(h)},placeholder:d?`Add a note…`:o.options.length?`${Q0(o.options)} Something else…`:`Type your answer…`,className:`col-span-full w-full resize-none overflow-hidden rounded-md border px-3 py-1.5 text-[12px] leading-snug text-fg/90 outline-none placeholder:text-muted/80 transition-colors ${h.trim()?`border-accent bg-accent/10`:`border-border bg-transparent hover:bg-panel-2 focus:border-accent`}`})]}),o.trailingMd&&(0,V.jsx)(o1,{className:`mt-2 md-body text-[12px] text-muted/70${a?` [overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`:``}`,html:c}),o.recommendation&&l===null&&(0,V.jsx)(o1,{className:`md-inline mt-1.5 text-[11px] text-muted/70`,html:u})]})}function Z0({md:e,wrap:t}){let n=l$(e.split(`
484
+ `).join(` `));return(0,V.jsx)(`div`,{className:`mt-1 text-fg`,children:(0,V.jsx)(o1,{className:`md-body${t?` ${r0}`:``}`,html:n})})}function Q0(e){let t=e[e.length-1]?.match(/^\s*([A-Za-z]|\d+)([.)])\s/);if(!t)return`${String.fromCharCode(65+e.length)}.`;let[,n,r]=t;return/\d/.test(n)?`${Number(n)+1}${r}`:`${String.fromCharCode(n.toUpperCase().charCodeAt(0)+1)}${r}`}function $0({label:e,selected:t,disabled:n,multi:r,recommended:i,recTitle:a,onClick:o}){let s=l$(e),c=(0,B.useId)();return(0,V.jsxs)(`div`,{"data-question-option":!0,title:a,className:`relative flex items-start gap-2 rounded-md border px-3 py-1.5 text-[12px] leading-snug transition-colors ${t?`border-accent bg-accent/10 text-fg`:n?`border-border text-muted/80`:`border-border text-fg/90 hover:bg-elevated hover:border-border-strong`}`,children:[(0,V.jsx)(`button`,{type:`button`,disabled:n,"aria-labelledby":c,onClick:o,onMouseDown:e=>e.preventDefault(),className:`absolute inset-0 rounded-md outline-none`}),r&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`mt-px flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-[3px] border ${t?`border-accent bg-accent text-bg`:`border-border-strong`}`,children:t&&(0,V.jsx)(jC,{size:10,strokeWidth:3})}),(0,V.jsxs)(`span`,{id:c,className:`min-w-0 flex-1`,children:[i&&(0,V.jsx)(`span`,{className:`pointer-events-none float-right ml-2 mt-px -translate-y-[2px] rounded-full border border-border-strong px-1.5 py-px text-[9.5px] uppercase tracking-wide text-muted`,children:`Recommended`}),(0,V.jsx)(o1,{as:`span`,className:`md-inline`,html:s})]})]})}function e2({blocks:e,answering:t,onClose:n}){let[r,i]=(0,B.useState)(0),[a,o]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[]),(0,B.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopPropagation(),n())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[n]);let s=e[Math.min(r,e.length-1)];if(!s)return null;let c=r>=e.length-1;return(0,Xd.createPortal)((0,V.jsxs)(`div`,{"data-mobile-answer-sheet":!0,className:`fixed inset-0 z-[80] flex flex-col justify-end`,children:[(0,V.jsx)(`button`,{"aria-label":`Close`,onClick:n,className:`absolute inset-0 bg-black/50 transition-opacity duration-200 ${a?`opacity-100`:`opacity-0`}`}),(0,V.jsxs)(`div`,{className:`relative flex max-h-[86%] flex-col overflow-hidden rounded-t-[14px] border-t border-border-strong bg-panel pb-[env(safe-area-inset-bottom)] shadow-[0_-20px_60px_-10px_rgba(0,0,0,0.8)] transition-transform duration-200 ease-out motion-reduce:transition-none ${a?`translate-y-0`:`translate-y-full`}`,children:[(0,V.jsx)(`div`,{className:`mx-auto mt-[6px] h-[5px] w-[36px] shrink-0 rounded-full bg-muted/35`}),(0,V.jsxs)(`div`,{className:`flex h-[48px] shrink-0 items-center gap-2 border-b border-border/70 px-3`,children:[(0,V.jsx)(`button`,{onClick:n,className:`flex h-[44px] items-center px-2 text-[16px] text-fg/85`,children:`Cancel`}),(0,V.jsx)(`span`,{className:`flex-1 text-center text-[15px] font-semibold tracking-[-0.01em] text-fg`,children:e.length>1?`Question ${r+1} of ${e.length}`:`Question`}),(0,V.jsx)(`span`,{className:`flex h-[44px] w-[44px] items-center justify-center`,children:(0,V.jsx)(jw,{size:19,className:`opacity-0`,"aria-hidden":!0})})]}),(0,V.jsx)(`div`,{"data-mobile-answer-body":!0,className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:(0,V.jsx)(X0,{raw:s.raw,questionKind:s.kind,danger:s.danger,interactive:{answer:t.answerFor(s.bi),onChip:(e,n)=>t.onChip(s.bi,e,n),onText:e=>t.onText(s.bi,e),onSubmit:()=>c?l():i(e=>e+1)}},s.bi)}),(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-3 border-t border-border/70 px-4 pb-[30px] pt-3`,children:[e.length>1?(0,V.jsx)(`div`,{className:`flex items-center gap-1.5`,children:e.map((e,t)=>(0,V.jsx)(`span`,{className:`size-[6px] rounded-full ${t===r?`bg-accent`:`bg-muted/35`}`},e.bi))}):null,(0,V.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[r>0?(0,V.jsx)(`button`,{onClick:()=>i(e=>e-1),className:`flex h-[50px] shrink-0 items-center justify-center rounded-[14px] border border-border-strong bg-elevated px-5 text-[17px] text-fg active:bg-panel-2`,children:`Back`}):null,(0,V.jsx)(`button`,{onClick:()=>c?l():i(e=>e+1),disabled:c?!t.anyAnswered||t.sending:!1,className:`flex h-[50px] flex-1 items-center justify-center rounded-[14px] bg-accent px-5 text-[17px] font-semibold text-bg transition-[filter,opacity] active:brightness-90 disabled:opacity-40`,children:c?t.sending?`Sending…`:`Send answers`:`Continue`})]})]})]})]}),document.body);function l(){t.onSubmit(),n()}}function t2(e){return(0,B.useSyncExternalStore)(e=>zf(Z,e),()=>e?n2(e)!==`codex`:!1,()=>!1)}function n2(e){return iC(Z.board,e)?.backend}function r2(e,t,n,r){let i=rW.followUp(e,t,n),a=tW.get(i),o=a?`${r}\n\n${a}`:r;return tW.set(i,o),i}function i2(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 a2(e){let t=Md(),n=iW(),[r,i]=(0,B.useState)(!1);return{unqueue:(0,B.useCallback)(a=>{if(!e||r)return;let o=iC(Z.board,e)?.sessionId;if(!o){Q(`This thread has no live session to unqueue from`);return}i(!0),X.unqueueFollowUp({slug:e,sessionId:o,deliveryId:a.deliveryId}).then(r=>{if(i(!1),!r.unqueued){Q(r.reason??`That message could not be taken back`);return}mj(t,e,a.rawText,a.deliveryId),r2(n,e,o,a.text),i2(a.from)},e=>{i(!1),Q(`Couldn't unqueue — ${(e instanceof Error?e.message:String(e)).slice(0,90)}`)})},[r,n,t,e]),pending:r}}function o2(e){return(0,B.useSyncExternalStore)(e=>zf(Z,e),()=>{if(!e)return!1;let t=iC(Z.board,e);return t?.backend!==`codex`&&t?.runtime===`running`},()=>!1)}function s2(e){let[t,n]=(0,B.useState)(!1);return{deliverNow:(0,B.useCallback)(()=>{if(!e||t)return;let r=iC(Z.board,e)?.sessionId;if(!r){Q(`This thread has no live session to interrupt`);return}n(!0),X.deliverQueuedNow({slug:e,sessionId:r}).then(e=>{n(!1),e.interrupted||Q(e.reason??`That message could not be pushed through`)},e=>{n(!1),Q(`Couldn't push it through — ${(e instanceof Error?e.message:String(e)).slice(0,90)}`)})},[t,e]),pending:t}}function c2(e){return e.displayText??e.text}function l2(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.role===`user`&&!n.queued&&!n.peerFrom)return t}return-1}var u2=`icon-label-nudge`,d2=new Set([`planning`,`planned`,`active`,`needs-human`,`blocked`]);function f2(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&&d2.has(e.status))}function p2(e,t){let n=e.trim();if(!(!n||n===t.trim()))return n}function m2(e,t){let n=e.trim();return!n||n===t||n===`Untitled thread`||n===`Spinning up a thread…`?``:n}function h2(e){return e.kind!==`session`||e.foreign||e.backend===`codex`?{show:!1,enabled:!1,label:``}:e.runtime===`turn-idle`?{show:!0,enabled:!0,label:`Rename with Claude`}:e.runtime===`perm-prompt`||e.pendingAsk?{show:!0,enabled:!1,label:`Resolve Claude's terminal prompt before renaming`}:e.runtime===`running`||e.runtime===`spawning`?{show:!0,enabled:!1,label:`Rename with Claude when the current turn finishes`}:{show:!0,enabled:!1,label:`Resume this Claude thread to use AI rename`}}var g2=`sticky top-0 z-10 flex min-w-0 shrink-0 items-center gap-2.5 border-b border-border bg-panel px-3 py-1.5 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`,_2=`min-w-0 flex-1 pl-1 max-[640px]:basis-full`,v2=`flex shrink-0 items-center max-[640px]:w-full max-[640px]:justify-between`;function y2(e){return e?.trim()?{kind:`profile-error`,message:`Profile controls unavailable: ${e.trim().slice(0,160)}`}:null}function b2(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`)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 x2(e){return e.permissionChangePending===!0||e.permissionPending!==void 0||e.profileChangePending===!0||e.runtimeControlPending===!0}function S2(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 C2(e){return e===`right`?`pl-3 pr-7`:`pl-7 pr-3`}function w2(e,t,n,r){let i=(n?n.flatMap(e=>e.options):t??[]).find(t=>t.value===e);return i?{text:i.label,placeholder:!1}:e?{text:e,placeholder:!1}:{text:r??``,placeholder:!0}}var T2=`__frizz_empty_select_value__`,E2=e=>e===``?T2:e,D2=e=>e===T2?``:e,O2={ghost:`border-transparent bg-transparent hover:border-border hover:bg-panel-2 data-[state=open]:border-border data-[state=open]:bg-panel-2`,bordered:`w-full justify-between border-border bg-bg hover:bg-panel-2 data-[state=open]:bg-panel-2`,readout:`text-muted hover:text-fg border-border/50 bg-transparent hover:border-border hover:bg-panel-2 data-[state=open]:border-border data-[state=open]:bg-panel-2 [&_.select-caret]:text-fg/65 [&_.select-caret]:opacity-100`},k2={ghost:`border-transparent bg-transparent`,bordered:`w-full justify-between border-border bg-bg`,readout:`text-muted border-border/50 bg-transparent [&_.select-caret]:text-fg/65 [&_.select-caret]:opacity-100`};function A2({o:e,indicatorPosition:t,typography:n}){return(0,V.jsxs)(_V,{value:E2(e.value),title:e.title,className:`relative flex w-full min-w-0 cursor-pointer select-none items-center overflow-hidden rounded-md py-1.5 text-left text-[12px] text-muted outline-none data-[highlighted]:bg-panel-2 data-[highlighted]:text-fg data-[state=checked]:bg-panel-2 data-[state=checked]:font-medium data-[state=checked]:text-fg ${C2(t)} ${n??``}`,children:[(0,V.jsx)(vV,{className:`pointer-events-none absolute top-1/2 inline-flex -translate-y-1/2 items-center text-accent ${t===`right`?`right-2`:`left-2`}`,children:(0,V.jsx)(jC,{size:13})}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e.label})]})}function j2({value:e,onValueChange:t,options:n,groups:r,placeholder:i,ariaLabel:a,title:o,disabled:s=!1,variant:c=`ghost`,indicatorPosition:l=`left`,side:u=`bottom`,className:d=``}){let f=w2(e,n,r,i),p=s?k2[c]:O2[c],m=c===`readout`?ZH:``,[h,g]=(0,B.useState)(!1),_=(0,B.useRef)(h),v=(0,B.useRef)(s),y=(0,B.useRef)(void 0);return _.current=h,v.current=s,(0,B.useLayoutEffect)(()=>{let e=e=>{e.key!==`Escape`||!_.current||v.current||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_.current=!1,y.current?.(),y.current=void 0,g(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]),(0,B.useLayoutEffect)(()=>{!s||!h||(_.current=!1,y.current?.(),y.current=void 0,g(!1))},[s,h]),(0,B.useLayoutEffect)(()=>()=>y.current?.(),[]),(0,V.jsxs)(lV,{modal:!1,open:h,onOpenChange:e=>{y.current?.(),y.current=void 0,_.current=e,g(e),e&&(y.current=hU(()=>{_.current=!1,y.current=void 0,g(!1)}))},children:[(0,V.jsx)(uV,{asChild:!0,disabled:s,children:(0,V.jsxs)(`button`,{type:`button`,"aria-label":a,title:o,className:`group inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border px-2 py-1 text-left text-[12px] text-fg outline-none data-[placeholder]:text-muted ${s?`cursor-not-allowed opacity-45`:`cursor-pointer transition-colors`} ${p} ${c===`readout`?`select-trigger-readout`:``} ${m} ${d}`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left ${f.placeholder?`text-muted`:``}`,children:f.text}),(0,V.jsx)(MC,{className:`select-caret shrink-0 text-muted ${s?``:`transition-transform group-data-[state=open]:rotate-180`}`,size:13})]})}),(0,V.jsx)(dV,{children:(0,V.jsx)(fV,{align:`start`,side:u,sideOffset:5,onEscapeKeyDown:e=>e.stopPropagation(),className:`${SV} min-w-[var(--radix-dropdown-menu-trigger-width)] max-w-[calc(100vw-1rem)] overflow-hidden rounded-lg p-1 ${m}`,children:(0,V.jsx)(gV,{value:E2(e),onValueChange:e=>t(D2(e)),className:`max-h-[300px] min-w-0 overflow-y-auto`,children:r?r.map((e,t)=>(0,V.jsxs)(pV,{children:[e.label&&(0,V.jsx)(mV,{className:`${C2(l)} min-w-0 truncate pb-1 pt-2 text-left text-[10px] font-medium uppercase tracking-wide text-muted/60 first:pt-1`,children:e.label}),e.options.map(e=>(0,V.jsx)(A2,{o:e,indicatorPosition:l,typography:m},e.value))]},e.label||`g${t}`)):(n??[]).map(e=>(0,V.jsx)(A2,{o:e,indicatorPosition:l,typography:m},e.value))})})})]})}function M2(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 N2(e){let t=Hf(Z).board?.threads.find(t=>t.id===e),n=qd({queryKey:[`threadProfileOptions`,e],queryFn:()=>X.threadProfileOptions({slug:e}),enabled:!!(t&&!t.foreign&&t.kind===`session`),staleTime:5e3}),r=Jd({mutationFn:t=>X.setThreadProfile({slug:e,...t})}),i=Jd({mutationFn:t=>X.setThreadPermission({slug:e,permissionMode:t})}),a=r.isPending||i.isPending;if(!t||t.foreign||t.kind!==`session`)return{busy:a,footer:null,status:null};let o=a||x2(t),s=t.model?.trim(),c=t.effort?.trim(),l=t.backend===`codex`?`codex`:`claude`,u=r.isPending?r.variables:void 0,d=t.profilePendingModel??u?.model,f=t.profilePendingEffort??u?.effort,p=n.data?.options??[],{modelSelectable:m}=M2(p,s,c,t.runtime===`exited`),h=n.data!==void 0,g=[{id:l,label:l===`codex`?`Codex`:`Claude Code`,options:p}],_=y2(n.isError?n.error.message:void 0),v=t.permissionMode?NU(t.permissionMode):`auto`,y=jU.some(e=>e.value===v)?v:`auto`,b=i.isPending?i.variables:y,x=b2(t);function S(e){e!==y&&i.mutate(e,{onSuccess:e=>Q(S2(e.effect,`claude`)),onError:e=>Q(`Permission change failed: ${e.message.slice(0,120)}`)})}function C(e){r.mutate(e,{onSuccess:e=>Q(e.effect===`next-resume`?`Model and effort saved for the next resume`:`Model and effort applied`),onError:e=>Q(`Profile change failed: ${e.message.slice(0,120)}`)})}return{busy:o,footer:(0,V.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:[(0,V.jsx)(yU,{groups:g,value:{provider:l,model:s,effort:c},pending:d||f?{provider:l,model:d,effort:f}:void 0,onValueChange:({model:e,effort:t})=>C({model:e,effort:t}),placeholder:n.isPending?`Profile loading…`:`Profile unknown`,ariaLabel:`Thread model and effort`,menuAriaLabel:`Choose ${l===`codex`?`Codex`:`Claude Code`} model and effort`,title:m?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:o||!h||!m||n.isError,compact:!0,side:`top`,className:`min-w-0 max-w-[min(72%,20rem)] px-1.5 py-0.5`}),l===`claude`&&(0,V.jsx)(j2,{variant:`readout`,side:`top`,value:b,onValueChange:e=>S(e),options:jU,ariaLabel:`Thread permission mode`,title:x?`${x} — changing permissions restarts this thread's worker process`:b===`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:o||x!==null,className:`shrink-0`}),d&&f&&(0,V.jsxs)(`span`,{className:`min-w-0 truncate text-[9px] text-muted/50`,children:[`→ `,d,` · `,f,` pending`]})]}),status:_?(0,V.jsx)(`div`,{"data-thread-control-error":``,className:`px-1 pt-1 text-[9.5px] leading-tight text-muted/65`,children:_.message}):null}}var P2=new Map;function F2(e){let t=P2.get(e);if(t)return t;let n=X.threadSkills({slug:e}).then(e=>e.skills,()=>(P2.delete(e),[]));return P2.set(e,n),n}function I2({slug:e,surface:t,placeholder:n,className:r,id:i,ops:a,submitOverride:o}){let s=Hf(Z).board?.threads.find(t=>t.id===e),c=iW(),l=rW.followUp(c,e,s?.sessionId),[u,d,f]=oW(l),p=N2(e),m=eJ(e),[h,g]=(0,B.useState)(null),_=(0,B.useMemo)(()=>()=>F2(e),[e]),[v,y]=(0,B.useState)(null),b=!o&&s?.runtime===`running`&&s.backend!==`codex`;function x(e=!1){let t=u.trim();if(!t)return;let n=wU(t);if(n){f();let e=s?.backend===`codex`?`codex`:`claude`;n===`login`?g(e):y(e);return}let r={onOptimistic:f,onRollback:()=>{tW.get(l)||d(u)}};o?o(t,r):m.submit(t,{...r,interrupt:e})}return(0,V.jsxs)(`div`,{"data-thread-composer-box":t,...t===`chatComposer`?{"data-thread-action-bar":``}:{},className:r,children:[(0,V.jsx)(KH,{id:i,surface:t,value:u,onChange:d,onSubmit:()=>x(),onInterruptSubmit:b?()=>x(!0):void 0,slashSuggest:_,placeholder:n,busy:p.busy,footer:p.footer}),p.status,(0,V.jsx)(`div`,{className:`ops-column-optical-inset empty:hidden`,children:a}),h&&(0,V.jsx)(EU,{backend:h,onClose:()=>g(null),onAuthed:()=>g(null)}),v&&(0,V.jsx)(DU,{backend:v,onClose:()=>y(null)})]})}function L2({slug:e,ops:t}){let n=Hf(Z).board?.threads.find(t=>t.id===e);return n?(0,V.jsx)(I2,{slug:e,surface:`chatComposer`,id:`followup-input`,placeholder:n.foreign?`Send a message to take over this session…`:`Follow up…`,className:`shrink-0 px-3 py-3`,ops:t}):null}function R2({thread:e,openHref:t,onDoc:n,onDone:r,onCollapse:i,collapsed:a,doneBusy:o,onStatusMutate:s,onStatusApplied:c,onStatusFailed:l}){let u=e.kind===`session`;return(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[i&&(0,V.jsx)(V2,{label:a?`Expand`:`Collapse`,icon:a?IC:FC,size:13,onClick:i}),n&&(0,V.jsx)(V2,{label:`Frizz document`,icon:qC,size:14,onClick:n}),t&&(0,V.jsx)(H2,{label:`Open in new tab`,icon:EC,size:14,href:t}),u?gM(e)?(0,V.jsx)(z2,{slug:e.id}):null:(0,V.jsx)(`div`,{className:`ml-1`,children:(0,V.jsx)(AV,{slug:e.id,onDone:r,doneBusy:o,onMutateStart:s,onApplied:c,onFailed:l})})]})}function z2({slug:e}){let t=Md(),[n,r]=(0,B.useState)(!1);return(0,V.jsx)(Pq,{label:`Retry — resume this session where it left off`,children:(0,V.jsxs)(`button`,{onClick:()=>{r(!0),tJ(t,e).finally(()=>r(!1))},disabled:n,"aria-label":`Retry exited session`,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,V.jsx)(cw,{size:12,className:`animate-spin`}):(0,V.jsx)(yw,{size:12}),`Retry`]})})}var B2=`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:hover:bg-transparent disabled:hover:text-muted disabled:opacity-40`;function V2({label:e,icon:t,size:n,busy:r,...i}){return(0,V.jsx)(Pq,{label:e,children:(0,V.jsx)(`button`,{...i,"aria-label":e,onMouseDown:e=>e.preventDefault(),className:B2,children:r?(0,V.jsx)(cw,{size:n,strokeWidth:2,className:`animate-spin`}):(0,V.jsx)(t,{size:n,strokeWidth:2})})})}function H2({label:e,icon:t,size:n,href:r}){return(0,V.jsx)(Pq,{label:e,children:(0,V.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener`,"aria-label":e,onMouseDown:e=>e.preventDefault(),className:B2,children:(0,V.jsx)(t,{size:n,strokeWidth:2})})})}function U2(e){let t=e.kind===`session`&&e.foreign!==!0,n=t&&(e.state===`archived`||e.archived===!0),r=t,i=t&&!n;return{footer:r,done:n,snooze:i,archive:i}}function W2(e){if(e.runtime===`perm-prompt`||e.pendingAsk)return!0;if(e.runtime===`running`||e.runtime===`spawning`)return!1;let t=e=>e.state===`running`||e.state===`stale`;return!(e.subAgents?.some(e=>Sy(e)&&t(e))||e.bgShells?.some(t))}function G2(e){let t={lead:`This thread is still running.`,groups:[],trailer:`Marking it done will stop its agent session, then move it to Done.`};if(!e)return t;let n=[K2(`agent`,`sub-agent`,e.subAgents,e.subAgentCount),K2(`shell`,`background shell`,e.bgShells,e.bgShellCount)].filter(e=>e!==null);return e.unobservable?{lead:`This session is live, but its transcript can’t be read right now — it may still be working.`,groups:n,trailer:`Marking it done will stop the session anyway, then move it to Done.`}:!e.turnInFlight&&n.length===0?t:{lead:e.turnInFlight?n.length>0?`The agent is mid-turn, and it still owns background work:`:`The agent is mid-turn — it’s executing right now.`:`The agent is resting, but the background work it launched is still running:`,groups:n,trailer:n.length>0?`Marking it done will stop the session and everything running under it, then move it to Done.`:`Marking it done will stop its agent session mid-turn, then move it to Done.`}}function K2(e,t,n,r){let i=Math.max(r,n.length);return i===0?null:{kind:e,heading:`${i} ${t}${i===1?``:`s`}`,items:n.map(e=>({label:e.label,stale:e.state===`stale`})),overflow:Math.max(0,i-n.length)}}function q2({open:e,onOpenChange:t,title:n,children:r,footer:i,className:a=`w-[640px] max-w-[92vw] max-h-[82vh]`}){return(0,V.jsx)(FV,{open:e,onOpenChange:t,children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`overlay-in fixed inset-0 z-[200] bg-black/55 backdrop-blur-[1px]`}),(0,V.jsxs)(qV,{"aria-modal":`true`,onEscapeKeyDown:_U,className:`pop-in fixed left-1/2 top-1/2 z-[200] flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-border bg-panel shadow-2xl shadow-black/50 outline-none ${a}`,children:[(0,V.jsxs)(`header`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-border px-4`,children:[(0,V.jsx)(QV,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:n}),(0,V.jsx)(nH,{type:`button`,"aria-label":`Close`,className:`rounded-md p-1 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,V.jsx)(jw,{size:15})})]}),(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:r}),i&&(0,V.jsx)(`footer`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-border px-4 py-3`,children:i})]})]})})}function J2({thread:e,onSnoozed:t}){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(``),f=(0,B.useId)(),p=(0,B.useId)(),m=(0,B.useId)(),h=lM(e),g=Hf(zj).snoozePreset,_=wj(g),v=Kee(g),y=(0,B.useMemo)(()=>Oj(new Date(Date.now()+6e4)),[i]);async function b(n,i=null){r(!0);try{await X.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:n,prompt:n?i:null}),n?(Q(`${i?`Bump scheduled`:`Snoozed`} · ${kj(n)}`),t?.()):Q(`Snooze cleared`),a(!1),d(``)}catch(e){let t=e instanceof Error?e.message:`Snooze failed`;Q(t.slice(0,100)),d(t)}finally{r(!1)}}function x(e){zj.snoozePreset=e,b(Ej(e))}function S(){s(Oj(new Date(h??Ej(g)))),l(e.snoozePrompt??``),d(``),a(!0)}function C(){let e=qee(o);if(!e.ok){d(e.message);return}let t=c.trim();if(t.length>4e3){d(`Prompt is too long (${t.length}/${Fy})`);return}b(e.until,t||null)}return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`inline-flex items-stretch rounded-md border border-border-strong bg-panel-2/60`,children:[(0,V.jsxs)(`button`,{type:`button`,disabled:n,"aria-label":h?`Wake thread now`:v,title:h?`Wake now · ${kj(h)}`:v,onClick:()=>void b(h?null:Ej(g)),className:`flex items-center gap-1.5 rounded-l-md px-2.5 py-1 text-[12px] font-medium text-fg/75 outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-not-allowed disabled:opacity-45`,children:[n&&(0,V.jsx)(cw,{size:12,className:`animate-spin`}),h?`Wake now`:v]}),(0,V.jsx)(`span`,{"aria-hidden":!0,className:`my-1 w-px bg-border`}),(0,V.jsxs)(TV,{children:[(0,V.jsx)(EV,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,disabled:n,"aria-label":`Snooze options`,title:`Selected snooze: ${_}`,className:`flex min-w-0 items-center justify-center gap-1 rounded-r-md px-2 text-fg/75 outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-not-allowed disabled:opacity-45`,children:(0,V.jsx)(MC,{size:12})})}),(0,V.jsxs)(DV,{align:`end`,children:[Cj.map(e=>(0,V.jsx)(OV,{onSelect:()=>x(e.value),icon:(0,V.jsx)(UC,{size:12}),children:(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center justify-between gap-4`,children:[(0,V.jsx)(`span`,{children:e.label}),(0,V.jsx)(`span`,{className:`text-[10px] text-muted/55`,children:e.detail})]})},e.value)),(0,V.jsx)(kV,{}),(0,V.jsx)(OV,{onSelect:S,children:`Custom time & prompt…`}),h&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(kV,{}),(0,V.jsx)(OV,{onSelect:()=>void b(null),children:`Wake now`})]})]})]})]}),(0,V.jsx)(q2,{open:i,onOpenChange:e=>{n||a(e)},title:`Snooze thread`,className:`w-[360px] max-w-[92vw]`,footer:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>a(!1),className:`rounded-md px-3 py-1.5 text-[12px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-45`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`submit`,form:m,disabled:n,className:`flex items-center gap-1.5 rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-opacity hover:opacity-90 disabled:opacity-45`,children:[n&&(0,V.jsx)(cw,{size:12,className:`animate-spin`}),c.trim()?`Snooze & bump`:`Snooze`]})]}),children:(0,V.jsxs)(`form`,{id:m,className:`flex flex-col gap-2.5 p-4`,onSubmit:e=>{e.preventDefault(),C()},children:[(0,V.jsx)(`label`,{htmlFor:f,className:`text-[11px] font-medium text-muted`,children:`Wake at this local time`}),(0,V.jsx)(`input`,{id:f,type:`datetime-local`,required:!0,min:y,value:o,onChange:e=>{s(e.target.value),d(``)},className:`w-full rounded-md border border-border bg-bg px-2.5 py-2 text-[13px] text-fg outline-none focus:border-accent`}),(0,V.jsx)(`p`,{className:`text-[10.5px] text-muted/65`,children:`Stored as an exact instant; shown here in your browser’s local time zone.`}),(0,V.jsxs)(`label`,{htmlFor:p,className:`mt-1 text-[11px] font-medium text-muted`,children:[`Then send this prompt `,(0,V.jsx)(`span`,{className:`font-normal text-muted/55`,children:`(optional)`})]}),(0,V.jsx)(`textarea`,{id:p,autoFocus:!0,rows:3,maxLength:Fy,placeholder:`e.g. Check whether CI went green and land it if so.`,value:c,onChange:e=>{l(e.target.value),d(``)},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())},className:`w-full resize-y rounded-md border border-border bg-bg px-2.5 py-2 text-[13px] leading-5 text-fg outline-none placeholder:text-muted/40 focus:border-accent`}),(0,V.jsx)(`p`,{className:`min-h-4 text-[10.5px] text-muted/65`,children:c.trim()?`frizz will resume this thread with the prompt at the wake time.`:`Leave empty to just bring the card back to your queue.`}),u&&(0,V.jsx)(`p`,{role:`alert`,className:`text-[11px] text-red-400`,children:u})]})})]})}function Y2(e,t){return new Promise(n=>{$q(e,t,`Your worker process was restarted so it picks up frizz's current tooling (hooks and worker contract). Re-read whatever you left in your scratch directory, then continue exactly where you left off.`,{freshProcess:!0,onSuccess:()=>{Q(`Restarting worker…`),n()},onRollback:()=>n(),failureToast:e=>`Restart failed: ${e.slice(0,80)}`})||n()})}var X2=null,Z2=null;function Q2(){return X2===null?(Z2??=TK().then(e=>e===null?!1:(X2=wK(e),X2)).catch(()=>!1).finally(()=>{Z2=null}),Z2):Promise.resolve(X2)}function $2(){let[e,t]=(0,B.useState)(X2===!0);return(0,B.useEffect)(()=>{if(X2!==null){t(X2);return}let e=!0;return Q2().then(n=>{e&&t(n)}),()=>{e=!1}},[]),e}function e4({thread:e}){let t=Md(),[n,r]=(0,B.useState)(!1);return!$2()||e.kind!==`session`||e.foreign||e.backend===`codex`||e.runtime===`exited`?null:(0,V.jsx)(Pq,{label:`Restart worker — same conversation, fresh process on current tooling`,side:`top`,children:(0,V.jsx)(`button`,{type:`button`,disabled:n,"aria-label":`Restart worker`,onMouseDown:e=>e.preventDefault(),onClick:()=>{r(!0),Y2(t,e.id).finally(()=>r(!1))},className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-fg/55 outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-not-allowed disabled:opacity-45 ${DH}`,children:n?(0,V.jsx)(cw,{size:12,className:`animate-spin`}):(0,V.jsx)(_w,{size:12})})})}function t4({thread:e}){let[t,n]=(0,B.useState)(!1);if(e.kind!==`session`||e.foreign||e.claudeRuntime!==`broker`||e.runtime===`exited`)return null;async function r(){n(!0);try{let t=await X.reloadThreadPlugins({slug:e.id,sessionId:e.sessionId??``}),n=[`${t.plugins} plugin${t.plugins===1?``:`s`}`,`${t.commands} skill${t.commands===1?``:`s`}`,`${t.agents} agent${t.agents===1?``:`s`}`],r=t.mcpServers.length?` · MCP: ${t.mcpServers.join(`, `)}`:``,i=t.errorCount?` · ${t.errorCount} load error${t.errorCount===1?``:`s`}`:``;Q(`Reloaded ${n.join(`, `)}${r}${i}`)}catch(e){Q((e instanceof Error?e.message:`Plugin reload failed`).slice(0,120))}finally{n(!1)}}return(0,V.jsx)(Pq,{label:`Reload plugins — hooks, skills, agents and MCP re-read from disk, same conversation`,side:`top`,children:(0,V.jsx)(`button`,{type:`button`,"data-reload-plugins":!0,disabled:t,"aria-label":`Reload plugins`,onMouseDown:e=>e.preventDefault(),onClick:()=>void r(),className:`flex size-6 items-center justify-center rounded-md text-fg/55 hover:bg-panel-2 hover:text-fg/80 disabled:opacity-50 ${EH}`,children:(0,V.jsx)(mw,{size:13})})})}var n4=1.25,r4=7.5-n4/2,i4=2*Math.PI*r4;function a4(e,t){return Math.max(0,Math.min(100,Math.floor(e/t*100)))}function o4({thread:e}){let t=e.context;if(!t||t.window<=0)return null;let n=a4(t.tokens,t.window),r=Math.max(0,Math.min(1,t.tokens/t.window)),i=`Context ${n}% full\n${t.tokens.toLocaleString()} of ${t.window.toLocaleString()} tokens`;return(0,V.jsx)(Pq,{label:i,side:`top`,multiline:!0,children:(0,V.jsx)(`span`,{"data-context-meter":!0,"data-context-percent":n,"aria-label":i,className:`flex shrink-0 items-center text-muted/60`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 16 16`,className:`h-[1.05em] w-[1.05em]`,"aria-hidden":!0,style:{transform:`rotate(-90deg)`},children:[(0,V.jsx)(`circle`,{cx:`8`,cy:`8`,r:r4,fill:`none`,stroke:`currentColor`,strokeOpacity:.3,strokeWidth:n4}),(0,V.jsx)(`circle`,{cx:`8`,cy:`8`,r:r4,fill:`none`,stroke:`currentColor`,strokeWidth:n4,strokeDasharray:`${i4*r} ${i4}`})]})})})}var s4={sm:{track:`h-[16px] w-[28px]`,thumb:`size-[12px]`,travel:`translate-x-[12px]`,onCap:`translate-y-[calc(6px_-_0.5cap)]`},md:{track:`h-[20px] w-[34px]`,thumb:`size-[16px]`,travel:`translate-x-[14px]`,onCap:`translate-y-[calc(8px_-_0.5cap)]`}};function c4({checked:e,onChange:t,disabled:n,label:r,size:i=`sm`,testId:a}){let o=s4[i];return(0,V.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":r,disabled:n,"data-switch":a,"data-state":e?`checked`:`unchecked`,onMouseDown:e=>e.preventDefault(),onClick:()=>t(!e),className:`inline-flex shrink-0 cursor-pointer items-center self-baseline rounded-full p-[2px] outline-none transition-colors focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-default disabled:opacity-45 ${o.track} ${o.onCap} ${e?`bg-fg`:`bg-border hover:bg-border-strong`}`,children:(0,V.jsx)(`span`,{className:`pointer-events-none block rounded-full transition-transform duration-150 ease-out ${o.thumb} ${e?`bg-bg ${o.travel}`:`translate-x-0 bg-muted/70`}`})})}function l4({size:e=12,className:t=``}){return(0,V.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,"aria-hidden":`true`,children:[(0,V.jsx)(`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,V.jsx)(`path`,{d:`M12 7a5 5 0 1 0 5 5`}),(0,V.jsx)(`path`,{d:`M13 3.055a9 9 0 1 0 7.941 7.945`}),(0,V.jsx)(`path`,{d:`M15 6v3h3l3 -3h-3v-3l-3 3`}),(0,V.jsx)(`path`,{d:`M15 9l-3 3`})]})}function u4({thread:e}){let[t,n]=(0,B.useState)(`closed`),r=(0,B.useRef)(null),i=(0,B.useRef)(void 0);(0,B.useEffect)(()=>()=>clearTimeout(i.current),[]);let a=e.recurringPrompt,o=a?.stopHook===!0||a?.heartbeat===!0||a?.postCompaction===!0;function s(){clearTimeout(i.current),i.current=setTimeout(()=>n(e=>e===`closed`?`preview`:e),d4)}function c(){clearTimeout(i.current),n(e=>e===`preview`?`closed`:e)}let l=e=>{r.current?.contains(e.detail.originalEvent.target)&&e.preventDefault()};return(0,V.jsxs)(nK,{open:t!==`closed`,onOpenChange:e=>{e||(clearTimeout(i.current),n(`closed`))},children:[(0,V.jsx)(iK,{asChild:!0,children:(0,V.jsx)(`button`,{ref:r,type:`button`,"data-recurring-prompt":!0,"data-recurring-prompt-on":o?`true`:`false`,"aria-label":o?`Goal (on)`:`Goal`,"aria-haspopup":`dialog`,"aria-expanded":t===`full`,onClick:()=>{clearTimeout(i.current),n(e=>e===`full`?`closed`:`full`)},onPointerEnter:e=>{e.pointerType===`mouse`&&s()},onPointerLeave:e=>{e.pointerType===`mouse`&&c()},onFocus:()=>n(e=>e===`closed`?`preview`:e),onBlur:c,className:`flex items-center rounded-md px-0.5 py-0.5 outline-none ${TH}`,children:(0,V.jsx)(l4,{size:12,className:o?`text-amber-400/90`:`text-muted/60 hover:text-muted`})})}),t===`preview`?(0,V.jsx)(aK,{side:`top`,align:`start`,"data-recurring-preview":!0,onPointerDownOutside:l,className:`pointer-events-none max-w-[min(22rem,calc(100vw-1.5rem))] p-2.5 text-[11px] leading-snug text-fg`,onOpenAutoFocus:e=>e.preventDefault(),children:(0,V.jsx)(f4,{armed:a})}):(0,V.jsx)(aK,{side:`top`,align:`start`,className:`w-[min(46rem,calc(100vw-1.5rem))] p-3 text-[11px] leading-relaxed text-fg`,onPointerDownOutside:l,onOpenAutoFocus:e=>e.preventDefault(),children:(0,V.jsx)(x4,{thread:e,armed:a})})]})}var d4=260;function f4({armed:e}){let t=e?.prompt?.trim(),n=e?b4({stopHook:e.stopHook===!0,heartbeat:e.heartbeat===!0,postCompaction:e.postCompaction===!0,seconds:e.intervalSeconds??h4}):[];return(0,V.jsxs)(`div`,{"data-recurring-preview-body":!0,children:[(0,V.jsxs)(`div`,{className:`mb-1 flex items-baseline gap-2`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Goal`}),(0,V.jsx)(`span`,{className:`text-muted/70`,children:n.length>0?`sent ${n.join(`, `)}`:t?`no trigger is on`:`not set`})]}),(0,V.jsx)(`p`,{className:`line-clamp-4 whitespace-pre-wrap ${t?`text-fg/90`:`text-muted`}`,children:t||`Click to write what this thread is trying to achieve.`})]})}var p4=1,m4=1440,h4=600;function g4(e,t){if(e===String(Math.round(t/60)))return t;let n=Math.round(Number(e));return Number.isFinite(n)&&n>0?Math.min(m4,Math.max(p4,n))*60:t}var _4=null;function v4(e){return{prompt:e.text.trim(),stopHook:e.stopHook,heartbeat:e.heartbeat,postCompaction:e.postCompaction,seconds:e.seconds}}function y4(e,t){return!e.archived&&!t}function b4(e){return[e.stopHook?`at every rest`:null,e.heartbeat?`every ${Math.round(e.seconds/60)} min`:null,e.postCompaction?`after every compaction`:null].filter(e=>e!==null)}function x4({thread:e,armed:t}){let n=y4(e,t)?By:``,r=_4?.slug===e.id?_4.draft:null,[i,a]=(0,B.useState)(r?.text??t?.prompt??n),[o,s]=(0,B.useState)(r?.stopHook??t?.stopHook??!1),[c,l]=(0,B.useState)(r?.heartbeat??t?.heartbeat??!1),[u,d]=(0,B.useState)(r?.postCompaction??t?.postCompaction??!1),[f,p]=(0,B.useState)(r?.seconds??t?.intervalSeconds??h4),m=o||c||u,[h,g]=(0,B.useState)(String(Math.round((r?.seconds??t?.intervalSeconds??h4)/60))),_=(0,B.useRef)(null),v=(0,B.useRef)({prompt:t?.prompt??n,stopHook:t?.stopHook??!1,heartbeat:t?.heartbeat??!1,postCompaction:t?.postCompaction??!1,seconds:t?.intervalSeconds??h4}),y=e=>({text:i,stopHook:o,heartbeat:c,postCompaction:u,seconds:g4(h,f),...e}),b=(0,B.useRef)(y());b.current=y();let x=(0,B.useRef)(()=>Promise.resolve(!0));x.current=e=>C(e),(0,B.useEffect)(()=>()=>{x.current(b.current)},[]);let S=(0,B.useRef)(Promise.resolve(!0));function C(t){let n=S.current.catch(()=>!1).then(async()=>{let n=await w(t);return n?_4?.slug===e.id&&(_4=null):_4={slug:e.id,draft:t},n});return S.current=n,n}async function w(n){let r=n.text.trim()||null;if(r===(v.current.prompt||null)&&n.stopHook===v.current.stopHook&&n.heartbeat===v.current.heartbeat&&n.postCompaction===v.current.postCompaction&&n.seconds===v.current.seconds)return!0;if(r===null&&!t)return v.current={...v4(n),prompt:``},!0;try{await X.setThreadRecurringPrompt({slug:e.id,sessionId:e.sessionId??``,prompt:r,stopHook:n.stopHook,heartbeat:n.heartbeat,postCompaction:n.postCompaction,...r===null?{}:{intervalSeconds:n.seconds}}),v.current={...v4(n),prompt:r??``};let t=b4(n);Q(r===null?`Goal cleared`:t.length===0?`Goal saved — no trigger is on, so nothing is sent`:`Goal: sent ${t.join(`, `)}`)}catch(e){return Q((e instanceof Error?e.message:`Could not save the recurring prompt`).slice(0,100)),!1}return!0}let T=()=>void C(y());function E(){let e=g4(h,f);g(String(Math.round(e/60))),p(e),C(y({seconds:e}))}let D=[{at:t?.lastRestFiredAt,how:`at rest`},{at:t?.lastScheduleFiredAt,how:`on schedule`},{at:t?.lastCompactFiredAt,how:`after a compaction`}].filter(e=>e.at!==void 0),O=D.reduce((e,t)=>e&&Date.parse(e.at)>=Date.parse(t.at)?e:t,void 0),k=O===void 0?null:D.length>1?`Last sent ${QM(O.at)}`:`Last sent ${O.how} ${QM(O.at)}`;return(0,V.jsxs)(`section`,{"data-recurring-panel":!0,children:[(0,V.jsxs)(`div`,{className:`mb-2 flex items-center gap-3`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Goal`}),k&&(0,V.jsx)(`span`,{className:`ml-auto truncate text-muted/55`,children:k})]}),(0,V.jsx)(`textarea`,{ref:_,"data-recurring-text":!0,value:i,maxLength:Ly,onChange:e=>a(e.target.value),onBlur:T,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),T())},placeholder:`What is this thread trying to achieve?`,className:`field-sizing-content max-h-[28vh] min-h-[4rem] w-full resize-none overflow-y-auto rounded-md border border-border bg-bg px-2 py-1.5 text-[12px] leading-snug outline-none placeholder:text-muted/50 focus:border-border-strong ${m?`text-fg`:`text-muted`}`}),(0,V.jsxs)(`div`,{className:`mt-3 grid grid-cols-[auto_auto_1fr] items-baseline gap-x-2.5 gap-y-2`,children:[(0,V.jsx)(c4,{testId:`stop-hook`,label:`Stop hook`,checked:o,onChange:e=>{s(e),C(y({stopHook:e})),e&&!i.trim()&&requestAnimationFrame(()=>_.current?.focus())}}),(0,V.jsx)(`span`,{className:`font-medium ${o?`text-fg`:`text-muted`}`,children:`Stop hook`}),(0,V.jsx)(`span`,{className:`text-muted`,children:`every rest — unless it signed off or parked on a wait`}),(0,V.jsx)(c4,{testId:`heartbeat`,label:`Heartbeat`,checked:c,onChange:e=>{l(e),C(y({heartbeat:e})),e&&!i.trim()&&requestAnimationFrame(()=>_.current?.focus())}}),(0,V.jsx)(`span`,{className:`font-medium ${c?`text-fg`:`text-muted`}`,children:`Heartbeat`}),c?(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted`,children:[`every`,(0,V.jsx)(`input`,{type:`number`,"data-recurring-minutes":!0,inputMode:`numeric`,min:p4,max:m4,value:h,onChange:e=>g(e.target.value),onBlur:E,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),E())},"aria-label":`Heartbeat interval in minutes`,className:`w-[4.5ch] rounded-md border border-border bg-bg px-1 py-[3px] text-center text-[11px] leading-none tabular-nums text-fg outline-none focus:border-border-strong disabled:opacity-45 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none`}),`min, even mid-turn`]}):(0,V.jsx)(`span`,{className:`text-muted`,children:`on a clock, even mid-turn`}),(0,V.jsx)(c4,{testId:`post-compaction`,label:`Compaction`,checked:u,onChange:e=>{d(e),C(y({postCompaction:e})),e&&!i.trim()&&requestAnimationFrame(()=>_.current?.focus())}}),(0,V.jsx)(`span`,{className:`font-medium ${u?`text-fg`:`text-muted`}`,children:`Compaction`}),(0,V.jsx)(`span`,{className:`text-muted`,children:`when the context is summarized away — link the doc to re-read`})]})]})}function S4({thread:e,sticky:t=!1,safeArea:n=!1,onArchived:r,onDismissCancel:i,onSnoozed:a}){let o=U2(e);return o.footer?(0,V.jsxs)(`footer`,{"aria-label":`Thread lifecycle actions`,"data-thread-lifecycle-footer":!0,className:`${t?`z-20`:o0} flex min-h-10 shrink-0 flex-wrap items-center justify-end ${CH} border-t border-border/70 bg-panel/95 px-3 pt-2 text-[12px] ${n?`pb-[max(0.5rem,env(safe-area-inset-bottom))]`:`pb-2`} backdrop-blur-sm`,children:[(0,V.jsxs)(`span`,{className:`mr-auto flex items-center ${CH}`,children:[(0,V.jsx)(o4,{thread:e}),!o.done&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(t4,{thread:e}),(0,V.jsx)(e4,{thread:e})]}),(0,V.jsx)(w4,{thread:e}),(0,V.jsx)(u4,{thread:e})]}),o.done?(0,V.jsx)(C4,{}):(0,V.jsxs)(V.Fragment,{children:[o.snooze&&(0,V.jsx)(J2,{thread:e,onSnoozed:a}),(0,V.jsx)(T4,{thread:e,onArchived:r,onDismissCancel:i})]})]}):null}function C4(){let e=`Marked done — send a message to reopen it`;return(0,V.jsx)(Pq,{label:e,side:`top`,children:(0,V.jsxs)(`span`,{"data-thread-done":!0,"aria-label":e,className:`flex items-center gap-1 rounded-md border border-transparent px-2.5 py-1 font-medium text-muted`,children:[(0,V.jsx)(jC,{size:12}),`Done`]})})}function w4({thread:e}){let t=lM(e);if(!t)return null;let n=e.snoozePrompt?.trim(),r=n?`Bumps ${kj(t)}\n${n}`:`Snoozed until ${kj(t)}`;return(0,V.jsx)(Pq,{label:r,side:`top`,multiline:!!n,children:(0,V.jsx)(`span`,{"data-pending-snooze":!0,"aria-label":r,className:`flex items-center px-0.5 text-muted/60 ${wH}`,children:(0,V.jsx)(tw,{size:12})})})}function T4({thread:e,onArchived:t,onDismissCancel:n,className:r=`rounded-md border border-border-strong bg-panel-2/60 px-2.5 py-1 text-[12px] text-fg/80 hover:bg-panel-2 hover:text-fg`,iconClassName:i=``}){let[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(void 0),d=(r,i)=>{o(!0),i&&t?.(),(r||W2(e))&&wJ(e.id),X.completeThread({slug:e.id,sessionId:e.sessionId??``,terminateLive:r}).then(r=>{if(r.needsConfirmation){TJ(e.id),i&&n?.(),u(r.hold),c(!0),o(!1);return}c(!1),Q(`Done`),i||t?.()}).catch(t=>{TJ(e.id),i&&n?.(),Q(`Couldn’t finish: ${t.message.slice(0,80)}`),o(!1)})},f=!!t&&!!n&&W2(e);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>d(!1,f),disabled:a,"aria-label":`Mark as done`,title:`Mark as done`,onMouseDown:e=>e.preventDefault(),className:`flex items-center gap-1 font-medium outline-none transition-colors focus-visible:ring-1 focus-visible:ring-fg/60 disabled:opacity-45 ${r}`,children:[(0,V.jsx)(jC,{size:12,className:i}),`Mark as done`]}),(0,V.jsx)(q2,{open:s,onOpenChange:e=>{a||c(e)},title:`End this session?`,className:`w-[390px] max-w-[92vw]`,footer:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>c(!1),className:`rounded-md px-3 py-1.5 text-[12px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-45`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>d(!0,!1),className:`flex items-center gap-1.5 rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-opacity hover:opacity-90 disabled:opacity-45`,children:[a&&(0,V.jsx)(cw,{size:12,className:`animate-spin`}),`End session & mark done`]})]}),children:(0,V.jsx)(E4,{hold:l})})]})}function E4({hold:e}){let t=G2(e);return(0,V.jsxs)(`div`,{"data-completion-hold":!0,className:`flex flex-col gap-2 p-4 text-[12px] leading-relaxed text-muted`,children:[(0,V.jsx)(`p`,{children:t.lead}),t.groups.map(e=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,V.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg/70`,children:e.heading}),(0,V.jsxs)(`ul`,{className:`flex flex-col gap-0.5`,children:[e.items.map((e,t)=>(0,V.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,V.jsx)(`span`,{"aria-hidden":!0,className:$M,children:`⤷`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate text-fg/80`,children:e.label}),e.stale&&(0,V.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted/60`,children:`no recent output`})]},`${e.label}-${t}`)),e.overflow>0&&(0,V.jsxs)(`li`,{className:`pl-[15px] text-muted/60`,children:[`+`,e.overflow,` more`]})]})]},e.kind)),(0,V.jsx)(`p`,{children:t.trailer})]})}function D4(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 O4={completed:`finished`,killed:`stopped`,failed:`failed`};function k4(e){let t=O4[e.agentStatus??`completed`],n=e.agentElapsedMs===void 0?void 0:YM(e.agentElapsedMs);return{outcome:t,tail:`${t}${n?` · ${n}`:``}`}}var A4=e=>e===void 0?void 0:WM(e),j4=e=>{if(e!==void 0)return YM(e)||void 0};function M4(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=A4(n);return{label:t===`completed`?void 0:O4[t],duration:j4(n),tone:r?`failed`:`muted`,title:`${e?`Stopped`:r?`Failed`:`Ran for`}${e||r?` after`:``} ${i??`an unknown time`}`}}if(r){let e=A4(i);return{label:void 0,duration:j4(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=A4(o);return{label:c?O4.killed:s?O4.failed:void 0,duration:j4(o),tone:s?`failed`:`muted`,title:`${c?`Stopped after`:s?`Failed after`:`Ran for`} ${l??`an unknown time`}`}}var N4=`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 F4(e){return`${P4} ${e?`-mx-[0.208em] rotate-90`:`-mx-[0.333em]`}`}var $=B.createElement;function I4({payload:e}){return e.kind===`command-approval`?$(B.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,$(L4,{label:`Redacted command preview`,text:e.command.preview}),e.command.actions?$(R4,{actions:e.command.actions}):null,e.capabilities?$(B4,{capabilities:e.capabilities}):null):e.kind===`file-approval`?$(B.Fragment,null,$(`div`,{className:`text-[12px] text-muted`},W4(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-amber-400/35 bg-amber-500/[0.06] px-2.5 py-2`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-amber-100/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-amber-100/75`},e.scopeLabel):null):null,e.diffPreview?$(L4,{label:`Plain-text diff preview`,text:e.diffPreview}):null,e.changes?$(z4,{changes:e.changes}):null):$(B.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?$(B4,{capabilities:e.capabilities}):null)}function L4({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-fg/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 R4({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`},U4(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,$(L4,{label:`${U4(e.kind)} command detail`,text:e.commandPreview})))))}function z4({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`},W4(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?$(L4,{label:`${W4(e.operation)} plain-text diff`,text:e.diffPreview}):null))))}function B4({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`},$(V4,{capability:e})))))}function V4({capability:e}){if(e.kind===`network`){let t=e.enabled===!0?`Enable network access`:e.enabled===!1?`Disable network access`:`Network access request`;return $(B.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},t),e.hosts.length>0?$(H4,{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 $(B.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},t),$(H4,{label:`Paths`,values:e.resources}))}return e.kind===`glob-scan`?$(B.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`?$(B.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},`Future command policy amendment`),$(H4,{label:`Command prefix tokens`,values:e.prefixes})):$(B.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},e.access===`allow`?`Allow future network hosts`:`Deny future network hosts`),$(H4,{label:`Hosts`,values:e.hosts}))}function H4({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 U4(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 W4(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 G4(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 K4={semantic:`approve`,label:`Approve once`,order:10,tone:`primary`,durable:!1,scope:`Applies only to this request.`},q4={semantic:`approve`,label:`Approve for session`,order:20,tone:`primary`,durable:!0,scope:`Persists for later matching requests in this thread session.`},J4={semantic:`approve`,label:`Grant for turn`,order:10,tone:`primary`,durable:!1,scope:`Applies to this turn only.`},Y4={semantic:`approve`,label:`Grant for session`,order:20,tone:`primary`,durable:!0,scope:`Persists until this thread session ends.`},X4={semantic:`deny`,label:`Deny`,order:70,tone:`danger`,durable:!1,scope:`Rejects this request.`},Z4={semantic:`decline`,label:`Decline`,order:70,tone:`danger`,durable:!1,scope:`Declines this request.`},Q4={semantic:`cancel`,label:`Cancel request`,order:80,tone:`neutral`,durable:!1,scope:`Cancels this pending request.`};function $4(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`?K4:n===`acceptForSession`&&r===`approve`?q4:(n===`decline`||n===`deny`)&&r===`deny`?X4:n===`cancel`&&r===`cancel`?Q4:void 0;if(e.kind===`permission-approval`)return n===`grant-turn`&&r===`approve`?J4:n===`grant-session`&&r===`approve`?Y4:(n===`deny`||n===`decline`)&&r===`deny`?X4:n===`cancel`&&r===`cancel`?Q4: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`?Z4:n===`cancel`&&r===`cancel`?Q4: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 Z4;if(n===`cancel`&&r===`cancel`)return Q4}function e3(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=$4(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 t3(e){switch(e){case`claude`:return`Claude`;case`codex`:return`Codex`;case`frizz`:return`Frizz`}}function n3(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 r3(e,t){let n=e.options.findIndex(e=>JSON.stringify(e.value)===JSON.stringify(t));return n<0?``:String(n)}function i3(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?``:r3(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 a3(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 o3(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=Bv(i,a);e?r[i.id]=`Value ${e}.`:n[i.id]=a}}if(Object.keys(r).length>0)return{errors:r};let i=Qv.safeParse(n);return i.success?{errors:r,values:i.data}:{errors:r,formError:`The response is too large or contains invalid values.`}}function s3(e,t){return JSON.stringify([e,t??null])}function c3(e,t){try{let n=new URL(e,t);return n.protocol===`http:`||n.protocol===`https:`?n.toString():null}catch{return null}}function l3(e,t){let n=e.getAttribute(`href`);if(!n)return!1;let r=c3(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 u3(e=()=>location.href){return t=>{if(t.defaultPrevented||t.button!==0)return;let n=f3(t);n&&l3(n,e())}}function d3(){let e=u3();return document.addEventListener(`click`,e,!0),()=>document.removeEventListener(`click`,e,!0)}function f3(e){let t=typeof e.composedPath==`function`?e.composedPath():[];for(let e of t)if(p3(e))return e;let n=e.target?.closest?.(`a[href]`);return p3(n)?n:null}function p3(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 m3(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 h3(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)=>`${m3(t)} ${e.label}`),recommendedIdx:null},...e?{optionFieldId:e.id}:{},optionValues:r.map(e=>e.value),...t?{notesFieldId:t.id}:{}}}function g3(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=h3(r,a);if(!e)return null;n.push(e)}else if(r.input===`text`||r.input===`multiline`){let e=h3(void 0,r);if(!e)return null;n.push(e)}else return null}return n.length>0?n:null}function _3(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}if(a){e.notesFieldId&&(n[e.notesFieldId]=a);return}let o=i.chosen;e.optionFieldId&&o!==null&&e.optionValues[o]!==void 0&&(n[e.optionFieldId]=e.optionValues[o])}),Object.keys(n).length>0?n:void 0}function v3(e){let t=e instanceof Error?e.message:`The request could not be updated.`;return t.length>240?`${t.slice(0,239)}…`:t}function y3(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`frizz-response-${Date.now()}-${Math.random().toString(36).slice(2)}`}function b3({thread:e,className:t=``,autoFocusFirst:n=!1}){let r=rj(e),i=aj(e),a=(0,B.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,V.jsxs)(`div`,{"data-interactions-error":!0,role:`alert`,className:`${i0} border border-amber-500/35 bg-amber-500/[0.07] p-4 text-[12px] text-amber-100 ${t}`,children:[(0,V.jsx)(`div`,{className:`font-medium`,children:`Pending requests could not be loaded.`}),(0,V.jsx)(`div`,{className:`mt-1 break-words text-amber-100/75`,children:v3(i.error)}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void i.refetch(),className:`mt-2 rounded-md border border-amber-400/40 px-2 py-1 text-[11px] hover:bg-amber-500/10`,children:`Try again`})]}):a.length===0?null:(0,V.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,V.jsx)(S3,{record:e,autoFocus:n&&t===0},e.id))}):null}function x3({record:e,questions:t,autoFocus:n}){let r=Md(),i=(0,B.useRef)(null),a=(0,B.useRef)(new Map),o=iW(),s=G4(e.delivery?.effect),c=(0,B.useMemo)(()=>e3(e).find(e=>e.semantic===`answer`),[e]),l=sW(t.flatMap(t=>t.notesFieldId?[rW.interaction(o,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId)]:[])),[u,d]=(0,B.useState)(()=>t.map(()=>({chosen:null,chosenSet:[]}))),f=t.map((t,n)=>({chosen:u[n]?.chosen??null,chosenSet:u[n]?.chosenSet??[],text:t.notesFieldId?l.get(rW.interaction(o,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId))??``:``})),p=_3(t,f),[m,h]=(0,B.useState)(),[g,_]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(!n)return;let e=document.activeElement;e&&e!==document.body||requestAnimationFrame(()=>i.current?.focus())},[n,e.id]);let v=Jd({mutationFn:async t=>X.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=>{_(!0),Ik(r,t.interaction),r.invalidateQueries({queryKey:Pk(e.owner.threadSlug,e.owner.sessionId)}),r.invalidateQueries({queryKey:Fk(e.owner.threadSlug,e.owner.sessionId,e.id)})},onError:t=>{Lk(r,e),h(v3(t))}}),y=()=>{if(!c||!p||v.isPending||g||!s.actionsEnabled)return;h(void 0);let e=s3(c.id,p),t=a.current.get(e)??y3();a.current.set(e,t),v.mutate({decisionId:c.id,values:p,responseId:t})},b=(t,n)=>{t.notesFieldId&&tW.set(rW.interaction(o,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId),n)};return(0,V.jsxs)(`article`,{ref:i,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,V.jsx)(X0,{question:e.question,interactive:s.actionsEnabled&&!g?{answer:f[t],onChip:n=>d(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 b(e,``),{...r,chosen:n}})),onText:t=>b(e,t),onSubmit:y}:void 0},e.optionFieldId??e.notesFieldId??t)),m&&(0,V.jsx)(`div`,{role:`alert`,className:`break-words text-[11px] leading-snug text-red-300`,children:m}),(s.status||v.isPending||g)&&(0,V.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`text-[11px] leading-snug text-muted`,children:s.status??(g?`Answer sent.`:`Sending…`)}),s.actionsEnabled&&!g&&(0,V.jsx)(`div`,{className:`flex justify-start`,children:(0,V.jsx)(`button`,{type:`button`,"data-send-answers":!0,disabled:!p||v.isPending,onClick:y,onMouseDown:e=>e.preventDefault(),className:`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 S3({record:e,autoFocus:t=!1}){let n=(0,B.useMemo)(()=>g3(e),[e]);return n?(0,V.jsx)(x3,{record:e,questions:n,autoFocus:t}):(0,V.jsx)(C3,{record:e,autoFocus:t})}function C3({record:e,autoFocus:t=!1}){let n=Md(),r=(0,B.useId)(),i=(0,B.useRef)(null),a=(0,B.useRef)(new Map),o=e.payload.kind===`mcp-elicitation-form`||e.payload.kind===`agent-question`?e.payload.fields:[],s=o.some(e=>e.secret),c=iW(),l=o.filter(e=>!e.secret&&(e.input===`text`||e.input===`multiline`)).map(t=>rW.interaction(c,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.id)),u=sW(l),[d,f]=(0,B.useState)(()=>i3(o)),p=(0,B.useMemo)(()=>{let t={...d};return o.forEach(n=>{if(!n.secret&&(n.input===`text`||n.input===`multiline`)){let r=rW.interaction(c,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,n.id);t[n.id]=u.get(r)??``}}),t},[o,d,u,c,e.id,e.owner]),[m,h]=(0,B.useState)({}),[g,_]=(0,B.useState)(),[v,y]=(0,B.useState)(),[b,x]=(0,B.useState)(!1),[S,C]=(0,B.useState)(),[w,T]=(0,B.useState)(!1),E=G4(e.delivery?.effect),D=(0,B.useMemo)(()=>e3(e),[e]).filter(e=>!(s&&e.requiresValues)),O=e.allowedDecisions.length-D.length,k=(0,B.useCallback)(t=>{for(let n of o)if(!n.secret&&(n.input===`text`||n.input===`multiline`)){let r=t[n.id];typeof r==`string`&&tW.set(rW.interaction(c,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,n.id),r)}f(t)},[o,c,e.id,e.owner]);(0,B.useEffect)(()=>{if(!t)return;let e=document.activeElement;e&&e!==document.body||requestAnimationFrame(()=>i.current?.focus())},[t,e.id]),(0,B.useEffect)(()=>{E.actionsEnabled||(C(void 0),T(!1))},[E.actionsEnabled]);let A=Jd({mutationFn:async({decision:t,values:n,responseId:r})=>{if(t.semantic===`cancel`&&e.provider.kind===`frizz`){let t=await X.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 X.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,r)=>{t.waitingForProvider||a.current.delete(s3(r.decision.id,r.values)),_(void 0),C(void 0),T(!1),x(!0),l.forEach(e=>tW.clear(e)),y(t.waitingForProvider?`Response sent. Waiting for the provider to acknowledge it…`:`Request completed.`),Ik(n,t.interaction),n.setQueryData(Fk(e.owner.threadSlug,e.owner.sessionId,e.id),{interaction:t.interaction}),n.invalidateQueries({queryKey:Pk(e.owner.threadSlug,e.owner.sessionId),exact:!0}),t.waitingForProvider&&window.setTimeout(()=>{n.invalidateQueries({queryKey:Pk(e.owner.threadSlug,e.owner.sessionId),exact:!0})},1e3)},onError:t=>{y(void 0),_(v3(t)),Lk(n,e),X.interactionGet({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id}).then(({interaction:t})=>{Ik(n,t),n.setQueryData(Fk(e.owner.threadSlug,e.owner.sessionId,e.id),{interaction:t}),t.delivery?.effect===`sending`?(_(void 0),y(void 0),x(!0)):t.delivery?.effect===`reconnect-required`?(_(void 0),y(void 0)):(t.lifecycle!==`pending`||t.recordRevision!==e.recordRevision)&&(_(void 0),y(t.lifecycle===`expired`?`This request expired.`:`This request changed in another client.`),n.invalidateQueries({queryKey:Pk(e.owner.threadSlug,e.owner.sessionId),exact:!0})),n.invalidateQueries({queryKey:Pk(e.owner.threadSlug,e.owner.sessionId),exact:!0})}).catch(()=>{})}});function j(e){if(!e.requiresValues){h({});return}let t=o3(o,p);return h(t.errors),t.formError?(_(t.formError),null):t.values?t.values:null}function M(e,t=!1){if(!E.actionsEnabled||A.isPending||b)return;_(void 0);let n=j(e);if(n===null)return;if(e.durable&&!t){C(e),T(!1);return}let r=s3(e.id,n),i=a.current.get(r)??y3();a.current.set(r,i),A.mutate({decision:e,values:n,responseId:i})}let N=D.find(e=>e.requiresValues&&e.tone===`primary`);function P(e){e.preventDefault(),E.actionsEnabled&&N&&M(N)}return(0,V.jsxs)(`article`,{ref:i,tabIndex:-1,"aria-labelledby":r,"data-interaction-id":e.id,"data-interaction-kind":e.payload.kind,"data-delivery-effect":e.delivery?.effect,className:`min-w-0 ${i0} border border-accent/45 bg-accent/[0.065] shadow-sm shadow-black/15 outline-none focus-visible:ring-2 focus-visible:ring-accent/60`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 border-b border-accent/20 px-4 py-3`,children:[(0,V.jsx)(xw,{"aria-hidden":`true`,size:16,className:`shrink-0 text-accent`}),(0,V.jsx)(`h3`,{id:r,className:`min-w-0 flex-1 break-words text-[14px] font-semibold leading-snug text-fg`,children:e.payload.title})]}),(0,V.jsx)(`form`,{onSubmit:P,className:`min-w-0 px-4 py-3.5`,noValidate:!0,children:(0,V.jsxs)(`fieldset`,{disabled:!E.actionsEnabled,className:`min-w-0 border-0 p-0`,children:[(0,V.jsx)(`legend`,{className:`sr-only`,children:`Interaction request`}),(0,V.jsx)(T3,{record:e,instanceId:r,draft:p,setDraft:k,errors:m,autoFocus:t}),s&&(0,V.jsxs)(`div`,{"data-secret-fallback":!0,className:`mt-3 rounded-md border border-amber-500/35 bg-amber-500/[0.07] p-3 text-[12px] leading-snug text-amber-100/90`,children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(aw,{"aria-hidden":`true`,size:14,className:`mt-0.5 shrink-0`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`font-medium`,children:`Secret input is unavailable in this page.`}),(0,V.jsx)(`div`,{className:`mt-1 text-amber-100/70`,children:`Frizz will not persist or send secret values through the current RPC.`})]})]}),(0,V.jsx)(`div`,{className:`mt-2 font-medium`,children:`Use the provider's trusted secret-input flow. The thread terminal cannot answer this typed request.`})]}),O>0&&(0,V.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-md border border-amber-500/25 bg-amber-500/[0.05] px-3 py-2 text-[11px] leading-snug text-amber-100/75`,children:[(0,V.jsx)(kw,{"aria-hidden":`true`,size:13,className:`mt-0.5 shrink-0`}),(0,V.jsxs)(`span`,{children:[O===1?`One advertised choice`:`${O} advertised choices`,` cannot be safely labeled or delivered in Frizz and is not shown.`]})]}),S&&(0,V.jsxs)(`div`,{"data-durable-confirmation":!0,role:`group`,"aria-label":`Confirm ${S.label}`,className:`mt-3 rounded-md border border-amber-400/45 bg-amber-500/[0.08] p-3`,children:[(0,V.jsx)(`div`,{className:`text-[12px] font-semibold text-amber-100`,children:`This approval persists beyond the current request.`}),(0,V.jsx)(`div`,{className:`mt-1 text-[11px] leading-snug text-amber-100/75`,children:S.scope}),(0,V.jsxs)(`label`,{className:`mt-2.5 flex cursor-pointer items-start gap-2 text-[11px] leading-snug text-fg/85`,children:[(0,V.jsx)(`input`,{type:`checkbox`,autoFocus:!0,checked:w,onChange:e=>T(e.target.checked),className:`mt-0.5 accent-[var(--color-accent)]`}),(0,V.jsx)(`span`,{children:`I understand this may authorize later matching actions in this session.`})]}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-start gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>{C(void 0),T(!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,V.jsxs)(`button`,{type:`button`,disabled:!w||A.isPending,onClick:()=>M(S,!0),className:`rounded-md border border-amber-400/50 bg-amber-500/15 px-2.5 py-1.5 text-[11px] font-semibold text-amber-50 hover:bg-amber-500/25 disabled:opacity-35`,children:[`Confirm `,S.label.toLowerCase()]})]})]}),g&&(0,V.jsx)(`div`,{role:`alert`,className:`mt-3 break-words text-[11px] leading-snug text-red-300`,children:g}),(E.status??v)&&(0,V.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`mt-3 text-[11px] leading-snug text-muted`,children:E.status??v}),E.actionsEnabled&&!S&&!b&&D.length>0&&(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap justify-start gap-2`,children:[D.map(e=>(0,V.jsxs)(`button`,{type:e===N?`submit`:`button`,"data-interaction-decision":e.id,disabled:A.isPending,"aria-describedby":e.durable?`${r}-scope-${e.id}`:void 0,onClick:e===N?void 0:()=>M(e),className:w3(e),children:[A.isPending?`Sending…`:e.label,e.durable&&(0,V.jsx)(`span`,{className:`sr-only`,children:`; persistent approval`})]},e.id)),D.filter(e=>e.durable).map(e=>(0,V.jsx)(`span`,{id:`${r}-scope-${e.id}`,className:`sr-only`,children:e.scope},`scope-${e.id}`))]}),!E3.has(e.payload.kind)&&(0,V.jsx)(k3,{record:e})]})})]})}function w3(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-fg/50 disabled:opacity-40`;return e.tone===`primary`?`${t} border-accent/55 bg-accent/15 text-fg hover:bg-accent/25`:e.tone===`danger`?`${t} border-red-400/35 bg-red-500/[0.07] text-red-200 hover:bg-red-500/15`:`${t} border-border bg-panel text-muted hover:bg-panel-2 hover:text-fg`}function T3({record:e,instanceId:t,draft:n,setDraft:r,errors:i,autoFocus:a}){let o=e.payload,s=(e,t)=>r(a3(n,e,t)),c;return c=o.kind===`command-approval`||o.kind===`file-approval`||o.kind===`permission-approval`?(0,V.jsx)(I4,{payload:o}):o.kind===`mcp-elicitation-url`?(0,V.jsx)(O3,{url:o.url}):(0,V.jsx)(A3,{instanceId:t,fields:o.fields,draft:n,setValue:s,errors:i,autoFocus:a}),(0,V.jsxs)(V.Fragment,{children:[`message`in o&&o.message&&(0,V.jsx)(D3,{text:o.message}),(0,V.jsx)(`div`,{className:`message`in o&&o.message?`mt-3`:``,children:c})]})}var E3=new Set([`command-approval`,`file-approval`,`permission-approval`]);function D3({text:e}){return e.length>600||e.split(`
485
+ `).length>6?(0,V.jsxs)(`details`,{className:`rounded-md border border-border/70 bg-panel/60`,children:[(0,V.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-fg/50`,children:`Request message`}),(0,V.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,V.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})}function O3({url:e}){let t=c3(e,location.href);return(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-[11px] font-medium text-fg`,children:`Open this page to continue`}),(0,V.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,V.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,V.jsx)(KC,{"aria-hidden":`true`,size:12}),`Open page`]}):(0,V.jsx)(`div`,{role:`alert`,className:`mt-1.5 break-words text-[11px] text-red-300`,children:`This request did not provide a safe http(s) URL.`})]})}function k3({record:e}){return(0,V.jsxs)(`details`,{className:`mt-3 border-t border-border/50 pt-2 text-[10.5px] text-muted/70`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer w-fit outline-none hover:text-muted focus-visible:ring-1 focus-visible:ring-fg/50`,children:`Request details`}),(0,V.jsxs)(`dl`,{className:`mt-2 grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1`,children:[(0,V.jsx)(`dt`,{children:`Provider`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:t3(e.provider.kind)}),e.provider.name&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Reported name`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.name})]}),e.provider.version&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Reported version`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.version})]}),(0,V.jsx)(`dt`,{children:`Source`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:n3(e.source.kind)}),e.source.label&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Reported source`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.source.label})]}),(0,V.jsx)(`dt`,{children:`Scope`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:`This thread · this request`}),e.expiresAt&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Expires`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.expiresAt})]})]})]})}function A3({instanceId:e,fields:t,draft:n,setValue:r,errors:i,autoFocus:a}){let o=t.findIndex(e=>!e.secret);return(0,V.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,V.jsx)(`legend`,{className:`sr-only`,children:`Requested information`}),(0,V.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:t.map((t,s)=>(0,V.jsx)(j3,{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 j3({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,V.jsxs)(V.Fragment,{children:[t.label,t.required&&(0,V.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-accent/40`,f;if(t.secret)f=(0,V.jsx)(`div`,{className:`mt-1 text-[11px] text-amber-100/70`,children:`Use the secure fallback below.`});else if(t.input===`multiline`)f=(0,V.jsx)(`textarea`,{id:o,name:t.id,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,V.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,V.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,V.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,V.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,V.jsx)(`span`,{children:u})]});else if(t.input===`select`)f=(0,V.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,V.jsx)(`option`,{value:``,children:`Choose an option…`}),t.options.map((e,t)=>(0,V.jsx)(`option`,{value:String(t),children:e.label},t))]});else if(t.input===`multi-select`){let e=Array.isArray(n)?n:[];f=(0,V.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,V.jsx)(`legend`,{className:`px-1 text-[11px] font-medium text-fg/85`,children:u}),(0,V.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.options.map((n,i)=>{let o=String(i);return(0,V.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-[12px] text-fg/85`,children:[(0,V.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,V.jsx)(`span`,{children:n.label})]},o)})})]})}return(0,V.jsxs)(`div`,{className:`min-w-0`,children:[t.secret?(0,V.jsx)(`div`,{className:`text-[11px] font-medium text-fg/85`,children:u}):t.input!==`boolean`&&t.input!==`multi-select`?(0,V.jsx)(`label`,{htmlFor:o,className:`block text-[11px] font-medium text-fg/85`,children:u}):null,t.description&&(0,V.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,V.jsx)(`div`,{id:c,role:`alert`,className:`mt-1 text-[10.5px] text-red-300`,children:i})]})}function M3(e){return(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).length}function N3(e,t={}){let n=(e.subAgents??[]).filter(e=>Sy(e)&&e.state===`running`).length,r=(e.bgShells??[]).filter(e=>e.state===`running`).length,i=t.watchers===!1?0:M3(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 P3(e){return(e.subAgents??[]).some(e=>Sy(e)&&e.state===`running`)}function F3(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length}function I3(e){return P3(e)||F3(e)>0}function L3(e){return R3(e)?`Background shells running`:`Awaiting`}function R3(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length>0&&!P3(e)&&M3(e)===0&&z3(e).length===0}function z3(e){return(e.watches??[]).filter(e=>e.kind===`timer`&&e.state===`armed`)}var B3={mergeable:`no conflicts`,blocked:`merge blocked`,conflicting:`has conflicts`,unknown:null};function V3(e){return e.state!==`open`||e.merge===`blocked`&&e.checks!==`passing`&&e.checks!==`none`?null:B3[e.merge]}var H3=`shrink-0 self-baseline translate-y-[calc(0.5em_-_0.5cap)]`;function U3({tone:e}){return(0,V.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-3 rounded-full border ${e} border-t-transparent motion-safe:animate-spin ${H3}`})}function W3({status:e}){return e?e.state===`merged`?(0,V.jsx)(XC,{size:12,className:`${H3} text-purple-400`}):e.state===`closed`?(0,V.jsx)(ZC,{size:12,className:`${H3} text-red-400`}):e.checks===`failing`?(0,V.jsx)(HC,{size:12,className:`${H3} text-red-400`}):e.checks===`passing`?(0,V.jsx)(LC,{size:12,className:`${H3} text-emerald-500`}):e.checks===`running`?(0,V.jsx)(U3,{tone:`border-amber-400`}):(0,V.jsx)(RC,{size:12,className:`${H3} text-muted/60`}):(0,V.jsx)(RC,{size:12,className:`${H3} text-muted/60`})}function G3(e){return[e.failed>0?`${e.failed} failing`:null,e.running>0?`${e.running} in progress`:null,e.passed>0?`${e.passed} successful`:null].filter(e=>e!==null).join(`, `)}function K3(e){if(!e)return`Checking…`;if(e.state===`merged`)return`Merged`;if(e.state===`closed`)return`Closed`;let t=G3(e),n=V3(e);return[t||`No checks`,n].filter(e=>e!==null).join(` · `)}var q3=`group relative col-span-4 grid grid-cols-subgrid items-baseline rounded-sm text-[12px] leading-5`,J3=`ml-1.5 min-w-0 truncate font-medium text-fg/90`,Y3=`ml-3 min-w-0 truncate text-right text-muted/70`,X3=`outline-none after:absolute after:inset-0 after:rounded-sm focus-visible:after:ring-1 focus-visible:after:ring-fg/60`;function Z3(){return(0,V.jsx)(PC,{size:13,"aria-hidden":!0,className:`${H3} ml-[3px] -mr-[4px] text-muted/35 transition-colors group-hover:text-muted/70`})}function Q3({mark:e,name:t,status:n,onOpen:r,href:i,ghRef:a,title:o,testKind:s,testId:c}){let l=i?(0,V.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer noopener`,title:o,"data-gh-ref":a,onMouseDown:e=>e.stopPropagation(),className:`${J3} ${X3} group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):r?(0,V.jsx)(`button`,{type:`button`,onClick:r,onMouseDown:e=>e.stopPropagation(),title:o,className:`${J3} ${X3} text-left group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):(0,V.jsx)(`span`,{className:J3,title:o,children:t}),u=!!(i||r);return(0,V.jsxs)(`div`,{"data-wait-row":c,"data-wait-kind":s,className:`${q3} ${u?`cursor-pointer transition-colors hover:bg-fg/[0.045]`:``}`,children:[(0,V.jsx)(`span`,{className:`flex shrink-0`,children:e}),l,(0,V.jsx)(`span`,{"data-wait-status":!0,className:Y3,children:n}),u?(0,V.jsx)(Z3,{}):(0,V.jsx)(`span`,{})]})}function $3({watch:e}){let t=e.github,n=nJ(e.target);return(0,B.useEffect)(()=>{n&&_S([e.target])},[n,e.target]),(0,V.jsx)(Q3,{testKind:`github`,testId:e.target,mark:(0,V.jsx)(W3,{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,V.jsxs)(V.Fragment,{children:[K3(t),t&&t.failing.length>0&&n&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsx)(`a`,{href:`${n}/checks`,target:`_blank`,rel:`noreferrer noopener`,onMouseDown:e=>e.stopPropagation(),className:`relative text-red-400/85 underline decoration-red-400/30 underline-offset-2 hover:decoration-red-400`,children:`view failures`})]})]})})}function e6(e,t){return(e.bgShells??[]).find(e=>e.id===t||e.taskId===t||e.label===t)}function t6(e){return(e.watches??[]).filter(e=>e.kind===`shell`&&e.state===`armed`)}function n6({watch:e,thread:t,slug:n,now:r}){let i=e6(t,e.target),a=JM(i?.startedAt??e.createdAt,r),o=i?.id&&!i.outputUnavailable;return(0,V.jsx)(Q3,{testKind:`shell`,testId:e.target,mark:(0,V.jsx)(Ew,{size:12,className:`${H3} text-shell`}),name:i?.label??e.target,onOpen:o?()=>HS(n,i.id,{label:i.label,startedAt:i.startedAt}):void 0,title:o?`Read this shell's output — running for ${a}`:i?.label??e.target,status:a?`running · ${a}`:`running`})}function r6({watch:e,now:t}){let n=Date.parse(e.timer?.fireAt??``),r=Number.isFinite(n)?n>t?`fires in ${KM(n-t)}`:`firing…`:`armed`;return(0,V.jsx)(Q3,{testKind:`timer`,testId:e.target,mark:(0,V.jsx)(UC,{size:12,className:`${H3} 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 i6(e){return(e.subAgents??[]).filter(e=>Sy(e)&&e.state===`running`)}function a6({agent:e,slug:t,now:n}){let r=JM(e.startedAt,n),i=e.subagentType?.replace(/^frizz:/,``);return(0,V.jsx)(Q3,{testKind:`agent`,testId:e.id??e.label,mark:(0,V.jsx)(U3,{tone:`border-accent`}),name:e.label,onOpen:e.id?()=>VS(t,e.id,{label:e.label,subagentType:e.subagentType,startedAt:e.startedAt}):void 0,title:e.id?`Open this sub-agent — working for ${r}`:e.label,status:[i,r].filter(Boolean).join(` · `)})}function o6(e){return e?.awaitingBackground===!0&&e.runtime===`turn-idle`&&e.bgSnoozed!==!0}function s6({thread:e,actions:t}){let n=P3(e),r=fJ(e.lastFence?.kind===`awaiting`?e.lastFence.body:void 0),i=s$(r??``),a=FM(),o=(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`),s=t6(e),c=i6(e),l=z3(e),u=[{head:`Sub-agents`,rows:c.map(t=>(0,V.jsx)(a6,{agent:t,slug:e.id,now:a},t.id??t.label))},{head:`Background shells`,rows:s.map(t=>(0,V.jsx)(n6,{watch:t,thread:e,slug:e.id,now:a},t.id))},{head:`Pull requests`,rows:o.map(e=>(0,V.jsx)($3,{watch:e},e.id))},{head:`Timers`,rows:l.map(e=>(0,V.jsx)(r6,{watch:e,now:a},e.id))}].filter(e=>e.rows.length>0);return(0,V.jsxs)(d0,{"data-awaiting-background":!0,icon:R3(e)?Ew:tw,label:L3(e),className:t?`pb-0`:``,children:[r&&(0,V.jsx)(o1,{className:`md-body [overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`,html:i}),u.length===0&&I3(e)&&(0,V.jsx)(`p`,{className:`block min-w-0 text-[13px] leading-5 text-fg/75`,children:n?(0,V.jsxs)(V.Fragment,{children:[`It’s awaiting the results from `,N3(e,{watchers:!1}),` it dispatched. It returns to the queue on its own when the work comes back.`]}):(0,V.jsxs)(V.Fragment,{children:[N3(e,{watchers:!1}),` `,F3(e)===1?`is`:`are`,` still running. It resumes on its own when`,` `,F3(e)===1?`it finishes`:`one of them finishes`,`.`]})}),r&&u.length>0&&(0,V.jsx)(`div`,{"aria-hidden":!0,className:`-mx-4 mt-3 border-t border-border`}),u.length>0&&(0,V.jsx)(`div`,{className:`mt-3 grid grid-cols-[auto_1fr_auto_auto] gap-y-px`,children:u.map((e,t)=>(0,V.jsxs)(B.Fragment,{children:[(0,V.jsx)(`div`,{className:`col-span-4 text-[10.5px] uppercase tracking-wide text-muted/45 ${t>0?`mt-2.5`:``}`,children:e.head}),e.rows]},e.head))}),t?(0,V.jsx)(`div`,{className:`-mx-4 mt-3 flex flex-wrap items-center gap-x-2.5 gap-y-2 border-t border-border bg-fg/[0.03] px-4 py-2.5 ${o0}`,children:t}):null]})}function c6(e,t=Date.now()){return e!==void 0&&lM(e,t)!==void 0}function l6(){let[e,t]=(0,B.useState)(()=>Date.now());return(0,B.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function u6({thread:e}){let t=l6(),[n,r]=(0,B.useState)(!1),i=lM(e,t);if(!i)return null;let a=Date.parse(i),o=kj(i,t).replace(/^(Today|Tomorrow)/,e=>e.toLowerCase()),s=e.snoozePrompt?.trim();async function c(){r(!0);try{await X.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:null,prompt:null}),Q(`Snooze cleared`)}catch(e){Q((e instanceof Error?e.message:`Wake failed`).slice(0,100))}finally{r(!1)}}return(0,V.jsxs)(d0,{"data-snooze-card":!0,icon:tw,label:`Snoozed`,children:[(0,V.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:XM(a-t)}),(0,V.jsx)(`p`,{className:f0,children:s?(0,V.jsxs)(V.Fragment,{children:[`Resumes `,o,` and sends: “`,jj(s),`”`]}):(0,V.jsxs)(V.Fragment,{children:[`Returns to the queue `,o,`.`]})}),e.foreign!==!0&&(0,V.jsx)(p0,{children:(0,V.jsx)(`button`,{type:`button`,"data-snooze-wake-now":!0,disabled:n,onClick:()=>void c(),className:`${g0} disabled:cursor-not-allowed disabled:opacity-45`,children:`Wake now`})})]})}function d6({at:e,fallbackAt:t,className:n=``}){let r=FM(),i=SM(e,t),a=CM(i,r);return!a||!i?null:(0,V.jsx)(`time`,{dateTime:i,className:n,children:a})}var f6=1500;function p6(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},f6),a},fail(t){t===n&&(i(),e(!1))},dispose(){n++,i()}}}var m6=`Could not copy terminal command`,h6={attach:`Attach command copied`,resume:`Resume command copied`},g6={attach:`Copy command to attach to this thread's live terminal`,resume:`Copy command to resume this thread in a new terminal`},_6=e=>[`terminalCommand`,e];function v6(e){return X.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 y6(e){let t=v6(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 bU(n),r}function b6(e){let t=Jd({mutationFn:()=>y6(e)});return e=>t.mutate(void 0,{onSuccess:t=>{e?.onSuccess?.(),Q(h6[t])},onError:t=>{e?.onError?.(),Q(t instanceof Error?`${m6}: ${t.message}`:m6,{duration:7e3})}})}function x6({slug:e}){let[t,n]=(0,B.useState)(!1),r=(0,B.useRef)(null);r.current||=p6(n,{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)});let i=Md(),a=b6(e);(0,B.useEffect)(()=>()=>r.current?.dispose(),[]);function o(){i.prefetchQuery({queryKey:_6(e),queryFn:()=>v6(e),staleTime:15e3})}function s(){let t=i.getQueryData(_6(e));if(t){bU(t.command).then(()=>{r.current?.begin(),Q(h6[t.mode])},()=>Q(m6,{duration:7e3}));return}a({onSuccess:()=>r.current?.begin()})}let c=i.getQueryData(_6(e)),l=t?c?h6[c.mode]:`Terminal command copied`:c?g6[c.mode]:`Copy terminal command`;return(0,V.jsx)(Pq,{label:l,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":l,title:l,onClick:s,onPointerEnter:o,onFocus:o,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:t?(0,V.jsx)(jC,{size:14,strokeWidth:2.2,className:`text-fg`}):(0,V.jsx)(Ew,{size:14,strokeWidth:1.8})})})}function S6(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 C6(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 w6(e){return`legacy:${e.role}:${e.kind??`message`}:${e.at??``}:${e.text}`}function T6(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??w6(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 E6(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 D6(e,t){let n=e.map(e=>e.message);return e.filter((e,r)=>!E6(n,r,t))}var O6=new Set([`agent`,`follow up`,`interrupt`,`send message`,`spawn agent`,`wait for agents`]),k6=new Set([`poll process`,`wait`]);function A6(e){return(e.split(`__`).pop()||e).replaceAll(`_`,` `).trim()}function j6(e){return A6(e).toLowerCase()}function M6(e){return e.prompt!==void 0||e.agentId!==void 0||e.sendTo!==void 0||e.sendBody!==void 0||e.backgroundState!==void 0&&!P6(e)||N6(e)||O6.has(j6(e.name))}function N6(e){return e.outputImage!==void 0||e.sentImages!==void 0&&e.sentImages.length>0}function P6(e){return e.backgroundState===`unknown`&&k6.has(j6(e.name))}function F6(e){if(e.role!==`assistant`||e.kind||e.queued)return null;if(e.parts&&e.parts.length>0){let t=[];for(let n of e.parts)if(n.kind===`text`){if(n.text.trim())return null}else t.push(...n.tools);return t.length>0&&t.every(e=>!M6(e))?t:null}return e.text.trim()||e.tools.length===0?null:e.tools.every(e=>!M6(e))?e.tools:null}function I6(e){return e.role!==`assistant`||e.kind||e.queued||e.text.trim()||e.tools.length>0?!1:!e.parts?.some(e=>e.kind===`text`?e.text.trim().length>0:e.tools.length>0)}function L6(e){if(e.role!==`assistant`||e.kind||e.queued)return null;if(!e.parts?.length)return F6(e);for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.kind===`text`){if(n.text.trim())return null;continue}if(n.tools.length!==0)return n.tools.every(e=>!M6(e))?n.tools:null}return null}function R6(e,t,n){let r=[...e.tools,...t],i=e.parts?.map(e=>e.kind===`text`?e:{...e,tools:[...e.tools]})??[],a=-1;for(let e=i.length-1;e>=0;e--){let t=i[e];if(t.kind===`text`){if(t.text.trim())break;continue}if(t.tools.length>0){a=e;break}}let o=i[a];return o?.kind===`tools`?i[a]={kind:`tools`,tools:[...o.tools,...t]}:i.push({kind:`tools`,tools:t}),{...e,at:n??e.at,tools:r,parts:i}}function z6(e){let t=[],n=null;return e.forEach((e,r)=>{if(I6(e))return;if(e.queued){t.push({message:e,messageIndex:r});return}let i=F6(e);if(i&&n){n.message=R6(n.message,i,e.at);return}let a={message:e,messageIndex:r};t.push(a),L6(e)?(a.runStartedAt=e.at,n=a):n=null}),t}function B6(e){return e.status===`completed`||e.status===`failed`||e.status===`cancelled`}function V6(e){let t=H6(e);return t?.tools.some(e=>!B6(e))?t.tools.at(-1):void 0}function H6(e){let t=U6(e);if(!t)return;let n=L6(t.message);return n?{tools:n,at:t.message.at}:void 0}function U6(e){for(let t=e.length-1;t>=0;t--)if(!e[t].message.queued)return e[t]}function W6(e){let t=U6(e);if(t)return L6(t.message)?t.runStartedAt??t.message.at:t.message.at}function G6(e){let t=L6(e);if(!t)return e;let n=e.tools.length>=t.length?e.tools.slice(0,e.tools.length-t.length):e.tools.filter(e=>!t.includes(e)),r=!1,i=e.parts?e.parts.reduceRight((e,n)=>!r&&n.kind===`tools`&&n.tools===t?(r=!0,e):(e.unshift(n),e),[]):e.parts;return{...e,tools:n,parts:i}}function K6(e){let t;for(let n=e.length-1;n>=0;n--){let r=e[n].message;if(!r.queued){L6(r)&&(t=r);break}}if(!t)return[...e];let n=[];for(let r of e){let e=r.message===t?G6(r.message):r.message;I6(e)||n.push(e===r.message?r:{...r,message:e})}return n}function q6(e){return e.detail?.trim()||void 0}var J6={add:`Adding`,analyze:`Analyzing`,apply:`Applying`,audit:`Auditing`,benchmark:`Benchmarking`,build:`Building`,bump:`Bumping`,capture:`Capturing`,check:`Checking`,clean:`Cleaning`,collect:`Collecting`,commit:`Committing`,compare:`Comparing`,confirm:`Confirming`,copy:`Copying`,count:`Counting`,create:`Creating`,debug:`Debugging`,delete:`Deleting`,diff:`Diffing`,disable:`Disabling`,dispatch:`Dispatching`,drive:`Driving`,dump:`Dumping`,edit:`Editing`,enable:`Enabling`,extract:`Extracting`,fetch:`Fetching`,find:`Finding`,fix:`Fixing`,format:`Formatting`,generate:`Generating`,grep:`Grepping`,inspect:`Inspecting`,install:`Installing`,kill:`Killing`,launch:`Launching`,lint:`Linting`,list:`Listing`,load:`Loading`,measure:`Measuring`,merge:`Merging`,migrate:`Migrating`,move:`Moving`,open:`Opening`,parse:`Parsing`,patch:`Patching`,poll:`Polling`,print:`Printing`,probe:`Probing`,profile:`Profiling`,publish:`Publishing`,pull:`Pulling`,push:`Pushing`,query:`Querying`,read:`Reading`,rebase:`Rebasing`,refactor:`Refactoring`,regenerate:`Regenerating`,remove:`Removing`,rename:`Renaming`,render:`Rendering`,reproduce:`Reproducing`,restart:`Restarting`,revert:`Reverting`,review:`Reviewing`,run:`Running`,save:`Saving`,scan:`Scanning`,search:`Searching`,seed:`Seeding`,spawn:`Spawning`,start:`Starting`,stop:`Stopping`,summarize:`Summarizing`,sync:`Syncing`,tag:`Tagging`,test:`Testing`,trace:`Tracing`,typecheck:`Typechecking`,update:`Updating`,validate:`Validating`,verify:`Verifying`,wait:`Waiting`,watch:`Watching`,write:`Writing`};function Y6(e,t){let n=e?.trim();if(!n)return t;let r=n.indexOf(` `),i=(r===-1?n:n.slice(0,r)).replace(/[.:]$/,``);if(/ing$/i.test(i))return i.charAt(0).toUpperCase()+i.slice(1)+(r===-1?``:n.slice(r));let a=J6[i.toLowerCase()];return a?a+(r===-1?``:n.slice(r)):n.charAt(0).toUpperCase()+n.slice(1)}function X6(e,t){let n=t?.trim().replace(/\/+$/,``);if(!n||n===`/`||!n.startsWith(`/`))return e;let r=e.replaceAll(`${n}/`,``),i=/^(\/(?:Users|home)\/[^/]+)(?:\/|$)/.exec(n)?.[1];return i?r.replaceAll(`${i}/`,`~/`):r}function Z6(e,t){return X6(Q6(e),t)}function Q6(e){let t=j6(e.name),n=q6(e),r=n?` ${n}`:``;return t===`bash`||t===`exec`||t===`run command`?Y6(e.desc,n?`Running ${n}`:`Running a command`):t===`read`||t===`view image`?`Reading${r||` a file`}`:t===`grep`||t===`search`||t===`search query`||t===`find`?n?`Searching for ${n}`:`Searching`:t===`glob`||t===`find files`?n?`Finding ${n}`:`Finding files`:t===`edit`||t===`write`||t===`apply patch`?n?`Editing ${n}`:`Editing files`:t===`todos`||t===`update plan`?`Updating the plan`:t===`screenshot`||t===`snapshot`?n?`Capturing ${n}`:`Capturing the page`:t===`navigate`?n?`Navigating to ${n}`:`Navigating`:t===`evaluate`?`Evaluating the page`:t===`pages`?`Listing pages`:t===`new page`?`Opening a new page`:t===`close page`?`Closing the page`:t===`select page`?`Selecting a page`:t===`console`||t===`console message`?`Reading the console`:t===`network`||t===`network request`?`Inspecting network traffic`:t===`press key`?n?`Pressing ${n}`:`Pressing a key`:t===`fill form`?`Filling the form`:t===`dialog`?`Handling a dialog`:t===`upload`?n?`Uploading ${n}`:`Uploading a file`:t===`wait for`||t===`wait`?n?`Waiting for ${n}`:`Waiting`:t===`resize`?`Resizing the page`:t===`ask`?`Preparing a question`:t===`web`||t===`web search`?n?`Searching for ${n}`:`Searching the web`:`Using ${A6(e.name)||`a tool`}`}var $6=new Set([`edit`,`multiedit`,`write`,`apply patch`]);function e8(e){let t=new Set;for(let n of e){for(let e of n.edits??(n.edit?[n.edit]:[]))e.file.trim()&&t.add(e.file.trim());if(n.edit||n.edits?.length)continue;let e=n.detail?.trim();e&&$6.has(j6(n.name))&&t.add(e)}return t.size}function t8(e,t=0){let n=`Ran ${e} tool ${e===1?`call`:`calls`}`;return t===0?n:`${n}, edited ${t} file${t===1?``:`s`}`}function n8(e){return e>0?`${t8(e)}. Thinking…`:`Thinking…`}function r8(e,t){let n=e[t];return typeof n==`string`&&n?n:void 0}function i8(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function a8(e,t){let n=r8(e,t);if(n)try{let e=new URL(n);return e.protocol===`https:`||e.protocol===`http:`?e.href:void 0}catch{return}}function o8({directive:e,icon:t,title:n,meta:r,children:i}){return(0,V.jsxs)(`section`,{"data-codex-directive":e.name,className:`min-w-0 ${i0} border border-border bg-panel-2/75 p-4`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-muted`,"aria-hidden":!0,children:t}),(0,V.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,V.jsx)(`div`,{className:`min-w-0 truncate text-[11px] font-normal leading-4 text-muted`,children:r})]}),i]})}function s8({children:e,mono:t=!1}){return(0,V.jsx)(`div`,{className:`ml-6 mt-1 break-words text-[11px] leading-4 text-muted${t?` font-mono-keep`:``}`,children:e})}function c8({directive:e}){let t=e.attrs,n=r8(t,`display_name`)??r8(t,`skill_name`)??`Artifact template`,r=r8(t,`artifact_kind`),i=r8(t,`skill_name`),a=r8(t,`skill_directory`),[o,s]=(0,B.useState)(!!a);return(0,V.jsxs)(o8,{directive:e,icon:(0,V.jsx)(ow,{size:15}),title:n,meta:r?`${r} template`:`Template`,children:[i&&(0,V.jsx)(s8,{mono:!0,children:i.startsWith(`$`)?i:`$${i}`}),o&&a&&(0,V.jsx)(`img`,{src:RH(`${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 l8({directive:e}){let t=e.attrs,n=r8(t,`file`),r=i8(t,`start`),i=i8(t,`end`)??r,a=i8(t,`priority`),o=n?`${n}${r?`:${r}${i&&i!==r?`-${i}`:``}`:``}`:`Code location unavailable`;return(0,V.jsxs)(o8,{directive:e,icon:(0,V.jsx)(lw,{size:15}),title:r8(t,`title`)??`Review finding`,meta:a===void 0?void 0:`P${a}`,children:[r8(t,`body`)&&(0,V.jsx)(s8,{children:r8(t,`body`)}),n?(0,V.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,V.jsx)(s8,{mono:!0,children:o})]})}var u8={"git-stage":[fw,`Changes staged`],"git-commit":[YC,`Commit created`],"git-create-branch":[JC,`Branch created`],"git-push":[Aw,`Branch pushed`],"git-create-pr":[$C,`Pull request created`]};function d8({directive:e}){let[t,n]=u8[e.name],r=r8(e.attrs,`branch`),i=a8(e.attrs,`url`),a=`${n}${e.attrs.isDraft===!0?` as draft`:``}`;return(0,V.jsx)(o8,{directive:e,icon:(0,V.jsx)(t,{size:15}),title:i?(0,V.jsx)(`a`,{className:`text-accent underline underline-offset-2`,href:i,target:`_blank`,rel:`noopener noreferrer`,children:a}):a,meta:r&&(0,V.jsx)(`span`,{className:`font-mono-keep`,children:r})})}function f8({directive:e}){let t=r8(e.attrs,`threadId`),n=r8(e.attrs,`pendingWorktreeId`);return(0,V.jsx)(o8,{directive:e,icon:(0,V.jsx)(dw,{size:15}),title:n?`Thread setup queued`:`Thread created`,meta:(t||n)&&(0,V.jsx)(`span`,{className:`font-mono-keep`,children:t??n})})}function p8({directive:e}){let t=r8(e.attrs,`reason`);return(0,V.jsx)(o8,{directive:e,icon:(0,V.jsx)(CC,{size:15}),title:`Archive suggested`,meta:t})}function m8(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 h8({directive:e}){let t=e.attrs,n=r8(t,`mode`),r=r8(t,`name`)??`Automation`,i=m8(t.rrule),a=[r,n,r8(t,`status`),i].filter(Boolean).join(` · `);return(0,V.jsx)(o8,{directive:e,icon:(0,V.jsx)(AC,{size:15}),title:`Automation suggested`,meta:a,children:r8(t,`prompt`)&&(0,V.jsx)(s8,{children:r8(t,`prompt`)})})}function g8({directive:e}){return e.name===`artifact-template`?(0,V.jsx)(c8,{directive:e}):e.name===`code-comment`?(0,V.jsx)(l8,{directive:e}):e.name.startsWith(`git-`)?(0,V.jsx)(d8,{directive:e}):e.name===`created-thread`?(0,V.jsx)(f8,{directive:e}):e.name===`archive`||e.name===`archive-thread`?(0,V.jsx)(p8,{directive:e}):(0,V.jsx)(h8,{directive:e})}var _8;function v8(){return _8??=HO(async()=>{let{default:e}=await import(`./mermaid.core-0EWDNL_R.js`);return{default:e}},__vite__mapDeps([2,3,4,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`dark`,themeVariables:{background:`#181b20`,primaryColor:`#181b20`,primaryTextColor:`#e6e7e9`,primaryBorderColor:`#33363c`,lineColor:`#8b8f96`,secondaryColor:`#26282d`,tertiaryColor:`#0d0e10`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`}}),e)),_8}function y8({source:e}){let t=(0,B.useId)(),[n,r]=(0,B.useState)({}),i=q$(n.html??``);return(0,B.useEffect)(()=>{let n=!0;if(r({}),e.length>5e4)return r({error:`Diagram source exceeds the 50 KB rendering limit`}),()=>{n=!1};let i=`frizz-mermaid-${t.replace(/[^a-zA-Z0-9]/g,``)}`;return v8().then(t=>t.render(i,e)).then(({svg:e})=>{n&&r({html:e})}).catch(e=>{if(!n)return;let t=e instanceof Error?e.message.split(/\n| for text:/,1)[0]:`Unknown diagram error`;r({error:t.slice(0,240)})}).finally(()=>document.getElementById(`d${i}`)?.remove()),()=>{n=!1}},[t,e]),n.error?(0,V.jsxs)(`section`,{"data-mermaid-state":`error`,className:`${i0} border border-border bg-panel-2/75 p-4`,children:[(0,V.jsx)(`div`,{className:`text-[12px] font-medium text-fg`,children:`Diagram unavailable`}),(0,V.jsx)(`div`,{className:`mt-1 text-[11px] text-muted`,children:n.error}),(0,V.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})]}):n.html?(0,V.jsx)(`div`,{"data-mermaid-state":`ready`,className:`overflow-x-auto ${i0} border border-border bg-panel-2/75 p-4 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:i}):(0,V.jsx)(`div`,{"data-mermaid-state":`loading`,role:`status`,"aria-label":`Rendering diagram`,className:`h-24 animate-pulse ${i0} bg-panel-2`})}var b8=(0,B.createContext)(null),x8=(0,B.createContext)(null);function S8(){let e=(0,B.useContext)(b8),t=(0,B.useContext)(x8);return e??t}var C8=(0,B.createContext)(null);function w8(e){return e.status===`pending`&&e.backgroundState===`background`}function T8(e){let t=[];for(let n of e)for(let e of n.tools)w8(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 E8(e){return e.map(e=>{if(!e.tools.some(w8))return e;let t=e.tools.filter(e=>!w8(e)),n=e.parts?.map(e=>e.kind===`tools`?{...e,tools:e.tools.filter(e=>!w8(e))}:e).filter(e=>e.kind!==`tools`||e.tools.length>0);return{...e,tools:t,parts:n}})}function D8({slug:e,onStatusApplied:t,onClose:n,virtualized:r=!1,showReturnToQueue:i=!1}){let a=iC($A(),e);return(0,V.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,V.jsx)(P8,{slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:i}),(0,V.jsx)(O8,{slug:e,virtualized:r}),a&&(0,V.jsx)(S4,{thread:a,sticky:!0,safeArea:!0,onArchived:t})]})}function O8({slug:e,virtualized:t}){let n=$A(),r=iC(n,e),i=r?.runtime===`running`||r?.runtime===`spawning`,a=b6(e),o=r?.pendingInteraction?void 0:r?.pendingAsk,s=lj(e,{poll:i}),c=Md(),l=(0,B.useRef)(!1),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(null),m=(0,B.useMemo)(()=>s.data?.messages??[],[s.data]),h=(0,B.useMemo)(()=>T8(m),[m]),g=(0,B.useMemo)(()=>E8(m),[m]),_=(0,B.useMemo)(()=>J8(g),[g]),v=(0,B.useMemo)(()=>z6(g),[g]),y=i?H6(v):void 0,b=i?V6(v):void 0,x=b?Z6(b,n?.projectDir):void 0,S=i?W6(v):void 0,C=(0,B.useMemo)(()=>{let e=i?K6(v):v;return D6(e,Y8(e,_))},[v,i,_]),w=i,T=(0,B.useMemo)(()=>n0(m),[m]),E=(0,B.useMemo)(()=>l2(m),[m]),{stickyUserMessage:D}=Hf(zj),{answeringForMessage:O}=K0(e,m),k=(0,B.useRef)(null),[A,j]=(0,B.useState)(null),M=s.data?.messages.length??0;(0,B.useEffect)(()=>{if(t)return;let e=k.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<=4&&(e.scrollTop=e.scrollHeight)},[M,i,t]);let N=(0,B.useCallback)(async()=>{if(l.current)return;let t=c.getQueryData([`transcript`,e]),n=t?.beforeCursor,r=t?.transcriptKey;if(!(!t?.hasEarlier||!n||!r)){l.current=!0,d(!0),p(null);try{let t=await X.threadTranscriptEarlier({slug:e,cursor:n}),i=c.getQueryData([`transcript`,e]);if(!i?.transcriptKey||i.transcriptKey!==r||t.transcriptKey!==r){await s.refetch(),Q(`Transcript changed while loading history; refreshed the current session`);return}c.setQueryData([`transcript`,e],hA(i,t))}catch(e){let t=e instanceof Error?e.message:`Could not load earlier transcript history`;p(t)}finally{l.current=!1,d(!1)}}},[s,c,e]);return(0,V.jsx)(b8.Provider,{value:e,children:(0,V.jsxs)(`div`,{"data-drawer-scroll-ready":s.isPending?`false`:`true`,className:`flex-1 min-h-0 flex flex-col overflow-hidden outline-none`,children:[(0,V.jsxs)(`div`,{className:`relative min-h-0 flex-1 flex flex-col`,children:[(0,V.jsx)(`div`,{ref:k,"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&&u?!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-fg/60`,children:t&&M>0?(0,V.jsx)(M8,{slug:e,transcriptRef:k,transcriptKey:s.data?.transcriptKey,messages:g,paired:T,answeringForMessage:O,thread:r,running:i,copyTerminalCommand:a,stickyUserMessage:D,transportFallback:s.transportFallback,isFetching:s.isFetching,refresh:()=>void s.refetch(),retryLiveUpdates:s.retryLiveUpdates,hasEarlier:s.data?.hasEarlier===!0,beforeCursor:s.data?.beforeCursor,loadingEarlier:u,earlierError:f,loadEarlier:()=>void N(),jumpOverlay:A}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(b3,{thread:r,className:`px-6 pt-5`,autoFocusFirst:!0}),s.transportFallback&&(0,V.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:s.transportFallback.kind===`payload-too-large`?`Live payload ${s.transportFallback.actualBytes} bytes; socket limit ${s.transportFallback.maxBytes} bytes`:`Transcript read budget reached (${s.transportFallback.scope}); retry after about ${s.transportFallback.retryAfterMs}ms`,children:[(0,V.jsx)(kw,{size:13,className:`shrink-0 text-muted`}),(0,V.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,s.transportFallback.kind===`payload-too-large`?`The transcript is too large for push; the last complete HTTP-loaded copy remains visible.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,V.jsx)(`button`,{type:`button`,disabled:s.isFetching,onClick:()=>void s.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:s.isFetching?`Refreshing…`:`Refresh once`}),(0,V.jsx)(`button`,{type:`button`,onClick:s.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,V.jsx)(`div`,{"data-transcript-column":!0,className:`flex min-h-full flex-col px-6 py-5`,children:M===0?(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted`,children:s.isPending?(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(n7,{}),` Loading…`]}):i?(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(n7,{}),` Session starting…`]}):f2(r)?(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`p`,{className:`mb-3`,children:`No session is attached to this thread yet.`}),(0,V.jsx)(`button`,{className:`btn-ghost border border-border text-[12px]`,onClick:()=>X.adoptThread({slug:e}).catch(()=>{}),children:`Start a session on this thread`})]}):`No conversation yet.`}):(0,V.jsxs)(V.Fragment,{children:[$8(C.map(e=>e.message),(e,t)=>{let n=C[t].messageIndex,r=n===E&&D,i=(0,V.jsx)(N5,{m:e,answering:O(e),showSendButton:!0,paired:T[n],sticky:r,staleAwaiting:_>=0&&n<_},t);return r?(0,V.jsx)(j5,{children:i},t):i},e=>!!e.queued),(r?.providerFault||r?.limitPause||o||r?.runtime===`perm-prompt`||w||c6(r)||r?.awaitingBackground)&&(0,V.jsx)(_0,{h:w&&!r?.providerFault&&!r?.limitPause&&!o&&r?.runtime!==`perm-prompt`?Q8(C.map(e=>e.message)):14}),r?.providerFault&&!r.foreign?(0,V.jsx)(W5,{slug:e,sessionId:r.sessionId,fault:r.providerFault,retryText:E>=0?m[E]?.text:void 0}):r?.limitPause&&!r.foreign?(0,V.jsx)(K5,{slug:e,sessionId:r.sessionId,pause:r.limitPause}):o?(0,V.jsx)(X5,{ask:o,onTerminal:a}):r?.runtime===`perm-prompt`?(0,V.jsx)(q5,{onTerminal:a}):w?(0,V.jsx)(r7,{since:r?.lastUserAt,startedAt:S,activityLabel:x,run:y}):c6(r)?(0,V.jsx)(u6,{thread:r}):o6(r)?(0,V.jsx)(s6,{thread:r}):null,r?.permPolicy?(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(J5,{policy:r.permPolicy,denies:r.permDenies})}):null,m.some(e=>e.queued)&&(0,V.jsx)(_0,{}),(0,V.jsx)(`div`,{className:`flex flex-col gap-3.5`,children:m.map((e,t)=>e.queued?(0,V.jsx)(N5,{m:e,paired:T[t]},`q${t}`):null)})]})})]})}),(0,V.jsx)(`div`,{ref:j,"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,V.jsx)(`div`,{"data-thread-chat-footer":!0,className:`z-10 shrink-0 border-t border-border/60 bg-panel`,children:(0,V.jsx)(L2,{slug:e,onTerminal:a,ops:(0,V.jsx)(Y5,{slug:e,transcriptShells:h,className:`px-1 pt-1.5`})})})]})})}var k8=700,A8=250,j8=(()=>{try{return localStorage.getItem(`frizz.debugScroll`)===`1`}catch{return!1}})();function M8({slug:e,transcriptRef:t,transcriptKey:n,messages:r,paired:i,answeringForMessage:a,thread:o,running:s,copyTerminalCommand:c,stickyUserMessage:l,transportFallback:u,isFetching:d,refresh:f,retryLiveUpdates:p,hasEarlier:m,beforeCursor:h,loadingEarlier:g,earlierError:_,loadEarlier:v,jumpOverlay:y}){let b=ej(),x=(0,B.useMemo)(()=>z6(r),[r]),S=s?H6(x):void 0,C=s?V6(x):void 0,w=C?Z6(C,b):void 0,T=s?W6(x):void 0,E=(0,B.useMemo)(()=>J8(r),[r]),D=(0,B.useMemo)(()=>{let e=s?K6(x):x;return D6(e,Y8(e,E))},[x,s,E]),O=s,k=(0,B.useMemo)(()=>T6(D.map(e=>e.message),Y8(D,E),K8).map(e=>({...e,messageIndex:D[e.messageIndex].messageIndex})),[D,E]),A=(0,B.useMemo)(()=>l2(r),[r]),j=!!(o?.providerFault&&!o.foreign||o?.limitPause&&!o.foreign||!o?.pendingInteraction&&o?.pendingAsk||o?.runtime===`perm-prompt`||O||c6(o)||o?.awaitingBackground),M=(0,B.useMemo)(()=>O&&!(o?.providerFault&&!o.foreign)&&!(o?.limitPause&&!o.foreign)&&!(!o?.pendingInteraction&&o?.pendingAsk)&&o?.runtime!==`perm-prompt`?Q8(D.map(e=>e.message)):14,[D,O,o]),N=(0,B.useMemo)(()=>{let e=[{key:`head-anchor`,kind:`head-anchor`}];u&&e.push({key:`transport-fallback`,kind:`transport-fallback`}),(m||g||_)&&e.push({key:`earlier-history:${h??`complete`}`,kind:`earlier-history`}),e.push(...k.map(e=>({...e,kind:`message`}))),e.push({key:`interactions`,kind:`interactions`}),j&&e.push({key:`runtime-status`,kind:`runtime-status`});let t=j||k.length>0?14:0;return r.forEach((n,r)=>{if(!n.queued)return;let i=`queued:${n.deliveryId??n.sourceId??r}`;e.push({key:i,kind:`queued`,message:n,messageIndex:r,gap:t}),t=14}),e},[h,_,m,j,g,k,r,u]),P=(0,B.useMemo)(()=>!l||A<0?-1:N.findIndex(e=>e.kind===`message`&&e.messageIndex===A),[A,N,l]),ee=tX({count:N.length,getScrollElement:()=>t.current,getItemKey:e=>N[e]?.key??e,estimateSize:e=>{let t=N[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===`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})}}),[F,te]=(0,B.useState)(!0),ne=(0,B.useRef)(!0),re=(0,B.useRef)(-1),ie=(0,B.useRef)(0),ae=(0,B.useRef)(null),oe=(0,B.useRef)(!1),se=(0,B.useRef)(!1),ce=(0,B.useRef)(!0),le=(0,B.useRef)(null),ue=(0,B.useRef)(void 0),de=(0,B.useRef)(null),fe=(0,B.useRef)(void 0),pe=(0,B.useRef)(void 0),me=(0,B.useRef)(0),he=(0,B.useCallback)(()=>{let e=t.current;if(e){let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-transcript-source-id]:not([data-transcript-sticky])`)).find(e=>e.getBoundingClientRect().bottom>t+1),r=n?.dataset.transcriptRowKey;n&&r&&(le.current={rowKey:r,viewportTop:n.getBoundingClientRect().top-t})}v()},[v,t]);(0,B.useLayoutEffect)(()=>{if(!n||N.length===0||ue.current===n)return;ue.current=n,oe.current=!1,se.current=!1,ce.current=!0;let e=requestAnimationFrame(()=>{ee.scrollToEnd({behavior:`instant`}),oe.current=!0,te(!0)});return()=>cancelAnimationFrame(e)},[N.length,n,ee]),(0,B.useLayoutEffect)(()=>{let e=le.current,n=t.current;if(!e||!n||g)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(),le.current===e&&(le.current=null)})});return()=>{cancelAnimationFrame(a),cancelAnimationFrame(i)}},[g,k.length,t]);let ge=(0,B.useCallback)(()=>{let e=t.current;if(!e)return null;let n=e.getBoundingClientRect().top,r=Array.from(e.querySelectorAll(`[data-transcript-row-key]:not([data-transcript-sticky])`)).find(e=>e.getBoundingClientRect().bottom>n+1),i=r?.dataset.transcriptRowKey;return!r||!i?null:{rowKey:i,viewportTop:r.getBoundingClientRect().top-n}},[t]),_e=(0,B.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&&t.dataset.transcriptSticky!==`true`);if(!r)return;let i=r.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=i-e.viewportTop},[t]),ve=P>=0?N[P]?.key:void 0;(0,B.useLayoutEffect)(()=>{let e=ve,t=fe.current;if(fe.current=e,t===void 0||t===e||ne.current)return;let n=de.current;if(!n||le.current)return;me.current=performance.now()+A8,_e(n);let r=0,i=0,a=requestAnimationFrame(()=>{_e(n),r=requestAnimationFrame(()=>{_e(n),i=requestAnimationFrame(()=>{_e(n),me.current=0})})});return()=>{cancelAnimationFrame(a),cancelAnimationFrame(r),cancelAnimationFrame(i),me.current=0}},[_e,ve]);let ye=k[0]?.key;(0,B.useLayoutEffect)(()=>{let e=pe.current;if(pe.current=ye,e===void 0||e===ye||!oe.current||ne.current||le.current)return;let t=de.current;if(!t)return;_e(t);let n=()=>{if(performance.now()<ie.current)return;let e=de.current;e&&_e(e)},r=0,i=requestAnimationFrame(()=>{n(),r=requestAnimationFrame(n)});return()=>{cancelAnimationFrame(i),cancelAnimationFrame(r)}},[_e,ye]);let be=(0,B.useCallback)(()=>{let e=t.current;if(!e||le.current||performance.now()<me.current)return;let n=S6({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,previousScrollHeight:re.current,following:ne.current,readerMoved:performance.now()<ie.current});if(ne.current=n.following,n.scrollTop!==null&&(e.scrollTop=n.scrollTop),re.current=e.scrollHeight,te(e=>e===n.following?e:n.following),j8&&!n.following&&performance.now()>=ie.current){let t=de.current,n=t&&Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.dataset.transcriptRowKey===t.rowKey&&e.dataset.transcriptSticky!==`true`);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 — pin=${fe.current??`none`} row=${t.rowKey}`)}}de.current=ge()??de.current},[ge,t]);(0,B.useLayoutEffect)(be),(0,B.useEffect)(()=>{let e=ae.current;if(!e)return;let t=new ResizeObserver(be);return t.observe(e),()=>t.disconnect()},[be]),(0,B.useEffect)(()=>{let e=t.current;if(!e)return;let n=()=>{be();let t=C6({armed:ce.current,scrollTop:e.scrollTop,readerMoved:oe.current&&se.current,hasEarlier:m,loading:g});ce.current=t.armed,t.shouldLoad&&he()},r=()=>{se.current=!0,ie.current=performance.now()+k8,requestAnimationFrame(n)},i=t=>{[`ArrowUp`,`PageUp`,`Home`,` `].includes(t.key)&&(e.scrollTop<=480&&(ce.current=!0),r())},a=t=>{t.deltaY<0&&e.scrollTop<=480&&(ce.current=!0),r()},o=()=>{e.scrollTop<=480&&(ce.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)}},[m,g,he,be,t]);let xe=ee.getVirtualItems(),Se=ee.getTotalSize(),Ce=P>=0?N[P]:void 0,we=Ce?.kind===`message`?Ce:void 0,Te=we?ee.measurementsCache[P]?.start??0:0;return(0,V.jsxs)(`div`,{ref:ae,"data-virtualized-transcript":!0,"data-virtual-row-count":xe.length,className:`relative w-full`,style:{height:Se},children:[we&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{"aria-hidden":!0,style:{height:Te}}),(0,V.jsx)(`div`,{ref:ee.measureElement,"data-index":P,"data-transcript-row-key":we.key,"data-transcript-source-id":we.message.sourceId,"data-transcript-sticky":`true`,className:`pointer-events-none [&>*]:pointer-events-auto sticky top-0 z-[9] flex w-full flex-col px-6 pt-3 pb-1.5`,children:(0,V.jsx)(N5,{m:we.message,answering:a(we.message),showSendButton:!0,paired:i[we.messageIndex],sticky:!0})},we.key)]}),xe.map(t=>{let n=N[t.index];return!n||t.index===P?null:(0,V.jsx)(`div`,{ref:ee.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`,style:{transform:`translateY(${t.start}px)`},children:n.kind===`head-anchor`?null:n.kind===`interactions`?(0,V.jsx)(b3,{thread:o,className:`px-6 pt-5`,autoFocusFirst:!0}):n.kind===`transport-fallback`?u?(0,V.jsx)(`div`,{className:`px-6 pt-3`,children:(0,V.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`flex flex-wrap items-center gap-2.5 ${i0} border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:u.kind===`payload-too-large`?`Live payload ${u.actualBytes} bytes; socket limit ${u.maxBytes} bytes`:`Transcript read budget reached (${u.scope}); retry after about ${u.retryAfterMs}ms`,children:[(0,V.jsx)(kw,{size:13,className:`shrink-0 text-muted`}),(0,V.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,u.kind===`payload-too-large`?`The transcript is too large for push; the last complete HTTP-loaded copy remains visible.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,V.jsx)(`button`,{type:`button`,disabled:d,onClick:f,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:d?`Refreshing…`:`Refresh once`}),(0,V.jsx)(`button`,{type:`button`,onClick:p,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,V.jsx)(`div`,{className:`flex min-h-10 items-center justify-center px-6 text-[11px] text-muted`,role:`status`,children:_?(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-2 text-center`,children:[(0,V.jsx)(`span`,{children:_}),(0,V.jsx)(`button`,{type:`button`,onClick:he,className:`rounded-md border border-border px-2 py-1 text-fg/90 hover:bg-panel-2`,children:`Retry`})]}):g?(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(cw,{size:12,className:`animate-spin`}),` Loading earlier messages…`]}):(0,V.jsx)(`button`,{type:`button`,onClick:he,className:`rounded-md px-2 py-1 outline-none hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:`Load earlier messages`})}):n.kind===`message`?(0,V.jsx)(`div`,{className:`flex flex-col px-6`,style:{paddingTop:n.gap},children:(0,V.jsx)(N5,{m:n.message,answering:a(n.message),showSendButton:!0,paired:i[n.messageIndex],staleAwaiting:E>=0&&n.messageIndex<E})}):n.kind===`runtime-status`?(0,V.jsxs)(`div`,{className:`px-6`,style:{paddingTop:M},children:[o?.providerFault&&!o.foreign?(0,V.jsx)(W5,{slug:e,sessionId:o.sessionId,fault:o.providerFault,retryText:A>=0?r[A]?.text:void 0}):o?.limitPause&&!o.foreign?(0,V.jsx)(K5,{slug:e,sessionId:o.sessionId,pause:o.limitPause}):!o?.pendingInteraction&&o?.pendingAsk?(0,V.jsx)(X5,{ask:o.pendingAsk,onTerminal:c}):o?.runtime===`perm-prompt`?(0,V.jsx)(q5,{onTerminal:c}):O?(0,V.jsx)(r7,{since:o?.lastUserAt,startedAt:T,activityLabel:w,run:S}):c6(o)?(0,V.jsx)(u6,{thread:o}):o6(o)?(0,V.jsx)(s6,{thread:o}):null,o?.permPolicy?(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(J5,{policy:o.permPolicy,denies:o.permDenies})}):null]}):(0,V.jsx)(`div`,{className:`flex flex-col px-6`,style:{paddingTop:n.gap},children:(0,V.jsx)(N5,{m:n.message,paired:i[n.messageIndex]})})},n.key)}),(0,V.jsx)(N8,{overlay:y,hidden:F,onJump:()=>ee.scrollToEnd({behavior:`smooth`})})]})}function N8({overlay:e,hidden:t,onJump:n}){return!e||t?null:(0,Xd.createPortal)((0,V.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-black/30 hover:bg-panel-2`,children:[(0,V.jsx)(wC,{size:12}),`Jump to latest`]}),e)}function P8({slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:r=!1}){let i=iC($A(),e),a=Jd({mutationFn:()=>X.markComplete({slug:e})}),o=Jd({mutationFn:t=>X.renameThread({slug:e,title:t})}),s=Jd({mutationFn:()=>X.aiRenameThread({slug:e}),onSuccess:({title:e})=>Q(`Renamed to “${e}”`),onError:e=>Q(e instanceof Error?e.message:`Could not rename with Claude`,{duration:7e3})}),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!c)return;let e=requestAnimationFrame(()=>{f.current?.focus(),f.current?.select()});return()=>cancelAnimationFrame(e)},[c]),(0,B.useEffect)(()=>{l(!1),d(``)},[e]);let p=JQ(qd({queryKey:[`threadBody`,e],queryFn:()=>X.threadBody({slug:e})}).data?.markdown??``).trim().length>0;if(!i)return null;let m=i.kind===`session`&&i.foreign!==!0,h=i.foreign===!0,g=i.kind===`session`&&!h,_=Uj(i),v=h2(i),y=!v.enabled||s.isPending,b=s.isPending?`Claude is generating a title…`:v.enabled&&s.error instanceof Error?s.error.message:v.label;function x(){l(!1),d(``)}function S(){let e=p2(u,_);if(l(!1),!e){d(``);return}o.mutate(e,{onSuccess:()=>{d(``),Q(`Thread renamed`)},onError:t=>{d(e),l(!0),Q(t instanceof Error?t.message:`Could not rename thread`)}})}return(0,V.jsxs)(`header`,{"data-thread-header":!0,className:g2,children:[(0,V.jsx)(`div`,{className:_2,children:(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[r&&(0,V.jsx)(Pq,{label:`Return to queue`,children:(0,V.jsx)(`a`,{href:_j(`/`),"aria-label":`Return to queue`,"data-standalone-return":!0,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:(0,V.jsx)(TC,{size:14})})}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 leading-tight`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[c?(0,V.jsx)(`input`,{ref:f,"aria-label":`Thread title`,value:u,maxLength:200,onChange:e=>d(e.target.value),onBlur:S,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),S()):e.key===`Escape`&&(e.preventDefault(),x())},className:`min-w-0 flex-1 rounded-md border border-border bg-elevated px-1.5 py-1 font-semibold text-[15px] text-fg outline-none focus:border-accent`}):g?(0,V.jsx)(`button`,{type:`button`,title:`Edit title`,"aria-label":`Edit thread title: ${_}`,disabled:o.isPending||s.isPending,onClick:()=>{d(m2(_,i.id)),l(!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-fg/60 disabled:cursor-not-allowed disabled:opacity-40`,children:_}):(0,V.jsx)(`div`,{className:`min-w-0 max-w-full shrink truncate px-0.5 -mx-0.5 font-semibold text-[15px]`,title:_,children:_}),v.show&&!c&&(0,V.jsx)(Pq,{label:b,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":s.isPending?`Renaming with Claude`:v.enabled?`Rename with Claude`:v.label,title:b,"aria-busy":s.isPending,"aria-disabled":y,onClick:()=>{y||(s.reset(),s.mutate())},className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md outline-none transition-colors ${y?`cursor-not-allowed opacity-40`:``} ${s.error?`text-red-400 hover:bg-red-500/10`:`text-accent hover:bg-accent/10`}`,children:(0,V.jsx)(Cw,{size:13,strokeWidth:2,className:s.isPending?`animate-pulse`:``})})})]}),(0,V.jsx)(d6,{at:eM(i),fallbackAt:i.spawnedAt,className:`mt-0.5 block truncate text-[11px] leading-tight text-muted/75`})]})]})}),(0,V.jsxs)(`div`,{className:v2,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[m&&(0,V.jsx)(x6,{slug:e}),(0,V.jsx)(R2,{thread:i,onDoc:p?()=>BS(`doc`,i.id):void 0,onDone:()=>a.mutate(void 0,{onSuccess:t}),doneBusy:a.isPending,onStatusApplied:t}),n&&(0,V.jsx)(Pq,{label:`Open in new tab`,children:(0,V.jsx)(`a`,{href:Ex(e),target:`_blank`,rel:`noopener`,"aria-label":`Open in new tab`,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:(0,V.jsx)(EC,{size:14})})})]}),n&&(0,V.jsx)(`button`,{type:`button`,"aria-label":`Close`,"data-dialog-initial-focus":!0,onClick:n,className:`ml-0.5 shrink-0 rounded-md p-1.5 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,V.jsx)(jw,{size:15})})]})]})}function F8(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||D4(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 I8(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||D4(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 L8(e){return F8(e)!==null}function R8(e){return I8(e)!==null}function z8(e){return e.kind===`event`&&!e.boundary||e.kind===`reasoning`}function B8(e){return z8(e)||L8(e)}function V8(e){return z8(e)||R8(e)}function H8(e){if(z8(e))return!0;let t=F8(e);return t!==null&&!M6(t[t.length-1])}function U8(e){if(z8(e))return!0;let t=I8(e);return t!==null&&!M6(t[0])}function W8(e){let t=F8(e);return t!==null&&N6(t[t.length-1])}function G8(e){let t=I8(e);return t!==null&&N6(t[0])}function K8(e,t){let n=W8(e)||G8(t),r=!n&&B8(e)&&V8(t)&&!(H8(e)&&U8(t));return(n?22:r?6:14)+(e.role===`user`&&t.role!==`user`?3:0)}function q8(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:X8(e,n.text,t)):(e.tools?.length??0)===0&&X8(e,e.text,t)}function J8(e){for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`&&e[t].kind!==`event`)return t;return-1}function Y8(e,t){let n=new WeakSet;if(t>=0)for(let r of e)r.messageIndex<t&&n.add(r.message);return e=>q8(e,n.has(e))}function X8(e,t,n){return!e.fenceRefused&&!n?!t.trim():W1(t).every(e=>e.kind===`fence`&&e.fenceKind===`awaiting`)}function Z8(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`&&!X8(e,n.text,t)):typeof e.text==`string`&&!X8(e,e.text,t)}function Q8(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.queued||q8(n)))return W8(n)?22:B8(n)&&!H8(n)?6:14+(n.role===`user`?3:0)}return 0}function $8(e,t,n){let r=[],i=null;return e.forEach((e,a)=>{n?.(e,a)||q8(e)||(i!==null&&r.push((0,V.jsx)(_0,{h:K8(i,e)},`s${a}`)),r.push(t(e,a)),i=e)}),r}function e5(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 t5(e,t=14){let n=e.filter(e=>e!=null&&e!==!1),r=[];return n.forEach((e,n)=>{n>0&&r.push((0,V.jsx)(_0,{h:typeof t==`number`?t:t(n)},`vs${n}`)),r.push(e)}),r}var n5={head:!1,tail:!1};function r5(e,t){return n=>e[n-1]?.tail||e[n]?.head?22:t}function i5(e){return{head:N6(e[0]),tail:N6(e[e.length-1])}}function a5(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}):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 o5(e){return e.split(`__`).pop()||e}function s5(e){let t=Z.board?.projectDir;return t&&e.startsWith(t+`/`)?e.slice(t.length+1):e}function c5({tools:e,at:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useId)(),a=e.reduce((e,t)=>e+t.count,0),o=t8(a,e8(e));return(0,V.jsxs)(`div`,{"data-tool-activity":!0,"data-tool-activity-state":`settled`,className:`flex min-w-0 flex-col`,children:[(0,V.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-fg/60 ${N4}`,children:[(0,V.jsx)(`span`,{"data-tool-activity-label":!0,title:o,className:`min-w-0 truncate text-muted`,children:o}),(0,V.jsx)(PC,{"data-tool-activity-chevron":!0,"aria-hidden":`true`,size:13,className:F4(n)})]}),n&&(0,V.jsx)(`div`,{id:i,className:`mt-1.5 flex flex-col`,children:t5(e.map((e,n)=>(0,V.jsx)(u5,{t:e,startedAt:t},n)),6)}),!n&&(0,V.jsx)(`div`,{id:i,hidden:!0})]})}function l5({tools:e,at:t}){let n=[];for(let t of e){let e=M6(t),r=n[n.length-1];r?.exceptional===e?r.tools.push(t):n.push({exceptional:e,tools:[t]})}return(0,V.jsx)(`div`,{className:`flex flex-col`,children:t5(n.map((e,n)=>e.exceptional?(0,V.jsx)(`div`,{className:`flex flex-col`,children:t5(e.tools.map((e,n)=>(0,V.jsx)(u5,{t:e,startedAt:t},n)),r5(e.tools.map(e=>i5([e])),6))},`exceptions-${n}`):(0,V.jsx)(c5,{tools:e.tools,at:t},`activity-${n}`)),r5(n.map(e=>i5(e.tools)),6))})}function u5({t:e,startedAt:t}){let n=(0,B.useContext)(b8),r=$A(),i=UM(e,(n?iC(r,n):void 0)?.bgShells??[]);return e.edits&&e.status!==`failed`&&e.status!==`cancelled`?(0,V.jsx)(W$,{edits:e.edits,meta:(0,V.jsx)(m5,{status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,durationMs:e.durationMs})}):e.command?(0,V.jsx)(S5,{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,V.jsx)(y5,{name:e.name,detail:e.detail,outputImage:e.outputImage,output:e.output,status:e.status,durationMs:e.durationMs}):e.read?(0,V.jsx)(w5,{detail:e.detail,read:e.read,status:e.status,durationMs:e.durationMs}):e.prompt||e.agentId?(0,V.jsx)(E5,{detail:e.detail,prompt:e.prompt,input:e.input,subagentType:e.subagentType,agentId:e.agentId,agentStatus:e.agentStatus,agentElapsedMs:e.agentElapsedMs,status:e.status,durationMs:e.durationMs,output:e.output}):e.sendTo!==void 0||e.sendBody!==void 0?(0,V.jsx)(O5,{to:e.sendTo,summary:e.sendSummary,body:e.sendBody??``,type:e.sendType,dispatchId:e.sendDispatchId,targetLabel:e.sendTargetLabel,status:e.status,durationMs:e.durationMs}):e.sentImages||e.sentFiles?(0,V.jsx)(b5,{images:e.sentImages??[],files:e.sentFiles??[],caption:e.caption,status:e.status,durationMs:e.durationMs}):e.todos?(0,V.jsx)(x1,{todos:e.todos,note:e.input,meta:(0,V.jsx)(m5,{status:e.status,durationMs:e.durationMs})}):e.input||e.output?(0,V.jsx)(S5,{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,V.jsx)(v5,{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 d5({tone:e,indicator:t,label:n,duration:r,title:i}){return(0,V.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,V.jsx)(`span`,{children:[n,r].filter(Boolean).join(` · `)})]})}function f5(e,t,n){let[r,i]=(0,B.useState)(()=>Date.now()),a=BM(e,t),o=VM(e,t,n,r);return(0,B.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(zM-(Date.now()-e),0));return()=>clearTimeout(t)},[a,o,n]),o}function p5({status:e,backgroundState:t,liveBackgroundState:n,startedAt:r}){let i=f5(e,t,r),a=n===`running`?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):n===`stale`?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot-quiet frizz-live-dot-quiet--shell`,"data-running-indicator":`tool-quiet`,title:iN}):RM(e,t)||i?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):null;return a?(0,V.jsx)(`span`,{className:`frizz-tool-mark -mr-1 flex w-[9px] shrink-0 justify-center`,children:a}):null}function m5({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:WM(i),c=[o,s].filter(Boolean).join(` · `);return(0,V.jsx)(d5,{tone:e===`failed`?`frizz-tool-failed`:e===`cancelled`?`text-amber-400`:`text-muted/55`,title:c,label:a,duration:s})}function h5(e,t,n){let r=t?Date.parse(t):NaN,i=e===`pending`&&Number.isFinite(r),[a,o]=(0,B.useState)(()=>Date.now());return(0,B.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 g5(e,t,n){let r=t&&t!==Z.board?.projectDir?`in ${s5(t)}`:void 0;return[e,t?r:n!==void 0&&!e?.includes(String(n))?`session ${n}`:void 0].filter(Boolean).join(` · `)||void 0}function _5(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.includes(`…`)}function v5({name:e,detail:t,count:n,status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,cwd:s,sessionId:c,durationMs:l,startedAt:u}){let d=g5(t,s,c),f=d?s5(d):void 0,p=t&&_5(t)?t:void 0;return(0,V.jsx)(`div`,{className:`frizz-bash`,title:d,children:(0,V.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(p5,{status:r,backgroundState:i,liveBackgroundState:a,startedAt:u}),(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:o5(e)}),f&&(p?(0,V.jsx)(`span`,{className:`min-w-0 truncate`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(H$,{path:p,className:`text-[11.5px] text-muted`,children:f})}):(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:f}))]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(m5,{status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,durationMs:l}),n>1&&(0,V.jsxs)(`span`,{className:`tabular-nums text-[11px] text-muted/45`,children:[`×`,n]})]})]})})}function y5({name:e,detail:t,outputImage:n,output:r,status:i,durationMs:a}){let o=t?s5(t):void 0,s=(0,V.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:o5(e)}),o&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,title:t,children:o})]}),(0,V.jsx)(`span`,{className:`flex shrink-0 items-center gap-2`,children:(0,V.jsx)(m5,{status:i,durationMs:a})})]});return(0,V.jsxs)(`div`,{children:[(0,V.jsx)(I5,{path:n,hideCaption:!0,altText:o?`${o5(e)}: ${o}`:o5(e),header:s}),r&&(0,V.jsx)(`pre`,{className:`frizz-bash frizz-bash-body frizz-bash-output-body mt-1.5`,children:r})]})}function b5({images:e,files:t,caption:n,status:r,durationMs:i}){let[a,o]=(0,B.useState)(!0),s=(0,B.useId)(),c=[e.length?`${e.length} image${e.length===1?``:`s`}`:``,t.length?`${t.length} file${t.length===1?``:`s`}`:``].filter(Boolean).join(` · `);return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.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${c?`: ${c}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Sent to you`}),c&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:c})]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(m5,{status:r,durationMs:i}),(0,V.jsx)(PC,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${a?`rotate-90`:``}`})]})]}),(0,V.jsx)(`div`,{id:s,hidden:!a,children:a&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5 px-2.5 pb-2.5 pt-1.5`,children:[e.map((e,t)=>(0,V.jsx)(I5,{path:e,hideCaption:!0,altText:n??`delivered image`},`i${t}`)),t.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map((e,t)=>(0,V.jsx)(L5,{path:e},`f${t}`))}),n&&(0,V.jsx)(`div`,{className:`max-w-[65%] text-[12px] leading-snug text-muted`,children:n})]})})]})}var x5=16;function S5({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,B.useState)(!1),[m,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(!1),v=(0,B.useId)(),y=h5(i,d,l),b=(0,B.useMemo)(()=>e.split(`
486
+ `).length,[e]),x=b>x5,S=(0,B.useMemo)(()=>n?n.split(`
487
+ `).length:0,[n]),C=S>x5,w=g5(t,void 0,c),T=!!(e||n);return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.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`} `:``}${o5(r)}${w?`: ${w}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(p5,{status:i,backgroundState:a,liveBackgroundState:o,startedAt:d}),(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:o5(r)}),(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,title:w,children:w??``})]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(m5,{status:i,backgroundState:a,liveBackgroundState:o,exitCode:s,durationMs:y}),T&&(0,V.jsx)(PC,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${f?`rotate-90`:``}`})]})]}),T&&(0,V.jsxs)(`div`,{id:v,hidden:!f,children:[f&&e&&(0,V.jsxs)(V.Fragment,{children:[u&&(0,V.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:u}),(0,V.jsx)(h1,{text:e,language:u?`plaintext`:`bash`,className:`frizz-bash-body${u?` frizz-bash-output-body`:``}${x&&!m?` frizz-bash-clamp`:``}`}),x&&(0,V.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,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:`output`}),(0,V.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body${C&&!g?` frizz-bash-clamp`:``}`,children:n}),C&&(0,V.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 C5=16;function w5({detail:e,read:t,status:n,durationMs:r}){let[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),c=(0,B.useId)(),l=(0,B.useMemo)(()=>t.split(`
488
+ `).length,[t]),u=l>C5,d=e?s5(e):void 0,f=e&&_5(e)?e:void 0;return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.jsxs)(V$,{className:`frizz-bash-header`,controls:c,expanded:i,label:`${i?`Collapse`:`Expand`} Read${e?`: ${e}`:``}`,onToggle:()=>a(e=>!e),meta:(0,V.jsx)(m5,{status:n,durationMs:r}),children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Read`}),d&&(f?(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,V.jsx)(H$,{path:f,className:`text-[11.5px] text-muted`,children:d})}):(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:d}))]}),(0,V.jsx)(`div`,{id:c,hidden:!i,children:i&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(h1,{text:t,language:_Q(e),className:`frizz-bash-body${u&&!o?` frizz-bash-clamp`:``}`}),u&&(0,V.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 T5=16;function E5({detail:e,prompt:t,input:n,subagentType:r,agentId:i,agentStatus:a,agentElapsedMs:o,status:s,durationMs:c,output:l}){let[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(!1),m=(0,B.useId)(),h=t??n,g=(0,B.useMemo)(()=>h?h.split(`
489
+ `).length:0,[h]),_=g>T5,v=S8(),y=$A(),b=v?iC(y,v):void 0,x=!a&&i?(b?.subAgents??[]).find(e=>e.id===i):void 0,S=x?.state===`running`,C=!!(v&&i),w=e??`sub-agent`,T=FM(),E=M4({agentStatus:a,agentElapsedMs:o,liveState:x?.state,liveElapsedMs:x?.startedAt?Math.max(T-Date.parse(x.startedAt),0):void 0,status:s,durationMs:c}),D=S?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--agent`,"data-running-indicator":`subagent-disclosure`}):x?.state===`stale`?(0,V.jsx)(`span`,{className:eN,title:tN}):x?.state===`rested`?(0,V.jsx)(`span`,{className:nN,title:rN}):null;function O(){!v||!i||VS(v,i,{label:w,subagentType:r,startedAt:x?.startedAt})}return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.jsxs)(V$,{className:`frizz-bash-header`,controls:m,expanded:u,label:`${u?`Collapse`:`Expand`} Agent dispatch: ${w}`,onToggle:()=>d(e=>!e),meta:E&&(0,V.jsx)(d5,{tone:E.tone===`failed`?`frizz-tool-failed`:`text-muted/55`,title:E.title,label:E.label,duration:E.duration}),children:[D&&(0,V.jsx)(`span`,{className:`frizz-tool-mark -mr-1 flex w-[9px] shrink-0 justify-center`,children:D}),(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Agent`}),C?(0,V.jsx)(`button`,{type:`button`,"aria-label":`Open sub-agent transcript: ${w}`,title:r?`Open sub-agent transcript — ${r}`:`Open sub-agent transcript`,onClick:O,className:`min-w-[4rem] flex-1 truncate text-left text-[11.5px] text-muted outline-none hover:underline hover:text-fg/80 focus-visible:underline focus-visible:text-fg/80`,children:w}):(0,V.jsx)(`span`,{className:`min-w-[4rem] flex-1 truncate text-[11.5px] text-muted`,title:r,children:w})]}),(0,V.jsx)(`div`,{id:m,hidden:!u,children:u&&(0,V.jsxs)(V.Fragment,{children:[h&&(0,V.jsx)(`pre`,{className:`frizz-bash-body${_&&!f?` frizz-bash-clamp`:``}`,children:h}),_&&(0,V.jsx)(`button`,{type:`button`,onClick:()=>p(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand petite-caps px-2.5 pb-1.5`,children:f?`Collapse`:`Show all ${g} lines`}),l&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:`output`}),(0,V.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body`,children:l})]})]})})]})}function D5(e,t){return t===`shutdown_request`?`Shutdown`:t===`codex_followup`?`Followed up`:e===`main`?`Reported`:`Steered`}function O5({to:e,summary:t,body:n,type:r,dispatchId:i,targetLabel:a,status:o,durationMs:s}){return(0,B.useContext)(b8)===null?(0,V.jsx)(A5,{to:e,summary:t,body:n,type:r,status:o,durationMs:s}):(0,V.jsx)($5,{to:e,type:r,dispatchId:i,targetLabel:a})}var k5=16;function A5({to:e,summary:t,body:n,type:r,status:i,durationMs:a}){let[o,s]=(0,B.useState)(!t),[c,l]=(0,B.useState)(!1),u=(0,B.useId)(),d=q$(s$(n)),f=(0,B.useMemo)(()=>n.split(`
490
+ `).length,[n]),p=f>k5,m=!!n.trim(),h=D5(e,r);return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":m?u:void 0,"aria-expanded":m?o:void 0,"aria-label":`${m?`${o?`Collapse`:`Expand`} `:``}${h}${e?` to ${e}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,disabled:!m,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:h}),t&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:t})]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(m5,{status:i,durationMs:a}),m&&(0,V.jsx)(PC,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${o?`rotate-90`:``}`})]})]}),m&&(0,V.jsx)(`div`,{id:u,hidden:!o,children:o&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`border-t border-border px-2.5 py-2${p&&!c?` frizz-bash-clamp`:``}`,children:(0,V.jsx)(`div`,{className:`md-body`,dangerouslySetInnerHTML:d})}),p&&(0,V.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand petite-caps px-2.5 pb-1.5`,children:c?`Collapse`:`Show all ${f} lines`})]})})]})}function j5({children:e,stickyTopPx:t,sourceId:n}){let r=t!==void 0;return(0,V.jsx)(`div`,{"data-transcript-source-id":n,"data-transcript-sticky":`true`,style:r?{"--sticky-user-top":`${t}px`}:void 0,className:`pointer-events-none [&>*]:pointer-events-auto sticky z-[9] flex flex-col pt-3 pb-1.5 ${r?`top-[var(--sticky-user-top)] max-[800px]:top-[calc(var(--sticky-user-top)_+_2.5rem)]`:`top-0`}`,children:e})}function M5({text:e,rawText:t,queued:n,sticky:r,deliveryUnconfirmed:i,deliveryId:a,sourceId:o}){let s=(0,B.useRef)(null),c=(0,B.useContext)(b8),l=t2(c),{unqueue:u,pending:d}=a2(c),f=!!(n&&a&&c&&l),p=o2(n?c:null),{deliverNow:m,pending:h}=s2(c),g=!!(n&&c&&p),{prose:_,attachments:v}=(0,B.useMemo)(()=>gH(e),[e]),[y,b]=(0,B.useState)(!1),[x,S]=(0,B.useState)(!1),[C,w]=(0,B.useState)(!1),[T,E]=(0,B.useState)(!1),[D,O]=(0,B.useState)(null),k=(0,B.useCallback)(()=>{let e=s.current;if(!r||!e){O(null),S(!1),w(!1);return}let t=Math.round((typeof window>`u`?800:window.innerHeight)*.85);S(e.scrollHeight>205),w(e.scrollHeight>t),O(y?`${Math.min(e.scrollHeight,t)}px`:`200px`)},[r,y]);(0,B.useLayoutEffect)(()=>{k()},[k,e]),(0,B.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>k();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[k]);let A=r===!0&&!y,j=r===!0&&y&&C&&T;return(0,V.jsxs)(`div`,{"data-frizz-msg":o,className:`self-end flex flex-col items-end gap-0.5 max-w-[85%]`,children:[_.trim()!==``&&(0,V.jsxs)(`div`,{className:`group relative`,children:[(0,V.jsxs)(`div`,{ref:s,...f?{role:`button`,tabIndex:0,"data-unqueue":a,"aria-label":`Unqueue this message and put it back in the prompt box`,title:d?`Taking it back…`:void 0,onClick:n=>u({deliveryId:a,text:e,rawText:t??e,from:n.currentTarget}),onKeyDown:n=>{n.key!==`Enter`&&n.key!==` `||(n.preventDefault(),u({deliveryId:a,text:e,rawText:t??e,from:n.currentTarget}))}}:{},onMouseEnter:r?()=>b(!0):void 0,onMouseLeave:r?()=>{b(!1),E(!1)}:void 0,onTransitionEnd:r?e=>{e.propertyName===`max-height`&&y&&C&&E(!0)}:void 0,style:{...D?{maxHeight:D}:{},...r&&C&&!j?{paddingRight:`calc(0.875rem + var(--sbw))`}:{}},className:`relative rounded-xl rounded-br-sm bg-user-bubble px-3.5 py-3 text-[14px] whitespace-pre-wrap [overflow-wrap:anywhere] text-bg ${n?`opacity-50`:``} ${f?`cursor-pointer transition-opacity group-hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg`:``} ${d?`!opacity-30`:``} ${r?`transition-[max-height] duration-200 ease-out ${j?`overflow-y-auto`:`overflow-hidden`}`:``}`,children:[(0,V.jsx)(R0,{text:_}),A&&x&&(0,V.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-user-bubble to-transparent`})]}),g&&(0,V.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:m,disabled:h,title:`Send now — interrupts what the worker is doing so it reads the queue immediately`,"aria-label":`Send now`,className:`absolute bottom-0 right-full mr-2 flex h-7 w-7 items-center justify-center rounded-lg text-muted opacity-0 outline-none transition-[opacity,color,background-color] group-hover:opacity-100 enabled:hover:bg-panel-2/70 enabled:hover:text-fg enabled:focus-visible:opacity-100 enabled:focus-visible:bg-panel-2/70 enabled:focus-visible:ring-1 enabled:focus-visible:ring-muted/80 enabled:focus-visible:ring-offset-1 enabled:focus-visible:ring-offset-bg enabled:active:bg-elevated`,children:h?(0,V.jsx)(cw,{size:15,strokeWidth:2.2,className:`animate-spin`}):(0,V.jsx)(DC,{size:15,strokeWidth:2.2})})]}),v.length>0&&(0,V.jsxs)(`div`,{className:`mt-1 flex flex-col items-end gap-1.5`,children:[v.filter(e=>e.kind===`image`).map((e,t)=>(0,V.jsx)(I5,{path:e.path,hideCaption:!0},`i${t}-${e.path}`)),v.some(e=>e.kind===`file`)&&(0,V.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1.5`,children:v.filter(e=>e.kind===`file`).map((e,t)=>(0,V.jsx)(L5,{path:e.path},`f${t}-${e.path}`))})]}),i&&(0,V.jsx)(`div`,{className:`text-[11px] text-amber-400/80`,children:`Delivery unconfirmed — no receipt from the worker`}),f&&d&&(0,V.jsx)(`div`,{"aria-hidden":!0,className:`h-0 overflow-visible text-[11px] text-muted`,children:`Taking it back…`})]})}var N5=(0,B.memo)(function({m:e,answering:t,dense:n,paired:r,sticky:i,textOnly:a,showSendButton:o,staleAwaiting:s}){let c=kY(),[l,u]=(0,B.useState)(!1);if(e.kind===`event`)return(0,V.jsx)(e7,{text:e.text,boundary:e.boundary,sourceId:e.sourceId});if(e.kind===`reasoning`)return(0,V.jsx)(t7,{text:e.text,sourceId:e.sourceId});let d=D4(e);if(d)return(0,V.jsx)(Z5,{call:d,sourceId:e.sourceId});if(e.role===`user`){let t=c2(e).replace(/\r\n?/g,`
491
+ `),a=r===void 0?X1(t):r;if(a)return(0,V.jsx)(P5,{answers:a,queued:e.queued,sourceId:e.sourceId});let o=e.wake?Wy(t):void 0;return o?(0,V.jsx)(j0,{bump:o,sourceId:e.sourceId}):e.wake?(0,V.jsx)(C0,{steer:e.wakeSteer,text:t,sourceId:e.sourceId,wrap:n}):e.peerFrom?(0,V.jsx)(Q5,{from:e.peerFrom,unnamed:e.peerUnnamed,dispatchId:e.peerDispatchId,sourceId:e.sourceId}):(0,V.jsx)(M5,{text:t,rawText:e.text,queued:e.queued,sticky:i,deliveryUnconfirmed:e.deliveryState===`unconfirmed`,deliveryId:e.deliveryId,sourceId:e.sourceId})}let f=[],p=[],m=(e,t=n5)=>{f.push(e),p.push(t)},h={n:-1},g=[],_=(r,i)=>{for(let[a,o]of W1(r).entries()){if(o.kind===`fence`){if(o.fenceKind===`awaiting`&&(e.fenceRefused||s))continue;m((0,V.jsx)(V5,{fenceKind:o.fenceKind,body:o.body,hints:o.hints,wrap:n},`${i}-f${a}`));continue}for(let[e,r]of w1(o.text).entries()){if(r.kind===`prose`){for(let[t,o]of hH(r.text).entries()){let r=`${i}-${a}-p${e}-${t}`;m(o.kind===`image`?(0,V.jsx)(I5,{path:o.path},r):o.kind===`file`?(0,V.jsx)(L5,{path:o.path},r):o.kind===`visualization`?(0,V.jsx)(B5,{file:o.file},r):o.kind===`directive`?(0,V.jsx)(g8,{directive:o.directive},r):o.kind===`mermaid`?(0,V.jsx)(y8,{source:o.source},r):(0,V.jsx)(F5,{md:o.text,wrap:n},r))}continue}h.n+=1;let o=h.n;t&&g.push({raw:r.text,kind:r.questionKind,danger:r.danger,bi:o});let s=t&&!c?{answer:t.answerFor(o),onChip:(e,n)=>t.onChip(o,e,n),onText:e=>t.onText(o,e),onSubmit:t.onSubmit}:void 0;m((0,V.jsx)(X0,{raw:r.text,questionKind:r.questionKind,danger:r.danger,interactive:s,wrap:n},`${i}-${a}-q${e}`))}}};if(e.parts&&e.parts.length>0)e5(e.parts).forEach((t,r)=>{if(t.kind===`tools`){if(a)return;let i=a5(t.tools);i.length&&m((0,V.jsx)(l5,{tools:i,dense:n,at:e.at},`t${r}`),i5(i))}else _(t.text,`x${r}`)});else{if(!a){let t=a5(e.tools);t.length>0&&m((0,V.jsx)(l5,{tools:t,dense:n,at:e.at},`tools`),i5(t))}_(e.text,`leg`)}return f.length===0?null:(o&&t&&c&&g.length>0?m((0,V.jsx)(`div`,{className:`flex justify-start`,children:(0,V.jsx)(`button`,{type:`button`,"data-mobile-answer-open":!0,onClick:()=>u(!0),className:`flex h-[40px] items-center justify-center rounded-[12px] bg-accent px-4 text-[15px] font-semibold text-bg active:brightness-90`,children:g.length>1?`Answer ${g.length} questions`:`Answer`})},`answer-open`)):o&&t&&m((0,V.jsx)(`div`,{className:`flex justify-start`,children:(0,V.jsx)(`button`,{type:`button`,"data-send-answers":!0,disabled:!t.anyAnswered||t.sending,onClick:t.onSubmit,onMouseDown:e=>e.preventDefault(),className:`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`})},`send-answers`)),(0,V.jsxs)(`div`,{"data-frizz-msg":e.sourceId,className:`flex flex-col text-[13px] min-w-0`,children:[t5(f,r5(p,14)),l&&t&&g.length>0?(0,V.jsx)(e2,{blocks:g,answering:t,onClose:()=>u(!1)}):null]}))});function P5({answers:e,queued:t,sourceId:n}){return(0,V.jsx)(`div`,{"data-frizz-msg":n,"data-answers-card":!0,className:`self-end flex w-full max-w-[85%] flex-col items-end ${t?`opacity-50`:``}`,children:(0,V.jsxs)(`div`,{className:`w-full min-w-0 ${i0} rounded-br-sm border border-border-strong bg-elevated p-4`,children:[(0,V.jsx)(l0,{icon:sw,label:`Answers`}),(0,V.jsx)(u0,{children:(0,V.jsx)(`div`,{className:`flex flex-col gap-2.5`,children:e.map((e,t)=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.question&&(0,V.jsx)(`div`,{title:e.question,className:`line-clamp-2 min-w-0 text-[11px] leading-snug text-muted`,children:e.question}),(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!e.question&&(0,V.jsx)(`span`,{className:`mt-1.5 shrink-0 text-[10px] uppercase tabular-nums tracking-wide text-muted/70`,children:e.n}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap [overflow-wrap:anywhere] rounded-md border border-border-strong border-l-2 border-l-accent/40 bg-bg/50 px-2.5 py-1.5 text-[12px] leading-snug text-fg`,children:(0,V.jsx)(R0,{text:e.answer})})]})]},t))})})]})})}function F5({md:e,wrap:t}){let n=s$(e),r=q$(n),i=(0,B.useRef)(null);return a1(i,n),n?(0,V.jsx)(`div`,{ref:i,className:`md-body${t?` ${r0}`:``}`,dangerouslySetInnerHTML:r}):null}function I5({path:e,hideCaption:t,altText:n,header:r}){let[i,a]=(0,B.useState)(!1);if(i)return(0,V.jsx)(`div`,{className:`font-mono-keep text-[12px] text-muted/70 break-all`,children:e});let o=e.split(`/`).filter(Boolean).pop()||e;return(0,V.jsx)(EQ,{header:r,caption:t?void 0:(0,V.jsx)(`figcaption`,{className:`bg-panel-2 px-2 pb-1.5 font-mono-keep text-[11px] text-muted/60 break-all`,children:o}),children:(0,V.jsx)(`img`,{src:RH(e),alt:n??o,"data-local-path":e,"data-local-image":`true`,onError:()=>a(!0),className:`cursor-pointer ${kQ}`})})}function L5({path:e}){let t=e.split(`/`).filter(Boolean).pop()||e;return(0,V.jsxs)(`button`,{type:`button`,className:`local-file-action inline-flex max-w-full items-center gap-1.5 ${i0} border border-border bg-panel-2 px-3 py-1.5 text-left align-top no-underline hover:border-accent`,"data-local-path":e,title:e,children:[(0,V.jsx)(qC,{size:14,strokeWidth:2,className:`shrink-0 text-muted`}),(0,V.jsx)(`span`,{className:`font-mono-keep truncate text-[12px] text-fg`,children:t})]})}var R5={"--background":`--color-bg`,"--foreground":`--color-fg`,"--card":`--color-panel-2`,"--card-foreground":`--color-fg`,"--popover":`--color-elevated`,"--popover-foreground":`--color-fg`,"--primary":`--color-fg`,"--primary-foreground":`--color-bg`,"--secondary":`--color-panel-2`,"--secondary-foreground":`--color-fg`,"--muted":`--color-panel-2`,"--muted-foreground":`--color-muted`,"--accent":`--color-border-strong`,"--accent-foreground":`--color-fg`,"--border":`--color-border-strong`,"--input":`--color-border-strong`,"--ring":`--color-accent`};function z5(){let e=getComputedStyle(document.documentElement),t=Object.fromEntries(Object.entries(R5).map(([t,n])=>[t,e.getPropertyValue(n).trim()]));return t[`--font-size-base`]=getComputedStyle(document.body).fontSize,{type:`frizz-inline-vis-theme`,colorScheme:e.colorScheme===`light`?`light`:`dark`,vars:t}}function B5({file:e}){let t=(0,B.useContext)(b8),n=(0,B.useRef)(null),[r,i]=(0,B.useState)(360),[a,o]=(0,B.useState)(null),s=t?`${Tx()}/local-visualization?slug=${encodeURIComponent(t)}&file=${encodeURIComponent(e)}`:null;return(0,B.useEffect)(()=>{if(!s){o(!1);return}let e=new AbortController;return o(null),fetch(s,{method:`HEAD`,signal:e.signal}).then(t=>{e.signal.aborted||o(t.ok)}).catch(()=>{e.signal.aborted||o(!1)}),()=>e.abort()},[s]),(0,B.useEffect)(()=>{let e=e=>{if(e.source!==n.current?.contentWindow||e.data?.type!==`frizz-inline-vis-height`)return;let t=Number(e.data.height);Number.isFinite(t)&&i(Math.max(80,Math.min(2400,Math.ceil(t))))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[]),a===!1||!s?(0,V.jsxs)(`div`,{role:`status`,className:`${i0} border border-border bg-panel-2 px-4 py-2.5 text-[12px] text-muted`,children:[`Visualization unavailable: `,(0,V.jsx)(`span`,{className:`font-mono-keep break-all`,children:e})]}):a===null?(0,V.jsx)(`div`,{role:`status`,className:`h-20 animate-pulse ${i0} bg-panel-2`,"aria-label":`Loading ${e}`}):(0,V.jsx)(`iframe`,{ref:n,src:s,title:e.replace(/\.html$/,``).replaceAll(`-`,` `),sandbox:`allow-scripts`,onLoad:()=>n.current?.contentWindow?.postMessage(z5(),`*`),className:`block w-full border-0 bg-transparent`,style:{height:r}})}function V5({fenceKind:e,body:t,hints:n,wrap:r}){let i=s$(t),a=s$(dJ(t)),o=hJ(n),s=gJ(n),c=(0,B.useContext)(b8),l=(0,B.useContext)(C8),u=$A(),d=c?iC(u,c):void 0,f=d?U2(d):void 0,p=!!(d&&f?.archive),m=(0,B.useRef)(null);p&&d&&(m.current=d);let h=p&&d?d:m.current;if(e===`done`)return(0,V.jsxs)(d0,{icon:jC,label:`Done`,children:[i&&(0,V.jsx)(o1,{className:`md-body${r?` [overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`:``}`,html:i}),h&&(0,V.jsx)(p0,{children:(0,V.jsx)(T4,{thread:h,className:`rounded-md text-[11px] bg-fg px-2.5 py-1 text-bg hover:opacity-90`,iconClassName:`icon-label-nudge`,onArchived:l?.dismiss,onDismissCancel:l?.cancel})})]});let g=iJ(n),_=g?.title??`Awaiting`,v=n.some(e=>e.kind===`pr`)?gw:tw,y=aJ(n);return g===null&&d!=null&&o6(d)?null:(0,V.jsxs)(d0,{"data-awaiting-fence":!0,icon:v,label:_,aside:y.length===1?(0,V.jsx)(H5,{watch:y[0]}):void 0,children:[(0,V.jsx)(o1,{className:`md-body${r?` ${r0}`:``}`,html:a}),(o.length>0||s)&&(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[12px] text-muted`,children:[o.map((e,t)=>(0,V.jsx)(`span`,{children:e},`${t}-${e}`)),s&&(0,V.jsx)(`span`,{className:`text-muted/70`,children:s})]}),y.length>1&&(0,V.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:y.map(e=>(0,V.jsx)(H5,{watch:e},e.ref))}),p&&d&&(0,V.jsx)(U5,{thread:d,hints:n})]})}function H5({watch:e}){return(0,B.useEffect)(()=>{e.url&&_S([e.ref])},[e.url,e.ref]),e.url?(0,V.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,"data-gh-ref":e.ref,className:`${h0} text-[12px]`,children:e.ref}):(0,V.jsx)(`span`,{className:`text-[12px] text-muted`,children:e.ref})}function U5({thread:e,hints:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useContext)(C8),a=iJ(t);return a?(0,V.jsxs)(p0,{children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=a.timerUntil??Ej(zj.snoozePreset);r(!0),X.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:t}).then(()=>{Q(`${a.toastVerb} · ${kj(t)}`),i?.dismiss()}).catch(e=>Q(`Couldn’t snooze: ${e.message.slice(0,80)}`)).finally(()=>r(!1))},disabled:n,"aria-label":rJ,title:a.explainer,onMouseDown:e=>e.preventDefault(),className:`whitespace-nowrap disabled:opacity-45 ${g0}`,children:[n&&(0,V.jsx)(cw,{size:11,className:`animate-spin`}),rJ]}),(0,V.jsx)(`span`,{className:m0,children:a.explainer})]}):null}function W5({slug:e,sessionId:t,fault:n,retryText:r}){let[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),c=Md(),l=CU[n.backend],u=t=>{s(!0),$q(c,e,t,{onSuccess:()=>{s(!1),Q(`Retrying with the previous message…`)},onRollback:()=>s(!1),failureToast:e=>`Retry failed: ${e.slice(0,80)}`})||s(!1)};return(0,V.jsxs)(d0,{"data-provider-fault":!0,tone:`danger`,icon:aw,label:`${l} sign-in required`,children:[(0,V.jsx)(`span`,{className:f0,children:`The provider rejected this session's credential. Sign in, then retry.`}),(0,V.jsxs)(p0,{children:[r?.trim()&&(0,V.jsx)(`button`,{onClick:()=>u(r),disabled:o,onMouseDown:e=>e.preventDefault(),className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel hover:border-border-strong disabled:opacity-60`,children:`Retry`}),(0,V.jsx)(`button`,{onClick:()=>a(!0),onMouseDown:e=>e.preventDefault(),className:g0,children:`Sign in`})]}),i&&(0,V.jsx)(EU,{backend:n.backend,onClose:()=>a(!1),onAuthed:()=>a(!1)})]})}function G5(e){let t=new Date(e*1e3),n=t.toDateString()===new Date().toDateString(),r=t.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`});return n?r:`${t.toLocaleDateString([],{weekday:`short`})} ${r}`}function K5({slug:e,sessionId:t,pause:n}){let r=CU[n.backend],i=n.window===`weekly`?`weekly limit`:n.window===`session`?`session limit`:`usage limit`,[a,o]=(0,B.useState)(!1),s=Md();return(0,V.jsxs)(d0,{"data-limit-pause":!0,tone:`caution`,icon:tw,label:`Paused by the ${r} ${i}`,children:[(0,V.jsx)(`span`,{className:f0,children:n.autoResume?n.resumesAt?`Continuing automatically at ${G5(n.resumesAt)}.`:`Continuing automatically once the window resets.`:`Continue it whenever you have capacity again.`}),(0,V.jsx)(p0,{children:(0,V.jsx)(`button`,{onClick:()=>{o(!0),$q(s,e,`Continue exactly where you left off.`,{onSuccess:()=>{o(!1),Q(`Continuing…`)},onRollback:()=>o(!1),failureToast:e=>`Continue failed: ${e.slice(0,80)}`})||o(!1)},disabled:a,onMouseDown:e=>e.preventDefault(),className:`disabled:opacity-45 ${g0}`,children:`Continue now`})})]})}function q5({onTerminal:e}){return(0,V.jsxs)(d0,{tone:`attention`,icon:aw,label:`Permission approval`,children:[(0,V.jsx)(`span`,{className:f0,children:`The agent is waiting on your approval — respond in your external terminal.`}),(0,V.jsx)(p0,{children:(0,V.jsx)(`button`,{onClick:()=>e(),onMouseDown:e=>e.preventDefault(),className:g0,children:`Copy terminal command`})})]})}function J5({policy:e,denies:t}){let n=[e.tool,e.command].filter(Boolean).join(`: `);return(0,V.jsxs)(d0,{tone:`caution`,icon:kw,label:`Blocked by frizz's permission policy`,children:[n?(0,V.jsx)(`code`,{className:`mb-1.5 block min-w-0 break-all rounded bg-panel px-1.5 py-1 text-[11px] text-fg/85`,children:n}):null,(0,V.jsx)(`span`,{className:f0,children:e.reason}),(0,V.jsxs)(`span`,{className:`mt-1.5 block text-[11px] text-muted`,children:[`Rule `,(0,V.jsx)(`code`,{className:`rounded bg-panel px-1 py-0.5`,children:e.rule}),t&&t>1?` · ${t} denials this session`:``]})]})}function Y5({slug:e,className:t=`px-4 pb-2 pt-1`,includeAgents:n=!0,transcriptShells:r=[],parentAgentId:i}){let a=iC($A(),e),o=a?.subAgents??[],s=n?i?dN(o,i):o:[],c=i?[...r]:hN(a?.bgShells??[],r),l=i?[]:(a?.watches??[]).filter(e=>e.kind===`github`),u=s.length+c.length+l.length,d=new Set((a?.watches??[]).filter(e=>e.kind===`shell`&&e.state===`armed`).map(e=>e.target)),f=e=>d.has(e.taskId??``)||d.has(e.id??``)||d.has(e.label),[,p]=(0,B.useState)(0);(0,B.useEffect)(()=>{if(u===0)return;let e=setInterval(()=>p(e=>e+1),3e4);return()=>clearInterval(e)},[u]);let m=fj(e,c.flatMap(e=>e.id&&!e.outputUnavailable?[e.id]:[]));return u===0?null:(0,V.jsxs)(`div`,{className:`flex flex-col gap-0.5 ${t}`,"data-background-ops":!0,children:[pN(s,`sheet`).map((t,n)=>(0,V.jsx)(gN,{kind:`AGENT`,label:t.label,state:t.state,density:`sheet`,depth:t.displayDepth??t.depth,startedAt:t.startedAt,onOpen:t.id?()=>VS(e,t.id,{label:t.label,subagentType:t.subagentType,startedAt:t.startedAt}):void 0,onDismiss:vN(e,t)},`a${n}`)),pN(c,`sheet`).map((t,n)=>(0,V.jsx)(gN,{kind:`SHELL`,label:t.label,state:t.state,density:`sheet`,startedAt:t.startedAt,counter:t.id?oN(m.get(t.id)):void 0,counterTitle:`Lines of output so far — open the row to read them`,onOpen:t.id&&!t.outputUnavailable?()=>HS(e,t.id,{label:t.label,startedAt:t.startedAt}):void 0,onDismiss:vN(e,t,`SHELL`),title:f(t)?`${t.label}\nWatched — this thread wakes when it finishes`:void 0},`s${n}`)),l.map(e=>(0,V.jsx)(gN,{kind:`GITHUB`,label:e.target,state:`running`,density:`sheet`,startedAt:e.createdAt,onOpen:()=>window.open(nJ(e.target)??`https://github.com/${e.target.replace(`#`,`/pull/`)}`,`_blank`,`noreferrer,noopener`)},e.id))]})}function X5({ask:e,onTerminal:t}){return(0,V.jsxs)(d0,{tone:`attention`,icon:BC,label:`Waiting on your answer — in your external terminal`,children:[(0,V.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e.header&&(0,V.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-muted/55`,children:e.header}),(0,V.jsx)(`div`,{className:`min-w-0 text-[12px] font-medium leading-5 text-fg`,children:e.question}),e.options.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.options.map((e,t)=>(0,V.jsxs)(`div`,{className:`rounded-md border border-border bg-elevated px-3 py-1.5 text-[12px] text-fg/80`,children:[(0,V.jsx)(`span`,{className:`font-medium text-fg/90`,children:e.label}),e.description&&(0,V.jsxs)(`span`,{className:`text-muted/70`,children:[` — `,e.description]})]},t)),e.multiSelect&&(0,V.jsx)(`div`,{className:`text-[10px] text-muted/50`,children:`select one or more`})]})]},t))}),(0,V.jsx)(p0,{children:(0,V.jsxs)(`button`,{onClick:()=>t(),onMouseDown:e=>e.preventDefault(),className:g0,children:[(0,V.jsx)(aw,{size:12,className:`shrink-0 ${u2}`}),`Copy terminal command`]})})]})}function Z5({call:e,sourceId:t}){let n=S8(),r=e.detail??`sub-agent`,{tail:i}=k4(e),a=!!(n&&e.agentId);return(0,V.jsxs)(v0,{icon:kC,sourceId:t,marker:`agent`,ariaLabel:a?void 0:`Sub-agent ${r} ${i}`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`Sub-agent`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`«`}),a?(0,V.jsx)(`button`,{type:`button`,"data-subagent-completion-open":!0,title:aN.AGENT,"aria-label":`${aN.AGENT}: ${r}`,onClick:()=>VS(n,e.agentId,{label:r,subagentType:e.subagentType}),onMouseDown:e=>e.preventDefault(),className:`min-w-0 truncate rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:r}):(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`»`})]}),(0,V.jsx)(`span`,{className:`shrink-0`,children:i})]})}function Q5({from:e,unnamed:t,dispatchId:n,sourceId:r}){let i=S8(),a=!!(i&&n),o=t?void 0:e,s=t&&e?`${aN.AGENT} — ${e}`:aN.AGENT;return o===void 0?(0,V.jsx)(v0,{icon:kC,sourceId:r,marker:`agent-report`,ariaLabel:a?void 0:`Sub-agent reported`,children:a?(0,V.jsx)(`button`,{type:`button`,"data-subagent-report-open":!0,title:s,"aria-label":`${aN.AGENT}${e?`: ${e}`:``}`,onClick:()=>VS(i,n,{label:`Sub-agent`,subagentType:e}),onMouseDown:e=>e.preventDefault(),className:`shrink-0 rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:`Sub-agent reported`}):(0,V.jsx)(`span`,{className:`shrink-0`,title:e||void 0,children:`Sub-agent reported`})}):(0,V.jsxs)(v0,{icon:kC,sourceId:r,marker:`agent-report`,ariaLabel:a?void 0:`Sub-agent ${o} reported`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`Sub-agent`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`«`}),a?(0,V.jsx)(`button`,{type:`button`,"data-subagent-report-open":!0,title:aN.AGENT,"aria-label":`${aN.AGENT}: ${o}`,onClick:()=>VS(i,n,{label:o,subagentType:e}),onMouseDown:e=>e.preventDefault(),className:`min-w-0 truncate rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:o}):(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:o}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`»`})]}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`reported`})]})}function $5({to:e,type:t,dispatchId:n,targetLabel:r,sourceId:i}){let a=S8(),o=D5(e,t),s=e===`main`?void 0:r??e,c=!!(a&&n);return(0,V.jsxs)(v0,{icon:kC,sourceId:i,marker:`agent-steer`,ariaLabel:c?void 0:`${o}${s?` ${s}`:``}`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:o}),s&&(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`«`}),c?(0,V.jsx)(`button`,{type:`button`,"data-subagent-steer-open":!0,title:aN.AGENT,"aria-label":`${aN.AGENT}: ${s}`,onClick:()=>VS(a,n,{label:s}),onMouseDown:e=>e.preventDefault(),className:`min-w-0 truncate rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:s}):(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:s}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`»`})]})]})}function e7({text:e,boundary:t,sourceId:n}){return t?(0,V.jsx)(v0,{icon:t===`wake`?Ew:void 0,sourceId:n,marker:t===`rest`?`rest`:`event`,ariaLabel:e,children:e}):(0,V.jsx)(`div`,{"data-frizz-msg":n,className:N4,children:e})}function t7({text:e,sourceId:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useId)();return(0,V.jsxs)(`div`,{"data-frizz-msg":t,className:`flex flex-col`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":i,"aria-expanded":n,"aria-label":`${n?`Collapse`:`Expand`} model reasoning`,className:`${N4} flex items-baseline gap-1.5 self-start rounded outline-none transition-colors hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:[(0,V.jsx)(`span`,{children:`Reasoning`}),(0,V.jsx)(PC,{"aria-hidden":`true`,size:13,className:F4(n)})]}),n&&(0,V.jsx)(`div`,{id:i,className:`frizz-reasoning mt-1.5 ml-[5px] border-l border-border/70 pl-3`,children:(0,V.jsx)(F5,{md:e,wrap:!0})})]})}function n7(){return(0,V.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-full border border-muted/70 border-t-transparent animate-spin`})}function r7({since:e,startedAt:t,activityLabel:n,run:r}){let[i]=(0,B.useState)(()=>Date.now()),a=(0,B.useMemo)(()=>{for(let n of[t,e]){let e=Date.parse(n??``);if(Number.isFinite(e)&&e<=Date.now())return e}return i},[t,e,i]),[o,s]=(0,B.useState)(()=>Date.now()),[c,l]=(0,B.useState)(!1),u=(0,B.useId)();(0,B.useEffect)(()=>{let e=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(e)},[]);let d=qM(Math.max(0,o-a)),f=(0,B.useMemo)(()=>a5([...r?.tools??[]]),[r]),p=f.reduce((e,t)=>e+t.count,0),m=p>0,h=`group flex min-w-0 items-baseline justify-between gap-3 rounded text-left outline-none focus-visible:ring-1 focus-visible:ring-fg/60 ${N4}`,g=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate shimmer-text`,children:n??n8(p)}),m&&(0,V.jsx)(PC,{"data-working-chevron":!0,"aria-hidden":`true`,size:13,className:F4(c)})]}),(0,V.jsx)(`span`,{className:`shrink-0 whitespace-nowrap tabular-nums text-[12px] text-muted/60`,children:d})]});return(0,V.jsxs)(`div`,{"data-working-indicator":!0,"data-working-activity":n?`tool`:`generic`,className:`flex min-w-0 flex-col`,children:[m?(0,V.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":u,"aria-expanded":c,"aria-label":`${c?`Collapse`:`Expand`} ${p} tool ${p===1?`call`:`calls`}${n?`: ${n}`:``}`,className:`${h} w-full`,children:g}):(0,V.jsx)(`div`,{className:h,children:g}),m&&c&&(0,V.jsx)(`div`,{id:u,className:`mt-1.5 flex flex-col`,children:t5(f.map((e,t)=>(0,V.jsx)(u5,{t:e,startedAt:r?.at},t)),6)}),m&&!c&&(0,V.jsx)(`div`,{id:u,hidden:!0})]})}function i7(){let[e,t]=(0,B.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: 800px)`).matches);return(0,B.useEffect)(()=>{let e=window.matchMedia(`(max-width: 800px)`),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function a7({id:e,slug:t,depth:n,widthDepth:r,initiallyOpen:i}){let{shown:a,close:o,closingRef:s}=lC(e,i===!0),[c,l]=(0,B.useState)(i===!0),u=(0,B.useRef)(null),d=(0,B.useRef)(null),f=[...Hf(Z).drawers].reverse().find(e=>!e.closing)?.id===e,p=i7(),m=(0,B.useRef)(typeof document<`u`&&document.activeElement instanceof HTMLElement?document.activeElement:null),h=(0,B.useCallback)(()=>{let e=m.current,t=document.activeElement;t&&t!==document.body||e?.isConnected&&e.focus({preventScroll:!0})},[]);(0,B.useEffect)(()=>()=>{window.setTimeout(h,0)},[h]);let g=$A(),_=gx(g,t),v=_.kind===`found`?_.thread:void 0;g?.projectDir;let y=v?v.runtime===`turn-idle`||v.runtime===`exited`||v.runtime===`none`:!1;return(0,B.useEffect)(()=>{!v||!y||X.threadSeen({slug:t}).catch(()=>{})},[t,y,y?v?.lastActivityAt:void 0]),(0,B.useEffect)(()=>{let t=u.current;if(!t||!c)return;let n=()=>t.querySelector(`[data-drawer-scroll-ready]`),r=()=>t.querySelector(`[data-drawer-transcript-scroll]`),i=new jY({isActive:()=>[...Z.drawers].reverse().find(e=>!e.closing)?.id===e,isContentReady:()=>n()?.dataset.drawerScrollReady===`true`,scrollToBottom:()=>{let e=r();return e?(e.scrollTop=e.scrollHeight,!0):!1},preserveAnchor:()=>location.hash.length>1});d.current=i;let a=null,o=new ResizeObserver(()=>i.layoutChanged()),s=()=>{let e=n();e!==a&&(a&&o.unobserve(a),a=e,e&&o.observe(e)),i.layoutChanged()},l=new MutationObserver(s);l.observe(t,{attributes:!0,attributeFilter:[`data-drawer-scroll-ready`],childList:!0,subtree:!0});let f=()=>i.userIntent(),p=e=>{[`Shift`,`Control`,`Alt`,`Meta`].includes(e.key)||f()};return t.addEventListener(`wheel`,f,{capture:!0,passive:!0}),t.addEventListener(`touchstart`,f,{capture:!0,passive:!0}),t.addEventListener(`pointerdown`,f,!0),t.addEventListener(`keydown`,p,!0),s(),()=>{i.dispose(),d.current===i&&(d.current=null),t.removeEventListener(`wheel`,f,!0),t.removeEventListener(`touchstart`,f,!0),t.removeEventListener(`pointerdown`,f,!0),t.removeEventListener(`keydown`,p,!0),o.disconnect(),l.disconnect()}},[c,e]),(0,B.useEffect)(()=>{d.current?.activationChanged()},[f]),(0,B.useEffect)(()=>{if(i)return;let e=!1,t=()=>{e||s.current||(e=!0,l(!0))},n=0,r=requestAnimationFrame(()=>{n=requestAnimationFrame(t)}),a=window.setTimeout(t,120);return()=>{window.clearTimeout(a),cancelAnimationFrame(r),n&&cancelAnimationFrame(n)}},[i]),(0,B.useEffect)(()=>{let e=u.current;if(!c||!e||document.activeElement!==e)return;let t=requestAnimationFrame(()=>{e.querySelector(`[data-dialog-initial-focus]`)?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(t)},[c]),(0,B.useEffect)(()=>(lx(e,()=>{(u.current?.querySelector(`[data-dialog-initial-focus]`)??u.current)?.focus({preventScroll:!0})}),()=>lx(e,null)),[e]),(0,V.jsx)(FV,{modal:p,open:!0,onOpenChange:e=>{e||o()},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`${aC} ${a?`opacity-100`:`opacity-0`}`,style:{zIndex:50+n*2}}),(0,V.jsxs)(qV,{ref:u,"aria-modal":p||void 0,"aria-describedby":void 0,tabIndex:-1,onEscapeKeyDown:_U,onPointerDownOutside:n=>{let r=Z.drawers.findIndex(t=>t.id===e);if(r!==-1&&r<Z.drawers.length-1){n.preventDefault();return}(n.target instanceof Element?n.target.closest(`[data-subagent-parent]`):null)?.getAttribute(`data-subagent-parent`)===t&&n.preventDefault()},onFocusOutside:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),h()},onOpenAutoFocus:e=>{e.preventDefault();let t=u.current;(t?.querySelector(`[data-dialog-initial-focus]`)??t)?.focus({preventScroll:!0})},className:`fixed right-0 top-0 overflow-hidden outline-none ${oC} ${a?`translate-x-0`:`translate-x-full`}`,style:{zIndex:51+n*2,width:sC(r)},children:[(0,V.jsx)(QV,{className:`sr-only`,children:_.kind===`found`?`Thread: ${Uj(_.thread)}`:`Thread: ${t}`}),c&&_.kind===`found`?(0,V.jsx)(D8,{slug:t,onStatusApplied:o,onClose:o,virtualized:!0}):c&&_.kind===`missing`?(0,V.jsx)(o7,{slug:t,onClose:o}):(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,V.jsx)(`span`,{className:`block h-5 w-5 rounded-full border-2 border-muted/50 border-t-transparent animate-spin`})})]})]})})}function o7({slug:e,onClose:t}){return(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,V.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-border bg-panel px-4`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:`Thread unavailable`}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Close`,"data-dialog-initial-focus":!0,onClick:t,className:`p-1 text-muted hover:text-fg`,children:`×`})]}),(0,V.jsxs)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-muted`,role:`status`,children:[`Thread “`,e,`” was not found in this project.`]})]})}var s7=new Set([`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]);function c7(e,t){let n=e.lastIndexOf(t);if(n<=0)return{model:e};let r=e.slice(n+1);return s7.has(r)?{model:e.slice(0,n),effort:r}:{model:e}}function l7(e){let t=e?.trim();if(!t)return`Profile unknown`;if(t.startsWith(`frizz:`)){let{model:e,effort:n}=c7(t.slice(6).replace(/^frizz-/,``),`-`);return n?`${e} › ${n}`:e}let n=t.split(/\s+/),{model:r,effort:i}=c7(n.at(-1)??t,`/`);if(!i)return t;let a=n.slice(0,-1).join(` `);return`${a?`${a} · `:``}${r} › ${i}`}function u7({id:e,slug:t,subId:n,label:r,subagentType:i,startedAt:a,depth:o,widthDepth:s}){let[c,l]=(0,B.useState)(!1),u=(0,B.useRef)(null),d=uj(t,n),f=ej(),p=(0,B.useMemo)(()=>d.data?.messages??[],[d.data]),m=d.data?.state,h=m===`running`,g=(0,B.useMemo)(()=>T8(p),[p]),_=(0,B.useMemo)(()=>E8(p),[p]),v=(0,B.useMemo)(()=>z6(_),[_]),y=h?H6(v):void 0,b=h?V6(v):void 0,x=b?Z6(b,f):void 0,S=h?W6(v):void 0,C=(0,B.useMemo)(()=>h?K6(v):v,[v,h]),w=h,T=d.isError||m===`gone`||p.length===0&&(m===`done`||m===`stale`);return(0,B.useEffect)(()=>{let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>l(!0))});return()=>{cancelAnimationFrame(t),e&&cancelAnimationFrame(e)}},[]),(0,B.useEffect)(()=>{let e=u.current;if(!e||!c)return;let t=!0,n=()=>{t&&(e.scrollTop=e.scrollHeight)},r=()=>{t=e.scrollHeight-e.scrollTop-e.clientHeight<160};e.addEventListener(`scroll`,r,{passive:!0});let i=new ResizeObserver(n);for(let t of e.children)i.observe(t);return n(),()=>{e.removeEventListener(`scroll`,r),i.disconnect()}},[c]),(0,V.jsx)(pC,{id:e,depth:o,widthDepth:s,children:e=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Mw,{title:r,onClose:e}),(0,V.jsx)(`div`,{ref:u,className:`flex-1 min-h-0 overflow-y-auto`,children:T?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center px-8 text-center text-[13px] text-muted`,children:`Transcript unavailable (agent completed or cleaned up).`}):!c||d.isLoading||p.length===0?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,V.jsx)(`span`,{className:`block h-5 w-5 rounded-full border-2 border-muted/50 border-t-transparent animate-spin`})}):(0,V.jsx)(x8.Provider,{value:t,children:(0,V.jsxs)(`div`,{"data-transcript-column":!0,className:`flex flex-col px-6 py-5`,children:[$8(C.map(e=>e.message),(e,t)=>(0,V.jsx)(N5,{m:e},t)),w&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(_0,{h:Q8(C.map(e=>e.message))}),(0,V.jsx)(r7,{since:a,startedAt:S,activityLabel:x,run:y})]})]})})}),(0,V.jsx)(d7,{slug:t,subId:n,subagentType:i,steerable:d.data?.steerable===!0,note:d.data?.steerNote??null,stoppable:d.data?.stoppable===!0,stopNote:d.data?.stopNote??null,ops:e=>(0,V.jsx)(Y5,{slug:t,parentAgentId:n,transcriptShells:g,className:e})})]})})}function d7({slug:e,subId:t,subagentType:n,steerable:r,note:i,stoppable:a,stopNote:o,ops:s}){let[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(!1),m=Md();function h(){let n=c.trim();!n||u||(d(!0),l(``),X.subAgentSteer({slug:e,id:t,message:n}).then(()=>{m.invalidateQueries({queryKey:[`subAgentTranscript`,e,t]}),Q(`Steer sent`)}).catch(e=>{l(n),Q(e instanceof Error?e.message:`Could not steer this sub-agent`)}).finally(()=>d(!1)))}function g(){f||(p(!0),X.subAgentStop({slug:e,id:t}).then(({descendantsStopped:n,note:r})=>{r?Q(`Sub-agent stopped. ${r}`,{duration:7e3}):Q(n>0?`Sub-agent and ${n} descendant${n===1?``:`s`} stopped`:`Sub-agent stopped`),m.invalidateQueries({queryKey:[`subAgentTranscript`,e,t]})}).catch(e=>{Q(e instanceof Error?e.message:`Could not stop this sub-agent`)}).finally(()=>p(!1)))}if(!r&&!a){let e=i??o;return e?(0,V.jsxs)(`div`,{"data-subagent-steer-note":!0,className:`w-full shrink-0 border-t border-border bg-panel px-3 py-3`,children:[(0,V.jsx)(`div`,{className:`px-1 pb-2 text-[11.5px] text-muted/70`,children:e}),(0,V.jsx)(`div`,{className:`pl-1.5`,children:(0,V.jsx)(f7,{subagentType:n})}),s?.(`px-1 pt-1.5 ops-column-optical-inset`)]}):(0,V.jsx)(V.Fragment,{children:s?.(`w-full shrink-0 border-t border-border bg-panel px-4 pb-2 pt-3`)})}return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{"data-subagent-steer":!0,className:`w-full shrink-0 border-t border-border bg-panel px-3 py-3`,children:[r?(0,V.jsx)(KH,{value:c,onChange:l,onSubmit:h,surface:`subAgentComposer`,placeholder:`Steer this sub-agent…`,busy:u||f,footer:(0,V.jsx)(f7,{subagentType:n})}):i?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`px-1 pb-2 text-[11.5px] text-muted/70`,children:i}),(0,V.jsx)(`div`,{className:`pl-1.5`,children:(0,V.jsx)(f7,{subagentType:n})})]}):null,r&&!a&&o&&(0,V.jsx)(`div`,{className:`mt-2 px-1 text-[11.5px] text-muted/70`,children:o}),s?.(`px-1 pt-1.5 ops-column-optical-inset`)]}),a&&(0,V.jsx)(`footer`,{"aria-label":`Sub-agent lifecycle actions`,"data-subagent-lifecycle-footer":!0,className:`flex min-h-10 w-full shrink-0 items-center justify-end gap-1.5 border-t border-border/70 bg-panel/95 px-3 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] text-[12px] backdrop-blur-sm`,children:(0,V.jsx)(`button`,{type:`button`,"data-stop-subagent":!0,disabled:f,onClick:g,className:`rounded-md border border-border-strong bg-panel-2/60 px-2.5 py-1 text-[12px] text-fg/80 transition-colors hover:border-red-400/40 hover:bg-red-400/10 hover:text-red-300 disabled:opacity-50`,children:f?`Stopping…`:`Stop sub-agent`})})]})}function f7({subagentType:e}){let t=l7(e);return(0,V.jsx)(`span`,{"data-subagent-profile":!0,"aria-label":`Sub-agent profile: ${t}`,title:e?.trim()||`The provider did not report this sub-agent's model and effort`,className:`inline-flex min-w-0 max-w-[min(72%,20rem)] items-center rounded-md border border-border/50 bg-transparent px-1.5 py-0.5 text-muted ${ZH}`,children:(0,V.jsx)(`span`,{className:`profile-grid-value relative -top-px min-w-0 truncate`,children:t})})}var p7=`font-mono-keep overflow-x-auto whitespace-pre-wrap break-words ${i0} border border-border bg-bg/75 px-4 py-2.5 text-[12px] leading-relaxed text-fg/85`;function m7({id:e,slug:t,shellId:n,label:r,startedAt:i,depth:a,widthDepth:o}){let s=(0,B.useRef)(null),c=dj(t,n),l=c.data?.state,u=c.data?.command,d=c.data?.output??``,[f,p]=(0,B.useState)(!1),m=Md();(0,B.useEffect)(()=>{let e=s.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<160&&(e.scrollTop=e.scrollHeight)},[d]);let h=ZM(i),g=l===`running`?`running${h?` ${h}`:``}`:l===`done`?`finished`:l===`gone`?`unavailable`:``,_=c.isError||l===`gone`;function v(){f||(p(!0),X.subAgentStop({slug:t,id:n}).then(({note:e})=>{e?Q(`Background shell stopped. ${e}`,{duration:7e3}):Q(`Background shell stopped — the worker was told`),m.invalidateQueries({queryKey:[`backgroundShellOutput`,t,n]})}).catch(e=>{Q(e instanceof Error?e.message:`Could not stop this background shell`)}).finally(()=>p(!1)))}async function y(){if(u)try{await bU(u),Q(`Command copied`)}catch{Q(`Could not copy command`)}}return(0,V.jsx)(pC,{id:e,depth:a,widthDepth:o,children:e=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Mw,{title:r,icon:(0,V.jsx)(Ew,{"aria-hidden":!0,size:14,className:`shrink-0 text-muted/60`}),meta:g?(0,V.jsx)(`span`,{className:`shrink-0 whitespace-nowrap text-[11.5px] text-muted/60`,children:g}):void 0,onClose:e}),(0,V.jsx)(`div`,{ref:s,className:`min-h-0 flex-1 overflow-y-auto px-5 py-5`,children:_?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center px-8 text-center text-[13px] text-muted`,children:`Background shell output is no longer available.`}):(0,V.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,V.jsxs)(`section`,{children:[(0,V.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h2`,{className:`petite-caps text-[10px] text-muted/65`,children:`Command`}),u&&(0,V.jsxs)(`button`,{type:`button`,onClick:y,className:`flex items-center gap-1 rounded px-1.5 py-1 text-[10.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:[(0,V.jsx)(WC,{"aria-hidden":!0,size:11}),` Copy`]})]}),u?(0,V.jsx)(h1,{"data-background-shell-command":!0,text:u,language:`bash`,className:p7}):(0,V.jsx)(`pre`,{"data-background-shell-command":!0,className:p7,children:c.isLoading?`Loading…`:`Command unavailable for this background operation.`})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,V.jsx)(`h2`,{className:`petite-caps text-[10px] text-muted/65`,children:`Output`}),l===`running`&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`shell-drawer`}),c.data?.truncated&&(0,V.jsx)(`span`,{className:`text-[10.5px] text-muted/50`,children:`Showing latest 512 KB`})]}),d?(0,V.jsx)(`pre`,{"data-background-shell-output":!0,className:`font-mono-keep min-h-40 whitespace-pre-wrap break-words ${i0} border border-border bg-[#090b10] px-4 py-3 text-[12px] leading-relaxed text-fg/85`,children:d}):(0,V.jsx)(`div`,{"data-background-shell-output":!0,className:`flex min-h-40 items-center justify-center ${i0} border border-border bg-[#090b10] px-4 text-center text-[12px] text-muted/60`,children:l===`done`?`No output was captured.`:`No output yet.`})]})]})}),!_&&c.data?.stoppable&&(0,V.jsx)(`footer`,{"aria-label":`Background shell lifecycle actions`,"data-background-shell-lifecycle-footer":!0,className:`flex min-h-10 w-full shrink-0 items-center justify-end gap-1.5 border-t border-border/70 bg-panel/95 px-3 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] text-[12px] backdrop-blur-sm`,children:(0,V.jsx)(`button`,{type:`button`,"data-stop-background-shell":!0,disabled:f,onClick:v,className:`rounded-md border border-border-strong bg-panel-2/60 px-2.5 py-1 text-[12px] text-fg/80 transition-colors hover:border-red-400/40 hover:bg-red-400/10 hover:text-red-300 disabled:opacity-50`,children:f?`Stopping…`:`Stop shell`})}),!_&&!c.data?.stoppable&&l===`running`&&c.data?.stopNote&&(0,V.jsx)(`footer`,{"data-background-shell-stop-note":!0,className:`w-full shrink-0 border-t border-border/70 bg-panel/95 px-4 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] text-[11.5px] text-muted/70`,children:c.data.stopNote})]})})}function h7(e){let t=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(e);return t?{front:t[1].split(/\r?\n/).filter(e=>e.trim()!==``),body:e.slice(t[0].length)}:{front:null,body:e}}var g7={paddingBottom:`max(0.75rem, env(safe-area-inset-bottom))`};function _7({path:e}){return(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{X.openLocalFile({path:e}).then(async e=>{e.action===`copy`&&(await bU(e.path),Q(`Copied local path`))}).catch(e=>Q(`Could not open local file: ${e.message.slice(0,100)}`))},onMouseDown:e=>e.preventDefault(),className:`flex items-center gap-1.5 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-fg/60`,title:`Open ${e} outside Frizz`,"aria-label":`Open`,children:[(0,V.jsx)(KC,{size:12,"aria-hidden":`true`}),` Open`]})}function v7({lines:e}){return(0,V.jsx)(`div`,{className:`mb-4 rounded-md border border-border/60 bg-panel-2/40 px-3 py-2 text-[12px] leading-5 text-muted`,children:e.map((e,t)=>{let n=e.indexOf(`:`),r=n>0?e.slice(0,n):null;return(0,V.jsx)(`div`,{className:`break-words`,children:r?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`font-mono-keep text-fg/60`,children:r}),e.slice(n)]}):e},t)})})}function y7({id:e,path:t,title:n,depth:r,widthDepth:i}){let a=qd({queryKey:[`localMarkdown`,t],queryFn:()=>X.localMarkdown({path:t})}),o=a.data?.path??t,{front:s,body:c}=h7(a.data?.markdown??``),l=s$(c,{baseDir:WH(o),asDocument:!0}),u=q$(l),d=(0,B.useRef)(null);return a1(d,l),(0,V.jsx)(pC,{id:e,depth:r,widthDepth:i,children:e=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Mw,{title:n,subtitle:o,onClose:e}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4`,children:a.isLoading?(0,V.jsx)(`div`,{className:`text-[13px] text-muted`,children:`Loading…`}):a.error?(0,V.jsxs)(`div`,{className:`text-[13px] text-red-400/90`,children:[`Couldn’t read this file: `,a.error.message]}):l?(0,V.jsxs)(V.Fragment,{children:[s&&(0,V.jsx)(v7,{lines:s}),(0,V.jsx)(`div`,{ref:d,className:`md-body`,dangerouslySetInnerHTML:u}),a.data?.truncated&&(0,V.jsx)(`p`,{className:`mt-4 border-t border-border/60 pt-3 text-[12px] text-muted`,children:`This file is too long to render in full — everything above the cut is shown. Open it to read the rest.`})]}):(0,V.jsx)(`div`,{className:`text-[13px] text-muted`,children:`This file is empty.`})}),(0,V.jsx)(`div`,{className:`shrink-0 flex items-center justify-end gap-1.5 border-t border-border/60 bg-panel px-5 pt-3`,style:g7,children:(0,V.jsx)(_7,{path:o})})]})})}function b7({id:e,slug:t,title:n,depth:r,widthDepth:i}){let a=qd({queryKey:[`threadBody`,t],queryFn:()=>X.threadBody({slug:t})}),o=Hf(Z);(0,B.useEffect)(()=>{a.refetch()},[o.board]);let s=f2(iC(o.board,t)),c=iW(),l=rW.adopt(c,t),[u,d,f]=oW(l),p=Jd({mutationFn:async e=>{await X.adoptThread({slug:t,message:e.trim()||void 0})},onSuccess:()=>{Z.drawers.find(t=>t.id===e)?.closing||(Z.drawers=Z.drawers.map(t=>t.id===e?{...t,kind:`thread`}:t))},onError:(e,t)=>{tW.get(l)||d(t),Q(`Start failed: ${e.message.slice(0,80)}`)}}),m=s$(JQ(a.data?.markdown??``)),h=q$(m);return(0,V.jsx)(pC,{id:e,depth:r,widthDepth:i,widthOffset:1,subagentParent:t,children:e=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Mw,{title:n,subtitle:`${t}.md`,onClose:e}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4`,children:a.isLoading?(0,V.jsx)(`div`,{className:`text-[13px] text-muted`,children:`Loading…`}):m?(0,V.jsx)(`div`,{className:`md-body`,dangerouslySetInnerHTML:h}):(0,V.jsx)(`div`,{className:`text-[13px] text-muted`,children:`No thread file found.`})}),s&&(0,V.jsxs)(`div`,{className:`shrink-0 border-t border-border/60 px-5 pb-4 pt-3`,children:[(0,V.jsx)(`p`,{className:`mb-2.5 text-[11.5px] text-muted/80`,children:`No session is attached to this thread yet. Send a message below to start one on this plan.`}),(0,V.jsx)(KH,{surface:`adoptComposer`,value:u,onChange:d,onSubmit:()=>{if(!u.trim()||p.isPending)return;let e=u;f(),Q(`Starting thread…`,{spinner:!0,sticky:!0}),p.mutate(e)},placeholder:`Kick off work on this thread…`,minHeight:44,busy:p.isPending})]})]})})}function x7(){let e=Hf(Z),t=$A();(0,B.useEffect)(()=>{function e(e){if(e.key===`Escape`&&!(e.target instanceof Element&&e.target.closest(`.xterm`))){if(gU()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(Z.showPalette)Z.showPalette=!1;else if(Z.showNewThread)Z.showNewThread=!1;else if(Z.showGithubPicker)NS();else if(Z.showSettings)ix()||(Z.showSettings=!1);else if(Z.drawers.length>0){let e=Z.drawers[Z.drawers.length-1];cx(e.id)||Z.drawers.pop()}}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let n=0;return(0,V.jsx)(V.Fragment,{children:e.drawers.map((e,r)=>{let i=n;e.closing||n++;let a=e.kind===`thread`?(0,V.jsx)(a7,{id:e.id,slug:e.slug,depth:r,widthDepth:i,initiallyOpen:e.routed},e.id):e.kind===`subagent`?(0,V.jsx)(u7,{id:e.id,slug:e.slug,subId:e.subId??``,label:e.label??e.slug,subagentType:e.subagentType,startedAt:e.startedAt,depth:r,widthDepth:i},e.id):e.kind===`shell`?(0,V.jsx)(m7,{id:e.id,slug:e.slug,shellId:e.subId??``,label:e.label??`Background shell`,startedAt:e.startedAt,depth:r,widthDepth:i},e.id):e.kind===`markdown`?(0,V.jsx)(y7,{id:e.id,path:e.path??e.slug,title:e.label??e.slug,depth:r,widthDepth:i},e.id):(0,V.jsx)(b7,{id:e.id,slug:e.slug,depth:r,widthDepth:i,title:(()=>{let n=iC(t,e.slug);return n?Uj(n):e.slug})()},e.id);return(0,V.jsx)(Pw,{label:`this drawer`,resetKeys:[e.kind,e.slug,e.subId,e.path],fallback:(t,n)=>(0,V.jsx)(zw,{id:e.id,depth:r,widthDepth:i,error:t,onRetry:n}),children:a},e.id)})})}function S7(e){let t=w1(e).filter(e=>e.kind===`question`);if(t.length!==0)return JSON.stringify(t.map(e=>e.kind===`question`?[e.questionKind,e.danger===!0,e.text.trim()]:null))}function C7(e){let t=new Map,n=[];for(let r=0;r<e.length;r++){let i=S7(e[r].text);n.push(i),i!==void 0&&t.set(i,r)}let r=new Set;for(let e=0;e<n.length;e++){let i=n[e];i!==void 0&&t.get(i)!==e&&r.add(e)}return r}function w7(e,t,n){return D1(e.text)?!n.has(t):e.wake===!0}function T7(e){return e.wake===!0}function E7(e,t){let n=[],r,i=!1,a=()=>{r&&r.start<=r.end&&n.push(r),r=void 0};for(let n=Math.max(0,t);n<e.length;n++){let t=e[n];if(t.closes===!0){a(),i=!0;continue}if(t.skip===!0)continue;if(t.opens===!0){a(),i=!0,r={start:n+1,end:n,open:-1,close:-1,steps:0,tools:0,resumed:!0,waker:-1};continue}let o=r===void 0;r||={start:n,end:n,open:-1,close:-1,steps:0,tools:0,resumed:i,waker:-1},o&&t.completion===!0&&r.resumed&&(r.waker=n),r.end=n,r.tools+=t.tools??0,t.text===!0&&(r.open<0&&(r.open=n),r.close=n)}a();for(let t of n)for(let n=t.start;n<=t.end;n++){let r=e[n];r.skip===!0||r.survives===!0||n===t.open||n===t.close||n===t.waker||r.countable===!0&&t.steps++}return n}function D7(e){return e.open<0||e.tools<1&&e.steps<1?!1:e.resumed||e.open!==e.close}function O7(e){if(e.length<3)return{kept:[...e]};let t=e[0],n=e[e.length-1],r=e.slice(1,-1);return{kept:[t,n],middle:{start:Math.max(t.end+1,r[0].start-1),end:r[r.length-1].end,runs:r.length,tools:r.reduce((e,t)=>e+t.tools,0)}}}function k7(e){return pN(e,`card`).length>0}function A7({slug:e,subAgents:t,className:n=`px-1 pt-1.5`}){let r=pN(t,`card`);return r.length===0?null:(0,V.jsx)(`div`,{"data-queue-subagents":!0,className:`flex min-w-0 flex-col gap-0.5 ${n}`,children:r.map((t,n)=>(0,V.jsx)(gN,{kind:`AGENT`,label:t.label,state:t.state,density:`card`,depth:t.depth,startedAt:t.startedAt,parentSlug:e,onOpen:t.id?()=>VS(e,t.id,{label:t.label,subagentType:t.subagentType,startedAt:t.startedAt}):void 0,onDismiss:vN(e,t)},t.id??`${t.startedAt}-${n}`))})}var j7=320;function M7(e){let t=[...document.querySelectorAll(`[data-queue-card]`)],n=t.findIndex(t=>t.dataset.queueCard===e);if(n<0)return null;let r=window.innerHeight,i=e=>{if(!e||e.dataset.queueLeaving===`true`||!e.dataset.queueCard)return!1;let t=e.getBoundingClientRect();return t.bottom>0&&t.top<r},a=i(t[n-1])?t[n-1]:i(t[n+1])?t[n+1]:null;return a?{slug:a.dataset.queueCard,top:a.getBoundingClientRect().top}:null}function N7(e){let t=[...document.querySelectorAll(`[data-queue-card]`)],n=t.findIndex(t=>t.dataset.queueCard===e);if(n<0)return null;let r=e=>e.dataset.queueLeaving!==`true`&&!!e.dataset.queueCard;for(let e=n+1;e<t.length;e++)if(r(t[e]))return t[e].dataset.queueCard;for(let e=n-1;e>=0;e--)if(r(t[e]))return t[e].dataset.queueCard;return null}var P7=0,F7=``;function I7(){P7++===0&&(F7=document.documentElement.style.overflowAnchor,document.documentElement.style.overflowAnchor=`none`)}function L7(){P7>0&&--P7===0&&(document.documentElement.style.overflowAnchor=F7)}var R7=`Hides card until new activity is detected`;function z7({thread:e,onSnooze:t,onSnoozeFailed:n}){let[r,i]=(0,B.useState)(!1);return(0,V.jsx)(s6,{thread:e,actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{i(!0),t(),X.snoozeAwaitingBackground({slug:e.id,sessionId:e.sessionId??``}).then(()=>Q(`Snoozed until the background work returns`)).catch(e=>{n(),Q(`Couldn’t snooze: ${e.message.slice(0,80)}`),i(!1)})},disabled:r,onMouseDown:e=>e.preventDefault(),title:R7,className:`disabled:opacity-45 ${g0}`,children:[(0,V.jsx)(tw,{size:12,className:u2}),`Snooze`]}),(0,V.jsx)(`span`,{className:m0,children:R7})]})})}function yte(){let e=$A(),t=rM(tj(e?.threads??[]).filter(iM),Hf(zj).queueOrder),n=t.map(e=>e.id).join(`,`),[r,i]=(0,B.useState)(()=>new Set),a=(0,B.useRef)(t);a.current=t;let o=(0,B.useRef)(r);o.current=r;let s=new Set(t.map(e=>e.id)),c=(0,B.useRef)([]),l=(0,B.useRef)([]),u=(0,B.useRef)(new Map),d=(0,B.useRef)(new Set),f=(0,B.useRef)(new Set),p=(0,B.useRef)(new Map),m=(0,B.useRef)(new Map),h=(0,B.useRef)(null),[g,_]=(0,B.useState)(0);c.current.forEach(e=>{if(!s.has(e.id)&&!f.current.has(e.id)){let t=l.current.indexOf(e.id);u.current.delete(e.id),u.current.set(e.id,{view:e,index:t>=0?t:l.current.length}),r.has(e.id)&&d.current.add(e.id)}}),c.current=t;for(let e of[...f.current])s.has(e)?r.has(e)||(f.current.delete(e),d.current.delete(e)):r.has(e)||(f.current.delete(e),u.current.delete(e),d.current.delete(e));for(;u.current.size>32;){let e=u.current.keys().next().value;if(e===void 0)break;u.current.delete(e),d.current.delete(e);let t=p.current.get(e);t&&(clearTimeout(t),p.current.delete(e))}let v=e=>s.has(e)?r.has(e):d.current.has(e),y=(0,B.useMemo)(()=>{let e=t.filter(e=>!f.current.has(e.id)),n=[...u.current.entries()].filter(([e])=>!s.has(e)&&!f.current.has(e)).map(([,e])=>e).sort((e,t)=>e.index-t.index);for(let{view:t,index:r}of n)e.splice(Math.min(r,e.length),0,t);return e},[t,r,g]);l.current=y.map(e=>e.id),(0,B.useEffect)(()=>{let e=[...u.current.keys()].filter(e=>!s.has(e)&&!f.current.has(e)),t=e.filter(e=>!d.current.has(e)),n;t.length&&(n=requestAnimationFrame(()=>{t.forEach(e=>{u.current.has(e)&&d.current.add(e)}),_(e=>e+1)}));let i=new Set;for(let e of r)f.current.has(e)||i.add(e);for(let t of e)i.add(t);for(let e of i){if(p.current.has(e))continue;let t=setTimeout(()=>{if(p.current.delete(e),o.current.has(e)){let t=N7(e);h.current=t?{kind:`top`,slug:t}:null}else{let t=M7(e);h.current=t?{kind:`hold`,...t}:null}f.current.add(e),d.current.delete(e),_(e=>e+1)},j7);p.current.set(e,t)}return()=>{n!==void 0&&cancelAnimationFrame(n)}},[n,r,g]),(0,B.useEffect)(()=>{let e=[...r].filter(e=>f.current.has(e)&&!s.has(e));if(e.length!==0){for(let t of e)f.current.delete(t),u.current.delete(t),d.current.delete(t);i(t=>{let n=new Set(t);for(let t of e)n.delete(t);return n})}},[n,g]),(0,B.useEffect)(()=>()=>{for(let e of p.current.values())clearTimeout(e);for(let e of m.current.values())clearTimeout(e)},[]),(0,B.useLayoutEffect)(()=>{let e=h.current;if(!e)return;h.current=null;let t=document.querySelector(`[data-queue-card="${CSS.escape(e.slug)}"]`);if(!t)return;if(e.kind===`hold`){let n=t.getBoundingClientRect().top-e.top;Math.abs(n)>.5&&window.scrollBy({top:n,left:0,behavior:`auto`});return}I7();let n=()=>{let t=AS(e.slug);t!==null&&Math.abs(dx()-t)>.5&&window.scrollTo({top:t,left:0,behavior:`auto`})};n(),requestAnimationFrame(()=>{n(),requestAnimationFrame(()=>{n(),L7()})})},[g]);let b=(0,B.useCallback)(e=>{i(t=>new Set(t).add(e));let t=m.current.get(e);t&&clearTimeout(t);let n=setTimeout(()=>{m.current.delete(e),a.current.some(t=>t.id===e)&&(f.current.delete(e),d.current.delete(e),i(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),_(e=>e+1))},8e3);m.current.set(e,n)},[]),x=(0,B.useCallback)(e=>{let t=m.current.get(e);t&&(clearTimeout(t),m.current.delete(e));let n=p.current.get(e);n&&(clearTimeout(n),p.current.delete(e)),f.current.delete(e),d.current.delete(e),i(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),_(e=>e+1)},[]),S=(e?.threads.length??0)===0;return(0,V.jsxs)(`div`,{className:`my-auto w-full min-w-0 flex flex-col py-8`,children:[(0,V.jsx)(bte,{board:e}),y.length>0&&(0,V.jsx)(`div`,{className:`flex flex-col`,children:y.map((e,t)=>(0,V.jsxs)(B.Fragment,{children:[(0,V.jsx)(Ste,{slug:e.id,leaving:v(e.id),children:(0,V.jsx)(Tte,{thread:e,leaving:v(e.id),onResolve:b,onUnresolve:x})}),t<y.length-1&&(0,V.jsx)(`hr`,{className:`my-10 border-0 border-t border-border/60`})]},e.id))}),S?(0,V.jsxs)(`div`,{className:`w-full flex flex-col gap-3`,children:[(0,V.jsx)(`h2`,{className:`text-[15px] font-medium text-center`,children:`What should the agent do?`}),(0,V.jsx)(UK,{}),(0,V.jsx)(cW,{autoFocus:!0})]}):y.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-2 pt-2`,children:[(0,V.jsx)(iw,{size:40,strokeWidth:1.25,className:`text-muted/30`}),(0,V.jsx)(`div`,{className:`text-[13px] text-muted/80`,children:`No threads awaiting human input`})]}):null]})}function bte({board:e}){let t=e?.errorItems??[],n=e?.errors??[];return t.length===0&&n.length===0?null:(0,V.jsxs)(`div`,{className:`mb-6 ${i0} border border-amber-500/25 bg-amber-500/[0.06] px-4 py-2.5 text-[12px] text-amber-200/90`,children:[(0,V.jsx)(`div`,{className:`font-medium mb-0.5`,children:`Board errors`}),t.length>0?t.slice(0,6).map((e,t)=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2 py-0.5`,children:[(0,V.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,title:`${e.file?`${e.file}: `:``}${e.message}`,children:[e.file?`${e.file}: `:``,e.message]}),e.kind===`no-frontmatter`&&(0,V.jsx)(xte,{file:e.file})]},t)):n.slice(0,3).map((e,t)=>(0,V.jsx)(`div`,{className:`truncate`,title:e,children:e},t))]})}function xte({file:e}){let t=Jd({mutationFn:()=>X.repairThread({file:e}),onSuccess:({slug:e})=>Q(`Repaired ${e} — verify its status`),onError:e=>Q(e instanceof Error?e.message:`Repair failed`)});return(0,V.jsx)(`button`,{onClick:()=>t.mutate(),disabled:t.isPending,className:`shrink-0 rounded border border-amber-400/50 bg-amber-500/10 px-2 py-0.5 text-[11px] font-medium text-amber-100 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,title:`Prepend minimal frontmatter (title + status: active) so this thread becomes visible again`,children:t.isPending?`Repairing…`:`Repair`})}function Ste({leaving:e,slug:t,children:n}){return(0,V.jsx)(`div`,{"data-queue-card":t,"data-queue-leaving":e,className:`frizz-card-slot min-w-0`,children:(0,V.jsx)(`div`,{className:`frizz-card-clip min-h-0 min-w-0`,children:(0,V.jsx)(`div`,{className:`frizz-card-body min-w-0`,children:n})})})}function Cte({runs:e,toolCount:t,onExpand:n}){let r=t>0?`${t} tool call${t===1?``:`s`}`:``,i=`${e} more round${e===1?``:`s`}`;return(0,V.jsxs)(v0,{icon:IC,marker:`middle-runs-summary`,onClick:n,ariaLabel:`Expand ${i}${r?` and ${r}`:``} of intermediate agent activity`,children:[(0,V.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:i}),r&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50`,children:`·`}),(0,V.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:r})]}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50`,children:`·`}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`Click to expand`})]})}function wte({toolCount:e,onExpand:t}){let n=e>0?`${e} tool call${e===1?``:`s`}`:``;return(0,V.jsxs)(v0,{icon:IC,marker:`intermediate-summary`,onClick:t,ariaLabel:`Expand ${n?`${n} of `:``}intermediate agent activity`,children:[n&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:n}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50`,children:`·`})]}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`Click to expand`})]})}var Tte=(0,B.memo)(function({thread:e,leaving:t,onResolve:n,onUnresolve:r}){let[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(null),[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(0),g=(0,B.useRef)(null),_=(0,B.useRef)(null),[v,y]=(0,B.useState)(0),b=(0,B.useRef)(null),x=(0,B.useRef)(!1),S=(0,B.useRef)(!1),C=(0,B.useRef)(null),w=Md(),T=b6(e.id),{stickyUserMessage:E}=Hf(zj);(0,B.useLayoutEffect)(()=>{let e=_.current;if(!e)return;let t=()=>y(e.getBoundingClientRect().height);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[i]);let D=lj(e.id,{poll:!1}),O=(0,B.useMemo)(()=>D.data?.messages??[],[D.data]),k=(0,B.useMemo)(()=>J8(O),[O]),A=e=>k>=0&&e<k,j=(0,B.useMemo)(()=>n0(O),[O]),M=(0,B.useMemo)(()=>{for(let e=O.length-1;e>=0;e--){let t=O[e];if(t.role===`user`&&!t.wake&&!t.queued)return e}return 0},[O]),N=(0,B.useMemo)(()=>{for(let e=O.length-1;e>=0;e--)if(O[e].boundary===`rest`)for(let t=e+1;t<O.length;t++){let n=O[t];if(!(n.queued||n.boundary===`rest`||q8(n,A(t))))return e+1}return 0},[O]),P=(0,B.useMemo)(()=>{for(let e=O.length-1;e>=0;e--)if(O[e].role===`user`&&!O[e].queued)return e;return-1},[O]),ee=(0,B.useMemo)(()=>C7(O),[O]),F=(0,B.useMemo)(()=>O.map((e,t)=>{if(!e||e.queued||q8(e,A(t)))return{skip:!0};if(e.boundary===`rest`)return{skip:!0,closes:!0};let n=D4(e),r=n?0:e.tools.length;return{text:Z8(e,A(t)),tools:r,countable:Z8(e,A(t))||r>0||n!==void 0||e.kind!==void 0,survives:w7(e,t,ee),opens:T7(e),completion:e.boundary===`wake`||n!==void 0}}),[O,ee]),te=(0,B.useMemo)(()=>E7(F,M+1),[F,M]),{kept:ne,middle:re}=(0,B.useMemo)(()=>O7(te),[te]),ie=(0,B.useMemo)(()=>ne.filter(D7),[ne]),ae=(0,B.useMemo)(()=>{let e=new Map;return ie.forEach((t,n)=>{for(let r=t.start;r<=t.end;r++)e.set(r,n)}),e},[ie]),oe=!o&&(P>=0||N>0)&&ie.length>0,se=dA(O,u,M),ce=(0,B.useMemo)(()=>O.slice(se),[O,se]),le=(0,B.useMemo)(()=>z6(ce).map(e=>({...e,messageIndex:e.messageIndex+se})),[ce,se]),ue=se>0||D.data?.hasEarlier===!0;(0,B.useLayoutEffect)(()=>{let e=b.current,t=g.current;if(!e||!t||![...t.querySelectorAll(`[data-transcript-source-id]`)].some(t=>t.dataset.transcriptSourceId===e.targetStartId))return;let n=()=>{vA(t,e.anchor,e=>{e!==0&&window.scrollBy({top:e,left:0,behavior:`auto`})});let n=0;return vA(t,e.anchor,e=>{n=e}),n},r=n();if(yA({remaining:r,scrollY:window.scrollY,maxScrollY:Math.max(0,document.documentElement.scrollHeight-window.innerHeight),alreadyReserved:e.reserved===!0})===`reserve`){e.reserved=!0,h(e=>e+Math.ceil(r));return}S.current||(S.current=!0,requestAnimationFrame(()=>{n(),requestAnimationFrame(()=>{n(),b.current=null,S.current=!1,x.current&&(x.current=!1,L7())})}))},[m,O,u]),(0,B.useEffect)(()=>{let e=D.data?.transcriptKey;if(!e)return;let t=C.current;C.current=e,!(!t||t===e)&&(d(null),h(0),s(!1),b.current=null,S.current=!1,x.current&&(x.current=!1,L7()))},[D.data?.transcriptKey]),(0,B.useEffect)(()=>()=>{x.current&&(x.current=!1,L7())},[]);let de=e=>{let t=gA(g.current);!e||!t||(x.current||(x.current=!0,I7()),b.current={anchor:t,targetStartId:e})},fe=async()=>{if(f||!ue)return;let t=uA(O,se),n=t!==null&&O[t]?.role===`user`?t:null;if(n!==null){let e=O[n].sourceId;de(e),d(e??null);return}let r=D.data?.beforeCursor;if(!r){if(se>0){let e=O[0]?.sourceId;de(e),d(e??null)}return}let i=D.data?.transcriptKey;if(i){p(!0);try{let t=await X.threadTranscriptEarlier({slug:e.id,cursor:r}),n=w.getQueryData([`transcript`,e.id]);if(!n?.transcriptKey||n.transcriptKey!==i||t.transcriptKey!==i){await D.refetch(),d(null),Q(`Transcript changed while loading history; refreshed the current session`);return}let a=t.messages[0]?.sourceId??O[0]?.sourceId;de(a);let o=hA(n,t);w.setQueryData([`transcript`,e.id],o),d(a??null)}catch(e){await D.refetch(),d(null),Q(e instanceof Error?e.message:`Could not load earlier transcript history`)}finally{p(!1)}}},pe=Jd({mutationFn:()=>X.markComplete({slug:e.id})}),{answeringForMessage:me,answerable:he,anyAnswered:ge,sendAnswers:_e,sendMessage:ve}=K0(e.id,O,()=>{document.activeElement?.blur(),n(e.id)},{scrollToBottom:!1}),ye=he||ge,be=(0,B.useCallback)(()=>n(e.id),[n,e.id]),xe=(0,B.useCallback)(()=>r(e.id),[r,e.id]),Se=(0,B.useMemo)(()=>({dismiss:be,cancel:xe}),[be,xe]);return(0,V.jsx)(b8.Provider,{value:e.id,children:(0,V.jsx)(C8.Provider,{value:Se,children:(0,V.jsxs)(`div`,{"data-queue-card-root":e.id,"data-queue-leaving":t,style:m?{marginBottom:m}:void 0,className:`flex flex-col min-w-0 max-w-full ${i0} border border-border-strong bg-panel shadow-lg shadow-black/25 transition-opacity ${c?`opacity-40`:``}`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[(0,V.jsxs)(`div`,{ref:_,className:`sticky top-0 z-10 flex items-center gap-2 bg-panel px-5 py-3.5 max-[800px]:top-10 ${i?i0:`${a0} border-b border-border/60`}`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`div`,{className:`flex min-w-0 items-center gap-1`,children:(0,V.jsx)(`div`,{className:`min-w-0 flex-1 truncate font-semibold text-[15px] leading-snug`,title:Uj(e),children:Uj(e)})}),(0,V.jsx)(d6,{at:eM(e),fallbackAt:e.spawnedAt,className:`mt-0.5 block truncate text-[11px] leading-tight text-muted/75`}),e.statusText&&e.status===`needs-human`&&(0,V.jsx)(`div`,{className:`text-[11px] text-muted/80 mt-0.5 truncate`,title:e.statusText,children:e.statusText})]}),e.kind===`session`&&e.foreign!==!0&&(0,V.jsx)(x6,{slug:e.id}),(0,V.jsx)(R2,{thread:e,collapsed:i,onCollapse:()=>a(e=>!e),openHref:Ex(e.id),onDone:()=>pe.mutate(void 0,{onSuccess:()=>n(e.id),onError:()=>l(!1)}),doneBusy:pe.isPending,onStatusMutate:()=>l(!0),onStatusApplied:()=>n(e.id),onStatusFailed:()=>l(!1)})]}),i?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`px-5 pt-5 ${ye?`pb-2`:`pb-5`}`,children:[(0,V.jsx)(b3,{thread:e,className:`mb-4`}),!e.pendingInteraction&&e.pendingAsk?(0,V.jsx)(`div`,{className:`mb-4`,children:(0,V.jsx)(X5,{ask:e.pendingAsk,onTerminal:T})}):e.runtime===`perm-prompt`?(0,V.jsx)(`div`,{className:`mb-4`,children:(0,V.jsx)(q5,{onTerminal:T})}):null,e.permPolicy?(0,V.jsx)(`div`,{className:`mb-4`,children:(0,V.jsx)(J5,{policy:e.permPolicy,denies:e.permDenies})}):null,O.length===0?(0,V.jsx)(`p`,{className:`text-[13px] text-muted`,children:D.isLoading?`Loading…`:e.statusText||`No message yet.`}):(0,V.jsxs)(`div`,{ref:g,className:`flex flex-col`,children:[ue&&(0,V.jsx)(`button`,{className:`mb-3.5 self-center rounded-md border border-border px-2 py-0.5 text-[11px] text-muted transition-colors hover:text-fg hover:bg-panel-2 outline-none`,onClick:()=>void fe(),onMouseDown:e=>e.preventDefault(),disabled:f,children:f?`Loading earlier messages…`:D.data?.reachedTurnBoundary===!1?`Continue loading this turn`:`Load earlier messages`}),(()=>{let e=se,t=[],n=null,r=new Set;return le.forEach(({message:e,messageIndex:i},a)=>{if(e.queued||q8(e,A(i))||e.boundary===`rest`)return;if(oe&&re&&i>=re.start&&i<=re.end){i===re.start&&(n!==null&&t.push((0,V.jsx)(_0,{h:14},`middle-runs-space`)),t.push((0,V.jsx)(Cte,{runs:re.runs,toolCount:re.tools,onExpand:()=>s(!0)},`middle-runs-summary`)),n=!1);return}let o=oe?ae.get(i):void 0,c=o===void 0?void 0:ie[o],l=c!==void 0,u=c!==void 0&&i===c.open,d=c!==void 0&&i===c.close,f=l&&!u&&!d&&!D1(e.text)&&w7(e,i,ee);if(c!==void 0&&i===c.waker){n!==null&&t.push((0,V.jsx)(_0,{h:n&&V8(e)?6:14},`s${a}`));let r=e.sourceId??`legacy-${i}`;t.push((0,V.jsx)(`div`,{"data-transcript-source-id":r,className:`flex flex-col`,children:(0,V.jsx)(N5,{m:e,dense:!0})},r)),n=B8(e);return}if(l&&!f){if(!u&&!d&&!w7(e,i,ee)||(!u&&o!==void 0&&!r.has(o)&&(n!==null&&t.push((0,V.jsx)(_0,{h:14},`im-space-${o}`)),t.push((0,V.jsx)(wte,{toolCount:c.tools,onExpand:()=>s(!0)},`intermediate-summary-${o}`)),n=!1,r.add(o)),!Z8(e,A(i))))return;n!==null&&t.push((0,V.jsx)(_0,{h:14},`s${a}`));let l=e.sourceId??`legacy-${i}`;t.push((0,V.jsx)(`div`,{"data-transcript-source-id":l,className:`flex flex-col`,children:(0,V.jsx)(N5,{m:e,dense:!0,textOnly:!0,answering:me(e),paired:j[i],staleAwaiting:A(i)})},l)),n=!1;return}n!==null&&t.push((0,V.jsx)(_0,{h:n&&V8(e)?6:14},`s${a}`));let p=e.sourceId??`legacy-${i}`,m=i===P&&E,h=(0,V.jsx)(N5,{m:e,dense:!0,staleAwaiting:A(i),answering:me(e),paired:j[i],sticky:m});t.push(m?(0,V.jsx)(j5,{sourceId:p,stickyTopPx:v,children:h},p):(0,V.jsx)(`div`,{"data-transcript-source-id":p,className:`flex flex-col`,children:h},p)),n=B8(e)}),ce.forEach((n,r)=>{n.queued&&(t.push((0,V.jsx)(_0,{},`qs${r}`)),t.push((0,V.jsx)(N5,{m:n,dense:!0,paired:j[e+r]},`q${e+r}`)))}),t})()]}),o6(e)&&(0,V.jsx)(`div`,{className:`mt-4`,children:(0,V.jsx)(z7,{thread:e,onSnooze:be,onSnoozeFailed:xe})})]}),ye&&(0,V.jsx)(`div`,{className:`shrink-0 px-5 pt-0`,children:(0,V.jsx)(`div`,{className:`mb-4 flex items-center justify-start gap-2`,children:(0,V.jsx)(`button`,{disabled:!ge,onClick:()=>_e(),onMouseDown:e=>e.preventDefault(),className:`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`})})}),(0,V.jsx)(I2,{slug:e.id,surface:`queueComposer`,className:`shrink-0 px-5 pb-3 pt-0`,placeholder:he?`Or skip the questions and reply…`:`Reply to the agent…`,submitOverride:ve,ops:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(A7,{slug:e.id,subAgents:e.subAgents??[],className:`px-1 pt-1.5`}),(0,V.jsx)(Y5,{slug:e.id,includeAgents:!1,className:`px-1 ${k7(e.subAgents??[])?`pt-0.5`:`pt-1.5`}`})]})})]})]}),(0,V.jsx)(S4,{thread:e,onArchived:()=>n(e.id),onDismissCancel:()=>r(e.id),onSnoozed:()=>n(e.id)})]})})})},Ete);function Ete(e,t){return e.leaving===t.leaving&&e.onResolve===t.onResolve&&e.onUnresolve===t.onUnresolve&&(e.thread===t.thread||JSON.stringify(e.thread)===JSON.stringify(t.thread))}function Dte(e,t){if(e.backend===`claude`)return MU.some(t=>t.value===e.model)?LU(e.model).includes(e.effort)?void 0:`Reasoning level ${e.effort} is not available for ${e.model}`:`Claude model ${e.model} is no longer available`;let n=t.find(t=>t.slug===e.model);if(!n)return`Codex model ${e.model} is no longer available`;if(!n.efforts.includes(e.effort))return`Reasoning level ${e.effort} is not available for ${e.model}`}function Ote(e,t){return{items:t.map(e=>({...e})),backend:e.backend,model:e.model,effort:e.effort}}function kte({keys:e,key:t,shiftKey:n,anchor:r,selected:i}){let a=e.indexOf(t),o=r===null?-1:e.indexOf(r);if(!n||a===-1||o===-1||r===null){let e=new Set(i);return e.has(t)?e.delete(t):e.add(t),{selected:e,anchor:a===-1?r:t}}let s=a>=o?1:-1,c=i.has(r),l=new Set(i);for(let t=o;;t+=s){let n=e[t];if(c?l.add(n):l.delete(n),t===a)break}return{selected:l,anchor:r}}var Ate=30;function jte({onClose:e}){let t=JH(),{resolved:n,codexList:r,loadError:i,saveProfile:a}=GU(),[o,s]=(0,B.useState)(`issues`),[c,l]=(0,B.useState)(`recent`),[u,d]=(0,B.useState)(1),[f,p]=(0,B.useState)(()=>new Set),[m,h]=(0,B.useState)(null),g=qd({queryKey:[`githubList`,o,c,u],queryFn:()=>X.githubList({kind:o,sort:c,page:u,perPage:Ate}),placeholderData:Wu}),_=g.data?.items??[],v=g.data?.page??u,y=g.data?.pageCount??1,b=g.data?.total??0,x=(0,B.useRef)(null);(0,B.useEffect)(()=>{x.current&&(x.current.scrollTop=0)},[u,o,c]);let S=Jd({mutationFn:e=>X.githubDispatchBatch(e),onMutate:e=>Q(`Starting ${e.items.length} thread${e.items.length===1?``:`s`}…`,{spinner:!0,sticky:!0}),onSuccess:t=>{let n=t.dispatched.length,r=t.failed.length;Q(`Started ${n} thread${n===1?``:`s`}${r?` (${r} failed)`:``}`),e()},onError:e=>Q(`Dispatch failed: ${e.message.slice(0,80)}`)});function C(e){e!==o&&(s(e),d(1),p(new Set),h(null))}function w(e){e!==c&&(l(e),d(1),p(new Set),h(null))}function T(e,t){let n=kte({keys:_.map(e=>e.number),key:e,shiftKey:t,anchor:m,selected:f});p(n.selected),h(n.anchor)}function E(){p(new Set),h(null)}let D=t.data?.nameWithOwner??`this repo`,O=f.size,k=(0,B.useMemo)(()=>UU(r),[r]),A=n?{backend:n.backend,model:n.model,effort:n.effort}:void 0,j=A?Dte(A,r):i?`Could not load the model catalogue — reopen once it loads`:void 0,M=j??(A?void 0:`Loading the model catalogue…`);function N(){if(!A||M){Q(M??`Choose a model and reasoning level`);return}S.mutate(Ote(A,[...f].map(e=>({kind:o===`issues`?`issue`:`pr`,number:e}))))}return(0,V.jsx)(uW,{onClose:e,children:(0,V.jsxs)(`div`,{className:`flex max-h-[85vh] w-[720px] max-w-[90vw] flex-col rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50`,onKeyDownCapture:t=>{t.key===`Escape`&&(t.stopPropagation(),e())},children:[(0,V.jsxs)(`h2`,{className:`mb-4 flex items-center gap-2 text-[14px] font-medium`,children:[(0,V.jsx)(ew,{size:15,className:`text-muted`}),(0,V.jsx)(`span`,{children:`Investigate this issue and make recommendations`}),(0,V.jsx)(`span`,{className:`text-muted/40`,children:`—`}),(0,V.jsx)(`span`,{className:`font-mono-keep text-[12.5px] text-muted`,children:D})]}),(0,V.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,V.jsx)(V7,{value:o,onChange:e=>C(e),options:[{value:`issues`,label:`Issues`},{value:`prs`,label:`PRs`}]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps text-[11px] text-muted/70`,children:`Sort`}),(0,V.jsx)(V7,{value:c,onChange:w,options:[{value:`recent`,label:`Recent`},{value:`reactions`,label:`Reactions`}]})]})]}),(0,V.jsx)(`div`,{ref:x,className:`min-h-[240px] flex-1 overflow-y-auto rounded-lg border border-border/70 bg-bg/40 transition-opacity ${g.isPlaceholderData?`opacity-40`:``}`,children:g.isLoading?(0,V.jsx)(zte,{}):g.isError?(0,V.jsxs)(W7,{children:[(0,V.jsxs)(`span`,{className:`text-[12.5px] text-muted/80`,children:[`Couldn't load `,o===`issues`?`issues`:`pull requests`,`.`]}),(0,V.jsx)(`span`,{className:`max-w-[80%] text-center text-[11px] text-muted/45`,children:g.error.message.slice(0,140)})]}):_.length===0?(0,V.jsxs)(W7,{children:[(0,V.jsx)(iw,{size:28,strokeWidth:1.25,className:`text-muted/30`}),(0,V.jsxs)(`span`,{className:`text-[12.5px] text-muted/60`,children:[`No open `,o===`issues`?`issues`:`pull requests`]})]}):_.map(e=>(0,V.jsx)(Fte,{item:e,checked:f.has(e.number),onActivate:t=>T(e.number,t)},e.number))}),!g.isLoading&&!g.isError&&(0,V.jsxs)(`div`,{className:`mt-2.5 flex items-center justify-between gap-3 whitespace-nowrap text-[11.5px] text-muted/60`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,V.jsxs)(`span`,{className:`truncate tabular-nums`,children:[b,` open `,o===`issues`?b===1?`issue`:`issues`:b===1?`pull request`:`pull requests`]}),O>0&&(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`text-muted/30`,children:`·`}),(0,V.jsxs)(`span`,{className:`tabular-nums text-fg/70`,children:[O,` selected`]}),(0,V.jsx)(`button`,{onClick:E,onMouseDown:e=>e.preventDefault(),className:`rounded py-0.5 text-muted/60 underline-offset-2 outline-none transition-colors hover:text-fg hover:underline`,children:`Clear`})]})]}),y>1&&(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,V.jsx)(B7,{label:`Previous page`,disabled:v<=1,onClick:()=>d(Math.max(1,v-1)),children:(0,V.jsx)(NC,{size:14})}),(0,V.jsxs)(`span`,{className:`relative px-2 text-center tabular-nums`,children:[(0,V.jsxs)(`span`,{"aria-hidden":!0,className:`invisible`,children:[`Page `,y,` of `,y]}),(0,V.jsxs)(`span`,{className:`absolute inset-0`,children:[`Page `,v,` of `,y]})]}),(0,V.jsx)(B7,{label:`Next page`,disabled:v>=y,onClick:()=>d(Math.min(y,v+1)),children:(0,V.jsx)(PC,{size:14})})]})]}),(0,V.jsxs)(`div`,{className:`mt-4 flex items-end justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(yU,{groups:k,value:n?{provider:n.backend,model:n.model,effort:n.effort}:void 0,onValueChange:e=>a({field:`profile`,backend:e.provider,model:e.model,effort:e.effort}),placeholder:i?`Profile unavailable`:`Profile loading…`,ariaLabel:`Model and effort`,title:M??`Model and reasoning effort for every thread this batch starts`,disabled:!n,side:`top`,menuZClass:CV,className:`max-w-[min(21rem,60vw)]`}),j&&(0,V.jsx)(`p`,{className:`mt-1 max-w-[430px] text-[10.5px] text-red-400`,children:j})]}),(0,V.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,V.jsxs)(`button`,{disabled:O===0||S.isPending||!!M,onClick:N,onMouseDown:e=>e.preventDefault(),className:`flex items-center gap-2 rounded-md bg-fg px-3.5 py-1.5 text-[12.5px] font-medium text-bg outline-none transition-all hover:opacity-90 active:scale-95 disabled:opacity-30 disabled:hover:opacity-30`,children:[S.isPending&&(0,V.jsx)(cw,{size:13,className:`animate-spin`}),O<=1?`Start investigation`:`Start ${O} investigations`]})})]})]})})}function B7({label:e,disabled:t,onClick:n,children:r}){return(0,V.jsx)(`button`,{type:`button`,"aria-label":e,title:e,disabled:t,onClick:n,onMouseDown:e=>e.preventDefault(),className:`inline-flex h-[22px] w-[22px] items-center justify-center rounded-md border border-border/70 text-muted/70 outline-none transition-colors hover:border-border hover:bg-elevated hover:text-fg disabled:pointer-events-none disabled:opacity-30`,children:r})}function V7({value:e,onChange:t,options:n}){return(0,V.jsx)(`div`,{className:`inline-flex items-center gap-0.5 rounded-lg border border-border bg-panel-2 p-0.5`,children:n.map(n=>(0,V.jsx)(`button`,{onClick:()=>t(n.value),onMouseDown:e=>e.preventDefault(),className:`rounded-md px-3 py-1 text-[12px] font-medium outline-none transition-colors ${e===n.value?`bg-elevated text-fg shadow-sm shadow-black/20`:`text-muted hover:text-fg`}`,children:n.label},n.value))})}function Mte({item:e}){let t=(e.state??`OPEN`).toUpperCase();return e.kind===`pr`?t===`MERGED`?(0,V.jsx)(XC,{size:15,className:`shrink-0 text-purple-400`}):t===`CLOSED`?(0,V.jsx)(ZC,{size:15,className:`shrink-0 text-red-400`}):e.isDraft?(0,V.jsx)(QC,{size:15,className:`shrink-0 text-muted/70`}):(0,V.jsx)($C,{size:15,className:`shrink-0 text-emerald-500`}):t===`CLOSED`?(0,V.jsx)(LC,{size:15,className:`shrink-0 text-purple-400`}):(0,V.jsx)(zC,{size:15,className:`shrink-0 text-emerald-500`})}function Nte(e){if(!e)return``;let t=Date.parse(e);if(!Number.isFinite(t))return``;let n=Math.max(0,(Date.now()-t)/1e3),r=n/60,i=r/60,a=i/24;return n<45?`just now`:r<60?`${Math.round(r)}m ago`:i<24?`${Math.round(i)}h ago`:a<30?`${Math.round(a)}d ago`:a<365?`${Math.round(a/30)}mo ago`:`${Math.round(a/365)}y ago`}function Pte({name:e,color:t}){let n=/^[0-9a-fA-F]{6}$/.test(t)?`#${t}`:void 0;return(0,V.jsx)(`span`,{className:`max-w-[130px] shrink-0 truncate rounded-full border px-1.5 py-px text-[9.5px] leading-[13px]`,style:n?{borderColor:`${n}59`,color:n,backgroundColor:`${n}14`}:void 0,title:e,children:e})}function Fte({item:e,checked:t,onActivate:n}){let r=Nte(e.createdAt),i=[e.author,r?`opened ${r}`:``].filter(Boolean).join(` `);return(0,V.jsxs)(`div`,{role:`button`,tabIndex:0,"data-row-number":e.number,"aria-pressed":t,onClick:e=>n(e.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(e.shiftKey))},className:`group flex w-full cursor-pointer items-start gap-2.5 border-b border-border/40 px-3 py-2.5 text-left outline-none transition-colors last:border-b-0 hover:bg-white/[0.03]`,children:[(0,V.jsx)(`span`,{className:`mt-px shrink-0`,children:(0,V.jsx)(Ite,{checked:t})}),(0,V.jsx)(`span`,{className:`mt-px`,children:(0,V.jsx)(Mte,{item:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,V.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,onClick:e=>e.stopPropagation(),title:e.title,className:`min-w-0 truncate text-[13px] font-medium text-fg/90 hover:underline`,children:e.title}),e.labels.slice(0,4).map(e=>(0,V.jsx)(Pte,{name:e.name,color:e.color},e.name))]}),(0,V.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] text-muted/55`,children:[(0,V.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,onClick:e=>e.stopPropagation(),className:`shrink-0 tabular-nums hover:text-muted hover:underline`,children:[`#`,e.number]}),i?(0,V.jsxs)(`span`,{className:`truncate`,children:[`· `,i]}):null]})]}),(0,V.jsxs)(`span`,{className:`mt-px flex shrink-0 items-center gap-2.5 text-[11.5px] text-muted/70`,children:[e.linkedPrs?(0,V.jsx)(Rte,{prs:e.linkedPrs}):null,e.comments?(0,V.jsx)(U7,{icon:uw,n:e.comments,label:`comments`}):null,e.reactions?(0,V.jsx)(U7,{emoji:`👍`,n:e.reactions,label:`reactions`}):null]})]})}function Ite({checked:e}){return(0,V.jsx)(`span`,{className:`inline-flex h-[15px] w-[15px] items-center justify-center rounded-[4px] border transition-colors ${e?`border-fg bg-fg`:`border-muted/45 group-hover:border-muted/80`}`,children:e&&(0,V.jsx)(jC,{size:11,strokeWidth:3,className:`text-bg`})})}var H7={octicon:`-0.1em`,stroke:`-0.112em`};function Lte({size:e=12,className:t}){return(0,V.jsx)(`svg`,{viewBox:`0 0 16 16`,width:e,height:e,fill:`currentColor`,"aria-hidden":!0,className:t,style:{transform:`translateY(${H7.octicon})`},children:(0,V.jsx)(`path`,{d:`M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z`})})}function Rte({prs:e}){let t=e.state.toUpperCase()===`MERGED`,n=e.count>1?`${e.count} linked pull requests — `:``,r=t?`#${e.number} merged`:e.isDraft?`#${e.number} open (draft)`:`#${e.number} open`;return(0,V.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,onClick:e=>e.stopPropagation(),title:`${n}${r}`,className:`inline-flex items-center gap-1 tabular-nums hover:text-fg/90`,children:[(0,V.jsx)(Lte,{size:12}),e.count]})}function U7({icon:e,emoji:t,n,label:r}){return(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 tabular-nums`,title:`${n} ${r}`,children:[t?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`text-[11px] leading-none`,children:t}):e?(0,V.jsx)(`span`,{className:`inline-flex`,style:{transform:`translateY(${H7.stroke})`},children:(0,V.jsx)(e,{size:12,strokeWidth:2})}):null,n]})}function zte(){return(0,V.jsx)(`div`,{className:`animate-pulse`,children:Array.from({length:6}).map((e,t)=>(0,V.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border/40 px-3 py-2.5 last:border-b-0`,children:[(0,V.jsx)(`span`,{className:`h-[15px] w-[15px] shrink-0 rounded-[4px] bg-muted/20`}),(0,V.jsx)(`span`,{className:`h-3 w-8 shrink-0 rounded bg-muted/20`}),(0,V.jsx)(`span`,{className:`h-3 flex-1 rounded bg-muted/15`,style:{maxWidth:`${55+t*7%35}%`}})]},t))})}function W7({children:e}){return(0,V.jsx)(`div`,{className:`flex h-full min-h-[240px] flex-col items-center justify-center gap-1.5`,children:e})}var G7={permissionMode:`The permission mode new Claude Code threads launch with. Auto runs safe actions and asks you to approve the risky ones in the thread. Bypass launches the worker with --dangerously-skip-permissions: it never asks, so nothing waits on you and nothing is checked either. Takes effect on the next thread you dispatch; to change a thread that already exists, use the picker beside its model in the prompt box. Codex threads always run with full workspace access and are unaffected.`,font:`Changes the interface reading font for this browser.`,localFileOpener:`Chooses how vetted local artifact links open. Markdown files open in Frizz's own reader (which carries an Open action that uses this setting), and image clicks always use the OS default viewer.`,density:`How much of a diff shows before you ask for it, in this browser. Compact collapses every diff to its header row (click one to open it); Comfortable shows them in full. Applies immediately.`,stickyUserMessage:`Keeps your most recent message stuck to the top of a thread while the reply scrolls underneath. It stays collapsed to a small card (hover to expand it) so a long message never blocks much of the view. Applies immediately in this browser.`,queueOrder:`Orders the Needs-you queue and the sidebar's rested threads by when each was last active. Oldest first (FIFO, default) surfaces the longest-waiting item first so you cycle through everything; Newest first (LIFO) keeps the most recently active on top. Applies immediately in this browser.`,notifications:`Shows a desktop notification when work needs attention while this window is hidden.`,projectRail:`Shows a permanent column of every project on this machine down the left edge. Off by default: Frizz's home is one board, and a standing list of the others is an easy way to leave the thread you were in. With it off, the home crumb in the status bar is the way back to the projects page.`};function Bte(){return typeof Notification>`u`?`unsupported`:Notification.permission}var Vte=500,Hte=1600,Ute=2e3,Wte=6;function Gte(){let[e,t]=(0,B.useState)(`idle`),n=(0,B.useRef)(null),r=(0,B.useRef)(void 0),i=(0,B.useRef)(Promise.resolve()),a=(0,B.useRef)(0),o=(0,B.useRef)(void 0),s=(0,B.useRef)(0),c=(0,B.useRef)(()=>{}),l=(0,B.useCallback)(()=>{r.current!==void 0&&window.clearTimeout(r.current),r.current=void 0;let e=n.current;e&&(n.current=null,a.current+=1,t(`saving`),i.current=i.current.then(()=>X.settingsSet(e)).then(e=>{$9.setQueryData([`settingsGet`],e),--a.current,s.current=0,!(a.current>0||n.current)&&(t(`saved`),o.current!==void 0&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>t(`idle`),Hte))}).catch(i=>{--a.current,t(`error`),!(n.current||!Qx(i)||s.current>=Wte)&&(s.current+=1,n.current=e,r.current=window.setTimeout(c.current,Ute))}))},[]);c.current=l;let u=(0,B.useCallback)((e,t=!1)=>{if(n.current=e,s.current=0,r.current!==void 0&&window.clearTimeout(r.current),r.current=void 0,!t)return l();r.current=window.setTimeout(l,Vte)},[l]);return(0,B.useEffect)(()=>()=>{l(),o.current!==void 0&&window.clearTimeout(o.current)},[l]),{state:e,queue:u,flush:l}}function Kte(){let e=qd({queryKey:[`settingsGet`],queryFn:()=>X.settingsGet()}),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(Bte()),{state:a,queue:o,flush:s}=Gte(),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=requestAnimationFrame(()=>l(!0));return()=>cancelAnimationFrame(e)},[]),(0,B.useEffect)(()=>(rx(p),()=>rx(null)),[]),(0,B.useEffect)(()=>{e.data&&!t&&n(e.data)},[e.data,t]);let f=(0,B.useCallback)((e,t)=>{n(e),o(e,t?.debounce)},[o]);function p(){u||(s(),d(!0),l(!1),window.setTimeout(()=>Z.showSettings=!1,cC()?0:210))}async function m(e){if(t){if(e&&typeof Notification<`u`&&Notification.permission==="default"){let e=await Notification.requestPermission();i(e)}f({...t,notifications:e})}}return(0,V.jsx)(`div`,{className:`${aC} z-50 flex justify-end ${c?`opacity-100`:`opacity-0`}`,onMouseDown:e=>e.target===e.currentTarget&&p(),children:(0,V.jsxs)(`div`,{className:`${oC} w-[560px] max-w-[94vw] ${c?`translate-x-0`:`translate-x-full`}`,children:[(0,V.jsx)(Mw,{title:`Settings`,actions:(0,V.jsx)(qte,{state:a}),onClose:p}),t?(0,V.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-5 flex flex-col gap-6`,children:[(0,V.jsx)(q7,{label:`Font`,help:G7.font,children:(0,V.jsx)($te,{value:t.font??`mono`,onChange:e=>f({...t,font:e})})}),(0,V.jsx)(q7,{label:`Project sidebar`,help:G7.projectRail,children:(0,V.jsx)(j2,{variant:`bordered`,value:t.projectRail?`shown`:`hidden`,onValueChange:e=>f({...t,projectRail:e===`shown`}),options:[{value:`hidden`,label:`Hidden`},{value:`shown`,label:`Always shown`}],indicatorPosition:`right`,ariaLabel:`Project sidebar`})}),(0,V.jsx)(q7,{label:`Local file links`,help:G7.localFileOpener,children:(0,V.jsx)(j2,{variant:`bordered`,value:t.localFileOpener??`system`,onValueChange:e=>f({...t,localFileOpener:e}),options:[{value:`system`,label:`System default`},{value:`cursor`,label:`Cursor`},{value:`vscode`,label:`VS Code`},{value:`finder`,label:`Reveal in Finder`},{value:`copy`,label:`Copy path`}],indicatorPosition:`right`,ariaLabel:`Local file link opener`})}),(0,V.jsx)(q7,{label:`Density`,help:G7.density,children:(0,V.jsx)(ene,{})}),(0,V.jsx)(q7,{label:`Sticky message`,help:G7.stickyUserMessage,children:(0,V.jsx)(tne,{})}),(0,V.jsx)(q7,{label:`Queue order`,help:G7.queueOrder,children:(0,V.jsx)(nne,{})}),(0,V.jsxs)(q7,{label:`Desktop notifications`,help:G7.notifications,children:[(0,V.jsx)(Y7,{value:t.notifications,onChange:m}),t.notifications&&(0,V.jsx)(ine,{perm:r})]}),(0,V.jsx)(Yte,{draft:t,setDraft:f}),(0,V.jsx)(Xte,{draft:t,setDraft:f})]}):(0,V.jsx)(`div`,{className:`p-4 text-[13px] text-muted`,children:`Loading…`})]})})}function qte({state:e}){return e===`idle`?null:e===`error`?(0,V.jsx)(`span`,{className:`text-[11px] font-normal text-accent`,children:`Couldn't save`}):(0,V.jsx)(`span`,{className:`text-[11px] font-normal text-muted transition-opacity ${e===`saved`?`opacity-70`:`opacity-100`}`,children:e===`saving`?`Saving…`:`Saved`})}function K7({label:e,help:t}){return(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] uppercase tracking-wide text-muted`,children:[e,(0,V.jsx)(Pq,{label:t,side:`right`,clickable:!0,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":`About ${e}`,className:`inline-flex size-4 items-center justify-center text-muted/60 hover:text-fg transition-colors`,children:(0,V.jsx)(BC,{size:12})})})]})}function q7({label:e,help:t,children:n}){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(K7,{label:e,help:t}),n]})}var Jte=[{token:`repo`,gloss:`repository`},{token:`n`,gloss:`number`},{token:`title`,gloss:`title`},{token:`url`,gloss:`link`},{token:`labels`,gloss:`labels`},{token:`body`,gloss:`description`}];function Yte({draft:e,setDraft:t}){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,V.jsx)(J7,{label:`Claude`}),(0,V.jsxs)(q7,{label:`Permissions`,help:G7.permissionMode,children:[(0,V.jsx)(j2,{variant:`bordered`,value:e.permissionMode===`bypassPermissions`?`bypassPermissions`:`auto`,onValueChange:n=>t({...e,permissionMode:n}),options:jU,indicatorPosition:`right`,ariaLabel:`Claude permission mode`}),e.permissionMode===`bypassPermissions`&&(0,V.jsx)(rne,{})]})]})}function Xte({draft:e,setDraft:t}){let n=qd({queryKey:[`githubPromptDefaults`],queryFn:()=>X.githubPromptDefaults()});return(0,V.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,V.jsx)(J7,{label:`Prompts`}),n.data?(0,V.jsx)(Qte,{label:`Issue and PR triage prompt`,help:`The prompt for every item dispatched from the GitHub picker, issues and PRs alike. The default has the worker read the whole thread, classify it, and branch — reproduce + fix-plan for a bug, a plan for a feature, an adversarial review for a PR.`,value:e.githubPrompt,fallback:n.data.prompt,onChange:(n,r)=>t({...e,githubPrompt:n},r)}):(0,V.jsx)(`div`,{className:`text-[12px] text-muted`,children:`Loading defaults…`})]})}function J7({label:e}){return(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5 text-[11px] uppercase tracking-wide text-muted/70`,children:[(0,V.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border/60`}),(0,V.jsx)(`span`,{className:`shrink-0`,children:e}),(0,V.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border/60`})]})}function Zte(){let[e,t]=(0,B.useState)(!1);return(0,V.jsxs)(nK,{open:e,onOpenChange:t,children:[(0,V.jsx)(rK,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:`shrink-0 text-[11px] transition-colors ${e?`text-accent`:`text-muted hover:text-accent`}`,children:`Tokens`})}),(0,V.jsxs)(aK,{side:`top`,align:`end`,className:`w-56 p-3`,children:[(0,V.jsx)(`div`,{className:`mb-2 text-[11px] font-medium text-fg`,children:`Substitution tokens`}),(0,V.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:Jte.map(({token:e,gloss:t})=>(0,V.jsxs)(`li`,{className:`flex items-center justify-between gap-3 text-[11px]`,children:[(0,V.jsx)(`code`,{className:`font-mono-keep rounded border border-border bg-bg px-1 py-0.5 text-[10px] text-fg/80`,children:`{${e}}`}),(0,V.jsx)(`span`,{className:`text-muted/80`,children:t})]},e))})]})]})}function Qte({label:e,help:t,value:n,fallback:r,onChange:i}){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,V.jsx)(K7,{label:e,help:t}),(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[n!=null&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:`text-[11px] text-muted hover:text-accent transition-colors`,onClick:()=>i(void 0),children:`Reset to default`}),(0,V.jsx)(`span`,{"aria-hidden":!0,className:`text-[11px] text-muted/40`,children:`·`})]}),(0,V.jsx)(Zte,{})]})]}),(0,V.jsx)(`textarea`,{value:n??r,onChange:e=>i(e.target.value===``?void 0:e.target.value,{debounce:!0}),rows:10,className:`input resize-none text-[12px] leading-relaxed font-mono-keep`,spellCheck:!1})]})}function $te({value:e,onChange:t}){return(0,V.jsx)(`div`,{className:`inline-flex w-fit rounded-md border border-border bg-bg p-0.5`,children:[{v:`mono`,label:`Mono`,cls:``},{v:`sans`,label:`Sans`,cls:``}].map(n=>(0,V.jsx)(`button`,{onClick:()=>t(n.v),className:`rounded px-3 py-1 text-[12px] transition-colors ${n.cls} ${e===n.v?`bg-fg text-bg`:`text-muted hover:text-fg`}`,children:n.label},n.v))})}function Y7({value:e,onChange:t}){return(0,V.jsx)(`div`,{className:`inline-flex w-fit rounded-md border border-border bg-bg p-0.5`,children:[{v:!1,label:`Off`},{v:!0,label:`On`}].map(n=>(0,V.jsx)(`button`,{onClick:()=>t(n.v),className:`rounded px-3 py-1 text-[12px] transition-colors ${e===n.v?`bg-fg text-bg`:`text-muted hover:text-fg`}`,children:n.label},n.label))})}function ene(){let{compactDiffs:e}=Hf(zj);return(0,V.jsx)(`div`,{className:`inline-flex w-fit rounded-md border border-border bg-bg p-0.5`,children:[{v:!1,label:`Comfortable`},{v:!0,label:`Compact`}].map(t=>(0,V.jsx)(`button`,{onClick:()=>zj.compactDiffs=t.v,className:`rounded px-3 py-1 text-[12px] transition-colors ${e===t.v?`bg-fg text-bg`:`text-muted hover:text-fg`}`,children:t.label},t.label))})}function tne(){let{stickyUserMessage:e}=Hf(zj);return(0,V.jsx)(Y7,{value:e,onChange:e=>zj.stickyUserMessage=e})}function nne(){let{queueOrder:e}=Hf(zj);return(0,V.jsx)(`div`,{className:`inline-flex w-fit rounded-md border border-border bg-bg p-0.5`,children:[{v:`fifo`,label:`Oldest first`},{v:`lifo`,label:`Newest first`}].map(t=>(0,V.jsx)(`button`,{onClick:()=>zj.queueOrder=t.v,className:`rounded px-3 py-1 text-[12px] transition-colors ${e===t.v?`bg-fg text-bg`:`text-muted hover:text-fg`}`,children:t.label},t.v))})}function rne(){return(0,V.jsx)(`span`,{className:`text-[11px] text-muted/70`,children:`New Claude threads will run every command, edit, and network call without asking you first.`})}function ine({perm:e}){return e===`denied`?(0,V.jsx)(one,{}):(0,V.jsx)(`span`,{className:`text-[11px] text-muted/70`,children:{granted:`Browser permission granted — notifications fire when the window is hidden.`,default:`Browser permission not yet granted — notifications won't fire until you allow them.`,unsupported:`This browser does not support desktop notifications.`}[e]})}function ane(){let e=typeof navigator<`u`?navigator.userAgent:``;return/Firefox\//.test(e)?`firefox`:/Edg\//.test(e)?`edge`:/OPR\/|Brave\//.test(e)?`other`:/Chrome\//.test(e)?`chrome`:/Safari\//.test(e)?`safari`:`other`}function one(){let e=(0,B.useMemo)(ane,[]),t=typeof location<`u`?location.origin:``,n=`${e===`edge`?`edge`:`chrome`}://settings/content/siteDetails?site=${encodeURIComponent(t)}`;return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 text-[11px] text-muted/70`,children:[(0,V.jsx)(`span`,{children:`Notifications are blocked for this site. Re-enable them in your browser, then reload.`}),e===`chrome`||e===`edge`?(0,V.jsx)(cne,{url:n,hint:`Paste this into a new tab, set Notifications → Allow:`}):e===`safari`?(0,V.jsxs)(`span`,{children:[`Safari → Settings → Websites → Notifications → allow `,sne(t),`, then reload.`]}):e===`firefox`?(0,V.jsx)(`span`,{children:`Firefox → Settings → Privacy & Security → Permissions → Notifications → Settings → allow this site.`}):(0,V.jsx)(`span`,{children:`Open this site's notification permission in your browser's settings and set it to Allow.`})]})}function sne(e){try{return new URL(e).host}catch{return e}}function cne({url:e,hint:t}){let[n,r]=(0,B.useState)(!1);async function i(){try{await bU(e),r(!0),window.setTimeout(()=>r(!1),1500)}catch{}}return(0,V.jsxs)(`span`,{className:`flex w-full flex-col gap-1`,children:[(0,V.jsx)(`span`,{children:t}),(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,V.jsx)(`code`,{className:`min-w-0 flex-1 font-mono-keep select-all rounded border border-border bg-bg px-1.5 py-0.5 text-[10.5px] text-fg/90 break-all`,children:e}),(0,V.jsx)(`button`,{type:`button`,onClick:i,"aria-label":`Copy address`,className:`shrink-0 rounded border border-border p-1 text-muted hover:bg-panel-2 hover:text-fg transition-colors`,children:n?(0,V.jsx)(jC,{size:11,className:`text-live`}):(0,V.jsx)(WC,{size:11})})]})]})}var X7=1,lne=.9,une=.8,dne=.17,Z7=.1,Q7=.999,fne=.9999,pne=.99,mne=/[\\\/_+.#"@\[\(\{&]/,hne=/[\\\/_+.#"@\[\(\{&]/g,gne=/[\s-]/,$7=/[\s-]/g;function e9(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?X7:pne;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=e9(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=X7:mne.test(e.charAt(l-1))?(d*=une,p=e.slice(i,l-1).match(hne),p&&i>0&&(d*=Q7**+p.length)):gne.test(e.charAt(l-1))?(d*=lne,m=e.slice(i,l-1).match($7),m&&i>0&&(d*=Q7**+m.length)):(d*=dne,i>0&&(d*=Q7**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=fne)),(d<Z7&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=e9(e,t,n,r,l+1,a+2,o),f*Z7>d&&(d=f*Z7)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function t9(e){return e.toLowerCase().replace($7,` `)}function _ne(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,e9(e,t,t9(e),t9(t),0,0,{})}var n9=`[cmdk-group=""]`,r9=`[cmdk-group-items=""]`,vne=`[cmdk-group-heading=""]`,i9=`[cmdk-item=""]`,a9=`${i9}:not([aria-disabled="true"])`,o9=`cmdk-item-select`,s9=`data-value`,yne=(e,t,n)=>_ne(e,t,n),c9=B.createContext(void 0),l9=()=>B.useContext(c9),u9=B.createContext(void 0),d9=()=>B.useContext(u9),f9=B.createContext(void 0),p9=B.forwardRef((e,t)=>{let n=_9(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=_9(()=>new Set),i=_9(()=>new Map),a=_9(()=>new Map),o=_9(()=>new Set),s=h9(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=PP(),y=PP(),b=PP(),x=B.useRef(null),S=Ane();g9(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),g9(()=>{S(6,k)},[]);let C=B.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=B.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??yne;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(r9);t?t.appendChild(e.parentElement===t?e:e.closest(`${r9} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${r9} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${n9}[${s9}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(s9);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(n9)?.querySelector(vne))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${i9}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(a9)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(s9))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(s9))}function P(e){let t=A()?.closest(n9),n;for(;t&&!n;)t=e>0?One(t,n9):kne(t,n9),n=t?.querySelector(a9);n?C.setState(`value`,n.getAttribute(s9)):N(e)}let ee=()=>M(j().length-1),F=e=>{e.preventDefault(),e.metaKey?ee():e.altKey?P(1):N(1)},te=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return B.createElement(KN.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&F(e);break;case`ArrowDown`:F(e);break;case`p`:case`k`:g&&e.ctrlKey&&te(e);break;case`ArrowUp`:te(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),ee();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(o9);t.dispatchEvent(e)}}}}},B.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:Mne},c),b9(e,e=>B.createElement(u9.Provider,{value:C},B.createElement(c9.Provider,{value:w},e))))}),bne=B.forwardRef((e,t)=>{let n=PP(),r=B.useRef(null),i=B.useContext(f9),a=l9(),o=h9(e),s=o.current?.forceMount??i?.forceMount;g9(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=y9(n,r,[e.value,e.children,r],e.keywords),l=d9(),u=v9(e=>e.value&&e.value===c.current),d=v9(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);B.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(o9,f),()=>t.removeEventListener(o9,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return B.createElement(KN.div,{ref:xN(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),xne=B.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=PP(),s=B.useRef(null),c=B.useRef(null),l=PP(),u=l9(),d=v9(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);g9(()=>u.group(o),[]),y9(o,s,[e.value,e.heading,c]);let f=B.useMemo(()=>({id:o,forceMount:i}),[i]);return B.createElement(KN.div,{ref:xN(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&B.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),b9(e,e=>B.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},B.createElement(f9.Provider,{value:f},e))))}),Sne=B.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=B.useRef(null),a=v9(e=>!e.search);return!n&&!a?null:B.createElement(KN.div,{ref:xN(i,t),...r,"cmdk-separator":``,role:`separator`})}),Cne=B.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=d9(),o=v9(e=>e.search),s=v9(e=>e.selectedItemId),c=l9();return B.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),B.createElement(KN.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),wne=B.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=B.useRef(null),o=B.useRef(null),s=v9(e=>e.selectedItemId),c=l9();return B.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),B.createElement(KN.div,{ref:xN(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},b9(e,e=>B.createElement(`div`,{ref:xN(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Tne=B.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return B.createElement(FV,{open:n,onOpenChange:r},B.createElement(VV,{container:o},B.createElement(UV,{"cmdk-overlay":``,className:i}),B.createElement(qV,{"aria-label":e.label,"cmdk-dialog":``,className:a},B.createElement(p9,{ref:t,...s}))))}),Ene=B.forwardRef((e,t)=>v9(e=>e.filtered.count===0)?B.createElement(KN.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Dne=B.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return B.createElement(KN.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},b9(e,e=>B.createElement(`div`,{"aria-hidden":!0},e)))}),m9=Object.assign(p9,{List:wne,Item:bne,Input:Cne,Group:xne,Separator:Sne,Dialog:Tne,Empty:Ene,Loading:Dne});function One(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function kne(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function h9(e){let t=B.useRef(e);return g9(()=>{t.current=e}),t}var g9=typeof window>`u`?B.useEffect:B.useLayoutEffect;function _9(e){let t=B.useRef();return t.current===void 0&&(t.current=e()),t}function v9(e){let t=d9(),n=()=>e(t.snapshot());return B.useSyncExternalStore(t.subscribe,n,n)}function y9(e,t,n,r=[]){let i=B.useRef(),a=l9();return g9(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(s9,s),i.current=s}),i}var Ane=()=>{let[e,t]=B.useState(),n=_9(()=>new Map);return g9(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function jne(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function b9({asChild:e,children:t},n){return e&&B.isValidElement(t)?B.cloneElement(jne(t),{ref:t.ref},n(t.props.children)):n(t)}var Mne={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function Nne(){let e=Hf(Z),t=$A(),[n,r]=(0,B.useState)(``);if((0,B.useEffect)(()=>{e.showPalette&&r(``)},[e.showPalette]),!e.showPalette)return null;let i=tM(tj(t?.threads??[])),a=e.drawers.length?[...e.drawers].reverse().find(e=>e.kind===`thread`)?.slug:void 0,o=t?.threads.find(e=>e.id===a);function s(){Z.showPalette=!1}function c(e){e(),s()}function l(e){US(e)}return(0,V.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-start justify-center bg-black/50 pt-[12vh]`,onMouseDown:e=>e.target===e.currentTarget&&s(),children:(0,V.jsxs)(m9,{label:`Command palette`,className:`w-[560px] max-w-[92vw] rounded-lg border border-border bg-panel shadow-2xl overflow-hidden`,filter:(e,t,n)=>+!!e.toLowerCase().includes(t.toLowerCase()),children:[(0,V.jsx)(m9.Input,{autoFocus:!0,value:n,onValueChange:r,placeholder:`Jump to a thread or run a command…`,className:`w-full px-4 h-12 bg-transparent outline-none border-b border-border text-sm placeholder:text-muted`}),(0,V.jsxs)(m9.List,{className:`max-h-[52vh] overflow-y-auto py-1.5`,children:[(0,V.jsx)(m9.Empty,{className:`px-4 py-6 text-center text-sm text-muted`,children:`No matches.`}),(0,V.jsxs)(m9.Group,{heading:`Actions`,className:`cmdk-group`,children:[(0,V.jsx)(x9,{value:`new thread create home`,onSelect:()=>c(()=>jS()),children:`New thread`}),(0,V.jsx)(x9,{value:`queue todos inbox pending`,onSelect:()=>c(()=>{QS(Z.drawers.map(e=>e.id)),Z.view=`todos`}),children:`Queue`}),(0,V.jsx)(x9,{value:`open settings preferences`,onSelect:()=>c(()=>Z.showSettings=!0),children:`Open settings`}),o&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x9,{value:`open details drawer doc ${Uj(o)}`,onSelect:()=>c(()=>{let e=$S();e&&BS(`doc`,e)}),children:`Open thread details`}),(0,V.jsxs)(x9,{value:`mark complete done ${Uj(o)}`,onSelect:()=>c(()=>X.markComplete({slug:o.id}).catch(()=>{})),children:[`Mark “`,Uj(o),`” complete`]}),(0,V.jsxs)(x9,{value:`mark read ${Uj(o)}`,onSelect:()=>c(()=>X.markRead({slug:o.id}).catch(()=>{})),children:[`Mark “`,Uj(o),`” read`]})]})]}),i.length>0&&(0,V.jsx)(m9.Group,{heading:`Threads`,className:`cmdk-group`,children:i.map(e=>(0,V.jsxs)(x9,{value:`${Uj(e)} ${e.id}`,onSelect:()=>c(()=>l(e.id)),children:[(0,V.jsx)(`span`,{className:`truncate`,children:Uj(e)}),(0,V.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted/70`,children:e.id})]},e.id))})]})]})})}function x9({value:e,onSelect:t,children:n}){return(0,V.jsx)(m9.Item,{value:e,onSelect:t,className:`mx-1.5 px-2.5 py-1.5 rounded flex items-center gap-2 text-sm cursor-pointer data-[selected=true]:bg-panel-2 data-[selected=true]:text-fg text-muted`,children:n})}var S9=`Updating and restarting Frizz`,Pne=`This may take a moment while the new build is being prepared. All of your threads will continue running normally.`;function Fne(e){if(e.key===`Tab`||e.key===`Enter`)return!0;if(e.metaKey||e.ctrlKey){let t=e.key.toLowerCase();if(t===`k`||t===`i`)return!0}return!1}function Ine({open:e,message:t}){let n=(0,B.useRef)(null);if((0,B.useEffect)(()=>{if(!e)return;let t=document.activeElement;t instanceof HTMLElement&&t.blur(),n.current?.focus({preventScroll:!0});let r=e=>{Fne(e)&&(e.preventDefault(),e.stopImmediatePropagation())};return window.addEventListener(`keydown`,r,{capture:!0}),()=>window.removeEventListener(`keydown`,r,{capture:!0})},[e]),!e)return null;let r=t?.trim()?t.trim():null;return(0,V.jsx)(`div`,{role:`alertdialog`,"aria-modal":`true`,"aria-label":S9,className:`fixed inset-0 z-[300] flex items-center justify-center bg-black/55 px-4 backdrop-blur-md backdrop-saturate-150`,children:(0,V.jsxs)(`div`,{ref:n,tabIndex:-1,className:`w-[min(26rem,calc(100vw-2rem))] rounded-2xl border border-border-strong bg-elevated p-6 text-center shadow-2xl shadow-black/60 outline-none`,children:[(0,V.jsx)(`span`,{className:`mx-auto flex h-11 w-11 items-center justify-center rounded-full bg-fg/10 text-fg`,children:(0,V.jsx)(_w,{size:20,strokeWidth:2.25,className:`animate-spin`,"aria-hidden":`true`})}),(0,V.jsx)(`h2`,{className:`mt-4 text-[15px] font-semibold tracking-[-0.01em] text-fg`,children:S9}),(0,V.jsx)(`p`,{className:`mt-2 text-[12.5px] leading-relaxed text-muted`,children:Pne}),r&&(0,V.jsx)(`p`,{"aria-live":`polite`,className:`mt-2 text-[11.5px] leading-relaxed text-muted/80`,children:r})]})})}var C9=`frizz:reload-after-update-restart`,w9=!1;function Lne(){w9||(w9=!0,Q("Sign in to the GitHub CLI (`gh auth login`) to dispatch from issues/PRs.",{duration:6e3}))}function Rne(){let e=Hf(Z),t=(0,B.useRef)({projectDir:null,hasBeenVisible:!1});(0,B.useEffect)(()=>{X.board().then(nC).catch(()=>{})},[]);let n=XD();(0,B.useEffect)(()=>Bee((e,t)=>n(e,t)),[n]),(0,B.useEffect)(()=>{let e=!0,t,n=null,r=!1,i=async()=>{if(r)return;r=!0;let a=await TK();if(!e){r=!1;return}if(a){Z.controlPlaneRestartPending?a.state!==`ready`&&(Z.controlPlaneRestartPending=!1,Z.controlPlaneState=a.state,Z.controlPlaneMessage=a.message??null):(Z.controlPlaneState=a.state,Z.controlPlaneMessage=a.message??null);let e=sessionStorage.getItem(C9);if(a.state===`ready`&&e&&!Z.controlPlaneRestartPending){sessionStorage.removeItem(C9),window.location.replace(e),r=!1;return}a.state===`failed`&&e&&(sessionStorage.removeItem(C9),n!==a.message&&(n=a.message??`Update & Restart failed`,Q(`Update & Restart failed — Frizz kept running the previous version`,{duration:7e3})))}r=!1,t=setTimeout(i,Z.controlPlaneState===`restarting`?500:8e3)},a=()=>{t&&clearTimeout(t),i()};return window.addEventListener(xK,a),i(),()=>{e=!1,window.removeEventListener(xK,a),t&&clearTimeout(t)}},[]);let r=e.drawers.length>0||e.showSettings||e.showNewThread||e.showGithubPicker||e.showPalette;(0,B.useEffect)(()=>{if(!r)return;let e=window.scrollY,t=document.body;return hx(),t.style.position=`fixed`,t.style.top=`-${e}px`,t.style.left=`0`,t.style.right=`0`,t.style.width=`100%`,()=>{t.style.position=``,t.style.top=``,t.style.left=``,t.style.right=``,t.style.width=``,window.scrollTo(0,hx()??e)}},[r]);let i=qd({queryKey:[`settingsGet`],queryFn:()=>X.settingsGet()});(0,B.useEffect)(()=>{Z.notificationsEnabled=i.data?.notifications??!1},[i.data?.notifications]);let a=JH();(0,B.useEffect)(()=>{a.data?.inRepo&&!a.data.authed&&Lne()},[a.data?.inRepo,a.data?.authed]),(0,B.useEffect)(()=>{function e(e){if(e.target instanceof Element&&e.target.closest(`.xterm`)||!(e.metaKey||e.ctrlKey))return;let t=e.key.toLowerCase();if(t===`k`)e.preventDefault(),Z.showPalette=!Z.showPalette;else if(t===`i`){let t=YS(),n=$S();t?.kind===`doc`?(e.preventDefault(),cx(t.id)||Z.drawers.pop()):n&&(e.preventDefault(),BS(`doc`,n))}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let o=$A(),s=kY();(0,B.useEffect)(()=>{WS()},[o,e.routeThreadSlug]),t.current=Vee(t.current,o);let c=o!==null&&t.current.hasBeenVisible,l=o===null&&Hee(bx()),u=t.current.hasBeenVisible;(0,B.useEffect)(()=>{o!==null&&Uee(bx(),u)},[o,u]);let d=o?.projectLabel??o?.projectName;return(0,B.useEffect)(()=>{let e=window.matchMedia?.(`(display-mode: standalone)`).matches;document.title=e?d??`Frizz`:d?`${d} — Frizz`:`Frizz`},[d]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ine,{open:e.controlPlaneState===`restarting`,message:e.controlPlaneMessage}),(0,V.jsxs)(`div`,{inert:e.controlPlaneState===`restarting`,className:`relative min-h-screen bg-bg text-fg text-sm`,children:[s?(0,V.jsx)(CY,{}):(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(`div`,{className:`flex min-h-screen justify-center gap-[clamp(28px,3.4vw,52px)] px-5 max-[800px]:flex-col max-[800px]:justify-start max-[800px]:gap-0 max-[800px]:px-3`,children:[c&&(0,V.jsx)(Pw,{label:`the sidebar`,children:(0,V.jsx)(PJ,{})}),l&&(0,V.jsx)(`aside`,{"aria-hidden":!0,className:`sticky top-0 self-start h-screen w-[clamp(272px,34vw,680px)] shrink-0 flex flex-col justify-center max-[800px]:static max-[800px]:h-auto max-[800px]:w-full max-[800px]:justify-start max-[800px]:pt-16`,"data-sidebar-reserved":!0}),(0,V.jsx)(`main`,{id:`workpane`,className:`w-[720px] max-w-[62vw] min-w-0 flex flex-col py-5 max-[800px]:w-full max-[800px]:max-w-none ${e.view===`todos`||!o?`min-h-screen`:``} ${e.view===`todos`?``:`rounded-lg border border-border bg-panel`}`,children:o?(0,V.jsxs)(Pw,{label:`the queue`,resetKeys:[e.view],children:[e.view.startsWith(`status:`)&&(0,V.jsx)(oY,{status:e.view.slice(7)}),e.view===`todos`&&(0,V.jsx)(yte,{})]}):(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,V.jsx)(`span`,{className:`block h-5 w-5 rounded-full border-2 border-muted/50 border-t-transparent animate-spin`})})})]})}),(0,V.jsx)(x7,{}),e.showSettings&&(0,V.jsx)(Kte,{}),e.showNewThread&&(0,V.jsx)(lW,{onClose:()=>{Z.showNewThread=!1}}),e.showGithubPicker&&(0,V.jsx)(jte,{onClose:NS}),(0,V.jsx)(Nne,{})]})]})}function T9(e,t,n){let r=[...e];if(t<0||t>=r.length||n<0||n>=r.length||t===n)return r;let[i]=r.splice(t,1);return r.splice(n,0,i),r}function zne(e,t,n,r=48){let i=Math.round(t/r);return Math.max(0,Math.min(n-1,e+i))}function Bne(e,t,n,r=48){return e===t?0:n>t&&e>t&&e<=n?-r:n<t&&e>=n&&e<t?r:0}function E9(e,t,n=44,r=14){let i=t.top+n-e;if(i>0)return-Math.min(r,i/n*r);let a=e-(t.bottom-n);return a>0?Math.min(r,a/n*r):0}var Vne=`w-[57px]`,Hne=`max-[800px]:pl-0 pl-[57px]`;function Une(e){let t=0;for(let n=0;n<e.length;n++)t=(t*31+e.charCodeAt(n))%360;return t}function Wne(e){let t=e.split(/[\s\-_./]+/u).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[1][0]).toUpperCase()}function Gne(e){let t=e.iconVersion?`&v=${encodeURIComponent(e.iconVersion)}`:``;return`/_frizz/project-icon?id=${encodeURIComponent(e.id)}${t}`}function D9({project:e,size:t}){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1),o=Une(e.id),s=e.iconStatus!==`none`,[c,l]=(0,B.useState)(!1),u=!s||c;return(0,V.jsxs)(`span`,{className:`relative block overflow-hidden rounded-[30%] bg-elevated`,style:{width:t,height:t,background:s&&!c?void 0:`hsl(${o} 32% 24%)`},children:[u&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-0 flex items-center justify-center font-semibold leading-none`,style:{fontSize:t*.4,color:`hsl(${o} 55% 78%)`},children:(0,V.jsx)(`span`,{style:{textBox:`trim-both cap alphabetic`},children:Wne(e.name)})}),s&&!c&&(0,V.jsx)(`img`,{src:Gne(e),alt:``,width:t,height:t,loading:`eager`,decoding:`async`,onLoad:e=>{let t=e.currentTarget;t.naturalWidth>0&&t.naturalHeight>0&&a(Math.abs(t.naturalWidth/t.naturalHeight-1)<=.05),r(!0)},onError:()=>l(!0),className:`relative h-full w-full transition-opacity ${i?`object-cover`:`object-contain p-[6%]`} ${n?`opacity-100`:`opacity-0`}`})]})}var Kne=40;function qne({project:e,current:t,count:n,index:r,drag:i,onPointerDown:a,onKeyDown:o}){let s=i?.fromIndex===r,c=i?s?i.deltaY:Bne(r,i.fromIndex,i.toIndex):0;return(0,V.jsx)(Pq,{side:`right`,disabled:i!==null,label:e.stale?`${e.name} — directory is missing`:n?`${e.name} — ${n} in the queue`:e.name,children:(0,V.jsxs)(mk,{to:xx(e.slug),"aria-current":t?`page`:void 0,"aria-grabbed":s||void 0,onPointerDown:e=>a(e,r),onKeyDown:e=>o(e,r),onClick:e=>{(i||Xne())&&e.preventDefault()},onDragStart:e=>e.preventDefault(),className:`group relative flex h-10 w-full items-center justify-center outline-none ${s?`z-10 cursor-grabbing`:``}`,style:{transform:c?`translateY(${c}px)`:void 0,transition:s?`none`:`transform 160ms ease`},children:[(0,V.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 w-[3px] rounded-r-full bg-fg transition-all duration-150 ${t?`h-7 opacity-100`:`h-2.5 opacity-0 group-hover:opacity-60`}`}),(0,V.jsx)(`span`,{className:`rounded-[30%] transition-[transform,opacity,box-shadow] duration-150 group-focus-visible:ring-1 group-focus-visible:ring-fg/60 ${s?`scale-[1.12] opacity-100 shadow-lg shadow-black/50`:`group-hover:scale-[1.06] ${t?``:`opacity-75 group-hover:opacity-100`}`} ${e.stale?`grayscale`:``}`,children:(0,V.jsx)(D9,{project:e,size:Kne})}),n?(0,V.jsx)(`span`,{"aria-label":`${n} in the queue`,"data-rail-queue-count":n,className:`pointer-events-none absolute -bottom-[5px] right-[3px] flex h-[16px] min-w-[16px] items-center justify-center rounded-full border-[1.5px] border-bg bg-accent px-[3.5px] text-[10px] font-semibold leading-none proportional-nums text-bg`,children:(0,V.jsx)(`span`,{style:{textBox:`trim-both cap alphabetic`},children:n})}):null]})})}function Jne({project:e,children:t}){let n=(0,B.useRef)(null),r=Md(),i=()=>r.invalidateQueries({queryKey:[`projectsList`]}),a=e=>Q(e instanceof Error?e.message:String(e),{duration:7e3}),o=Jd({mutationFn:async t=>{let n=new Uint8Array(await t.arrayBuffer()),r=``;for(let e=0;e<n.length;e+=8192)r+=String.fromCharCode(...n.subarray(e,e+8192));return X.projectIconSet({id:e.id,name:t.name,data:btoa(r)})},onSuccess:()=>void i(),onError:a}),s=Jd({mutationFn:()=>X.projectIconClear({id:e.id}),onSuccess:()=>void i(),onError:a}),c=Jd({mutationFn:()=>X.projectIconPick({id:e.id}),onSuccess:e=>{if(e.kind!==`cancelled`){if(e.kind===`unavailable`){n.current?.click();return}i()}},onError:()=>n.current?.click()}),l=`cursor-default rounded px-2 py-1.5 text-[12.5px] text-fg outline-none data-[highlighted]:bg-panel-2`;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`input`,{ref:n,type:`file`,accept:ex.map(e=>`.${e}`).join(`,`),className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&o.mutate(t)}}),(0,V.jsxs)(lV,{children:[(0,V.jsx)(uV,{asChild:!0,children:t}),(0,V.jsx)(dV,{children:(0,V.jsxs)(fV,{align:`start`,sideOffset:6,className:`z-[220] min-w-[190px] rounded-lg border border-border bg-panel p-1 shadow-xl shadow-black/40`,children:[(0,V.jsx)(hV,{className:l,onSelect:()=>c.mutate(),children:o.isPending?`Uploading…`:`Choose an icon…`}),(0,V.jsx)(hV,{className:l,onSelect:()=>s.mutate(),children:e.iconIsCustom?`Use the detected icon`:`Look for an icon again`})]})})]})]})}var Yne=4,O9=0;function Xne(){return Date.now()-O9<250}function Zne(e,t){let n=qd({queryKey:[`projectsQueueCounts`],queryFn:()=>X.projectsQueueCounts(),refetchInterval:5e3}),r=Hf(Z).board,i=e!==void 0&&r?tj(r.threads).filter(iM).length:void 0,a=e===void 0?void 0:t.find(t=>t.slug===e)?.id;return e=>e.id===a&&i!==void 0?i:n.data?.[e.id]}function Qne(){let e=Md(),{data:t}=qd({queryKey:[`projectsList`],queryFn:()=>X.projectsList()}),n=bx(),[r,i]=(0,B.useState)(!1),a=XD(),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),u=(0,B.useRef)(null),d=Jd({mutationFn:()=>X.projectPick({}),onSuccess:e=>{e.kind===`picked`?a(xx(e.project.slug)):e.kind===`unavailable`&&a(`/`)},onSettled:()=>i(!1)}),f=Jd({mutationFn:e=>X.projectsReorder({ids:e}),onSuccess:async()=>{await e.invalidateQueries({queryKey:[`projectsList`]}),l(null)},onError:()=>l(null)}),p=c??t??[],m=Zne(n,p),[h,g]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=u.current;if(!e)return;let t=()=>g(e.scrollTop+e.clientHeight<e.scrollHeight-1);t(),e.addEventListener(`scroll`,t,{passive:!0});let n=new ResizeObserver(t);return n.observe(e),window.addEventListener(`resize`,t),()=>{e.removeEventListener(`scroll`,t),n.disconnect(),window.removeEventListener(`resize`,t)}},[p.length]);let _=(0,B.useCallback)((e,t)=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let n=e.currentTarget,r=e.clientY,i=p,a=!1,o=null,c=0,d=e=>{let n=u.current,a=0;if(n){let t=E9(e,n.getBoundingClientRect());if(t){let e=n.scrollTop;n.scrollTop+=t,a=n.scrollTop-e}}m+=a;let c=e-r+m;o={id:i[t].id,fromIndex:t,toIndex:zne(t,c,i.length),deltaY:c},s(o)},m=0,h=e=>{if(!a){if(Math.abs(e.clientY-r)<Yne)return;a=!0,n.setPointerCapture(e.pointerId)}e.preventDefault();let t=e.clientY;cancelAnimationFrame(c);let i=()=>{d(t),u.current&&E9(t,u.current.getBoundingClientRect())&&(c=requestAnimationFrame(i))};c=requestAnimationFrame(i)},g=()=>{if(cancelAnimationFrame(c),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g),s(null),!a||!o)return;O9=Date.now();let e=T9(i,o.fromIndex,o.toIndex);o.fromIndex!==o.toIndex&&(l(e),f.mutate(e.map(e=>e.id)))};window.addEventListener(`pointermove`,h,{passive:!1}),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[p,f]),v=(0,B.useCallback)((e,t)=>{if(!e.altKey||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;let n=t+(e.key===`ArrowUp`?-1:1);if(n<0||n>=p.length)return;e.preventDefault();let r=T9(p,t,n);l(r),f.mutate(r.map(e=>e.id)),requestAnimationFrame(()=>{u.current?.querySelectorAll(`a`)[n]?.focus()})},[p,f]);return(0,V.jsxs)(`nav`,{"aria-label":`Projects`,className:`fixed inset-y-0 left-0 z-[60] flex flex-col items-center border-r border-border bg-panel/60 py-3 max-[800px]:hidden ${Vne}`,children:[(0,V.jsx)(Pq,{side:`right`,label:`All projects`,children:(0,V.jsx)(mk,{to:`/`,"aria-label":`All projects`,"aria-current":n?void 0:`page`,className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted/70 outline-none transition-colors hover:bg-elevated hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:(0,V.jsx)(nw,{size:17})})}),(0,V.jsx)(`hr`,{className:`my-2.5 w-6 shrink-0 border-0 border-t border-border`}),(0,V.jsx)(`div`,{ref:u,"data-overflowing":h||void 0,className:`frizz-rail-scroll flex w-full min-h-0 flex-1 flex-col items-center gap-2 overflow-y-auto pb-1.5`,children:p.map((e,t)=>(0,V.jsx)(qne,{project:e,index:t,current:e.slug===n,count:m(e),drag:o,onPointerDown:_,onKeyDown:v},e.id))}),(0,V.jsx)(Pq,{side:`right`,label:`Add a project`,children:(0,V.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>{i(!0),d.mutate()},"aria-label":`Add a project`,className:`mt-3 flex h-10 w-10 shrink-0 items-center justify-center rounded-[30%] border-[1.5px] border-dotted border-border-strong text-muted/80 outline-none transition-colors hover:border-accent hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 disabled:opacity-50`,children:(0,V.jsx)(hw,{size:16})})})]})}var k9=76;function $ne(e,t){return t&&e.startsWith(`${t}/`)?`~${e.slice(t.length)}`:e}var A9=`flex flex-col gap-1 rounded-lg border px-4 py-3 outline-none transition-colors focus-visible:ring-1 focus-visible:ring-fg/60`,ere=`max-[700px]:rounded-none max-[700px]:border-x-0 max-[700px]:border-t-0 max-[700px]:border-b-border/70 max-[700px]:bg-transparent max-[700px]:py-3.5`,j9=38;function tre({project:e,home:t}){let n=wM(e.lastOpenedAt);return(0,V.jsxs)(`div`,{className:`group/card relative`,children:[(0,V.jsxs)(mk,{to:xx(e.slug),className:`${A9} ${ere} flex-row items-center gap-3 border-border bg-panel group-hover/card:border-border-strong group-hover/card:bg-panel-2 ${e.stale?`opacity-60`:``}`,children:[(0,V.jsx)(`span`,{className:`shrink-0 ${e.stale?`grayscale`:``}`,children:(0,V.jsx)(D9,{project:e,size:j9})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium text-fg`,children:e.name}),e.slug===e.name?null:(0,V.jsxs)(`span`,{className:`max-w-[45%] shrink-0 truncate font-mono text-[11px] text-muted/70`,children:[`/`,e.slug]})]}),(0,V.jsx)(`span`,{className:`truncate text-[11px] text-muted`,title:e.path,children:$ne(e.path,t)}),(0,V.jsx)(`span`,{className:`truncate text-[11px] text-muted/70`,children:e.stale?`Directory is missing`:n?`Opened ${n}`:`Never opened`})]})]}),(0,V.jsx)(Jne,{project:e,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":`Change the icon for ${e.name}`,style:{width:j9,height:j9},className:`absolute left-[17px] top-1/2 flex -translate-y-1/2 items-center justify-center rounded-[30%] bg-black/75 text-fg opacity-0 outline-none transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-1 focus-visible:ring-fg/60 data-[state=open]:opacity-100 max-[700px]:left-4 max-[700px]:top-[calc(50%-0.5px)]`,children:(0,V.jsx)(rw,{size:16,strokeWidth:1.75})})})]})}function nre({hero:e,pending:t,onClick:n}){return(0,V.jsxs)(`button`,{type:`button`,onClick:n,disabled:t,className:`${A9} items-center justify-center gap-1.5 border-dashed border-border-strong bg-transparent text-muted hover:border-accent hover:text-fg max-[700px]:mx-4 max-[700px]:mt-4 ${e?`min-h-[118px]`:`min-h-[74px]`}`,children:[(0,V.jsx)(`span`,{className:`text-[17px] leading-none text-muted/70`,children:`+`}),(0,V.jsx)(`span`,{className:`text-[12.5px]`,children:t?`Choosing a folder…`:`Add a project`}),e?(0,V.jsx)(`span`,{className:`text-[11px] text-muted/70`,children:`Point Frizz at a folder on this machine`}):null]})}function rre({reason:e,proposed:t,onClose:n}){let[r,i]=(0,B.useState)(t??``),a=XD(),o=Md(),s=Jd({mutationFn:e=>X.projectAdd({path:e}),onSuccess:e=>{o.invalidateQueries({queryKey:[`projectsList`]}),a(xx(e.slug))}}),c=s.error instanceof Error?s.error.message:s.error?String(s.error):null;return(0,V.jsx)(FV,{open:!0,onOpenChange:e=>{!e&&!s.isPending&&n()},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] w-[460px] max-w-[90vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,V.jsx)(QV,{className:`mb-1 text-[14px] font-medium`,children:t?`Add this folder as a project?`:`Add a project`}),(0,V.jsx)(`p`,{className:`mb-3.5 text-[12.5px] leading-relaxed text-muted`,children:t?`You ran Frizz here and it is not a project yet. Nothing has been written — adding it is what creates its board.`:e?`${e}. Paste the folder instead — Frizz walks up to the repository root, the same way it does when you run it in a terminal.`:`Paste the folder you want a board for. Frizz walks up to the repository root, the same way it does when you run it in a terminal.`}),(0,V.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),s.isPending||s.mutate(r)},children:[(0,V.jsx)(`input`,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),placeholder:`~/code/my-project`,spellCheck:!1,className:`w-full rounded-md border bg-bg px-2.5 py-2 font-mono text-[12px] text-fg outline-none placeholder:text-muted/50 focus-visible:ring-1 focus-visible:ring-fg/60 ${c?`border-red-500/60`:`border-border-strong`}`}),c?(0,V.jsx)(`p`,{className:`mt-1.5 text-[11.5px] text-red-400`,children:c}):null,(0,V.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:n,disabled:s.isPending,className:`rounded-md border border-border-strong bg-elevated px-3 py-1.5 text-[12.5px] text-fg outline-none hover:bg-panel-2 focus-visible:ring-1 focus-visible:ring-fg/60 disabled:opacity-50`,children:t?`Not now`:`Cancel`}),(0,V.jsx)(`button`,{type:`submit`,disabled:s.isPending||r.trim().length===0,className:`rounded-md border border-accent bg-accent px-3 py-1.5 text-[12.5px] font-medium text-bg outline-none hover:brightness-110 focus-visible:ring-1 focus-visible:ring-fg/60 disabled:opacity-50`,children:s.isPending?`Adding…`:t?`Add it`:`Add project`})]})]})]})]})})}function ire(){let[e]=(0,B.useState)(()=>{let e=new URLSearchParams(location.search).get(`add`)??void 0;return e&&history.replaceState(null,``,location.pathname),e}),[t,n]=(0,B.useState)(e?{}:null);(0,B.useEffect)(()=>{let e=new URLSearchParams(location.search).get(`unknown`);e&&(history.replaceState(null,``,location.pathname),Q(`No project named ${e} — showing all projects instead`,{duration:7e3}))},[]);let r=XD(),i=Md(),a=Jd({mutationFn:()=>X.projectPick({}),onSuccess:e=>{if(e.kind!==`cancelled`){if(e.kind===`unavailable`){n({reason:e.reason});return}i.invalidateQueries({queryKey:[`projectsList`]}),r(xx(e.project.slug))}},onError:e=>n({reason:e instanceof Error?e.message:String(e)})}),{data:o,isPending:s,error:c}=qd({queryKey:[`projectsList`],queryFn:()=>X.projectsList()}),l=o?.[0]?.path.match(/^(\/(?:Users|home)\/[^/]+)\//u)?.[1],u=o!==void 0&&o.length===0;return(0,V.jsxs)(`div`,{className:`flex min-h-dvh w-full flex-col px-6 py-14 max-[700px]:px-0 max-[700px]:py-10`,children:[(0,V.jsxs)(`div`,{className:`m-auto flex w-full flex-col items-center`,children:[(0,V.jsxs)(`div`,{className:`mb-8 flex flex-col items-center gap-2.5 text-center`,children:[(0,V.jsx)(`img`,{src:`/favicon.svg`,width:k9,height:k9,alt:``,className:`rounded-[17px]`}),(0,V.jsx)(`h1`,{className:`text-[19px] font-semibold tracking-[-0.01em] text-fg`,children:u?`Welcome to Frizz`:`Select a project`}),u?(0,V.jsx)(`p`,{className:`max-w-[420px] text-[13px] leading-relaxed text-muted`,children:`A project is a folder on this machine. Frizz keeps one board of threads per project, and serves them all from here.`}):null]}),c?(0,V.jsxs)(`p`,{className:`text-[13px] text-muted`,children:[`Could not read the project registry: `,String(c)]}):s?(0,V.jsx)(`p`,{className:`text-[13px] text-muted`,children:`Loading…`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`grid w-full gap-2.5 max-[700px]:gap-0 ${u?`max-w-[360px] grid-cols-1`:`max-w-[720px] grid-cols-1 sm:grid-cols-2`}`,children:[o.map(e=>(0,V.jsx)(tre,{project:e,home:l},e.id)),(0,V.jsx)(nre,{hero:u,pending:a.isPending,onClick:()=>a.mutate()})]}),u?(0,V.jsxs)(`p`,{className:`mt-6 text-[11.5px] text-muted/70`,children:[`Or run`,` `,(0,V.jsx)(`code`,{className:`rounded border border-border bg-panel px-1.5 py-0.5 font-mono text-muted`,children:`frizz`}),` `,`inside any folder — it registers itself and opens.`]}):null]})]}),t?(0,V.jsx)(rre,{reason:t.reason,proposed:e,onClose:()=>n(null)}):null]})}function M9(){let e=Hf(Z),t=e.toast,[n,r]=(0,B.useState)(!1),i=e.drawers.some(e=>!e.closing);return(0,B.useEffect)(()=>{if(!t||(r(!0),t.sticky))return;let e=setTimeout(()=>r(!1),t.duration??(t.link?5e3:1600));return()=>clearTimeout(e)},[t?.id]),t?(0,V.jsx)(`div`,{className:`pointer-events-none fixed right-4 z-[70] flex justify-end ${i?`bottom-20`:`bottom-4`}`,children:(0,V.jsxs)(`div`,{"data-toast":!0,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`flex max-w-[min(30rem,calc(100vw-2rem))] items-center gap-2.5 break-words rounded-lg border border-border-strong bg-elevated px-4 py-2 text-[13px] font-medium text-fg shadow-xl shadow-black/40 transition-all duration-200 ease-out ${n?`translate-y-0 opacity-100`:`translate-y-8 opacity-0`}`,children:[t.spinner&&(0,V.jsx)(cw,{size:13,className:`animate-spin text-muted`}),t.text,t.link&&(0,V.jsx)(`button`,{onClick:()=>{BS(`thread`,t.link.slug),Z.toast=null},className:`pointer-events-auto shrink-0 rounded-md border border-border px-2 py-0.5 text-[12px] text-fg/90 transition-colors hover:bg-panel-2`,children:t.link.label})]})}):null}function N9(e,t){return`${xx(e)}${Ex(t,`/`)}`}function are({slug:e}){let t=$A(),n=gx(t,e),r=n.kind===`found`?n.thread:void 0;t?.projectDir,(0,B.useEffect)(()=>{X.board().then(nC).catch(()=>{})},[]);let i=r?.runtime===`turn-idle`||r?.runtime===`exited`||r?.runtime===`none`;return(0,B.useEffect)(()=>{!r||!i||X.threadSeen({slug:e}).catch(()=>{})},[i,e,r?.lastActivityAt]),(0,B.useEffect)(()=>{let n=t?.projectLabel??t?.projectName,i=r?Uj(r):e;document.title=n?`${i} · ${n} — Frizz`:`${i} · Frizz`},[t?.projectLabel,t?.projectName,e,r]),(0,V.jsx)(Nq,{children:(0,V.jsxs)(`div`,{className:`h-dvh min-h-0 bg-bg px-0 text-sm text-fg sm:px-5`,children:[(0,V.jsx)(`main`,{"data-standalone-thread":!0,className:`mx-auto flex h-full w-full max-w-[900px] min-w-0 flex-col overflow-hidden border-border bg-panel sm:border-x`,children:n.kind===`loading`?(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,role:`status`,"aria-label":`Loading thread`,children:(0,V.jsx)(`span`,{className:`block h-5 w-5 animate-spin rounded-full border-2 border-muted/50 border-t-transparent`})}):n.kind===`missing`?(0,V.jsx)(ore,{slug:e}):(0,V.jsx)(D8,{slug:e,virtualized:!0,showReturnToQueue:!0})}),(0,V.jsx)(x7,{}),(0,V.jsx)(M9,{})]})})}function ore({slug:e}){let{data:t,isPending:n}=qd({queryKey:[`threadLocate`,e],queryFn:()=>X.threadLocate({slug:e})});return(0,B.useEffect)(()=>{t?.length===1&&location.replace(N9(t[0].projectSlug,e))},[t,e]),(0,V.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 px-6 text-center`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h1`,{className:`font-medium text-fg`,children:`Thread unavailable`}),n?(0,V.jsxs)(`p`,{className:`mt-1 text-muted`,children:[`Looking for “`,e,`” in your other projects…`]}):t&&t.length>0?(0,V.jsxs)(`p`,{className:`mt-1 text-muted`,children:[`“`,e,`” lives in `,t.length===1?`another project`:`these projects`,` — opening it there.`]}):(0,V.jsxs)(`p`,{className:`mt-1 text-muted`,children:[`Thread “`,e,`” was not found in any project on this machine.`]})]}),t&&t.length>1?(0,V.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:t.map(t=>(0,V.jsx)(`a`,{href:N9(t.projectSlug,e),className:`rounded-md border border-border px-3 py-1.5 text-[12px] text-fg/90 hover:bg-panel-2`,children:t.projectName},t.projectSlug))}):(0,V.jsx)(`a`,{href:`/`,className:`rounded-md border border-border px-3 py-1.5 text-[12px] text-fg/90 hover:bg-panel-2`,children:`All projects`})]})}var sre={OPEN_ISSUE:{bg:`#238636`,icon:zC,label:`Open`},CLOSED_ISSUE:{bg:`#8957e5`,icon:LC,label:`Closed`},NOT_PLANNED:{bg:`#656c76`,icon:VC,label:`Closed as not planned`},OPEN_PR:{bg:`#238636`,icon:$C,label:`Open`},DRAFT:{bg:`#656c76`,icon:QC,label:`Draft`},MERGED:{bg:`#8957e5`,icon:XC,label:`Merged`},CLOSED_PR:{bg:`#da3633`,icon:ZC,label:`Closed`}};function cre(e){return e.kind===`commit`?null:e.state===`MERGED`?`MERGED`:e.state===`DRAFT`?`DRAFT`:e.state===`OPEN`?e.kind===`pr`?`OPEN_PR`:`OPEN_ISSUE`:e.state===`CLOSED`?e.kind===`pr`?`CLOSED_PR`:e.stateReason===`NOT_PLANNED`?`NOT_PLANNED`:`CLOSED_ISSUE`:null}function P9(e,t=Date.now()){if(!e)return``;let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=n.getFullYear()===new Date(t).getFullYear();return n.toLocaleDateString(void 0,{month:`short`,day:`numeric`,...r?{}:{year:`numeric`}})}function lre(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.max(0,Math.floor((t-n)/1e3)),i=(e,t)=>`${e} ${t}${e===1?``:`s`} ago`;if(r<60)return`just now`;if(r<3600)return i(Math.floor(r/60),`minute`);if(r<86400)return i(Math.floor(r/3600),`hour`);let a=Math.floor(r/86400);return a<7?i(a,`day`):a<30?i(Math.floor(a/7),`week`):a<365?i(Math.floor(a/30),`month`):`on ${P9(e,t)}`}function ure(e,t){let n=e+t;if(n<=0)return[,,,,,].fill(`none`);let r=Math.min(5,Math.floor(e/n*5)),i=Math.min(5-r,Math.floor(t/n*5));return[...Array(r).fill(`add`),...Array(i).fill(`del`),...Array(5-r-i).fill(`none`)]}var F9={add:`#3fb950`,del:`#f85149`},dre={add:{backgroundColor:`#238636`,borderColor:`#238636`},del:{backgroundColor:`#da3633`,borderColor:`#da3633`},none:{backgroundColor:`#656c7633`,borderColor:`#3d444d`}};function I9({additions:e,deletions:t}){return(0,V.jsxs)(`div`,{className:`flex items-baseline gap-1.5 text-[12px] tabular-nums`,children:[(0,V.jsxs)(`span`,{"data-gh-add":!0,style:{color:F9.add},children:[`+`,e.toLocaleString()]}),(0,V.jsxs)(`span`,{"data-gh-del":!0,style:{color:F9.del},children:[`−`,t.toLocaleString()]}),(0,V.jsx)(`span`,{"data-gh-blocks":!0,className:`ml-0.5 inline-flex gap-[1px] self-baseline translate-y-[calc(4px_-_0.5cap)]`,children:ure(e,t).map((e,t)=>(0,V.jsx)(`span`,{className:`size-[8px] rounded-[2px] border`,style:dre[e]},t))})]})}function fre({card:e}){let t=cre(e),n=t?sre[t]:void 0;if(!n)return null;let r=n.icon;return(0,V.jsxs)(`span`,{"data-gh-pill":!0,className:`inline-flex items-baseline gap-1 rounded-full px-2.5 py-1 text-[12px] font-medium text-white`,style:{backgroundColor:n.bg},children:[(0,V.jsx)(r,{strokeWidth:2,"aria-hidden":!0,className:`size-[1.1em] shrink-0 self-baseline -mr-px translate-y-[calc(0.55em_-_0.5cap)]`}),(0,V.jsx)(`span`,{"data-gh-pill-label":!0,children:n.label})]})}function pre({name:e,color:t}){let n=/^[0-9a-fA-F]{6}$/.test(t)?`#${t}`:`#8b8f96`;return(0,V.jsx)(`span`,{className:`inline-flex items-center rounded-full border px-2 py-[1px] text-[11px] font-medium`,style:{color:n,backgroundColor:`${n}26`,borderColor:`${n}59`},children:e})}var mre=/`([^`\n]+)`/g;function hre(e,t){if(!t)return[e];let n=[],r=0;for(let t of e.matchAll(mre))t.index>r&&n.push(e.slice(r,t.index)),n.push({code:t[1]}),r=t.index+t[0].length;return r<e.length&&n.push(e.slice(r)),n}function L9({text:e,code:t,className:n}){return(0,V.jsx)(`div`,{className:n,children:hre(e,t).map((e,t)=>typeof e==`string`?e:(0,V.jsx)(`code`,{className:`rounded-[3px] bg-panel-2 px-[3px] py-[1px] font-mono-keep text-[0.92em]`,children:e.code},t))})}var gre=new Set([`avatars.githubusercontent.com`,`camo.githubusercontent.com`]);function _re(e){if(e)try{let t=new URL(e);return t.protocol===`https:`&&gre.has(t.hostname)?e:void 0}catch{return}}function R9({card:e,nowMs:t}){let n=_re(e.authorAvatar),r=e.authorLogin??e.authorName??`Someone`,i=e.kind===`commit`?`committed`:e.kind===`pr`?`opened this pull request`:`opened this issue`,a=lre(e.at,t);return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border px-3 py-2 text-[12px] text-muted`,children:[n?(0,V.jsx)(`img`,{"data-gh-avatar":!0,src:n,alt:``,className:`size-[18px] shrink-0 rounded-full`}):(0,V.jsx)(`span`,{"data-gh-avatar":!0,className:`size-[18px] shrink-0 rounded-full bg-border`}),(0,V.jsxs)(`span`,{"data-gh-byline-text":!0,className:`truncate`,children:[(0,V.jsx)(`span`,{className:`text-fg`,children:r}),` `,i,` `,a]})]})}var z9=`w-[360px] max-w-[min(360px,calc(100vw-24px))] leading-normal`;function vre({card:e,nowMs:t=Date.now()}){let n=e.additions!==void 0&&e.deletions!==void 0;if(e.kind===`commit`)return(0,V.jsxs)(`div`,{className:z9,children:[(0,V.jsxs)(`div`,{className:`flex items-baseline gap-2 px-3 pt-3 pb-2.5`,children:[(0,V.jsx)(`span`,{"data-gh-commit-glyph":!0,className:`shrink-0 self-baseline -mr-px text-[14px] translate-y-[calc(0.5em_-_0.5cap)]`,children:(0,V.jsx)(YC,{className:`size-[1em] text-muted`,"aria-hidden":!0})}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-[14px] font-semibold leading-snug text-fg`,children:e.title}),e.body?(0,V.jsx)(L9,{text:e.body,code:!1,className:`mt-1.5 line-clamp-6 text-[12px] text-muted`}):null,n?(0,V.jsx)(`div`,{className:`mt-2.5`,children:(0,V.jsx)(I9,{additions:e.additions,deletions:e.deletions})}):null]})]}),(0,V.jsx)(R9,{card:e,nowMs:t})]});let r=e.ref.slice(e.ref.indexOf(`#`));return(0,V.jsxs)(`div`,{className:z9,children:[(0,V.jsxs)(`div`,{className:`px-3 pt-3 pb-3`,children:[(0,V.jsxs)(`div`,{className:`text-[12px] text-muted`,children:[(0,V.jsx)(`span`,{className:`underline decoration-border underline-offset-2`,children:e.repo}),e.at?` on ${P9(e.at,t)}`:``]}),(0,V.jsxs)(`div`,{className:`mt-1 text-[14px] font-semibold leading-snug text-fg`,children:[e.title,` `,(0,V.jsx)(`span`,{className:`font-normal text-muted`,children:r})]}),(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,V.jsx)(fre,{card:e}),n?(0,V.jsx)(I9,{additions:e.additions,deletions:e.deletions}):null]})]}),e.body||e.labels.length>0?(0,V.jsxs)(`div`,{className:`border-t border-border px-3 py-2.5`,children:[e.body?(0,V.jsx)(L9,{text:e.body,code:!0,className:`line-clamp-2 text-[12px] text-muted`}):null,e.labels.length>0?(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1 ${e.body?`mt-2`:``}`,children:e.labels.map(e=>(0,V.jsx)(pre,{name:e.name,color:e.color},e.name))}):null]}):null,(0,V.jsx)(R9,{card:e,nowMs:t})]})}var yre=250,bre=180;function xre(e){let t=e.getClientRects()[0]??e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}}function Sre(){let[e,t]=(0,B.useState)(null),n=(0,B.useRef)(void 0),r=(0,B.useRef)(void 0),i=(0,B.useRef)(!1),a=(0,B.useCallback)(()=>{clearTimeout(n.current),clearTimeout(r.current),n.current=void 0,r.current=void 0},[]),o=(0,B.useCallback)(()=>{clearTimeout(r.current),r.current=setTimeout(()=>{i.current||t(null)},bre)},[]);return(0,B.useEffect)(()=>{let i=i=>{if(i.pointerType!==`mouse`)return;let a=i.target?.closest?.(`a[data-gh-ref]`)??null,o=a?.getAttribute(`data-gh-ref`);!a||!o||(clearTimeout(r.current),e?.ref!==o&&(clearTimeout(n.current),_S([o]),n.current=setTimeout(()=>t({ref:o,rect:xre(a)}),yre)))},a=e=>{e.pointerType===`mouse`&&e.target?.closest?.(`a[data-gh-ref]`)&&(clearTimeout(n.current),o())};return document.addEventListener(`pointerover`,i),document.addEventListener(`pointerout`,a),()=>{document.removeEventListener(`pointerover`,i),document.removeEventListener(`pointerout`,a)}},[e?.ref,o]),(0,B.useEffect)(()=>{if(!e)return;let n=()=>{i.current=!1,a(),t(null)};return window.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[e,a]),(0,B.useEffect)(()=>a,[a]),(0,V.jsxs)(nK,{open:e!==null,children:[(0,V.jsx)(iK,{asChild:!0,children:(0,V.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none fixed`,style:{top:e?.rect.top??0,left:e?.rect.left??0,width:e?.rect.width??0,height:e?.rect.height??0}})}),e?(0,V.jsx)(aK,{side:`top`,align:`start`,sideOffset:8,alignOffset:-8,"aria-hidden":!0,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onPointerEnter:()=>{i.current=!0,clearTimeout(r.current)},onPointerLeave:()=>{i.current=!1,o()},className:`overflow-hidden`,children:(0,V.jsx)(Cre,{refKey:e.ref})}):null]})}function Cre({refKey:e}){let t=(0,B.useSyncExternalStore)(fS,()=>pS(e),()=>pS(e));return(0,B.useEffect)(()=>{mS(pS(e))&&xS(e)},[e]),t?.card?(0,V.jsx)(vre,{card:t.card}):(0,V.jsx)(`div`,{className:`flex h-[64px] w-[220px] items-center px-3 text-[12px] text-muted`,children:t?.missing?`Not found on GitHub`:`Loading…`})}var B9=`frizz-project-rail`;function wre(){try{return localStorage.getItem(B9)===`shown`}catch{return!1}}function Tre(e){try{localStorage.setItem(B9,e?`shown`:`hidden`)}catch{}}function Ere(){JD();let e=qd({queryKey:[`settingsGet`],queryFn:()=>X.settingsGet(),placeholderData:Wu}).data?.projectRail;return(0,B.useEffect)(()=>{e!==void 0&&Tre(e===!0)},[e]),e===void 0?wre():e===!0}var V9=`/project/:slug`;function Dre(){let e=Ere();return(0,V.jsxs)(Nq,{children:[e?(0,V.jsx)(Qne,{}):null,(0,V.jsx)(`div`,{className:e?Hne:void 0,children:(0,V.jsx)(Fee,{})}),(0,V.jsx)(M9,{}),(0,V.jsx)(Sre,{})]})}function H9(e){(0,B.useEffect)(()=>{IA(e)||(tC(),ZA())},[e])}function U9(){let{slug:e}=eO();return H9(e),kre(),(0,V.jsx)(Rne,{},e??`__launching__`)}function Ore(){return(0,V.jsx)(ire,{})}function kre(){let e=JD();(0,B.useEffect)(()=>{vj(Cx(e.pathname))},[e.pathname])}function W9(){let{thread:e,slug:t}=eO();return H9(t),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(are,{slug:e}),(0,V.jsx)(M9,{})]})}var Are=[{index:!0,element:(0,V.jsx)(U9,{})},{path:`thread/:thread`,element:(0,V.jsx)(U9,{})},{path:`status/:status`,element:(0,V.jsx)(U9,{})}],jre=uk([{path:`/thread/:thread/full`,element:(0,V.jsx)(W9,{})},{path:`${V9}/thread/:thread/full`,element:(0,V.jsx)(W9,{})},{element:(0,V.jsx)(Dre,{}),children:[{path:`/`,element:(0,V.jsx)(Ore,{})},{path:`/thread/:thread`,element:(0,V.jsx)(U9,{})},{path:`/status/:status`,element:(0,V.jsx)(U9,{})},{path:V9,children:Are},{path:`*`,element:(0,V.jsx)(U9,{})}]}]),Mre=24,Nre=6,Pre=700,G9=new Map,K9=null,q9=null;function Fre(e){return!Array.isArray(e)||e.length!==2?null:e[0]===`transcript`&&typeof e[1]==`string`?e[1]:null}function J9(e){return Z.board?.threads.find(t=>t.id===e)?.lastActivityAt}function Ire(){let e=[...G9.entries()].filter(([,e])=>e.observers>0),t=new Set(e.slice(-24).map(([e])=>e));for(let[e,n]of G9){if(n.observers<=0){n.live&&(n.live=!1,YA(e)),G9.delete(e);continue}t.has(e)?!n.live&&!n.queued&&(n.queued=!0):(n.queued=!1,n.live&&(n.live=!1,YA(e)))}Y9()}function Y9(){q9||[...G9.values()].some(e=>e.queued)&&(q9=setTimeout(()=>{q9=null;let e=0,t=[...G9.values()].filter(e=>e.live).length;for(let[n,r]of G9){if(e>=Nre||t>=Mre)break;r.queued&&(r.queued=!1,!(r.observers<=0||r.live)&&(r.live=!0,t++,r.lastActivityAt=J9(n),JA(n),e++))}Y9()},Pre))}function Lre(){if(K9)for(let[e,t]of G9){if(t.observers<=0)continue;let n=J9(e);n!==t.lastActivityAt&&(t.lastActivityAt=n,!(t.live&&Z.socketTranscripts)&&(Z.socketTranscriptFallbacks[e]||K9.refetchQueries({queryKey:[`transcript`,e],exact:!0,type:`active`})))}}function Rre(e){K9||(K9=e,e.getQueryCache().subscribe(e=>{let t=Fre(e.query.queryKey);if(!t||e.type!==`observerAdded`&&e.type!==`observerRemoved`)return;let n=e.query.getObserversCount(),r=G9.get(t);e.type===`observerAdded`?(G9.delete(t),G9.set(t,{observers:n,live:r?.live??!1,queued:r?.queued??!1,lastActivityAt:r?r.lastActivityAt:J9(t)})):r&&(r.observers=n),Ire()}),zf(Z,Lre))}var zre=`ui-monospace, "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Mono", Consolas, Menlo, "DejaVu Sans Mono", monospace`,Bre=`system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`;function X9(e){let t=e===`mono`?`mono`:`sans`;document.documentElement.dataset.font=t,document.body&&(document.body.style.fontFamily=t===`sans`?Bre:zre);try{localStorage.setItem(`frizz-font`,t)}catch{}}function Vre(e){let t=e.getQueryData([`settingsGet`]);t&&X9(t.font),X.settingsGet().then(e=>X9(e.font)).catch(()=>{}),e.getQueryCache().subscribe(()=>{let t=e.getQueryData([`settingsGet`]);t&&X9(t.font)})}function Hre(){let e=e=>{if(e.button!==0||e.defaultPrevented)return;let t=e.target instanceof Element?e.target.closest(`.${xQ}`):null;t&&(e.preventDefault(),e.stopPropagation(),Wre(t))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)}function Ure(e){return e.closest(`.md-code`)?.querySelector(`pre code`)??null}async function Wre(e){let t=Ure(e);if(!t)return;let n=(t.textContent??``).replace(/\n$/,``);if(n){try{await bU(n)}catch(e){Q(`Could not copy code: ${e.message.slice(0,100)}`,{duration:7e3});return}Gre(e)}}var Z9=new WeakMap;function Gre(e){e.classList.add(SQ),e.title=`Copied`;let t=Z9.get(e);t!==void 0&&window.clearTimeout(t),Z9.set(e,window.setTimeout(()=>{e.classList.remove(SQ),e.title=CQ,Z9.delete(e)},f6))}var Kre=/^\/thread\/([a-z0-9][a-z0-9-]*)\/?$/;function qre(){let e=e=>{if(e.button!==0||e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target instanceof Element?e.target.closest(`a[href*="/thread/"]`):null,n=t?.getAttribute(`href`);if(!t||!n||!n.startsWith(`/`))return;let r=bx(n);if(r&&r!==bx())return;let i=Kre.exec(Cx(n));i&&(e.preventDefault(),e.stopPropagation(),US(i[1]))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)}var Jre=new Set([`projectsList`,`projectsQueueCounts`,`threadLocate`,`dispatchPreferencesGet`]);function Yre(e){let t=e[0];return typeof t==`string`&&Jre.has(t)?Pu(e):Pu([`project:${bx()??``}`,...e])}var Q9=typeof window<`u`&&window.location.pathname.endsWith(`/settings-formatting-fixture.html`),Xre=typeof window<`u`?gee(Cx()):null;!Q9&&!Xre&&yj();var $9=new Od({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1,queryKeyHashFn:Yre}}});Q9||(QA($9),Rre($9),Vre($9),d3(),F$(),Hre(),qre()),Q9||(0,Yd.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(Nd,{client:$9,children:(0,V.jsx)(Rw,{children:(0,V.jsx)(Mee,{router:jre})})}));export{mu as i,Tx as n,Ad as r,HO as t};