openpond 0.0.49 → 0.0.51

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 (133) hide show
  1. package/dist/chunks/{app-layer-E2JWCA6D.js → app-layer-DCUTQ4TM.js} +2 -2
  2. package/dist/chunks/{app-server-runtime-OWEIHFEU.js → app-server-runtime-Q3IGU5YB.js} +6 -6
  3. package/dist/chunks/{apps-VQDIVGST.js → apps-JDRCDAPE.js} +2 -2
  4. package/dist/chunks/{chunk-7G472COA.js → chunk-35OYRVVH.js} +1491 -4
  5. package/dist/chunks/{chunk-3BR4ACFF.js → chunk-3PYU3XCS.js} +484 -201
  6. package/dist/chunks/{chunk-NR2N6JAC.js → chunk-CSN3DLWJ.js} +1 -1
  7. package/dist/chunks/{chunk-ZJBJQCQZ.js → chunk-EJURKADM.js} +4 -2
  8. package/dist/chunks/{chunk-NRLI3S72.js → chunk-IGSEFSMA.js} +187 -21
  9. package/dist/chunks/{chunk-UJV3UYLP.js → chunk-J4LLKY6E.js} +1 -1
  10. package/dist/chunks/{chunk-64LWPRGN.js → chunk-LYEXNSCO.js} +2 -2
  11. package/dist/chunks/{chunk-LRLDBKTI.js → chunk-PFNX5XOT.js} +1 -1
  12. package/dist/chunks/{chunk-QD4FR3O4.js → chunk-R4PRXXTC.js} +40 -35
  13. package/dist/chunks/{chunk-CNIMJPM5.js → chunk-UDTHREHB.js} +2231 -2125
  14. package/dist/chunks/{chunk-7M4HGT5X.js → chunk-V3HADQL5.js} +1 -1
  15. package/dist/chunks/{cli-T6TTMVSU.js → cli-2FTM4SXH.js} +5 -5
  16. package/dist/chunks/{core-commands-UW4XTGXK.js → core-commands-5BRR7TU4.js} +3 -3
  17. package/dist/chunks/{desktop-test-JTBPE7CH.js → desktop-test-EQ2BGZOM.js} +2 -2
  18. package/dist/chunks/{extension-VP7LMA32.js → extension-V3NZ7MU7.js} +305 -170
  19. package/dist/chunks/{help-OZNCHHO3.js → help-WJBMX37U.js} +1 -1
  20. package/dist/chunks/{opchat-RY3QU5UJ.js → opchat-W7DSKNNB.js} +2 -2
  21. package/dist/chunks/{organizations-GLKSXK3Q.js → organizations-RHOF5H4Z.js} +4 -4
  22. package/dist/chunks/{profile-JWUYJF23.js → profile-B62ZWPTQ.js} +3 -3
  23. package/dist/chunks/{project-agent-L4EB7QFO.js → project-agent-QA25HHDV.js} +2 -2
  24. package/dist/chunks/{sandbox-command-26255MSV.js → sandbox-command-JFEVPU4X.js} +2 -2
  25. package/dist/chunks/{sandbox-template-6UDA3AEY.js → sandbox-template-GEWTAWAR.js} +3 -3
  26. package/dist/chunks/{src-7S66FU4P.js → src-JOTV67WO.js} +4944 -3831
  27. package/dist/chunks/{src-GCZ2GMG3.js → src-P2BL3KCV.js} +3 -4
  28. package/dist/chunks/{teams-bot-PO3GOLWU.js → teams-bot-ODSMRNE4.js} +2 -2
  29. package/dist/chunks/{training-BR5A7SPU.js → training-5CPTZRVC.js} +81 -2
  30. package/dist/chunks/{workspaces-26IF6TQV.js → workspaces-7YHBJG5P.js} +2 -2
  31. package/dist/cli.js +13 -13
  32. package/dist/index.js +7 -5
  33. package/dist/profile/profile-git.d.ts +22 -0
  34. package/dist/skills/openpond-taskset-authoring/SKILL.md +9 -1
  35. package/dist/skills/openpond-taskset-authoring/artifact.json +10 -5
  36. package/dist/skills/openpond-taskset-authoring/references/benchmarking.md +26 -0
  37. package/dist/web/assets/{AppDialog-BTOxCNC5.js → AppDialog-DylZeiI-.js} +1 -1
  38. package/dist/web/assets/{AppsView-Cm5x09IS.js → AppsView-Bz6C0a1u.js} +1 -1
  39. package/dist/web/assets/{BrowserSidebar-CIPh5JIn.js → BrowserSidebar-xXFxZP2-.js} +1 -1
  40. package/dist/web/assets/CommandMenu-C9k5VdaR.js +1 -0
  41. package/dist/web/assets/CommunityView-DaIS0cHw.css +1 -0
  42. package/dist/web/assets/CommunityView-DcJlUNgd.js +1 -0
  43. package/dist/web/assets/{ComposerCreateImproveStrip-CW2QuI7r.js → ComposerCreateImproveStrip-Yt3irJVo.js} +1 -1
  44. package/dist/web/assets/{GetStartedView--CbCnzFQ.js → GetStartedView-BhD0Ij7c.js} +1 -1
  45. package/dist/web/assets/LabModelVersionDetailPage-B-OoSJYT.js +1 -0
  46. package/dist/web/assets/LabSkillSidebar-dqdSTmHG.js +1 -0
  47. package/dist/web/assets/LabsRoute-BMPI4vB8.js +3 -0
  48. package/dist/web/assets/LabsRoute-DDTgtCul.css +1 -0
  49. package/dist/web/assets/MainChatThread-B0ajKiNL.js +2 -0
  50. package/dist/web/assets/{MainPane-Bky_Rqcx.css → MainPane-BfVDe9f7.css} +1 -1
  51. package/dist/web/assets/MainPane-COs4xUGo.js +6 -0
  52. package/dist/web/assets/{MarkdownText-DTBS9xe7.js → MarkdownText-CzZ60aWs.js} +4 -4
  53. package/dist/web/assets/Messages-DGrK4iIj.js +9 -0
  54. package/dist/web/assets/{NativeSkillSidebar-DSoPD42b.js → NativeSkillSidebar-BkpgGLSO.js} +1 -1
  55. package/dist/web/assets/{NewProjectDialog-CmXg2GK7.js → NewProjectDialog-BOdCdNcG.js} +1 -1
  56. package/dist/web/assets/OutputsPage-CSBWIFdi.js +1 -0
  57. package/dist/web/assets/RightChatPanelStack-PZR6NYJj.js +1 -0
  58. package/dist/web/assets/ScheduledWorkPage-WXLnwju_.js +1 -0
  59. package/dist/web/assets/{SettingsView-CrXwXjZ1.css → SettingsView-C39BqlSI.css} +1 -1
  60. package/dist/web/assets/SettingsView-CQJoEx-y.js +6 -0
  61. package/dist/web/assets/{TeamChatView-CB_0oRid.js → TeamChatView-BRnuD-lV.js} +2 -2
  62. package/dist/web/assets/TeamChatView-Br3VdxhD.css +1 -0
  63. package/dist/web/assets/{TerminalOverlay-XhABQsCB.js → TerminalOverlay-B5m8j4_C.js} +1 -1
  64. package/dist/web/assets/{TrainingCreationPanel-ChsDr2GP.js → TrainingCreationPanel-CA1rt7XZ.js} +1 -1
  65. package/dist/web/assets/{TrainingDraftPanel-CDlpnno6.js → TrainingDraftPanel-C0p3GP1n.js} +1 -1
  66. package/dist/web/assets/{UsageSettingsSection-NbX7_3Uz.js → UsageSettingsSection-CpIKj4p-.js} +1 -1
  67. package/dist/web/assets/WorkspaceDiffPanel-BXk8mdZB.js +14 -0
  68. package/dist/web/assets/WorkspaceEnvironmentMenu-BO60uNVj.js +32 -0
  69. package/dist/web/assets/{WorkspaceGitDialogs-C0PMpVfj.js → WorkspaceGitDialogs-hWBfhgaP.js} +1 -1
  70. package/dist/web/assets/{WorkspaceMonacoEditor-6QNGzQUi.js → WorkspaceMonacoEditor-ULPyacH8.js} +3 -3
  71. package/dist/web/assets/{arrow-up-right-Cx2xjktp.js → arrow-up-right-CkfCgokz.js} +1 -1
  72. package/dist/web/assets/{chevron-up-UF_r7JHT.js → chevron-up-B5URpgIH.js} +1 -1
  73. package/dist/web/assets/{circle-alert-BUHAQ7Du.js → circle-alert-CAvjRdlQ.js} +1 -1
  74. package/dist/web/assets/{cloud-upload-Cc_ZQEAm.js → cloud-upload-DeQEwz1o.js} +1 -1
  75. package/dist/web/assets/{cssMode-CrigFsxI.js → cssMode-B4V5a3OX.js} +1 -1
  76. package/dist/web/assets/folder-DgS_U9Lq.js +1 -0
  77. package/dist/web/assets/folder-git-2-BTtbxKWf.js +1 -0
  78. package/dist/web/assets/{folder-open-D7a4t258.js → folder-open-CqjIkaDK.js} +1 -1
  79. package/dist/web/assets/{folder-plus-CmeHTj5W.js → folder-plus-CsS0KPW5.js} +1 -1
  80. package/dist/web/assets/{git-branch-CaVUghsI.js → git-branch-BN2ijBYt.js} +1 -1
  81. package/dist/web/assets/{git-commit-horizontal-oiDAVV_Y.js → git-commit-horizontal-CVsl4u1O.js} +1 -1
  82. package/dist/web/assets/{htmlMode-CLzM5GNi.js → htmlMode-DRksGWJA.js} +1 -1
  83. package/dist/web/assets/index-CE2hroF6.css +1 -0
  84. package/dist/web/assets/index-Cxq5q-6B.js +174 -0
  85. package/dist/web/assets/index-SKvMOpII.js +1 -0
  86. package/dist/web/assets/{info-dTkimobU.js → info-DwVXRQli.js} +1 -1
  87. package/dist/web/assets/{jsonMode-BBF67cOE.js → jsonMode-eJvgtAy-.js} +1 -1
  88. package/dist/web/assets/{lspLanguageFeatures-DHtN2nxz.js → lspLanguageFeatures-DCk7zUI-.js} +1 -1
  89. package/dist/web/assets/{monaco.contribution-DtM9AdPi.js → monaco.contribution-B02C5mDa.js} +2 -2
  90. package/dist/web/assets/{monaco.contribution-BClTZJd2.js → monaco.contribution-CPnN-lZN.js} +2 -2
  91. package/dist/web/assets/{monaco.contribution-riAIDf7J.js → monaco.contribution-DWVguH46.js} +2 -2
  92. package/dist/web/assets/{monaco.contribution-C_GWU01R.js → monaco.contribution-WGT1eYvk.js} +2 -2
  93. package/dist/web/assets/{play-CjWTsI9z.js → play-DGCzapdE.js} +1 -1
  94. package/dist/web/assets/{python-CvZQM_g2.js → python-DRPzruv8.js} +1 -1
  95. package/dist/web/assets/{refresh-cw-CeHT_tXT.js → refresh-cw-BKF4NhDI.js} +1 -1
  96. package/dist/web/assets/{save-CmJ92Odx.js → save-DQXtfx_4.js} +1 -1
  97. package/dist/web/assets/{square-B00f_944.js → square-Dp5eGICS.js} +1 -1
  98. package/dist/web/assets/square-pen-j-mZ_UkO.js +1 -0
  99. package/dist/web/assets/{toggleHighContrast-C6N52VOS.js → toggleHighContrast-wDmA5YPb.js} +1 -1
  100. package/dist/web/assets/{training-model-data-B7-1Bxil.js → training-model-data-V8276E5q.js} +1 -1
  101. package/dist/web/assets/{tsMode-CDIfvnHn.js → tsMode-DELTv39m.js} +1 -1
  102. package/dist/web/assets/{upload-DK0-5jXz.js → upload-_rNli8wK.js} +1 -1
  103. package/dist/web/assets/{useLocalAgentSchedules-BUkZjV9E.js → useLocalAgentSchedules-DRVUfTbv.js} +1 -1
  104. package/dist/web/assets/wifi-off-uKPwd8A7.js +1 -0
  105. package/dist/web/assets/{workers-BfcjsZ3C.js → workers-CXbluSB3.js} +1 -1
  106. package/dist/web/assets/{yaml-CNqgAihH.js → yaml-BMqi-3ui.js} +1 -1
  107. package/dist/web/index.html +2 -2
  108. package/docs/command-reference.md +6 -1
  109. package/package.json +1 -1
  110. package/dist/web/assets/CommandMenu-DdR82TLd.js +0 -1
  111. package/dist/web/assets/CommunityView-DSik4sd2.css +0 -1
  112. package/dist/web/assets/CommunityView-Dqu4cos1.js +0 -1
  113. package/dist/web/assets/LabModelVersionDetailPage-BPUvR5XP.js +0 -1
  114. package/dist/web/assets/LabSkillSidebar-CnuyFZ1G.js +0 -1
  115. package/dist/web/assets/LabsRoute-CYk2dzQp.js +0 -3
  116. package/dist/web/assets/LabsRoute-CoSPO4HR.css +0 -1
  117. package/dist/web/assets/MainChatThread-0Tc95p0t.js +0 -2
  118. package/dist/web/assets/MainPane-Bke4JEHC.js +0 -6
  119. package/dist/web/assets/Messages-Bae_sFx5.js +0 -9
  120. package/dist/web/assets/OutputsPage-XmIreC0M.js +0 -1
  121. package/dist/web/assets/RightChatPanelStack-BMOtbjus.js +0 -1
  122. package/dist/web/assets/ScheduledWorkPage-Cn5a9VLV.js +0 -1
  123. package/dist/web/assets/SettingsView-DXF8z3P2.js +0 -6
  124. package/dist/web/assets/TeamChatView-Cgxm-pKA.css +0 -1
  125. package/dist/web/assets/WorkspaceDiffPanel-jaJU08NH.js +0 -14
  126. package/dist/web/assets/WorkspaceEnvironmentMenu-D0nvQmmj.js +0 -32
  127. package/dist/web/assets/index-De6p2npi.js +0 -1
  128. package/dist/web/assets/index-UUM3pwfd.css +0 -1
  129. package/dist/web/assets/index-Ure41UF0.js +0 -178
  130. package/dist/web/assets/monitor-POfnZCWw.js +0 -1
  131. package/dist/web/assets/reply-BkH8nKWG.js +0 -1
  132. package/dist/web/assets/square-pen-LHr8bFfZ.js +0 -1
  133. package/dist/web/assets/wifi-off-BQGq-son.js +0 -1
@@ -1,9 +1,9 @@
1
- import{c as L,r as p,j as a,C as oe,P as ce,n as V,aF as ue,X as de,aY as I,aZ as j,a_ as he,aT as H}from"./index-Ure41UF0.js";const fe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],kn=L("arrow-right",fe);const pe=[["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"}]],wn=L("bot",pe);const me=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],vn=L("clipboard",me);const ge=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],yn=L("code-xml",ge);const ke=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],bn=L("file",ke);const we=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],xn=L("minimize-2",we);const ve=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],In=L("pause",ve);const ye=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],jn=L("trash-2",ye);const be=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Ln=L("workflow",be);function Pn({value:e,options:r,disabled:n,compact:t,className:s,icon:i,placement:l="bottom",label:c,tooltip:o,searchable:u=!1,onChange:m}){const[f,v]=p.useState(!1),[w,k]=p.useState(""),d=p.useRef(null),b=r.find(h=>h.value===e)??r[0],g=w.trim().toLowerCase(),y=g?r.filter(h=>[h.label,h.shortLabel,h.description].some(x=>x?.toLowerCase().includes(g))):r;return p.useEffect(()=>{if(!f){k("");return}function h(P){d.current?.contains(P.target)||v(!1)}function x(P){P.key==="Escape"&&v(!1)}return document.addEventListener("pointerdown",h),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",h),document.removeEventListener("keydown",x)}},[f]),a.jsxs("div",{className:`dropdown-select ${s??""} ${t?"compact":""} ${l==="top"?"open-up":""}`,"data-tooltip":o,ref:d,children:[a.jsxs("button",{type:"button",className:`dropdown-trigger ${f?"active":""}`,disabled:n,"aria-label":c,"aria-haspopup":"menu","aria-expanded":f,onClick:()=>v(h=>!h),children:[i,a.jsx("span",{children:b?.shortLabel??b?.label??e}),a.jsx(oe,{size:14})]}),f&&a.jsxs("div",{className:"dropdown-menu",role:"menu",children:[u?a.jsxs("label",{className:"dropdown-search",onClick:h=>h.stopPropagation(),children:[a.jsxs("span",{className:"sr-only",children:["Search ",c]}),a.jsx("input",{autoFocus:!0,placeholder:`Search ${c.toLowerCase()}`,value:w,onChange:h=>k(h.target.value)})]}):null,y.map(h=>a.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":h.value===e,disabled:h.disabled,className:[h.value===e?"selected":"",h.separatorBefore?"separator-before":"",h.icon?"with-icon":""].filter(Boolean).join(" "),onClick:()=>{h.disabled||(m(h.value),k(""),v(!1))},children:[a.jsxs("span",{children:[h.icon==="plus"?a.jsx(ce,{size:13}):null,a.jsx("span",{children:h.label})]}),h.description&&a.jsx("small",{children:h.description})]},h.value)),y.length?null:a.jsx("div",{className:"dropdown-empty",children:"No matches"})]})]})}const U=new Map,xe=15e3;function Y(e,r,n){const t=G(e),[s,i]=p.useState(()=>t.getUrl(r,n));return p.useEffect(()=>{let l=!1;return i(t.getUrl(r,n)),t.loadUrl(r,n).then(c=>{l||i(c)}),()=>{l=!0}},[r,n,t]),s}function G(e){const[,r]=p.useState(0),n=p.useCallback((i,l)=>!e||!i||!l?null:B(D(e,i,l)),[e]),t=p.useCallback(async(i,l)=>{if(!e||!i||!l)return null;const c=D(e,i,l),o=B(c);if(o)return o;const u=U.get(c);if(u?.state==="loading")return u.promise;const m=V.signWorkspaceImageUrl(e,{appId:i,path:l}).then(f=>(U.set(c,{state:"ready",url:f.url,expiresAt:f.expiresAt}),r(v=>v+1),f.url)).catch(()=>(U.delete(c),r(f=>f+1),null));return U.set(c,{state:"loading",promise:m}),m},[e]),s=p.useCallback((i,l)=>{t(i,l)},[t]);return p.useMemo(()=>({ensureUrl:s,getUrl:n,loadUrl:t}),[s,n,t])}function B(e){const r=U.get(e);return r?.state!=="ready"?null:r.expiresAt<=Date.now()+xe?(U.delete(e),null):r.url}function D(e,r,n){return`${e.serverUrl}\0${e.token}\0${r}\0${n}`}function Ie({open:e,src:r,title:n,onClose:t}){const[s,i]=p.useState(!1);if(p.useEffect(()=>{if(!e)return;const o=u=>{u.key==="Escape"&&t()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,e]),p.useEffect(()=>{i(!1)},[r]),!e||!r)return null;const l=(()=>{const o=n.split("/").pop()?.trim();if(o&&/\.[A-Za-z0-9]+$/.test(o))return o;try{const m=new URL(r,window.location.href).pathname.split("/").pop()?.trim();if(m&&/\.[A-Za-z0-9]+$/.test(m))return m}catch{}return"image.png"})(),c=()=>{const o=document.createElement("a");o.href=r,o.download=l,o.rel="noopener",document.body.appendChild(o),o.click(),o.remove()};return a.jsx("div",{className:"image-lightbox-backdrop",role:"presentation",onMouseDown:o=>{o.target===o.currentTarget&&t()},children:a.jsxs("section",{"aria-label":n?`Image preview: ${n}`:"Image preview","aria-modal":"true",className:"image-lightbox-dialog",role:"dialog",children:[a.jsxs("header",{className:"image-lightbox-header",children:[a.jsx("span",{title:n,children:n}),a.jsxs("div",{className:"image-lightbox-actions",children:[a.jsx("button",{type:"button","aria-label":"Download image",title:"Download",onClick:c,children:a.jsx(ue,{size:16})}),a.jsx("button",{type:"button","aria-label":"Close image preview",title:"Close",onClick:t,children:a.jsx(de,{size:16})})]})]}),a.jsx("div",{className:"image-lightbox-frame",children:s?a.jsx("div",{className:"image-lightbox-error",children:"Image preview unavailable"}):a.jsx("img",{alt:n||"Image preview",decoding:"async",draggable:!1,src:r,onError:()=>i(!0)})})]})})}const je=new Set(["bash","c","cc","cjs","cpp","css","csv","env","gif","go","graphql","h","hpp","html","ico","java","jpeg","jpg","js","json","jsx","lock","lockb","md","mdx","m4v","mjs","mov","mp4","png","py","rs","scss","sh","sql","svg","toml","ts","tsx","txt","webp","webm","yaml","yml","zsh"]),Le=new Set(["AGENTS.md","Dockerfile","LICENSE","Makefile","README"]),O=String.raw`[A-Za-z0-9_.@+-]+`,Pe=new RegExp(String.raw`^(?:(?:\.{1,2}|~)?[\\/]|[A-Za-z]:[\\/])?(?:${O}[\\/])+${O}(?::\d+(?::\d+)?)?`),Me=new RegExp(String.raw`^${O}(?::\d+(?::\d+)?)?`),Ue=/^(?:workspace|sandbox):file:[^\s<>()]+/;function Mn({projectTargetDetail:e,projectTargetValue:r,workspaceRepoPath:n,workspaceTargetValue:t}){const s=n?.trim();return s||(t!=="local"||!r.startsWith("local:")?null:e.trim()||null)}function Ee(e,r,n={}){if(!Se(e[r-1]))return null;const t=e.slice(r),s=Ue.exec(t),i=s?null:Pe.exec(t),l=s||i?null:Me.exec(t),c=Q((s??i??l)?.[0]??"");if(!c)return null;const o=C(c,n);return o?{...o,end:r+c.length}:null}function C(e,r={}){const n=Q(e.trim().replace(/^['"`]+|['"`]+$/g,""));if(!n||/^https?:\/\//i.test(n))return null;const s=$e(Ne(n)).replace(/:\d+(?::\d+)?$/,"");return Re(s)?{displayPath:n,path:Ce(s,r.workspaceRootPath)}:null}function Ne(e){const r=/^(workspace|sandbox):file:(.*)$/i.exec(e);if(!r)return e;const n=r[1]?.toLowerCase();let t=r[2]??"";return n==="sandbox"&&(t=t.replace(/^\/workspace\/app\//,"").replace(/^\/workspace\//,"")),t}function $e(e){if(!/^file:\/\//i.test(e))return e;try{return decodeURIComponent(new URL(e).pathname)}catch{return e.replace(/^file:\/\//i,"")}}function Ce(e,r){let n=e.replace(/\\/g,"/").replace(/^\.\/+/,"");const t=r?.trim().replace(/\\/g,"/").replace(/\/+$/,"");if(!t)return n;n.startsWith(`${t}/`)&&(n=n.slice(t.length+1));const s=t.split("/").filter(Boolean).at(-1);return s&&n.startsWith(`${s}/`)&&(n=n.slice(s.length+1)),n}function Re(e){const r=e.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??e;if(Le.has(r)||r.startsWith(".")&&r.length>1)return!0;const n=r.includes(".")?r.split(".").at(-1)?.toLowerCase():null;return!!(n&&je.has(n))}function Se(e){return!e||/[\s([{<"'`]/.test(e)}function Q(e){return e.replace(/[.,;!?]+$/,"").replace(/[\])}]+$/,"")}const E=new Map,_e=15e3;function J(e,r){const n=ee(e),[t,s]=p.useState(()=>n.getUrl(r));return p.useEffect(()=>{let i=!1;return s(n.getUrl(r)),n.loadUrl(r).then(l=>{i||s(l)}),()=>{i=!0}},[r,n]),t}function ee(e){const[,r]=p.useState(0),n=p.useCallback(s=>!e||!s?null:q(X(e,s)),[e]),t=p.useCallback(async s=>{if(!e||!s)return null;const i=X(e,s),l=q(i);if(l)return l;const c=E.get(i);if(c?.state==="loading")return c.promise;const o=V.signLocalImageUrl(e,{path:s}).then(u=>(E.set(i,{state:"ready",url:u.url,expiresAt:u.expiresAt}),r(m=>m+1),u.url)).catch(()=>(E.delete(i),r(u=>u+1),null));return E.set(i,{state:"loading",promise:o}),o},[e]);return p.useMemo(()=>({getUrl:n,loadUrl:t}),[n,t])}function q(e){const r=E.get(e);return r?.state!=="ready"?null:r.expiresAt<=Date.now()+_e?(E.delete(e),null):r.url}function X(e,r){return`${e.serverUrl}\0${e.token}\0${r}`}function ne(e){const r=e.replace(/\r\n/g,`
1
+ import{c as L,r as p,j as a,C as oe,P as ce,n as Z,aE as ue,X as de,aW as I,aX as j,aY as he,aR as T}from"./index-Cxq5q-6B.js";const fe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],kn=L("arrow-right",fe);const pe=[["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"}]],wn=L("bot",pe);const me=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],vn=L("clipboard",me);const ge=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],yn=L("code-xml",ge);const ke=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],bn=L("file",ke);const we=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],xn=L("minimize-2",we);const ve=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],In=L("pause",ve);const ye=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],jn=L("trash-2",ye);const be=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Ln=L("workflow",be);function Pn({value:e,options:r,disabled:n,compact:t,className:s,icon:i,placement:l="bottom",label:c,tooltip:o,searchable:u=!1,onChange:m}){const[f,v]=p.useState(!1),[w,k]=p.useState(""),d=p.useRef(null),b=r.find(h=>h.value===e)??r[0],g=w.trim().toLowerCase(),y=g?r.filter(h=>[h.label,h.shortLabel,h.description].some(x=>x?.toLowerCase().includes(g))):r;return p.useEffect(()=>{if(!f){k("");return}function h(P){d.current?.contains(P.target)||v(!1)}function x(P){P.key==="Escape"&&v(!1)}return document.addEventListener("pointerdown",h),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",h),document.removeEventListener("keydown",x)}},[f]),a.jsxs("div",{className:`dropdown-select ${s??""} ${t?"compact":""} ${l==="top"?"open-up":""}`,"data-tooltip":o,ref:d,children:[a.jsxs("button",{type:"button",className:`dropdown-trigger ${f?"active":""}`,disabled:n,"aria-label":c,"aria-haspopup":"menu","aria-expanded":f,onClick:()=>v(h=>!h),children:[i,a.jsx("span",{children:b?.shortLabel??b?.label??e}),a.jsx(oe,{size:14})]}),f&&a.jsxs("div",{className:"dropdown-menu",role:"menu",children:[u?a.jsxs("label",{className:"dropdown-search",onClick:h=>h.stopPropagation(),children:[a.jsxs("span",{className:"sr-only",children:["Search ",c]}),a.jsx("input",{autoFocus:!0,placeholder:`Search ${c.toLowerCase()}`,value:w,onChange:h=>k(h.target.value)})]}):null,y.map(h=>a.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":h.value===e,disabled:h.disabled,className:[h.value===e?"selected":"",h.separatorBefore?"separator-before":"",h.icon?"with-icon":""].filter(Boolean).join(" "),onClick:()=>{h.disabled||(m(h.value),k(""),v(!1))},children:[a.jsxs("span",{children:[h.icon==="plus"?a.jsx(ce,{size:13}):null,a.jsx("span",{children:h.label})]}),h.description&&a.jsx("small",{children:h.description})]},h.value)),y.length?null:a.jsx("div",{className:"dropdown-empty",children:"No matches"})]})]})}const U=new Map,xe=15e3;function Y(e,r,n){const t=G(e),[s,i]=p.useState(()=>t.getUrl(r,n));return p.useEffect(()=>{let l=!1;return i(t.getUrl(r,n)),t.loadUrl(r,n).then(c=>{l||i(c)}),()=>{l=!0}},[r,n,t]),s}function G(e){const[,r]=p.useState(0),n=p.useCallback((i,l)=>!e||!i||!l?null:B(D(e,i,l)),[e]),t=p.useCallback(async(i,l)=>{if(!e||!i||!l)return null;const c=D(e,i,l),o=B(c);if(o)return o;const u=U.get(c);if(u?.state==="loading")return u.promise;const m=Z.signWorkspaceImageUrl(e,{appId:i,path:l}).then(f=>(U.set(c,{state:"ready",url:f.url,expiresAt:f.expiresAt}),r(v=>v+1),f.url)).catch(()=>(U.delete(c),r(f=>f+1),null));return U.set(c,{state:"loading",promise:m}),m},[e]),s=p.useCallback((i,l)=>{t(i,l)},[t]);return p.useMemo(()=>({ensureUrl:s,getUrl:n,loadUrl:t}),[s,n,t])}function B(e){const r=U.get(e);return r?.state!=="ready"?null:r.expiresAt<=Date.now()+xe?(U.delete(e),null):r.url}function D(e,r,n){return`${e.serverUrl}\0${e.token}\0${r}\0${n}`}function Ie({open:e,src:r,title:n,onClose:t}){const[s,i]=p.useState(!1);if(p.useEffect(()=>{if(!e)return;const o=u=>{u.key==="Escape"&&t()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,e]),p.useEffect(()=>{i(!1)},[r]),!e||!r)return null;const l=(()=>{const o=n.split("/").pop()?.trim();if(o&&/\.[A-Za-z0-9]+$/.test(o))return o;try{const m=new URL(r,window.location.href).pathname.split("/").pop()?.trim();if(m&&/\.[A-Za-z0-9]+$/.test(m))return m}catch{}return"image.png"})(),c=()=>{const o=document.createElement("a");o.href=r,o.download=l,o.rel="noopener",document.body.appendChild(o),o.click(),o.remove()};return a.jsx("div",{className:"image-lightbox-backdrop",role:"presentation",onMouseDown:o=>{o.target===o.currentTarget&&t()},children:a.jsxs("section",{"aria-label":n?`Image preview: ${n}`:"Image preview","aria-modal":"true",className:"image-lightbox-dialog",role:"dialog",children:[a.jsxs("header",{className:"image-lightbox-header",children:[a.jsx("span",{title:n,children:n}),a.jsxs("div",{className:"image-lightbox-actions",children:[a.jsx("button",{type:"button","aria-label":"Download image",title:"Download",onClick:c,children:a.jsx(ue,{size:16})}),a.jsx("button",{type:"button","aria-label":"Close image preview",title:"Close",onClick:t,children:a.jsx(de,{size:16})})]})]}),a.jsx("div",{className:"image-lightbox-frame",children:s?a.jsx("div",{className:"image-lightbox-error",children:"Image preview unavailable"}):a.jsx("img",{alt:n||"Image preview",decoding:"async",draggable:!1,src:r,onError:()=>i(!0)})})]})})}const je=new Set(["bash","c","cc","cjs","cpp","css","csv","env","gif","go","graphql","h","hpp","html","ico","java","jpeg","jpg","js","json","jsx","lock","lockb","md","mdx","m4v","mjs","mov","mp4","png","py","rs","scss","sh","sql","svg","toml","ts","tsx","txt","webp","webm","yaml","yml","zsh"]),Le=new Set(["AGENTS.md","Dockerfile","LICENSE","Makefile","README"]),O=String.raw`[A-Za-z0-9_.@+-]+`,Pe=new RegExp(String.raw`^(?:(?:\.{1,2}|~)?[\\/]|[A-Za-z]:[\\/])?(?:${O}[\\/])+${O}(?::\d+(?::\d+)?)?`),Me=new RegExp(String.raw`^${O}(?::\d+(?::\d+)?)?`),Ue=/^(?:workspace|sandbox):file:[^\s<>()]+/;function Mn({projectTargetDetail:e,projectTargetValue:r,workspaceRepoPath:n,workspaceTargetValue:t}){const s=n?.trim();return s||(t!=="local"||!r.startsWith("local:")?null:e.trim()||null)}function Ee(e,r,n={}){if(!Se(e[r-1]))return null;const t=e.slice(r),s=Ue.exec(t),i=s?null:Pe.exec(t),l=s||i?null:Me.exec(t),c=Q((s??i??l)?.[0]??"");if(!c)return null;const o=C(c,n);return o?{...o,end:r+c.length}:null}function C(e,r={}){const n=Q(e.trim().replace(/^['"`]+|['"`]+$/g,""));if(!n||/^https?:\/\//i.test(n))return null;const s=$e(Ne(n)).replace(/:\d+(?::\d+)?$/,"");return Re(s)?{displayPath:n,path:Ce(s,r.workspaceRootPath)}:null}function Ne(e){const r=/^(workspace|sandbox):file:(.*)$/i.exec(e);if(!r)return e;const n=r[1]?.toLowerCase();let t=r[2]??"";return n==="sandbox"&&(t=t.replace(/^\/workspace\/app\//,"").replace(/^\/workspace\//,"")),t}function $e(e){if(!/^file:\/\//i.test(e))return e;try{return decodeURIComponent(new URL(e).pathname)}catch{return e.replace(/^file:\/\//i,"")}}function Ce(e,r){let n=e.replace(/\\/g,"/").replace(/^\.\/+/,"");const t=r?.trim().replace(/\\/g,"/").replace(/\/+$/,"");if(!t)return n;n.startsWith(`${t}/`)&&(n=n.slice(t.length+1));const s=t.split("/").filter(Boolean).at(-1);return s&&n.startsWith(`${s}/`)&&(n=n.slice(s.length+1)),n}function Re(e){const r=e.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??e;if(Le.has(r)||r.startsWith(".")&&r.length>1)return!0;const n=r.includes(".")?r.split(".").at(-1)?.toLowerCase():null;return!!(n&&je.has(n))}function Se(e){return!e||/[\s([{<"'`]/.test(e)}function Q(e){return e.replace(/[.,;!?]+$/,"").replace(/[\])}]+$/,"")}const E=new Map,_e=15e3;function J(e,r){const n=ee(e),[t,s]=p.useState(()=>n.getUrl(r));return p.useEffect(()=>{let i=!1;return s(n.getUrl(r)),n.loadUrl(r).then(l=>{i||s(l)}),()=>{i=!0}},[r,n]),t}function ee(e){const[,r]=p.useState(0),n=p.useCallback(s=>!e||!s?null:q(X(e,s)),[e]),t=p.useCallback(async s=>{if(!e||!s)return null;const i=X(e,s),l=q(i);if(l)return l;const c=E.get(i);if(c?.state==="loading")return c.promise;const o=Z.signLocalImageUrl(e,{path:s}).then(u=>(E.set(i,{state:"ready",url:u.url,expiresAt:u.expiresAt}),r(m=>m+1),u.url)).catch(()=>(E.delete(i),r(u=>u+1),null));return E.set(i,{state:"loading",promise:o}),o},[e]);return p.useMemo(()=>({getUrl:n,loadUrl:t}),[n,t])}function q(e){const r=E.get(e);return r?.state!=="ready"?null:r.expiresAt<=Date.now()+_e?(E.delete(e),null):r.url}function X(e,r){return`${e.serverUrl}\0${e.token}\0${r}`}function ne(e){const r=e.replace(/\r\n/g,`
2
2
  `).split(`
3
3
  `),n=[];let t=[],s=[],i=[],l=!1,c,o=null,u,m=0;function f(){t.length!==0&&(n.push({type:"paragraph",content:t.join(`
4
4
  `).trim()}),t=[])}function v(){s.length!==0&&(n.push({type:"blockquote",content:s.join(`
5
5
  `)}),s=[])}function w(){i.length!==0&&(n.push({type:"list",ordered:l,start:c,items:i}),i=[],l=!1,c=void 0)}for(let k=0;k<r.length;k+=1){const d=r[k];if(o){if(Ae(d,m)){n.push({type:"code",content:o.join(`
6
- `),language:u}),o=null,u=void 0,m=0;continue}o.push(d);continue}const b=d.match(/^\s*>\s?(.*)$/);if(b){f(),w(),s.push(b[1]??"");continue}v();const g=Fe(d);if(g){f(),w(),o=g.firstLine===void 0?[]:[g.firstLine],u=g.language,m=g.ticks;continue}const y=Te(r,k);if(y){f(),w(),n.push({type:"table",headers:y.headers,rows:y.rows}),k=y.endIndex;continue}const h=d.match(/^\s*(#{1,4})(?:\s+|(?=\d+[.)]\s+))(.+)$/);if(h){f(),w();const P=h[1].length;n.push({type:"heading",level:P,content:h[2].trim()});continue}const x=d.match(re);if(x){f();const P=!!x[2];i.length>0&&P!==l&&w(),l=P;const T=x[2]?Number(x[2]):null;i.length===0&&(c=T??void 0),i.push(ze(x[3].trim(),T));continue}if(!d.trim()){if(f(),i.length>0&&We(r,k+1)===l)continue;w();continue}w(),t.push(d)}return o&&n.push({type:"code",content:o.join(`
6
+ `),language:u}),o=null,u=void 0,m=0;continue}o.push(d);continue}const b=d.match(/^\s*>\s?(.*)$/);if(b){f(),w(),s.push(b[1]??"");continue}v();const g=We(d);if(g){f(),w(),o=g.firstLine===void 0?[]:[g.firstLine],u=g.language,m=g.ticks;continue}const y=He(r,k);if(y){f(),w(),n.push({type:"table",headers:y.headers,rows:y.rows}),k=y.endIndex;continue}const h=d.match(/^\s*(#{1,4})(?:\s+|(?=\d+[.)]\s+))(.+)$/);if(h){f(),w();const P=h[1].length;n.push({type:"heading",level:P,content:h[2].trim()});continue}const x=d.match(re);if(x){f();const P=!!x[2];i.length>0&&P!==l&&w(),l=P;const H=x[2]?Number(x[2]):null;i.length===0&&(c=H??void 0),i.push(ze(x[3].trim(),H));continue}if(!d.trim()){if(f(),i.length>0&&Fe(r,k+1)===l)continue;w();continue}w(),t.push(d)}return o&&n.push({type:"code",content:o.join(`
7
7
  `),language:u}),v(),f(),w(),n}const Oe=/^\s*(?:#{1,4}\s*|>\s*|\d+[.)]\s*|[-*]\s*)$/;function Un(e,r){if(r)return e;const n=e.lastIndexOf(`
8
- `)+1;return Oe.test(e.slice(n))?e.slice(0,n):e}function Ae(e,r){const n=e.match(/^\s*(`{2,})\s*(?:[A-Za-z0-9_-]+)?\s*$/);return!!(n&&n[1].length>=r)}function Fe(e){const r=e.match(/^\s*(`{2,})\s*([A-Za-z0-9_-]+)?\s*$/);if(r)return{language:r[2],ticks:r[1].length};const n=e.match(/^\s*(`{2,})\s*([A-Za-z][A-Za-z0-9_-]*)(?:\s+(\S.*)|(\S.*))$/);return n?{language:n[2],firstLine:n[3]??n[4],ticks:n[1].length}:null}const re=/^\s*(?:([-*])|(\d+)[.)])\s+(.+)$/;function We(e,r){let n=r;for(;n<e.length&&!e[n].trim();)n+=1;const t=(e[n]??"").match(re);return t?!!t[2]:null}function ze(e,r){const n=/^\[([ xX])]\s*(.*)$/.exec(e);return n?{content:n[2]??"",checked:n[1]?.toLowerCase()==="x",ordinal:r}:{content:e,checked:null,ordinal:r}}function Te(e,r){const n=e[r]??"",t=e[r+1]??"";if(!n.includes("|")||!He(t))return null;const s=A(n);if(s.length===0)return null;const i=[];let l=r+2;for(;l<e.length;){const c=e[l]??"";if(!c.trim()||!c.includes("|"))break;i.push(A(c)),l+=1}return{headers:s,rows:i,endIndex:l-1}}function He(e){const r=A(e);return r.length>0&&r.every(n=>/^:?-{3,}:?$/.test(n.trim()))}function A(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(n=>n.trim())}const Be=new Set([".avif",".gif",".ico",".jpeg",".jpg",".png",".svg",".webp"]);function te({checked:e,inline:r=!1}){return a.jsx("input",{"aria-label":e?"Checked item":"Unchecked item",checked:e,className:`markdown-checkbox ${r?"inline":""}`,disabled:!0,readOnly:!0,type:"checkbox"})}function M(e,r){const n=[];let t=0,s=0;const i=l=>{l>s&&n.push(e.slice(s,l))};for(;t<e.length;){const l=e[t];if(l==="`"){const d=e.indexOf("`",t+1);if(d>t+1){const b=e.slice(t+1,d),g=r.onOpenFileInSidebar&&qe(b,e,t,d+1)?C(b,{workspaceRootPath:r.workspaceRootPath}):null;i(t),n.push(g?F(g.displayPath,g.path,g.displayPath,r,n.length):a.jsx("code",{children:b},n.length)),t=d+1,s=t;continue}}const c=l==="<"||e.startsWith("!<img",t)?Ge(e,t):null;if(c){const d=W(c.src,r);if(d){i(t),n.push(Z(c.alt,d,r,n.length)),t=c.end,s=t;continue}}const o=l==="<"?Je(e,t):null;if(o){i(t),n.push(N(o.label,o.href,r,n.length)),t=o.end,s=t;continue}const u=l==="<"?en(e,t):null;if(u){i(t),n.push(N(u.href,u.href,r,n.length)),t=u.end,s=t;continue}const m=l==="["?Qe(e,t):null;if(m){i(t),n.push(a.jsx(te,{checked:m.checked,inline:!0},n.length)),t=m.end,s=t;continue}const f=e.startsWith("![",t)?Ve(e,t):null;if(f){const d=W(f.href,r);i(t),n.push(d?Z(f.label,d,r,n.length):N(f.label||f.href,f.href,r,n.length)),t=f.end,s=t;continue}const v=l==="["?Ye(e,t):null;if(v){i(t),n.push(N(v.label,v.href,r,n.length)),t=v.end,s=t;continue}const w=De(e,t);if(w){i(t),n.push(N(w.href,w.href,r,n.length)),t=w.end,s=t;continue}const k=r.onOpenFileInSidebar?Ee(e,t,{workspaceRootPath:r.workspaceRootPath}):null;if(k){i(t),n.push(F(k.displayPath,k.path,k.displayPath,r,n.length)),t=k.end,s=t;continue}if(e.startsWith("**",t)){const d=e.indexOf("**",t+2);if(d>t+2){i(t),n.push(a.jsx("strong",{children:e.slice(t+2,d)},n.length)),t=d+2,s=t;continue}}if(e.startsWith("__",t)){const d=e.indexOf("__",t+2);if(d>t+2){i(t),n.push(a.jsx("strong",{children:e.slice(t+2,d)},n.length)),t=d+2,s=t;continue}}t+=1}return i(e.length),n}function De(e,r){const n=r>0?e[r-1]:"";if(n&&!/[\s([{<]/.test(n))return null;const t=e.slice(r),s=/^(?:https?:\/\/|www\.)[^\s<>()]+(?:\([^\s<>()]*\)[^\s<>()]*)*/i.exec(t);if(!s)return null;let i=s[0];for(;/[.,;:!?]$/.test(i);)i=i.slice(0,-1);return i?{href:/^www\./i.test(i)?`https://${i}`:i,end:r+i.length}:null}function qe(e,r,n,t){return Xe(e)?!0:!r.slice(0,n).trim()&&!r.slice(t).trim()}function Xe(e){return/^(?:workspace|sandbox):file:/i.test(e.trim())}function N(e,r,n,t){const s=le(r),i=W(s,n),l=/^https?:\/\//i.test(s),c=i?.kind==="url"?i.src:i?.src??s,o=n.onOpenFileInSidebar?C(s,{workspaceRootPath:n.workspaceRootPath}):null;return!i&&o?F(e,o.path,o.displayPath,n,t):a.jsx("a",{href:l||i?c:"#",className:i?"markdown-image-link":void 0,onBlur:()=>{i&&n.onPreviewImage(null)},onClick:u=>{if(i){u.preventDefault(),cn(i,n),n.onPreviewImage(null);return}if(l&&n.onOpenBrowserLink){u.preventDefault(),n.onOpenBrowserLink(c);return}l||u.preventDefault()},onContextMenu:u=>{u.preventDefault(),n.onPreviewImage(null),n.onOpenLinkMenu(un(c,s,u.clientX,u.clientY))},onFocus:u=>{i&&K(i,n,u.currentTarget)},onMouseEnter:u=>{i&&K(i,n,u.currentTarget)},onMouseLeave:()=>{i&&n.onPreviewImage(null)},rel:l?"noreferrer":void 0,target:l?"_blank":void 0,title:s,children:e},t)}function Z(e,r,n,t){return a.jsx(Ze,{context:n,image:r,label:e},t)}function Ze({context:e,image:r,label:n}){const t=Y(e.connection,r.kind==="workspace"?r.appId:null,r.kind==="workspace"?r.path:null),s=J(e.connection,r.kind==="local"?r.path:null),i=r.kind==="url"?r.src:r.kind==="local"?s:t,l=n.trim()||r.title;return a.jsx("button",{type:"button",className:`markdown-inline-image ${i?"ready":"loading"}`,onClick:()=>{if(r.kind==="url"){e.onOpenImage({src:r.src,title:l});return}if(i){e.onOpenImage({src:i,title:l});return}r.kind!=="local"&&e.onOpenWorkspaceImage({appId:r.appId,path:r.path,title:l})},title:l,children:i?a.jsx("img",{alt:l,decoding:"async",loading:"lazy",src:i}):a.jsx("span",{"aria-hidden":"true"})})}function F(e,r,n,t,s){const i=tn(r,n,t);return i?a.jsx(Ke,{context:t,displayPath:n,image:i,label:e,path:r},s):a.jsx(se,{context:t,displayPath:n,label:e,path:r},s)}function se({context:e,displayPath:r,label:n,path:t}){return a.jsx("a",{href:"#",className:"markdown-file-link",onClick:s=>{s.preventDefault(),e.onOpenFileInSidebar?.(t)},onContextMenu:s=>{s.preventDefault(),e.onPreviewImage(null),e.onOpenLinkMenu(dn(t,r,s.clientX,s.clientY))},title:r,children:n})}function Ke({context:e,displayPath:r,image:n,label:t,path:s}){const i=Y(e.connection,n.kind==="workspace"?n.appId:null,n.kind==="workspace"?n.path:null),l=J(e.connection,n.kind==="local"?n.path:null),c=n.kind==="url"?n.src:n.kind==="local"?l:i,o=n.title||r;return a.jsxs("span",{className:"markdown-file-image-reference",children:[a.jsx(se,{context:e,displayPath:r,label:t,path:s}),a.jsx("button",{type:"button",className:`markdown-file-image-preview ${c?"ready":"loading"}`,onClick:()=>{if(n.kind==="url"){e.onOpenImage({src:n.src,title:o});return}if(c){e.onOpenImage({src:c,title:o});return}n.kind!=="local"&&e.onOpenWorkspaceImage({appId:n.appId,path:n.path,title:o})},title:o,children:c?a.jsx("img",{alt:o,decoding:"async",loading:"lazy",src:c}):a.jsx("span",{"aria-hidden":"true"})})]})}function Ve(e,r){if(!e.startsWith("![",r))return null;const n=r+2,t=e.indexOf("]",n);if(t<n||e[t+1]!=="(")return null;const s=ie(e,t+2);return s?{label:e.slice(n,t),href:s.href,end:s.end}:null}function Ye(e,r){const n=e.indexOf("]",r+1);if(n<=r+1||e[n+1]!=="(")return null;const t=ie(e,n+2);return t?{label:e.slice(r+1,n),href:t.href,end:t.end}:null}function ie(e,r){if(e[r]==="<"){const t=e.indexOf(">",r+1);return t<0||e[t+1]!==")"?null:{href:e.slice(r+1,t),end:t+2}}let n=0;for(let t=r;t<e.length;t+=1){const s=e[t];if(s==="\\"){t+=1;continue}if(s==="("){n+=1;continue}if(s===")"){if(n===0)return{href:e.slice(r,t),end:t+1};n-=1}}return null}function Ge(e,r){const n=e[r]==="!"?r+1:r;if(!/^<img\b/i.test(e.slice(n)))return null;const t=e.indexOf(">",n+4);if(t<0)return null;const s=e.slice(n,t+1),i=_(s,"src");return i?{src:i,alt:_(s,"alt")??_(s,"title")??"",end:t+1}:null}function Qe(e,r){const n=e.slice(r,r+3);return n==="[ ]"?{checked:!1,end:r+3}:n==="[x]"||n==="[X]"?{checked:!0,end:r+3}:null}function Je(e,r){const n=e.slice(r),t=/^<a\s+[^>]*href\s*=\s*(["'])(.*?)\1[^>]*>(.*?)<\/a>/i.exec(n);return t?{href:t[2]??"",label:nn(t[3]??""),end:r+t[0].length}:null}function en(e,r){const n=e.indexOf(">",r+1);if(n<=r+1)return null;const t=e.slice(r+1,n).trim();return rn(t)?{href:t,end:n+1}:null}function nn(e){return e.replace(/<[^>]+>/g,"").trim()||e}function _(e,r){const t=new RegExp(`\\s${r}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);return t?.[1]??t?.[2]??t?.[3]??null}function rn(e){return/^(https?:\/\/|file:\/\/|(?:workspace|sandbox):file:|\/|\.{1,2}\/)/i.test(e)}function W(e,r){const n=le(e);if(!n)return null;if(/^https?:\/\//i.test(n))try{const l=new URL(n),c=on(l,r);return c||(an(l,r.connection)?{kind:"url",src:n,title:I(l.searchParams.get("path")??l.pathname)}:null)}catch{return null}const t=ln(n),s=z(t??n,r.workspaceRootPath);if(s)return{kind:"url",src:s,title:I(t??n)};if(!t||!j(t)||!r.connection)return null;if(R(t))return{kind:"local",path:t,src:r.localImageUrls.getUrl(t),title:I(t)};if(!r.activeWorkspaceAppId)return null;const i=S(t,r.workspaceRootPath);return!i||!j(i)?null:{kind:"workspace",appId:r.activeWorkspaceAppId,path:i,src:r.workspaceImageUrls.getUrl(r.activeWorkspaceAppId,i),title:I(i)}}function tn(e,r,n){const t=z(e,n.workspaceRootPath)??z(r,n.workspaceRootPath);if(t)return{kind:"url",src:t,title:I(r)};if(!j(e)||!n.connection)return null;if(R(e))return{kind:"local",path:e,src:n.localImageUrls.getUrl(e),title:I(e)};if(!n.activeWorkspaceAppId)return null;const s=S(e,n.workspaceRootPath);return!s||!j(s)?null:{kind:"workspace",appId:n.activeWorkspaceAppId,path:s,src:n.workspaceImageUrls.getUrl(n.activeWorkspaceAppId,s),title:I(s)}}function z(e,r){const n=S(e,r),t="apps/web/public/";if(!n?.startsWith(t))return null;const s=n.slice(t.length);return!s||!sn(s)?null:he(s.split("/").map(encodeURIComponent).join("/"))}function sn(e){const r=e.split("?")[0]?.split("#")[0]??e,n=r.lastIndexOf(".");return n<0?!1:Be.has(r.slice(n).toLowerCase())}function le(e){return e.trim().replace(/^['"`]+|['"`]+$/g,"")}function ln(e){let r=e.trim();if(!r)return null;if(r.startsWith("file://"))try{return decodeURIComponent(new URL(r).pathname)}catch{return r.replace(/^file:\/\//,"")}if(R(r))return r;const n=r.indexOf("#");n>=0&&(r=r.slice(0,n));const t=r.indexOf("?");return t>=0&&(r=r.slice(0,t)),r}function R(e){return/^file:\/\//i.test(e)||/^\//.test(e)||/^[A-Za-z]:[\\/]/.test(e)}function S(e,r){let n=e.trim().replace(/^['"`]+|['"`]+$/g,"");if(!n)return null;if(n.startsWith("file://"))try{n=decodeURIComponent(new URL(n).pathname)}catch{n=n.replace(/^file:\/\//,"")}if(n=n.replace(/\\/g,"/"),R(n)){const s=r?.trim().replace(/\\/g,"/").replace(/\/+$/,"");if(!s||!n.startsWith(`${s}/`))return null;n=n.slice(s.length+1)}n=n.replace(/^\.\/+/,"");const t=n.split("/").filter(Boolean);return t.length===0||t.some(s=>s==="."||s===".."||s===".git")?null:t.join("/")}function an(e,r){if(r){const t=new URL(r.serverUrl);if(e.origin===t.origin){if(e.pathname==="/v1/local-image"||/\/v1\/workspaces\/[^/]+\/file-image$/.test(e.pathname))return!1;if(e.pathname==="/v1/assets/workspace-image"||e.pathname==="/v1/assets/chat-attachment-image")return!0}}if(j(e.pathname))return!0;const n=e.searchParams.get("path");return!!(n&&j(n))}function on(e,r){if(!r.connection)return null;const n=new URL(r.connection.serverUrl);if(e.origin!==n.origin)return null;const t=e.pathname==="/v1/assets/workspace-image"?e.searchParams.get("path"):null;if(t&&j(t))return{kind:"url",src:e.toString(),title:I(t)};const s=e.pathname==="/v1/assets/chat-attachment-image"?e.searchParams.get("storageName"):null;if(s&&j(s))return{kind:"url",src:e.toString(),title:I(s)};const i=/^\/v1\/workspaces\/([^/]+)\/file-image$/.exec(e.pathname),l=i?e.searchParams.get("path"):null;if(!i||!l||!j(l))return null;const c=decodeURIComponent(i[1]),o=S(l,r.workspaceRootPath);return!o||!j(o)?null:{kind:"workspace",appId:c,path:o,src:r.workspaceImageUrls.getUrl(c,o),title:I(o)}}function cn(e,r){if(e.kind==="url"){r.onOpenImage(e);return}if(e.kind==="local"){e.src&&r.onOpenImage({src:e.src,title:e.title});return}if(e.src){r.onOpenImage({src:e.src,title:e.title});return}r.onOpenWorkspaceImage({appId:e.appId,path:e.path,title:e.title})}function K(e,r,n){if(e.kind==="url"){r.onPreviewImage($(e,n));return}if(e.kind==="local"){if(e.src){r.onPreviewImage($({src:e.src,title:e.title},n));return}r.localImageUrls.loadUrl(e.path).then(t=>{t&&n.matches(":hover")&&r.onPreviewImage($({src:t,title:e.title},n))});return}if(e.src){r.onPreviewImage($({src:e.src,title:e.title},n));return}r.workspaceImageUrls.loadUrl(e.appId,e.path).then(t=>{t&&n.matches(":hover")&&r.onPreviewImage($({src:t,title:e.title},n))})}function $(e,r){const n=r.getBoundingClientRect(),t=236,s=172,i=12,l=Math.max(i,Math.min(n.left,window.innerWidth-t-i)),c=n.bottom+8,o=c+s<=window.innerHeight-i?c:Math.max(i,n.top-s-8);return{...e,x:l,y:o}}function un(e,r,n,t){return{kind:"browser",browserHref:e,displayHref:r,x:Math.max(8,Math.min(n,window.innerWidth-220-8)),y:Math.max(8,Math.min(t,window.innerHeight-142-8))}}function dn(e,r,n,t){return{kind:"file",path:e,displayPath:r,x:Math.max(8,Math.min(n,window.innerWidth-220-8)),y:Math.max(8,Math.min(t,window.innerHeight-72-8))}}async function hn(e){const r=e.trim();if(!r)return!1;const n=window.openpond?.files;if(!n)return!1;try{return(await n.reveal({path:r})).ok}catch{return!1}}async function En(e,r){const n=e.trim(),t=window.openpond?.files;if(!n||!t?.saveAs)return{ok:!1,canceled:!1,path:null};try{const s=await t.saveAs({path:n,suggestedName:r});return{ok:s.ok,canceled:s.canceled,path:s.path??null}}catch{return{ok:!1,canceled:!1,path:null}}}function Nn({activeWorkspaceAppId:e=null,connection:r=null,content:n,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i=null}){const l=p.useMemo(()=>ne(n),[n]),[c,o]=p.useState(null),[u,m]=p.useState(null),[f,v]=p.useState(null),w=ee(r),k=G(r),d=p.useCallback(g=>{k.loadUrl(g.appId,g.path).then(y=>{y&&o({src:y,title:g.title})})},[k]),b=p.useMemo(()=>({activeWorkspaceAppId:e,connection:r,onOpenBrowserLink:t,onOpenFileInSidebar:s,onOpenLinkMenu:v,onOpenImage:o,onOpenWorkspaceImage:d,onPreviewImage:m,localImageUrls:w,workspaceImageUrls:k,workspaceRootPath:i}),[e,r,d,w,t,s,k,i]);return p.useEffect(()=>{if(!f)return;const g=()=>v(null),y=h=>{h.key==="Escape"&&g()};return window.addEventListener("click",g),window.addEventListener("keydown",y),window.addEventListener("scroll",g,!0),()=>{window.removeEventListener("click",g),window.removeEventListener("keydown",y),window.removeEventListener("scroll",g,!0)}},[f]),a.jsxs("div",{className:"markdown-message",children:[ae(l,b,i),u&&a.jsx(pn,{preview:u}),f&&a.jsx(mn,{menu:f,onClose:()=>v(null),onOpenBrowserLink:t,onOpenFileInSidebar:s}),a.jsx(Ie,{open:!!c,src:c?.src??null,title:c?.title??"",onClose:()=>o(null)})]})}function ae(e,r,n,t="block"){return e.map((s,i)=>{const l=`${t}-${i}`;if(s.type==="blockquote")return a.jsx("blockquote",{className:"markdown-blockquote",children:ae(ne(s.content),r,n,`${l}-quote`)},l);if(s.type==="code"){const c=fn(s.content,n);return c?a.jsx("div",{className:"markdown-file-reference-block",children:c.map((o,u)=>a.jsx("div",{className:"markdown-file-reference-line",children:M(o,r)},u))},l):a.jsx("pre",{className:"markdown-code-block",children:a.jsx("code",{children:s.content})},l)}if(s.type==="list"){const c=s.items.map((o,u)=>a.jsxs("li",{className:o.checked===null?void 0:"markdown-task-list-item",value:s.ordered?o.ordinal??void 0:void 0,children:[o.checked===null?null:a.jsx(te,{checked:o.checked}),a.jsx("span",{children:M(o.content,r)})]},u));return s.ordered?a.jsx("ol",{className:"markdown-list",start:s.start,children:c},l):a.jsx("ul",{className:"markdown-list",children:c},l)}if(s.type==="heading"){const c=s.level===1?"h1":s.level===2?"h2":s.level===3?"h3":"h4";return a.jsx(c,{className:"markdown-heading",children:M(s.content,r)},l)}return s.type==="table"?a.jsx("div",{className:"markdown-table-wrap",children:a.jsxs("table",{className:"markdown-table",children:[a.jsx("thead",{children:a.jsx("tr",{children:s.headers.map((c,o)=>a.jsx("th",{children:M(c,r)},o))})}),a.jsx("tbody",{children:s.rows.map((c,o)=>a.jsx("tr",{children:s.headers.map((u,m)=>a.jsx("td",{children:M(c[m]??"",r)},m))},o))})]})},l):a.jsx("p",{className:"markdown-paragraph",children:M(s.content,r)},l)})}function fn(e,r){const n=e.split(`
9
- `),t=[];for(const s of n){const i=s.trim();if(!i)continue;const c=i.replace(/^(?:[-*]|\d+[.)])\s+/,"").trim().replace(/^`+|`+$/g,"").trim();if(!c||!C(c,{workspaceRootPath:r}))return null;t.push(c)}return t.length>0?t:null}function pn({preview:e}){const[r,n]=p.useState(!1);return p.useEffect(()=>{n(!1)},[e.src]),a.jsxs("div",{className:`markdown-image-hover-preview ${r?"unavailable":""}`,style:{left:e.x,top:e.y},children:[r?a.jsx("span",{children:"Preview unavailable"}):a.jsx("img",{alt:"",src:e.src,onError:()=>n(!0)}),a.jsx("span",{children:e.title})]})}function mn({menu:e,onClose:r,onOpenBrowserLink:n,onOpenFileInSidebar:t}){return e.kind==="file"?a.jsxs("div",{className:"markdown-link-menu",role:"menu",style:{left:e.x,top:e.y},onClick:s=>s.stopPropagation(),children:[a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{t?.(e.path),r()},children:"Open in sidebar"}),a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{hn(e.path),r()},children:"Open externally"}),a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{H(e.displayPath),r()},children:"Copy path"})]}):a.jsxs("div",{className:"markdown-link-menu",role:"menu",style:{left:e.x,top:e.y},onClick:s=>s.stopPropagation(),children:[a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{n?n(e.browserHref):window.open(e.browserHref,"_blank","noopener,noreferrer"),r()},children:"Open in sidebar"}),a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{n?n(e.browserHref,{newTab:!0}):window.open(e.browserHref,"_blank","noopener,noreferrer"),r()},children:"Open in new tab"}),a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{window.open(e.browserHref,"_blank","noopener,noreferrer"),r()},children:"Open externally"}),a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{H(e.displayHref),r()},children:"Copy link"})]})}export{kn as A,wn as B,yn as C,Pn as D,bn as F,Ie as I,xn as M,In as P,jn as T,Ln as W,vn as a,Nn as b,Mn as c,Un as d,J as e,C as n,hn as r,En as s,Y as u};
8
+ `)+1;return Oe.test(e.slice(n))?e.slice(0,n):e}function Ae(e,r){const n=e.match(/^\s*(`{2,})\s*(?:[A-Za-z0-9_-]+)?\s*$/);return!!(n&&n[1].length>=r)}function We(e){const r=e.match(/^\s*(`{2,})\s*([A-Za-z0-9_-]+)?\s*$/);if(r)return{language:r[2],ticks:r[1].length};const n=e.match(/^\s*(`{2,})\s*([A-Za-z][A-Za-z0-9_-]*)(?:\s+(\S.*)|(\S.*))$/);return n?{language:n[2],firstLine:n[3]??n[4],ticks:n[1].length}:null}const re=/^\s*(?:([-*])|(\d+)[.)])\s+(.+)$/;function Fe(e,r){let n=r;for(;n<e.length&&!e[n].trim();)n+=1;const t=(e[n]??"").match(re);return t?!!t[2]:null}function ze(e,r){const n=/^\[([ xX])]\s*(.*)$/.exec(e);return n?{content:n[2]??"",checked:n[1]?.toLowerCase()==="x",ordinal:r}:{content:e,checked:null,ordinal:r}}function He(e,r){const n=e[r]??"",t=e[r+1]??"";if(!n.includes("|")||!Te(t))return null;const s=A(n);if(s.length===0)return null;const i=[];let l=r+2;for(;l<e.length;){const c=e[l]??"";if(!c.trim()||!c.includes("|"))break;i.push(A(c)),l+=1}return{headers:s,rows:i,endIndex:l-1}}function Te(e){const r=A(e);return r.length>0&&r.every(n=>/^:?-{3,}:?$/.test(n.trim()))}function A(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(n=>n.trim())}const Be=new Set([".avif",".gif",".ico",".jpeg",".jpg",".png",".svg",".webp"]);function te({checked:e,inline:r=!1}){return a.jsx("input",{"aria-label":e?"Checked item":"Unchecked item",checked:e,className:`markdown-checkbox ${r?"inline":""}`,disabled:!0,readOnly:!0,type:"checkbox"})}function M(e,r){const n=[];let t=0,s=0;const i=l=>{l>s&&n.push(e.slice(s,l))};for(;t<e.length;){const l=e[t];if(l==="`"){const d=e.indexOf("`",t+1);if(d>t+1){const b=e.slice(t+1,d),g=r.onOpenFileInSidebar&&qe(b,e,t,d+1)?C(b,{workspaceRootPath:r.workspaceRootPath}):null;i(t),n.push(g?W(g.displayPath,g.path,g.displayPath,r,n.length):a.jsx("code",{children:b},n.length)),t=d+1,s=t;continue}}const c=l==="<"||e.startsWith("!<img",t)?Ge(e,t):null;if(c){const d=F(c.src,r);if(d){i(t),n.push(K(c.alt,d,r,n.length)),t=c.end,s=t;continue}}const o=l==="<"?Je(e,t):null;if(o){i(t),n.push(N(o.label,o.href,r,n.length)),t=o.end,s=t;continue}const u=l==="<"?en(e,t):null;if(u){i(t),n.push(N(u.href,u.href,r,n.length)),t=u.end,s=t;continue}const m=l==="["?Qe(e,t):null;if(m){i(t),n.push(a.jsx(te,{checked:m.checked,inline:!0},n.length)),t=m.end,s=t;continue}const f=e.startsWith("![",t)?Ze(e,t):null;if(f){const d=F(f.href,r);i(t),n.push(d?K(f.label,d,r,n.length):N(f.label||f.href,f.href,r,n.length)),t=f.end,s=t;continue}const v=l==="["?Ye(e,t):null;if(v){i(t),n.push(N(v.label,v.href,r,n.length)),t=v.end,s=t;continue}const w=De(e,t);if(w){i(t),n.push(N(w.href,w.href,r,n.length)),t=w.end,s=t;continue}const k=r.onOpenFileInSidebar?Ee(e,t,{workspaceRootPath:r.workspaceRootPath}):null;if(k){i(t),n.push(W(k.displayPath,k.path,k.displayPath,r,n.length)),t=k.end,s=t;continue}if(e.startsWith("**",t)){const d=e.indexOf("**",t+2);if(d>t+2){i(t),n.push(a.jsx("strong",{children:e.slice(t+2,d)},n.length)),t=d+2,s=t;continue}}if(e.startsWith("__",t)){const d=e.indexOf("__",t+2);if(d>t+2){i(t),n.push(a.jsx("strong",{children:e.slice(t+2,d)},n.length)),t=d+2,s=t;continue}}t+=1}return i(e.length),n}function De(e,r){const n=r>0?e[r-1]:"";if(n&&!/[\s([{<]/.test(n))return null;const t=e.slice(r),s=/^(?:https?:\/\/|www\.)[^\s<>()]+(?:\([^\s<>()]*\)[^\s<>()]*)*/i.exec(t);if(!s)return null;let i=s[0];for(;/[.,;:!?]$/.test(i);)i=i.slice(0,-1);return i?{href:/^www\./i.test(i)?`https://${i}`:i,end:r+i.length}:null}function qe(e,r,n,t){return Xe(e)?!0:!r.slice(0,n).trim()&&!r.slice(t).trim()}function Xe(e){return/^(?:workspace|sandbox):file:/i.test(e.trim())}function N(e,r,n,t){const s=le(r),i=F(s,n),l=/^https?:\/\//i.test(s),c=i?.kind==="url"?i.src:i?.src??s,o=n.onOpenFileInSidebar?C(s,{workspaceRootPath:n.workspaceRootPath}):null;return!i&&o?W(e,o.path,o.displayPath,n,t):a.jsx("a",{href:l||i?c:"#",className:i?"markdown-image-link":void 0,onBlur:()=>{i&&n.onPreviewImage(null)},onClick:u=>{if(i){u.preventDefault(),cn(i,n),n.onPreviewImage(null);return}if(l&&n.onOpenBrowserLink){u.preventDefault(),n.onOpenBrowserLink(c);return}l||u.preventDefault()},onContextMenu:u=>{u.preventDefault(),n.onPreviewImage(null),n.onOpenLinkMenu(un(c,s,u.clientX,u.clientY))},onFocus:u=>{i&&V(i,n,u.currentTarget)},onMouseEnter:u=>{i&&V(i,n,u.currentTarget)},onMouseLeave:()=>{i&&n.onPreviewImage(null)},rel:l?"noreferrer":void 0,target:l?"_blank":void 0,title:s,children:e},t)}function K(e,r,n,t){return a.jsx(Ke,{context:n,image:r,label:e},t)}function Ke({context:e,image:r,label:n}){const t=Y(e.connection,r.kind==="workspace"?r.appId:null,r.kind==="workspace"?r.path:null),s=J(e.connection,r.kind==="local"?r.path:null),i=r.kind==="url"?r.src:r.kind==="local"?s:t,l=n.trim()||r.title;return a.jsx("button",{type:"button",className:`markdown-inline-image ${i?"ready":"loading"}`,onClick:()=>{if(r.kind==="url"){e.onOpenImage({src:r.src,title:l});return}if(i){e.onOpenImage({src:i,title:l});return}r.kind!=="local"&&e.onOpenWorkspaceImage({appId:r.appId,path:r.path,title:l})},title:l,children:i?a.jsx("img",{alt:l,decoding:"async",loading:"lazy",src:i}):a.jsx("span",{"aria-hidden":"true"})})}function W(e,r,n,t,s){const i=tn(r,n,t);return i?a.jsx(Ve,{context:t,displayPath:n,image:i,label:e,path:r},s):a.jsx(se,{context:t,displayPath:n,label:e,path:r},s)}function se({context:e,displayPath:r,label:n,path:t}){return a.jsx("a",{href:"#",className:"markdown-file-link",onClick:s=>{s.preventDefault(),e.onOpenFileInSidebar?.(t)},onContextMenu:s=>{s.preventDefault(),e.onPreviewImage(null),e.onOpenLinkMenu(dn(t,r,s.clientX,s.clientY))},title:r,children:n})}function Ve({context:e,displayPath:r,image:n,label:t,path:s}){const i=Y(e.connection,n.kind==="workspace"?n.appId:null,n.kind==="workspace"?n.path:null),l=J(e.connection,n.kind==="local"?n.path:null),c=n.kind==="url"?n.src:n.kind==="local"?l:i,o=n.title||r;return a.jsxs("span",{className:"markdown-file-image-reference",children:[a.jsx(se,{context:e,displayPath:r,label:t,path:s}),a.jsx("button",{type:"button",className:`markdown-file-image-preview ${c?"ready":"loading"}`,onClick:()=>{if(n.kind==="url"){e.onOpenImage({src:n.src,title:o});return}if(c){e.onOpenImage({src:c,title:o});return}n.kind!=="local"&&e.onOpenWorkspaceImage({appId:n.appId,path:n.path,title:o})},title:o,children:c?a.jsx("img",{alt:o,decoding:"async",loading:"lazy",src:c}):a.jsx("span",{"aria-hidden":"true"})})]})}function Ze(e,r){if(!e.startsWith("![",r))return null;const n=r+2,t=e.indexOf("]",n);if(t<n||e[t+1]!=="(")return null;const s=ie(e,t+2);return s?{label:e.slice(n,t),href:s.href,end:s.end}:null}function Ye(e,r){const n=e.indexOf("]",r+1);if(n<=r+1||e[n+1]!=="(")return null;const t=ie(e,n+2);return t?{label:e.slice(r+1,n),href:t.href,end:t.end}:null}function ie(e,r){if(e[r]==="<"){const t=e.indexOf(">",r+1);return t<0||e[t+1]!==")"?null:{href:e.slice(r+1,t),end:t+2}}let n=0;for(let t=r;t<e.length;t+=1){const s=e[t];if(s==="\\"){t+=1;continue}if(s==="("){n+=1;continue}if(s===")"){if(n===0)return{href:e.slice(r,t),end:t+1};n-=1}}return null}function Ge(e,r){const n=e[r]==="!"?r+1:r;if(!/^<img\b/i.test(e.slice(n)))return null;const t=e.indexOf(">",n+4);if(t<0)return null;const s=e.slice(n,t+1),i=_(s,"src");return i?{src:i,alt:_(s,"alt")??_(s,"title")??"",end:t+1}:null}function Qe(e,r){const n=e.slice(r,r+3);return n==="[ ]"?{checked:!1,end:r+3}:n==="[x]"||n==="[X]"?{checked:!0,end:r+3}:null}function Je(e,r){const n=e.slice(r),t=/^<a\s+[^>]*href\s*=\s*(["'])(.*?)\1[^>]*>(.*?)<\/a>/i.exec(n);return t?{href:t[2]??"",label:nn(t[3]??""),end:r+t[0].length}:null}function en(e,r){const n=e.indexOf(">",r+1);if(n<=r+1)return null;const t=e.slice(r+1,n).trim();return rn(t)?{href:t,end:n+1}:null}function nn(e){return e.replace(/<[^>]+>/g,"").trim()||e}function _(e,r){const t=new RegExp(`\\s${r}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);return t?.[1]??t?.[2]??t?.[3]??null}function rn(e){return/^(https?:\/\/|file:\/\/|(?:workspace|sandbox):file:|\/|\.{1,2}\/)/i.test(e)}function F(e,r){const n=le(e);if(!n)return null;if(/^https?:\/\//i.test(n))try{const l=new URL(n),c=on(l,r);return c||(an(l,r.connection)?{kind:"url",src:n,title:I(l.searchParams.get("path")??l.pathname)}:null)}catch{return null}const t=ln(n),s=z(t??n,r.workspaceRootPath);if(s)return{kind:"url",src:s,title:I(t??n)};if(!t||!j(t)||!r.connection)return null;if(R(t))return{kind:"local",path:t,src:r.localImageUrls.getUrl(t),title:I(t)};if(!r.activeWorkspaceAppId)return null;const i=S(t,r.workspaceRootPath);return!i||!j(i)?null:{kind:"workspace",appId:r.activeWorkspaceAppId,path:i,src:r.workspaceImageUrls.getUrl(r.activeWorkspaceAppId,i),title:I(i)}}function tn(e,r,n){const t=z(e,n.workspaceRootPath)??z(r,n.workspaceRootPath);if(t)return{kind:"url",src:t,title:I(r)};if(!j(e)||!n.connection)return null;if(R(e))return{kind:"local",path:e,src:n.localImageUrls.getUrl(e),title:I(e)};if(!n.activeWorkspaceAppId)return null;const s=S(e,n.workspaceRootPath);return!s||!j(s)?null:{kind:"workspace",appId:n.activeWorkspaceAppId,path:s,src:n.workspaceImageUrls.getUrl(n.activeWorkspaceAppId,s),title:I(s)}}function z(e,r){const n=S(e,r),t="apps/web/public/";if(!n?.startsWith(t))return null;const s=n.slice(t.length);return!s||!sn(s)?null:he(s.split("/").map(encodeURIComponent).join("/"))}function sn(e){const r=e.split("?")[0]?.split("#")[0]??e,n=r.lastIndexOf(".");return n<0?!1:Be.has(r.slice(n).toLowerCase())}function le(e){return e.trim().replace(/^['"`]+|['"`]+$/g,"")}function ln(e){let r=e.trim();if(!r)return null;if(r.startsWith("file://"))try{return decodeURIComponent(new URL(r).pathname)}catch{return r.replace(/^file:\/\//,"")}if(R(r))return r;const n=r.indexOf("#");n>=0&&(r=r.slice(0,n));const t=r.indexOf("?");return t>=0&&(r=r.slice(0,t)),r}function R(e){return/^file:\/\//i.test(e)||/^\//.test(e)||/^[A-Za-z]:[\\/]/.test(e)}function S(e,r){let n=e.trim().replace(/^['"`]+|['"`]+$/g,"");if(!n)return null;if(n.startsWith("file://"))try{n=decodeURIComponent(new URL(n).pathname)}catch{n=n.replace(/^file:\/\//,"")}if(n=n.replace(/\\/g,"/"),R(n)){const s=r?.trim().replace(/\\/g,"/").replace(/\/+$/,"");if(!s||!n.startsWith(`${s}/`))return null;n=n.slice(s.length+1)}n=n.replace(/^\.\/+/,"");const t=n.split("/").filter(Boolean);return t.length===0||t.some(s=>s==="."||s===".."||s===".git")?null:t.join("/")}function an(e,r){if(r){const t=new URL(r.serverUrl);if(e.origin===t.origin){if(e.pathname==="/v1/local-image"||/\/v1\/workspaces\/[^/]+\/file-image$/.test(e.pathname))return!1;if(e.pathname==="/v1/assets/workspace-image"||e.pathname==="/v1/assets/chat-attachment-image")return!0}}if(j(e.pathname))return!0;const n=e.searchParams.get("path");return!!(n&&j(n))}function on(e,r){if(!r.connection)return null;const n=new URL(r.connection.serverUrl);if(e.origin!==n.origin)return null;const t=e.pathname==="/v1/assets/workspace-image"?e.searchParams.get("path"):null;if(t&&j(t))return{kind:"url",src:e.toString(),title:I(t)};const s=e.pathname==="/v1/assets/chat-attachment-image"?e.searchParams.get("storageName"):null;if(s&&j(s))return{kind:"url",src:e.toString(),title:I(s)};const i=/^\/v1\/workspaces\/([^/]+)\/file-image$/.exec(e.pathname),l=i?e.searchParams.get("path"):null;if(!i||!l||!j(l))return null;const c=decodeURIComponent(i[1]),o=S(l,r.workspaceRootPath);return!o||!j(o)?null:{kind:"workspace",appId:c,path:o,src:r.workspaceImageUrls.getUrl(c,o),title:I(o)}}function cn(e,r){if(e.kind==="url"){r.onOpenImage(e);return}if(e.kind==="local"){e.src&&r.onOpenImage({src:e.src,title:e.title});return}if(e.src){r.onOpenImage({src:e.src,title:e.title});return}r.onOpenWorkspaceImage({appId:e.appId,path:e.path,title:e.title})}function V(e,r,n){if(e.kind==="url"){r.onPreviewImage($(e,n));return}if(e.kind==="local"){if(e.src){r.onPreviewImage($({src:e.src,title:e.title},n));return}r.localImageUrls.loadUrl(e.path).then(t=>{t&&n.matches(":hover")&&r.onPreviewImage($({src:t,title:e.title},n))});return}if(e.src){r.onPreviewImage($({src:e.src,title:e.title},n));return}r.workspaceImageUrls.loadUrl(e.appId,e.path).then(t=>{t&&n.matches(":hover")&&r.onPreviewImage($({src:t,title:e.title},n))})}function $(e,r){const n=r.getBoundingClientRect(),t=236,s=172,i=12,l=Math.max(i,Math.min(n.left,window.innerWidth-t-i)),c=n.bottom+8,o=c+s<=window.innerHeight-i?c:Math.max(i,n.top-s-8);return{...e,x:l,y:o}}function un(e,r,n,t){return{kind:"browser",browserHref:e,displayHref:r,x:Math.max(8,Math.min(n,window.innerWidth-220-8)),y:Math.max(8,Math.min(t,window.innerHeight-142-8))}}function dn(e,r,n,t){return{kind:"file",path:e,displayPath:r,x:Math.max(8,Math.min(n,window.innerWidth-220-8)),y:Math.max(8,Math.min(t,window.innerHeight-72-8))}}async function hn(e){const r=e.trim();if(!r)return!1;const n=window.openpond?.files;if(!n)return!1;try{return(await n.reveal({path:r})).ok}catch{return!1}}async function En(e,r){const n=e.trim(),t=window.openpond?.files;if(!n||!t?.saveAs)return{ok:!1,canceled:!1,path:null};try{const s=await t.saveAs({path:n,suggestedName:r});return{ok:s.ok,canceled:s.canceled,path:s.path??null}}catch{return{ok:!1,canceled:!1,path:null}}}function Nn({activeWorkspaceAppId:e=null,connection:r=null,content:n,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i=null}){const l=p.useMemo(()=>ne(n),[n]),[c,o]=p.useState(null),[u,m]=p.useState(null),[f,v]=p.useState(null),w=ee(r),k=G(r),d=p.useCallback(g=>{k.loadUrl(g.appId,g.path).then(y=>{y&&o({src:y,title:g.title})})},[k]),b=p.useMemo(()=>({activeWorkspaceAppId:e,connection:r,onOpenBrowserLink:t,onOpenFileInSidebar:s,onOpenLinkMenu:v,onOpenImage:o,onOpenWorkspaceImage:d,onPreviewImage:m,localImageUrls:w,workspaceImageUrls:k,workspaceRootPath:i}),[e,r,d,w,t,s,k,i]);return p.useEffect(()=>{if(!f)return;const g=()=>v(null),y=h=>{h.key==="Escape"&&g()};return window.addEventListener("click",g),window.addEventListener("keydown",y),window.addEventListener("scroll",g,!0),()=>{window.removeEventListener("click",g),window.removeEventListener("keydown",y),window.removeEventListener("scroll",g,!0)}},[f]),a.jsxs("div",{className:"markdown-message",children:[ae(l,b,i),u&&a.jsx(pn,{preview:u}),f&&a.jsx(mn,{menu:f,onClose:()=>v(null),onOpenBrowserLink:t,onOpenFileInSidebar:s}),a.jsx(Ie,{open:!!c,src:c?.src??null,title:c?.title??"",onClose:()=>o(null)})]})}function ae(e,r,n,t="block"){return e.map((s,i)=>{const l=`${t}-${i}`;if(s.type==="blockquote")return a.jsx("blockquote",{className:"markdown-blockquote",children:ae(ne(s.content),r,n,`${l}-quote`)},l);if(s.type==="code"){const c=fn(s.content,n);return c?a.jsx("div",{className:"markdown-file-reference-block",children:c.map((o,u)=>a.jsx("div",{className:"markdown-file-reference-line",children:M(o,r)},u))},l):a.jsx("pre",{className:"markdown-code-block",children:a.jsx("code",{children:s.content})},l)}if(s.type==="list"){const c=s.items.map((o,u)=>a.jsxs("li",{className:o.checked===null?void 0:"markdown-task-list-item",value:s.ordered?o.ordinal??void 0:void 0,children:[o.checked===null?null:a.jsx(te,{checked:o.checked}),a.jsx("span",{children:M(o.content,r)})]},u));return s.ordered?a.jsx("ol",{className:"markdown-list",start:s.start,children:c},l):a.jsx("ul",{className:"markdown-list",children:c},l)}if(s.type==="heading"){const c=s.level===1?"h1":s.level===2?"h2":s.level===3?"h3":"h4";return a.jsx(c,{className:"markdown-heading",children:M(s.content,r)},l)}return s.type==="table"?a.jsx("div",{className:"markdown-table-wrap",children:a.jsxs("table",{className:"markdown-table",children:[a.jsx("thead",{children:a.jsx("tr",{children:s.headers.map((c,o)=>a.jsx("th",{children:M(c,r)},o))})}),a.jsx("tbody",{children:s.rows.map((c,o)=>a.jsx("tr",{children:s.headers.map((u,m)=>a.jsx("td",{children:M(c[m]??"",r)},m))},o))})]})},l):a.jsx("p",{className:"markdown-paragraph",children:M(s.content,r)},l)})}function fn(e,r){const n=e.split(`
9
+ `),t=[];for(const s of n){const i=s.trim();if(!i)continue;const c=i.replace(/^(?:[-*]|\d+[.)])\s+/,"").trim().replace(/^`+|`+$/g,"").trim();if(!c||!C(c,{workspaceRootPath:r}))return null;t.push(c)}return t.length>0?t:null}function pn({preview:e}){const[r,n]=p.useState(!1);return p.useEffect(()=>{n(!1)},[e.src]),a.jsxs("div",{className:`markdown-image-hover-preview ${r?"unavailable":""}`,style:{left:e.x,top:e.y},children:[r?a.jsx("span",{children:"Preview unavailable"}):a.jsx("img",{alt:"",src:e.src,onError:()=>n(!0)}),a.jsx("span",{children:e.title})]})}function mn({menu:e,onClose:r,onOpenBrowserLink:n,onOpenFileInSidebar:t}){return e.kind==="file"?a.jsxs("div",{className:"markdown-link-menu",role:"menu",style:{left:e.x,top:e.y},onClick:s=>s.stopPropagation(),children:[a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{t?.(e.path),r()},children:"Open in sidebar"}),a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{hn(e.path),r()},children:"Open externally"}),a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{T(e.displayPath),r()},children:"Copy path"})]}):a.jsxs("div",{className:"markdown-link-menu",role:"menu",style:{left:e.x,top:e.y},onClick:s=>s.stopPropagation(),children:[a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{n?n(e.browserHref):window.open(e.browserHref,"_blank","noopener,noreferrer"),r()},children:"Open in sidebar"}),a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{n?n(e.browserHref,{newTab:!0}):window.open(e.browserHref,"_blank","noopener,noreferrer"),r()},children:"Open in new tab"}),a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{window.open(e.browserHref,"_blank","noopener,noreferrer"),r()},children:"Open externally"}),a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{T(e.displayHref),r()},children:"Copy link"})]})}export{kn as A,wn as B,yn as C,Pn as D,bn as F,Ie as I,xn as M,In as P,jn as T,Ln as W,vn as a,Nn as b,Mn as c,Un as d,J as e,C as n,hn as r,En as s,Y as u};
@@ -0,0 +1,9 @@
1
+ import{c as _,r as d,n as re,j as n,bX as M,bY as Te,a2 as _e,F as k,C as z,S as le,aW as ze,Y as Ee,bU as Pe,an as Le,$ as F,bb as Ue,bZ as Fe,b_ as Be,aR as Oe,b$ as Ge,c0 as W,b1 as We}from"./index-Cxq5q-6B.js";import{C as De}from"./chevron-up-B5URpgIH.js";import{I as B,f as qe,e as Ke}from"./MainPane-COs4xUGo.js";import{d as Ve,b as ce,W as He,n as Qe,I as oe,e as de,u as Ye,r as ue,B as he}from"./MarkdownText-CzZ60aWs.js";import{A as U}from"./arrow-up-right-CkfCgokz.js";import{G as Xe}from"./git-branch-BN2ijBYt.js";import{C as Ze}from"./circle-alert-CAvjRdlQ.js";import{F as Je}from"./folder-open-CqjIkaDK.js";import{P as et}from"./play-DGCzapdE.js";import{S as tt}from"./square-pen-j-mZ_UkO.js";const nt=[["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"}]],st=_("circle-dashed",nt);const it=[["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"}]],at=_("copy",it);const rt=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],lt=_("lightbulb",rt);const ct=[["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"}]],ot=_("circle-x",ct);function dt(e){const t=xt(e);if(t)return t;const s=gt();let i="";const a=[],r=[],l=[];for(const h of e){if(!i&&h.label&&(i=h.label),It(r,h.label),Tt(l,h),h.kind==="command"&&h.content){bt(s,vt(h.content));continue}jt(s,h)||Mt(a,h.label)}const c=[...yt(s),...r,...l],o=s.runCount>0?At(s.runCount):"",u=Pt(a),f=(e.length===1&&e[0]?.kind==="command"&&e[0].content&&r.length===0&&l.length===0?me(e[0].content,"completed"):null)||Rt(c,o)||u||i||"Ran command";return{kind:kt(s,o),text:f}}function me(e,t="completed"){const s=xe(e);if(s.length===0)return null;const i=t==="running"||t==="pending";if(s.some(be))return i?"Running shell command":"Ran shell command";const a=fe(s);if(!a)return null;const[r,l]=a;if(r==="cat"){const o=v(l);return o.length===0?i?"Reading standard input":"Read standard input":`${i?"Reading":"Read"} ${y(o)}`}if(r==="sed")return pt(Ut([r,...l]),i);if(r==="rg")return Ft([r,...l],i);if(["grep","ag"].includes(r)||r==="git"&&l[0]==="grep")return i?"Searching code":"Searched code";if(["ls","find","tree","fd"].includes(r)){const o=r==="ls"?v(l):[];return o.length===0?i?"Listing files":"Listed files":`${i?"Listing":"Listed"} files in ${y(o)}`}if(["head","tail","nl","wc","awk","jq"].includes(r)){const o=ge(r,l);return o.length===0?i?`Running ${r}`:`Ran ${r}`:`${i?"Reading":"Read"} ${y(o)}`}if(r==="apply_patch")return i?"Editing files":"Edited files";if(r==="write_stdin")return i?"Continuing command":"Continued command";if(r==="wait")return i?"Waiting for command":"Waited for command";if(r==="js")return i?"Running JavaScript":"Ran JavaScript";if(r==="exec_command")return i?"Running shell command":"Ran shell command";if(r==="read_file")return i?"Reading file":"Read file";if(r==="view_image")return i?"Viewing image":"Viewed image";if(r==="update_plan")return i?"Updating plan":"Updated plan";if(r==="tool_search")return i?"Searching tools":"Searched tools";if(r==="rm")return i?"Removing files":"Removed files";if(r==="mv")return i?"Moving files":"Moved files";if(r==="cp")return i?"Copying files":"Copied files";if(r==="mkdir")return i?"Creating directories":"Created directories";if(r==="touch")return i?"Creating files":"Created files";if(r==="git")return ut(l,i);if(ft(r))return ht(r,l,i);if(pe(r))return mt(r,i);if(["curl","wget"].includes(r))return i?"Fetching URL":"Fetched URL";if(["node","tsx","python","python3","bash","sh","zsh"].includes(r))return i?`Running ${R(r)} script`:`Ran ${R(r)} script`;const c=R(r);return i?`Running ${c} command`:`Ran ${c} command`}function ut(e,t){const s=e.find(i=>!i.startsWith("-"))??"";return s==="status"?t?"Checking Git status":"Checked Git status":s==="diff"?t?"Reviewing changes":"Reviewed changes":s==="show"||s==="log"?t?"Reading Git history":"Read Git history":s==="add"?t?"Staging changes":"Staged changes":s==="commit"?t?"Committing changes":"Committed changes":s==="push"?t?"Pushing changes":"Pushed changes":s==="pull"||s==="fetch"?t?"Fetching changes":"Fetched changes":s==="checkout"||s==="switch"?t?"Switching branches":"Switched branches":s==="branch"?t?"Listing branches":"Listed branches":t?"Running Git command":"Ran Git command"}function ht(e,t,s){const i=t.join(" ").toLowerCase();return/\b(typecheck|tsc)\b/.test(i)?s?"Checking types":"Checked types":/\b(lint|eslint|prettier)\b/.test(i)?s?"Running lint":"Ran lint":/\b(test|vitest|jest|playwright)\b/.test(i)?s?"Running tests":"Ran tests":/\bbuild\b/.test(i)?s?"Building project":"Built project":/\b(install|add)\b/.test(i)?s?"Installing dependencies":"Installed dependencies":s?`Running ${R(e)} command`:`Ran ${R(e)} command`}function mt(e,t){return e==="tsc"?t?"Checking types":"Checked types":e==="eslint"||e==="prettier"?t?"Running lint":"Ran lint":t?"Running tests":"Ran tests"}function ft(e){return["bun","npm","pnpm","yarn"].includes(e)}function R(e){const t=e.split("/").filter(Boolean).at(-1)??e;return t==="python"||t==="python3"?"Python":t==="node"||t==="tsx"?"Node":["bash","sh","zsh"].includes(t)?"shell":t==="git"?"Git":t}function pt(e,t){return!e||!t?e:e.startsWith("Read ")?`Reading ${e.slice(5)}`:e.startsWith("Run ")?`Running ${e.slice(4)}`:e}function gt(){return{approvals:0,controlCount:0,editCount:0,goalContextUpdates:0,imageCount:0,listedFiles:0,readFileCount:0,readFiles:new Set,reasoningCount:0,runCount:0,searchedCode:0,subagentStatuses:new Map,testsOrChecks:0,turnInterruptions:0,webSearches:0}}function xt(e){if(e.length===0)return null;const t=e.map(r=>r.subagentMessage).filter(r=>!!r);if(t.length===0||t.length!==e.length)return null;if(t.length===1){const r=t[0];return{kind:"subagent",text:`${r.direction==="received"?"Child Message Received":"Child Message Sent"}: ${r.summary}`}}const s=t.filter(r=>r.direction==="received").length,i=t.length-s,a=[s>0?D(s,"received"):null,i>0?D(i,"sent"):null].filter(r=>!!r);return{kind:"subagent",text:I(O(a))}}function D(e,t){return e===1?`child message ${t}`:`${e} child messages ${t}`}function bt(e,t){e.editCount+=t.editCount??0,e.listedFiles+=t.listedFiles??0,e.searchedCode+=t.searchedCode??0,e.testsOrChecks+=t.testsOrChecks??0;for(const s of t.readFiles??[])e.readFiles.add(s);t.readFiles?.length&&(e.readFileCount+=t.readFiles.length),t.countedAsRun&&(e.runCount+=1)}function jt(e,t){const s=t.label.toLowerCase();if(t.controlKind)return e.controlCount+=1,t.controlKind==="goal_context"&&(e.goalContextUpdates+=1),t.controlKind==="turn_aborted"&&(e.turnInterruptions+=1),!0;if(s==="reasoning")return e.reasoningCount+=1,!0;if(s.includes("approval"))return e.approvals+=1,!0;if(s.includes("subagent"))return St(e,t,i(s)),!0;if(s.includes("image"))return e.imageCount+=1,!0;function i(a){return a.includes("failed")?"failed":a.includes("blocked")?"blocked":a.includes("stale")?"stale":a.includes("needs revision")?"needs revision":a.includes("archived")?"archived":a.includes("accepted")?"accepted":a.includes("submitted")?"submitted":a.includes("completed")?"completed":"running"}return s.includes("web")?(e.webSearches+=1,!0):/\b(searching|searched)\b/.test(s)?(e.searchedCode+=1,!0):/\b(listing|listed)\b/.test(s)?(e.listedFiles+=1,!0):/\b(reading|read)\b/.test(s)?(e.readFileCount+=1,!0):/\b(editing|edited|writing|wrote|deleting|deleted|moving|moved|uploading|uploaded|creating|created)\b/.test(s)?(e.editCount+=1,!0):!1}function vt(e){const t=xe(e);if(t.length===0||t.some(be))return{countedAsRun:!0};const s=fe(t);if(!s)return{countedAsRun:!0};const[i,a]=s;if(i==="apply_patch")return{countedAsRun:!1,editCount:1};if(["rm","mv","cp","mkdir","touch"].includes(i))return{countedAsRun:!1,editCount:1};if(Ct(i,a)||pe(i))return{countedAsRun:!1,testsOrChecks:1};if(i==="rg")return a.includes("--files")?{countedAsRun:!1,listedFiles:1}:{countedAsRun:!1,searchedCode:1};if(["grep","ag"].includes(i))return{countedAsRun:!1,searchedCode:1};if(i==="git"&&a[0]==="grep")return{countedAsRun:!1,searchedCode:1};if(["ls","find","tree","fd"].includes(i))return{countedAsRun:!1,listedFiles:1};const r=ge(i,a);return r.length>0?{countedAsRun:!1,readFiles:r}:{countedAsRun:!0}}function fe(e){let t=0;for(;/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(e[t]??"");)t+=1;const s=e[t];if(!s)return null;if(s==="bunx"||s==="npx"){const i=e[t+1];return i?[i,e.slice(t+2)]:[s,[]]}return[s,e.slice(t+1)]}function Ct(e,t){if(!["bun","npm","pnpm","yarn"].includes(e))return!1;const s=t.join(" ").toLowerCase();return/\b(test|typecheck|check|lint|vitest|jest|playwright|tsc)\b/.test(s)}function pe(e){return["eslint","jest","playwright","prettier","tsc","vitest"].includes(e)}function ge(e,t){if(e==="cat"||e==="nl"||e==="head"||e==="tail"||e==="wc")return L(v(t));if(e==="sed"){const s=t.findIndex(i=>i!=="-n"&&!i.startsWith("--"));return L(s>=0?v(t.slice(s+1)):[])}return e==="awk"||e==="jq"?L(v(t.slice(1))):[]}function L(e){return e.filter(t=>!(!t||t==="."||t==="-"||/^\d+$/.test(t)))}function yt(e){const t=[],s=wt(e);s&&t.push(s),e.editCount>0&&t.push("made edits");const i=e.readFiles.size||e.readFileCount;return i>0&&t.push(K("read",i,"file")),e.searchedCode>0&&t.push("searched code"),e.listedFiles>0&&t.push("listed files"),e.testsOrChecks>0&&t.push(e.testsOrChecks===1?"ran checks":`ran ${e.testsOrChecks} checks`),e.webSearches>0&&t.push("searched web"),e.imageCount>0&&t.push(K("read",e.imageCount,"image")),e.reasoningCount>0&&t.length===0&&t.push("thought through the request"),e.approvals>0&&t.push("requested approval"),t.push(...$t(e)),t}function $t(e){const t=[];e.goalContextUpdates===1&&t.push("goal context updated"),e.goalContextUpdates>1&&t.push(`${e.goalContextUpdates} goal context updates`),e.turnInterruptions===1&&t.push("turn interrupted"),e.turnInterruptions>1&&t.push(`${e.turnInterruptions} turns interrupted`);const s=e.controlCount-e.goalContextUpdates-e.turnInterruptions;return s===1&&t.push("context updated"),s>1&&t.push(`${s} context updates`),t}function wt(e){const t=Nt(e);return t.failed>0?b(t.failed,"failed"):t.blocked>0?b(t.blocked,"blocked"):t.stale>0?b(t.stale,"stale"):t["needs revision"]>0?b(t["needs revision"],"needs revision"):t.submitted>0?b(t.submitted,"submitted"):t.running>0&&t.completed===0&&t.accepted===0?b(t.running,"running"):t.accepted>0?b(t.accepted,"accepted"):t.completed>0?b(t.completed,"completed"):t.archived>0?b(t.archived,"archived"):null}function St(e,t,s){const i=t.openSession?.sessionId??(t.content.trim()||t.id),a=e.subagentStatuses.get(i);(!a||q(s)>q(a))&&e.subagentStatuses.set(i,s)}function Nt(e){const t={accepted:0,archived:0,blocked:0,completed:0,failed:0,"needs revision":0,running:0,stale:0,submitted:0};for(const s of e.subagentStatuses.values())t[s]+=1;return t}function q(e){return e==="running"?1:e==="submitted"?2:e==="accepted"||e==="completed"||e==="archived"?3:e==="needs revision"?4:e==="blocked"?5:e==="stale"?6:7}function b(e,t){return e===1?`subagent ${t}`:`${e} subagents ${t}`}function kt(e,t){const s=[];return e.subagentStatuses.size>0&&s.push("subagent"),e.editCount>0&&s.push("edit"),(e.readFiles.size>0||e.readFileCount>0)&&s.push("read"),e.searchedCode>0&&s.push("search"),e.listedFiles>0&&s.push("list"),e.webSearches>0&&s.push("web"),e.imageCount>0&&s.push("image"),e.reasoningCount>0&&s.push("reasoning"),e.approvals>0&&s.push("approval"),e.controlCount>0&&s.push("control"),(e.testsOrChecks>0||t)&&s.push("command"),s[0]??"command"}function At(e){return e===1?"ran a command":`ran ${e} commands`}function K(e,t,s){return t===1?`${e} a ${s}`:`${e} ${t} ${s}s`}function Rt(e,t){return e.length===0?t?I(t):"":I(O(t?[...e,t]:e))}function Mt(e,t){const s=t.trim();s&&(e.includes(s)||e.push(s))}function It(e,t){const s=_t(t);!s||e.includes(s)||e.push(s)}function Tt(e,t){const s=t.receipt;if(!s)return;const i=`${s.status} receipt ${Et(s.id)} ${zt(s.totalUsd)}`;e.includes(i)||e.push(i)}function _t(e){switch(e.trim().toLowerCase()){case"applied locally":return"applied locally";case"apply locally failed":return"apply locally failed";case"exported sandbox patch":return"exported patch";case"patch export failed":return"patch export failed";case"preserved sandbox source":return"preserved sandbox source";case"preserve failed":return"preserve failed";case"stopped sandbox":return"stopped sandbox";case"sandbox stop failed":return"sandbox stop failed";default:return null}}function zt(e){const t=e.trim();return t.startsWith("$")?t:`$${t}`}function Et(e){const t=e.trim();return t.length<=14?t:`${t.slice(0,6)}...${t.slice(-4)}`}function Pt(e){return e.length===0?"":I(O(e.map(Lt)))}function Lt(e){return e&&`${e[0].toLowerCase()}${e.slice(1)}`}function O(e){return e.length===0?"":e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`}function I(e){return e&&`${e[0].toUpperCase()}${e.slice(1)}`}function Ut(e){const t=e.findIndex((r,l)=>l>0&&r!=="-n"&&!r.startsWith("--")),s=t>=0?e[t]??"":"",i=t>=0?v(e.slice(t+1)):[],a=/^(\d+)(?:,(\d+))?p$/.exec(s);if(a){const r=a[1],l=a[2],c=l?`lines ${r}-${l}`:`line ${r}`;return i.length>0?`Read ${c} of ${y(i)}`:`Read ${c}`}return i.length>0?`Read ${y(i)} with sed`:"Run sed"}function Ft(e,t=!1){const s=e.slice(1);if(s.includes("--files")){const l=v(s.filter(c=>c!=="--files"));return l.length>0?`${t?"Listing":"Listed"} files matching ${y(l)}`:t?"Listing files":"Listed files"}const i=v(s),a=i[0],r=i.slice(1);return a?r.length>0?`${t?"Searching":"Searched"} for ${V(a)} in ${y(r)}`:`${t?"Searching":"Searched"} for ${V(a)}`:t?"Searching files":"Searched files"}function xe(e){return(e.match(/"([^"\\]|\\.)*"|'[^']*'|[^\s]+/g)??[]).map(s=>Bt(s)).filter(Boolean)}function Bt(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function be(e){return["|","&&","||",";",">",">>","<","(",")"].includes(e)}function v(e){const t=[];for(let s=0;s<e.length;s+=1){const i=e[s];if(!i.startsWith("-")){t.push(i);continue}Ot(i)&&s+1<e.length&&(s+=1)}return t}function Ot(e){return["-e","-f","-g","--glob","--type","-t","--context","-C","-A","-B","-m","-n","-c"].includes(e)}function y(e){return e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e[0]} and ${e.length-1} more`}function V(e){return`"${e}"`}function Gt(e,t){return new Set(e.filter(s=>!t.has(s.id)).map(s=>s.id))}function js(e,t){const s=d.useRef({scopeKey:t,ids:new Set(e.map(r=>r.id)),initialized:e.length>0}),i=s.current.scopeKey===t,a=i&&s.current.initialized?Gt(e,s.current.ids):new Set;return d.useLayoutEffect(()=>{s.current={scopeKey:t,ids:new Set(e.map(r=>r.id)),initialized:i&&s.current.initialized?!0:e.length>0}},[e,i,t]),a}const S=new Map,Wt=15e3;function Dt(e,t){const s=qt(e),[i,a]=d.useState(()=>s.getUrl(t));return d.useEffect(()=>{let r=!1;return a(s.getUrl(t)),s.loadUrl(t).then(l=>{r||a(l)}),()=>{r=!0}},[t,s]),i}function qt(e){const[,t]=d.useState(0),s=d.useCallback(a=>!e||!a?null:H(Q(e,a)),[e]),i=d.useCallback(async a=>{if(!e||!a)return null;const r=Q(e,a),l=H(r);if(l)return l;const c=S.get(r);if(c?.state==="loading")return c.promise;const o=re.signChatAttachmentImageUrl(e,a).then(u=>(S.set(r,{state:"ready",url:u.url,expiresAt:u.expiresAt}),t(m=>m+1),u.url)).catch(()=>(S.delete(r),t(u=>u+1),null));return S.set(r,{state:"loading",promise:o}),o},[e]);return d.useMemo(()=>({getUrl:s,loadUrl:i}),[s,i])}function H(e){const t=S.get(e);return t?.state!=="ready"?null:t.expiresAt<=Date.now()+Wt?(S.delete(e),null):t.url}function Q(e,t){return[e.serverUrl,e.token,t.sessionId,t.turnId,t.attachmentId,t.storageName,t.contentType].join("\0")}const Kt=64,Vt=120,Ht=210,Qt=360,Yt=40,Xt=120,Zt=600,Jt=64,Y=16;function en(e,t,s=0){if(e<=0)return{characterCount:0,remainder:0};const i=e>Zt?Qt:e>Xt?Ht:e>Yt?Vt:Kt,a=s+Math.min(Math.max(t,0),Jt)*i/1e3,r=Math.min(e,Math.floor(a));return{characterCount:r,remainder:a-r}}function je(e,t,s){let i=Math.min(t.length,e.length+s);const a=t.charCodeAt(i-1),r=t.charCodeAt(i);return a>=55296&&a<=56319&&r>=56320&&r<=57343&&(i+=1),t.slice(0,i)}function X(){return typeof window<"u"&&typeof window.matchMedia=="function"&&typeof document<"u"&&document.visibilityState==="visible"&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}function tn(e,t,s){return t&&s?je("",e,1):e}function nn(e,t=!1){const[s,i]=d.useState(()=>tn(e,t,X())),a=d.useRef(s),r=d.useRef(e),l=d.useRef(null),c=d.useRef(null),o=d.useRef(0);return d.useEffect(()=>{if(r.current=e,!X()||!e.startsWith(a.current)){l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=e,i(e);return}if(a.current.length===e.length||l.current!==null)return;const u=()=>{const m=a.current,f=r.current,h=performance.now();if(!f.startsWith(m)){a.current=f,i(f),l.current=null,c.current=null,o.current=0;return}const x=f.length-m.length;if(x===0){l.current=null,c.current=null,o.current=0;return}const $=c.current===null?16:h-c.current,j=en(x,$,o.current);if(c.current=h,o.current=j.remainder,j.characterCount>0){const p=je(m,f,j.characterCount);a.current=p,i(p)}l.current=window.setTimeout(u,Y)};l.current=window.setTimeout(u,Y)},[e]),d.useEffect(()=>{const u=()=>{document.visibilityState!=="visible"&&(l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=r.current,i(r.current))};return document.addEventListener("visibilitychange",u),()=>{document.removeEventListener("visibilitychange",u),l.current!==null&&(window.clearTimeout(l.current),l.current=null)}},[]),s}function sn({animateInitialContent:e=!1,content:t,...s}){const i=nn(t,e),a=Ve(i,i.length===t.length);return n.jsx(ce,{...s,content:a})}function an({actionRun:e,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i=null}){const a=on(e.status),r=dn(e);return n.jsxs("div",{className:`action-run-card ${e.status}`,children:[n.jsxs("div",{className:"action-run-header",children:[n.jsx("span",{className:"action-run-status",title:e.status,children:n.jsx(a,{size:15})}),n.jsxs("div",{className:"action-run-title",children:[n.jsx("strong",{children:e.title}),n.jsx("span",{children:e.actionName})]})]}),r.length>0&&n.jsx("div",{className:"action-run-meta","aria-label":"Action run metadata",children:r.map(l=>n.jsxs("span",{className:"action-run-chip",children:[l.icon,n.jsx("span",{children:l.label}),n.jsx("code",{children:l.value})]},l.label))}),e.responseText&&n.jsx("p",{className:"action-run-response",children:e.responseText}),e.refs.length>0&&n.jsx("div",{className:"action-run-ref-list","aria-label":"Action run references",children:e.refs.slice(0,8).map(l=>n.jsx(cn,{refItem:l,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i},l.id))}),e.childCalls.length>0&&n.jsx("div",{className:"action-run-child-list","aria-label":"Child implementation calls",children:e.childCalls.map(l=>n.jsxs("div",{className:`action-run-child ${l.status}`,children:[n.jsx("span",{children:l.label}),n.jsx("small",{children:l.status}),l.detail&&n.jsx("code",{children:l.detail})]},l.id))})]})}function Z(e){return e.implementationType==="openpond-profile-action"}function rn(e){const t=e.agentName??e.agentId;return e.actionName.endsWith(".chat")?M({actionId:e.actionName,label:e.title,name:t}):t?M({actionId:e.actionName,name:t}):e.title&&!Te(e.title)?M({actionId:e.actionName,label:e.title}):M({actionId:e.actionName})}function ln(e){return e.status==="failed"?`${e.title} failed.`:e.status==="completed"?`${e.title} completed.`:e.status==="pending"?`${e.title} is pending.`:`${e.title} is running...`}function cn({refItem:e,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i}){const a=s?Qe(e.target,{workspaceRootPath:i}):null,r=un(e.target)&&t,l=!!(a&&s);return n.jsxs("div",{className:`action-run-ref ${e.kind}`,children:[n.jsx("span",{children:e.label}),n.jsx("code",{children:e.target}),r&&n.jsx("button",{type:"button",title:`Open ${e.target}`,"aria-label":`Open ${e.label}`,onClick:()=>t(e.target,{newTab:!0}),children:n.jsx(U,{size:13})}),l&&n.jsx("button",{type:"button",title:`Open ${e.target}`,"aria-label":`Open ${e.label}`,onClick:()=>{a&&s&&s(a.path)},children:n.jsx(U,{size:13})})]})}function on(e){return e==="completed"?_e:e==="failed"?ot:st}function dn(e){const t=[];return e.implementationType&&t.push({label:"Type",value:e.implementationType,icon:n.jsx(He,{size:12})}),e.runId&&t.push({label:"Run",value:e.runId,icon:n.jsx(k,{size:12})}),e.sandboxId&&t.push({label:"Sandbox",value:e.sandboxId,icon:n.jsx(k,{size:12})}),e.sourceRef&&t.push({label:"Source",value:e.sourceRef,icon:n.jsx(Xe,{size:12})}),e.manifestHash&&t.push({label:"Manifest",value:e.manifestHash,icon:n.jsx(k,{size:12})}),t}function un(e){return/^https?:\/\//i.test(e)}const N=new Map,hn=15e3;function mn(e,t){const s=fn(e),[i,a]=d.useState(()=>s.getUrl(t));return d.useEffect(()=>{let r=!1;return a(s.getUrl(t)),s.loadUrl(t).then(l=>{r||a(l)}),()=>{r=!0}},[t,s]),i}function fn(e){const[,t]=d.useState(0),s=d.useCallback(a=>!e||!a?null:J(ee(e,a)),[e]),i=d.useCallback(async a=>{if(!e||!a)return null;const r=ee(e,a),l=J(r);if(l)return l;const c=N.get(r);if(c?.state==="loading")return c.promise;const o=re.signLocalVideoUrl(e,{path:a}).then(u=>(N.set(r,{state:"ready",url:u.url,expiresAt:u.expiresAt}),t(m=>m+1),u.url)).catch(()=>(N.delete(r),t(u=>u+1),null));return N.set(r,{state:"loading",promise:o}),o},[e]);return d.useMemo(()=>({getUrl:s,loadUrl:i}),[s,i])}function J(e){const t=N.get(e);return t?.state!=="ready"?null:t.expiresAt<=Date.now()+hn?(N.delete(e),null):t.url}function ee(e,t){return`${e.serverUrl}\0${e.token}\0${t}`}function pn(e,t){return{toolCount:e.reduce((i,a)=>i+(te(a)?0:1),0),toolsExpanded:t,visibleActivities:t?e.filter(i=>!te(i)):[]}}function te(e){return e.kind==="reasoning"}function gn(e,t){if(!e||!t)return null;const s=Date.parse(t)-Date.parse(e);if(!Number.isFinite(s)||s<1e3)return null;const i=Math.round(s/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60),r=i%60;if(a<60)return r>0?`${a}m ${r}s`:`${a}m`;const l=Math.floor(a/60),c=a%60;return c>0?`${l}h ${c}m`:`${l}h`}const xn=4;function bn({onOpenSession:e,onShowAll:t,sessions:s}){const i=s.slice(0,xn),a=Math.max(0,s.length-i.length),r=s.map(Ce).join(", ");return n.jsxs("div",{"aria-label":`Subagent conversations: ${r}`,className:"activity-subagent-avatar-group",title:`Subagent conversations: ${r}`,children:[i.map(l=>n.jsx(ve,{openSession:l,onOpenSession:e},l.sessionId)),a>0?n.jsxs("button",{type:"button","aria-label":`Show ${a} more subagent conversation${a===1?"":"s"}`,className:"activity-subagent-avatar activity-subagent-avatar-count",onClick:t,title:`Show ${a} more subagent conversation${a===1?"":"s"}`,children:["+",a]}):null]})}function ve({className:e="",onOpenSession:t,openSession:s}){const i=$e(s.roleId),a=Cn(s.status),r=`Open ${Ce(s)} conversation`;return n.jsx("button",{type:"button","aria-label":r,className:`activity-subagent-avatar ${e}`,"data-role":i,"data-status":a,onClick:()=>t(s.sessionId),title:r,children:n.jsx(jn,{roleId:i})})}function jn({roleId:e}){return e==="coding"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M9.4 7.2 4.8 12l4.6 4.8"}),n.jsx("path",{d:"m14.6 7.2 4.6 4.8-4.6 4.8"}),n.jsx("path",{d:"m12.9 5.7-1.8 12.6"})]}):e==="research"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.2"}),n.jsx("path",{d:"m15 15 4 4"}),n.jsx("path",{d:"M8.6 10.8h4.4"}),n.jsx("path",{d:"M10.8 8.6v4.4"})]}):e==="review"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M7 4.8h7.2L18 8.6v10.6H7z"}),n.jsx("path",{d:"M14 4.8v4h4"}),n.jsx("path",{d:"m8.9 14.2 2 2 4.3-4.7"})]}):e==="test"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M9.2 4.8h5.6"}),n.jsx("path",{d:"M10.4 4.8v5.4l-4 6.8a1.8 1.8 0 0 0 1.6 2.7h8a1.8 1.8 0 0 0 1.6-2.7l-4-6.8V4.8"}),n.jsx("path",{d:"M8.2 15.8h7.6"})]}):e==="docs"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M7 4.8h7.2L18 8.6v10.6H7z"}),n.jsx("path",{d:"M14 4.8v4h4"}),n.jsx("path",{d:"M9.2 11.4h5.6"}),n.jsx("path",{d:"M9.2 14.2h5.6"}),n.jsx("path",{d:"M9.2 17h3.4"})]}):e==="planner"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("circle",{cx:"7.2",cy:"7.2",r:"2.1"}),n.jsx("circle",{cx:"16.8",cy:"7.2",r:"2.1"}),n.jsx("circle",{cx:"12",cy:"16.8",r:"2.1"}),n.jsx("path",{d:"M9 8.2h6"}),n.jsx("path",{d:"m8.5 9 2.4 5.4"}),n.jsx("path",{d:"m15.5 9-2.4 5.4"})]}):e==="summarizer"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M7 6.8h10"}),n.jsx("path",{d:"M7 10.4h8.2"}),n.jsx("path",{d:"M7 14h6.2"}),n.jsx("path",{d:"M7 17.6h4.2"})]}):n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("circle",{cx:"12",cy:"8.2",r:"3.2"}),n.jsx("path",{d:"M6.5 19.2c.6-3 2.5-5 5.5-5s4.9 2 5.5 5"}),n.jsx("path",{d:"M5.2 11.8h2"}),n.jsx("path",{d:"M16.8 11.8h2"})]})}function vn(e){const t=new Map;for(const s of e){const i=s.openSession;i&&t.set(i.sessionId,{...t.get(i.sessionId),...i})}return[...t.values()].reverse()}function Ce(e){const t=`${ye(e.roleId)} subagent`,s=e.status?.replace(/_/g," ").trim();return s?`${t} (${s})`:t}function ye(e){return $e(e).split(/[-_]+/).filter(Boolean).map(s=>s.slice(0,1).toUpperCase()+s.slice(1)).join(" ")||"Subagent"}function $e(e){const t=e?.trim().toLowerCase()||"subagent";return/^[a-z][a-z0-9_-]*$/.test(t)?t:"subagent"}function Cn(e){const t=e?.trim().toLowerCase()||"unknown";return/^[a-z][a-z0-9_-]*$/.test(t)?t:"unknown"}const we=5,yn=280;function $n({activeWorkspaceAppId:e,connection:t,message:s,onOpenFileInSidebar:i,onOpenSession:a}){const r=s.activities??[],[l,c]=d.useState(!1),[o,u]=d.useState(null),m=d.useId(),f=d.useMemo(()=>dt(r),[r]),h=d.useMemo(()=>pn(r,l),[r,l]),x=r.find(g=>g.imagePreview)?.imagePreview??null,$=s.deliverables??[],j=G(o,t,e),p=s.traceState==="running",A=s.traceState==="failed"||s.traceState==="interrupted",E=gn(s.traceStartedAt,s.traceCompletedAt),w=In(f.text,s.traceState,E,r),C=vn(r);return r.length>0&&r.every(g=>g.subagentMessage)?n.jsx(An,{activities:r}):n.jsxs("article",{className:`activity-group work-trace ${p?"running":"settled"}`,children:[n.jsxs("div",{className:"activity-summary-row",children:[h.toolCount>0?n.jsxs("button",{type:"button","aria-controls":m,"aria-expanded":h.toolsExpanded,className:`activity-summary ${A?"danger":""} ${p?"working":""}`,onClick:()=>c(g=>!g),children:[x?n.jsx(se,{activeWorkspaceAppId:e,connection:t,image:x}):n.jsx(ie,{kind:f.kind}),n.jsx(ne,{summary:w}),n.jsx(z,{className:`activity-summary-toggle ${h.toolsExpanded?"expanded":""}`,size:14})]}):n.jsxs("div",{className:`activity-summary static ${A?"danger":""} ${p?"working":""}`,children:[x?n.jsx(se,{activeWorkspaceAppId:e,connection:t,image:x}):n.jsx(ie,{kind:f.kind}),n.jsx(ne,{summary:w})]}),C.length>0&&a?n.jsx(bn,{onOpenSession:a,onShowAll:()=>c(!0),sessions:C}):null]}),$.length>0?n.jsx(Sn,{artifacts:$,connection:t,onOpenFileInSidebar:i}):null,h.visibleActivities.length>0?n.jsx("div",{className:"work-trace-flow",id:m,children:h.visibleActivities.map(g=>n.jsx(wn,{activeWorkspaceAppId:e,activity:g,connection:t,onOpenImage:u,onOpenSession:a},g.id))}):null,n.jsx(oe,{open:!!j,src:j,title:o?.path??"",onClose:()=>u(null)})]})}function wn({activeWorkspaceAppId:e,activity:t,connection:s,onOpenImage:i,onOpenSession:a}){const[r,l]=d.useState(!1),c=d.useId(),o=G(t.imagePreview??null,s,e);return t.subagentMessage?n.jsx(Ne,{activity:t}):n.jsxs("div",{className:`activity-tool-row ${t.controlKind==="turn_aborted"?"danger":""}`,children:[n.jsxs("button",{type:"button","aria-controls":c,"aria-expanded":r,className:"activity-tool-summary",onClick:()=>l(u=>!u),children:[t.kind==="command"?n.jsx(le,{"aria-hidden":!0,className:"activity-tool-kind-icon",size:12}):null,n.jsx("span",{children:_n(t)}),n.jsx(z,{className:`activity-tool-toggle ${r?"expanded":""}`,size:13})]}),r?n.jsxs("div",{className:"activity-tool-details",id:c,children:[t.kind==="command"&&t.content?n.jsx(zn,{command:t.content,exitCode:t.terminal?.exitCode,output:t.detail,state:t.state}):t.content?Bn(t.content)?n.jsx("pre",{className:"activity-detail-output",children:t.content}):n.jsx("code",{className:"activity-tool-content",children:t.content}):null,t.detail&&t.kind!=="command"?n.jsx("pre",{className:"activity-detail-output",children:t.detail.replace(/\r\n/g,`
2
+ `).trimEnd()}):null,t.meta?n.jsx("small",{className:"activity-detail-meta",children:t.meta}):null,t.imagePreview&&o?n.jsx("button",{type:"button",className:"activity-image-preview",title:`Open ${t.imagePreview.path}`,onClick:()=>i(t.imagePreview??null),children:n.jsx("img",{alt:ze(t.imagePreview.path),decoding:"async",loading:"lazy",src:o})}):null,t.openSession&&a?n.jsx(ve,{className:"activity-subagent-detail-avatar",openSession:t.openSession,onOpenSession:a}):null]}):null]})}function Sn({artifacts:e,connection:t,onOpenFileInSidebar:s}){return n.jsx("div",{className:"activity-artifact-list",children:e.map(i=>i.contentType.startsWith("video/")?n.jsx(kn,{artifact:i,connection:t,onOpenFileInSidebar:s},i.path):i.contentType.startsWith("image/")?n.jsx(Nn,{artifact:i,connection:t},i.path):n.jsxs("button",{type:"button",className:"activity-artifact",title:`Show ${i.path} in its folder`,onClick:()=>{ue(i.path)},children:[n.jsx(k,{"aria-hidden":!0,size:14}),n.jsxs("span",{children:[n.jsx("strong",{children:i.title}),n.jsx("code",{children:i.path})]}),n.jsx("small",{children:i.sizeBytes==null?i.contentType:Se(i.sizeBytes)})]},i.path))})}function Nn({artifact:e,connection:t}){const[s,i]=d.useState(!1),a=de(t,e.path);return n.jsxs("div",{className:"activity-artifact-image",title:e.path,children:[n.jsx("button",{type:"button",disabled:!a,onClick:()=>i(!0),title:`Open ${e.title}`,children:a?n.jsx("img",{alt:e.title,decoding:"async",loading:"lazy",src:a}):n.jsx(B,{"aria-hidden":!0,size:20})}),n.jsx("strong",{children:e.title}),n.jsx(oe,{open:s&&!!a,src:a,title:e.title,onClose:()=>i(!1)})]})}function kn({artifact:e,connection:t,onOpenFileInSidebar:s}){const i=d.useRef(null),[a,r]=d.useState(!1),l=mn(t,e.path),c=()=>{const o=i.current;o&&o.play().then(()=>r(!0)).catch(()=>{})};return n.jsxs("div",{className:"activity-artifact-video",title:e.path,children:[n.jsxs("div",{className:"activity-artifact-video-stage",children:[l?n.jsx("video",{controls:!0,onPlay:()=>r(!0),preload:"metadata",ref:i,src:l}):n.jsx("div",{className:"activity-artifact-video-loading",children:"Preparing video…"}),l&&!a?n.jsx("button",{type:"button",className:"activity-artifact-video-play",onClick:c,"aria-label":`Play ${e.title}`,children:n.jsx(et,{"aria-hidden":!0,fill:"currentColor",size:22})}):null]}),n.jsxs("div",{className:"activity-artifact-video-footer",children:[n.jsxs("button",{type:"button",className:"activity-artifact-video-file",onClick:()=>{ue(e.path)},title:`Show ${e.path} in its folder`,children:[n.jsx(Je,{"aria-hidden":!0,size:13}),n.jsxs("span",{children:[n.jsx("strong",{children:e.title}),n.jsx("code",{children:e.path})]}),n.jsx("small",{children:e.sizeBytes==null?e.contentType:Se(e.sizeBytes)})]}),s?n.jsxs("button",{type:"button",className:"activity-artifact-video-sidebar",onClick:()=>s(e.path),title:"Open video in sidebar",children:[n.jsx(Ee,{"aria-hidden":!0,size:13}),"Open in sidebar"]}):null]})]})}function Se(e){return e<1024?`${e} B`:e<1024**2?`${(e/1024).toFixed(1)} KB`:e<1024**3?`${(e/1024**2).toFixed(1)} MB`:`${(e/1024**3).toFixed(1)} GB`}function Ne({activity:e}){const[t,s]=d.useState(!1),i=e.subagentMessage;if(!i)return null;const a=`${ye(i.roleId??e.openSession?.roleId)} subagent`,r=i.direction==="received"?`${a} update`:`Message to ${a.toLowerCase()}`,l=i.modelRef?.modelId?`${r} · ${i.modelRef.modelId}`:r,c=Rn(i),o=Mn(i.body);return n.jsx("div",{className:`activity-child-message ${i.direction}`,children:n.jsxs("div",{className:"activity-child-message-card",children:[n.jsxs("div",{className:"activity-child-message-header",children:[n.jsxs("span",{className:"activity-child-message-title",children:[n.jsx(he,{"aria-hidden":!0,size:14}),n.jsx("strong",{title:l,children:l})]}),n.jsx("small",{children:i.kind.replace(/_/g," ")})]}),n.jsx("p",{className:o&&!t?"collapsed":void 0,style:{"--subagent-message-visible-lines":we},children:i.body}),o?n.jsx("button",{type:"button",className:"activity-child-message-toggle","aria-expanded":t,onClick:()=>s(u=>!u),children:t?"Show less":"Show more"}):null,n.jsxs("details",{className:"activity-child-message-details",children:[n.jsx("summary",{children:"Message details"}),n.jsx("div",{className:"activity-child-message-facts","aria-label":"Child message metadata",children:c.map(u=>n.jsxs("span",{children:[n.jsx("small",{children:u.label}),n.jsx("code",{title:u.value,children:u.value})]},u.label))})]}),i.refs?.length?n.jsx("div",{className:"activity-child-message-refs","aria-label":"Child message references",children:i.refs.map(u=>n.jsxs("span",{children:[u.kind,":",u.id," (",u.label,")"]},`${u.kind}:${u.id}`))}):null]})},e.id)}function An({activities:e}){const t=e[0]?.subagentMessage?.direction??"received";return n.jsx("article",{className:`activity-child-message-group ${t}`,children:e.map(s=>n.jsx(Ne,{activity:s},s.id))})}function Rn(e){return[{label:"Message",value:e.messageId},{label:"Kind",value:e.kind},{label:"From",value:e.fromRunId},e.roleId?{label:"Role",value:e.roleId}:null,e.modelRef?{label:"Model",value:`${e.modelRef.providerId}/${e.modelRef.modelId}`}:null,e.childSessionId?{label:"Child",value:e.childSessionId}:null,e.toRunId?{label:"To run",value:e.toRunId}:null,e.toRole?{label:"To role",value:e.toRole}:null,e.deliveryStatus?{label:"Delivery",value:e.deliveryStatus}:null,e.wakeReason?{label:"Wake",value:e.wakeReason}:null,e.createdAt?{label:"Created",value:e.createdAt}:null].filter(t=>!!t)}function Mn(e){return e.length>yn||e.split(/\r?\n/).length>we}function ne({summary:e}){return n.jsx("span",{className:"activity-summary-text",children:n.jsx("span",{children:e})})}function In(e,t,s,i){return t==="running"?Tn(i)||e||"Working…":t==="failed"?`${s?`Failed after ${s}`:"Failed"}${e?` · ${e}`:""}`:t==="interrupted"?`${s?`Interrupted after ${s}`:"Interrupted"}${e?` · ${e}`:""}`:t==="completed"?`${s?`Worked for ${s}`:"Worked"}${e?` · ${e}`:""}`:e}function Tn(e){let t=null;for(let s=e.length-1;s>=0;s-=1){const i=e[s];if(i.kind!=="reasoning"&&(t??=i,i.state==="running"||i.state==="pending"))return T(i)}return t?T(t):null}function T(e){return e.kind==="command"?e.state==="failed"?"Command failed":me(e.content,e.state)??(e.state==="running"||e.state==="pending"?"Running command":"Ran command"):e.label.trim()||null}function _n(e){if(e.kind!=="command")return e.label;if(e.state==="running"||e.state==="pending")return T(e)??"Running command";const t=En(e.terminal?.durationMs);return e.state==="failed"?`Command failed${t?` in ${t}`:""}`:`${T(e)??"Ran command"}${t?` in ${t}`:""}`}function zn({command:e,exitCode:t,output:s,state:i}){const a=i==="running"||i==="pending"?"Running…":t!=null?`Exit code ${t}`:i==="completed"?"Exit code 0":"Failed";return n.jsxs("section",{"aria-label":"Shell command output",className:`activity-command-terminal ${i??"completed"}`,children:[n.jsx("header",{children:"Shell"}),n.jsx("pre",{children:n.jsxs("code",{className:"shell-command-code",children:[n.jsx("span",{className:"activity-command-prompt","aria-hidden":!0,children:"$ "}),Pn(e),s?n.jsx("span",{className:"activity-command-output",children:`
3
+ ${s.replace(/\r\n/g,`
4
+ `).trimEnd()}`}):null]})}),n.jsx("footer",{children:a})]})}function En(e){if(e==null||e<0)return null;if(e<6e4)return`${Math.max(1,Math.round(e/1e3))}s`;const t=Math.floor(e/6e4),s=Math.round(e%6e4/1e3);return s>0?`${t}m ${s}s`:`${t}m`}function Pn(e){return Ln(e).map((t,s)=>n.jsx("span",{className:`shell-token ${t.kind}`,children:t.text},`${s}-${t.text}`))}function Ln(e){const t=e.match(/"[^"]*"|'[^']*'|&&|\|\||[|;&()<>]|\s+|[^\s|;&()<>]+/g)??[e];let s=!0;return t.map(i=>/^\s+$/.test(i)?{kind:"plain",text:i}:/^(?:&&|\|\||[|;&()<>])$/.test(i)?(s=i!==")"&&i!==">",{kind:"operator",text:i}):/^(['"]).*\1$/.test(i)?{kind:"string",text:i}:/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(i)?{kind:"variable",text:i}:s?(s=!1,{kind:"command",text:i}):/^-{1,2}[\w-]/.test(i)?{kind:"flag",text:i}:/^(?:\.{0,2}\/|~\/|[\w.-]+\/)/.test(i)?{kind:"path",text:i}:{kind:"plain",text:i})}function se({activeWorkspaceAppId:e,connection:t,image:s}){const i=G(s,t,e);return i?n.jsx("img",{"aria-hidden":!0,className:"activity-summary-image",decoding:"async",loading:"lazy",src:i,alt:""}):null}function ie({kind:e}){const t=Un(e);return n.jsx(t,{"aria-hidden":!0,className:`activity-summary-kind-icon ${e}`,size:14})}function Un(e){return e==="approval"||e==="control"?Ze:e==="edit"?tt:e==="image"?B:e==="list"?Pe:e==="read"?k:e==="reasoning"?lt:e==="search"?Le:e==="subagent"?he:e==="web"?F:le}function G(e,t,s){const i=e&&Fn(e.path)?e.path:null,a=e?.appId??s,r=de(t,i),l=Ye(t,i?null:a,i?null:e?.path);return i?r:l}function Fn(e){return/^file:\/\//i.test(e)||/^\//.test(e)||/^[A-Za-z]:[\\/]/.test(e)}function Bn(e){return e.includes(`
5
+ `)||e.length>160}function On({summary:e,onOpenFileInSidebar:t}){const[s,i]=d.useState(null),a=`${e.filesChanged} ${e.filesChanged===1?"file":"files"} changed`,r=e.files.reduce((l,c)=>{const o=ke(c);return{additions:l.additions+o.additions,deletions:l.deletions+o.deletions}},{additions:0,deletions:0});return n.jsxs("div",{className:"change-summary-card",children:[n.jsxs("div",{className:"change-summary-header",children:[n.jsx("span",{children:a}),n.jsxs("span",{className:"change-summary-counts",children:[n.jsxs("span",{className:"diff-addition",children:["+",r.additions]}),n.jsxs("span",{className:"diff-deletion",children:["-",r.deletions]})]})]}),n.jsx("div",{className:"change-summary-files",children:e.files.map(l=>n.jsx(Gn,{file:l,onOpenFileInSidebar:t,open:s===l.path,onToggle:()=>i(c=>c===l.path?null:l.path)},l.path))})]})}function Gn({file:e,onOpenFileInSidebar:t,open:s,onToggle:i}){const a=ke(e),r=Ae(e.patch);return n.jsxs("div",{className:"change-summary-file",children:[n.jsxs("div",{className:"change-summary-file-trigger",children:[n.jsx("button",{type:"button",className:"change-summary-file-toggle",onClick:i,children:n.jsx("span",{children:e.path})}),n.jsxs("span",{className:"change-summary-counts",children:[n.jsxs("span",{className:"diff-addition",children:["+",a.additions]}),n.jsxs("span",{className:"diff-deletion",children:["-",a.deletions]})]}),t&&n.jsx("button",{type:"button",className:"change-summary-open-file",title:"Open in sidebar","aria-label":`Open ${e.path} in sidebar`,onClick:()=>t(e.path),children:n.jsx(U,{size:14})}),n.jsx("button",{type:"button",className:"change-summary-expand-file",title:s?"Hide patch":"Show patch","aria-label":s?`Hide ${e.path} patch`:`Show ${e.path} patch`,onClick:i,children:n.jsx(z,{className:s?"expanded":"",size:14})})]}),s&&r&&n.jsx("div",{className:"change-summary-patch-unavailable",children:"Patch is no longer available for this workspace path."}),s&&e.patch&&!r&&n.jsx("pre",{className:"change-summary-patch",children:n.jsx("code",{children:e.patch})})]})}function ke(e){if((e.status==="added"||e.status==="untracked")&&e.additions===0&&e.content)return{additions:Wn(e.content),deletions:0};if(e.additions>0||e.deletions>0||!e.patch||Ae(e.patch))return{additions:e.additions,deletions:e.deletions};const t=Dn(e.patch);return t.additions>0||t.deletions>0?t:{additions:e.additions,deletions:e.deletions}}function Wn(e){const t=e.endsWith(`
6
+ `)?e.slice(0,-1):e;return t?t.split(`
7
+ `).length:0}function Ae(e){return/^error: Could not access /m.test(e)}function Dn(e){let t=0,s=0;for(const i of e.split(`
8
+ `))i.startsWith("+++")||i.startsWith("---")||(i.startsWith("+")&&(t+=1),i.startsWith("-")&&(s+=1));return{additions:t,deletions:s}}function qn({run:e}){const t=e.plan,s=e.questions.find(c=>c.status==="pending")??null,i=Ue(t?.metadata),r=e.target.kind==="agent"?null:e.sourceRefs[0]??t?.sourcePlan[0]?.path??null,l=e.checkRefs.length||t?.checks.length||0;return n.jsxs("section",{className:"chat-create-receipt","aria-label":"Create or improve status",children:[n.jsxs("div",{className:"chat-create-receipt-heading",children:[n.jsx(k,{size:14}),n.jsx("span",{children:Kn(e)}),n.jsx("small",{children:e.target.kind})]}),n.jsx("p",{children:Vn(e,t?.summary??null,s?.prompt??null)}),i||r||l?n.jsxs("div",{className:"chat-create-receipt-facts",children:[i?n.jsx("span",{title:i.detail,children:i.label}):null,r?n.jsx("span",{title:r,children:r}):null,l?n.jsxs("span",{children:[l," Evals"]}):null]}):null]})}function Kn(e){const t=e.target.kind==="agent";return e.state==="awaiting_questions"?"Question ready":e.state==="awaiting_plan_approval"?"Plan ready":e.state==="applying_source"?t?"Saving Agent":"Applying source":e.state==="running_checks"?"Running Evals":e.state==="evaluating"?t?"Checking Agent":"Evaluating candidate":e.state==="awaiting_promotion"?t?"Update ready":"Candidate ready":e.state==="opening_pull_request"?"Opening review":e.state==="pull_request_open"?"Review open":e.state==="reconciling_release"?t?"Applying update":"Merging change":e.state==="released"?t?"Agent updated":"Released":e.state==="rejected"?t?"Current Agent kept":"Rejected":e.state==="ready"||e.state==="ready_local"?t?"Agent ready":"Workproduct ready":e.state==="published_hosted"?"Published":e.state==="cancelled"?"Cancelled":e.state==="blocked"?"Blocked":e.state==="failed"?"Failed":e.operation==="improve"?"Planning improvement":"Planning creation"}function Vn(e,t,s){return e.state==="awaiting_questions"&&s?s:t||(e.blockedReason?e.blockedReason:e.state==="ready"||e.state==="ready_local"?e.target.kind==="agent"?"The Agent and its actions are ready to use.":"The candidate and its Evals are ready.":e.state==="awaiting_promotion"?e.target.kind==="agent"?"The updated Agent passed its Evals. Apply the update or keep the current version.":"The candidate has been committed and evaluated. Merge or reject it.":e.state==="pull_request_open"&&e.releaseOutcome.pullRequest?e.target.kind==="agent"?"The Agent update review is waiting to finish or close.":"The external review is waiting for merge or closure.":e.state==="released"?e.target.kind==="agent"?"The Agent update is saved and its Evals passed.":"The change merged and the active Profile passed its post-merge Evals.":e.state==="rejected"?e.blockedReason??(e.target.kind==="agent"?"The Agent update was not applied.":"The candidate was rejected."):`Preparing work for ${e.objective}.`)}const vs=d.memo(function({activeWorkspaceAppId:t=null,animateInitialContent:s=!1,accountBaseUrl:i=null,billingOrganizationSlug:a=null,billingTeamId:r=null,connection:l=null,message:c,onOpenBrowserLink:o,onOpenAttachmentInSidebar:u,onOpenFileInSidebar:m,onOpenProfileSettings:f,onResolveUserQuestion:h,onOpenSession:x,showFooter:$=!1,userAttachmentDisplay:j="full",workspaceRootPath:p=null}){if(c.role==="status_divider")return n.jsx(cs,{message:c});if(c.role==="activity_group")return n.jsx($n,{activeWorkspaceAppId:t,connection:l,message:c,onOpenFileInSidebar:m,onOpenSession:x});if(c.role==="error")return c.errorKind==="opchat_quota_exceeded"?n.jsx("article",{className:"message-row assistant",children:n.jsx(ns,{accountBaseUrl:i,billingOrganizationSlug:a,billingTeamId:r,onOpenBrowserLink:o})}):n.jsx("article",{className:"message-row assistant",children:n.jsx("div",{className:"assistant-message error-message",children:c.content??""})});if(c.role==="user"){const C=c.attachments??[],P=j==="compact",g=C.length>0,Me=!!(!P&&C.some(Ie=>Ie.kind==="image"));return n.jsx("article",{className:"message-row user",children:n.jsxs("div",{className:`user-message ${g?"has-attachments":""} ${Me?"has-image-attachments":""}`,children:[C.length?n.jsx(is,{attachments:C,compact:P,connection:l,onOpenAttachment:u}):null,c.content?n.jsx(Hn,{content:c.content}):null]})})}const A=Fe(c.timestamp),E=Be(c.timestamp),w=c.actionRun&&Z(c.actionRun)?rn(c.actionRun):null;return n.jsxs("article",{className:"message-row assistant",children:[c.content?n.jsx("div",{className:"assistant-message",children:n.jsx(sn,{activeWorkspaceAppId:t,animateInitialContent:s,connection:l,content:c.content,onOpenBrowserLink:o,onOpenFileInSidebar:m,workspaceRootPath:p})}):null,c.sources?.length?n.jsx(Zn,{sources:c.sources,onOpenBrowserLink:o}):null,c.actionRun&&Z(c.actionRun)?n.jsxs("div",{className:`assistant-message action-run-profile-message ${c.actionRun.status}`,children:[n.jsx(ce,{activeWorkspaceAppId:t,connection:l,content:c.actionRun.responseText??ln(c.actionRun),onOpenBrowserLink:o,onOpenFileInSidebar:m,workspaceRootPath:p}),w?n.jsx("div",{className:"action-run-agent-label",children:f?n.jsx("button",{type:"button",className:"action-run-agent-link",onClick:f,children:w}):n.jsx("span",{children:w})}):null]}):c.actionRun?n.jsx(an,{actionRun:c.actionRun,onOpenBrowserLink:o,onOpenFileInSidebar:m,workspaceRootPath:p}):null,c.changeSummary&&n.jsx(On,{summary:c.changeSummary,onOpenFileInSidebar:m}),c.createImproveRun?n.jsx(qn,{run:c.createImproveRun}):null,c.userQuestion?n.jsx(Xn,{question:c.userQuestion,onResolve:h}):null,$&&n.jsxs("div",{className:"assistant-message-footer",children:[A&&n.jsx("time",{className:"message-timestamp",dateTime:c.timestamp,title:E,children:A}),n.jsx("button",{type:"button",className:"message-copy-button",title:"Copy message","aria-label":"Copy assistant message",disabled:!c.content,onClick:()=>{c.content&&Oe(c.content)},children:n.jsx(at,{size:14})})]})]})},Qn),ae=10;function Hn({content:e}){const t=d.useMemo(()=>e.split(/\r?\n/),[e]),[s,i]=d.useState(!1),a=t.length>ae,r=a&&!s?t.slice(0,ae).join(`
9
+ `):e;return n.jsxs("div",{className:`user-message-content-wrap ${a?"collapsible":""}`,children:[n.jsx("div",{className:"user-message-content",children:r}),a?n.jsxs("button",{type:"button",className:"user-message-show-more","aria-expanded":s,onClick:()=>i(l=>!l),children:[s?n.jsx(De,{size:14}):n.jsx(z,{size:14}),n.jsx("span",{children:s?"Show less":"Show more"})]}):null]})}function Qn(e,t){return e.activeWorkspaceAppId===t.activeWorkspaceAppId&&e.animateInitialContent===t.animateInitialContent&&e.accountBaseUrl===t.accountBaseUrl&&e.billingOrganizationSlug===t.billingOrganizationSlug&&e.billingTeamId===t.billingTeamId&&e.connection===t.connection&&e.onOpenBrowserLink===t.onOpenBrowserLink&&e.onOpenAttachmentInSidebar===t.onOpenAttachmentInSidebar&&e.onOpenFileInSidebar===t.onOpenFileInSidebar&&e.onOpenProfileSettings===t.onOpenProfileSettings&&e.onResolveUserQuestion===t.onResolveUserQuestion&&e.onOpenSession===t.onOpenSession&&e.showFooter===t.showFooter&&e.userAttachmentDisplay===t.userAttachmentDisplay&&e.workspaceRootPath===t.workspaceRootPath&&Yn(e.message,t.message)}function Yn(e,t){return e===t?!0:e.id===t.id&&e.role===t.role&&e.content===t.content&&e.timestamp===t.timestamp&&e.turnId===t.turnId&&e.statusKind===t.statusKind&&e.statusState===t.statusState&&e.statusTone===t.statusTone&&e.errorKind===t.errorKind&&ss(e.attachments,t.attachments)&&e.activities===t.activities&&e.sources===t.sources&&e.actionRun===t.actionRun&&e.changeSummary===t.changeSummary&&e.createImproveRun===t.createImproveRun&&e.userQuestion===t.userQuestion}function Xn({question:e,onResolve:t}){const[s,i]=d.useState(""),[a,r]=d.useState(!1),l=async c=>{if(!(!t||a||e.status!=="pending")){r(!0);try{await t(e,c)}finally{r(!1)}}};return n.jsxs("section",{className:`user-question-card ${e.status}`,"aria-label":"Question from OpenPond",children:[n.jsx("strong",{children:e.question}),e.reason?n.jsx("p",{children:e.reason}):null,e.status==="pending"?n.jsxs(n.Fragment,{children:[e.options.length>0?n.jsx("div",{className:"user-question-options",children:e.options.map(c=>n.jsxs("button",{disabled:a||!t,type:"button",onClick:()=>{l({questionId:e.id,action:"answer",optionId:c.id,text:c.label})},children:[n.jsx("span",{children:c.label}),c.description?n.jsx("small",{children:c.description}):null]},c.id))}):null,e.allowFreeform?n.jsxs("form",{className:"user-question-freeform",onSubmit:c=>{c.preventDefault();const o=s.trim();o&&l({questionId:e.id,action:"answer",optionId:null,text:o})},children:[n.jsx("input",{"aria-label":"Answer",disabled:a||!t,onChange:c=>i(c.target.value),placeholder:"Type an answer",value:s}),n.jsx("button",{disabled:a||!t||!s.trim(),type:"submit",children:"Answer"})]}):null,n.jsx("button",{className:"user-question-dismiss",disabled:a||!t,type:"button",onClick:()=>{l({questionId:e.id,action:"dismiss",optionId:null,text:""})},children:"Dismiss question"})]}):n.jsx("small",{children:e.status==="answered"?`Answered${e.answer?.text?`: ${e.answer.text}`:""}`:"Dismissed"})]})}function Zn({sources:e,onOpenBrowserLink:t}){return n.jsxs("div",{className:"assistant-sources","aria-label":"Sources",children:[n.jsxs("span",{className:"assistant-sources-label",children:[n.jsx(F,{size:13}),n.jsx("span",{children:"Sources"})]}),e.map(s=>n.jsx(Jn,{source:s,onOpenBrowserLink:t},`${s.id}:${s.url}`))]})}function Jn({source:e,onOpenBrowserLink:t}){const s=ts(e),i=[e.title,Re(e.url)].filter(Boolean).join(" - "),a=n.jsxs(n.Fragment,{children:[n.jsx(es,{source:e}),n.jsx("span",{children:s})]});return t?n.jsx("button",{type:"button",className:"assistant-source-pill",title:i||s,"aria-label":`Open source ${s}`,onClick:()=>t(e.url,{newTab:!0}),children:a}):n.jsx("a",{className:"assistant-source-pill",href:e.url,target:"_blank",rel:"noreferrer",title:i||s,"aria-label":`Open source ${s}`,children:a})}function es({source:e}){const[t,s]=d.useState(!1);return!e.faviconUrl||t?n.jsx(F,{className:"assistant-source-fallback-icon",size:13}):n.jsx("img",{alt:"","aria-hidden":"true",className:"assistant-source-favicon",decoding:"async",loading:"lazy",src:e.faviconUrl,onError:()=>s(!0)})}function ts(e){return e.sourceName?.trim()||Re(e.url)||e.title}function Re(e){try{return new URL(e).hostname.replace(/^www\./i,"")}catch{return null}}function ns({accountBaseUrl:e,billingOrganizationSlug:t,billingTeamId:s,onOpenBrowserLink:i}){const a=Ge({accountBaseUrl:e,organizationSlug:t,teamId:s}),r=n.jsxs(n.Fragment,{children:[n.jsx(W,{size:15}),n.jsx("span",{children:"Add credits"}),n.jsx(We,{size:13})]});return n.jsxs("div",{className:"assistant-message quota-error-card",role:"alert",children:[n.jsx("div",{className:"quota-error-card-icon",children:n.jsx(W,{size:17})}),n.jsxs("div",{className:"quota-error-card-body",children:[n.jsx("strong",{children:"OpenPond Chat allowance reached"}),n.jsx("p",{children:"You have reached your OpChat token allowance for this period. Add credits or wait for the allowance to reset."}),i?n.jsx("button",{type:"button",className:"quota-error-card-action",onClick:()=>i(a,{newTab:!0}),children:r}):n.jsx("a",{className:"quota-error-card-action",href:a,target:"_blank",rel:"noreferrer",children:r})]})]})}function ss(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const i=e[s],a=t[s];if(i.id!==a.id||i.kind!==a.kind||i.name!==a.name||i.mediaType!==a.mediaType||i.sizeBytes!==a.sizeBytes||i.lineCount!==a.lineCount||i.imagePreview?.sessionId!==a.imagePreview?.sessionId||i.imagePreview?.turnId!==a.imagePreview?.turnId||i.imagePreview?.attachmentId!==a.imagePreview?.attachmentId||i.imagePreview?.storageName!==a.imagePreview?.storageName||i.imagePreview?.contentType!==a.imagePreview?.contentType||i.filePreview?.sessionId!==a.filePreview?.sessionId||i.filePreview?.turnId!==a.filePreview?.turnId||i.filePreview?.attachmentId!==a.filePreview?.attachmentId||i.filePreview?.storageName!==a.filePreview?.storageName||i.filePreview?.contentType!==a.filePreview?.contentType)return!1}return!0}function is({attachments:e,compact:t,connection:s,onOpenAttachment:i}){return n.jsx("div",{className:`user-message-attachments${t?" compact":""}`,"aria-label":"Attached files",children:e.map(a=>n.jsx(as,{attachment:a,compact:t,connection:s,onOpenAttachment:i},a.id))})}function as({attachment:e,compact:t,connection:s,onOpenAttachment:i}){return!t&&e.kind==="image"&&e.imagePreview?n.jsx(ls,{attachment:e,connection:s}):n.jsx(rs,{attachment:e,onOpenAttachment:i})}function rs({attachment:e,onOpenAttachment:t}){const[s,i]=d.useState(!1),a=!!((e.filePreview||e.imagePreview)&&t),r=s?"Opening":e.lineCount!==void 0?qe(e.lineCount):null,l=n.jsxs(n.Fragment,{children:[n.jsx(Ke,{attachment:e,size:13}),n.jsx("span",{children:e.name}),r?n.jsx("small",{children:r}):null]});return a?n.jsx("button",{"aria-label":`Open attached file ${e.name}`,className:"user-message-attachment openable",disabled:s,title:`Open ${e.name}`,type:"button",onClick:()=>{!t||s||(i(!0),t(e).finally(()=>i(!1)))},children:l}):n.jsx("span",{className:"user-message-attachment",title:e.name,children:l})}function ls({attachment:e,connection:t}){const s=Dt(t,e.imagePreview);return n.jsxs("figure",{className:`user-message-image-attachment ${s?"ready":"loading"}`,title:e.name,children:[n.jsx("div",{className:"user-message-image-frame",children:s?n.jsx("img",{alt:e.name,decoding:"async",loading:"lazy",src:s}):n.jsx(B,{size:24})}),n.jsx("figcaption",{children:n.jsx("span",{children:e.name})})]})}const Cs=d.memo(function(){return n.jsx("article",{className:"activity-group thinking-row","aria-live":"polite",children:n.jsx("div",{className:"activity-summary thinking-summary",role:"status",children:n.jsx("span",{children:"Thinking..."})})})});function cs({message:e}){const t=e.statusTone??"info",s=e.statusState??"idle";return n.jsx("article",{className:`status-divider ${t} ${s}`,"aria-live":t==="danger"?"assertive":"polite",children:n.jsx("span",{children:e.content??""})})}export{vs as M,Cs as T,js as u};
@@ -1 +1 @@
1
- import{j as e,F as o,$ as c,X as n}from"./index-Ure41UF0.js";import{M as d}from"./MarkdownText-DTBS9xe7.js";function x({expanded:s,skill:a,onClose:i,onResizeStart:r,onToggleExpanded:l}){const t=a.path.split("/").at(-1)??a.path;return e.jsxs("aside",{className:`workspace-diff-panel native-skill-sidebar ${s?"expanded":""}`,"aria-label":`Skill source: ${a.name}`,children:[s?null:e.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize native skill source",onPointerDown:r}),e.jsxs("div",{className:"workspace-diff-topbar native-skill-sidebar-topbar",children:[e.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Native skill files",children:e.jsxs("button",{className:"workspace-diff-tab active",type:"button",role:"tab","aria-selected":!0,children:[e.jsx(o,{size:14}),e.jsx("span",{children:t})]})}),e.jsxs("div",{className:"workspace-diff-toolbar-actions",children:[e.jsx("button",{className:"diff-icon-button",type:"button",title:s?"Dock sidebar":"Expand sidebar","aria-label":s?"Dock sidebar":"Expand sidebar",onClick:l,children:s?e.jsx(d,{size:14}):e.jsx(c,{size:14})}),e.jsx("button",{className:"diff-icon-button",type:"button",title:"Close skill source","aria-label":"Close skill source",onClick:i,children:e.jsx(n,{size:14})})]})]}),e.jsxs("div",{className:"native-skill-sidebar-body",children:[e.jsxs("header",{className:"native-skill-source-header",children:[e.jsx("h2",{children:a.name}),e.jsx("p",{children:a.description}),e.jsx("code",{children:a.path})]}),e.jsx("pre",{className:"native-skill-markdown-source","aria-label":`${a.name} Markdown source`,children:e.jsx("code",{children:a.body})})]})]})}export{x as NativeSkillSidebar};
1
+ import{j as e,F as o,Z as c,X as n}from"./index-Cxq5q-6B.js";import{M as d}from"./MarkdownText-CzZ60aWs.js";function x({expanded:s,skill:a,onClose:i,onResizeStart:r,onToggleExpanded:l}){const t=a.path.split("/").at(-1)??a.path;return e.jsxs("aside",{className:`workspace-diff-panel native-skill-sidebar ${s?"expanded":""}`,"aria-label":`Skill source: ${a.name}`,children:[s?null:e.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize native skill source",onPointerDown:r}),e.jsxs("div",{className:"workspace-diff-topbar native-skill-sidebar-topbar",children:[e.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Native skill files",children:e.jsxs("button",{className:"workspace-diff-tab active",type:"button",role:"tab","aria-selected":!0,children:[e.jsx(o,{size:14}),e.jsx("span",{children:t})]})}),e.jsxs("div",{className:"workspace-diff-toolbar-actions",children:[e.jsx("button",{className:"diff-icon-button",type:"button",title:s?"Dock sidebar":"Expand sidebar","aria-label":s?"Dock sidebar":"Expand sidebar",onClick:l,children:s?e.jsx(d,{size:14}):e.jsx(c,{size:14})}),e.jsx("button",{className:"diff-icon-button",type:"button",title:"Close skill source","aria-label":"Close skill source",onClick:i,children:e.jsx(n,{size:14})})]})]}),e.jsxs("div",{className:"native-skill-sidebar-body",children:[e.jsxs("header",{className:"native-skill-source-header",children:[e.jsx("h2",{children:a.name}),e.jsx("p",{children:a.description}),e.jsx("code",{children:a.path})]}),e.jsx("pre",{className:"native-skill-markdown-source","aria-label":`${a.name} Markdown source`,children:e.jsx("code",{children:a.body})})]})]})}export{x as NativeSkillSidebar};
@@ -1 +1 @@
1
- import{j as e,X as N,d as b}from"./index-Ure41UF0.js";import{F as f}from"./folder-open-D7a4t258.js";import{F as P}from"./folder-plus-CmeHTj5W.js";function A({open:d,mode:a="local",name:s,path:r,directory:n,busy:t,onNameChange:c,onPathChange:j,onClose:p,onSubmit:g}){if(!d)return null;const l=a==="cloud",o=a==="existing-local",u=l?b:o?f:P,x=l?"New Cloud Project":o?"Use Existing Folder":"New Local Project",m=l?"Create a hosted project in OpenPond Cloud.":o?"Add an existing local project folder to Projects.":"Create a new local Git project and add it to Projects.",h=t||(o?!r.trim():!s.trim()),C=t?o?"Adding":"Creating":l?"Create Cloud Project":o?"Add project":"Create project";return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:e.jsxs("form",{className:"git-dialog new-project-dialog","aria-label":o?"Add existing project":"Create project",onSubmit:i=>{i.preventDefault(),g()},children:[e.jsx("button",{className:"git-dialog-close",disabled:t,type:"button",onClick:p,children:e.jsx(N,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(u,{size:18})}),e.jsx("h2",{children:x}),e.jsx("p",{children:m}),o?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Folder path"}),e.jsx("input",{autoFocus:!0,disabled:t,placeholder:"/home/user/project",value:r,onChange:i=>j(i.target.value)})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Project name"}),e.jsx("input",{autoFocus:!0,disabled:t,placeholder:"New project",value:s,onChange:i=>c(i.target.value)})]}),e.jsxs("div",{className:"git-dialog-row",children:[e.jsx("span",{children:"Location"}),e.jsx("strong",{className:"git-dialog-path",children:l?"OpenPond Cloud":n})]})]}),e.jsx("button",{className:"git-dialog-primary full",disabled:h,type:"submit",children:C})]})})}export{A as NewProjectDialog};
1
+ import{j as e,X as N,d as b}from"./index-Cxq5q-6B.js";import{F as f}from"./folder-open-CqjIkaDK.js";import{F as P}from"./folder-plus-CsS0KPW5.js";function A({open:d,mode:a="local",name:s,path:r,directory:n,busy:t,onNameChange:c,onPathChange:j,onClose:p,onSubmit:g}){if(!d)return null;const l=a==="cloud",o=a==="existing-local",u=l?b:o?f:P,x=l?"New Cloud Project":o?"Use Existing Folder":"New Local Project",m=l?"Create a hosted project in OpenPond Cloud.":o?"Add an existing local project folder to Projects.":"Create a new local Git project and add it to Projects.",h=t||(o?!r.trim():!s.trim()),C=t?o?"Adding":"Creating":l?"Create Cloud Project":o?"Add project":"Create project";return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:e.jsxs("form",{className:"git-dialog new-project-dialog","aria-label":o?"Add existing project":"Create project",onSubmit:i=>{i.preventDefault(),g()},children:[e.jsx("button",{className:"git-dialog-close",disabled:t,type:"button",onClick:p,children:e.jsx(N,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(u,{size:18})}),e.jsx("h2",{children:x}),e.jsx("p",{children:m}),o?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Folder path"}),e.jsx("input",{autoFocus:!0,disabled:t,placeholder:"/home/user/project",value:r,onChange:i=>j(i.target.value)})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Project name"}),e.jsx("input",{autoFocus:!0,disabled:t,placeholder:"New project",value:s,onChange:i=>c(i.target.value)})]}),e.jsxs("div",{className:"git-dialog-row",children:[e.jsx("span",{children:"Location"}),e.jsx("strong",{className:"git-dialog-path",children:l?"OpenPond Cloud":n})]})]}),e.jsx("button",{className:"git-dialog-primary full",disabled:h,type:"submit",children:C})]})})}export{A as NewProjectDialog};
@@ -0,0 +1 @@
1
+ import{r as i,n as W,j as e,aL as A,aE as D,X as B,F as R}from"./index-Cxq5q-6B.js";import{s as M,r as z,C as K,F as X}from"./MarkdownText-CzZ60aWs.js";import{F as q,I as H,P as Y,a as V,b as G}from"./MainPane-COs4xUGo.js";import{F as J}from"./folder-open-CqjIkaDK.js";import"./cloud-upload-DeQEwz1o.js";import"./folder-DgS_U9Lq.js";import"./arrow-up-right-CkfCgokz.js";import"./square-Dp5eGICS.js";const Q="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Z="application/vnd.openxmlformats-officedocument.presentationml.presentation",tt="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";function x(t){const s=t.contentType.toLowerCase(),o=t.title.toLowerCase();return s===Q||o.endsWith(".docx")?{label:"Document",type:"document"}:s==="application/pdf"||o.endsWith(".pdf")?{label:"PDF",type:"pdf"}:s===Z||o.endsWith(".pptx")?{label:"Presentation",type:"presentation"}:s===tt||s==="text/csv"||s==="text/tab-separated-values"||o.endsWith(".xlsx")||o.endsWith(".csv")||o.endsWith(".tsv")?{label:"Table",type:"table"}:s==="text/html"||o.endsWith(".html")?{label:"HTML",type:"html"}:s==="application/json"||s==="text/markdown"||s==="text/plain"?{label:"Text",type:"text"}:s.startsWith("image/")?{label:"Image",type:"image"}:s.startsWith("audio/")?{label:"Audio",type:"audio"}:s.startsWith("video/")?{label:"Video",type:"video"}:{label:"File",type:"file"}}function et(t){return[...t].sort((s,o)=>P(o.createdAt)-P(s.createdAt)||o.revision-s.revision)}function P(t){const s=new Date(t).getTime();return Number.isNaN(s)?0:s}const st=15e3,f=new Map;function nt(t){const s=i.useMemo(()=>t?_(t):null,[t]),o=s?L(s):null,[a,r]=i.useState(o??[]),[j,h]=i.useState(!!t&&!o),[b,d]=i.useState(null);return i.useEffect(()=>{let p=!1;if(!t||!s){r([]),h(!1),d(null);return}const m=L(s);return r(m??[]),h(!m),d(null),ot(t).then(l=>{p||r(l)}).catch(l=>{p||d(rt(l))}).finally(()=>{p||h(!1)}),()=>{p=!0}},[s,t]),{error:b,loading:j,outputs:a}}function L(t){const s=f.get(t);return s&&s.refreshedAt>0?s.outputs:null}function ot(t){const s=_(t),o=f.get(s);if(o?.request)return o.request;if(o&&o.refreshedAt>0&&Date.now()-o.refreshedAt<st)return Promise.resolve(o.outputs);const a=W.workOutputs(t).then(r=>et(r.outputs)).then(r=>(f.set(s,{outputs:r,refreshedAt:Date.now(),request:null}),r)).catch(r=>{throw o?f.set(s,{...o,request:null}):f.delete(s),r});return f.set(s,{outputs:o?.outputs??[],refreshedAt:o?.refreshedAt??0,request:a}),a}function _(t){return`${t.serverUrl}\0${t.token}`}function rt(t){return t instanceof Error?t.message:"Could not load Work outputs."}const v="all",at=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"});function gt({connection:t,onViewChat:s}){const{error:o,loading:a,outputs:r}=nt(t),[j,h]=i.useState(v),[b,d]=i.useState(null),[p,m]=i.useState(null),[l,T]=i.useState(null);i.useEffect(()=>()=>{l?.objectUrl&&URL.revokeObjectURL(l.objectUrl)},[l?.objectUrl]);const k=i.useMemo(()=>Array.from(new Set(r.map(n=>x(n).label))).sort((n,u)=>n.localeCompare(u)),[r]),y=k.includes(j)?j:v,w=i.useMemo(()=>y===v?r:r.filter(n=>x(n).label===y),[y,r]);async function I(n){if(!t)return;const u=S(n);m(u),d(null);try{const c=await W.workspaceTool(t,n.sourceTaskId,{action:"work_output_read",source:"ui_button",args:{outputId:n.id,revision:n.revision}});if(!c.ok)throw new Error(c.output);const F=pt(c.data),U=typeof F.contentsBase64=="string"?F.contentsBase64:"";if(!U)throw new Error("The output did not include file data.");const N=new File([dt(U)],n.title,{type:n.contentType}),E=x(n),O=E.type==="text"||E.type==="html";l?.objectUrl&&URL.revokeObjectURL(l.objectUrl),T({file:N,objectUrl:O?null:URL.createObjectURL(N),output:n,text:O?await N.text():null})}catch(c){d(ft(c))}finally{m(null)}}async function C(n){if(n.location.kind!=="local")return;const u=await M(n.location.path,n.title);!u.ok&&!u.canceled&&d("Could not save a copy of the Work output.")}return e.jsxs("section",{"aria-label":"My files",className:`outputs-view${l?" detail-open":""}`,children:[e.jsx("div",{className:"outputs-scroll",children:e.jsxs("div",{className:"outputs-content",children:[r.length>0?e.jsx("header",{className:"outputs-header",children:e.jsx("label",{className:"outputs-filter",children:e.jsxs("select",{"aria-label":"Filter files by file type",onChange:n=>h(n.target.value),value:y,children:[e.jsx("option",{value:v,children:"All file types"}),k.map(n=>e.jsx("option",{value:n,children:n},n))]})})}):null,o||b?e.jsx("p",{className:"outputs-error",children:b??o}):null,t?a&&r.length===0?e.jsxs("div",{className:"outputs-loading",role:"status",children:[e.jsx(A,{className:"outputs-spin",size:16}),e.jsx("span",{children:"Loading files"})]}):r.length===0?e.jsx(g,{children:"Files created in Work will appear here."}):w.length===0?e.jsx(g,{children:"No files match this file type."}):e.jsx("div",{className:"outputs-grid","data-testid":"desktop-output-cards",children:w.map(n=>{const u=x(n),c=S(n);return e.jsxs("article",{className:"output-card",children:[e.jsxs("button",{"aria-label":`Preview ${n.title}`,className:"output-card-main",disabled:p===c,onClick:()=>{I(n)},type:"button",children:[e.jsx("span",{className:"output-card-icon",children:e.jsx($,{type:u.type})}),e.jsxs("span",{className:"output-card-copy",children:[e.jsx("strong",{children:n.title}),e.jsxs("small",{children:[u.label," · ",ut(n.sizeBytes)]}),e.jsxs("small",{children:["Revision ",n.revision," ·"," ",e.jsx("time",{dateTime:n.createdAt,children:ct(n.createdAt)})]})]}),p===c?e.jsx(A,{className:"outputs-spin",size:15}):null]}),e.jsxs("div",{className:"output-card-actions",children:[n.location.kind==="local"?e.jsx("button",{"aria-label":`Download ${n.title}`,className:"output-download-button",onClick:()=>{C(n)},title:"Download",type:"button",children:e.jsx(D,{"aria-hidden":"true",size:14})}):null,e.jsx("button",{onClick:()=>s(n.sourceTaskId),type:"button",children:"View chat"})]})]},c)})}):e.jsx(g,{children:"Connect to the local OpenPond server to view outputs."})]})}),l?e.jsx(lt,{onClose:()=>T(null),onSave:()=>{C(l.output)},onViewChat:()=>s(l.output.sourceTaskId),preview:l}):null]})}function lt({onClose:t,onSave:s,onViewChat:o,preview:a}){const r=x(a.output);return e.jsxs("aside",{"aria-label":`${a.output.title} preview`,className:"output-detail",children:[e.jsxs("header",{className:"output-detail-header",children:[e.jsxs("div",{children:[e.jsx("h2",{children:a.output.title}),e.jsxs("p",{children:[r.label," · Revision ",a.output.revision]})]}),e.jsx("button",{"aria-label":"Close output preview",onClick:t,type:"button",children:e.jsx(B,{size:16})})]}),e.jsx("div",{className:"output-preview-surface",children:a.text!==null?r.type==="html"?e.jsx("iframe",{sandbox:"",srcDoc:a.text,title:a.output.title}):e.jsx("pre",{children:a.text}):r.type==="image"&&a.objectUrl?e.jsx("img",{alt:a.output.title,src:a.objectUrl}):r.type==="pdf"&&a.objectUrl?e.jsx("iframe",{src:a.objectUrl,title:a.output.title}):r.type==="audio"&&a.objectUrl?e.jsx("audio",{controls:!0,src:a.objectUrl}):r.type==="video"&&a.objectUrl?e.jsx("video",{controls:!0,src:a.objectUrl}):e.jsxs("div",{className:"output-native-preview",children:[e.jsx($,{type:r.type}),e.jsx("p",{children:"This file type uses its native application for detailed review."})]})}),e.jsxs("div",{className:"output-detail-actions",children:[a.output.location.kind==="local"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{z(a.output.location.kind==="local"?a.output.location.path:"")},type:"button",children:[e.jsx(J,{size:14}),"Reveal"]}),e.jsx("button",{"aria-label":`Download ${a.output.title}`,className:"output-download-button",onClick:s,title:"Download",type:"button",children:e.jsx(D,{"aria-hidden":"true",size:14})})]}):null,e.jsx("button",{onClick:o,type:"button",children:"View chat"})]})]})}function $({type:t}){const s=it(t);return e.jsx(s,{"aria-hidden":"true",size:18})}function it(t){return t==="audio"?q:t==="html"||t==="text"?K:t==="image"?H:t==="presentation"?Y:t==="table"?V:t==="video"?G:t==="file"?X:R}function g({children:t}){return e.jsx("p",{className:"outputs-empty",children:t})}function S(t){return`${t.sourceTaskId}:${t.id}:${t.revision}`}function ut(t){return t<1e3?`${t} B`:t<1e6?`${(t/1e3).toFixed(1)} KB`:`${(t/1e6).toFixed(1)} MB`}function ct(t){const s=new Date(t);return Number.isNaN(s.getTime())?"Unknown date":at.format(s)}function dt(t){const s=window.atob(t),o=new ArrayBuffer(s.length),a=new Uint8Array(o);for(let r=0;r<s.length;r+=1)a[r]=s.charCodeAt(r);return o}function pt(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function ft(t){return t instanceof Error?t.message:"Could not load Work outputs."}export{gt as OutputsPage};
@@ -0,0 +1 @@
1
+ import{r,al as ke,j as s,bW as ve,a9 as we,aa as xe,ae as Re,ab as ye,X as je,P as Pe,a0 as Ae}from"./index-Cxq5q-6B.js";import{F as ue}from"./folder-open-CqjIkaDK.js";import{u as Ce,T as Te,M as Ie}from"./Messages-DGrK4iIj.js";import{s as Me,c as Ne,A as De,d as Ee}from"./MainPane-COs4xUGo.js";import"./chevron-up-B5URpgIH.js";import"./MarkdownText-CzZ60aWs.js";import"./arrow-up-right-CkfCgokz.js";import"./git-branch-BN2ijBYt.js";import"./circle-alert-CAvjRdlQ.js";import"./play-DGCzapdE.js";import"./square-pen-j-mZ_UkO.js";import"./cloud-upload-DeQEwz1o.js";import"./folder-DgS_U9Lq.js";import"./square-Dp5eGICS.js";function Se({panel:e,actionCatalog:w,createImproveActions:x,initialScrollState:p,codexPermissionMode:E,codexReasoningEffort:S,openPondCommandAccessMode:R,connection:y,connectedAppMentions:F,mentionApps:B,codexPersonalSkills:L,profileSkills:$,profileTarget:j,projectTarget:O,providerSettings:H,accountBaseUrl:q,billingOrganizationSlug:z,billingTeamId:K,showToast:V,workspaceTarget:W,onCodexPermissionModeChange:U,onCodexReasoningEffortChange:Q,onOpenPondCommandAccessModeChange:P,onModelChange:X,onOpenAttachmentInSidebar:_,onOpenFileInSidebar:G,onOpenProfileSettings:J,onOpenSession:Y,onProviderChange:Z,onProviderSetupOpen:ee,onPromptChange:te,onProfileTargetChange:se,onScrollStateChange:ie,onProjectTargetChange:oe,onResolveApproval:re,onShowBrowserPanel:A,onStop:ne,onSubmit:g,onWorkspaceTargetChange:ae}){const b=r.useRef(null),l=r.useRef(p?.stickyToBottom??!0),C=r.useRef(!1),k=e.running&&!e.pendingApproval&&Me(e.messages),ce=r.useMemo(()=>e.createImproveRun?{...x,run:e.createImproveRun}:null,[x,e.createImproveRun]),T=r.useMemo(()=>Ne(e.messages,{showThinkingIndicator:k}),[e.messages,k]),h=Ce(e.messages,e.sessionId??`draft:${e.id}`),u=e.messages.at(-1),de=[e.id,e.sessionId??"draft",T.length,u?.id??"",u?.content?.length??0,u?.timestamp??"",k?"thinking":""].join(":");r.useLayoutEffect(()=>{const i=b.current;if(i){if(!C.current){C.current=!0,i.scrollTop=p?.stickyToBottom?i.scrollHeight:p?.scrollTop??0;return}l.current&&(i.scrollTop=i.scrollHeight)}},[de,p]),r.useLayoutEffect(()=>{const i=b.current;if(!i||typeof MutationObserver>"u")return;l.current&&(i.scrollTop=i.scrollHeight);const c=new MutationObserver(()=>{l.current&&(i.scrollTop=i.scrollHeight)});return c.observe(i,{childList:!0,characterData:!0,subtree:!0}),()=>c.disconnect()},[e.id]);const I=r.useCallback((i,c)=>{const m=e.sessionId??`side-chat:${e.id}`;ke({conversationId:m,href:i,explicitFile:c?.explicitFile,newTab:c?.newTab}).then(a=>{a&&A()})},[A,e.id,e.sessionId]),M=r.useCallback(async(i,c)=>{const m=c.action==="answer"?c.text:"Dismiss this question";if(!await g([],null,null,{displayPrompt:m,promptOverride:m,turnMetadata:{userQuestionResolution:c}}))throw new Error("The question response could not be sent.")},[g]);return s.jsxs("section",{className:`right-chat-pane ${e.pendingApproval?"has-approval":""}`,id:`right-chat-panel-${e.id}`,role:"tabpanel","aria-labelledby":`right-chat-tab-${e.id}`,children:[s.jsx("div",{className:"chat-thread right-chat-thread",ref:b,onScroll:i=>{const c=i.currentTarget;l.current=c.scrollHeight-c.scrollTop-c.clientHeight<=72,ie({scrollTop:c.scrollTop,stickyToBottom:l.current})},children:T.map(i=>i.type==="thinking"?s.jsx(Te,{},i.id):s.jsx(Ie,{activeWorkspaceAppId:e.activeWorkspaceAppId,accountBaseUrl:q,billingOrganizationSlug:z,billingTeamId:K,connection:y,animateInitialContent:i.message.role==="assistant"&&h.has(i.message.id),message:i.message,onOpenBrowserLink:I,onOpenAttachmentInSidebar:_,onOpenFileInSidebar:G,onOpenProfileSettings:J,onResolveUserQuestion:M,onOpenSession:Y,userAttachmentDisplay:e.provider==="codex"?"compact":"full",workspaceRootPath:e.workspaceRootPath,showFooter:i.showFooter},i.id))}),s.jsxs("div",{className:`composer-stack dock right-chat-composer ${e.pendingApproval?"has-approval":""}`,children:[s.jsx(De,{approval:e.pendingApproval,onResolve:re}),s.jsx(Ee,{mode:"dock",prompt:e.prompt,mentionApps:B,connectedAppMentions:F,profileSkills:e.provider==="codex"?L:$,profileTarget:e.provider==="codex"?null:j,selectedMentionAppId:null,contextWindowStatus:e.contextWindowStatus,goalRuntime:e.goalRuntime,createImproveRuntime:ce,busy:e.running,running:e.running,submissionScopeKey:e.sessionId??e.id,steerAutoDispatchBlocked:e.steerAutoDispatchBlocked,steerAutoDispatchReady:e.steerAutoDispatchReady,showProjectFooter:!1,connection:y,providerSettings:H,provider:e.provider,model:e.model,projectTarget:O,actionCatalog:w,workspaceTarget:W,codexPermissionMode:E,codexReasoningEffort:S,openPondCommandAccessMode:e.provider==="codex"?R:e.session?.openPondCommandAccessMode??R,onProviderChange:Z,onProviderSetupOpen:ee,onProjectTargetChange:oe,onWorkspaceTargetChange:ae,onModelChange:X,onCodexPermissionModeChange:U,onCodexReasoningEffortChange:Q,onOpenPondCommandAccessModeChange:P,onPromptChange:te,onProfileTargetChange:se,onMentionAppSelect:void 0,showToast:V,onSubmit:g,onStop:ne})]})]})}function _e({panels:e,actionCatalog:w=[],createImproveActions:x,busy:p,codexPermissionMode:E,codexReasoningEffort:S,openPondCommandAccessMode:R,connection:y,connectedAppMentions:F,mentionApps:B,codexPersonalSkills:L,profileSkills:$=[],profileLibrary:j={lastUsed:null,profiles:[]},extensionCatalog:O,projectTarget:H,providerSettings:q,accountBaseUrl:z,billingOrganizationSlug:K,billingTeamId:V,showToast:W,workspaceTarget:U,onAddChat:Q,onActivatePanel:P,onClosePanel:X,onCodexPermissionModeChange:_,onCodexReasoningEffortChange:G,onOpenPondCommandAccessModeChange:J,onModelChange:Y,onOpenAttachmentInSidebar:Z,onOpenFileInSidebar:ee,onOpenProfileSettings:te,onOpenSession:se,onProviderChange:ie,onProviderSetupOpen:oe,onPromptChange:re,onProfileTargetChange:A,onScrollStateChange:ne,onProjectTargetChange:g,onResolveApproval:ae,onResizeStart:b,onSelectFiles:l,onShowBrowserPanel:C,onStop:k,onSubmit:ce,onWorkspaceTargetChange:T}){const[h,u]=r.useState(!1),[de,I]=r.useState(()=>ve(e)?.id??null),M=r.useRef(null),i=r.useRef(new Map),c=r.useRef(new Set(e.map(t=>t.id))),m=r.useRef(new Map(e.map(t=>[t.id,t.activationVersion]))),a=e.find(t=>t.id===de)??e.at(-1)??null,fe=a?.session?.currentProfile??j.lastUsed,N=we(j,fe),he=N?xe(N,O):$,me=N?[...w.filter(t=>!Re(t)),...ye(N)]:w;r.useEffect(()=>{const t=c.current,d=m.current;let n=null,f=null;for(const o of e)t.has(o.id)||(n=o),t.has(o.id)&&o.activationVersion>(d.get(o.id)??0)&&(f=o);c.current=new Set(e.map(o=>o.id)),m.current=new Map(e.map(o=>[o.id,o.activationVersion])),I(o=>f?f.id:n?n.id:o&&e.some(D=>D.id===o)?o:e.at(-1)?.id??null)},[e]),r.useEffect(()=>{if(!h)return;function t(n){M.current?.contains(n.target)||u(!1)}function d(n){n.key==="Escape"&&u(!1)}return document.addEventListener("pointerdown",t),document.addEventListener("keydown",d),()=>{document.removeEventListener("pointerdown",t),document.removeEventListener("keydown",d)}},[h]);const v=r.useCallback((t,d=!1)=>{I(t),P(t),d&&window.requestAnimationFrame(()=>i.current.get(t)?.focus())},[P]),le=r.useCallback((t=!1)=>{l(),t&&window.requestAnimationFrame(()=>{document.getElementById("right-sidebar-files-tab")?.focus()})},[l]),pe=r.useCallback((t,d)=>{const n=e.findIndex(be=>be.id===d);if(n<0)return;const f=n+1;let o=null;if(t.key==="ArrowRight"&&(o=(f+1)%(e.length+1)),t.key==="ArrowLeft"&&(o=(f-1+e.length+1)%(e.length+1)),t.key==="Home"&&(o=0),t.key==="End"&&(o=e.length),o===null)return;if(t.preventDefault(),o===0){le(!0);return}const D=e[o-1];D&&v(D.id,!0)},[e,le,v]),ge=r.useCallback(t=>{if(!["ArrowRight","ArrowLeft","Home","End"].includes(t.key)||(t.preventDefault(),t.key==="Home"))return;const d=t.key==="ArrowLeft"||t.key==="End"?e.at(-1):e[0];d&&v(d.id,!0)},[e,v]);return s.jsxs("aside",{className:"workspace-diff-panel right-chat-panel-stack","aria-label":"Side chats",children:[s.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize side chat panel",onPointerDown:b}),s.jsx("div",{className:"workspace-diff-topbar right-chat-topbar",children:s.jsxs("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Right sidebar views",children:[s.jsxs("button",{type:"button",className:"workspace-diff-tab",role:"tab",id:"right-sidebar-files-tab","aria-controls":"right-sidebar-files-panel","aria-selected":!1,tabIndex:-1,onClick:()=>le(!1),onKeyDown:ge,children:[s.jsx(ue,{size:14}),s.jsx("span",{children:"Files"})]}),e.map(t=>{const d=t.id===a?.id;return s.jsxs("div",{className:`workspace-diff-tab right-chat-tab ${d?"active":""}`,children:[s.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab",id:`right-chat-tab-${t.id}`,"aria-controls":`right-chat-panel-${t.id}`,"aria-selected":d,tabIndex:d?0:-1,title:t.title,ref:n=>{n?i.current.set(t.id,n):i.current.delete(t.id)},onClick:()=>v(t.id),onKeyDown:n=>pe(n,t.id),children:[t.running?s.jsx("span",{className:"right-chat-status-dot","aria-label":"Running"}):null,s.jsx("span",{children:t.title})]}),s.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${t.title}`,"aria-label":`Close ${t.title}`,onClick:n=>{n.stopPropagation(),X(t.id)},children:s.jsx(je,{size:12})})]},t.id)}),s.jsxs("div",{className:"workspace-diff-add-anchor",ref:M,children:[s.jsx("button",{type:"button",className:`workspace-diff-add-tab ${h?"active":""}`,title:"Add to right sidebar","aria-label":"Add to right sidebar","aria-haspopup":"menu","aria-expanded":h,onClick:()=>u(t=>!t),children:s.jsx(Pe,{size:15})}),h?s.jsxs("div",{className:"workspace-diff-add-menu right-chat-add-popover",role:"menu",children:[s.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{u(!1),Q()},children:[s.jsx(Ae,{size:13}),s.jsx("span",{children:"New task"})]}),s.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{u(!1),l()},children:[s.jsx(ue,{size:13}),s.jsx("span",{children:"Files"})]})]}):null]})]})}),s.jsx("div",{className:"right-chat-stack-body panes-1",children:a?s.jsx(Se,{busy:p,createImproveActions:x,codexPermissionMode:E,codexReasoningEffort:S,openPondCommandAccessMode:R,connection:y,connectedAppMentions:F,actionCatalog:me,mentionApps:B,codexPersonalSkills:L,profileSkills:he,profileTarget:null,panel:a,initialScrollState:{scrollTop:a.scrollTop,stickyToBottom:a.stickyToBottom},projectTarget:H,providerSettings:q,accountBaseUrl:z,billingOrganizationSlug:K,billingTeamId:V,showToast:W,workspaceTarget:U,onCodexPermissionModeChange:_,onCodexReasoningEffortChange:G,onOpenPondCommandAccessModeChange:t=>J(t,a.session),onModelChange:t=>Y(a.id,t),onOpenAttachmentInSidebar:Z,onOpenFileInSidebar:ee,onOpenProfileSettings:te,onOpenSession:se,onProviderChange:t=>ie(a.id,t),onProviderSetupOpen:oe,onPromptChange:t=>re(a.id,t),onProfileTargetChange:t=>A(a.sessionId,t),onScrollStateChange:t=>ne(a.id,t),onProjectTargetChange:g,onResolveApproval:ae,onShowBrowserPanel:C,onStop:()=>k(a.sessionId),onSubmit:(t,d,n,f)=>ce(a.id,t,d,n,f),onWorkspaceTargetChange:T},a.id):null})]})}export{_e as RightChatPanelStack};
@@ -0,0 +1 @@
1
+ import{r as i,n as $,j as e,aL as oe,bT as ue,Z as he,X as me,b1 as G,A as xe,at as _,bU as fe}from"./index-Cxq5q-6B.js";import{u as je,R as X}from"./useLocalAgentSchedules-DRVUfTbv.js";import{M as pe,A as be,T as ye,P as J}from"./MarkdownText-CzZ60aWs.js";import{P as Q}from"./play-DGCzapdE.js";import{R as ve}from"./refresh-cw-BKF4NhDI.js";import{S as ge}from"./save-DQXtfx_4.js";const we=3e4;function Ne(s){const[t,n]=i.useState([]),[l,d]=i.useState([]),[j,u]=i.useState(null),[o,a]=i.useState(!1),[r,f]=i.useState(null),[R,v]=i.useState(()=>new Set);async function N(c,p){p&&a(!0);try{const y=await $.hostedSavedWork(c);n(y.definitions),d(y.runs),u(y.webBaseUrl??null),f(null)}catch(y){f(U(y))}finally{p&&a(!1)}}i.useEffect(()=>{if(!s){n([]),d([]),u(null),f(null),a(!1);return}let c=!1;const p=async k=>{if(!c){k&&a(!0);try{const w=await $.hostedSavedWork(s);if(c)return;n(w.definitions),d(w.runs),u(w.webBaseUrl??null),f(null)}catch(w){c||f(U(w))}finally{!c&&k&&a(!1)}}};p(!0);const y=window.setInterval(()=>{p(!1)},we);return()=>{c=!0,window.clearInterval(y)}},[s]);async function b(){s&&await N(s,!0)}async function D(c){s&&(await $.createHostedSavedWork(s,c),await N(s,!1))}async function A(c,p){await x(c,async y=>{await $.updateHostedSavedWork(y,c,p)})}async function S(c){await x(c,async p=>{await $.deleteHostedSavedWork(p,c)})}async function E(c){await x(c,async p=>{await $.runHostedSavedWork(p,c,crypto.randomUUID())})}async function x(c,p){if(!(!s||R.has(c))){g(c,!0);try{await p(s),await N(s,!1)}catch(y){throw f(U(y)),y}finally{g(c,!1)}}}function g(c,p){v(y=>{const k=new Set(y);return p?k.add(c):k.delete(c),k})}return{create:D,definitions:t,error:r,loading:o,pendingScheduleIds:R,refresh:b,remove:S,run:E,runs:l,update:A,webBaseUrl:j}}function U(s){return s instanceof Error?s.message:String(s)}const ee="openpond.scheduled-work.view.v1";function Se(s=se()){try{return s?.getItem(ee)==="list"?"list":"calendar"}catch{return"calendar"}}function ke(s,t=se()){try{t?.setItem(ee,s)}catch{}}function se(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function M(s,t){if(!s)return"None";const n=new Date(s);if(!Number.isFinite(n.getTime()))return"None";try{return n.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",...t?{timeZone:t,timeZoneName:"short"}:{}})}catch{return n.toLocaleString()}}function te(s){return F(s.replaceAll("_"," "))}function F(s){return s.replace(/^./,t=>t.toUpperCase())}function Re({run:s}){const t=s.error||s.stderr||s.stdout;return e.jsxs("details",{className:"scheduled-run-row",children:[e.jsxs("summary",{children:[e.jsxs("span",{children:[e.jsx("strong",{children:te(s.status)}),e.jsx("small",{children:M(s.createdAt,null)})]}),e.jsx("span",{className:"scheduled-run-trigger",children:s.trigger==="manual"?"Manual":"Scheduled"})]}),t?e.jsx("pre",{children:t}):null]})}function De({onOpen:s,run:t}){return e.jsxs("button",{className:"scheduled-run-row hosted",onClick:s,type:"button",children:[e.jsxs("span",{children:[e.jsx("strong",{children:te(t.status)}),e.jsx("small",{children:M(t.createdAt,null)})]}),e.jsxs("span",{className:"scheduled-run-trigger",children:[F(t.triggerKind)," ",e.jsx(G,{size:11})]}),t.deliveryError?e.jsx("p",{children:t.deliveryError}):null]})}function ne({children:s,detailExpanded:t,label:n,onClose:l,onDetailResizeStart:d,onToggleDetailExpanded:j}){return e.jsxs("aside",{"aria-label":n,className:`workspace-diff-panel scheduled-detail${t?" expanded":""}`,children:[t?null:e.jsx("div",{"aria-label":"Resize schedule details","aria-orientation":"vertical",className:"workspace-diff-resize-handle",onPointerDown:d,role:"separator"}),e.jsxs("div",{className:"workspace-diff-topbar",children:[e.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Schedule details",children:e.jsxs("button",{"aria-selected":"true",className:"workspace-diff-tab active",role:"tab",type:"button",children:[e.jsx(ue,{size:14}),e.jsx("span",{children:"Schedule"})]})}),e.jsxs("div",{className:"workspace-diff-toolbar-actions",children:[e.jsx("button",{"aria-label":t?"Dock schedule details":"Expand schedule details",className:"diff-icon-button",onClick:j,title:t?"Dock schedule details":"Expand schedule details",type:"button",children:t?e.jsx(pe,{size:14}):e.jsx(he,{size:14})}),e.jsx("button",{"aria-label":"Close schedule details",className:"diff-icon-button",onClick:l,title:"Close schedule details",type:"button",children:e.jsx(me,{size:14})})]})]}),e.jsx("div",{className:"scheduled-detail-body",children:s})]})}function T({children:s,title:t}){return e.jsxs("section",{className:"scheduled-detail-section",children:[e.jsx("div",{className:"scheduled-detail-section-heading",children:e.jsx("h3",{children:t})}),s]})}function C({label:s,value:t}){return e.jsxs("div",{children:[e.jsx("dt",{children:s}),e.jsx("dd",{children:t})]})}function O({children:s}){return e.jsx("p",{className:"scheduled-empty",children:s})}function le({label:s}){return e.jsxs("div",{className:"scheduled-loading",role:"status",children:[e.jsx(oe,{className:"scheduled-spin",size:16}),e.jsx("span",{children:s})]})}const Ae=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Ce({items:s,onSelect:t,selectedKey:n}){const[l,d]=i.useState(()=>q(new Date)),j=i.useMemo(()=>$e(l),[l]),u=i.useMemo(()=>Me(s),[s]),o=new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}).format(l),a=s.filter(r=>!ae(r.nextRunAt));return e.jsxs("div",{className:"scheduled-calendar",children:[e.jsxs("div",{className:"scheduled-calendar-toolbar",children:[e.jsx("strong",{children:o}),e.jsxs("div",{children:[e.jsx("button",{"aria-label":"Previous month",className:"scheduled-icon-button",onClick:()=>d(V(l,-1)),type:"button",children:e.jsx(xe,{size:15})}),e.jsx("button",{className:"scheduled-calendar-today",onClick:()=>d(q(new Date)),type:"button",children:"Today"}),e.jsx("button",{"aria-label":"Next month",className:"scheduled-icon-button",onClick:()=>d(V(l,1)),type:"button",children:e.jsx(be,{size:15})})]})]}),e.jsxs("div",{className:"scheduled-calendar-grid",role:"grid","aria-label":o,children:[Ae.map(r=>e.jsx("div",{className:"scheduled-calendar-weekday",role:"columnheader",children:r},r)),j.map(r=>{const f=K(r),R=u.get(f)??[],v=r.getMonth()!==l.getMonth(),N=f===K(new Date);return e.jsxs("div",{className:`scheduled-calendar-day${v?" outside":""}${N?" today":""}`,role:"gridcell",children:[e.jsx("span",{className:"scheduled-calendar-day-number",children:r.getDate()}),e.jsx("div",{className:"scheduled-calendar-events",children:R.map(b=>e.jsxs("button",{"aria-current":n===b.key?"true":void 0,className:`scheduled-calendar-event${b.enabled?"":" paused"}`,onClick:()=>t(b.key),title:b.title,type:"button",children:[e.jsx("span",{children:Ee(b.nextRunAt)}),e.jsx("strong",{children:b.title})]},b.key))})]},f)})]}),a.length?e.jsxs("div",{className:"scheduled-calendar-unscheduled",children:[e.jsx("span",{children:"No upcoming run"}),e.jsx("div",{children:a.map(r=>e.jsx("button",{onClick:()=>t(r.key),type:"button",children:r.title},r.key))})]}):null]})}function $e(s){const t=new Date(s.getFullYear(),s.getMonth(),1),n=new Date(t);return n.setDate(t.getDate()-t.getDay()),Array.from({length:42},(l,d)=>{const j=new Date(n);return j.setDate(n.getDate()+d),j})}function Me(s){const t=new Map;for(const n of s){const l=ae(n.nextRunAt);if(!l)continue;const d=K(l);t.set(d,[...t.get(d)??[],n])}for(const n of t.values())n.sort((l,d)=>l.nextRunAt.localeCompare(d.nextRunAt));return t}function ae(s){if(!s)return null;const t=new Date(s);return Number.isNaN(t.getTime())?null:t}function K(s){return`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")}`}function q(s){return new Date(s.getFullYear(),s.getMonth(),1)}function V(s,t){return new Date(s.getFullYear(),s.getMonth()+t,1)}function Ee(s){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(new Date(s))}function Te({cadence:s,onSelect:t,schedule:n,selected:l}){return e.jsxs("button",{"aria-current":l?"true":void 0,className:"scheduled-list-row",onClick:t,type:"button",children:[e.jsx("span",{className:`scheduled-status-dot ${n.enabled?"active":"paused"}`}),e.jsxs("span",{className:"scheduled-list-copy",children:[e.jsx("span",{className:"scheduled-list-title",children:e.jsx("strong",{children:n.scheduleName})}),e.jsx("span",{children:n.localProjectName}),e.jsxs("small",{children:[s,n.nextRunAt?` · Next ${M(n.nextRunAt,n.timezone)}`:" · No next run"]})]})]})}function Le({cadence:s,definition:t,onSelect:n,schedule:l,selected:d}){return e.jsxs("button",{"aria-current":d?"true":void 0,className:"scheduled-list-row",onClick:n,type:"button",children:[e.jsx("span",{className:`scheduled-status-dot ${l.enabled?"active":"paused"}`}),e.jsxs("span",{className:"scheduled-list-copy",children:[e.jsxs("span",{className:"scheduled-list-title",children:[e.jsx("strong",{children:t.name}),e.jsx("small",{className:"scheduled-environment-badge hosted",children:"Hosted"})]}),e.jsx("span",{children:t.prompt}),e.jsxs("small",{children:[s,l.nextRunAt?` · Next ${M(l.nextRunAt,l.timeZone)}`:" · No next run"]})]})]})}const ze=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ts({connection:s,detailOpen:t,detailExpanded:n,onDetailOpenChange:l,onDetailResizeStart:d,onToggleDetailExpanded:j}){const u=Ne(s),o=je(s),[a,r]=i.useState("all"),[f,R]=i.useState(Se),[v,N]=i.useState(!1),[b,D]=i.useState(null),A=i.useMemo(()=>Pe(u.definitions),[u.definitions]),S=i.useMemo(()=>Fe(A,a),[a,A]),E=i.useMemo(()=>Ze(o.schedules,a),[a,o.schedules]),x=A.find(h=>I(h.schedule.id)===b)??null,g=o.schedules.find(h=>W(h.id)===b)??null,c=x?u.runs.filter(h=>h.scheduleId===x.schedule.id):[],p=i.useMemo(()=>Ue(E,S),[E,S]),y=i.useMemo(()=>p.map(Oe),[p]);_(u.error,{prefix:"Scheduled Work"}),_(o.error,{prefix:"Local schedules"}),i.useEffect(()=>{b&&!x&&!g&&D(null)},[x,g,b]),i.useEffect(()=>{!t&&b&&D(null)},[t,b]),i.useEffect(()=>()=>l(!1),[l]);function k(h){D(h),l(!0)}function w(){D(null),l(!1)}function P(h){R(h),ke(h)}async function z(){N(!0);try{await Promise.all([u.refresh(),o.refresh()])}finally{N(!1)}}return e.jsxs("section",{"aria-label":"Scheduled work",className:`scheduled-work-view${x||g?" detail-open":""}${n?" detail-expanded":""}`,children:[e.jsx("div",{className:"scheduled-work-scroll",children:e.jsxs("div",{className:"scheduled-work-content",children:[e.jsxs("header",{className:"scheduled-work-header",children:[e.jsxs("div",{"aria-label":"Scheduled view",className:"scheduled-view-tabs",role:"tablist",children:[e.jsx("button",{"aria-selected":f==="calendar",className:f==="calendar"?"active":void 0,onClick:()=>P("calendar"),role:"tab",type:"button",children:"Calendar"}),e.jsx("button",{"aria-selected":f==="list",className:f==="list"?"active":void 0,onClick:()=>P("list"),role:"tab",type:"button",children:"List"})]}),e.jsxs("div",{className:"scheduled-work-header-actions",children:[e.jsx("button",{"aria-label":"Refresh schedules",className:"scheduled-icon-button",disabled:!s||u.loading||o.loading,onClick:()=>{z()},title:"Refresh schedules",type:"button",children:e.jsx(ve,{className:v?"scheduled-spin":void 0,size:16})}),e.jsxs("label",{className:"scheduled-filter",children:[e.jsx(fe,{"aria-hidden":"true",size:16}),e.jsxs("select",{"aria-label":"Schedule filter",onChange:h=>r(h.target.value),value:a,children:[e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"paused",children:"Paused"}),e.jsx("option",{value:"all",children:"All"})]})]})]})]}),e.jsx("section",{"aria-busy":u.loading||o.loading,className:"scheduled-list",children:s?(u.loading||o.loading)&&A.length===0&&o.schedules.length===0?e.jsx(le,{label:"Loading schedules"}):u.error&&o.error&&A.length===0&&o.schedules.length===0?e.jsx(O,{children:"Schedules are unavailable. Refresh to try again."}):p.length===0?e.jsx(O,{children:"Create a scheduled task here or ask for one in Work."}):f==="calendar"?e.jsx(Ce,{items:y,onSelect:k,selectedKey:b}):e.jsx("div",{className:"scheduled-list-rows",children:p.map(h=>h.kind==="local"?e.jsx(Te,{cadence:re(h.schedule),onSelect:()=>k(W(h.schedule.id)),schedule:h.schedule,selected:b===W(h.schedule.id)},W(h.schedule.id)):e.jsx(Le,{cadence:_e(h.row.schedule),definition:h.row.definition,onSelect:()=>k(I(h.row.schedule.id)),schedule:h.row.schedule,selected:b===I(h.row.schedule.id)},I(h.row.schedule.id)))}):e.jsx(O,{children:"Connect to OpenPond to view scheduled Work."})})]})}),x?e.jsx(Ie,{onClose:w,onDelete:async()=>{await u.remove(x.schedule.id),w()},onRun:()=>u.run(x.schedule.id),onSave:h=>u.update(x.schedule.id,h),onToggle:()=>u.update(x.schedule.id,{enabled:!x.schedule.enabled}),pending:u.pendingScheduleIds.has(x.schedule.id),row:x,runs:c,detailExpanded:n,onDetailResizeStart:d,onToggleDetailExpanded:j,webBaseUrl:u.webBaseUrl},`${x.schedule.id}:${x.definition.version}:${x.schedule.configurationVersion}`):g?e.jsx(We,{connection:s,onClose:w,onRun:()=>o.run(g),onToggle:()=>o.toggle(g),pending:o.pendingScheduleIds.has(g.id),schedule:g,detailExpanded:n,onDetailResizeStart:d,onToggleDetailExpanded:j},g.id):null]})}function We({connection:s,detailExpanded:t,onClose:n,onDetailResizeStart:l,onRun:d,onToggleDetailExpanded:j,onToggle:u,pending:o,schedule:a}){const r=qe(s,a.id);return _(r.error,{prefix:"Local schedule runs"}),e.jsxs(ne,{detailExpanded:t,label:`${a.scheduleName} details`,onClose:n,onDetailResizeStart:l,onToggleDetailExpanded:j,children:[e.jsx("div",{className:"scheduled-detail-header",children:e.jsxs("div",{children:[e.jsxs("div",{className:"scheduled-detail-title-row",children:[e.jsx("h2",{children:"Schedule details"}),e.jsx("span",{children:a.enabled?"Active":"Paused"})]}),e.jsx("p",{children:a.scheduleName})]})}),e.jsxs(T,{title:"Task",children:[e.jsxs("dl",{className:"scheduled-detail-fields",children:[e.jsx(C,{label:"Environment",value:"Local"}),e.jsx(C,{label:"Project",value:a.localProjectName}),e.jsx(C,{label:"Agent",value:a.agentName}),e.jsx(C,{label:"Action",value:a.targetAction})]}),e.jsx("pre",{className:"scheduled-prompt",children:He(a)})]}),e.jsxs(T,{title:"Schedule",children:[e.jsxs("dl",{className:"scheduled-detail-fields",children:[e.jsx(C,{label:"Cadence",value:re(a)}),e.jsx(C,{label:"Expression",value:a.scheduleExpression}),e.jsx(C,{label:"Timezone",value:a.timezone??"Local time"}),e.jsx(C,{label:"Next run",value:M(a.nextRunAt,a.timezone)}),e.jsx(C,{label:"Last run",value:M(a.lastRunAt,a.timezone)})]}),a.lastError?e.jsx("p",{className:"scheduled-detail-error",children:a.lastError}):null]}),e.jsxs("div",{className:"scheduled-detail-actions",children:[e.jsxs("button",{disabled:o,onClick:()=>{d()},type:"button",children:[e.jsx(X,{size:15}),e.jsx("span",{children:"Run now"})]}),e.jsxs("button",{disabled:o,onClick:()=>{u()},type:"button",children:[a.enabled?e.jsx(J,{size:15}):e.jsx(Q,{size:15}),e.jsx("span",{children:a.enabled?"Pause":"Resume"})]})]}),e.jsx(T,{title:"Runs",children:r.loading&&r.runs.length===0?e.jsx(le,{label:"Loading runs"}):r.runs.length===0?e.jsx("p",{className:"scheduled-no-runs",children:"No runs yet."}):e.jsx("div",{className:"scheduled-run-list",children:r.runs.map(f=>e.jsx(Re,{run:f},f.id))})})]})}function Ie({detailExpanded:s,onClose:t,onDelete:n,onDetailResizeStart:l,onRun:d,onSave:j,onToggleDetailExpanded:u,onToggle:o,pending:a,row:r,runs:f,webBaseUrl:R}){const v=Ke(r.schedule),[N,b]=i.useState(r.definition.name),[D,A]=i.useState(r.definition.prompt),[S,E]=i.useState(v.kind),[x,g]=i.useState(v.timeZone),[c,p]=i.useState(v.startDate),[y,k]=i.useState(v.localTime),[w,P]=i.useState(v.weekdays?.[0]??"monday"),[z,h]=i.useState(v.dayOfMonth??1),H=f[0]?.conversationId??null,Z=R?Y(R,H):null,de=N!==r.definition.name||D!==r.definition.prompt||S!==v.kind||x!==v.timeZone||c!==v.startDate||y!==v.localTime||w!==(v.weekdays?.[0]??"monday")||z!==(v.dayOfMonth??1);async function ce(m){m.preventDefault(),await j({name:N,prompt:D,recurrence:{version:1,kind:S,timeZone:x,startDate:c,localTime:y,end:{kind:"never"},...S==="weekly"?{weekdays:[w]}:{},...S==="monthly"?{dayOfMonth:z}:{}}})}return e.jsx(ne,{detailExpanded:s,label:`${r.definition.name} details`,onClose:t,onDetailResizeStart:l,onToggleDetailExpanded:u,children:e.jsxs("form",{onSubmit:ce,children:[e.jsxs("div",{className:"scheduled-detail-header",children:[e.jsx("div",{children:e.jsxs("div",{className:"scheduled-detail-title-row",children:[e.jsx("h2",{children:"Schedule details"}),e.jsx("span",{children:r.schedule.enabled?"Active":"Paused"})]})}),e.jsx("div",{className:"scheduled-detail-header-controls",children:e.jsx("button",{"aria-label":"Delete schedule",className:"scheduled-icon-button",disabled:a,onClick:()=>{n()},title:"Delete schedule",type:"button",children:e.jsx(ye,{size:16})})})]}),e.jsxs(T,{title:"Task",children:[e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Name"}),e.jsx("input",{maxLength:180,onChange:m=>b(m.target.value),required:!0,value:N})]}),e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Prompt"}),e.jsx("textarea",{onChange:m=>A(m.target.value),required:!0,value:D})]})]}),e.jsxs(T,{title:"Schedule",children:[e.jsxs("div",{className:"scheduled-field-grid",children:[e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Repeat"}),e.jsxs("select",{onChange:m=>E(m.target.value),value:S,children:[e.jsx("option",{value:"once",children:"Once"}),e.jsx("option",{value:"daily",children:"Daily"}),e.jsx("option",{value:"weekdays",children:"Weekdays"}),e.jsx("option",{value:"weekly",children:"Weekly"}),e.jsx("option",{value:"monthly",children:"Monthly"})]})]}),S==="weekly"?e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Day"}),e.jsx("select",{onChange:m=>P(m.target.value),value:w,children:ze.map(m=>e.jsx("option",{value:m,children:F(m)},m))})]}):S==="monthly"?e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Day of month"}),e.jsx("input",{max:31,min:1,onChange:m=>h(Number(m.target.value)),type:"number",value:z})]}):null,e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Start date"}),e.jsx("input",{onChange:m=>p(m.target.value),required:!0,type:"date",value:c})]}),e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Time"}),e.jsx("input",{onChange:m=>k(m.target.value),required:!0,type:"time",value:y})]}),e.jsxs("label",{className:"scheduled-field scheduled-field-wide",children:[e.jsx("span",{children:"Timezone"}),e.jsx("input",{onChange:m=>g(m.target.value),required:!0,value:x})]})]}),e.jsxs("p",{className:"scheduled-next-run",children:["Next run: ",M(r.schedule.nextRunAt,v.timeZone)]})]}),e.jsxs("div",{className:"scheduled-detail-actions",children:[de?e.jsxs("button",{disabled:a,type:"submit",children:[e.jsx(ge,{size:15}),e.jsx("span",{children:"Save"})]}):null,e.jsxs("button",{disabled:a,onClick:()=>{d()},type:"button",children:[e.jsx(X,{size:15}),e.jsx("span",{children:"Run now"})]}),e.jsxs("button",{disabled:a,onClick:()=>{o()},type:"button",children:[r.schedule.enabled?e.jsx(J,{size:15}):e.jsx(Q,{size:15}),e.jsx("span",{children:r.schedule.enabled?"Pause":"Resume"})]})]}),e.jsxs("button",{className:"scheduled-open-chat",disabled:a||!Z,onClick:()=>{Z&&B(Z,H)},type:"button",children:[e.jsx("span",{children:"Open hosted chat"}),e.jsx(G,{size:14})]}),e.jsx(T,{title:"Runs",children:f.length===0?e.jsx("p",{className:"scheduled-no-runs",children:"No runs yet."}):e.jsx("div",{className:"scheduled-run-list",children:f.map(m=>e.jsx(De,{onOpen:()=>{R&&B(Y(R,m.conversationId),m.conversationId)},run:m},m.id))})})]})})}function Pe(s){return s.flatMap(t=>t.schedules.map(n=>({definition:t,schedule:n})))}function Fe(s,t){return s.filter(n=>t==="active"?n.schedule.enabled:t==="paused"?!n.schedule.enabled:!0).sort((n,l)=>L(n.schedule.nextRunAt)-L(l.schedule.nextRunAt)||n.definition.name.localeCompare(l.definition.name))}function Ze(s,t){return s.filter(n=>t==="active"?n.enabled:t==="paused"?!n.enabled:!0).sort((n,l)=>L(n.nextRunAt)-L(l.nextRunAt)||n.scheduleName.localeCompare(l.scheduleName))}function Ue(s,t){return[...s.map(n=>({kind:"local",schedule:n})),...t.map(n=>({kind:"hosted",row:n}))].sort((n,l)=>{const d=L(n.kind==="local"?n.schedule.nextRunAt:n.row.schedule.nextRunAt),j=L(l.kind==="local"?l.schedule.nextRunAt:l.row.schedule.nextRunAt);if(d!==j)return d-j;const u=n.kind==="local"?n.schedule.scheduleName:n.row.definition.name,o=l.kind==="local"?l.schedule.scheduleName:l.row.definition.name;return u.localeCompare(o)})}function Oe(s){return s.kind==="local"?{enabled:s.schedule.enabled,key:W(s.schedule.id),nextRunAt:s.schedule.nextRunAt,title:s.schedule.scheduleName}:{enabled:s.row.schedule.enabled,key:I(s.row.schedule.id),nextRunAt:s.row.schedule.nextRunAt,title:s.row.definition.name}}function _e(s){const t=s.recurrence;if(!t)return s.expression??"Manual";const n=ie(t.localTime);return t.kind==="once"?`Once on ${t.startDate} at ${n} · ${t.timeZone}`:t.kind==="weekdays"?`Weekdays at ${n} · ${t.timeZone}`:t.kind==="weekly"?`${t.weekdays?.map(F).join(", ")??"Weekly"} at ${n} · ${t.timeZone}`:t.kind==="monthly"?`Monthly on day ${t.dayOfMonth??1} at ${n} · ${t.timeZone}`:`Daily at ${n} · ${t.timeZone}`}function re(s){const t=s.timezone?` · ${s.timezone}`:"";if(s.scheduleType==="rate")return`Every ${s.scheduleExpression}${t}`;const n=s.scheduleExpression.trim().split(/\s+/);if(n.length===5&&/^\d+$/.test(n[0])&&/^\d+$/.test(n[1])){const l=ie(`${n[1].padStart(2,"0")}:${n[0].padStart(2,"0")}`);if(n[2]==="*"&&n[3]==="*"&&n[4]==="*")return`Daily at ${l}${t}`;if(n[2]==="*"&&n[3]==="*"&&n[4]==="MON-FRI")return`Weekdays at ${l}${t}`}return`Cron ${s.scheduleExpression}${t}`}function Ke(s){return s.recurrence??{version:1,kind:"daily",timeZone:s.timeZone||Ye(),startDate:Ve(),localTime:"08:00",end:{kind:"never"}}}function He(s){const t=s.input.prompt;return typeof t=="string"&&t.trim()?t.trim():Object.keys(s.input).length>0?JSON.stringify(s.input,null,2):"No task input configured."}function qe(s,t){const[n,l]=i.useState([]),[d,j]=i.useState(!1),[u,o]=i.useState(null);return i.useEffect(()=>{if(!s){l([]),j(!1),o(null);return}let a=!1;return j(!0),$.localAgentScheduleRuns(s,t,{limit:20}).then(r=>{a||(l(r.runs),o(null))}).catch(r=>{a||o(Be(r))}).finally(()=>{a||j(!1)}),()=>{a=!0}},[s,t]),{error:u,loading:d,runs:n}}function W(s){return`local:${s}`}function I(s){return`hosted:${s}`}function Y(s,t){const n=new URL(s);return n.pathname=t?`/sandboxes/work/${encodeURIComponent(t)}`:"/sandboxes/work",n.search="",n.hash="",n.toString()}async function B(s,t){const n=window.openpond?.browser;n?.openExternal&&(await n.openExternal({conversationId:t??"hosted-scheduled-work",url:s})).ok||window.open(s,"_blank","noopener,noreferrer")}function ie(s){const[t="0",n="00"]=s.split(":");return new Date(2020,0,1,Number(t),Number(n)).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function L(s){if(!s)return Number.MAX_SAFE_INTEGER;const t=new Date(s).getTime();return Number.isFinite(t)?t:Number.MAX_SAFE_INTEGER}function Ve(){return new Date().toISOString().slice(0,10)}function Ye(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}function Be(s){return s instanceof Error?s.message:String(s)}export{ts as ScheduledWorkPage,Ue as combineScheduleRows,Ze as filterAndSortLocalSchedules,Fe as filterAndSortSchedules,M as formatScheduledRunAt,Y as hostedConversationUrl,re as localScheduleCadence,_e as scheduleCadence,Pe as scheduledRows};